akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

vector<int> DecToBin(int i, int n)
{
    vector<int> temp;
    int dig = 0;
    while (i)
    {
        temp.push_back(i % 2);
        i /= 2;
        dig++;
    }
    for (int i = 0; i < (n - dig); i++)
        temp.push_back(0);
    return temp;
}

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    int c[n], a[n][m];
    int total[m];
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        for (int j = 0; j < m; j++)
            cin >> a[i][j];
    }
    for (int i = 0; i < m; i++)
        total[i] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            total[j] += a[i][j];
        }
    }
    int flag = 1;
    for (int i = 0; i < m; i++)
    {
        if (total[i] < x)
        {
            flag = 0;
            break;
        }
    }
    if (flag == 0)
    {
        cout << -1 << endl;
        return 0;
    }

    int win[m];
    int min_cost = 10000000;
    int cost = 0;

    int comb = pow(2, n);
    for (int i = 1; i <= comb; i++)
    {
        vector<int> perm;
        perm = DecToBin(i, n);

        for (int j = 0; j < m; j++)
            win[j] = 0;

        cost = 0;

        for (int j = 0; j < n; j++)
        {
            if (perm[j] == 1)
            {
                cost += c[j];
                for (int k = 0; k < m; k++)
                {
                    win[k] += a[j][k];
                }
            }
        }

        int f = 1;
        for (int j = 0; j < m; j++)
        {
            if (win[j] < x)
            {
                f = 0;
                break;
            }
        }
        if (f == 1)
        {
            min_cost = min(min_cost, cost);
        }
    }
    cout << min_cost << endl;
    return 0;
}

Measured memory_bytes: 4104
using System;

namespace AtCoder
{
	class Programs
	{
		static void Main ()
		{
			var n = int.Parse (Console.ReadLine ());
			var k = int.Parse (Console.ReadLine ());
			var a = Array.ConvertAll (Console.ReadLine ().Split (), int.Parse);
			long ans = 0;
			for (int i = 0; i < n; i++) 
			{
				if (k - a [i] < a [i]) ans += k - a [i];
				else ans += a [i];
			}
			Console.WriteLine (2*ans);
		}
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
	int n;
    cin >> n;
	vector<int> a(n);
	rep(i,n){
		cin >> a[i];
		a[i]-=i+1;
	}
    vector<int> b = a;
	sort(a.begin(), a.end());
	int mid = a[(n-1)/2];
	ll ans = 0;
	rep(i,n){
		ans += abs(b[i]-mid);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cctype>

int main(){
    char ch;

    while(1){
        scanf("%c", &ch);
        if(isalpha(ch)){
            if(islower(ch))printf("%c", toupper(ch));
            else printf("%c", tolower(ch));
        }else printf("%c", ch);

        if (ch == '\n') break;
    }

    return 0;
}


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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    vector<int> state(N+1);
    for (int k=0;k<min(K,50);k++){
        for (int i=0;i<N+1;i++){
            state[i] = 0;
        }
        for (int i=0;i<N;i++){
            if (i - A[i] < 0) state[0]++;
            else state[i-A[i]]++;
            if (i + 1 + A[i] > N) state[N]--;
            else state[i+1+A[i]]--;
        }
        for (int i=0;i<N;i++){
            state[i+1] += state[i];
        }
        for (int i=0;i<N;i++){
            A[i] = state[i];
        }
    }
    for (int i=0;i<N;i++){
        cout << A[i];
        if (i==N-1) cout << "\n";
        else cout << " ";
    }
}

Measured memory_bytes: 4784
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    long long a;
    cin>>a;
    long long c=100;
    int cou=0;
    rep(i,5000){
        c+=(c/100);
        cou++;
        if(c>=a){
            break;
        }
    }
    cout<<cou<<endl;

}



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

// --------------------------------------------------------------------------------
#define fast_IO	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL);
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve()
{
    int n,k;cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;++i)
        cin>>arr[i];
    sort(arr,arr+n);
    long long ans = 0;
    for(int i=0;i<k;++i)
    {
        ans+=arr[i];
    }
    cout<<ans<<"\n";
}

