akhauriyash/Code-Regression huggingface dataset:
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, t, mini = 1001;
  cin >> n >> t;
  REP(i,n) {
    int c, ti;
    cin >> c >> ti;
    if(ti > t) continue;
    mini = min(mini,c);
  }
  if(mini == 1001) cout << "TLE" << endl;
  else cout << mini << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;

using mint = modint998244353;

struct S {
    mint a;
    mint coef; // aが2桁だったら100
    S(mint a=0, mint coef=1): a(a), coef(coef) {}
};

// struct F {
//     mint a, b;
// }; //今回Fはint

S op(S l, S r) { return S{l.a * r.coef + r.a, l.coef * r.coef}; } // datをまとめる

S e() { return S(); } // 初期値

const mint inv9 = (mint)1 / 9;

S mapping(int l, S r) {
    if (l == 0) return r;
    return S{l * (r.coef - 1) * inv9, r.coef};
} // Ai ←　b * Ai + c の計算

int composition(int l, int r) {
    if (l == 0) return r;
    return l; // rが先の演算、lが後の演算で関数を合成
}

int id() { return 0; } // 恒等写像（この関数では値が変わらない）
// vector<S> a(n); lazy_segtree<S, op, e, F, mapping, composition, id> seg(A);
// seg.apply(l, r, F{c, d}); seg.prod(l, r).a.val(); // 半開区間

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<S> A(N);
    // rep(i, N) A[i] = S{1, 10};
    lazy_segtree<S, op, e, int, mapping, composition, id> seg(A);
    rep(i, N) seg.set(i, S{1, 10});
    rep(i, Q) {
        int l, r, d;
        scanf("%d %d %d", &l, &r, &d);
        --l;
        seg.apply(l, r, d);
        S ans = seg.prod(0, N);
        printf("%d\n", ans.a.val());
    }
    return 0;
}

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

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

    vector<int> v(n);
    map<int,int> m;

    for(int i = 0; i < n; i++){
        cin >> v[i];
        m[v[i]] = i;
    }

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

    int ans = 0;
    for(int i = 0; i < n; i += 2){
        if(i%2 != m[v[i]]%2){
            ans++;
        }
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 5376
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll inf = 1 << 30;
const ll mod = 1000000000 + 7;

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

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

	ll cnt = 0;
	int r = 0;
	ll s0 = 0, s1 = 0;
	for (int l = 0; l < n; l++)
	{
		while (r < n && (s0 ^ a.at(r)) == s1 + a.at(r))
		{
			s0 ^= a.at(r);
			s1 += a.at(r);
			r++;
		}

		if (s0 == s1)
		{
			cnt += r - l;
		}

		if (l == r)
		{
			r++;
		}
		else
		{
			s0 ^= a.at(l);
			s1 -= a.at(l);
		}
	}

	cout << cnt << endl;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

int main(){
  int n;
  scanf("%d", &n);
  n++;
  vector<char> str(n);
  REP(i, n){
    scanf("%c", &str.at(i));
  }
  int count = 0;
  REP(x, n-2){
    if(str.at(x) == 'A' && str.at(x + 1) == 'B' && str.at(x + 2) == 'C'){
      count += 1;
    }
  }
  printf("%d\n", count);
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var r, g, b, n int
	fmt.Scan(&r, &g, &b, &n)

	ans := 0
	for i := 0; i*r <= n; i++ {
		for j := 0; i*r+j*g <= n; j++ {
			if k := (n - i*r - j*g) % b; k == 0 {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}inline void read(i64 &x){
	x=0;i64 f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
const int maxn=100005;
int a[maxn];
int n,l;
int main(){
	read(n);read(l);
	rep(i,1,n)read(a[i]);
	rep(i,1,n-1){
		if(a[i]+a[i+1]>=l){
			vector<int> ans;
			puts("Possible");
			ans.pb(i);
			rep(k,i+1,n-1)ans.pb(k);
			per(k,i-1,1)ans.pb(k);
			for(int i=ans.size()-1;i>=0;i--)
				printf("%d\n",ans[i]);
			return 0;
		}
	}
			return puts("Impossible"),0;
	return 0;
}

Measured memory_bytes: 1656
// Last Change: 04/19/2020 21:08:28.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

const double PI = acos(-1);

int main() {
  double R;
  cin >> R;
  cout << 2 * R * PI << endl;
}


Measured memory_bytes: 3264
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
int main()
{
	long a,b,k;
	cin>>a>>b>>k;
	for(int i=0;i<k/2;i++)
	{
		a-=a%2;
		b+=a/2;
		a/=2;
		b-=b%2;
		a+=b/2;
		b/=2;
	}
	if(k%2)a-=a%2,b+=a/2,a/=2;
	cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<endl
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define endl "\n"
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
bool compare(pair<ll,ll> p1,pair<ll,ll> p2){
return p1.se<p2.se;
}
ll sum(ll n){
return (n*(n+1))/2;
}
void solve(){
ll n,sum=0;
cin>>n;
fr(i,1,n+1){
fr(j,1,n+1){
fr(k,1,n+1){
sum+=__gcd(i,__gcd(j,k));
}
}
}
cout<<sum<<endl;
}
int main()
{   fast;
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 3640
s = input()

count = 0
ans = 0
for i in range(len(s)):
  if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
    count += 1
    ans = max(ans, count)
  else:
    count = 0

print(ans)


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

/* 公倍を求める関数 */
vector<int> divisor(int num){
    vector<int> vec;
    for(int i = 1;i <= num; i++){
        if(num%i == 0){
            vec.push_back(i);
        }
    }
    return vec;
}

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    vector<int> a_div;
    vector<int> b_div;
    vector<int> ans;
    a_div = divisor(a);
    b_div = divisor(b);
    set_intersection(a_div.begin(), a_div.end(), b_div.begin(), b_div.end(), back_inserter(ans));

    sort(ans.rbegin(), ans.rend()); // 降順にソート
    cout << ans.at(k-1) << endl;



}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
ans = ""

diff_x = abs(tx-sx)
diff_y = abs(ty-sy)

# 最短距離で行って戻る
ans += "U" * diff_y + "R" * diff_x
ans += "D" * diff_y + "L" * diff_x

# 一歩左に進んでから、ty+1の位置まで上に進む。
ans += "L" * 1 + "U" * (diff_y+1)
# txの位置まで右に進んでから、一歩下に進む。
ans += "R" * (diff_x+1) + "D" * 1

# 一歩右に進んでから、sy-1の位置まで下に進む。
ans += "R" * 1 + "D" * (diff_y+1)
# sxの位置まで左に進んでから、一歩上に進む。
ans += "L" * (diff_x+1) + "U" * 1

print(ans)


Measured memory_bytes: 3316
(set! *unchecked-math* true)
(defn input []
  (vector
    (->> (clojure.string/split (read-line) #"\s")
      (map #(Integer/parseInt %)))
    (apply vector (read-line))
    (apply vector (read-line))))

(defn gcd [A B]
  (.gcd (BigInteger. (str A)) (BigInteger. (str B))))

(defn lcm [a b]
  (quot (* (bigint a) (bigint b)) (gcd a b)))

(defn first-inner [N S L]
  (zipmap (range 0 L (quot L N)) S))

(defn second-inner [M T L X]
  (let [Number (quot L M)]
    (loop [t T i 0]
      (if (empty? t)
        true
        (if-let [v (find X i)]
          (if (not= (v 1) (first t))
            false
            (recur (rest t) (unchecked-add-int i Number)))
          (recur (rest t) (unchecked-add-int i Number)))))))


(defn TwoAbbreviation [[[N M] S T]]
  (let [L (lcm N M)]
    (if (->> (first-inner N S L) (second-inner M T L))
      (str L)
      -1)))

(->> (input)
  TwoAbbreviation
  println)


Measured memory_bytes: 95992
#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 <fstream>
#include <iomanip>
#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);
}

struct Edge {
	int from, to, weight;

	bool operator < (const Edge& obj) const {
		return weight < obj.weight;
	}
	bool operator > (const Edge& obj) const {
		return weight > obj.weight;
	}
};

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //ｘの入ってる集合と yの入ってる集合を併合
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //xとyが同じ集合に入っているかどうかを判定
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int main()
{
	int m;
	cin >> m;
	cout << (24 - m) + 24 << endl;

	return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define optimize() ios_base ::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n";
using namespace std;

 
int main()
{
 int i,n,k,l,m,c,d,p,sum=0,c3,c4,sum1=0;
 string s="ALC";
 cin>>n;
 for(i=0;i<n;i++)
 {
   cout<<"ACL";
 }
 
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cmath>
using namespace std;
int main(void){
	int w,a,b;
	cin>>w>>a>>b;
	int smaller = min(a,b);
	int larger = max(a,b);
	if(smaller + w >= larger)cout<<0<<endl;
	else cout<<(larger - smaller -w)<<endl;
	return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;

void solve(){
	int n,k;
	cin>>n>>k;
	int h[n];
	rep(i,0,n)cin>>h[i];
	int minc[n];
	rep(i,0,n)minc[i]=inf;
	minc[n-1]=0;
	rep(i,0,k){
		minc[n-2-i]=abs(h[n-2-i]-h[n-1]);
	}
	repd(i,n-k-2,0){
		rep(j,i+1,i+k+1){
			minc[i]=min(minc[j]+abs(h[i]-h[j]),minc[i]);
		}
	}
	cout<<minc[0]<<endl;
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 1024
import numpy as np
N = int(input())
one_of_N = 0
other_N = 0

if N % 2 == 0:
  one_of_N = int(N / 2)
  other_N = N - 1
else:
  one_of_N = int((N - 1) / 2)
  other_N = N
  
result = (one_of_N * other_N)
print('{}'.format(result))

Measured memory_bytes: 12504
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int A, B;

int main() {

	scanf("%d %d", &A, &B);

	printf("%d\n", (int)ceil((B-1)/(A-1.0)));

	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++)

int main() {
  int N, a=0, cnt=0;
  cin >> N;
  vector<int> H(N);
  rep(i, N){
    cin >> H.at(i);
    rep(j, i){
      if(H.at(j)>H.at(i)){
        a=1;
        break;
      }
    }
    if(a==0) cnt++;
    a=0;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
MOD = 10**9+7
N = int(input())
x = list(map(int,input().split()))
def mod_pow(x,n,mod):
    res = 1
    while(n > 0):
        if n&1:
            res = res * x % mod
        x = x * x % mod
        n >>= 1
    return res
prob = []
a = 0
for i in range(1,N):
    a += mod_pow(i,MOD-2,MOD)
    #koko
    a %= MOD
    prob.append(a)
ans = 0
for i in range(1,N):

    """for j in range(1,i+1):
        prob += 1/j
    """
    ans += (x[i]-x[i-1]) * prob[i-1]
    ans %= MOD

for i in range(1,N):
    ans *= i
    ans %= MOD
ans = int(ans)
print(ans)

Measured memory_bytes: 14480
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define ll long long
#define INF 1000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

vector<int>g[10];
int n,m;
int sum;
bool used[10];

void dfs(int now,int cnt){
  if(cnt==n){sum++;return ;};
  used[now]=true;
  rep(i,g[now].size()){
    if(!used[g[now][i]])dfs(g[now][i],cnt+1);
  }
  used[now]=0;
}

int main(){
  int a,b;
  cin>>n>>m;
  rep(i,m){
    cin>>a>>b;
    g[a].pb(b);
    g[b].pb(a);
  }
  dfs(1,1);
  cout<<sum<<endl;
}

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

using namespace std;
using int64 = long long;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int i=0; i<n; i++) cin >> h[i];

    vector<vector<int>> node(n, vector<int>());
    for (int i=0; i<m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        node[a].push_back(b);
        node[b].push_back(a);
    }

    int ans = 0;
    for (int i=0; i<n; i++) {
        bool f = true;
        for (auto j : node[i]) {
            if (h[i] <= h[j]) {
                f = false;
                break;
            }
        }
        if (f) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 8312
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		String T=stdIn.next();
		int z=0,max=0,cou=0;
		while(z<T.length()){
			if(T.substring(z,z+1).equals("A")){
				cou++;
			}
			else
				if(T.substring(z,z+1).equals("T")){
					cou++;
				}
				else
					if(T.substring(z,z+1).equals("G")){
						cou++;
					}
					else
						if(T.substring(z,z+1).equals("C")){
							cou++;
						}
						else{
							if(max<cou)
								max=cou;
							cou=0;
						}
			z++;
		}
		if(max<cou)
			max=cou;
		System.out.println(max);
	}
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
using ull =unsigned long long;
const ll INF =1001001001;

//10億7。　　　100000007

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}


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

ll N,K;
  cin>>N>>K;
 
  vector<int> vecN(N);
  for(int i=0;i<N;i++){
    vecN[i]=i+1;
  }
  int counter=0;
  vector<int> vecd(K);
    
   for(int i=0;i<K;i++){
    cin>>vecd[i];
     vector<int> vec(vecd[i]);
     for(int j=0;j<vecd[i];j++){
       cin>>vec[j];
       for(int k=0;k<N;k++){
         if(vecN[k]==vec[j]){
           vecN[k]=0;
         }
       }
       }

   }
     for(int i=0;i<N;i++){
       if(vecN[i]!=0){
         counter++;
       }
     }
       cout<<counter<<endl;
}



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

using namespace std;
 
#define PB	push_back
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP	make_pair
 
#define debug(_x)		cerr << #_x << '=' << (_x) << endl;
#define debug2(_x, _y)	cerr << #_x << '=' << (_x) << ' ' << #_y << '=' << (_y) << endl;
#define debugn(_a)		cerr << #_a << ": "; for (const auto _x: _a) cerr << (_x+1) << ' '; cerr << endl;

#define HERE debug(__LINE__);

#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long int

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX>>1;
const int NINF = LONG_LONG_MIN/2;

int32_t main() {
	FAST_IO;

	int n, k;
	cin >> n >> k;
	
	vvi group;
	map<int, set<int>> mp;
	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		vi a(d);
		for (int& x: a) cin >> x;
		
		group.PB(a);
		for (int i = 0; i < d; i++) {
			mp[a[i]].insert(i);
		}
	}
	
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if ((int)mp[i].size() == 0) {
			ans++;
		}
	}
	cout << ans << endl;
}

// g++ -Wall -Wextra -Wshadow -fsanitize=undefined


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

using namespace std;

int main()
{
	string S;
	cin >> S;

	int S_len = S.length();

	int res = 0;
	for (int i = 0; i < S_len ; i++)
	{
		if (S[i] != S[S_len - 1 - i])
		{
			res++;
		}
	}

	res = res / 2;

	cout << res << endl;
}



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

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

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;


int main() {
    int n; cin >> n;
    map<ll, ll> md;
    for(int i = 0; i < n; i++){
        ll d; cin >> d;
        md[d]++;
    }
    int m; cin >> m;
    V<ll> v(m);
    for(int i = 0; i < m; i++) cin >> v[i];

    bool ok = true;
    for(int i = 0; i < m; i++){
        if(0 < md[v[i]]) md[v[i]]--;
        else{
            ok = false;
            break;
        }
    }

    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;


    return 0;
}


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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c, d,n, sum, A[500010], B[500000], rui[500000], dp[5000];
str S, T, U; bool check = true;	vector<ll> v;



int main() {
	//Code Line
	cin >> S;
	n = S.size();
	for (int i = 0; i < n; i++) {
		if (S[i] != S[n - 1 - i])check = 0;


	}

	a = (n - 1) / 2;
	T = S.substr(0, a);
	c = T.size();
	for (int i = 0; i < c; i++) {
		if (T[i] != T[c - 1 - i])check = 0;


	}
	b = (n + 3) / 2;
	U = S.substr(b - 1, n);
	d = U.size();
	for (int i = 0; i < d; i++) {
		if (U[i] != U[d - 1 - i])check = 0;


	}

	if (check)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;
  cout<<(n+1)/2<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {

	int a, b, max = 0;

	scanf("%d", &a);
	scanf("%d", &b);

	max = a + b;

	if (max < a - b) max = a - b;

	if (max < a * b) max = a * b;

	printf("%d", max);
	
	return 0;

}

Measured memory_bytes: 128
import sys


def resolve(in_):
    k = int(next(in_))
    if not k % 2:
        return -1

    seven = 7 % k

    for i in range(1, 1000000):
        if not seven:
            return i
        i += 1
        seven = seven * 10 + 7
        if seven >= k:
            seven %= k

    return -1

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9232
#include<bits/stdc++.h>
using namespace std;
struct UnionFind{
    vector<int> par;
    int cnt;
    UnionFind(int N):par(N,-1),cnt(N){}
    void init(int N){par.assign(N,-1);}
    int root(int x){
        if(par[x]<0)return x;
        return par[x]=root(par[x]);
    }
    bool issame(int x,int y){
        return root(x)==root(y);
    }
    bool merge(int x,int y){
        x=root(x),y=root(y);
        if(x==y)return false;
        if(par[x]>par[y])swap(x,y);
        par[x]+=par[y];
        par[y]=x;
        cnt--;
        return true;
    }
    int size(int x){
        return -par[root(x)];
    }
};
struct Edge{
    double a,b,cost;
    bool operator<(const Edge &o){
        return cost<o.cost;
    }
};
bool compare_by_second(pair<int,int> a,pair<int,int> b){
    if(a.second!=b.second)return a.second<b.second;
    else return a.first<b.first;
}
int main(){
    int n;scanf("%d",&n);
    vector<pair<int,int>> P(n);
    map<pair<int,int>,int> m;
    for(int i=0;i<n;i++){
        scanf("%d%d",&P[i].first,&P[i].second);
        m[P[i]]=i;
    }
    vector<Edge> a;
    sort(P.begin(),P.end());
    for(int i=0;i<n-1;i++){
        Edge ne;
        ne.a=m[P[i]],ne.b=m[P[i+1]],ne.cost=P[i+1].first-P[i].first;
        a.push_back(ne);
    }
    sort(P.begin(),P.end(),compare_by_second);
    for(int i=0;i<n-1;i++){
        Edge ne;
        ne.a=m[P[i]],ne.b=m[P[i+1]],ne.cost=P[i+1].second-P[i].second;
        a.push_back(ne);
    }
    sort(a.begin(),a.end());
    int ans=0;
    UnionFind Tree(n);
    for(auto na:a){
        if(Tree.issame(na.a,na.b))continue;
        ans+=na.cost;
        Tree.merge(na.a,na.b);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 15472
inpl = input()
c1 = 0
c2 = 0

for i,s in enumerate(inpl):
    if i % 2 != 0:
        if s == '0':
            c1 += 1
    else:
        if s == '1':
            c1 += 1

for i,s in enumerate(inpl):
    if i % 2 != 1:
        if s == '0':
            c2 += 1
    else:
        if s == '1':
            c2 += 1
print(c1 if c1 < c2 else c2)

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

int main(){
    ll m=10000000000000000;
    ll n; cin >> n;
    vector<ll> a(5);
    rep(i,5){
        cin >> a[i];
        m=min(m,a[i]);
    }
    ll x=(n+m-1)/m;
    cout << x+4 << endl;
}

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

int main(){
    long N;
    cin >> N;
    //桁数
    long p =1;
    int d_number = 0;
    while(p<=N){
        p = p*10;
        d_number++;
    }
    p = p/10;
    int sum = 0;
    for(int i=1;i<d_number;i++){
        sum += 9;
    }
    long q = N / p;
    long r = N%10;
    if(r==9) sum = sum + q;
    else sum = sum + q -1;
    if(d_number==1) sum = N;

    cout << sum <<"\n";
}


Measured memory_bytes: 256
local abs = math.abs
local X, K, D = io.read("n", "n", "n")

local abs_X = abs(X)

local carrent_X, K_of_carrent_X

K_of_carrent_X = abs_X // D
carrent_X = abs_X % D
if K <= K_of_carrent_X then
	print(abs(abs_X - K * D))
elseif (K - K_of_carrent_X) % 2 == 0 then
	print(abs(carrent_X))
else
	print(abs(carrent_X - D))
end


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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define ld long double
#define pb push_back
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000000
#define pll pair<ll, ll>
#define vl vector<ll>
#define vll vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >


ll mulmod(ll, ll);
ll fastpower(ll, ll);
void getprime(vector<bool>&);
void getfact(vector<ll>&, vector<ll>&);
ll ncr(ll, ll, vector<ll>&, vector<ll>&);

void solve()
{
	ll n, c = 0;
	
	cin>>n;
	vl a(n+1);
	for(ll i = 1; i <= n ; i++) cin>>a[i];
	for(ll i = 1; i <= n; i++)
	{
	    if(i % 2 != 0 && a[i] % 2 != 0)
	        c++;
	}
	cout<<c;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll t = 1;
	//cin>>t;
	while(t--)
	{
		solve();		
	}
	return 0;
}

ll mulmod(ll a, ll b)
{
	ll res = 0; 
	a = a % MOD;
	while(b > 0)
	{
		if (b % 2 == 1)
			res = (res + a) % MOD;
 
		a = (a * 2) % MOD; 
		b /= 2;
	} 
	return res % MOD; 
}

ll  fastpower(ll a, ll n)
{
	ll res = 1;
	while(n > 0)
	{
		if(n % 2 != 0)
		{
			res = (res * a) % MOD;
		}
		n /= 2;
		a = (a * a) % MOD;
	}
	return res;
}

void getprime(vector<bool>&prime)
{
	prime[0] = false;
	prime[1] = false;
	
	for(ll i = 2; i * i <= MAX; i++)
	{
		if(prime[i])
		{
			for(ll j = i*i; j <= MAX; j += i)
				prime[j] = false;
		}
	}
}

void getfact(vector<ll> &fact, vector<ll> &ifact)
{
	fact[0] = 1;
	ifact[0] = 1;
	
	for(ll i = 1; i <= MAX; i++)
	{
		fact[i] = (fact[i-1] * i)%MOD;
		ifact[i] = (ifact[i-1] * fastpower(i, MOD -2) )%MOD;
	}
}

ll ncr(ll n, ll r, vector<ll>&fact, vector<ll>&ifact)
{
	ll res;
	res = (((fact[n] * ifact[r]) % MOD) * ifact[n-r]) % MOD;
	return res;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mod 1000000007
 
// int ans(){
    
// }
 
int main() {
	string s,t;
    cin>>s>>t;
    int n=s.size(),m=t.size();
    int mini=n+1,cnt;
    if(m==n){
        cnt=0;
        for(int i=0;i<n;i++)if(s[i]!=t[i])cnt++;
        mini=min(mini,cnt);
        cout<<mini;
        return 0;
    }
    for(int i=0;i<n-m;i++){
        cnt=0;
        int k=0;
        for(int j=i;j<i+m;j++){
            if(s[j]!=t[k]){
                cnt++;
            }
            k++;
        }
        mini=min(mini,cnt);
    }
    cout<<mini;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cmath>
#define MAX 1000000
using namespace std;

void eratos ( int n, bool prime[]){
    for ( int i = 0; i <= n; i++ ) prime[i] = false;
    for ( int i = 3; i <= n; i += 2 ) prime[i] = true;
    prime[2] = true;
    int limit = (int)sqrt((double)n) + 1;
    for ( int i = 3; i <= limit; i += 2 ){
	if ( !prime[i] ) continue;
	for ( int j = i + i; j <= n; j += i ) prime[j] = false;
    }
}

int main(void){
    bool prime[MAX + 1];
    eratos( MAX, prime );

    int T[MAX+1];
    for ( int i = 0; i <= MAX; i++ ) T[i] = 0;
    for ( int i = 1; i <= MAX; i++ ){
	T[i] = T[i-1];
	if ( prime[i] ) T[i]++;
    }

    int n, p, m, x, ans;
    while( cin >> n && n ){
	ans = 0;
	for ( int i = 0; i < n; i++ ){
	    cin >> p >> m;
	    x = 0;
	    int left = max(0, p-m);
	    int right = min(p+m, MAX);

	    x += T[right] - T[left];
	    if ( prime[left] ) x++;

	    /*
	    for ( int j = max(0, p-m); j <= min(p+m,MAX); j++ ){
		if ( !prime[j] ) continue;
		if ( p-m <= j && j <= p+m ) x++;
		}
	    */
	    if ( x == 0 )  ans--;
	    else ans += x-1;

	}
	cout << ans << endl;
    }

    return 0;
}

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

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

    vector<int> v(N);
    for (int i = 0; i < N; ++i) {
        cin >> v[i];
    }

    // 各項の奇数の数
    vector<int> odd(N);
    for (int i = 0; i < N; ++i) {
        if (v[i] % 2 == 0) odd[i] = 2; // 偶数の場合その前後の値は奇数なので2つ
        else odd[i] = 1;
    }

    // 積が奇数になるパターン数を求める
    int oddPattern = 1;
    for (int i = 0; i < N; ++i) {
        oddPattern *= odd[i];
    }

    // 全パターン数から奇数分を引く
    int ans = pow(3, N) - oddPattern;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;
const double PI=3.14159265358979323846;

int main (){
    int N;
    cin >> N;
    vector<vector<int>> a(N);
    int b[N];
    rep(i,0,N) {
        int tmp;
        cin >> tmp;
        b[i] = tmp-1;
        a[tmp-1].push_back(i);
    }

    int ans = 0;

    rep(i,0,N) {
        for (auto j:a[i]) {
            if (b[i]==j) {
                ans++;
            }
        }
    }
    ans/=2;
    cout << ans << endl;


}





Measured memory_bytes: 6144
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    switch(N % 10){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
            break;
    }
}

Measured memory_bytes: 3580
#include "stdio.h"

int main(){
	int grid[100][100];
	int a,b;
	int i,j;
	int white_count=1,black_count=1;
	scanf("%d",&a);//白の連結数
	scanf("%d",&b);//黒の連結数
	
	for(i=0;i<100;i++){
		for(j=0;j<100;j++){
			if(i<49){
				grid[i][j]=1;
			}else{
				grid[i][j]=0;
			}
		}
	}
	
	for(i=0;i<100;i+=2){
		for(j=0;j<100;j+=2){
			if(white_count<a){
				grid[i][j]=0;
				white_count++;
			}
		}
	}
	
	for(i=50;i<100;i+=2){
		for(j=0;j<100;j+=2){
			if(black_count<b){
				grid[i][j]=1;
				black_count++;
			}
		}
	}
	
	printf("100 100\n");
	for(i=0;i<100;i++){
		for(j=0;j<100;j++){
			switch(grid[i][j]){
				case 0:
					printf(".");
					break;
				case 1:
					printf("#");
					break;
			}
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    int N,K; cin>>N>>K;
    vector<int>a(N);
    map<int,int>mp;
    rep(i,N){
        cin>>a[i];
        mp[a[i]]++;
    }
    int cnt=0;
    int ans =0;
    vector<int>data(0);
    for(auto p:mp){
        data.emplace_back(p.second);
        cnt++;
    }
    sort(data.begin(),data.end());
    reverse(data.begin(),data.end());
    int cnt1=0;
    for(int i=0;i<cnt;i++){
        cnt1++;
        if(cnt1>K){
            ans +=data[i];
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 11516
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

struct node{
	int x,y,i;
};
struct edg{
	int w,u,v;
};
const int maxn = 1e5+10;
vector<int>par(maxn,-1);
int root(int u){return par[u]<0?u:par[u]=root(par[u]);}
void merge(int u,int v){
	if( (u=root(u)) == (v=root(v)) )return;
	if( par[u] > par[v] )swap(u,v);
	par[u]+=par[v];
	par[v]=u;
}
int32_t main(){
	IOS
	int n;cin>>n;
	vector<node>a(n);
	vector<edg>b;
	for(int i=0;i<n;i++){
		cin >> a[i].x >> a[i].y ; a[i].i = i;
	}
	sort(a.begin(),a.end(),[&](const node A,const node B){return A.x < B.x;});
	for(int i =1;i<n;i++){
		b.push_back({a[i].x-a[i-1].x,a[i-1].i,a[i].i});
	}
	sort(a.begin(),a.end(),[&](const node A,const node B){return A.y < B.y;});
	for(int i =1;i<n;i++){
		b.push_back({a[i].y-a[i-1].y,a[i-1].i,a[i].i});
	}
	sort(b.begin(),b.end(),[&](const edg A,const edg B){return A.w < B.w;});
	int ans=0;
	for(size_t i=0;i<b.size();i++){
		if( root(b[i].u) != root(b[i].v) ){
			ans += b[i].w;
			merge(b[i].u,b[i].v);
		}
	}
	cout<<ans<<endl;
		
	
	
}
/*
 * long long or int?
 * index out of bound?
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int ans = 0;
            string[] input;
            int a,b;
            for(int i = 0 ; i < n ; i++)
            {
                input = Console.ReadLine().Split(' ');
                a = int.Parse(input[0]);
                b = int.Parse(input[1]);
                
                ans += (b-a)+1;
            }
            Console.WriteLine(ans);
            
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

bool dfs(vector<vector<int>>& G, vector<int>& color, int v, int c) {
	color[v] = c;
	for (int i = 0; i < G[v].size(); ++i) {
		if (color[G[v][i]] == c) { return false; }
		if ((color[G[v][i]] == 0) && (!dfs(G, color, G[v][i], -c))) {
			return false;
		}
	}
	return true;
}

int main() {
	ll N, M;
	cin >> N >> M;
	vector<vector<int>> G(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	vector<int> color(N, 0);
	ll res = N*(N - 1)/2 - M;
	if (dfs(G, color, 0, 1)) {
		ll b = 0;
		ll w = 0;
		for (int i = 0; i < N; ++i) {
			if (color[i] > 0) { ++b; }
			else { ++w; }
		}
		res = b*w - M;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 6656
//  Suraj Saste

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pi pair<ll,ll>
#define in insert
#define fe first
#define se second
#define ms(x,i) memset(x,i,sizeof(x))
#define prec(x) cout<<std::setprecision(x)
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
ll fpow(ll n, ll k, ll p=mod) {ll r=1; n=n%p; while(k>0){ if(k&1){ r=(r*n)%p; } k=k>>1; n=(n*n)%p; } return r;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 || n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0||n%(i+2)==0)return false;}return true;}

int main()
{
	fast;
	ll n;cin>>n;
	ll a[n][3];
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<3;j++)cin>>a[i][j];
	}
    ll dp[n][3];
    dp[0][0]=a[0][0];
    dp[0][1]=a[0][1];
    dp[0][2]=a[0][2];
    for(ll i=1;i<n;i++)
    {
    	for(ll j=0;j<3;j++)
    	{
    		if(j==0)
    		{
    			dp[i][j]=max(a[i][j]+dp[i-1][1],a[i][j]+dp[i-1][2]);
    		}
    		else if(j==1)
    		{
    			dp[i][j]=max(a[i][j]+dp[i-1][0],a[i][j]+dp[i-1][2]);
    		}
    		else 
    			dp[i][j]=max(a[i][j]+dp[i-1][1],a[i][j]+dp[i-1][0]);
    	}
    }
    ll ans=-1;
    for(ll j=0;j<3;j++)
    {
    	ans=max(ans,dp[n-1][j]);
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 4992
import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readLong
  val city = Iterator.continually(in.readLong)
    .take(5)
    .toArray

  val p = (0 until 5).map(i => (n + city(i)-1) / city(i)).max
  val ans = 5 + p - 1
  println(ans)
}

Measured memory_bytes: 27324
#include<stdio.h>
int main(void){
	int i,j,n,m,x,xx,yy,min,M,a[51],b[51],c[51],d[51],z[51];
	M=2147483647;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++) scanf("%d %d",&a[i],&b[i]);
	for(i=1;i<=m;i++) scanf("%d %d",&c[i],&d[i]);
	for(i=1;i<=n;i++){
		min=M;
		for(j=1;j<=m;j++){
			xx=a[i]-c[j];
			if(xx<0) xx*=-1;
			yy=b[i]-d[j];
			if(yy<0) yy*=-1;
			x=xx+yy;
			if(min>x){
				z[i]=j;
				min=x;
			}
		}
	}
	for(i=1;i<=n;i++) printf("%d\n",z[i]);
	return 0;
}

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

using namespace std;

const int N = 2e5 + 10;
long long dp[N][2][2];
int n;
int a[N];

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

  int n;
  cin >> n;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 2; ++k) {
        dp[i][j][k] = -1e18;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  dp[0][0][0] = dp[0][1][0] = dp[0][0][1] = dp[0][1][1] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 2; ++k) {
        if (!(j & k)) {
          for (int g = 0; g < 2; ++g) {
            for (int t = 0; t < 2; ++t) {
              int x = (i + 1) / 2 - g, y = i / 2 - t;
              if (y + j == x and y >= 0) {
                dp[i][g][j] = max(dp[i][g][j], dp[i - 1][t][k] + j * a[i]);
              }
            }
          }
        }
      }
    }
  }
  long long ans = -1e18;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 2; ++j) {
      if ((i + 1) / 2 - j == n / 2) {
        for (int k = 0; k < 2; ++k) {
          ans = max(ans, dp[i][j][k]);
        }
      }
    }
  }
  cout << ans;

  return 0;
}

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

using namespace std;

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

	string ret="Positive";
	if(a<=0&&0<=b)ret="Zero";
	else if(a<0&&(b-a)%2==0)ret="Negative";
	cout<< ret<< endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <list>

const int MAX_N = 25;

struct Node {
  int parent;
  int left;
  int right;
  bool visited;
};

int findRoot(struct Node *nodes[], int n) {
  int index = -1;
  
  for (int i = 0; i < n; i++) {
    if (nodes[i]->parent < 0) {
      index = i;
      
      break;
    }
  }

  return index;
}

void printByInorder(struct Node *nodes[], int n, int rootID) {
  std::list<int> list;

  list.push_front(rootID);
  
  std::cout << "Inorder" << std::endl;
  
  while (!list.empty()) {
    int id = list.front();
    list.pop_front();
    
    if (id < 0) {
      continue;
    }
    
    struct Node *node = nodes[id];

    if (!node->visited) {
      node->visited = true;

      list.push_front(node->right);
      list.push_front(id);
      list.push_front(node->left);       
    } else {
      std::cout << " " << id;
    }
  }

  std::cout << std::endl;  
}

void printByPreorder(struct Node *nodes[], int n, int rootID) {
  std::cout << "Preorder" << std::endl;
  
  std::list<int> list;

  list.push_front(rootID);

  while (!list.empty()) {
    int id = list.front();
    list.pop_front();

    if (id < 0) {
      continue;
    }

    std::cout << " " << id;

    struct Node *node = nodes[id];

    list.push_front(node->right);
    list.push_front(node->left);    
  }

  std::cout << std::endl;
}

void printByPostorder(struct Node *nodes[], int n, int rootID) {
  std::list<int> list;

  list.push_front(rootID);
  
  std::cout << "Postorder" << std::endl;
  
  while (!list.empty()) {
    int id = list.front();
    list.pop_front();
    
    if (id < 0) {
      continue;
    }
    
    struct Node *node = nodes[id];

    if (!node->visited) {
      node->visited = true;
      
      list.push_front(id);      
      list.push_front(node->right);
      list.push_front(node->left);
    } else {
      std::cout << " " << id;
    }
  }

  std::cout << std::endl;    
}

void setVisited(struct Node *nodes[], int n, bool visited) {
  for (int i = 0; i < n; i++) {
    nodes[i]->visited = visited;
  }
}

int main(void) {
  int n;

  std::cin >> n;

  struct Node *nodes[MAX_N];

  for (int i = 0; i < n; i++) {
    struct Node *node = (struct Node *) std::malloc(sizeof(struct Node));
    
    node->parent = -1;
    node->left = -1;
    node->right = -1;
    node->visited = false;

    nodes[i] = node;
  }

  for (int i = 0; i < n; i++) {
    int id = 0;

    std::cin >> id;
    
    struct Node *node = nodes[id];

    std::cin >> node->left;
    std::cin >> node->right;

    if (node->left >= 0) {
      nodes[node->left]->parent = id;
    }

    if (node->right >= 0) {
      nodes[node->right]->parent = id;
    }
  }

  int rootID = findRoot(nodes, n);

  setVisited(nodes, n, false);
  printByPreorder(nodes, n, rootID);

  setVisited(nodes, n, false);
  printByInorder(nodes, n, rootID);

  setVisited(nodes, n, false);
  printByPostorder(nodes, n, rootID);

  return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    if(h == 1 && w == 1) {
        if(a == 0 && b == 0) {
            cout << 0;
        }
        else {
            cout << "No";
        }
        cout << endl;
        return 0;
    }

    if(h == 1 && w >= 2) {
        if(b == 0) {
            rep(i, a) {
                cout << 1;
            }
            rep(i, w-a) {
                cout << 0;
            }
        }
        else {
            cout << "No";
        }
        cout << endl;
        return 0;
    }

    if(h >= 2 && w == 1) {
        if(a == 0) {
            rep(i, b) {
                cout << 1 << "\n";
            }
            rep(i, h-b) {
                cout << 0 << "\n";
            }
        }
        else {
            cout << "No" << endl;
        }
        return 0;
    }

    rep(i, b) {
        rep(j, a) {
            cout << 1;
        }
        rep(j, w-a) {
            cout << 0;
        }
        cout << "\n";
    }

    rep(i, h-b) {
        rep(j, a) {
            cout << 0;
        }
        rep(j, w-a) {
            cout << 1;
        }
        cout << "\n";
    }

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    map<ll, ll> mp;
    for(ll i = 1; i <= 100; i++) {
        for(ll j = 1; j <= 100; j++) {
            for(ll k = 1; k <= 100; k++) {
                ll x = i*i + j*j + k*k + i*j + j*k + k*i;
                mp[x]++;
            }
        }
    }
    for(ll i = 1; i <= n; i++) cout << mp[i] << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 5948