akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const long MOD=(long)(1e9+7);
vector<int> adj[MAXN];
vector<pair<int,int>> G[MAXN];

Int N,M,K;
//Int B,C,H,W;
Int X,Y,Z;
//vector<Int> A;

Int ceilS(Int x,Int y){
    return (x+y-1)/y;
}
using D=long double;

Int perform(Int x){
    return (x*(x+1))/2LL;
}

int main()
{
        cin>>N;
        Int A[N][3];
        
        for(int i=0;i<N;++i){
            cin>>A[i][0]>>A[i][1]>>A[i][2];
        }
        
        Int dp[N][3];
        for(int i=0;i<3;++i) dp[0][i]=A[0][i];
        
        for(int i=1;i<N;++i){
            dp[i][0]=max(dp[i-1][1],dp[i-1][2])+A[i][0];
            dp[i][1]=max(dp[i-1][0],dp[i-1][2])+A[i][1];
            dp[i][2]=max(dp[i-1][0],dp[i-1][1])+A[i][2];
        }
        Int ans=max({dp[N-1][0],dp[N-1][1],dp[N-1][2]});
        cout<<ans<<"\n";
        
}


Measured memory_bytes: 31716
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;


int main()
{
  int N,A,B,C,X;
  while(cin>>N>>A>>B>>C>>X){
    if(N == 0) return 0;
    int Y[N];
    FOR(i,0,N) cin >> Y[i];
    int fr = 0;
    int now = 0;
    int rnd = X;
    bool ok = false;
    while(fr <= 10000) {
      if(Y[now] == rnd) now++;
      if(now == N) {
        cout << fr << endl;
        ok = true;
        break;
      }
      rnd = (A * rnd + B) % C;
      fr++;
    }
    if(!ok) cout << -1 << endl;
  }
  return 0;
}

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