int main()
{
	#ifndef ONLINE_JUDGE
    	freopen("/home/suryakant/input.txt","r",stdin);
        freopen("/home/suryakant/output.txt","w",stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    
}

Measured memory_bytes: 3584
#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;
#define IOS {ios :: sync_with_stdio(false); cin.tie(0);cout.tie(0); }
#define F first
#define S second
#define pb push_back
typedef long double ld;
#define deci(n) cout << fixed << setprecision(n);
typedef long long ll;

#define mem0(x)  memset(x,0,sizeof(x));
#define mem1(x)  memset(x,1,sizeof(x));
#define memm1(x) memset(x,-1,sizeof(x));
#define all(a) a.begin(), a.end()
#define pll pair<ll, ll>
#define bits(x) __builtin_popcount(x)
#define fori(n)  for (ll i = 0; i < n; i++)
#define fori2(n) for(ll i=1;i<=n;i++)
#define forj(n)  for (ll j = 0; j < n; j++)
#define forj2(n) for(ll j=1;j<=n;j++)
#define fork(n)  for (ll k = 0; k < n; k++)
#define fork2(n) for(ll k=1;k<=n;k++)
#define vll vector <ll>
#define mll map <ll, ll>
#define vpll vector <pll>
const ll md = 1e9 + 7;

#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a, p)?(BXOR(a, p)):(a))
#define BSHO(a, N) (bitset<N>(a))
// const ll N = 100005;
// ll fac[N] = {1};
// #define calfac for(ll i=1  ;i<N;i++) fac[i] = (fac[i-1]*i)%md;
// ll C[N+1][M+1]; 
// void  ncr(){
//     ll n = N,k = M; 
//     for (ll i = 0; i <= n; i++) { 
//         for (ll j = 0; j <= min(i, k); j++) { 
//             if (j == 0 || j == i)  C[i][j] = 1; 
//             else C[i][j] = C[i - 1][j - 1] +  C[i - 1][j]; 
//         } 
//     } 
// } 


#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 
// Ordered set docs:
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
ll modInv(ll a)
{
    return pow(a,md-2);
}
 
// ll nCr(ll n,ll r)
// {
//     return (fac[n]*modInv((fac[r]*fac[n-r])%md))%md;
// }

 
ll po(ll x,ll n){
    if(n==0) return 1;
    if(n%2==1) return (x*po(x,n-1));
    else {
        ll k=po(x,n/2);
        return (k*k);
    }
}
 
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}
 
ll dp[105][100005];
ll w[105],c[105];

int32_t main(){
    IOS;
    ll i,j,k,n,W;
    cin >> n >> W;
    fori2(n){
        cin >> w[i] >> c[i];
    }
    for(i = 1 ; i <= n ; i++){
        for(j = 1 ; j <= W ; j++){
            dp[i][j] = dp[i-1][j];
            if(j >= w[i]){
                dp[i][j] = max(dp[i][j],dp[i-1][j - w[i]] + c[i]) ;
            }
        }
    }
    cout << dp[n][W]<<"\n";
} 

Measured memory_bytes: 79360
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<list>
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int >
 
using namespace std;


bool ok1[200020],ok2[200020];








int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		if(x==1) ok1[y]=1;
		if(y==n) ok2[x]=1;
		if (ok1[x]&&y==n) 
		{
			printf("POSSIBLE\n");  
			return 0;
		}
		if (ok2[y]&&x==1)
		{
			printf("POSSIBLE\n");  
			return 0;
		}
	} 
	
	printf("IMPOSSIBLE\n");
	
	return 0;	
} 

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

void bit_conv(char *bit, int hex)
{
	int i;
	
	if (hex >= '0' && hex <= '9'){
		hex -= '0';
	}
	else {
		hex -= 'a';
		hex += 10;
	}
	
	for (i = 3; i >= 0; i--){
		bit[3 - i] = 0;
		if ((hex >> i) & 1){
			bit[3 - i] = 1;
		}
	}
}

int mpow(int num, int n)
{
	int ret;
	
	ret = 1;
	while (n--){
		ret *= num;
	}
	
	return (ret);
}

