akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>


int main(){

	std::string str1,str2,str3;
	std::cin >> str1 >> str2 >> str3;

	std::string Out = str1.substr(0,1) + str2.substr(0,1) + str3.substr(0,1); 
	//std::string Out = str1[0] + str2[0] + str3[0];
	std::cout << Out << std::endl;

	return 0;

}

Measured memory_bytes: 256
function levenshtein(s1, s2) {
    const opt = new Array(s1.length + 1).fill(0).map(() => new Array(s2.length + 1));
    for (let i = 0; i <= s1.length; ++i) {
        opt[i][0] = i;
    }
    for (let j = 0; j <= s2.length; ++j) {
        opt[0][j] = j;
    }
    for (let i = 1; i <= s1.length; ++i) {
        const c1 = s1.charCodeAt(i - 1);
        for (let j = 1; j <= s2.length; ++j) {
            const c2 = s2.charCodeAt(j - 1);
            if (c1 === c2) {
                opt[i][j] = opt[i - 1][j - 1];
            } else {
                opt[i][j] = Math.min(opt[i - 1][j - 1] + 1, opt[i - 1][j] + 1, opt[i][j - 1] + 1);
            }
        }
    }
    return opt[s1.length][s2.length];
}


new Promise(function(resolve, reject) {
    let cin = "";
    process.stdin.on("data", chunk => { cin += chunk; });
    process.stdin.on("end", () => { resolve([cin, process.stdout]); });
}).then(function([cin, cout]) {
    const [s1, s2] = cin.split("\n");
    cout.write(`${levenshtein(s1, s2)}\n`);
});



Measured memory_bytes: 30448
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
int A[10000];
int main(){
  int a,b;
  while(~scanf("%d %d",&a,&b)){
    if(!a && !b){
      if(A[1]%2==1 && A[2]%2==1){
	bool f=false;
	for(int i=3;i<10000;i++){
	  if(A[i]!=0 && A[i]%2==1) f=true;
	}
	if(!f) puts("OK");
	else puts("NG");
      }else
	puts("NG");
      memset(A,0,sizeof(A));
    }
    A[a]++;
    A[b]++;
  }
}

Measured memory_bytes: 1212
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
 *
 * @author Tarek
 */
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);
        AAtCoderContest solver = new AAtCoderContest();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAtCoderContest {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            String k = in.next();
            String h = in.next();
            out.print(s.charAt(0));
            out.print(k.charAt(0));
            out.print(h.charAt(0));
            out.println();
        }

    }

    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();
        }

    }
}



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

int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];

  int tmp = 1;
  int ans = 0;
  rep(i, n) {
    if (a[i] == tmp) ++tmp;
    else ++ans;
  }
  cout << (tmp > 1 ? ans : -1) << endl;
  return 0;
}

Measured memory_bytes: 1152
(defun read-and-sum (n)
  (loop :repeat n
        :sum (read)))

(let* ((enemy-hp (read))
       (n (read))
       (deathblow-damage (read-and-sum n)))
  (if (<= enemy-hp deathblow-damage)
      (princ "Yes")
      (princ "No")))
  

Measured memory_bytes: 57704
public class Main{
  static int N = 4000;
  static int M = 1000000;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int[] a, b, c;
    int i, n, x, count;
    int y, z;

