akhauriyash/Code-Regression huggingface dataset:
inf = 10**9

def dfs(cur, a, b, c):
    if cur==N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if a > 0 and b>0 and c>0 else inf
    ret0 = dfs(cur+1, a,b,c)
    ret1 = dfs(cur+1, a+l[cur],b,c) + 10
    ret2 = dfs(cur+1, a,b+l[cur],c) + 10
    ret3 = dfs(cur+1, a,b,c+l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)


N, A, B, C = map(int, input().split())
l = [0] * N
for i in range(N):
    l[i] = int(input())
print(dfs(0, 0, 0, 0))

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

using ll = long long;

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

int dis[51][51];
int n, m;
int a[50], b[50];
bool flag[51];

void isLink(int now){
    flag[now] = true;
    for(int i = 1; i <= n; i++){
        if(dis[now][i] == 1 && !flag[i]) {
            isLink(i);
        }
    }
    return;
}

void solve() {
    cin >> n >> m;
    for(int i = 0; i < 51; i++){
        for(int j = 0; j < 51; j++) dis[i][j] = 0;
    }
    for(int i = 0; i < m; i++) {
        int _a, _b;
        cin >> _a >> _b;
        dis[_a][_b] = 1;
        dis[_b][_a] = 1;
        a[i] = _a;
        b[i] = _b;
    }
    int ans = 0;
    for(int i = 0; i < m; i++){
        dis[a[i]][b[i]] = 0;
        dis[b[i]][a[i]] = 0;
        for(int j = 1; j <= n; j++) flag[j] = false;
        isLink(1);
        bool isBidge = false;
        for(int j = 1; j <= n; j++) {
            if(!flag[j]) {
                isBidge = true;
                break;
            }
        }
        if(isBidge) ans++;
        dis[a[i]][b[i]] = 1;
        dis[b[i]][a[i]] = 1;
    }
    cout << ans << endl;
}
 
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
str=input().split(" ")

a = int(str[0])
b = int(str[1])
c = int(str[2])

taka = a - c
if taka < 0:
    taka = 0

res = a - c
if res > 0:
    res = 0

ao = res + b
if ao < 0:
    ao = 0

print(taka, end = " " )
print(ao)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,l;
    cin >> n >> l;
    vector<string> A(n);
    REP(i,n){
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    REP(i,n){
        cout << A[i];
    }cout << endl;
}

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

using namespace std;

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

    if(A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }   
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
using namespace std;
typedef pair<char, char> P;
int main(){
    string S;
    cin >> S;
    vector<int> cnt(S.size(), 0);
    set<int> sr, sl;
    for(int i = 0; i < S.size() - 1; i++){
        if(S[i] == 'R' && S[i + 1] == 'L'){
            sr.insert(i);
            sl.insert(i + 1);
        }
    }
    int cntr = 0, cntl = 0;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'R') cntr++;
        else cntr = 0;
        if(sr.count(i)){
            cnt[i] += (cntr + 1) / 2;
            cnt[i + 1] += cntr / 2;
        }
    }
    for(int i = S.size() - 1; i >= 0; i--){
        if(S[i] == 'L') cntl++;
        else cntl = 0;
        if(sl.count(i)){
            cnt[i] += (cntl + 1) / 2;
            cnt[i - 1] += cntl / 2;
        }
    }
    for(int i = 0; i < S.size(); i++){
        if(i != S.size() -1) cout << cnt[i] << ' ';
        else cout << cnt[i] << endl;
    }
}

Measured memory_bytes: 8476
#include <iostream>

