akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
using namespace std;

class Dice {
public:
    static int rollingface[][4];
    static int sideface[][4];
    int face[6];

    Dice(string &face_data);
    // ~Dice();
    void roll(const char &op);
    int top();
    int front_face(int top, int right);
    void print_faces();
    bool operator==(const Dice& other);
};

int Dice::rollingface[][4] = {
    {0, 2, 5, 3},
    {0, 4, 5, 1},
    {0, 1, 5, 4},
    {0, 3, 5, 2},
};

int Dice::sideface[][4] = {
    {1, 3, 4, 2},
    {0, 2, 5, 3},
    {0, 4, 5, 1},
    {0, 1, 5, 4},
    {0, 3, 5, 2},
    {1, 2, 4, 3},
};

Dice::Dice(string &face_data) {
    istringstream strm;
    strm.str(face_data);
    for (int i = 0; i < 6; i++) {
        strm >> face[i];
    }
}

void Dice::roll(const char &op) {
    int *fseq;
    switch (op) {
        case 'E': fseq = Dice::rollingface[0]; break;
        case 'N': fseq = Dice::rollingface[1]; break;
        case 'S': fseq = Dice::rollingface[2]; break;
        case 'W': fseq = Dice::rollingface[3]; break;
        default: break;
    }
    int t, p = face[fseq[3]];
    for (int i = 0; i < 4; i++) {
        t = face[fseq[i]];
        face[fseq[i]] = p;
        p = t;
    }
}

int Dice::front_face(int top, int right) {
    int i;
    for (i = 0; i < 6; i++) {
        if (face[i] == top) break;
    }
    int *fseq = Dice::sideface[i];
    for (i = 0; i < 4; i++) {
        if (face[fseq[i]] == right) return face[fseq[(i-1+4)%4]];
    }
    return -1;
}

void Dice::print_faces() {
    cout << "face:" << endl;
    cout << "   " << face[4] << endl;
    cout << face[3] << " " << face[0] << " " << face[2] << endl;
    cout << "   " << face[1] << endl;
    cout << "   " << face[5] << endl;
    cout << endl;
}

bool Dice::operator==(const Dice& other) {
    int i;
    for (i = 0; i < 6; i++) {
        if (other.face[i] == face[0]) {
            if (other.face[5-i] != face[5]) continue;
            int *f = Dice::sideface[0], *of = Dice::sideface[i];
            for (int j = 0; j < 4; j++) {
                if (face[f[0]] == other.face[of[j]]) {
                    for (int k = 1; k < 4; k++) {
                        if (face[f[k]] != other.face[of[(j+k)%4]]) goto NOT_MATCH;
                    }
                    return true;
                }
            }
            NOT_MATCH:;
        }
    }
    return false;
}

int Dice::top() {
    return face[0];
}