int main() {
  int n,min = 2*100000+1,ans = 0;
  cin >> n;
  for(int i = 0;i < n;i++){
    int p;
    cin >> p;
    if(p < min){
      min = p;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
using namespace std;

int n, a, b, c;
string s;

int main()
{
    cin >> a >> b >> c;
    swap(a, b), swap(a, c);
    cout << a << " " << b << " " << c << endl;

    return 0;
}


Measured memory_bytes: 256
from collections import deque
n,q = map(int,input().split())
l = deque(list(map(str,input().split())) for _ in range(n))
t = 0
while l :
  a,b = l.popleft()
  b = int(b)
  if b<=q:
    t += b
    print(a,t)
  else:
    b -= q
    t += q
    l.append([a,b])
  


Measured memory_bytes: 14600
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 1e5 + 7;
string s;
int q, l[N], r[N], sum[N], d[N];
vector <int> g[N];
bool used[N];
int n;

bool have = 0;
int dfs(int u) {
    have |= u == 1;
    have |= u > n;
    int ans = d[u];
    used[u] = 1;
    for (int v : g[u]) {
        if (!used[v]) {
            ans += dfs(v);
        }   
    }
    return ans;
}   

int get(int i) {
    return (s[i] - s[i - 1] + 26) % 26;
}

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    cin >> s;
    n = s.size();
    s = "a" + s + "a";
    cin >> q;
    for (int i = 0; i < q; ++i) {
        cin >> l[i] >> r[i];
        ++r[i];
        g[l[i]].app(r[i]);
        g[r[i]].app(l[i]);

        //cout << "edge " << l[i] << ' ' << r[i] << endl;

    }    
    for (int i = 1; i <= n / 2; ++i) {
        int a = get(i + 1), b = get(n - i + 1);

        //cout << "edge " << i + 1 << ' ' << n - i + 1 << endl;

        g[i + 1].app(n - i + 1);
        g[n - i + 1].app(i + 1);
        d[i + 1] = a;
        d[n - i + 1] = b;
    }   
    /*
    for (int i = 1; i <= n; ++i) {
        cout << d[i] << ' ';
    }   
    cout << endl;
    */
    for (int i = 0; i < N; ++i) {
        if (!used[i]) {
            have = 0;
            int s = dfs(i);
            if (s % 26 && !have) {
                cout << "NO" << endl;
                //cout << i << ' ' << s << endl;
                exit(0);
            }   
        }   
    }
    cout << "YES" << endl;
}   

Measured memory_bytes: 12396
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

const double PI = acos(-1);
constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class Task{
public:
    void solve(istream& in, ostream& out){
        int A, B, H, M;
        in>>A>>B>>H>>M;
        complex<double> X = polar(1.0*A, (60*H+M)/360.0*PI);
        complex<double> Y = polar(1.0*B, M/30.0*PI);
        out<<setprecision(12)<<fixed<<abs(X-Y)<<'\n';
    }
};

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

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(i, n) for(int i = n-1; i >= (int)0; i--)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;

int main(){
    string s;
    std::cin >> s;
    rep(i,s.size()-1){
        if(s.substr(i,2)=="AC"){
            std::cout << "Yes" << std::endl;
            exit(0);
        }
    }
    std::cout << "No" << std::endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#ifdef sahdsg
#define DBG(...) printf(__VA_ARGS__)
#else
#define DBG(...) (void)0
#endif // sahdsg

using namespace std;
typedef long long LL;
char s[100007];
char k[100007];
char p[100007];
int main()
{
    scanf("%s",s);
    int l=strlen(s);
    for(int i=0; i<=l/2+2; i++) {
        k[i*2]='0',k[i*2+1]='1';
        p[i*2]='1',p[i*2+1]='0';
    }
    int ans1=0, ans2=0;
    for(int i=0; i<l; i++) {
        if(s[i]!=k[i]) ans1++;
        if(s[i]!=p[i]) ans2++;
    }
    printf("%d\n", min(ans1,ans2));
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
    int S, h, m, s;
    cin >> S;
    h = S / (60*60);
    m = (S - h * 60 * 60) / 60;
    s = S % 60;
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


Measured memory_bytes: 3100
a,b,c,x,y=[int(i) for i in input().split()]
Min=min(x,y)
ans=0
if c*Min*2<=(a+b)*Min:
    ans+=c*Min*2
else:
    ans+=(a+b)*Min
x,y=x-Min,y-Min
if x>0:
    if c*x*2<=a*x:
        ans+=c*x*2
    else:
        ans+=a*x
if y>0:
    if c*y*2<=b*y:
        ans+=c*y*2
    else:
        ans+=b*y
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
 
int main(void)
{
	int i, j, a, b, q;
	char str[1001], order[10], p[1001];
	scanf("%s",str);
	scanf("%d",&q);
	for (i=0; i<q; i++) {
		scanf("%s %d %d",order,&a,&b);
		if(strcmp(order,"print")==0) {
			for(j=a; j<=b; j++) {
				printf("%c",str[j]);
			}
			printf("\n");
		} else if(strcmp(order,"reverse")==0) {
			strcpy(p,str);
			for(j=a; j<=b; j++) {
				str[j] = p[a+b-j];
			}
		} else if(strcmp(order,"replace")==0) {
			scanf("%s",p);
			for(j=a; j<=b; j++) {
				str[j] = p[j-a];
			}
		}
	}
	return 0;
}

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

int main() {
	int N, M;
	cin >> N>> M;
	vector<int>vec(M, 0);
	for (int i = 0; i < N; i++) {
		int K;
		cin >> K;
		for (int j = 0; j < K; j++) {
			int A;
			cin >> A;
			A = A - 1;
			++vec[A];
		}
	}
	int ans = 0;
	for (int i = 0; i < M; i++) {
		if (vec[i] == N) ans++; 
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(N: int):
    if "9" in str(N):
        yes()
    else:
        no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <numeric>
#include <bitset>
#include <stack>
using namespace std;

class State
{
public:
  int p, cost;
  State(int pp = 0, int cc = 0)
    :p(pp), cost(cc) {}
  bool operator < (const State& st) const
  {
    return this->cost > st.cost;
  }
};

int string2index(vector<string>& index, const string& s)
{
  for (unsigned int i = 0; i < index.size(); ++i) {
    if (index[i] == s)
      return i;
  }
}

int main()
{
  const int INF = 1 << 28;

  int n, m;
  while (cin >> n >> m) {
    if (n == 0 && m == 0)
      break;
    string s, p, g;
    cin >> s >> p >> g;

    set<string> s2i;
    vector<string> a(m), b(m);
    vector<int> d(m), t(m);
    for (int i = 0; i < m; ++i) {
      cin >> a[i] >> b[i] >> d[i] >> t[i];
      s2i.insert(a[i]);
      s2i.insert(b[i]);
    }

    vector<string> index;
    for (set<string>::iterator it = s2i.begin(); it != s2i.end(); ++it)
      index.push_back(*it);

    vector<vector<int> > cost(n, vector<int>(n, INF));
    for (int i = 0; i < n; ++i)
      cost[i][i] = 0;

    for (int i = 0; i < m; ++i) {
      int ss = string2index(index, a[i]);
      int tt = string2index(index, b[i]);
      cost[ss][tt] = cost[tt][ss] = d[i] / 40 + t[i];
    }

    /*
    for (int k = 0; k < n; ++k) {
      for (int i = 0; i < n; ++i) {
	for (int j = 0; j < n; ++j)
	  cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]);
      }
    }
    */

    int ss = string2index(index, s);
    int pp = string2index(index, p);
    int gg = string2index(index, g);

    int ans = 0;
    priority_queue<State> que1;
    que1.push(State(ss, 0));
    vector<int> visited(n, INF);
    while (!que1.empty()) {
      const State st = que1.top();
      que1.pop();

      if (st.p == pp) {
	ans += st.cost;
	break;
      }

      if (visited[st.p] < st.cost)
	continue;

      visited[st.p] = st.cost;
      for (int i = 0; i < n; ++i) {
	if (cost[st.p][i] == 0 || cost[st.p][i] == INF)
	  continue;

	int new_cost = st.cost + cost[st.p][i];
	if (visited[i] > new_cost) {
	  visited[i] = new_cost;
	  que1.push(State(i, new_cost));
	}
      }
    }

    for (int i = 0; i < n; ++i)
      visited[i] = INF;
    priority_queue<State> que2;
    que2.push(State(pp, 0));
    while (!que2.empty()) {
      const State st = que2.top();
      que2.pop();

      if (st.p == gg) {
	ans += st.cost;
	break;
      }

      if (visited[st.p] < st.cost)
	continue;

      visited[st.p] = st.cost;
      for (int i = 0; i < n; ++i) {
	if (cost[st.p][i] == 0 || cost[st.p][i] == INF)
	  continue;

	int new_cost = st.cost + cost[st.p][i];
	if (visited[i] > new_cost) {
	  visited[i] = new_cost;
	  que2.push(State(i, new_cost));
	}
      }
    }

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

Measured memory_bytes: 2328
N = int(input())
A = list(map(int, input().split()))
B = [0]
for i in range(1, N):
    if A[i - 1] - A[i] > 0:
        B.append(A[i - 1] - A[i])
        A[i] += A[i - 1] - A[i]
print(sum(B))

Measured memory_bytes: 32252
from collections import Counter
n = int(input())
aaa = list(map(int, input().split()))
cnt_a = Counter(aaa)
ans = 0
for key in cnt_a.keys():
    value = cnt_a[key]
    if key > value:
        ans += value
    elif key < value:
        ans += value - key
    else:
        continue
print(ans)

Measured memory_bytes: 18672
using System;
using System.Collections;
class main{
	public static void Main(){
		int[] i = new int[10000000];
		int j = 0;
		while (true)
		{
			i[j] = int.Parse(Console.ReadLine());
			if(i[j] == 0) break;
			j++;
		}
		for (int k = 0; k < j; k++)
		{
			Console.WriteLine("Case {0}: {1}", k + 1, i[k]);
		}
	}
}

Measured memory_bytes: 52264
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

using namespace std;

const int INF = 1000000;
const int N = 102;

int h, w;
char mapData[N][N];
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
int height[N][N];

class State{
public:
  int y, x, cost;
};

int bfs(){
  State u, v;
  u.y = 0;
  u.x = 0;
  u.cost = 0;
  queue<State> Q;
  Q.push(u);
  int res = INF;
  fill(height[0], height[N], INF);
  height[0][0] = 0;
  while(!Q.empty()){
    u = Q.front(); Q.pop();
    if(mapData[u.y][u.x] == '&') res = min(res, u.cost);
    for(int i=0;i<4;i++){
      v.y = u.y + dy[i];
      v.x = u.x + dx[i];
      if(v.y < 0 || v.y >= h) continue;
      if(v.x < 0 || v.x >= w) continue;
      v.cost = u.cost;
      if(mapData[v.y][v.x] != '#' && mapData[u.y][u.x] == '#') ++v.cost;
      if(height[v.y][v.x] <= v.cost) continue;
      height[v.y][v.x] = v.cost;
      Q.push(v);
    }
  }
  return res;
}

main(){
  while(cin >> w >> h && (h || w)){
    for(int i=1;i<=h;i++){
      for(int j=1;j<=w;j++){
	cin >> mapData[i][j];
      }
    }
    h += 2;
    w += 2;
    for(int i=0;i<h;i++) mapData[i][0] = '.';
    for(int i=0;i<h;i++) mapData[i][w-1] = '.';
    for(int j=0;j<w;j++) mapData[0][j] = '.';
    for(int j=0;j<w;j++) mapData[h-1][j] = '.';
    cout << bfs() << endl;
  }
  return 0;
}

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

using namespace std;
#define ll long long 
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  ll res = 0;
  REP(i, n) cin >> a[i]; 

  for (ll left = 0; left < n; ++left) {
            ll ans = 0;

            while (left < n - 1 && a[left+1] <= a[left]) {
                // cout << left <<endl;
                left++;
                ans++;
                
            }

            res = max(res, ans);
        }

      cout << res << endl;
}

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

#define y1 asndja
#define ii pair < int , int >
#define iii pair < int , ii >
#define iv pair < ii , ii >

#define fi first
#define se second
#define t top()
#define fr front()
#define pb push_back

#define FOR(i , x , n) for(int i = x ; i <= n ; ++i)
#define REP(i , x) for(int i = 0 ; i < x ; ++i)
#define FORD(i , x , n) for(int i = x ; i >= n ; --i)

#define ll long long
#define oo 1e8
#define int long long

const int N = 23;
const int MASK = (1 << N);
int n , mod = 1e9 + 7;
int b[N];
int a[N][N];
int dp[N][MASK];
vector < int > g[N];

main()
{
    //freopen("O.inp","r",stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    FOR(i , 1 , n)
        FOR(j , 1 , n)
            cin >> a[i][j];
    REP(j , (1 << n))
    {
        int r = 0;
        FORD(i , n , 0)
            if((j >> i) & 1)
                b[++r] = i;
        g[r].pb(j);
    }
    dp[0][0] = 1;
    FOR(i , 1 , n)
    {
        REP(s , g[i].size())
        {
            int u = g[i][s];
            FORD(j , n , 0)
                if((u >> j) & 1 && a[i][j + 1] == 1)
                    dp[i][u] = (dp[i][u] + dp[i - 1][u ^ (1 << j)]) % mod;
        }
    }
    cout << dp[n][(1 << n) - 1];
}


Measured memory_bytes: 343584
#include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;

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

    int p[n];
    for (auto i = 0; i < n; i++) cin >> p[i];
    sort(p, p + n);

    cout << accumulate(p, p + k, 0);
}

Measured memory_bytes: 3612
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int main(){
    int h,i,j,w,k,count=0,ans=0,rh[6]={},rw[6]={};
    char c[7][7]={},d[7][7]={};
    scanf("%d %d %d\n",&h,&w,&k);
    for(i=0; i<h; i++){
        for(j=0; j<w; j++){
            scanf("%c\n",&c[i][j]);
            d[i][j]=c[i][j];
        }
    }
    for(rh[0]=0; rh[0]<=1; rh[0]++){
        for(rh[1]=0; rh[1]<=1; rh[1]++){
            if(rh[1]==1 && h<=1)continue;
            for(rh[2]=0; rh[2]<=1; rh[2]++){
                if(rh[2]==1 && h<=2)continue;
                for(rh[3]=0; rh[3]<=1; rh[3]++){
                    if(rh[3]==1 && h<=3)continue;
                    for(rh[4]=0; rh[4]<=1; rh[4]++){
                        if(rh[4]==1 && h<=4)continue;
                        for(rh[5]=0; rh[5]<=1; rh[5]++){
                            if(rh[5]==1 && h<=5)continue;
                            for(rw[0]=0; rw[0]<=1; rw[0]++){
                                for(rw[1]=0; rw[1]<=1; rw[1]++){
                                    if(rw[1]==1 && w<=1)continue;
                                    for(rw[2]=0; rw[2]<=1; rw[2]++){
                                        if(rw[2]==1 && w<=2)continue;
                                        for(rw[3]=0; rw[3]<=1; rw[3]++){
                                            if(rw[3]==1 && w<=3)continue;
                                            for(rw[4]=0; rw[4]<=1; rw[4]++){
                                                if(rw[4]==1 && w<=4)continue;
                                                for(rw[5]=0; rw[5]<=1; rw[5]++){
                                                    if(rw[5]==1 && w<=5)continue;
                                                    for(i=0; i<h; i++){
                                                        for(j=0; j<w; j++){
                                                            if(rh[i]==1 || rw[j]==1){
                                                                c[i][j]='.';
                                                            }
                                                            if(c[i][j]=='#')count++;
                                                        }
                                                    }
                                                    if(count==k)ans++;
                                                    for(i=0; i<h; i++){
                                                        for(j=0; j<w; j++){
                                                            c[i][j]=d[i][j];
                                                        }
                                                    }
                                                    count=0;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <iomanip>
#define rep(i, a, b) for (int(i) = (a); i < (b); i++)
using namespace std;

using ll = long long;

typedef pair<int, int> P;

const int INF = 100000000;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;

ll pow_mod(ll x, ll y, ll mod)
{
	ll ans=1;
	for(;y>0;y>>=1){
		if(y&1)(ans*=x)%=mod;
		(x*=x)%=mod;
	}
	return ans;
}

ll a,b,c,k;
ll ans;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	//問題文中の添え字が0-indexか1-indexか確認!
	cin>>a>>b>>c>>k;
	(a-b>=0)?ans=a-b:ans=b-a;
	if(ans>1e18){
		cout<<"Unfiar";
	}else if(k%2){
		cout<<b-a;
	}else{
		cout<<a-b;
	}
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <map>
const int INF = 1e9;
using namespace std;

pair<string, string> get_name(string S){
  string s, t;
  for(int i = 0; i < S.length(); ++i){
    if(S[i] == '-'){
      t = S.substr(i+1);
      break;
    }
    s += S[i];
  }
  return pair<string, string>(s, t);
}

void dfs(vector< vector<int> > &G, vector<int> &C, int v){
  int n = G.size();
  for(int i = 0; i < n; ++i){
    if(G[v][i] >= INF && G[i][v] >= INF) continue;
    if(C[i] == 0){
      C[i] = -C[v];
      dfs(G, C, i);
    }
  }
}

int main(){
  int N;
  while(cin >> N, N){
  map<string, int> m;
  vector<string> from(N), to(N);
  for(int i = 0; i < N; ++i){
    string s;
    cin >> s;
    pair<string, string> E = get_name(s);
    //cout << E.first << " " << E.second << endl;
    m[E.first] = 1;
    m[E.second] = 1;
    from[i] = E.first;
    to[i] = E.second;
  }
  int t = 1;
  for(auto itr = m.begin(); itr != m.end(); ++itr){
    itr->second = t;
    ++t;
  }
  int n = m.size();
  cout << n << endl;
  vector< vector<int> > G(n, vector<int>(n, INF));
  for(int i = 0; i < N; ++i){
    int u = m[from[i]] - 1, v = m[to[i]] - 1;
    G[u][v] = 1;
  }
  vector<int> C(n, 0);
  for(int i = 0; i < n; ++i){
    if(!C[i]){
      C[i] = 1;
      dfs(G, C, i);
    }
  }

  vector< vector<int> > G_ = G;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < n; ++j){
      if(G[i][j] < INF || G[j][i] < INF) continue;
      bool f = false;
      for(int k = 0; k < n; ++k){
        if((G[i][k] < INF && G[j][k] < INF) || (G[k][i] < INF && G[k][j] < INF)){
          f = true;
          break;
        }
      }
      for(int k = 0; k < n; ++k){
        if((G[i][k] < INF && G[k][j] < INF) || (G[k][i] < INF && G[j][k] < INF)){
          f = false;
          break;
        }
      }
      if(f){
        G_[i][j] = 1;
        G_[j][i] = 1;
      }
    }
  }

  for(int k = 0; k < n; ++k){
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j){
        G_[i][j] = min(G_[i][j], G_[i][k] + G_[k][j]);
      }
    }
  }

  //for(auto itr = m.begin(); itr != m.end(); ++itr) cout << itr->first << " " << itr->second << endl;
  //for(int i = 0; i < n; ++i) cout << C[i] << " ";cout << endl;

  int M;
  cin >> M;
  for(int i = 0; i < M; ++i){
    string S;
    cin >> S;
    pair<string, string> Q = get_name(S);
    int u = m[Q.first] - 1, v = m[Q.second] - 1;
    if(u < 0 || v < 0){
      cout << "NO" << endl;
      continue;
    }
    if(C[u] != C[v] && G_[u][v] < INF) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  }
  return 0;
}



Measured memory_bytes: 3436
import java.io.*;
import java.security.MessageDigestSpi;
import java.util.*;

class Main {
    static long x, k, mod;
    public static void main(String args[]) {
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int t = sc.nextInt();
        long ans = 0;
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();
        ans += t;
        for (int i = 1; i < n; i++) {
            if (a[i] - a[i-1] <= t) {
                ans += a[i] - a[i - 1];
            }
            else {
                ans += t;
            }
        }
        out.print(ans);
        out.close();
    }



    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 48352
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,K;
	cin >> n >> K;
	vector<int> x(n);
	vector<int> y(n);
	vector<P> xy(n);

	for(int i = 0;i < n;i++){
		int xx,yy;
		cin >> xx >> yy;
		x[i] = xx;
		y[i] = yy;
		xy[i] = P(xx,yy);
	}

	sort(x.begin(),x.end());
	sort(y.begin(),y.end());

	map<int,int> zx;
	map<int,int> zy;
	for(int i = 0;i < n;i++){
		zx[x[i]] = i+1;
		zy[y[i]] = i+1;
	}
	vector<vector<int>> grid(n+1,vector<int>(n+1,0));

	for(int i = 0;i < n;i++){
		int pos_x = zx[xy[i].first];
		int pos_y = zy[xy[i].second];
		grid[pos_y][pos_x]++;
	}

	for(int i = 1;i <= n;i++){
		for(int j = 0;j < n;j++){
			grid[i][j+1] = grid[i][j+1] + grid[i][j];
		}
	}

	for(int i = 1;i <= n;i++){
		for(int j = 0;j < n;j++){
			grid[j+1][i] = grid[j+1][i] + grid[j][i];
		}
	}

	ll ans = 5e18;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			for(int k = i+2;k <= n;k++){
				for(int l = j+2;l <= n;l++){
					int cnt = grid[k][l] - grid[i][l] - grid[k][j] + grid[i][j];
					ll dx = x[l-1] - x[j];
					ll dy = y[k-1] - y[i];
					if(cnt >= K){
						ans = min(ans,dx*dy);
					}
				}
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int INF = 1000000000; // 10^

int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    long double a, b ,c;
    cin >> a >> b >> c;
    long double eps = 1.0E-14;
    if(sqrt(a) + sqrt(b) + eps < sqrt(c)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

// {{{
#define PI pair<int, int>
#define mk make_pair
#define reg register
#define ll long long
#define rep(i, a, b) for(reg int i = a; i <= b; ++i)
#define per(i, a, b) for(reg int i = a; i >= b; --i)
// }}}

using namespace std;

inline int min(reg int a, reg int b) { return a < b ? a : b; }
inline int max(reg int a, reg int b) { return a > b ? a : b; }
inline int read() {
    reg int s = 0, f = 1; reg char ch = getchar();
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return s * f;
}

#define N 100005

int n;
int a[N];
map<int, int> mp;
vector<int>G;

int main() {
    n = read();
    int cnt = 0;
    rep (i, 1, n) {
        a[i] = read();
        if (mp[a[i]] == 0) {
            cnt++;
            G.push_back(a[i]);
        }
        mp[a[i]]++;
    }
    if (n == 3) {
        int now = a[1] ^ a[2];
        now ^= a[3];
        if (now == 0) puts("Yes");
        else puts("No");
        return 0;
    }
    if (n % 3 == 0) {
        int check = 1;
        sort(a + 1, a + n + 1);
        rep (i, 1, n / 3) {
            if (i == 1) continue;
            if (a[i] != a[i - 1]) check = 0;
        }
        rep (i, n / 3 + 1, n / 3 * 2) {
            if (i == n / 3 + 1) continue;
            if (a[i] != a[i - 1]) check = 0;
        }
        rep (i, n / 3 * 2 + 1, n) {
            if (i == n / 3 * 2 + 1) continue;
            if (a[i] != a[i - 1]) check = 0;
        }
        int now = a[1] ^ a[n];
        now ^= a[n / 3 + 1];
        if (now != 0) check = 0;
        if (check) puts("Yes");
        else puts("No");
        return 0;
    }
    if (mp[0] == n) puts("Yes");
    else puts("No");
    return 0; 
}

/*
 _____________________________________ 
< A.cpp is created by zrz who is weak >
 ------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
*/


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

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

	vector<int> a(M), b(M);
	REP(i, M){
		cin >> a[i] >> b[i];
	}

	vector<int> number_of_road(N);
	REP(i, M){
		number_of_road[a[i] - 1]++;
		number_of_road[b[i] - 1]++;
	}
	REP(i, N){
		cout << number_of_road[i] << endl;
	}

}


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

vector<int> v[100005];
int a[100005];
int b[100005];
int visa[100005];
int visb[100005];

void dfs(int n )
{
    visa[n] = 1;

    for(int i = 0 ; i<v[n].size() ; i++)
    {
        if(visa[v[n][i]]==0){
        a[v[n][i]]+=(a[n]+1);
        dfs(v[n][i]);
        }
    }
}


void dfs2(int m)
{
    visb[m] = 1;

    for(int i = 0 ; i<v[m].size() ; i++)
    {
        if(visb[v[m][i]]==0){
        b[v[m][i]]+=(b[m]+1);
        dfs2(v[m][i]);
        }
    }
}

int main()
{
    int n;

    cin >> n;

    for(int i = 1 ; i<n ; i++)
    {
        int x , y;

        cin >> x >> y;

        v[x].push_back(y);
        v[y].push_back(x);
    }

    dfs(1);
    dfs2(n);

    int black = 0 , white = 0;

    for(int i = 2 ; i<n ; i++)
    {
        if(a[i]<=b[i])
        {
            black++;
        }
        else
        {
           white++;
        }
    }
    if(black>white)
    {
        cout << "Fennec";
        return 0;
    }
    else
    {
        cout << "Snuke";
        return 0;
    }
}


Measured memory_bytes: 11904
#include<bits/stdc++.h>
#include<string.h>
#define pb push_back
#define all(v) v.begin(),v.end()
#define see(x) cout<<#x<<" : "<<(x)<<endl;
#define ya cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define ff first
#define sc second
typedef long long ll;
using namespace std;

const ll N=100009;
vector<ll>v[N],ww[N];
bool vis[N];
ll ans[N];
void dfs(ll i)
{
    vis[i]=1;
    for(int j=0;j<v[i].size();j++)
    {
        int u=v[i][j];
        int w=ww[i][j];
        if(!vis[u])
        {
            if(w&1)
            {
                ans[u]=!ans[i];
            }
            else
            {
                ans[u]=ans[i];
            }
            dfs(u);
        }
    }
}
int main()
{
    //freopen("output.txt","r",stdin);
    int n,i,u,vv,w;
    cin >>n;
    for(i=1;i<n;i++)
    {
        cin >> u >> vv >> w;
        v[u].pb(vv);
        v[vv].pb(u);
        ww[u].pb(w);
        ww[vv].pb(w);
    }
    dfs(1);
    for(i=1;i<=n;i++)
    {
        cout<<ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 17796
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn prime_factorize(mut p: u64) -> Vec<(u64, u64)> {
    let mut res: Vec<(u64, u64)> = Vec::new();
    let mut a = 2;
    while a * a <= p {
        if p % a != 0 {
            a += 1;
            continue;
        }
        let mut ex = 0;
        while p % a == 0 {
            ex += 1;
            p /= a;
        }
        res.push((a, ex));
        a += 1;
    }

    if p != 1 {
        res.push((p, 1));
    }
    res
}

fn main() {
    let n: u64 = read();
    let p: u64 = read();

    //整数pを素数指数表現のデータにする
    let p_f = prime_factorize(p);

    let mut ans = 1;
    for i in 0..p_f.len() {
        ans *= p_f[i].0.pow((p_f[i].1 / n) as u32);
    }
    println!("{}", ans);
}


Measured memory_bytes: 2108
import java.util.Scanner;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    String b = sc.next();
    if(a < 3200){
      System.out.println("red");
    }else{
      System.out.println(b);      
    }
  }
}

Measured memory_bytes: 21844
N = str(input())
num = N[-1]
num = int(num)
 
if num == 3:
  print('bon')
elif num == 0 or num==1 or num==6 or num==8:
  print('pon')
#elif num ==2 or num==4 or num==5 or num==7 or num==9:
else:
  print('hon')

Measured memory_bytes: 9140
X = int(input())

if 400 <= X <= 599:
    print('8')
elif 600 <= X <= 799:
    print('7')
elif 800 <= X <= 999:
    print('6')
elif 1000 <= X <= 1199:
    print('5')
elif 1200 <= X <= 1399:
    print('4')
elif 1400 <= X <= 1599:
    print('3')
elif 1600 <= X <= 1799:
    print('2')
else:
    print('1')

Measured memory_bytes: 9120
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mod)) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto N = RD!long;
	auto M = RD!long;

	auto cnt = new long[](N);
	foreach (i; 0..M)
	{
		auto a = RD!long;
		auto b = RD!long;
		if (a == 1) ++cnt[b];
		else if (b == N) ++cnt[a];
	}
	bool ans = false;
	foreach (e; cnt)
	{
		if (e >= 2) ans = true;
	}

	writeln(ans ? "POSSIBLE" : "IMPOSSIBLE");
	stdout.flush();
}

Measured memory_bytes: 4860
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <cmath>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <set>
#include <bitset>
using ll = long long;
using namespace std;
#define INF 999999999

int main()
{
    int a[4] = {0, 0, 0, 0};
    int tmp;
    for (int i = 0; i < 6; i++)
    {
        cin >> tmp;
        a[tmp - 1]++;
    }
    bool s = true;
    for (int i = 0; i < 4; i++)
    {
        if (a[i] == 3)
            s = false;
    }
    if (s)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    int INF = (int)Math.pow(10,9);
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] a = new int[m];
    for(int i=0;i<m;i++)a[i]=sc.nextInt();
    int[] dp = new int[n+1];
    int[] num = {0,2,5,5,4,5,6,3,7,6};
    
    for(int i=1;i<=n;i++){
      for(int j=0;j<m;j++){
        if(i>=num[a[j]]){
          dp[i]=Math.max(dp[i],dp[i-num[a[j]]]+1);
        }
      }
      if(dp[i]==0)dp[i]=(-1)*INF;
    }
    Arrays.sort(a);
    int res = n;
    for(int i=0;i<dp[n];i++){
      for(int j=m-1;j>=0;j--){
        if(res-num[a[j]]>=0&&dp[res-num[a[j]]]==dp[res]-1){
          System.out.print(a[j]);
          res-=num[a[j]];
          break;
        }
      }
    }
    System.out.println("");
  }
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define rep(n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(n) cout<<a[i]<<endl printf("%s\n"," " );
#define sc(a) scanf("%d",&a);
#define scl(a) scanf("%lld",&a);
#define scf(a) ascanf("%f",&a);
#define ff first
#define ss second
#define pu push_back
#define inf 1000000001
#define MOD 1000000007 
#define INF 100000000000001
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    bool b = 0;
    int ans;
    int cnt=0;
    rep(s.length())
    {
    	if(s[i]-'0'!=b) cnt++;
    	b= !b; 
    }
    ans = cnt;
    b = 1;cnt = 0;
    rep(s.length())
    {
    	if(s[i]-'0'!=b) cnt++;
    	b= !b; 
    }
    ans =min({ans,cnt});
    cout<<ans<<endl; 
    return 0;

}
    

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
template<class T> struct rge { T b, e; };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
	~debug(){cerr<<endl;}
	template<class T> debug& operator<<(T x){cerr<<boolalpha<<x; return *this;}
	template<class B, class C> debug& operator<<(pair<B, C> x){return *this<<"("<<x.first<<", "<<x.second<<")";}
	template<class T> debug& operator<<(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}return *this<<"]";}
	template<class T> debug& operator<<(vector<T> x){ return *this<<range(x.begin(),x.end());}
#else
	template<class T> debug& operator <<(const T&){return *this;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;

int ans = 0;
const int MAXQ = 55;
int a[MAXQ], b[MAXQ], c[MAXQ], d[MAXQ], q;

void rec(vector<int>& arr, int n, int lo, int hi) {
    if(n == 0) {
        // evaulate score
        int cur = 0;
        for(int i = 0; i < q; i++) {
            if(arr[b[i]] - arr[a[i]] == c[i]) {
                cur += d[i];
            }
        }
        ans = max(ans, cur);
    }
    else {
        for(int x = lo; x <= hi; x++) {
            arr.push_back(x);
            rec(arr, n-1, x, hi);
            arr.pop_back();
        }
    }
}

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

    int n, m;
    cin >> n >> m >> q;
    for(int i = 0; i < q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i], --b[i];
    }
    vector<int> cur;
    rec(cur, n, 1, m);
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include<limits.h>
#include<algorithm>
#include<queue>
#include<set>
#include<math.h>
#include<random>
#include<set>

#define lli long long int
#define MOD 1000000007

using namespace std;

long long int modpow(long long int a, long long int n) {
	if (n == 0)return 1;
	if (n == 1)return (a % MOD);

	long long int hanbun = n / 2;
	long long int amari = n % 2;

	long long int ans = (a * a) % MOD;
	ans = modpow(ans, hanbun);

	if (amari == 1)ans *= a;

	ans %= MOD;

	return ans;

}

long long int gcd(long long int a, long long int b) {
	if (a < b) {
		long long int tmp = a;
		a = b;
		b = tmp;
	}

	long long int amari = a % b;

	if (amari == 0)return b;

	return gcd(b, amari);
}

long long int lcm(long long int a, long long int b) {
	long long int ans = (a * b) % MOD;
	long long int wari = modpow(gcd(a, b), MOD - 2);
	ans = (ans * wari) % MOD;
	return ans;
}

long long int factElement[10000] = { 0 };

long long int factrial(int n) {

	if (factElement[n] != 0)return factElement[n];

	if (n == 0) {
		factElement[0] = 1;
		return factElement[n];
	}

	long long int ans = n * factrial(n - 1);
	factElement[n] = ans;
	return factElement[n];

}

struct SegmentTree {
private:
	int n;
	vector<long long int> node;
	int TANNI;

	long long int Func(long long int a, long long int b) {
		return min(a,b);
	}

public:
	//元配列ｖをセグメント木で表現する。
	SegmentTree(vector<long long int> v, long long int tanni) {
		//最下段のノード数は元配列のサイズ以上になる最小の2冪→これをｎとおく。
		//セグメント木全体で必要なノード数は2n-1個である。
		int sz = v.size();
		n = 1;
		while (n < sz)n *= 2;

		TANNI = tanni;
		node.resize(2 * n - 1, TANNI);

//最下段に値を入れた後に、下の段から順番に値を入れる。
//値を入れるには、自分の子の２値を参照すればよい。
for (int i = 0; i < sz; i++)node[i + n - 1] = v[i];
for (int i = n - 2; i >= 0; i--)node[i] = Func(node[2 * i + 1], node[2 * i + 2]);
	}

	void update(long long int x, long long int val) {
		//最下段のノードにアクセスする。
		x += (n - 1);

		//最下段のノードを更新したら、あとは親に上って更新していく。
		node[x] = val;

		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = Func(node[2 * x + 1], node[2 * x + 2]);
		}
	}

	long long int getVal(int x) {
		x += (n - 1);
		return node[x];
	}

	long long int getAns(int a, int b, int k = 0, int l = 0, int r = -1) {
		//最初に呼び出された時の区間は[0,n)
		if (r < 0)r = n;

		//要求区間と対象区間が交わらない→単位元を返す。
		if (r <= a || b <= l) return TANNI;

		//要求区間が対象区間を完全に被覆する→対象区間を答えの計算に使う。
		if (a <= l && r <= b) return node[k];

		//要求区間が対象区間の一部を被覆→子をよびだす。
		//左の子をvl、右の子をvrとしている。
		//新しい対象区間は現在の対象区間を半分に割ったもの。
		int vl = getAns(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = getAns(a, b, 2 * k + 2, (l + r) / 2, r);
		return Func(vl, vr);


	}



};



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

	vector<bool> sunuke(n, false);

	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;

		for (int i = 0; i < d; i++) {
			int wk;
			cin >> wk;

			sunuke[wk - 1] = true;
		}
	}
	

	int ans = 0;
	for (int i = 0; i < sunuke.size(); i++) {
		if (sunuke[i] == false)ans++;
	}

	cout << ans << endl;

	return 0;

}



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

int main(void){
    int c[3][3], d[2][3], e[3][2];
    for(int i = 0; i < 3; ++i){
        for(int j = 0; j < 3; ++j){
            cin >> c[i][j];
        }
    }
    for(int i = 0; i < 2; ++i){
        for(int j = 0; j < 3; ++j){
            d[i][j] = c[i][j] - c[i+1][j]; 
        }
    }
    for(int i = 0; i < 3; ++i){
        for(int j = 0; j < 2; ++j){
            e[i][j] = c[i][j] - c[i][j+1]; 
        }
    }
    
    if((d[0][0] == d[0][1] && d[0][1] == d[0][2]) && (d[1][0] == d[1][1] && d[1][1] == d[1][2]) && (e[0][0] == e[1][0] && e[1][0] == e[2][0]) && (e[0][1] == e[1][1] && e[1][1] == e[2][1])) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,m,i=0,j,p[200010],min=1000000,ans=0;
    string s;
    cin >> s;
    if(s[2]==s[3]&&s[4]==s[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;

}


Measured memory_bytes: 3576
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskD {
        static final long MODULO = (int) (1e9 + 7);
        static final long INV2 = (MODULO + 1) / 2;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int q = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) a[i] = in.nextInt();
            int[][] ways = new int[n][n];
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; ++j) {
                    ways[i][j] = a[i] > a[j] ? 1 : 0;
                }
            }
            for (int qi = 0; qi < q; ++qi) {
                int u = in.nextInt() - 1;
                int v = in.nextInt() - 1;
                for (int i = 0; i < n; ++i)
                    if (i != u && i != v) {
                        ways[u][i] = ways[v][i] = (int) ((ways[u][i] + ways[v][i]) * INV2 % MODULO);
                        ways[i][u] = ways[i][v] = (int) ((ways[i][u] + ways[i][v]) * INV2 % MODULO);
                    }
                ways[u][v] = ways[v][u] = (int) ((ways[u][v] + ways[v][u]) * INV2 % MODULO);
            }
            long res = 0;
            for (int i = 0; i < n; ++i) {
                for (int j = i + 1; j < n; ++j) {
                    res = (res + ways[i][j]) % MODULO;
                }
            }
            for (int i = 0; i < q; ++i) res = res * 2 % MODULO;
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 92592
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
using namespace std;
int main(){
	int n,S;
	cin>>n>>S;
	vector<int> w(n),v(n);
	for(int i=0;i<n;i++){
		cin>>w[i]>>v[i];
	}
	vector<vector<long long>> dp(n+1,vector<long long>(S+1,0));
	for(int i=1;i<=n;i++){
		for(int j=0;j<=S;j++){
			if(j>=w[i-1])
			    dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]] + v[i-1]);
			else
			    dp[i][j] = dp[i-1][j];
		} 
	}
	cout<<dp[n][S];
	return 0;
}



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

int main()
{
    ios_base::sync_with_stdio(false);
    bool sol = true;
    string s;
    cin >> s;
    for(int i = 0;i < s.size();i++)
    {
        if(i%2 == 0)
        {
            if(s[i] == 'L')
                sol = false;
        }
        else
        {
            if(s[i] == 'R')
                sol = false;
        }
    }
    if(sol)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}



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

#ifdef _LOCAL_DEBUG
#include "templates/debug.h"
#else
#define debug(...) 
#endif

int n;
char s[200005];

int main() {
    scanf("%d%s", &n, s);
    int l = 0, r = n - 1, ans = 0;
    while (l < r) {
        if (s[r] == 'W')
            r--;
        if (s[l] == 'R') {
            l++;
        } else {
            while (l < r && s[r] == 'W')
                r--;
            if (l < r)
                swap(s[l], s[r]), ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}
// wwrrrrr

Measured memory_bytes: 3964
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<ll> vec;
//typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=200010;

ll a,b;

int main(){
  cin>>a>>b;
  int num=stoi(to_string(a)+to_string(b));
  bool fl=false;
  for(ll i=0;i<=2000;i++){
    if(i*i==num)fl=true;
  }
  if(fl)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256