int main(void)
{
	char bit[512];
	char input[512];
	int Q;
	int i, j, k;
	int ip;
	double fp;
	
	scanf("%d", &Q);
	for (i = 0; i < Q; i++){
		scanf("%s", input);
		for (j = 0; input[j] != '\0'; j++){
			bit_conv(&bit[j * 4], input[j]);
		}
		if (bit[0] == 1) printf("-");
		
		ip = 0;
		for (j = 1; j <= 24; j++){
			ip = (ip << 1) + bit[j];
		}
		printf("%d.", ip);
		int m = 0;
		fp = 0;
		double dec = 1.0;
		for (j = 0; j < 7; j++){
			dec /= 2.0;
			if (bit[j + 25] == 1){
				m = j;
				fp += dec;
			}
		}
		for (j = 0; j <= m; j++){
			printf("%d", (int)(fp * mpow(10, j + 1)) % 10);
		}
		printf("\n");
	}
	
	return (0);
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    auto nc2 = [](ll n) {return n*(n-1)/2;};

    IOS
    int n, p;
    cin >> n >> p;
    string s; cin >> s;

    vector<ll> dp(p+1);
    dp[0] =1;
    ll ans = 0;
    if (p == 2 || p == 5) {
        REP(i,n) {
            int c = s[n-i-1] - '0';
            if (c % p == 0) ans += n-i;
        }
    } else {
        int mul = 1;
        int cnt = 0;
        RREP(i,n-1) {
            int c = s[i] - '0';
            cnt = (cnt + c * mul) % p;
            dp[cnt]++;
            mul = (mul*10) % p;
        }
    }

    REP(i,p) ans += nc2(dp[i]);

    cout << ans << '\n';

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    
    int a[n];
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    
    int ans = 0;
    
    bool flag = true;
    while(flag) {
        for (int i=0; i<n; i++) {
            if (a[i] % 2 != 0) {
                flag = false;
            }
        }
        if (flag) {
            ans++;
            for (int i=0; i<n; i++) {
                a[i] = a[i] / 2;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
//#include "stdafx.h"
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n);
using namespace std;
int main()
{
	MaRiaMa;
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if ((abs(a - c) <= d) || (abs(a - b) <= d && abs(b - c) <= d))
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 3648
package main

import "fmt"

func main() {
	var s, c int

	fmt.Scanf("%d %d", &s, &c)

	if c-s*2 < 0 {
		if c < 2 {
			fmt.Println(0)
		} else {
			fmt.Println(c / 2)
		}
		return
	}
	rest := c - s*2

	fmt.Println(s + int(rest/4))
}

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

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define rep(i,n) for(int i=0; i<(int)(n); i++)
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; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  int n; cin >> n;
  vector<ll> vec(n);
  rep(i, n) cin >> vec[i];
  sort(vec.begin(), vec.end());
  ll m = 0;
  vector<P> ans;
  if (vec[0] > 0) {
    ll now = vec[0];
    for(int i=1; i<n-1; i++) {
      ans.emplace_back(now, vec[i]);
      now = now - vec[i];
    }
    ans.emplace_back(vec[n-1], now);
    m = vec[n-1] - now;
  } else if (vec[n-1] < 0) {
    ll now = vec[n-1];
    for(int i=0; i<n-1; i++) {
      ans.emplace_back(now, vec[i]);
      now = now - vec[i];
    }
    m = now;
  } else {
    reverse(vec.begin(), vec.end());
    int i=1;
    while(vec[i] > 0) {
      ans.emplace_back(vec[n-1], vec[i]);
      vec[n-1] -= vec[i];
      i++;
    }
    while(i < n) {
      ans.emplace_back(vec[0], vec[i]);
      vec[0] -= vec[i];
      i++;
    }
    m = vec[0];
  }
  cout << m << '\n';
  for(auto p: ans) {
    cout << p.first << ' ' << p.second << '\n';
  }


}

Measured memory_bytes: 4336
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define slld(t) scanf("%lld",&t)
#define plld(t) printf("%lld\n",t)
#define For(i,n) for(ll i=0;i<n;i++)
#define bll __builtin_popcountll
#define speed ios::sync_with_stdio(false); cin.tie(0)



using namespace std;




int main()
{
	speed;
    ll n,k;
    cin>>n;
    ll x,y,z,a,b,c;
    ll ar[n+5][3]={0};
    for(ll i=1;i<=n;i++)
    {
        cin>>a>>b>>c;
        if(i==1)
        {
            ar[i][0]=a;
            ar[i][1]=b;
            ar[i][2]=c;
        }
        else
        {
            ar[i][0]=a+max(ar[i-1][1],ar[i-1][2]);
            ar[i][1]=b+max(ar[i-1][0],ar[i-1][2]);
            ar[i][2]=c+max(ar[i-1][0],ar[i-1][1]);
        }
        
    }
    // for(ll i=1;i<=n;i++)
    // {
    //     cout<<ar[i]<<" ";
    // }
    cout<<max(ar[n][0],max(ar[n][1],ar[n][2]));
    


    
    

    
    return 0;
           
}

Measured memory_bytes: 2560
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static boolean[][] wrong;
	public static int[][] number;
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		
		for(int i = 0; i < n; i++) {
			wrong = new boolean[9][9];
			number = new int[9][9];
			for(int j = 0; j < 9; j++) {
				for(int k = 0; k < 9; k++) {
					number[j][k] = stdIn.nextInt();
				}
			}
			
			checkA();
			checkB();
			checkC();
		
			for(int j = 0; j < 9; j++) {
				for(int k = 0; k < 9; k++) {
					if(wrong[j][k]) {
						System.out.print("*" + number[j][k]);
					}
					else {
						System.out.print(" "+number[j][k]);
					}
				}
				System.out.println();
			}
			if(i != n-1) 
			System.out.println();
		}
	}
	
	public static void checkA() {
		for(int x = 0; x < 3; x++) {
			for(int y = 0; y < 3; y++) {
				for(int i = 0; i < 3; i++) {
					for(int j = 0; j < 3; j++) {
						int tmp = number[x + 3*i][y + 3*j];
						int xp = x + 3*i;
						int yp = y + 3*j;
						
						for(int k = 0; k < 3; k++) {
							for(int l = 0; l < 3; l++) {
								if(xp == k + 3*i && yp == l + 3*j) {
									continue;
								}
								if(tmp == number[k + 3*i][l + 3*j]) {
									wrong[k+3*i][l+3*j] = true;
								}
							}
						}
					}
				}
			}
		}
		
		
		
	}
	
	public static void checkB() {
		for(int i = 0; i < 9; i++) {
			for(int j = 0; j < 9; j++) {
				int tmp = number[i][j];
				
				for(int k = 0; k < 9; k++) {
					if(j == k) {
						continue;
					}
					if(tmp == number[i][k]) {
						wrong[i][k] = true;
					}
					
					
				}
			}
		}
	}
	
	public static void checkC() {
		for(int i = 0; i < 9; i++) {
			for(int j = 0; j < 9; j++) {
				int tmp = number[j][i];
				
				for(int k = 0; k < 9; k++) {
					if(j == k) {
						continue;
					}
					if(tmp == number[k][i]) {
						wrong[k][i] = true;
					}
					
				}
			}
		}
	}
 
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;cin >> n >> m;
	if(n==1 && m==1) cout << 1 << endl;
	else if(n==1 || m==1){
		cout << max(max(n,m)-2,(ll)0) << endl;
	}
	else{
		cout << (n-2)*(m-2) << endl;
	}
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

h,w=map(int,input().split())
a=[input() for i in range(h)]

cnt=0

itta=[[10**9]*w for i in range(h)]

d=deque()
# aaa=d.append
for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            d.append((i,j))
            itta[i][j]=0

# print(d)
# print(itta)

while d:
    cnt+=1
    for l in range(len(d)):
        nh,nw=d.popleft()
        for i in range(4):
            d1,d2=direction[i]
            if 0<=nh+d1<h and 0<=nw+d2<w:
                if itta[nh+d1][nw+d2]==10**9:
                    itta[nh+d1][nw+d2]=cnt
                    d.append((nh+d1,nw+d2))
    # print(d)

# print(itta)
print(cnt-1)

Measured memory_bytes: 87004
N, K = map(int, input().split())
s1 = []
for i in range(1, N+1):
  s1.append(i)
s2 = set(s1)
  
d = []
A = []
for i in range(K):
  d.append(int(input()))
  A.append(list(map(int, input().split())))

for i in range(len(A)):
  for j in range(len(A[i])):
    if A[i][j] in s2:
      s2.remove(A[i][j])

print(len(s2))

Measured memory_bytes: 9204
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  int ans = 0, x = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'I')
      x++;
    else if (s[i] == 'D')
      x--;
    ans = max(ans, x);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#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 rep(i,n) for(int i=0;i<n;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
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;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int n;
    cin >> n;
    int k;
    cin >> k;
    int sum=0;
    rep(i,n){
        int x;
        cin >> x;
        if(x>=k)sum++;
    }
    cout << sum;
    


}