int main() {
    int R, G, B, N;
    int ans = 0;
    std::cin >> R >> G >> B >> N;
    for (int r=0; r<=N; ++r) {
        for (int g=0; g<=N; ++g) {
           int rg = r*R + g*G;
           if ( (N >= rg) && ((N-rg) % B == 0) ) ++ans;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=1e5+10;
char s[maxn],t[maxn];
int main(){
	int n=read(),m=read();
	scanf("%s%s",s+1,t+1);
	int Gcd=__gcd(n,m);
	for(int i=1,j=1;i<=n || j<=m;i+=n/Gcd,j+=m/Gcd) if(s[i]!=t[j]) return printf("-1\n"),0;
	printf("%lld\n",(ll)n*m/Gcd);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e11;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

int N, h[101010];
int dp[101010];

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(N)
        cin >> h[i];

    FOR(N + 10)
    dp[i] = INF;
    dp[0] = 0;
    FOR(N) {
        chmin(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        chmin(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }
    cout << dp[N - 1] << endl;

    solve();
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;
import java.util.TreeMap;

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

		while (true) {
			n = sc.nextInt();
			m = sc.nextInt();
			if ((n | m) == 0) {
				break;
			}

			h = new int[n + 1];
			w = new int[m + 1];
			
			for (int i = 1; i < n + 1; i++) {
				h[i] = h[i - 1] + sc.nextInt();
			}
			for (int i = 1; i < m + 1; i++) {
				w[i] = w[i - 1] + sc.nextInt();
			}
			
			TreeMap<Integer, Integer> t = new TreeMap<Integer, Integer>();
			for (int i = 0; i < n + 1; i++) {
				 for (int j = i + 1; j < n + 1; j++) {
					 Integer v = t.get(h[j] - h[i]);
					 t.put(h[j] - h[i], v == null ? 1 : v + 1);
				 }
			}
			
			int cnt = 0;
			for (int i = 0; i < m + 1; i++) {
				for (int j = i + 1; j < m + 1; j++) {
					Integer v = t.get(w[j] - w[i]);
					cnt += v == null ? 0 : v;
				}
			}
			
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 212388
n,l=map(int,input().split())
a=[]
b=0
for i in range(n):
    a.append((l+b))
    b+=1
if a[0]<=0 and a[n-1]>=0:
    print(sum(a))

elif a[0]>0:
    print(sum(a)-a[0])
elif a[n-1]<0:
    print(sum(a)-a[n-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#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;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int prime[1010];
bool is_prime[1011];
void sieve(){
    int n = 1010; // n以下の素数を求める
    int p = 0;
    for(int i=0;i<=n;i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <=n ; i++){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j <=n;j*=2) is_prime[j] = false;
        }
    }
}
vector<int> num(1010,0);

int main(){
    ll n;
    cin >> n;
    if(n==1) {
        cout<<"1"<<endl;
        return 0;
    }
    sieve();
    for(int i=2;i<=n;i++){
        ll number = i;
        for(ll j=2;j<=i;j++){
            if(is_prime[j]==true){
                while(number%j==0){
                    num[j]++;
                    number/=j;
                }
            }
        }
    }
    ll ans = 1;
    //cout<<is_prime[5]<<"add"<<endl;
    //rep(i,8) cout<<num[i]<<" ";
    //cout<<endl;
    for(ll i=2;i<=n;i++){
        ans *= (num[i]+1);
        ans %= mod;
    }
    cout<< ans <<endl;
    return 0;
}

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

using namespace std;
using ll = long long;

const int MOD = 1000000007;

int main(){
  ll N, M;
  cin >> N >> M;
 
  vector<bool> is_safe;
  is_safe.assign(N+1, true);
  
  for(int i=0; i<M; i++){
    int a; cin >> a;
    is_safe[a] = false;
  }
  
  vector<int> dp(N+1, 0);
  
  dp[0] = 1;
  if(is_safe[1]) dp[1] = 1;
  
  
  for(int i=2; i<=N; i++){
    if(is_safe[i-1]) dp[i] += dp[i-1];
    if(is_safe[i-2]) dp[i] += dp[i-2];
    dp[i] %= MOD;
  
  }
  
  cout << dp[N] << endl;
 
  return 0;
}

Measured memory_bytes: 3752
while True:
	n, x = map(int, raw_input().split())
	if (n == 0) and (n == x):
		break
	cnt = 0
	for i in range(1, n+1):
		for j in range(i+1, n+1):
			for k in range(j+1, n+1):
				if (i + j + k) == x:
					cnt += 1
	print cnt

Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;


vector <int> v;

void gen(int mask, vector <int> diff)
{
    /*for (int x : diff) eprintf("%d ", x); eprintf("| %d\n", mask);
    for (int x : diff)
        if ((mask & (1 << x)) == 0)
            throw;
    */
    int id = diff.back();
    diff.pop_back();
    int nmask = mask ^ (1 << id);
    if (nmask == 0)
    {
        v.push_back(0);
        v.push_back(1 << id);
        return;
    }
    if (diff.empty())
    {
        int x = 0;
        while ((nmask & (1 << x)) == 0)
            x++;
        vector <int> ndiff({x});
        gen(nmask, ndiff);
        int sz = (int) v.size();
        gen(nmask, ndiff);
        reverse(v.begin() + sz, v.end());
        for (int i = sz; i < (int) v.size(); i++)
            v[i] ^= (1 << id);
        return;
    }
    vector <int> adiff({diff.back()});
    diff.pop_back();

    gen(nmask, adiff);
    int sz = (int) v.size();

    gen(nmask, diff);
    for (int i = sz; i < (int) v.size(); i++)
            v[i] ^= (1 << adiff[0]) ^ (1 << id);

}

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    int d = (a ^ b);
    int cnt = __builtin_popcount(d);
    if (cnt % 2 == 0)
    {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    vector <int> diff;
    for (int i = 0; i < n; i++)
        if (d & (1 << i))
            diff.push_back(i);

    gen((1 << n) - 1, diff);

    for (int i = 0; i < (int) v.size(); i++)
        v[i] ^= a;

    for (int x : v)
        printf("%d ", x);
    printf("\n");

	return 0;
}




Measured memory_bytes: 1660
x,n=map(int,input().split())
arr=[int(x) for x in input().split()]
i,j=(x-50),(x+50)
min=10**9
z=x
for t in range(i,j+1):
    if abs(t-x)<min and t not in arr:
        z=t
        min=abs(t-x)
print(z)



Measured memory_bytes: 61916
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((a*b)%2 == 1){
            System.out.println("Odd");
        }
        else{
            System.out.println("Even");
        }
        
    }
}

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

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

    int d, r;
  	int A = a;
  	int B = b;
    double f;

    d = a/b;
    r = A%B;
    f = a/b;

    printf("%d %d %lf\n", d, r, f);
}


Measured memory_bytes: 3292
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int ans=a*b/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
a, b, c, x, y = map(int,input().split())
c = 2 * c
money = 0
apizza = 0
bpizza = 0
ans = 0
for i in range(max(x,y) + 1):
    apizza = x - i
    if apizza < 0:
        apizza = 0
    bpizza = y - i
    if bpizza < 0:
        bpizza = 0
    ans = apizza * a + bpizza * b + c * i
    if money > ans or i == 0:
        money = ans
print(money)


Measured memory_bytes: 9124
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N;
string S;

int main() {
	cin >> N >> S;
	if (N % 2 == 0 && S.substr(0, N / 2) == S.substr(N / 2 , N / 2)) {
		puts("Yes");
	}
	else {
		puts("No");
	}
}

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

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> l(n);
	for (int i = 0; i < n; i++)
	{
		cin >> l[i];
	}
	sort(l.begin(), l.end());
	int total = 0;
	for (int i = n - 1;k > 0; i--)
	{
		total += l[i];
		k--;
	}
	cout << total << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc;
	long N, A, B;
	
	private void calc() {
		sc = new Scanner(System.in);
		N = sc.nextLong();
		A = sc.nextLong();
		B = sc.nextLong();
		
		long c = N/(A+B)*A+Math.min(N%(A+B), A);
		System.out.println(c);
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}


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

int main() {
  int N;
  scanf("%d", &N);
  char S[N+1];
  scanf("%s", S);

  int count=0;
  for (int i = 0; i < N; i++) {
    if (S[i]=='A' && i<(N-1)) {
      if (S[i+1]=='B' && S[i+2]=='C') {
        count++;
        i = i+2;
      }
    }
  }

  printf("%d\n", count);
  return 0;
}


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

#define ul unsigned long long
#define ll long long

void dfs(vector<ll> *p, ll *c,ll id,ll x) {
  if (p[id][0]<0) return;
  c[id]+=x;
  ll cid;
  for (ul i = 0; i < p[id].size(); i++)
  {
    cid = p[id][i];
    p[id][i] = -1;
    dfs(p, c, cid, c[id]);
  }
}

int main()
{
  ll n,q;
  cin>>n>>q;
  vector<ll> p[n];
  ll ta,tb,c[n];
  fill_n(c,n,0);
  for (ll i = 1; i < n; i++)
  {
    cin>>ta>>tb;
    ta--;tb--;
    p[ta].push_back(tb);
    p[tb].push_back(ta);
  }
  for (ll i = 0; i < q; i++)
  {
    cin>>ta>>tb;
    c[ta-1]+=tb;
  }
  
  dfs(p,c,0,0);

  for (ll i = 0; i < n-1; i++)
  {
    cout<<c[i] << " ";
  }
  cout << c[n-1] << endl;

  return 0;
}


Measured memory_bytes: 24320
#include <iostream>
#include <algorithm>
using namespace std;
#define INF -1000000000000000
#define MAX_N 1010
#define MAX_M 2010
#define int long long

struct edge { int from, to, cost; };

edge es[MAX_M];

int d[MAX_N];
int n, m;

int bellman_ford() {
  for (int i = 1; i <= n; i++) {
    d[i] = INF;
  }
  d[1] = 0;
  int count = 0;
  while (true) {
    /*
    for (int i = 1; i <= n; i++) {
      cout << d[i] << " ";
    }
    cout << endl;
    */
    if (count == n - 1) break;
    bool update = false;
    for (int i = 0; i < m; i++) {
      edge e = es[i];
      if (d[e.from] != INF && d[e.to] < d[e.from] + e.cost) {
        d[e.to] = d[e.from] + e.cost;
        update = true;
      }
    }
    if (!update) break;
    count++;
  }
  bool negative[n + 1];
  fill(negative, negative + n + 1, false);
  count = 0;
  while (true) {
    /*
    for (int i = 1; i <= n; i++) {
      cout << d[i] << " ";
    }
    cout << endl;
    */
    if (count == n) break;
    bool update = false;
    for (int i = 0; i < m; i++) {
      edge e = es[i];
      if (d[e.from] != INF && d[e.to] < d[e.from] + e.cost) {
        d[e.to] = d[e.from] + e.cost;
        update = true;
        negative[e.to] = true;
      }
      if (negative[e.from]) negative[e.to] = true;
    }
    if (!update) break;
    count++;
  }
  if (negative[n]) return INF;
  return d[n];
}

signed main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    edge tmp;
    tmp.from = a;
    tmp.to = b;
    tmp.cost = c;
    es[i] = tmp;
  }
  int ans = bellman_ford();
  if (ans == INF) {
    cout << "inf" << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <tuple>
#include <queue>

using namespace std;

class Solver {
public:
	static void solve() {
		int w, h;
		cin >> w >> h;
		vector<int> res;
		while (w > 0 && h > 0) {
			vector<vector<bool>> grid(h, vector<bool>(w));
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					int now;
					cin >> now;
					grid[i][j] = now;
				}
			}

			int cnt = 0;
			vector<vector<int>> visited(h, vector<int>(w, false));

			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (!grid[i][j] || visited[i][j])continue;

					cnt++;

					queue<tuple<int, int>> que;
					que.push(make_tuple(i, j));
					while (!que.empty()) {
						auto pos = que.front();
						que.pop();
						int y = get<0>(pos);
						int x = get<1>(pos);
						if (y < 0 || h <= y || x < 0 || w <= x
							|| !grid[y][x] || visited[y][x])continue;

						visited[y][x] = true;

						que.push(make_tuple(y - 1, x));
						que.push(make_tuple(y + 1, x));
						que.push(make_tuple(y, x - 1));
						que.push(make_tuple(y, x + 1));
						que.push(make_tuple(y - 1, x - 1));
						que.push(make_tuple(y + 1, x - 1));
						que.push(make_tuple(y - 1, x + 1));
						que.push(make_tuple(y + 1, x + 1));
					}
				}
			}

			res.emplace_back(cnt);

			cin >> w >> h;
		}

		for (int i = 0; i < res.size(); i++) {
			cout << res[i] << endl;
		}
	}
};