    a = new int[N]; b = new int[N]; c = new int[N];
    for(;;){
      n = sc.nextInt();
      if(n == 0)break;
      for(i = 0;i < N;i++){
        a[i] = 0; b[i] = 0; c[i] = 0;
      }
      count = 0;
      for(i = 0;i < n;i++){
        x = sc.nextInt(); y = sc.nextInt(); z = sc.nextInt();
        if(z != 0 && ((M - a[x - 1]) / z < y ||
         ((M - a[x - 1]) / z == y && ((M - a[x - 1]) % z) == 0)))b[x - 1]++;
        else a[x - 1] += y * z;
        if((b[x - 1] > 0 || a[x - 1] >= M) && c[x - 1] == 0){
          out.println(x); count++; c[x - 1] = 1;
        }
      }

      if(count == 0)out.println("NA");
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

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

int main(){
    ll x;cin >> x;
    ll e = 100;
    int ans = 0;
    while(true){
        e += floor((double)e*0.01);
        ++ans;
        if(e >= x){
            break;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007



int main() {
    int N, K; cin >> N >> K;
    double ans = 0;
    rep(i, N) {
        double tmp = 1.0 / N;
        int a = i + 1;
        while (a < K) {
            a *= 2;
            tmp /= 2.0;
        }
        ans += tmp;
    }

    printf("%.12lf\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;
int main(){
  int n;
  cin>>n;
  rep2(i,1,n+1){
   int ans=0;
   int m=ceil(sqrt(i));
  rep2(x,1,m){
    rep2(y,1,m){
      double z=(-x-y+sqrt(-3*x*x-3*y*y-2*x*y+4*i))/2;
      if(z>=1&&z==floor(z)) ans++;
    }
  }
  cout<<ans<<endl;
  }  
return 0;
}

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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const LL INF = 1e15;

class UnionFind{
private:
  vector<int> par, rank;
public:
  UnionFind(int n){
	par.assign(n, 0);
	rank.assign(n, 0);
	for(int i=0;i<n;++i)
	  par[i] = i;
  }

  //find root of x
  int find(int x){
	if(par[x] == x)
	  return x;
	return (par[x] = find(par[x]));
  }

  void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x == y) return;

	if(rank[x] < rank[y])
	  par[x] = y;
	else{
	  par[y] = x;
	  if(rank[x] == rank[y])
		++rank[x];
	}
  }

  bool same(int x, int y){
	return find(x) == find(y);
  }
};

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

  int N;
  cin >> N;
  vector<pair<PLL,int>> xs(N);
  REP(i,N){
	cin >> xs[i].FF;
	xs[i].SS = i;
  }
  vector<pair<LL,PII>> q;
  sort(ALL(xs), [](const pair<PLL,int>& l, const pair<PLL,int>& r){
	  return l.FF.FF < r.FF.FF;
	});
  REP(i,N-1){
	q.EB(xs[i+1].FF.FF - xs[i].FF.FF, PII(xs[i].SS, xs[i+1].SS));
  }
  sort(ALL(xs), [](const pair<PLL,int>& l, const pair<PLL,int>& r){
	  return l.FF.SS < r.FF.SS;
	});
  REP(i,N-1){
	q.EB(xs[i+1].FF.SS - xs[i].FF.SS, PII(xs[i].SS, xs[i+1].SS));
  }
  
  SORT(q);
  UnionFind uf(N);
  LL ans = 0;
  for(auto&& p: q){
	if(!uf.same(p.SS.FF, p.SS.SS)){
	  uf.unite(p.SS.FF, p.SS.SS);
	  ans += p.FF;
	}
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8816
#include<stdio.h>
#include<stdlib.h>
typedef struct list{
  int u, k, *v;
}T_list;
typedef struct graph{
  int d, f;
}T_graph;
int n;
T_list *lst;
T_graph *grp;
void dfs(int);
int main(){
  scanf("%d", &n);
  lst = (T_list *)malloc(sizeof(T_list) * n);
  grp = (T_graph *)malloc(sizeof(T_graph) * n);
  int i, j;
  for(i = n - 1; i >= 0; i--)
    grp[i].d = 0;
  for(i = 0; i < n; i++){
    scanf("%d %d", &lst[i].u, &lst[i].k);
    if(lst[i].k){
      lst[i].v = (int *)malloc(sizeof(int) * lst[i].k);
      for(j = 0; j < lst[i].k; j++){
	scanf("%d", &lst[i].v[j]);
	//mat[lst[i].u - 1][lst[i].v[j] - 1] = 1;
      }
      //free(lst[i].v);
    }
  }
  for(i = 0; i < n; i++)
    if(!grp[i].d)
      dfs(i);
  for(i = 0; i < n; i++){
    if(lst[i].k)
      free(lst[i].v);
    printf("%d %d %d\n", i + 1, grp[i].d, grp[i].f);
  }
  free(grp), free(lst);
  return 0;
}

void dfs(int v){
  static int t = 0;
  grp[v].d = ++t;
  //printf("%d %d %d\n", v + 1, grp[v].d, lst[v].k);
  int i;
  for(i = 0; i < lst[v].k; i++)
    if(!grp[lst[v].v[i] - 1].d){
      //printf(" %d\n", lst[v].v[i] - 1);
      dfs(lst[v].v[i] - 1);
    }
  grp[v].f = ++t;
}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long int ll;
const ll INF = 10000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

double dp[3000][3000] = { 0.0 };

int main()
{
    int array[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int k;
    cin >> k;
    cout << array[k - 1] << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define MAX 10000005
#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
vector<int> primes;
ll sumprime[MAX];
bool is_prime[MAX];
void sieve(){
    is_prime[0]=is_prime[1]=true;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=true;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(!is_prime[i]){
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=true;
            }
        }
    }
    for(int i=0;i<MAX;i++){
        if(!is_prime[i]){
            sumprime[i]=sumprime[i-1]+i;
        }else{
            sumprime[i]=sumprime[i-1];
        }
    }
}
*/
/*
void lcs(char s1[],char s2[]){
    int n=strlen(s1);
    int m=strlen(s2);
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int sum=0;
            if(s1[i-1]==s2[j-1]){
                sum=1+dp[i-1][j-1];
            }
            else{
                sum=max(dp[i-1][j],dp[i][j-1]);
            }
            dp[i][j]=sum;
        }
    }
    
    int index=dp[n][m];
    //cout<<index<<endl;
    char ans[index+1];
    ans[index]='\0';
    index--;
    int x=n;
    int y=m;
    while(x>0 and y>0){
        if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]!=dp[x][y]){
            ans[index]=s1[x-1];
            index--;
            x--;
            y--;
        }else if(dp[x-1][y]>dp[x][y-1]){
            x--;
        }else{
            y--;
        }

    }
    //reverse(ans.begin(),ans.end());

    cout<<ans;
    return;
}
*/

int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;
    //sieve();
    int t=1;
    //cin>>t;
    for(int tc=1;tc<=t;tc++){
        int n,k;
        cin>>n>>k;
        int a[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        int s=0;
        for(int i=k;i<n;i++){
            if(a[i]>a[s]){
                cout<<"Yes\n";
            }else{
                cout<<"No\n";
            }
            s++;
        }
    }
    
    
    
    
    return 0;
    
}

Measured memory_bytes: 5216
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
   int x,y;
   cin >> x >> y;
   if(2*x<=y && 4*x>=y && y%2==0)cout << "Yes" << endl;
   else cout << "No" << endl; 
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
typedef long long ll;
using namespace std;

class UnionFind{
public:
        //親番号を格納，親の場合は木のサイズ
        vector<int> Parent; 

        //-1で初期化，最初はすべて根とする
        UnionFind(int n){
            Parent = vector<int>(n, -1);
        }

        //Aがどのグループに属しているか調べる
        int root(int a){
            if (Parent[a] < 0) return a;
            return Parent[a] = root(Parent[a]);
        }

        //自分のいるグループの頂点数を調べる
        int size(int a){
            return -Parent[root(a)]; //親を取りたいので
        }

        //aとbをくっつける
        bool connect(int a, int b){
            //aとbを直接つなぐのではなく，root(a)にroot(b)をくっつける
            a = root(a);
            b = root(b);
            if(a == b){
                //すでにくっついてる
                return false;
            }

            //大きい方に小さい方をくっつける
            //大小逆ならひっくり返す
            if(size(a) < size(b)) swap(a, b);

            //aのサイズ更新
            Parent[a] += Parent[b];
            //bの親をaに変更
            Parent[b] = a;

            return true;
        }
};

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

    vector<ll> ans(m);
    ans[m - 1] = (ll)n * (n - 1) / 2;

    UnionFind Uni(n);

    for(int i = m - 1; i >= 1; i--)
    {
        ans[i - 1] = ans[i];

        //繋がってなかったのが繋がった時
        if (Uni.root(a[i]) != Uni.root(b[i])) {
            ans[i - 1] -= (ll)Uni.size(a[i]) * Uni.size(b[i]);
            Uni.connect(a[i], b[i]);
        }
    }
    
    for(int i = 0; i < m; i++)
    {
        cout << ans[i] << endl;
    }
    
    
    
    return 0;
}

Measured memory_bytes: 3328
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, X: int, Y: int):
    if(2*C >= A+B):
        print(A*X+B*Y)
        exit()

    ans = A*X+B*Y
    for i in range(100001):
        ans = min(ans, 2*C*i + max(0,X-i)*A + max(0,Y-i)*B)

    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(A, B, C, X, Y)

if __name__ == '__main__':
    main()


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

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ldb long double 
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const ll INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n)
{
 ll res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a*=a;
  n/=2;
}
return res;
}

ll abst(ll a)
{
 return ((a<0)?(-1*a):(a));
}

int main()
{
 ll n,k;
 cin>>n>>k;
 ll cnt=0;
 while(n)
 {
     cnt++;
     n=n/k;
 }
 cout<<cnt<<"\n";
      return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e9)
using namespace std;
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    ll dx = tx - sx;
    ll dy = ty - sy;
    rep(i,0,dy){
        cout << 'U';
    }
    rep(i,0,dx){
        cout << 'R';
    }
    rep(i,0,dy){
        cout << 'D';
    }
    rep(i,0,dx){
        cout << 'L';
    }
    cout << 'L';
    rep(i,0,dy+1){
        cout << 'U';
    }
    rep(i,0,dx+1){
        cout << 'R';
    }
    cout << 'D';
    cout << 'R';
    rep(i,0,dy+1){
        cout << 'D';
    }
    rep(i,0,dx+1){
        cout << 'L';
    }
    cout << 'U' << endl;
}


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

int main()
{
	stack<int> s;

	int k, m, a, b;
	char c;
	while (cin.get(c)){
		if (isdigit(c)){
			k = c - '0';
			while (cin.get(c)){
				if (isdigit(c)){
					m = c - '0';
					k = 10 * k + m;
				}
				else{
					break;
				}
			}
			s.push(k);
		}
		else{
			if( c == ' ' ) continue;
			if( c == '\n' ) break;

			a = s.top(); s.pop();
			b = s.top(); s.pop();

			switch (c)
			{
			case '+': s.push(b + a); break;
			case '-': s.push(b - a); break;
			case '*': s.push(b * a); break;
			}
		}
	}

	cout << s.top() << "\n";

	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
string s, t;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s >> t;
    if(s.size() == t.size() - 1 && s == t.substr(0, s.size()))
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

int main(){
	int N, K, h, ans = 0;
	cin >> N >> K;
	for (int i = 0;i < N;i++) {
		cin >> h;
		if (h >= K) {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

#define PE(a, b) {(a) += (b); if((a) >= mod) (a) -= mod;}

const int mod = 1000000007;
long long int dp[62][3];

int main(){
  int i, j;
  long long int n;
  scanf("%lld", &n);

  dp[0][0] = 1;
  for(i = 0; i < 61; n >>= 1, i++){
    for(j = 0; j <= 2; j++){
      int x = n & 0x1;
      int y = j - x + 1;

      PE(dp[i+1][j > x], dp[i][j]);
      PE(dp[i+1][y-(y>>1)], dp[i][j]);
      PE(dp[i+1][1+(y>>1)], dp[i][j]);
    }
  }
  printf("%lld\n", dp[61][0]);
}


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

struct S
{
	int i;
	int p;
	int q;
	int r;
	int c;
};

int main(void)
{
	int n;
	S s[1000];
	S max;
	while(1)
	{
		cin >> n;
		if(n == 0)
			return 0;
		for(int i=0;i<n;++i)
		{
			cin >> s[i].i;
			cin >> s[i].p;
			cin >> s[i].q;
			cin >> s[i].r;
			s[i].c = s[i].p*4 + s[i].q*9 + s[i].r*4;
		}
		cin >>max.p >> max.q >> max.r >> max.c;

		bool f = false;
		for(int i=0;i<n;++i)
		{
			if(s[i].p <= max.p && s[i].q <= max.q && s[i].r <= max.r && s[i].c <= max.c)
			{
				cout << s[i].i << endl;
				f = true;
			}
		}
		if(f == false)
			cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 884
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *a = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, a + i);
  }
  i64 *dp = ALLOC (n, i64);
  for (i32 len = 1; len <= n; ++len) {
    for (i32 l = 0; l <= n - len; ++l) {
      i32 r = l + len - 1;
      i64 x = a[l] - dp[l + 1];
      i64 y = a[r] - dp[l];
      dp[l] = MAX (x, y);
    }
  }
  printf ("%" PRIi64 "\n", dp[0]);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 256
//#define anjn
//      Anjan Agarwala - anjn98

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, 
                  tree_order_statistics_node_update> ordered_set;

//ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

#define PR(x) cout<<#x<<": "<<x<<"\n";
#define PR1(x,y) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"\n";
#define PR2(x,y,z) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"  |  "<<#z<<": "<<z<<"\n";
#define ED cout<<'\n';

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define endl            '\n'
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define PB              push_back
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007


const int N=3e5+99;




int32_t main() 
{
    IO

    int n,pp=0,nn=0;cin>>n;
    vector<ll> a(n);
    fr(n) cin>>a[i];
    sort(all(a));

    fr(n) if(a[i]<0) nn=1; else pp=1;

    if(n==1)
    {
        cout<<a[0]<<endl;
        return 0;
    }

    if(pp && nn)
    {
        ll ps=0,p1=-1,ns=0,n1=-1,ans=0;
    
        for(int i=0;i<n;i++)
        {
            if(a[i]>=0) ps=a[i],p1=i;
            else ns=a[i],n1=i;
            ans+=abs(a[i]);
        }
        cout<<ans<<endl;
        for(int i=0;i<n;i++)
        {
            if(a[i]>=0 || i==n1) continue;
            cout<<ps<<" "<<a[i]<<endl;
            ps-=a[i];
        }
        for(int i=0;i<n;i++)
        {
            if(a[i]<0 || i==p1) continue;
            cout<<ns<<" "<<a[i]<<endl;
            ns-=a[i];
        }
        cout<<ps<<" "<<ns<<endl;
        
    }

    else if(pp)
    {
        ll sum=0;
        fr(n) sum+=a[i];
        cout<<(sum-a[0]-a[0])<<endl;
        sum=a[0];
        for(int i=1;i<n-1;i++)
        {   
            cout<<sum<<" "<<a[i]<<endl;
            sum-=a[i];
        }
        cout<<a[n-1]<<" "<<sum<<endl;
        
    }

    else
    {
        ll sum=0;
        fr(n) sum+=abs(a[i]);
        cout<<sum+a[n-1]+a[n-1]<<endl;

        sum=a[n-1];
        for(int i=n-2;i>=0;i--)
        {   
                cout<<sum<<" "<<a[i]<<endl;
                sum-=a[i];
        }
     
    } 

    return 0;
}




 

Measured memory_bytes: 2688
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		long N = stdIn.nextLong();
		long A = stdIn.nextLong();
		long B = stdIn.nextLong();
		long ans = 0;
		long sum = 0;
		long c = 0;
		c = N / (A + B);
		sum = c * A;
		ans = N % (A + B);

		if(ans > A){
			sum = sum + A;
		}
		else{
			sum = sum + ans;
		}
		System.out.println(sum);
		stdIn.close();
	}
}

Measured memory_bytes: 35676
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Main main = new Main();
		main.exec();

	}

	private void exec() {

		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextInt();
		}
		double ans = 0d;
		double wa = 0d;
		for(int i = 0 ; i < n ; i++) {
			wa += 1d / (double)a[i];
		}
		ans = 1 / wa;
		System.out.println(ans);
		sc.close();

	}

}


Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int ans = INF;
    A.push_back(-1);
    for (int x : A) {
        vector<vector<int> > sp;
        vector<int> tmp;
        for (int a : A) {
            if (x <= a) tmp.push_back(a);
            else {
                sp.push_back(tmp);
                tmp.clear();
            }
        }
        vector<int> m;
        for (vector<int> s : sp) {
            if (s.size() >= K) {
                sort(s.begin(), s.end());
                m.insert(m.end(), s.begin(), s.begin() + s.size() - K + 1);
            }
        }
        if (m.size() >= Q) {
            sort(m.begin(), m.end());
            int y = m[Q - 1];
            ans = min(ans, y - x);
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    string ans = "";
    while(N != 0) {
        if(N % 2 != 0) {
            N--;
            ans = "1" + ans;
        }
        else {
            ans = "0" + ans;
        }
        
        N /= -2;
    }

    if(ans == "") {
        ans = "0";
    }

    cout << ans;

    cout << endl;
    return 0;
}

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

long long gcd(long x, long y)
{    if (y == 0)
        return x;
    return gcd(y, x % y);}
long long lcm(long x, long y){ return x * y / gcd(x, y);}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}