/*



 */



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

string s, t;

int main(void){
    cin >> s >> t;
    int res = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != t[i]) res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3888
from bisect import bisect_right

n=int(input())
listl = [int(i) for i in input().split()]

listl.sort()
#print(listl)

ans = 0

for i in range(n-1,1,-1):
    c = listl[i]
    for j in range(i-1,0,-1):
        b = listl[j]
        a = bisect_right(listl,c-b)
        #print(a)
        num = j-a
        #print("num",num)
        if num>0:
            ans+=num
        

print(ans)

Measured memory_bytes: 45244
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ash[100001];
ll ans=0;
ll f(ll a[],ll start,ll size)
{
   if(start==size-1)
   return 0;
   if(ash[start]!=-1)
   return ash[start];
   ll cost=f(a,start+1,size)+abs(a[start]-a[start+1]);
   if(start+2<size)
   cost=min(cost,(f(a,start+2,size)+abs(a[start]-a[start+2])));
     return ash[start]=cost;
}
int main()
{
    memset(ash,-1,sizeof(ash));
  ll n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  ll start=0,ans1;
  ans1=f(a,start,n);
  cout<<ans1;
  
}
  

Measured memory_bytes: 11364
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#include <set>
#include <queue>
using namespace std;
#define mem(a,n) memset(a,n,sizeof(a))
#define pb(x) push_back(x)
typedef long long LL;
typedef unsigned long long ull;
const int mod=1e9+7;
const double eps=1e-6;
const int INF=0x3f3f3f3f;
const int N=1e5+5;
int cnt[N],vis[N],a[N];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int a,b,ans=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&a,&b);
            ans+=(b-a+1);
        }
        printf("%d\n",ans);
    }
    return 0;
}