int main() {
	Solver::solve();
}


Measured memory_bytes: 3032
#n<=10**3

n = int(input())

fct = [1]*(n+1)
fct[1] = 0
fct[0] = 0
mod = 10**9+7
#print(mod)
sq = int(n**(1/2))+5###1//2はゼロだwww
#print(sq)
for i in range(2,sq):
    for j in range(2,(n//i)+10):
        if i*j<=n:
            fct[i*j] = 0
            #if i==7 or j ==11:
            #    print("test",i,j)

#print(fct)
prm = []

for i in range(n+1):
    if fct[i]:
        prm.append(i)
#print("prm",prm)
ind = []

for p in prm:
    tmp = 0
    tmp2 = n
    while tmp2:
        tmp2//=p 
        tmp += tmp2 
    ind.append(tmp)
ans = 1
for i in ind:
    ans *= (i+1)
    ans %= mod

#print("ind",ind)
print(ans)

Measured memory_bytes: 38896
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int32_t main()
{
	c_p_c();
	int t;// int a[3];
	cin >> t;
	cout << 2 * 3.14 * t;

	return 0;



}

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

int main(){
  int n,tmp;
  cin >> n;
  for(int i=0;i<3;i++){
    tmp = n%10;
    n = n/10;
    if(tmp == 7){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


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

using namespace std;
#define ll  long long
#define ld long double
ll a[100005]={0};
ll n,k;
ll hod[105]={0};
ll rec(ll k) {
    if(a[k]!=-1) return a[k];
  bool b[105]={0};
    for(ll i =1;i<=n;i++) {
            if(hod[i]<=k)
        b[rec(k-hod[i])] = 1; else break;
    }
    for(ll i =0;i<=105;i++) {
        if(!b[i]) {a[k] = i; return i;}
    }
}
int main()
{
 // freopen("input.txt","r",stdin);
 //  freopen("output.txt","w",stdout);
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);

    cin>>n>>k;
    for(ll i =1;i<=k;i++) {
        a[i] = -1;
    }
    for(ll i =1;i<=n;i++) {
        cin>>hod[i];
    }
    stable_sort(hod+1,hod+1+n);
a[0] = 0;
if(rec(k)==0) cout<<"Second"; else cout<<"First";

}



Measured memory_bytes: 15104
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int l = 0, r = 0;
  rep(i, n) {
    if (s[i] == '(')
      l++;
    else if (l)
      l--;
  }
  for (int i = n-1; i >= 0; i--) {
    if (s[i] == ')')
      r++;
    else if (r)
      r--;
  }
  rep(i, r)
    s = '('+s;
  rep(i, l)
    s += ')';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n,k,q,all=0;
    cin>>n>>k>>q;
    vector<ll> p(n,k-q);
    rep(i,q){
        ll a; cin>>a;
        p[a-1]++;
    }
    rep(i,n){
        if(p[i]>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}

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

int main() {
    int r, c;
    int hyou[101][101] = {};
    cin >> r >> c;

    for (int i = 0; i < r; i++) {
        int sum = 0;
        for (int j = 0; j < c; j++) {
            cin >> hyou[i][j];
            sum += hyou[i][j];
        }
        hyou[i][c] = sum;
    }

    for (int j = 0; j <= c; j++) {
        int sum = 0;
        for (int i = 0; i <= r; i++) {
            sum += hyou[i][j];
        }
        hyou[r][j] = sum;
    }

    for (int i = 0; i <= r; i++) {
        for (int j = 0; j <= c; j++) {
            cout << hyou[i][j];
            if (j != c) cout << " ";
        }

        cout << endl;
    }
}

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

int dp[6003][12003] , inv[12003] , N , P;

int poww(long long a , int b){
	int tms = 1; while(b){if(b & 1) tms = tms * a % P; a = a * a % P; b >>= 1;} return tms;
}

int main(){
	cin >> N >> P; dp[0][3 * N] = 1;
	for(int i = 1 ; i <= 3 * N ; ++i) inv[i] = poww(i , P - 2);
	for(int i = 0 ; i < 3 * N ; ++i)
		for(int j = 3 * N - i ; j <= 3 * N + i ; ++j){
			dp[i + 3][j] = (dp[i + 3][j] + 1ll * dp[i][j] % P * inv[i + 3]) % P;
			dp[i + 2][j - 1] = (dp[i + 2][j - 1] + 1ll * dp[i][j] * inv[i + 2]) % P;
			dp[i + 1][j + 1] = (dp[i + 1][j + 1] + 1ll * dp[i][j] * inv[i + 1]) % P;
		}
	int sum = 0;
	for(int i = 3 * N ; i <= 12000 ; ++i) sum = (sum + dp[3 * N][i]) % P;
	for(int i = 1 ; i <= 3 * N ; ++i) sum = 1ll * sum * i % P;
	cout << sum % P;
	return 0;
}


Measured memory_bytes: 279936
#include <iostream>

using namespace std;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;


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

    ll n;
    cin >> n;
    ll i = 1;
    ll ans = 0;
    while(ans + i != n+1){
        int a;
        cin >> a;
        if(a != i) {
            ans++;
            continue;
        }
        ++i;
    }
    if(ans == n) cout << -1 << endl;
    else cout << ans << endl;
    cout << endl;
    return 0;
}


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

int main() {
  int n;
  while (cin >> n and n) {
    int ans = 0;
    for (int start = 1; start < n; start++) {
      int sum = 0;
      for (int i = start; sum < n; i++) {
        sum += i;
      }
      if (sum == n) {
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

// headers {{{
using namespace std;
// using namespace rel_ops;
 
const double pi=acos(-1.0);
const double eps=1e-11;
const int INF=0x7FFFFFFF;
template<class T> inline bool checkmin(T &a,T b){return b<a?a=b,1:0;}
template<class T> inline bool checkmax(T &a,T b){return b>a?a=b,1:0;}
template<class T> inline T sqr(T x){return x*x;}
template<class T> inline bool bit(T a, int b) {return (a>>b)&1;}
inline int popcount(int n) { return __builtin_popcount(n); }
inline int popcount(long long n) { return __builtin_popcountll(n); }
typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define eb(args...) emplace_back(args)
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ff first
#define ss second
#define sz(g) int(g.size())
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
#ifdef LOCAL
#define dout cerr 
void out() { dout << endl; }
template<typename A, typename... B> void out(A a, B... b) { dout << ' ' << a; out(b...); }
#define dbg(args...) dout << __LINE__ << ":(" << #args << ") -> ", out(args)
template<class T>void show(T a, int n){for(int i=0; i<n; ++i) cout<<a[i]<<' '; cout<<endl;}
template<class T>void show(T a, int r, int l){for(int i=0; i<r; ++i)show(a[i],l);cout<<endl;}
constexpr bool local = true;
#else
#define dbg(...)
#define dout if(true);else cerr
#define out(...)
#define show(...)
constexpr bool local = false;
#endif
// }}}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    int x, y;
    while (cin >> x >> y) {
        if ((y % 2 == 1) || (y<2*x) || (y>4*x)) {
            cout <<"No"<<endl;
        } else {
            cout <<"Yes"<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3648
#include "bits/stdc++.h"
using ll = long long;
using namespace std;

int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  int n;
  cin >> n;

  vector<int> a(n);
  for(auto& x: a)
    cin >> x;

  sort(a.begin(), a.end(), greater<decltype(a[0])>());

  ll ans = 0;

  n--;
  if(n > 0) {
    ans = a[0];
    n--;
    ans += 2 * accumulate(a.begin() + 1, a.begin() + 1 + n/2, 0ll);
    if(n & 1)
      ans += a[1 + n/2];
  }

  cout << ans;
}


Measured memory_bytes: 3988
#include <iostream>
#include <vector>
using namespace std;
const int SHN=100010;
int n;
bool visit[SHN]={0};
int a[SHN];
int b[SHN];
vector<int> edge[SHN];
int bl=0;
int wh=0;
inline void dfs(int x,int t,bool col)
{
	visit[x]=1;
	if (!col) a[x]=t;
	else b[x]=t;
	for (int i=0;i<edge[x].size();i++)
	{
		if (!visit[edge[x][i]]) dfs(edge[x][i],t+1,col);
	}
}
int main()
{
	cin >>n;
	for (int i=0;i<n-1;i++)
	{
		int x,y;
		cin >>x>>y;
		x--,y--;
		edge[x].push_back(y);
		edge[y].push_back(x);
	}
	dfs(0,0,0);
	fill(visit,visit+n,0);
	dfs(n-1,0,1);
	for (int i=0;i<n;i++)
	{
		int x=a[i];
		int y=b[i];
		if (x<=y) bl++;
		else wh++;
	}
	if (wh>=bl) cout <<"Snuke";
	else cout <<"Fennec";
	return 0;
}

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

template <typename T>
struct flow_graph {
	
	struct edge {
		int from, to;
		T cap, f;
	};
	
	vector<edge> edges;
	vector<vector<int>> g;
	vector<int> level, iter;
	int n, st, fin;
	T flow;
	
	flow_graph(int n, int st, int fin) : n(n), st(st), fin(fin) {
		assert(0 <= st && st < n && 0 <= fin && fin < n && st != fin);
		g.resize(n);
		level.resize(n);
		iter.resize(n);
		flow = 0;
	}
	
	void clean_flow() {
		for (const edge &e : edges) {
			e.f = 0;
		}
		flow = 0;
	}
	
	void add(int from, int to, T cap = 1, T rev_cap = 0) {
		assert(0 <= from && from < n && 0 <= to && to < n);
		g[from].emplace_back(edges.size());
		edges.push_back({from, to, cap, 0});
		g[to].emplace_back(edges.size());
		edges.push_back({to, from, rev_cap, 0});
	}
	
	bool bfs() {
		fill(level.begin(), level.end(), -1);
		queue<int> q;
		level[st] = 0;
		q.emplace(st);
		while (!q.empty()) {
			int i = q.front();
			q.pop();
			for (int id : g[i]) {
				const edge &e = edges[id];
				if (0 < e.cap - e.f && level[e.to] < 0) {
					level[e.to] = level[i] + 1;
					q.emplace(e.to);
				}
			}
		}
		return 0 < level[fin];
	}
	
	T dfs(int now, T f = numeric_limits<T>::max()) {
		if (now == fin) {
			return f;
		}
		for (int &i = iter[now]; i < g[now].size(); i++) {
			int id = g[now][i];
			edge &e = edges[id];
			if (0 < e.cap - e.f && level[now] < level[e.to]) {
				T d = dfs(e.to, min(f, e.cap - e.f));
				if (0 < d) {
					e.f += d;
					edges[id ^ 1].f -= d;
					return d;
				}
			}
		}
		return 0;
	}
	
	T max_flow() {
		while (bfs()) {
			fill(iter.begin(), iter.end(), 0);
			for (T f = dfs(st); 0 < f; f = dfs(st)) {
				flow += f;
			}
		}
		return flow;
	}
};

int main() {
	int n, m;
	cin >> n >> m;
	flow_graph<int64_t> g(n, 0, n - 1);
	for (int i = 0; i < m; i++) {
		int from, to;
		int64_t cap;
		cin >> from >> to >> cap;
		g.add(from, to, cap);
	}
	cout << g.max_flow() << endl;
	return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

void solve(int N, int Q, vector<int> t, vector<int> u, vector<int> v)
{
    dsu d(N);
    for (int i = 0; i < Q; i++)
    {
        if (t.at(i) == 0)
        {
            d.merge(u.at(i), v.at(i));
        }
        else
        {
            cout << ((d.same(u.at(i), v.at(i))) ? 1 : 0) << endl;
        }
    }
}

int main()
{
    int N;
    cin >> N;
    int Q;
    cin >> Q;
    vector<int> t(Q);
    vector<int> u(Q);
    vector<int> v(Q);
    for (int i = 0; i < Q; i++)
    {
        cin >> t.at(i);
        cin >> u.at(i);
        cin >> v.at(i);
    }
    solve(N, Q, move(t), move(u), move(v));
    return 0;
}


Measured memory_bytes: 5848
a,b,c,d,e,f=map(int,input().split())
X=[]
for ai in range(31):
    water=a*100*ai
    if water>f:
        break
    for bi in range(31):
        water=a*100*ai+b*100*bi
        if water==0 or water>f:
            break
        for ci in range(101):
            sugar=c*ci
            if water+sugar>f:
                break
            for di in range(101):
                sugar=c*ci+d*di
                if water+sugar>f:
                    break
                else:
                    if water>0 and (water/100)*e>=sugar:
                        X.append([water+sugar,sugar])
print(*sorted(X,key=lambda x:(100*x[1]/x[0]))[-1])

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

int main() {
  int h,a;
  cin >> h >> a;
  int cnt = 0;
  while (h > 0) {
    cnt++;
    h -= a;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3580
fun main(args:Array<String>){
    var n = readLine()!!.toLong() / 2
    var count: Long = 1
    var s: Long =  1

    while(true){
        if(n < 1){
            println(count)
            break
        }
        n /= 2
        s *= 2
        count += s
    }
}


Measured memory_bytes: 31740
#include<stdio.h>
#include<string.h>
int N,M,K,L[105][105],G[105][105],i,j,k,s,t,f[105][105],r=0;
char c[5];


int main()
{
	scanf("%d%d",&M,&N);
	memset(L,0xf0,sizeof(L));
	memset(G,0x70,sizeof(G));
	for(i=0;i<M;i++)
	{
		for(scanf("%d",&K);K--;)
		{
			scanf("%d%s%d",&s,c,&t);
			s--;
			if(c[0]=='<'&&G[i][s]>t)
				G[i][s]=t;
			else if(c[0]=='>'&&L[i][s]<t)
				L[i][s]=t;
		}
	}
	for(i=0;i<M;i++)
		for(j=0;j<M;j++)
			for(k=0;k<N;k++)
				if(G[i][k]<L[j][k])
					f[i][j]=1;
	for(k=0;k<M;k++)
		for(i=0;i<M;i++)
			for(j=0;j<M;j++)
				f[i][j]|=f[i][k]&f[k][j];
	for(i=0;i<M;i++)
		if(f[i][i])
			goto e;
	r=1;
e:	puts(r?"Yes":"No");
	return 0;
}

Measured memory_bytes: 724
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define MP make_pair
#define fi first
#define se second 
#define pb push_back
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int N=100010;
int L[N],R[N];
multiset<pair<int,int> > s1,s2;
multiset<pair<int,int> >::iterator it;
int cur;ll dis;ll ans;
int n;

void work(){
	pair<int,int> now;
	while(true){
		if(!s1.empty()){			
			it=s1.begin();now=*it;
			if(-now.fi>cur){
				dis+=-now.fi-cur;
				cur=-now.fi;
				s1.erase(s1.find(now));
				s2.erase(s2.find(MP(-now.se,-now.fi)));
				continue;
			}
		}
		if(!s2.empty()){			
			it=s2.begin();now=*it;
			if(now.fi<cur){
				dis+=cur-now.fi;
				cur=now.fi;
				s2.erase(s2.find(now));
				s1.erase(s1.find(MP(-now.se,-now.fi)));
				continue;
			}
		}
		break;
	}
	dis+=abs(cur);
	ans=max(ans,dis);
}

int main(){
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	int i,x,y;
	pair<int,int> now;
	scanf("%d",&n);
	rep(i,1,n){
		scanf("%d%d",&L[i],&R[i]);		
	}
	rep(i,1,n){
		x=L[i];y=R[i];
		s1.insert(MP(-x,-y));
		s2.insert(MP(y,x));
	}
	cur=0;dis=0;
	it=s1.begin();now=*it;
	if(-now.fi>0){
		cur=-now.fi;dis=-now.fi;
		s1.erase(s1.find(now));
		s2.erase(s2.find(MP(-now.se,-now.fi)));
	}
	work();
	s1.clear();s2.clear();
	rep(i,1,n){
		x=L[i];y=R[i];
		s1.insert(MP(-x,-y));
		s2.insert(MP(y,x));
	}
	cur=0;dis=0;
	it=s2.begin();now=*it;
	if(now.fi<0){
		cur=now.fi;dis=-now.fi;
		s2.erase(s2.find(now));
		s1.erase(s1.find(MP(-now.se,-now.fi)));
	}
	work();
	printf("%lld\n",ans);
	return 0;
}
























Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define fi first
#define sc second
int n;
vector<int>vec;
int dp[5005][5005];

int main(){
	cin >> n;
	rep(i,n){ int a; cin >> a; vec.pb(a); }
	sort(vec.begin(),vec.end());
	rep(i,n) for(int j=i+1;j<n;j++) dp[i][j] = 2;
	rep(i,n){
		int x = i+1;
		for(int j=i+1;j<n;j++){
			while(x < n && vec[j]-vec[i] > vec[x]-vec[j]) x++;
			if(x == n) break;
			if(vec[j]-vec[i] == vec[x]-vec[j]){
				dp[j][x] = max(dp[j][x],dp[i][j]+1);
			}
		}
	}
	int ans = 0;
	rep(i,n) rep(j,n) ans = max(ans,dp[i][j]);
	cout << ans << endl;
}



Measured memory_bytes: 69964
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var X, A, B int
	scanner.Scan()
	X, _ = strconv.Atoi(scanner.Text())
	scanner.Scan()
	A, _ = strconv.Atoi(scanner.Text())
	scanner.Scan()
	B, _ = strconv.Atoi(scanner.Text())

	X -= A
	fmt.Println(X - B*(X/B))
}

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

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class CGreenBin {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N;
	    in >> N;
	    vector<string> s(N);
	    REP(i,0,N) in >> s[i];

	    unordered_map<string, int> anagrams;
	    REP(i,0,N) {
	        string key = "";
	        for (const char c : "abcdefghijklmnopqrstuvwxyz") {
	            key += toString(count(all(s[i]), c));
	        }
	        anagrams[key]++;
	    }
	    ll answer = 0;
	    for (const auto grams : anagrams) {
	        const ll num = grams.second;
	        if (num > 1) {
	            answer += num * (num-1) / 2;
	        }
	    }
	    out << answer << "\n";
	}
};


int main() {
	CGreenBin solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 20772
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;

int main()
{
  // 整数の入力
  ll N,K;
  cin >> N >> K;
  set<ll> has;
  for(int i = 0;i < K;i++){
    ll d;
    cin >> d;
    for(int j = 0; j < d;j++){
      ll a;
      cin >> a;
      has.insert(a);
    }
  }
  cout << N - has.size() << endl;
  return 0;
}

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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
int n, q;
set<int> S;
ll d[100000];
vector<ll> vec;

void solve(){
    int ans = 0;
    /*
    for (int i = 0; i < q; i++)
    {
        if(S.count(vec[i])) ans++;
    }
    
    */
   sort(begin(d), begin(d) + n - 1);
  

    for (int i = 0; i < q; i++)
    {
        int ok = -1;
        int ng = n;
        while(abs(ng - ok) > 1){
            int mid = (ng + ok) / 2;
            if(d[mid] == vec[i]){
                ans++;
                break;
            }
            else if(d[mid] < vec[i]){
                ok = mid;
            }
            else{
                ng = mid;
            }
        }
    }

    cout << ans << endl;
}


int main(){
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> d[i];
    }
  
    /*for (int i = 0; i < n; i++){
        int x;
        cin >> x;
        S.insert(x);
    }*/
    cin >> q;
    for (int i = 0; i < q; i++){
        ll x;
        cin >> x;
        vec.push_back(x);
    }

    solve();

    return 0;

}

void show_vec(vector<int> v){
    cout << "[";
    for (int i = 0; i < (int)v.size(); i++)
    {
        cout << v[i] << ","; 
    }
    cout << "]" << endl;
}


Measured memory_bytes: 4220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef pair<int,int> P;

int main() {
    int i,j,n,p,q,temp;
    int t=0;
    int flag=0;
    string s;
    cin>>s;
    for(i=0; i<3; i++){
        if(s[i]=='o'){flag++;}
    }
    t=700+flag*100;
    cout<<t;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    
    for(int i=0;i<n;i++){
        if(v[i]%2==0){
            if(v[i]%3!=0&v[i]%5!=0){
                cout<<"DENIED";
                return 0;
            }
        }
    }
    cout<<"APPROVED";
    return 0;
}

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

int main() {
	int n;
	string s;
	stack<char> st;
	cin >> n >> s;
	for(char i : s){
		if(st.empty()){
			st.push(i);
		}else{
			if(i == st.top()) continue;
			st.push(i);
		}
	}
	cout << st.size();
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
vector<int>g[11000];
int c[110000];
int ans[110000];
int sz;
void dfs(int a,int b){
	ans[a]=c[sz++];
	for(int i=0;i<g[a].size();i++){
		if(g[a][i]==b)continue;
		dfs(g[a][i],a);
	}
}
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a-1;i++){
		int p,q;scanf("%d%d",&p,&q);p--;q--;
		g[p].push_back(q);
		g[q].push_back(p);
	}
	int ret=0;
	for(int i=0;i<a;i++){
		scanf("%d",c+i);
		ret+=c[i];
	}
	std::sort(c,c+a);
	reverse(c,c+a);
	dfs(0,-1);
	ret-=c[0];
	printf("%d\n",ret);
	for(int i=0;i<a;i++){
		if(i)printf(" ");
		printf("%d",ans[i]);
	}printf("\n");

}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] candyCount = new int[2][N];
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < N; j++) {
				candyCount[i][j] = sc.nextInt();
			}
		}
		int sum = 0;
		int ans = 0;

		for (int i = 0; i < N; i++) {
			sum = 0;
			for (int j = 0; j <= i; j++) {
				sum += candyCount[0][j];
			}
			for (int j = N-1; j >= i; j--) {
				sum += candyCount[1][j];
			}
			ans = Math.max(ans, sum);
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int n,a[100010];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	printf("%d",n%2?0:a[n/2+1]-a[n/2]);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans


void solve() {
}

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

    int N, K;
    vi p;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        p.push_back(a);
    }
    sort(all(p));
    int ans = 0;
    for (int i = 0; i < K; i++) {
        ans += p[i];
    }
    cout << ans << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
int main()
{
  long long int a,b,c,k;
  scanf("%lld %lld %lld %lld",&a,&b,&c,&k);
  if(a>=k)  printf("%lld",k);
  else if(a<k&&(a+b)>=k) printf("%lld",a);
  else if((a+b)<k) printf("%lld",a-(k-a-b));
  return 0;
}


Measured memory_bytes: 1720
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d)cout<<"Left"<<endl;
    if(a+b<c+d)cout<<"Right"<<endl;
    if(a+b==c+d)cout<<"Balanced"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
K = int(input())
input_AB = input().split(' ')
A = int(input_AB[0])
B = int(input_AB[1])
divA = A // K
divB = B // K

if divA != divB:
  print('OK')
elif A % K == 0 or B % K == 0:
  print('OK')
else:
  print('NG')

Measured memory_bytes: 9180
n = int(input())
a = [int(i) for i in input().split()]
a_b_sort = a[:]
a.sort()
num=0
flag = 1


if a_b_sort==a:
    print("YES")
    flag = 0


for i in range(len(a)):
    if a[i] != a_b_sort[i]:
        num += 1
        
    if num > 2:
        print("NO")
        flag = 0
        break
        
if flag==1:
    print("YES")

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

using namespace std;

int main(){
  int n,d; cin >> n >> d;
  vector<vector<int>> x(n,vector<int>(d));
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin >> x[i][j];
    }
  }
  int count =0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int dis=0;
      for(int k=0;k<d;k++){
        dis += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      for(int s=0;s<130;s++){
        if(dis==s*s){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}

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

int main(){
	int a,b,c,d,e = 0;

	cin>>a>>b>>c;
	
	for(d = a; d <= b; d++ ){
		if((c % d) == 0) e++;
	}
	cout<<e<<endl;

	return 0;
}


Measured memory_bytes: 3104