int main() {
    int n, i;
    string buf;
    istringstream strm;
    Dice *dice[100];

    getline(cin, buf);
    strm.str(buf);
    strm >> n;
    for (i = 0; i < n; i++) {
        getline(cin, buf);
        dice[i] = new Dice(buf);
    }
    
    for (i = 0; i < n-1; i++) {
        Dice *s = dice[i];
        for (int j = i + 1; j < n; j++) {
            if (*s == *dice[j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=1e2+5;
int dp[N][2];
string s;
int d;

void add(int &x,int y){
	x=(x+y);
	if(x>=M) x-=M;
}

void find(int x){
	if(x==s.size()){return;}
	int temp[N][2];
	int up=s[x]-'0';
	memset(temp,0,sizeof(temp));
	for(int i=0;i<=9;i++){
		if(i<up){
			for(int j=0;j<d;j++){
				add(temp[(j+i)%d][0],dp[j][0]+dp[j][1]);
			}
		}
		else if(i==up){
			for(int j=0;j<d;j++){
				add(temp[(i+j)%d][0],dp[j][0]);
				add(temp[(i+j)%d][1],dp[j][1]);
			}
		}
		else{
			for(int j=0;j<d;j++){
				add(temp[(i+j)%d][0],dp[j][0]);
			}
		}
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<2;j++){
			dp[i][j]=temp[i][j];
		}
	}
	find(x+1);
}

int32_t main(){
    cin>>s;
    cin>>d;
    memset(dp,0,sizeof(dp));
    dp[0][1]=1;
    find(0);
    int ans=(dp[0][0]+dp[0][1]-1+M)%M;
    cout<<ans<<endl;
}



Measured memory_bytes: 256
import bisect
A, B, Q = [int(_) for _ in input().split()]
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]
for x in X:
    i_sl = bisect.bisect_left(S, x)
    i_tl = bisect.bisect_left(T, x)
    D_sr = D_sl = D_tl = D_tr = float('inf')
    if i_sl < A:
        D_sl = S[i_sl] - x
    if i_tl < B:
        D_tl = T[i_tl] - x
    if i_sl:
        D_sr = x - S[i_sl - 1]
    if i_tl:
        D_tr = x - T[i_tl - 1]
    print(
        min([
            max(D_sl, D_tl),
            max(D_sr, D_tr),
            min(D_sl, D_tr) + D_tr + D_sl,
            min(D_tl, D_sr) + D_sr + D_tl
        ]))


Measured memory_bytes: 123480
package main

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

func main() {
	fsc := NewFastScanner()
	_, K := fsc.NextInt(), fsc.NextInt()
	A := fsc.NextIntArray()
	cnt := map[int]int{}
	for _, v := range A {
		cnt[v]++
	}
	costs := []int{}
	for _, v := range cnt {
		costs = append(costs, v)
	}
	sort.Ints(costs)
	k := len(costs)
	res := 0
	i := 0
	for k > K {
		res += costs[i]
		i++
		k--
	}
	fmt.Println(res)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


Measured memory_bytes: 20608
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""One line explanation of b.py.

More explanations of b.py."""

import sys

def read_input(fin):
    l0 = fin.readline()
    l1 = fin.readline()
    return sorted([int(c) for c in l1.strip().split(' ')], reverse=True)

def solve(data):
    result = 0
    sign = 1
    for d in data:
        result += d * sign
        sign = -sign
    return result

def main(argv):
    d = read_input(sys.stdin)
    sys.stdout.write('%d\n' % solve(d))
    

if __name__ == '__main__':
    main(sys.argv)


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

using namespace std;

#define ll long long
#define endl '\n'
#define pb push_back
#define inf 1e9

int const N = 1e5+5;

vector< pair<int, int> > g[N];

int color[N], check[N];

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

    memset(color, -1, sizeof color);

    for (int i = 1; i < n; i++)
    {
        int u, v, w; cin >> u >> v >> w;
        g[u].push_back({v, w});
        g[v].push_back({u, w});
    }

    //Só há um caminho entre dois vértices -> Condição de existência de uma árvore

    //Eu quero saber a distância entre todos os pares i,j tal que i dif de j

    queue<int> lista;

    lista.push(1);

    int contador = 0;

    while(!lista.empty())
    {
        int v = lista.front();
        lista.pop();

        if (check[v] == 1)
            continue;

        contador++;

        check[v] = 1;

        for (int i = 0; i < g[v].size(); i++)
        {
            int u = g[v][i].first, w = g[v][i].second;

            if (check[u] == 1)
                continue;

            //cout << "par (" << v << "," << u << ") ";
            if (w%2 == 0) //Se a distância é par, então, eles são do mesmo grupo
            {
                //cout << "same color" << endl;
                color[u] = color[v];
            } else
            {
                //cout << "dif color" << endl;
                color[u] = color[v] * -1; //Se a distância é ímpar, são de cores distintas
            }
            lista.push(u);
        }
    }

    //cout << "---" << contador << endl;

    for (int i = 1; i <= n; i++)
        cout << (color[i] == -1 ? 0 : 1) << endl;

    return 0;
}


Measured memory_bytes: 7168
(defun solver (&aux (max 0) (min 1001) temp)
  (let ((n (read)))
    (loop repeat n do
          (setf temp (read))
          (when (> temp max) (setf max temp))
          (when (< temp min) (setf min temp)))
    (format t "~A~%" (- max min))))

(solver)

Measured memory_bytes: 13668
#include <iostream>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

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

    map<string, int> strings;
    for(int idx = 1; idx <= N; ++idx) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        strings[s] += 1;
    }

    long long int ans = 0LL;
    for(auto iter = strings.begin(); iter != strings.end(); ++iter) {
        long long int n = iter->second;
        ans += (n*(n-1LL))/2LL;
    }
    
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 11136
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<cmath>
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n,a;
  cin>>a>>n;
  while(n--){
	int x,y;
	cin>>x>>y;
    x=min(x,a-x+1);
	y=min(y,a-y+1);
	if(x>y)swap(x,y);
	x--;
	cout<<x%3+1<<endl;
  }
}
	

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<char,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    int n;
    cin >> n;

    int ans = n * 800;
    ans -= n / 15 * 200;

    cout << ans << endl;

    return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h.at(i);
    }
    sort(h.begin(), h.end());

    long long numAttack = 0;
    for (int i = 0; i < n - k; i++)
    {
        numAttack += h.at(i);
    }
    cout << numAttack << endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)

int main () {
  int n, r = 0;
  cin >> n;
  string s;
  cin >> s;
  REP (i, n) {
    if (s[i] != s[i + 1]) {
      ++r;
    }
  }
  cout << r << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(){
    char ss[20];
    int a=0,max=0,i=0;
    scanf("%s",ss);
    while(ss[i]!='\0'){
	if(ss[i]=='A'){
		a++;
	}else if(ss[i]=='G'){
		a++;
	}else if(ss[i]=='T'){
		a++;
	}else if(ss[i]=='C'){
		a++;
	}else{
		a=0;
	}
	if(a>max){
		max=a;
	}
	i++;
}
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
 
int main() {
    int n;
    cin>>n;
    vector <string> s(n);
    vector <int> t(n);
    string x;
    rep(i,n) {
        cin>>s[i]>>t[i];
    }
    cin>>x;
    int ans=0;
    rep(i,n) {
        ans+=t[i];
    }
    int me;
    rep(i,n) {
        if(s[i]==x) me=i+1;
    }
    rep(i,me) {
        ans-=t[i];
    }

    cout<<ans<<endl;

 return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
int64_t i,j,k,l;//preparation for
int main(){
    double L;
    cin>>L;
    L=pow(L/3,3);
    cout<<fixed<<setprecision(15)<<L;
    return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const ll inf = 1e9;


void solve()
{
  ll N;
  scanf("%lld",&N);
  ll K;
  scanf("%lld",&K);
  if (N%K==0) cout << 0 << endl;
  else cout << 1 << endl;
}

int main()
{
  solve();
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

vector<vector<int>> adj;

vector<pair<vector<int>, vector<int>>> Bipartite() {
  vector<pair<vector<int>, vector<int>>> result;
  int n = adj.size();
  int used[n] = {};
  rep(i,n) {
    if (used[i]) continue;
    used[i] = 1;
    vector<int> left, right;
    queue<pair<int, int>> q; q.push(make_pair(i,-1));
    while (q.size()) {
      pair<int, int> now = q.front(); q.pop();
      if (used[now.first]==1) left.push_back(now.first);
      else right.push_back(now.first);
      for (auto x: adj[now.first]) {
        if (x==now.second) continue;
        if (used[x]) { if (used[x]==used[now.first]) return {}; }
        else {
          used[x] = used[now.first] * -1;
          q.push(make_pair(x,now.first));
        }
      }
    }
    result.push_back(make_pair(left,right));
  }
  return result;
}

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

int main() {
  int N, M; cin >> N >> M;
  bool edge[N][N]; rep(i,N) rep(j,N) edge[i][j] = i!=j;
  rep(i,M) {
    int A, B; cin >> A >> B; A--; B--;
    edge[A][B] = false;
    edge[B][A] = false;
  }
  adj.resize(N);
  rep(i,N) rep(j,N) if (edge[i][j]) adj[i].push_back(j);
  vector<pair<vector<int>, vector<int>>> bi = Bipartite();
  int bs = bi.size();
  if (!bs) { cout << -1 << endl; return 0; }

  bool dp[bs+1][N+1] = {}; dp[0][0] = true;
  rep(i,bs) {
    int vl = bi[i].first.size(), vr = bi[i].second.size();
    rep(j,N+1) {
      if (j+vl<=N) dp[i+1][j+vl] |= dp[i][j];
      if (j+vr<=N) dp[i+1][j+vr] |= dp[i][j];
    }
  }

  // for (auto x: bi) {
  //   debug(all(x.first));
  //   cout << "&" << endl;
  //   debug(all(x.second));
  //   cout << endl;
  // }
  // rep(i,bs+1) debug(dp[i],dp[i]+N+1);

  int lnum = N/2; while(!dp[bs][lnum]) lnum++;
  int result = N*(N-1)/2 - lnum*(N-lnum);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << " " << b << " " << c << "\n";


	return 0;
}



Measured memory_bytes: 888
#include <cstdio>

int ham[1000010];
int sum[1000010];

int main(){
	ham[1] = 1;
	for(int i = 2; i <= 1000000; ++i){
		int t = 0;
		if(i % 2 == 0){ t |= ham[i / 2]; }
		if(i % 3 == 0){ t |= ham[i / 3]; }
		if(i % 5 == 0){ t |= ham[i / 5]; }
		ham[i] = t;
	}
	for(int i = 1; i <= 1000000; ++i){
		sum[i] = sum[i - 1] + ham[i];
	}
	
	int m, n;
	while(scanf("%d%d", &m, &n) == 2){
		printf("%d\n", sum[n] - sum[m - 1]);
	}
}

Measured memory_bytes: 8840
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define Mx 200001
#define inf 1e15
const int MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


typedef long long  L;
//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,q,q1,q2,q3,q4,r,s,t,
u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

//double rat;
void solve(){
    c=0;
    for(L i=1;i<=n;i++){
        if(i%3==0||i%5==0){

        }else c+=i;
    }
    printf("%lld\n",c);
}
int main()
{
    scanf("%lld",&n);
    solve();
    return 0;
}
/// lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    string s; cin >> s;
    bool ok = true;
    if (s[2]!=s[3]) ok = false;
    if (s[4]!=s[5]) ok = false;
    if (ok) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
    int i, j, k, l, m, n;
    cin >> n >> m >> l;
    int A[n][m], B[m][l];
    
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            cin >> A[i][j];
        }
    }
    for(i = 0; i < m; i++){
        for(j = 0; j < l; j++){
        cin >> B[i][j];
        }
    }
    for(i = 0; i < n; i++){
        long int multip;
        for(j = 0; j < l; j++){
            multip = 0;
            for(k = 0; k < m; k++){
            multip += A[i][k] * B[k][j];
            }
            if(j == l-1) break;
            cout << multip << ' ';
        }
        cout << multip << endl;
    }
}


Measured memory_bytes: 3164
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        long C = sc.nextLong();
        long sum = 0;
        int counter = 0;
        while(sum < C){
            sum += A;
            if(counter % 7 == 6) sum += B;
            counter++;
        }
        System.out.println(counter);
    }
}



Measured memory_bytes: 26464
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    char a;
    cin >> a;
    if (a - 'a' >= 0) {
        cout << "a" << endl;
    } else {
        cout << "A" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3632
#![allow(unused_imports)]
use proconio::{
   fastout, input,
   marker::{Bytes, Isize1, Usize1},
};

const INF: usize = std::usize::MAX;

#[fastout]
fn main() {
   input! {
      mut h: usize,
      mut w: usize,
      k: usize,
      s: (usize, usize),
      g: (usize, usize),
      mut c: [Bytes; h],
   }
   for i in 0..h {
      c[i].insert(0, b'@');
      c[i].push(b'@');
   }
   w += 2;
   c.insert(0, vec![b'@'; w]);
   c.push(vec![b'@'; w]);
   h += 2;

   let mut d = vec![vec![INF; w]; h];
   let mut q = std::collections::VecDeque::new();
   d[s.0][s.1] = 0;
   q.push_back(s);
   while let Some(pos) = q.pop_front() {
      let dn = d[pos.0][pos.1] + 1;
      for &(dx, dy) in [(1, 0), (0, 1), (!0, 0), (0, !0)].iter() {
         let (mut x, mut y) = pos.clone();
         for _ in 0..k {
            x += dx;
            y += dy;
            if c[x][y] == b'@' {
               break;
            }
            if d[x][y] == INF {
               d[x][y] = dn;
               q.push_back((x, y));
            }
            if d[x][y] < dn {
               break;
            }
         }
      }
   }

   let ans = d[g.0][g.1];
   if ans == INF {
      println!("-1");
   } else {
      println!("{}", ans);
   }
}


Measured memory_bytes: 29524
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<sstream>
using namespace std;
#define MOD 1000000007
const long long INF = 1LL << 60;

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

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

long long dp[100010][3];
int main() {
	int n;
	cin >> n;
	int *a = new int[n];
	int *b = new int[n];
	int *c = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for (int i = 1; i < n; i++) {
		chmax(dp[i][0], dp[i - 1][1] + a[i]);
		chmax(dp[i][0], dp[i - 1][2] + a[i]);
		chmax(dp[i][1], dp[i - 1][0] + b[i]);
		chmax(dp[i][1], dp[i - 1][2] + b[i]);
		chmax(dp[i][2], dp[i - 1][0] + c[i]);
		chmax(dp[i][2], dp[i - 1][1] + c[i]);
	}
	long long max = dp[n - 1][0];
	if (max < dp[n - 1][1])max = dp[n - 1][1];
	if (max < dp[n - 1][2])max = dp[n - 1][2];
	cout << max;



	return 0;
}


Measured memory_bytes: 3712
/*
23280701537353
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define   mt         make_tuple
//#define   Y            imag()
//#define   X            real()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
//#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
//#define    dp(a,b)          (((conj(a))*(b)).real())
//#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
//#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     PT                    complex<double>
#define outfile freopen("out.out", "w", stdout);
#define infile  freopen("in.in", "r", stdin);
#define PI acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
using namespace __gnu_pbds;
int dcmp(double a,double b){   return fabs(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
ll setBit1(ll num, int idx) {return num | (1ll<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void FS(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=100009;
string st;
ll mod=(1e9+7);
ll mem[N][16],P[N];
ll solve(ll id,ll rem)
{
    if(id==sz(st))
    {
        if(rem==5)
            return 1;
        return 0;
    }
    ll &ret=mem[id][rem];
    if(ret!=-1)
        return ret;
    ll ans=0;
    if(st[id]=='?')
    {
        for(ll i=0;i<=9;i++)
        {
            ans=(ans+solve(id+1,(rem+(1ll*i*P[sz(st)-1-id])%13)%13))%mod;
        }
    }
    else
    {
        ll i=st[id]-'0';
        ans=(ans+solve(id+1,(rem+(i*P[sz(st)-1-id])%13)%13))%mod;
    }
    return ret=ans;
}
int main()
{
    cin>>st;
    clr(mem,-1);
    P[0]=1;
    for(int i=1;i<=100003;i++)
        P[i]=(P[i-1]*10ll)%13;
    cout<<solve(0,0)<<endl;
}





















Measured memory_bytes: 19968
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = reader.readLine().split(" ");
        int K = Integer.parseInt(arr[0]);
        int X = Integer.parseInt(arr[1]);
        System.out.println(X <= K * 500 ? "Yes" : "No");
    }
}

Measured memory_bytes: 21204
N = int(input())
words = []
for i in range(N):
  s_in = str(input())
  s_sort = ''.join(sorted([ch for ch in s_in]))
  words.append(s_sort)
#print(words)

# Counterクラス: key=要素, val=出現回数
from collections import Counter
cntr = Counter(words)
#print(cntr)

# 出現回数2個以上は組み合わせ数を足す
ans = 0
for cnt in cntr.values():
  if cnt > 1:
    ans += cnt * (cnt - 1) // 2

print(ans)

Measured memory_bytes: 19732
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 2400005
#define M 2400000
#define ll long long
#define mod 1000000007
int x1, x2, x3, x4, x5, x6;
int y1, y2, y3, y4, y5, y6;
int fac[N], inv[N];
int C(int n, int m)
{
	if (n < m)return 0;
	return (ll)fac[n] * inv[m] % mod * inv[n - m] % mod;
}
int Add(int a, int b)
{
	int c = a + b;
	if (c >= mod)c -= mod;
	return c;
}
int Sub(int a, int b)
{
	int c = a - b;
	if (c < 0)c += mod;
	return c;
}
int Pow(int a, int k)
{
	int ret = 1;
	while (k)
	{
		if (k & 1)
			ret = (ll)ret * a % mod;
		a = (ll)a * a % mod;
		k >>= 1;
	}
	return ret;
}
int Way(int x1, int y1, int x2, int y2)
{
	x1--, y1--, x2--, y2--;
	int ans = C(x2 + y2 + 2, x2 + 1);
	ans = Sub(ans, C(x2 + y1 + 1, x2 + 1));
	ans = Sub(ans, C(x1 + y2 + 1, x1));
	ans = Add(ans, C(x1 + y1, x1));
	return ans;
}
int main()
{
	fac[0] = 1;
	for (int i = 1; i <= M; i++)
		fac[i] = (ll)fac[i - 1] * i % mod;
	inv[M] = Pow(fac[M], mod - 2);
	for (int i = M; i >= 1; i--)
		inv[i - 1] = (ll)inv[i] * i % mod;
	scanf("%d%d%d%d%d%d", &x1, &x2, &x3, &x4, &x5, &x6);
	scanf("%d%d%d%d%d%d", &y1, &y2, &y3, &y4, &y5, &y6);
	int ans = 0, s;
	for (int i = y3 + 1; i <= y4; i++)//左侧进入点
	{
		s = (ll)Way(x3 - x2, i - y2 + 1, x3 - x1, i - y1 + 1) * Way(x5 - x3 + 1, y5 - i + 1, x6 - x3 + 1, y6 - i + 1) % mod;
		ans = (ans - (ll)(i + x3) * s) % mod;
	}
	s = (ll)Way(x3 - x2 + 1, y3 - y2 + 1, x3 - x1 + 1, y3 - y1 + 1) * Way(x5 - x3 + 1, y5 - y3 + 1, x6 - x3 + 1, y6 - y3 + 1) % mod;
	ans = (ans - (ll)(x3 + y3) * s) % mod;//左下进入点
	for (int i = x3 + 1; i <= x4; i++)//下侧进入点
	{
		s = (ll)Way(i - x2 + 1, y3 - y2, i - x1 + 1, y3 - y1) * Way(x5 - i + 1, y5 - y3 + 1, x6 - i + 1, y6 - y3 + 1) % mod;
		ans = (ans - (ll)(i + y3) * s) % mod;
	}
	for (int i = y3; i <= y4 - 1; i++)//右侧离开点
	{
		s = (ll)Way(x4 - x2 + 1, i - y2 + 1, x4 - x1 + 1, i - y1 + 1) * Way(x5 - x4, y5 - i + 1, x6 - x4, y6 - i + 1) % mod;
		ans = (ans + (ll)(i + x4 + 1) * s) % mod;
	}
	s = (ll)Way(x4 - x2 + 1, y4 - y2 + 1, x4 - x1 + 1, y4 - y1 + 1) * Way(x5 - x4 + 1, y5 - y4 + 1, x6 - x4 + 1, y6 - y4 + 1) % mod;
	ans = (ans + (ll)(x4 + y4 + 1) * s) % mod;
	for (int i = x3; i <= x4 - 1; i++)//上侧离开点
	{
		s = (ll)Way(i - x2 + 1, y4 - y2 + 1, i - x1 + 1, y4 - y1 + 1) * Way(x5 - i + 1, y5 - y4, x6 - i + 1, y6 - y4) % mod;
		ans = (ans + (ll)(i + y4 + 1) * s) % mod;
	}
	if (ans < 0)ans += mod;
	printf("%d\n", ans);
}


Measured memory_bytes: 18944
# -*- coding utf-8 -*-

S = input()

ans = 1000
for i in range(len(S) - 2):
    diff = abs(int(S[i]) * 100 + int(S[i+1]) * 10 + int(S[i + 2]) * 1 - 753)
    ans = min(ans, diff)

print(ans)

Measured memory_bytes: 2940
#include <stdio.h>

int binarySearch(int a[],int k,int head,int tail){
    int mid=(head+tail)/2;
//printf("a[%d]=%d,k=%d\n",mid,a[mid],k);
    if(tail<head)return 0;
    
    if(a[mid]==k)return 1;
    else if(a[mid]<k)head=mid+1;
    else if(a[mid]>k)tail=mid-1;
    
    return binarySearch(a,k,head,tail);
}

int main(void){
    int i;
    
    int n;
    scanf("%d\n",&n);
    int a[n];
    for(i=0;i<n;i++)scanf("%d ",&a[i]);
    
    int q;
    scanf("%d\n",&q);
    
    int k;
    for(i=0;i<q;i++){
        scanf("%d\n",&k);
        
        printf("%d\n",binarySearch(a,k,0,n-1));
    }
    
    return 0;
}


Measured memory_bytes: 2188
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
ans = 0.0
n.times do
  a,b = gets.chomp.split
  a = a.to_f
  bb = b == 'JPY' ? 1.0 : 380000.0
  ans += bb * a
end

puts ans


Measured memory_bytes: 2300
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define WDSIZE 10000000
typedef long long ll;
#define BUFSIZE 1000000000000

ll n;
int count = 0;
int divisor[WDSIZE] = {0};

//その約数が使われたことがあるか確認

int used_check(ll b){
  for(int i = 0;i < BUFSIZE; i++){
    if(divisor[i] == 0) break;
    if(divisor[i] == b) return 1;
  }
  return 0;
}

///素数判定
int prime(ll num){
  if(num == 1) return 1;
  for(ll i = 2;i <= sqrt(num);i++){
    if(num % i == 0){
      return 1;
    }
  }
    return 0; //素数なら０を返す
}


int frag = 0 ; //塁乗だったら０　違ったら　１にする
int rem; //一時的に割り切れる数を記憶
///素数の累乗かcheck

int conform_check(ll given){
  frag = 0;
  for(ll i = 2;i <= sqrt(given);i++){
    if(given % i == 0 && prime(i) == 0){
       rem = i;
       break;
     }
   }
  while(given > 1){

    if(given % rem == 0){
      given = given/rem;
    }else{
      frag = 1;
      break;
    }
  }
  if(frag == 1) return 0;
  else  return 1;
}

int flag_fin; //１だったらもう操作できない　終了条件判定


//入力した値を　まだ割ったことのない数かつ、素数or素数の累乗で割る関数

int fact(ll a){
  if(prime(a) == 0 && used_check(a) == 0){
    divisor[count] = a;
    count++;
    return 0;
  }
  for(ll i = 2;i <= a;i++){
    if(a % i == 0){
      if(used_check(i) == 1) continue; //使われてない確認
      else if(prime(i) == 0 || conform_check(i) == 1){ //素数か素数の累乗ならOK
        divisor[count] = i;///割った数を記憶　割るのは下のcal内
        count++;
        return 0;
      }
    }
  }
  flag_fin = 1;
  return 0;
}


int cal(ll given_number){
  fact(given_number);
  if(divisor[count - 1] == 0 || prime(given_number) == 0 || flag_fin == 1)
  return 0;
  cal(given_number/divisor[count - 1]);
}


int main(void){
  scanf("%lld",&n);
  if(prime(n) == 0){
    printf("1");
    exit(0);
  }
  cal(n);
  printf("%d",count);

  return 0;
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
     
    using namespace std;
     
    #define ll  long long
    #define mod 1000000007
    #define pb push_back
 
    
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
 
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
 
        ll i,n,n2,m,t,j,l,pos,mpos,f=0,k,p,n1,z,q,x,y,x1,y1,x2,y2;
      
        /*cin>>t;
        
      
       while(t--)
    {
 
        
    }*/
       cin>>n>>x;
       ll a[n+1],sz;
       vector<bool> vt(n+1,false);
       for(i=1;i<=n;i++)
        cin>>a[i];
       vector<ll> vp;

       i=1;
       y=1;
       while(true)
       {
        
        if(vt[i]){
            y=i;
            break;
        }
        vp.push_back(i);
        vt[i]=true;
        i=a[i];
       }
       sz=vp.size();
      /* for(i=0;i<sz;i++)
       {
        cout<<vp[i]<<" ";
       }
       cout<<endl;*/
       for(i=0;i<sz;i++)
        if(vp[i]==y)
            break;
        if(x<=i+1)
        {
            cout<<vp[x];
        }
        else
        {
            x-=i;
            z=sz-i;
            x%=z;
            cout<<vp[i+x];

        }
     
       
      
      return 0;
   }

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

int main() {
  ll n, m, k; cin >> n >> m >> k;
  vector<int> A(n+1), B(m+1);
  vector<ll>  CA(n+1), CB(m+1);
  rep(i,n+1) {
    if (i==0) continue;
    cin >> A[i];
    CA[i] = A[i] + CA[i-1];
  }
  rep(i,m+1) {
    if (i==0) continue;
    cin >> B[i];
    CB[i] = B[i] + CB[i-1];
  }
  int ans = 0, ai = 0;
  while (ai <= n && CA[ai] <= k) {
    int l = -1, r = m + 1;
    while (r - l > 1) {
      int mid = (l + r) / 2;
      if (CA[ai] + CB[mid] <= k) {
        l = mid;
      } else {
        r = mid;
      }
    }
    ans = max(ai+l, ans);
    ai++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 7956
//Andrew Yang
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>	
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>
using namespace std;
#define FOR(index, start, end) for(int index = start; index < end; index++)
#define RFOR(index, start, end) for(int index = start; index > end; index--)
#define FOREACH(itr, b) for(auto itr = b.begin(); itr != b.end(); itr++)
#define RFOREACH(itr, b) for(auto itr = b.rbegin(); itr != b.rend(); itr++)
#define INF 1000000000
#define M 1000000007
typedef long long ll;
typedef pair<int, int> pii;
int a[100001];
int main(void)
{
	//freopen("rename_this.in", "r", stdin);
	//freopen("rename_this.out", "w", stdout);
	int n;
	cin >> n;
	FOR(i, 0, n)
	{
		scanf("%d", &a[i]);
	}
	sort(a, a + n);
	ll sum = 0;
	int t = -1;
	FOR(i, 0, n)
	{
		sum += a[i];
		if (i < n - 1 && 2 * sum < (ll)a[i + 1])
		{
			t = i;
		}
	}
	if (t == -1)
	{
		cout << n << endl;
		return 0;
	}
	cout << n - 1 - t << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    string s;
    cin >> s;
    int n=s.length();
    if(n%2){
        cout << "No";
        return 0;
    }
    rep(i,n){
        if(i%2){
            if(s[i]!='i'){
                cout << "No";
                return 0;
            }
        }
        else{
            if(s[i]!='h'){
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";



    
}

/*
*/



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

using namespace std;

int main(){
	int n,k,sum=0;
	cin>>n>>k;
	int d[k+1],a[k+1][n+1],have[n+1];
	for(int i=0;i<=k;i++){
		for(int j=0;j<=n;j++){
			a[i][j]=0;
		}
	}
	for(int i=1;i<=n;i++){
		have[i]=0;
	}
	for(int i=1;i<=k;i++){
		cin>>d[i];
		for(int j=1;j<=d[i];j++){
			cin>>a[i][j];
			have[a[i][j]]=1;
		}
	}
	for(int i=1;i<=n;i++){
		if(have[i]==0)sum++;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int count=0;
	string word, uw, lw, text;

	cin >> word;

	while(cin>>text) {
		if(text=="END_OF_TEXT") break;

		transform(text.begin(), text.end(), text.begin(), ::tolower);

		if(text==word) count++;
	}

	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3168
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a), _end_ = (b); i < _end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define X first
#define Y second
#define mp make_pair
#define eb emplace_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
    char c = getchar();
    bool f = false;
    for (x = 0; !isdigit(c); c = getchar()) {
        if (c == '-') {
            f = true;
        }
    }
    for (; isdigit(c); c = getchar()) {
        x = x * 10 + c - '0';
    }
    if (f) {
        x = -x;
    }
}

const int MAX_N = 305;
const int MAX_M = 14005;
const int INF = 0x3f3f3f3f;

char s[5];

int main()
{
#ifdef ANONYM
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    scanf("%s", s);
    if(strlen(s) == 3) {
        char t = s[2];
        s[2] = s[0];
        s[0] = t;
        printf("%s\n", s);
    } else printf("%s\n", s);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  string s;
  cin >> n >> s;
  n*=2;
  ll a[n],c=0;
  rep(i,n) {
    if(s[i]=='B') {
      a[i]=1;
      c++;
    } else a[i]=0;
  }
  ll t=0,ans=1,cnt=0,r=0;
  rep(i,n) {
    if(a[i]^t) {
      r++;
      cnt++;
    } else {
      ans*=cnt;
      ans%=MAX;
      cnt--;
    }
    t^=1;
  }
  REP(i,1,n/2+1) {
    ans*=i;
    ans%=MAX;
  }
  if(r!=n/2) ans=0;
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 2196
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 5e5 + 123;
int n, dp[5][N], p[5][N];
string s;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> s;
	s = '#' + s;
	int res = 0;
	// 0-1: 10-1111...1
	// 2-3: 1111...1-01
	// 4: 0
	memset(& dp, -0x3f, sizeof(dp));
	dp[4][0] = 0;
	for (int i = 1; i <= n; i++) {
		if (s[i] == '0') {
			dp[4][i] = max({dp[0][i - 1], dp[1][i - 1], dp[3][i - 1], dp[4][i - 1]});
		}
		if (s[i] == '1') {
			dp[1][i] = max(dp[0][i - 1], dp[1][i - 1]) + 1;
			dp[2][i] = max({dp[1][i - 1], dp[2][i - 1], dp[3][i - 1], dp[4][i - 1]}) + 1;
		}
		if (i >= 2 && s[i - 1] == '1' && s[i] == '0') {
			dp[0][i] = max({p[0][i - 2], p[1][i - 2], p[3][i - 2], p[4][i - 2]});
		}
		if (i >= 2 && s[i - 1] == '0' && s[i] == '1') {
			dp[3][i] = dp[2][i - 2];
		}
		res = max({res, dp[1][i], dp[3][i]});
		for (int j = 0; j < 5; j++)
			p[j][i] = max(p[j][i - 1], dp[j][i]);
	}
	cout << res;
}


Measured memory_bytes: 23504
N =int(input())
L = [i for i in range(1,10)]
M = L.copy()
for i in range(11):
  S = []
  for x in L:
    if x % 10 == 0:
      S.append(x*10)
      S.append(x*10 + 1)
    elif x % 10 == 9:
      S.append(x*10 + 8)
      S.append(x*10 + 9)
    else:
      S.append(x*10 + x % 10 - 1)
      S.append(x*10 + x % 10)
      S.append(x*10 + x % 10 + 1)
  L = S.copy()
  M += S
print (sorted(M)[N-1])


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

int main(){
  string S;
  cin >> S;
  for(int i = 0;i<4;i++){
    
    if(i == 3){
      cout << "Good" << endl;
      break;
    }
    if(S.at(i) == S.at(i+1)){
      
      cout << "Bad" << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
## for use in beginner level questions where speed is key
## and also for single test case code
## mastercopy for x,y,z

import sys
import heapq, functools, collections
import random
from collections import Counter, defaultdict

# read line as a string
# strr = input()

# read line as an integer
k = int(input())

# read one line and parse each word as a string
# lst = input().split()

# read one line and parse each word as an integer
# arr = list(map(int,input().split()))

print(1-k)


Measured memory_bytes: 76760
#include <stdio.h>
int main(){
    char str[3][4];
    int i;
    for(i = 0; i < 3; i++){
        scanf("%s", str[i]);
    }
    for(i = 0; i < 3; i++){
        printf("%c", str[i][i]);
    }
    printf("\n");
}

Measured memory_bytes: 128
//------ © daxkofficial™ ------//
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define ll long long
#define ld long double
#define all(x) (x).begin(), (x).end()
#define srt(x) sort((x).begin(), (x).end());
#define clr(x) memset(x, 0, sizeof(x))
#define mem(a,val) memset(a,val,sizeof(a))
#define trace(x) for(auto it:x) cout<<it<<' '; cout<<"\n";
#define sumv(x, w) for(auto it:x) w+=it;
#define traca(A, n) for(ll i=0; i<n; i++) cout<<A[i]<<' '; cout<<"\n";
#define pll pair<ll,ll>
#define vll vector<ll>
#define vvll vector<vll>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define cy cout<<"YES"<<"\n";
#define cn cout<<"NO"<<"\n";
#define nl cout<<"\n";
#define chk cout<<"*\n";
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

/*-----------------------------Modular Arithmetic---------------------*/
inline ll add(ll x,ll y,ll mod){x+=y; if(x>=mod) return x-mod; return x;}
inline ll sub(ll x,ll y,ll mod){x-=y; if(x<0) return x+mod; return x;}
inline ll mul(ll x,ll y,ll mod){return (x*1ll*y)%mod;}
inline ll power(ll x,ll y,ll mod){ll ans=1; while(y){if(y&1) ans=mul(ans,x,mod); x=mul(x,x,mod); y>>=1;} return ans;}
inline ll inv(ll x,ll mod){return power(x,mod-2,mod);}
 
 
 
/*------------------------ Important Functions ----------------------------*/

ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}
 
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
 
 
 
 
/*------------------------ Trouble begins here ----------------------------*/
 
 
const ll M=1e9+7, M2=998244353;
const ll N=1e5+100;




void solve()
{
    ll a, b, c, d;
    cin>>a>>b>>c>>d;
    ll mx=-1e18;
    mx=max(mx, a*c);
    mx=max(mx, b*d);
    mx=max(mx, b*c);
    mx=max(mx, a*d);
    ll ze=0;
    if((b>=0&&a<=0)||(d>=0&&c<=0))
    mx=max(mx, ze);
    cout<<mx;
    nl
    return;
}
 
 
 
int main()
{
    fastio
 
    ll tc=1;
    //cin>>tc;
    while(tc--)
    {

        //cout<<"ch\n";
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 3652
// D - Coloring Edges on Tree
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	int G[N], C[N-1];
	rp(i, 0, N-1){
		int p; scanf("%d%d", &p, C+i);
		G[--C[i]] = p-1;
	}

	int K = 1;
	int pre_colors[N]; rp(i, 0, N) pre_colors[i] = 0;

	rp(c, 1, N){
		int p = G[c];
		int color = pre_colors[p] + 1;
		pre_colors[p] = G[c] = color==G[p]? ++color: color;
		K = max(K, color);
	}

	printf("%d\n", K);
	for(int c:C) printf("%d\n", G[c]);
}

Measured memory_bytes: 1664