/*
9
1 2 4 9 5 8 7 3 6
5
1 4 3 5 2
8
1 2 4 3 5 6 8 7
*/


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

template <class T>
class operators
{
public:
    const T operator+(const T& right) const{
        T ans = static_cast<const T&>( *this );
        ans += right;
        return ans;
    }
    const T operator-(const T& right) const{
        T ans = static_cast<const T&>( *this );
        ans -= right;
        return ans;
    }
    const T operator*(const T& right) const{
        T ans = static_cast<const T&>( *this );
        ans *= right;
        return ans;
    }
    const T operator/(const T& right) const{
        T ans = static_cast<const T&>( *this );
        ans /= right;
        return ans;
    }
    bool operator!=(const T& right) const{
        const T& left = static_cast<const T&>( *this );
        return !(left == right);
    }
};

class Mod : public operators<Mod>
{
private:
    static const int MOD = 1000000007;
    long long a;
public:
    Mod(){
        a = 0;
    }
    Mod(long long x){
        a = (x % MOD + MOD) % MOD;
    }
    Mod& operator+=(const Mod& x){
        a = (a + x.a) % MOD;
        return *this;
    }
    Mod& operator-=(const Mod& x){
        a = (a - x.a + MOD) % MOD;
        return *this;
    }
    Mod& operator*=(const Mod& x){
        a = (a * x.a) % MOD;
        return *this;
    }
    Mod& operator/=(const Mod& x){ // フェルマーの小定理、MODが素数である場合のみ有効
        int b = MOD - 2;
        long long c = x.a;
        long long ans = 1;
        while(b > 0){
            if(b & 1){
                ans *= c;
                ans %= MOD;
            }
            c *= c;
            c %= MOD;
            b >>= 1;
        }
        a *= ans;
        return *this;
    }
    bool operator==(const Mod& x) const{
        return a == x.a;
    }
    long long getValue(){
        return a;
    }
};

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

    vector<Mod> dp(2*n+2, 0);
    dp[0] = 1;
    dp[1] = -1;
    Mod ans = 0;
    for(int i=0; i<n; ++i){
        Mod x = dp[i];
        if(i < n - 1){
            Mod tmp = (n - 1LL) * (n - 1LL);
            ans += x * tmp;
        }
        dp[i+1] += x;
        dp[i+2] -= x;
        dp[i+3] += x;
        dp[i+n+2] -= x;

        dp[i+1] += dp[i];
    }

    for(int i=n; i<=2*n; ++i){
        ans += dp[i];
        dp[i+1] += dp[i];
    }
    cout << ans.getValue() << endl;

    return 0;
}


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