int main()
{
    int N,H[100010]={},ans=0;
    cin>>N;
    for(int i=1;i<=N;i++){
        cin>>H[i];
    }

    int temp=0,b=H[N];

    for(int i=(N-1);i>0;i--){
        if(H[i]>=b){
            temp++;
            b=H[i];
        }else{
            ans=max(ans,temp);
            temp=0;
            b=H[i];
        }
    }

    ans=max(ans,temp);

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 640
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

S = rs()

a = int(S[:2])
b = int(S[2:])

if 0 < a <= 12 and 0 < b <= 12:
	print('AMBIGUOUS')
elif 0 < a <= 12:
	print('MMYY')
elif 0 < b <= 12:
	print('YYMM')
else:
	print('NA')


Measured memory_bytes: 68000
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a1 = Integer.parseInt(sc.next());
        int a2 = Integer.parseInt(sc.next());
        int a3 = Integer.parseInt(sc.next());

        System.out.println((a1 + a2 + a3) > 21 ? "bust": "win");
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,m;
  cin >> n >> m;
  vector<P> p(n);
  rep(i,n){
    cin >> p[i].first >> p[i].second;
  }
  sort(p.begin(),p.end());
  ll ans=0;
  ll j=0,k=0;
  rep(i,m){
    if(j==p[k].second){
      k++;
      j=1;
      ans+=p[k].first;
    }
    else{
      j++;
      ans +=p[k].first;
    }
    //cout << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;
 
class Main {
    	static String[] x;
    	static String[] y;
    	static String temp;
 
    	public static void main(String[] args) {
        	Scanner sc = new Scanner(System.in);
        	x = sc.nextLine().split(" ");
        	y = sc.nextLine().split(" ");
        	char[] c = { 'E', 'E', 'E', 'N', 'W', 'W', 'W', 'S' };
         
        	boolean flag = false;
        	for(int i=0;i<3;i++){
            		for(char d:c){
                		roll(d);
                		if(Arrays.equals(x, y)){
                    			flag=true;
                    			break;
                		}
            		}
        	}
        	if(flag){
            		System.out.println("Yes");
        	}else{
            		System.out.println("No");
		}
    	}
 
    	public static void roll(char c) {
        	switch (c) {
        		case 'E':
            		    temp = x[0];
		            x[0] = x[3];
		            x[3] = x[5];
		            x[5] = x[2];
		            x[2] = temp;
		            break;
        		case 'N':
		            temp = x[0];
		            x[0] = x[1];
		            x[1] = x[5];
		            x[5] = x[4];
		            x[4] = temp;
		            break;
        		case 'W':
		            temp = x[0];
		            x[0] = x[2];
		            x[2] = x[5];
		            x[5] = x[3];
		            x[3] = temp;
		            break;
		        default:
		            temp = x[0];
		            x[0] = x[4];
		            x[4] = x[5];
		            x[5] = x[1];
		            x[1] = temp;
		            break;
        	}
    	}
}

Measured memory_bytes: 17328
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

ll N, W;

int main() {
    cin >> N >> W;
    vector<ll> w(N), v(N);
    REP(i, N) cin >> w[i] >> v[i];
    ll w0 = w[0];
    vector<vector<ll>> A(4, vector<ll>(1, 0));
    REP(i, N) {
        A[w[i]-w0].push_back(v[i]);
    }
    REP(i, 4) {
        sort(A[i].begin()+1, A[i].end());
        reverse(A[i].begin()+1, A[i].end());
        FOR(j, 1, A[i].size()) {
            A[i][j] += A[i][j-1];
        }
    }
    ll ans = 0;
    REP(i, A[0].size()) REP(j, A[1].size()) REP(k, A[2].size()) REP(l, A[3].size()) {
        ll ww = 0;
        ww += i * (w0);
        ww += j * (w0+1);
        ww += k * (w0+2);
        ww += l * (w0+3);
        if(ww <= W) {
            ans = max(ans, A[0][i]+A[1][j]+A[2][k]+A[3][l]);
        }        
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# 1.A_C間,B_D間に##となっているマスがないこと
# 2.D>CまたはDの周辺に#がないまたはB_D間に...があること
n, a, b, c, d = map(int, input().split())
s = " " + input()
Triple_floor = False
before_stat = ""
floor_num = 0
counter = a
for char in s[a:]:
    if(counter > max(c,d)):
        # この先はどうでもいい.
        break
    if(char == "."):
        floor_num += 1
        if(floor_num >= 3 and counter >= (b+1) and counter <= (d+1)):
            Triple_floor = True
    else:
        floor_num = 0
        if(before_stat == "#"):
            c=d
            Triple_floor = False
            break
    before_stat = char
    counter += 1
if(c<d or Triple_floor):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
using namespace std;
#define INF (1<<26)
int t[6]={500,100,50,10,5,1};
int p,u[6];

int calc(int x,bool f){
  int res=0;
  for(int i=0;i<6;i++){
    int a=x/t[i];
    if(f)a=min(a,u[i]);
    x-=t[i]*a;
    res+=a;
  }
  return (x==0?res:INF);
}


int main(){
  while(1){
    cin>>p;
    int sum=0;
    for(int i=5;i>=0;i--){
      cin>>u[i];
      sum+=u[i]*t[i];
    }
    if(p==0&&sum==0)break;
    int ans=INF;
    for(int i=p;i<=sum;i++){
      ans=min(ans,calc(i,1)+calc(i-p,0));
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
	
    public static void main(String[] args)   throws Exception, IOException{        
        long mod=1000000007;
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int x=sc.nextInt();
        int n=110000;
        boolean p[]=new boolean[n+1];
        p[1]=true;
        for(int i=4; i<=n; i+=2)p[i]=true;
        for(int i=3; i*i<=n; i+=2) {
            if(!p[i]){
                for (int t=i*i; t<=n; t+=i) {
                    p[t]=true;
                }
            }
        }
        int a=0;
        for(int i=x; i<=n; i++) {if(!p[i]) {
        		a=i;
        		break;
        	}
        }
        out.println(a);
     	out.flush();
    }


    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//
//class P {
//	int x, y, d;
//	P(int  x, int y, int d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}
//

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//        return -p.a+a;//as
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() throws IOException{
        return this.nextString().toCharArray();
    }    
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define INF 2e9
#define MOD 1e9+7
#define ALL(v) v.begin(), v.end()

int main()
{
    int N;
    cin >> N;
    
    ll A[N];
    ll B[N];
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];

    FOR(i, 1, N) A[i] += A[i-1];
    FORR(i, N-2, 0) B[i] += B[i+1];

    ll ans = 0;
    REP(i, N) ans = max(ans, A[i]+B[i]);

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define INF 1000000000
int h,w;
vector<vector<int>> c(10,vector<int>(10,0));
vector<vector<int>> A;

int ans=INF;
int dfs(int a,vector<bool> &visit,int sum){
    if(a==1){
        return sum;
    }
    
    for(int i=0;i<=9;i++){
        if(!visit[i]){
            visit[i]=true;
            ans=min(ans,dfs(i,visit,sum+c[a][i]));
            visit[i]=false;
        }
    }

    return ans;
}

int main(){
    int i,j,k;
    cin>>h>>w;
    vector<int> change_to_one(10,0);//数字iから1へ変換するのにかかる最小コスト
    A.assign(h,vector<int>(w,0));
    for(i=0;i<=9;i++){
        for(j=0;j<=9;j++){
            cin>>c[i][j];
        }
    }
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cin>>A[i][j];
        }
    }

    for(i=0;i<=9;i++){
        vector<bool> visit(10,false);
        ans=INF;
        visit[i]=true;
        change_to_one[i]=dfs(i,visit,0);
    }

    int answer=0;
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            if(A[i][j]!=-1){
                answer+=change_to_one[A[i][j]];
            }
        }
    }

    cout<<answer<<endl;
    return 0;
}

Measured memory_bytes: 384
from math import ceil #切り上げ
import numpy as np
 
def inp(): return int(input()) #一個だけ読み取り
def inpm(): return map(int,input().split()) #mapオブジェクトで呼び出し
def inpl(): return list(map(int, input().split())) #数字リストをintで
def inpls(): return list(input().split()) #リストをstrで

N,K = inpl()
people = []
for i in range(1,N+1):
  people.append(i)

for i in range(K):
  a = inp()
  num = inpl()
  for j in num:
    try:
    	people.remove(j)
    except:
      pass
    
print(len(people))

Measured memory_bytes: 27168
#include <stdio.h>

int main(){
  int a,b,c,d,fst,scd;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  fst=(b+c-1)/b;
  scd=(a+d-1)/d;
  if(fst<=scd)
    printf("Yes");
  else
    printf("No");
}

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

using namespace std ;

const int MAXN = 100010 ;

char s[MAXN] ;

int n ;

int main() { 
#ifdef YJQ_LOCAL
		freopen(".in", "r", stdin);
#endif
		scanf("%s",s + 1) ; 
		n = strlen(s + 1) ;
		int cur = 0 , ans = 0 ; 
		for (int i = 1; i <= n; i ++) { 
				if (cur) { 
						cur -- ; 
						if (s[i] == 'g') ans ++ ; 
				}
				else {
						cur ++ ; 
						if (s[i] == 'p') ans -- ; 
				}
		}
		printf("%d\n", ans) ; 
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k, c;
    string s;
    cin >> n >> k >> c >> s;
    int dpl[n + 1], dpr[n + 1];
    dpl[0] = 0;
    dpr[0] = 0;
    int last = -10000000;
    for (int i = 1; i <= n; ++i) {
        if (s[i - 1] == 'x') dpl[i] = dpl[i - 1];
        else if (last + c < i) {
            last = i;
            dpl[i] = dpl[i - 1] + 1;
        }
        else dpl[i] = dpl[i - 1];
    }
    // for(int i=1;i<=n;i++)
    // {
    //     cout<<dpl[i]<<" ";
    // }
    // cout<<endl;
    last = -10000000;
    for (int i = 1; i <= n; ++i) {
        if (s[n - i] == 'x') dpr[i] = dpr[i - 1];
        else if (last + c < i) {
            last = i;
            dpr[i] = dpr[i - 1] + 1;
        }
        else dpr[i] = dpr[i - 1];
    }
    // for(int i=1;i<=n;i++)
    // {
    //     cout<<dpr[i]<<" ";
    // }
    // cout<<endl;
    //for (int i = 0; i <= n; ++i) cout << dpr[i] << " ";
    for (int i = 0; i < n; ++i) {
        int left = i;
        int right = n - i - 1;
        if (s[i] == 'o' && dpl[left] + dpr[right] < k)
        {
            //  cout<<left<<" "<<right<<endl;
            //  cout<<dpl[left]<<" "<<dpr[right]<<endl;
             cout << i + 1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5012
#include <algorithm>
#include <iostream>

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

const long long INF = 1LL << 60;
using namespace std;

long long dp[110][100100] = { 0 };

int main() {
	int N, W; cin >> N >> W;
	long long weight[110], value[100100];
	for (int i = 0; i < N; i++) scanf("%lld%lld", &weight[i], &value[i]);

	for (int i = 0; i < N; i++) {
		for (int sum_w = 0; sum_w <= W; sum_w++) {
			if (sum_w - weight[i] >= 0) {
				chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
			}
			chmax(dp[i + 1][sum_w], dp[i][sum_w]);
		}
	}

	cout << dp[N][W] << endl;

	return 0;
}

Measured memory_bytes: 79360
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll h, w;  // h行w列のマス目
    cin >> h >> w;

    vl x(h*w), y(h*w);  // うなぎのi番目の座標が(x[i], y[i])
    rep(i, h) {
        rep(j, w) {
            x[i*w + j] = i;
        }
    }

    rep(i, h*w) {
        ll m = i%(2*w);
        if(m < w) {
            y[i] = m;
        }
        else {
            y[i] = (2*w - 1) - m;
        }
    }   

    ll n;
    cin >> n;

    ll k = 0;
    vvl matrix(h, vl(w));
    exrep(i, 1, n) {
        ll a;
        cin >> a;
        exrep(j, k, k+a-1) {
            matrix[x[j]][y[j]] = i;
        }
        k += a;
    }

    rep(i, h) {
        rep(j, w) {
            cout << matrix[i][j] << " ";
        }
        cout << "\n";
    }

    re0;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

int main()
{
    int n,m,x;
    cin >> n>>m>>x;
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    rep(n,i)
    {
        cin >> c[i];
        rep(m,j)
        {
            cin >> a[i][j];
        }
    }


    int minival = numeric_limits<int>::max();
    for (int bit = 0; bit < (1<<n); bit++)
    {
        int kane = 0;
        vector<int> rik(m, 0);
        for (size_t i = 0; i < n; i++)
        {
            if (bit & (1 << i))
            {
                kane += c[i];
                for (size_t j = 0; j < m; j++)
                {
                    rik[j] += a[i][j];
                }
            }
        }

        bool ok = true;
        for (auto &&r : rik)
        {
            ok &= r>=x;
        }
        if(ok) minival = min(minival, kane);
        
        
        // if (bit & (1 << i))	// 右からi桁目のビットが1のとき
    // bitは右から0桁目、1桁目、…と数える
    }

    if(minival == numeric_limits<int>::max()) minival = -1;

    cout << minival << endl;

    return 0;
}

Measured memory_bytes: 3636
H,W,D=gets.split.map(&:to_i)
h,d,ans={},Array.new(H*W+1,0),[]
H.times{|i|
  a=gets.split.map(&:to_i)
  W.times{|j|
    h[a[j]]=[i,j]
  }
}
((1+D)..(H*W)).each{|i|
  d[i]=d[i-D]+(h[i][0]-h[i-D][0]).abs+(h[i][1]-h[i-D][1]).abs
}
Q=gets.chomp.to_i
Q.times{|i|
  l,r=gets.split.map(&:to_i)
  ans[i]=d[r]-d[l]
}
Q.times{|i|
  puts ans[i]
}


Measured memory_bytes: 17660
n = int(input())

def dfs(s):
  if int(s) > n:
    return 0
  if all(s.count(c)>0 for c in '753'):
    t = 1
  else:
    t = 0
  for c in '753':
    t += dfs(s+c)
  return t

print(dfs('0'))

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int n = N / 100;
        int x = Integer.parseInt(n + "" + n + "" + n);

        if (x < N) {
            n = n + 1;
            x = Integer.parseInt(n + "" + n + "" + n);
            System.out.println(x);
        } else {
            System.out.println(x);
        }
    }
}

Measured memory_bytes: 23636
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <functional>
#define SQR 1000000

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

int main()
{
	ll n;
	scanf("%lld",&n);
	ll sum=0;
	for(ll i=1;i<=SQR;i++)
	{
		if(n%i==n/i) sum+=i;
	}
	for(ll i=1;i<=SQR;i++)
	{
		ll up=n/i;
		ll low=max((ll) SQR,n/(i+1))+1;
		if(low<=up)
		{
			if(n%i==0)
			{
				ll z=n/i-1;
				if(low<=z&&z<=up)
				{
					sum+=z;
				}
			}
		}
	}
	printf("%lld\n",sum);
	return 0;
}


Measured memory_bytes: 128