int main() {
	int x;
	cin >> x;
	if (x < 30) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 3640
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = LS()
    n.sort()
    if n == ["1", "4", "7", "9"]:
        print("YES")
    else:
        print("NO")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
#define INF 1e18
using namespace std;

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

vector<int> G[100];
int visited[100];

bool dfs(int v)
{
    visited[v]=1;
    for(auto u:G[v]){
        if(!visited[u] and dfs(u) or visited[u]==1)
            return true;
    }
    visited[v]=2; 
    return false;
}

signed main()
{
    int V,E; cin>>V>>E;
    REP(i,E){
        int a,b; cin>>a>>b;
        G[a].push_back(b);
    }
    
    REP(i,V){
        if(!visited[i] and dfs(i)){
            cout<<1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
 
}



Measured memory_bytes: 3180
#include <iostream>
#include <cstdlib>

int compar(const void *a, const void *b)
{
    if (*(long *)a == *(long *)b) return 0;
    return (*(long *)a - *(long *)b > 0) ? 1 : -1;
}

int main()
{
    const long a = 1000000000+7;
    int N, X;
    std::cin >> N >> X;
    long S[N];
    for(int i=0; i<N; i++)
        std::cin >> S[i];
    qsort(S, N, sizeof(long), compar);

    //sum(X;S1,..,SN) = sum(X%SN;S1,..SN-1) + (N-1)sum(X;S1,..,SN-1)
    long sum[X+1][N-1];
    for(int i=0; i<=X; i++){
        sum[i][0] = i % S[0];
        for(int j=1; j<N; j++){
            sum[i][j] = ( sum[i%S[j]][j-1] + j*sum[i][j-1] ) % a;
        }
    }

    std::cout << sum[X][N-1] << std::endl;
    return 0;
}


Measured memory_bytes: 155772
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> V(N);
    rep(i,0,N)cin >> V[i];
    sort(V.begin(), V.end());
    ll maxi = 0,sum = 0;
    if(N % 2){
        rep(i,0,N){
            if(i < N / 2)         sum -= V[i] * 2;
            else if(i < N / 2 + 2)sum += V[i];
            else                  sum += V[i] * 2;
        }
        maxi = max(maxi, sum);
        sum = 0;
        rep(i,0,N){
            if(i < N / 2 - 1)     sum -= V[i] * 2;
            else if(i < N / 2 + 1)sum -= V[i];
            else                  sum += V[i] * 2;
        }
        maxi = max(maxi, sum);
    }else{
        rep(i,0,N){
            if(i < N / 2 - 1)     sum -= V[i] * 2;
            else if(i < N / 2)    sum -= V[i];
            else if(i < N / 2 + 1)sum += V[i];
            else                  sum += V[i] * 2;
        }
        maxi = max(maxi, sum);
    }
    cout << maxi << endl;
}

Measured memory_bytes: 640
#![allow(unused)]

use proconio::{input, fastout};
use proconio::marker::{Chars, Usize1};

macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input! {
        x: usize,
        n: usize,
        ps: [usize; n],
    }

    let mut appeared = vec![false; 102];
    for p in ps {
        appeared[p] = true;
    }

    for i in 0..=100 {
        if x >= i && !appeared[x - i] {
            println!("{}", x - i);
            break;
        }
        if x + i <= 101 && !appeared[x + i] {
            println!("{}", x + i);
            break;
        }
    }
}



Measured memory_bytes: 2144
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int main(){
	int a;scanf("%d",&a);
	if(a<1200)printf("ABC\n");else printf("ARC\n");
}

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

int main(){
    string S, T;
    cin >> S >> T;
    string ans = "Yes";
    for(int i = 0; i < S.size(); i++){
        if(S[i] != T[i]){
            ans = "No";
            break;
        }
    }

    if(S.size() + 1 != T.size()){
        ans = "No";
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
S = str(input())
ans = 0
for i in range(len(S)):
    for j in range(i+1, len(S)+1):
        tmp = S[i:j]
        flag = True
        for char in tmp:
            if char in set(['A', 'G', 'C', 'T']):
                continue
            else:
                flag = False
                break
        if flag:
            ans = max(ans, len(tmp))
print(ans)

Measured memory_bytes: 3060
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)


using namespace std;


template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}

ll dx8[8]={1,0,-1,0,1,-1,1,-1};
ll dy8[8]={0,1,0,-1,1,-1,-1,1};
ll dx4[4]={0,0,1,-1};
ll dy4[4]={1,-1,0,0};


int main(){
    IOS;
    make2(ll,n,m);
    makevec(double,a,n);
    set <array <double,2> , greater <array <double,2> > > s;
    fr(i,n) s.insert({a[i],i});
    ll c=n;
    fr(i,m){
        double a=(*s.begin())[0];
        s.erase(s.begin());
        a/=2;
        s.insert({a,c++});
    }
    ll ans=0;
    for(auto x : s) ans+=(x[0]);
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 10384
package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	black, white := 0, 0
	for _, r := range s {
		if string(r) == "." {
			white = white + 1
		}
	}
	total := black + white
	for _, r := range s {
		if string(r) == "." {
			white = white - 1
		} else {
			black = black + 1
		}
		if total > black+white {
			total = black + white
		}
	}
	fmt.Println(total)
}

Measured memory_bytes: 1920
#include<iostream>
#include<string.h>

using namespace std;

int N;
int balls[10];
bool dfs(int n, int a, int b){
if(n==10)return true;
if(balls[n]>a) return dfs(n+1,balls[n],b);
if(balls[n]>b) return dfs(n+1,a,balls[n]);
return false;
}
int main(){
cin>>N;
for(int i=0;i<N;i++){
for(int j=0;j<10;j++){
cin>>balls[j];
}
if(dfs(0,0,0))cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}

Measured memory_bytes: 1152
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int num_dice = scanner.nextInt();
		int array_dice[][] = new int[num_dice][6];
		int dice[] = new int[6];
		int pip[] = new int[6];
		int count = 1;
		int order = num_dice;
		boolean bdice_front = false;
		int dice_front = 0;
		boolean bdice_up = false;
		int dice_up = 0;
		boolean judge = false;
		
		//サイコロの目の入力
		for( int i = 0; i < num_dice; i ++ ){
			dice =  make_dice(scanner);
			array_dice[i] = dice;
		}
		
		pip = array_dice[0];
		
		//命令数実行
		do {
			dice_up = array_dice[count][0];
			dice_front = array_dice[count][1];
			bdice_front = false;
			bdice_up = false;
			
			for( int i = 0; i < 4; i ++ ){
				for( int j = 0; j < 2; j ++ ){
					if(!bdice_front) {
						for( int k = 0; k < 4; k ++ ){
							if( !bdice_front ) {
								pip = diceroll_s(pip);
								if( pip[1] == dice_front ){
									bdice_front = true;
								}
							}
						}
						pip = diceroll_e(pip);
					}
				}
				if( pip[0] == dice_up ){
					bdice_up = true;
					break;
				}
				pip = diceroll_e(pip);
				
			}
			
			if( array_dice[count][2] == pip[2] ){
				if( array_dice[count][3] == pip[3] ){
					if( array_dice[count][4] == pip[4] ){
						if( array_dice[count][5] == pip[5] ){
							judge = true;
						}
					}
				}
			}else{
				judge = false;
			}
			
			count ++;
			if( count >= order){
				break;
			}
		}while( !judge );
		
		//出力
		if( judge ){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
		
		scanner.close();
	}
	
	public static int[] make_dice ( Scanner scanner){
		int dice[] = new int[6];
		
		for(int i = 0; i < 6; i ++){
			dice[i] = scanner.nextInt();
		}
		
		return dice;
	}

	public static int[] diceroll_n(int[] pip){
		int dice[] = new int[6];
		for(int i = 0; i < 6; i ++){
			dice[i] = pip[i];
		}
		pip[0] = dice[1];
		pip[1] = dice[5];
		pip[2] = dice[2];
		pip[3] = dice[3];
		pip[4] = dice[0];
		pip[5] = dice[4];
		
		return pip;
	}

	public static int[] diceroll_e (int[] pip){
		int dice[] = new int[6];
		for(int i = 0; i < 6; i ++){
			dice[i] = pip[i];
		}
		pip[0] = dice[3];
		pip[1] = dice[1];
		pip[2] = dice[0];
		pip[3] = dice[5];
		pip[4] = dice[4];
		pip[5] = dice[2];
		
		return pip;
	}

	public static int[] diceroll_w (int[] pip){
		int dice[] = new int[6];
		for(int i = 0; i < 6; i ++){
			dice[i] = pip[i];
		}
		pip[0] = dice[2];
		pip[1] = dice[1];
		pip[2] = dice[5];
		pip[3] = dice[0];
		pip[4] = dice[4];
		pip[5] = dice[3];
		
		return pip;
	}

	public static int[] diceroll_s (int[] pip){
		int dice[] = new int[6];
		for(int i = 0; i < 6; i ++){
			dice[i] = pip[i];
		}
		pip[0] = dice[4];
		pip[1] = dice[0];
		pip[2] = dice[2];
		pip[3] = dice[3];
		pip[4] = dice[5];
		pip[5] = dice[1];
		
		return pip;
	}
	
}



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

struct Puzzle{
    int f[9];
    int space;
    string path;

    bool operator<(const Puzzle &p)const{
        for(int i=0;i<9;i++){
            if(f[i]==p.f[i]) continue;
            return f[i]<p.f[i];
        }
        return false;
    }
};

bool isTarget(Puzzle &p){
    for(int i=0;i<9;i++){
        if(p.f[i]!=i+1) return false;
    }
    return true;
}

static const int dx[4]={-1,0,1,0};
static const int dy[4]={0,-1,0,1};
static const char dir[4]={'u','l','d','r'};

string bfs(Puzzle &s){
    queue<Puzzle> Q;
    map<Puzzle,bool> V;
    Puzzle u,v;
    s.path="";
    Q.push(s);
    V[s]=true;
    while(!Q.empty()){
        u=Q.front();
        Q.pop();
        if(isTarget(u)) return u.path;
        int sx=u.space/3;
        int sy=u.space%3;
        for(int r=0;r<4;r++){
            int tx=sx+dx[r];
            int ty=sy+dy[r];
            if(tx<0||ty<0||tx>2||ty>2){
                continue;
            }
            v=u;
            swap(v.f[u.space],v.f[tx*3+ty]);
            v.space=tx*3+ty;
            if(!V[v]){
                V[v]=true;
                v.path+=dir[r];
                Q.push(v);
            }
        }
    }
    return "unsolvable";
}

int main(){
    Puzzle x;
    for(int i=0;i<9;i++){
        cin>>x.f[i];
        if(x.f[i]==0){
            x.f[i]=9;
            x.space=i;
        }
    }

    cout<<(bfs(x)).size()<<endl;
}


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

using namespace std;

typedef long long int ll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

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

    string y = s.substr(0, 4);
    string m = s.substr(5, 2);
    string d = s.substr(8, 2);

    if(y>"2019")
    {
        cout << "TBD" << endl;
    }

    else if(m>"04")
    {
        cout << "TBD" << endl;
    }

    else if(d>"30")
    {
        cout << "TBD" << endl;
    }

    else
    {
        cout << "Heisei" << endl;
    }

    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int m = sc.NextInt();
        int[] h = sc.IntArray();

        bool[] ok = new bool[n];
        for (int i = 0; i < n; i++)
        {
            ok[i] = true;
        }

        for (int i = 0; i < m; i++)
        {
            int a = sc.NextInt();
            int b = sc.NextInt();
            if (h[a - 1] <= h[b - 1])
            {
                ok[a - 1] = false;
            }
            if (h[b - 1] <= h[a - 1])
            {
                ok[b - 1] = false;
            }
        }

        int answer = ok.Where(i => i == true).Count();

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 51724
#include <vector>
#include <iostream>
using namespace std;
int n, a, b; vector<vector<int> > g;
int solve(int pos, int pre) {
	int ret = 0;
	for (int i : g[pos]) {
		if(i != pre) ret ^= solve(i, pos);
	}
	return ret + 1;
}
int main() {
	cin >> n; g.resize(n);
	for (int i = 0; i < n - 1; i++) {
		cin >> a >> b; a--, b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	cout << (solve(0, -1) - 1 ? "Alice" : "Bob") << endl;
	return 0;
}

Measured memory_bytes: 10368
/*******************************
 * written by Koki Riho
 * Rih0z https://github.com/Rih0z
 *******************************/

#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>
#include<cmath>
#define DEBUG false

#define FOR(i , a, b) for(size_t i = a ; i < b ; i++ )
#define REP(i,b) FOR(i , 0 , b)
#define RFOR(i,a,b) for(size_t i = a-1 ; i >= b ; i--)
#define RREP(i,a) RFOR(i,a,0)



typedef long long ll;
using namespace std;

int scanInt(void);
string scanString(void);

void scanLlArr(ll *a , int n);
void scanCharArr(char *string);

void printInt(int p);
void printLlArr(ll *a);
void printCharArr(char *string);


void perSum(ll *a , ll *sum ,int n);

/*************Global variable  **************/
int N ;
char str[26];
std::map<char,int> M ;
/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  cin >> N ;
  if(N == 1){
    cout << 1 << endl;
    return 0 ;
  }
  int p ;
  int ans ;
  for(int i = 2 ; i <= N ; i++){
    if((int)(std::pow(i,2)) > N){
      p = i-1 ;
      ans = pow(p,2);
      break;
    }
  }

  for(int i = 2 ; i < p ; i++){
    for(int j = 3 ; j <= 10 ; j++)
    {
      if(pow(i,j) <= N)
      {
        ans = max((int)(pow(i,j)),ans);
      }
    }

  }
  cout << ans << endl;
  if (DEBUG){
    std::printf("******debug********\n");

    std::printf("******debug********\n");
  }
  return 0 ;
}

//各地点までの部分和を計算する
void perSum(ll *a , ll *sum ,int n){
  int i ;
  sum[0] = a[0];
  for(i = 1 ; i < n ; i++){
    sum[i] = a[i] + sum[i-1];
  }

}


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

int main(){
  int x,y;
  string a,q;
  q="qwertasdfgzxcvb";
  while(cin>>a){
    int ans=0;
    if(a=="#"){
      break;
    }
    if(q.find(a[0])!=string::npos){
      x=0;
    }else{
      x=1;
    }
    for(int i=1;i<a.size();i++){
      if(q.find(a[i])!=string::npos){
	y=0;
      }else{
	y=1;
      }
      if(x!=y){
	ans++;
      }
      x=y;
    }
    cout<<ans<<endl;
  }
    return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    int d = N / 1000;
    if (N % 1000 != 0) ++d;

    cout << d * 1000 - N << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(void){
  int a, b, d, r;
  double f;

  scanf("%d %d\n", &a, &b);
  
  d = a / b;
  r = a % b;
  f = (double) a / b;

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

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

#define int long long

using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007,INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

string s,t;
int a[100],b[100];

signed main(){
    cin>>s>>t;
    rep(i,0,s.size()){
        a[s[i]-'a']++;
        b[t[i]-'a']++;
    }
    sort(a,a+26);
    sort(b,b+26);
    int can=true;
    rep(i,0,26){
        if(a[i]!=b[i])can=false;
    }
    can?puts("Yes"):puts("No");
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

using namespace std;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int main() {
    
    int x;
    cin >> x;
    cout << 1000 * (x / 500) + 5 * ((x % 500) / 5) << endl;
    
    return 0;
}


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

int main(void){
    int N;
    ll num, sum, ans, MOD;
    vector<ll> A;
    sum = 0;
    ans = 0;
    MOD = 1e9+7;
    
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> num;
        sum += num;
        sum %= MOD;
        A.push_back(num);
    }
    
    for (int i = 0; i < N - 1; i++){
        sum -= A[i];
        if(sum < 0) sum += MOD;
        ans += A[i] * sum;
        ans %= MOD;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 5324