akhauriyash/Code-Regression huggingface dataset:
// Standard Stuff
#include <bits/stdc++.h>
using namespace std;

// Macros
#define F  first
#define S  second
#define PB push_back

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// HELPERS
//  Tedious Grid Movements
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
inline bool move_okay(int x, int y, int n, int m) { return 0 <= x and x < n and 0 <= y and y < m; }
//  Remember:
//   * vec.assign() GOOD; vec.resize() BAD
//   * comparator uses <

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const set<T> &v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T,S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T,S> &v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef SANYAM1101
	#define trace(args...) do{ cerr << "TRACE ON! (Line: " << __LINE__ << ")\n"; auto _stream = istringstream{string{#args}}; d_f(_stream, args); } while(0)
	void d_f(__attribute__((unused)) istringstream& _stream) {}
	template<typename Head, typename... Tails> void d_f(istringstream& _stream, Head H, Tails... T) { string _name; _stream >> _name; if(_name.back() == ',') _name.pop_back(); cerr << "\t" << _name << " <=> [" << H << "]\n"; d_f(_stream, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

void solve(){
	int n, m; ll k;
	cin >> n >> m >> k;

	vector<ll> a(1, 0), b(1, 0);
	for(int i = 0; i < n; ++i){
		int x; cin >> x;
		a.push_back(x + a.back());
	}
	for(int i = 0; i < m; ++i){
		int x; cin >> x;
		b.push_back(x + b.back());
	}

	int ans = 0;

	for(int i = 0; i <= n and a[i] <= k; ++i)
		ans = max(ans, i + (int)(upper_bound(b.begin(), b.end(), k - a[i]) - b.begin()) - 1);

	cout << ans << "\n";
}

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

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


Measured memory_bytes: 7892
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,i;
  double o,ans=0;
  string s;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> o >> s;
    if (s=="BTC") o*=380000;
    ans+=o;
  }
  cout << ans << endl;
  return 0;
}

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

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

    bool found = false;
    for (int i=0; i<A*B; i++) {
        if (i % A != 0)
            continue;
        if (i % B != C)
            continue;
        
        found = true;
        break;
    }

    cout << (found ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

const int MAX_N = 50, MAX_S = 2500;
int N, A, x[MAX_N];
ll dp[MAX_N + 1][MAX_N + 1][MAX_S + 1];

// main
int main() {
    cin >> N >> A;
    REP(i, N) {
        cin >> x[i];
    }

    dp[0][0][0] = 1;
    REP(i, N) {
        REP(j, N) {
            REP(k, MAX_S) {
                if (dp[i][j][k] > 0) {
                    dp[i + 1][j][k] += dp[i][j][k];
                    dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
                }
            }
        }
    }
    ll res = 0;
    FOR(i, 1, N + 1, 1) {
        res += dp[N][i][i * A];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 48128
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define SZ(x) ((int)(x).size())
#define TC(tc) while (tc--)
#define VI vector<int>
#define PII pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;

int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n; cin >> n;
	int md = n % 1000;
	cout << (1000 - md) % 1000;


	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
#define WHITE 0
#define BLACK 1
typedef long long ll;
typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
string s;
int k;
int INFi=1000000000;
ll INFl=1000000000000000;

struct UnionFind{
    vector<int> par;//初期化
    vector<int> rank;//高さ
    UnionFind(int n=0):par(n),rank(n,0){
        for(int i=0;i<n;i++) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);//経路圧縮
    }
    void unite(int x,int y){
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return;
        if(rank[rx]<rank[ry]) rank[rx]=ry;
        else rank[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};
struct edge{int from,to,cost;};
vector<edge> es(100); //辺の集合
vector<int> d(100,INFi);//最短距離
int V,E;//頂点数、辺数

int main(){
    int n;cin>>n;
    int ans=1;
    while(ans<=n){
        ans*=2;
    }
    cout<<ans/2<<endl;
}





Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 1001

void count(char *A, char *B){
  int i, j, tmp[N][N];

  for(i=0; i<N; i++){
    for(j=0; j<N; j++){
      tmp[i][j]=0;
    }
  }
  for(i=0; i<strlen(A); i++){
    for(j=0; j<strlen(B); j++){
      if(A[i]==B[j])tmp[i+1][j+1]=tmp[i][j]+1;
      else if(tmp[i][j+1] > tmp[i+1][j])tmp[i+1][j+1]=tmp[i][j+1];
      else tmp[i+1][j+1]=tmp[i+1][j];
    }
  }
  printf("%d\n", tmp[strlen(A)][strlen(B)]);
}

void aaaaa(int a){
  int i, count=0;
  for(i=0; i<a; i++){
    count++;
  }
}

int main(){
  int n, i, j, a=10;
  char A[N],B[N];
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%s", A);
    scanf("%s", B);
    count(A, B);
  }
  aaaaa(a);
  return 0;
}



Measured memory_bytes: 5720
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

struct Info{
	Info(int arg_start,int arg_end,int arg_value){
		start = arg_start;
		end = arg_end;
		value = arg_value;
	}
	bool operator<(const struct Info &arg) const{
		return end < arg.end;
		//return start < arg.start;
	};
	int start,end,value;
};

int main(){

	int N,dp[367][367],tmp_start,tmp_end,tmp_value;
	bool FLG;

	vector<Info> V;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		V.clear();

		for(int i = 0; i <= 366; i++){
			for(int k = 0; k <= 366; k++)dp[i][k] = 0;
		}

		dp[366][366] = 0;

		for(int i = 0; i < N; i++){
			scanf("%d %d %d",&tmp_start,&tmp_end,&tmp_value);
			V.push_back(Info(tmp_start,tmp_end,tmp_value));
		}

		sort(V.begin(),V.end());

		for(int i = 0; i < V.size();i++){

			for(int row = 1; row <= V[i].end+1; row++){
				dp[row][V[i].end+1] = max(dp[row][V[i].end+1],dp[row][V[i].start]+V[i].value);
			}

			for(int col = 1; col <= V[i].end;col++){
				dp[V[i].end+1][col] = max(dp[V[i].end+1][col],dp[V[i].start][col]+V[i].value);
			}

			for(int row = 1; row <= 366; row++){
				for(int col = V[i].end+2; col <= 366; col++){
					if(dp[row][col] < dp[row][col-1]){
						dp[row][col] = dp[row][col-1];
					}else{
						break;
					}
				}
			}

			for(int col = 1; col <= 366;col++){
				for(int row = V[i].end+2; row <= 366; row++){
					if(dp[row][col] < dp[row-1][col]){
						dp[row][col] = dp[row-1][col];
					}else{
						break;
					}
				}
			}
		}

		printf("%d\n",dp[366][366]);
	}

	return 0;
}

Measured memory_bytes: 3132
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K, Q;
    cin >> N >> K >> Q;
    int A[2010];
    int ans = INF2;
    rep(i, N) cin >> A[i];
    rep(i, N) {
        vector<int> all;
        rep(j, N) {
            vector<int> v;
            while (j < N && A[j] >= A[i]) v.push_back(A[j++]);
            if (v.size() < K) continue;
            sort(v.begin(), v.end());
            rep(k, v.size() - K + 1) {
                all.push_back(v[k]);
            }
        }
        sort(all.begin(), all.end());
        if (all.size() >= Q) {
            ans = min(ans, all[Q - 1] - all[0]);
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 384
import bisect
n=int(input())
L=sorted(list(map(int,input().split())))

ans=0
for i in range(n-1):
   for j in range(i+1,n):
      idx=bisect.bisect_left(L,L[i]+L[j])
      ans+=max(0,idx-j-1)
print(ans)
      

Measured memory_bytes: 45212
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;
//ここから

void solve(){
  int n;
  ll a,b;
  cin>>n>>a>>b;
  vector<ll>x(n);
  rep(i,n)cin>>x[i];
  ll ans=0;
  rep(i,n-1){
    ll sub=x[i+1]-x[i];
    if(sub>=(b+a-1)/a)ans+=b;
    else ans+=sub*a;
  }
  cout<<ans;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N;
  cin >> N;
  long foo = 1 + N;
  for (long i = 1; i * i <= N; i++) {
    if (N % i == 0) foo = min(foo, i + N / i);
  }
  cout << foo - 2 << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(j,n) for(int i=(int)(j);i<(int)(n);i++)
int main(){
  int N;
  cin>>N;
  vector<int> A(N+1),B(N);
  rep(0,N+1) cin>>A[i];
  long long ans=0;
  rep(0,N){ cin>>B[i];
           if(A[i]>=B[i]){ 
             ans+=B[i];
             B[i]=0;
           }
           else{ 
             ans+=A[i];
             B[i]-=A[i];
           }
           if(A[i+1]>=B[i]){
             ans+=B[i];
             A[i+1]-=B[i];
           }
           else{
             ans+=A[i+1];
             A[i+1]=0;
           }
          }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
function main(input) {
    const args = input.split('\n');
    const N = parseInt(args[0], 10);
    const nums = args.slice(1, N + 1);
    const isValid = nums.every((n) => {
        var ns = n.split(' ');
        var t = parseInt(ns[0], 10),
            x = parseInt(ns[1], 10),
            y = parseInt(ns[2], 10);
        var sum = x + y;

        return (t >= sum) && ((t % 2) === (sum % 2));
    });

    if (isValid) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29932
from queue import deque

n, m = map(int, input().split())
G = deque([[] for i in range(n)]) #??°??????
for i in range(m):
    s, t = map(int, input().split())
    # ???????????£?????????????????????1????????\??????0
    G[s].append(t)
    G[t].append(s)


def dfs(r, c):
    S = deque()
    S.append(r)
    color[r] = c
    while (len(S) > 0):
        u = S.popleft()
        for j in G[u]:
            if color[j] == -1:
                # ???????????£???????????????????????¢?´¢????????????(???????????¢?´¢?????????????????????)
                color[j] = c
                S.append(j) # ?????????????????????????????¢???

def assginColor():
    i_d = 1
    for u in range(n):
        if color[u] == -1: #?????¢?´¢
            dfs(u, i_d)
            i_d += 1

color = [-1] * n
assginColor()
q = int(input())
s_t = [list(map(int, input().split())) for i in range(q)]
for s, t in s_t:
    if color[s] == color[t]:
        print("yes")
    else:
        print("no")

Measured memory_bytes: 30280
#include <cstdio>
#define rep(i,n) for(int(i)=0;(i)<(n);(i)++)
int c[10][10];
int H,W,A,res;
int main()
{
scanf("%d%d",&H,&W);
rep(i,10) rep(j,10) scanf("%d",&c[i][j]);
rep(k,10) rep(i,10) rep(j,10)
if(c[i][j]>c[i][k]+c[k][j]) c[i][j]=c[i][k]+c[k][j];
rep(i,H)rep(j,W)
{
scanf("%d",&A);
if(A>=0)res+=c[A][1];
}
printf("%d\n",res);
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=2e5+5;
int a[mxn];
ll dp[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	for(int i=1; i<=n; i++){
		cin >> a[i];
		a[i]-=i;
	}
	sort(a+1,a+n+1);
	int b;
	if(n%2)b=a[n/2+1];
	else b=(a[n/2]+a[n/2+1])/2;
	ll ans = 0LL;
	for(int i=1; i<=n; i++){
		ans += abs(a[i]-b);
	}
	cout << ans << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


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

int main(){
  int a,b,c,d;
  cin >>a>>b>>c>>d;
  if (a+b<c+d){
    cout << "Right" << endl;
  }
  else if (a+b==c+d){
    cout << "Balanced" << endl;
  }
  else {
    cout << "Left" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] d = new int[N];

		for(int i = 0; i < N; i++) {
			String line = sc.next();
			d[i] = Integer.parseInt(line);
		}

		int K = 0;
		int count = 0;
		int countLeft = 0;
		int countRight = N;
		Arrays.sort(d);

		for(int i = 0; i < N; i++) {
			countLeft++;
			countRight--;
			if(countLeft == countRight) {
				K = d[i];
				while(d[i] <= K && K < d[i+1]) {
					K++;
					count++;
				}
				break;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 60476
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int lim = 4e5+5;
int evsize = 0;
vector<int> events[lim];

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

	int n,q;
	cin>>n>>q;
	for(int i=0;i<n;i++)
	{
		int s,t,x;
		cin>>s>>t>>x;
		s -= x;
		t -= x;
		vector<int> add = {s,+1,x};
		vector<int> del = {t,-1,x};
		events[evsize++] = add;
		events[evsize++] = del;
	}
	sort(events,events+evsize);

	set<int> minx;
	int eid = 0;
	for(int i=0;i<q;i++)
	{
		int d;
		cin>>d;
		while(eid<evsize && events[eid][0]<=d)
		{
			if(events[eid][1]==+1)
				minx.insert(events[eid][2]);
			if(events[eid][1]==-1)
				minx.erase(events[eid][2]);
			eid++;
		}

		if(minx.empty())
			cout<<-1<<'\n';
		else
			cout<<*minx.begin()<<'\n';
	}

	return 0;
}

Measured memory_bytes: 32512
/*

    author : s@if

*/

#include<bits/stdc++.h>
using namespace std;
#define NIL -1
#define fi first
#define sec second
#define MAX INT_MAX
#define INF 99999999
#define ll long long
#define PI acos(-1.0)
#define MOD 1000000007
#define PLL pair<ll,ll>
#define PII pair<int,int>
#define triplell pair<pair<ll,ll> , ll>
#define triple pair<pair<int,int> , int>
#define For(i,n) for(int i=0;i<(int)n;i++)
#define Forn(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define forba(i,a,b) for(int i=(int)b;i>=(int)a;i--)

int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};

const int MAXN = (int)1e5+9;

const int N = 100000;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */
    
    int i,j,k,l,m,n,p,q,r,tc,t;
    
    char c;
    
    cin>>c;
    
    if(c=='A')
    	cout<<"T\n";
    else if(c=='T')
    	cout<<"A\n";
    else if(c=='C')
    	cout<<"G\n";
    else
    	cout<<"C\n";

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll H, W;
  cin >> H >> W;
  vector<string> MAP(H);
  for (int i = 0; i < H; i++) {
    cin >> MAP[i];
  }
  vector<bool> deletable_row(H, true);
  vector<bool> deletable_col(W, true);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (MAP[i][j] == '#') {
        deletable_row[i] = false;
        deletable_col[j] = false;
      }
    }
  }
  for (int i = 0; i < H; i++) {
    if (deletable_row[i]) continue;
    for (int j = 0; j < W; j++) {
      if (deletable_col[j]) continue;
      cout << MAP[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>
 
using namespace std;
 
int main(){
  int a, b;

  cin >> a >> b;

  if(a>b) {
    for(int i = 0; i < a; i++) cout << b;
  }

  else{

    for(int i = 0; i < b; i++) cout << a;
  }

}

Measured memory_bytes: 256
/*************************************************************************
    > File Name: test.cpp
    > Author: Akira 
    > Mail: qaq.febr2.qaq@gmail.com 
 ************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
using namespace std;

#define MaxN 100001*3
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
int N;
LL A[MaxN];
int main()
{
    //std::ios::sync_with_stdio(false);
    scanf("%d", &N);
    for(int i=1;i<=3*N;i++) scanf("%lld", &A[i]);
    sort(A+1,A+1+3*N);
    LL ans = 0;
    for(int i=3*N-1;i>=N;i-=2) 
    {
        ans += A[i];
    }
    printf("%lld\n", ans);
  //  system("pause");
}


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

int main() {
  string S;
  cin >> S;
  int ans = 0;
  if(S == "RSR") {
    cout << ans+1 << endl;
    return 0;
  }
  for(int i =0;i < 3;i++) {
    if(S[i] == 'R') {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n, T, c, t, a=0, ans=1100;
    cin >> n >> T;
    for(int i=0; i<n; i++)
    {
        cin >> c >> t;
        if(T>=t)
        {
            ans=min(ans,c);
            a++;
        }
    }
    if(a==0)
        cout << "TLE\n";
    else
        cout << ans << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,T;
  cin >> A >> B >> T;
  int num = 0;  
 
  for (int time = A; time < T+0.5; time = time+ A) {
    num = num + B;
	}
 
  cout << num << endl;
}

Measured memory_bytes: 256
package main

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

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	X := nextLine()
	stack := make([]byte, 0, len(X))
	for i := 0; i < len(X); i++ {
		if len(stack) > 0 && stack[len(stack)-1] == 'S' && X[i] == 'T' {
			stack = stack[:len(stack)-1]
		} else {
			stack = append(stack, X[i])
		}
	}
	out(len(stack))
}


Measured memory_bytes: 2176
N,M = map(int,input().split())
ab = [[int(i) for i in input().split()] for _ in range(M)]

A = []
B = [0]*(N+1)
for a,b in ab:
  if a==1:
    A.append(b)
  if b==N:
    B[a]=1

for a in A:
  if B[a]==1:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Measured memory_bytes: 40856
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            var answer = "UNRESTORABLE";
            if (s.Length < t.Length)
            {
                Console.WriteLine(answer);
                return;
            }
            for (var i = s.Length - 1; i >= t.Length - 1; i--)
            {
                var tmp = s.ToCharArray();
                var ok = true;
                if (s[i] == t[t.Length - 1] || s[i] == '?')
                {
                    for (var j = 0; j < t.Length; j++)
                    {
                        if (s[i - j] != t[t.Length - 1 - j] && s[i - j] != '?')
                        {
                            ok = false;
                            break;
                        }
                    }
                }
                else
                {
                    ok = false;
                }

                if (ok)
                {
                    for (var j = 0; j < t.Length; j++)
                    {
                        tmp[i - j] = t[t.Length - 1 - j];
                    }
                    answer = new string(tmp);
                    answer = answer.Replace("?", "a");
                    break;
                }
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 25788
import sys

if __name__=="__main__":
    ab=[]
    cd=[]
    [n,m]=map(int,input().split(" "))
    for i in range(n):
        ab.append(list(map(int,input().split(" "))))
    for j in range(m):
        cd.append(list(map(int,input().split(" "))))
    for i in range(n):
        min=sys.maxsize
        index=0
        for j in range(m):
            distance = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
            if min > distance :
                min=distance 
                index=j
        print(index+1)

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

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
typedef pair<lli, int> pii;


int main()
{
    string s;
    cin >> s;
    if(s == "ABC") cout << "ARC\n";
    else cout << "ABC\n";

    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

using ll = long long;

int main(){
	ll a, b;

	cin >> a;
	cin >> b;
	
	if ((a + b) % 2 != 0) {
		cout << "IMPOSSIBLE" << endl;
	} else {
		cout << (a + b) / 2 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))

for i in range(1, n):
    print(" ".join(map(str, a)))
    v = a[i]
    j = i - 1
    while (j >= 0) & (a[j] > v):
        a[j+1] = a[j]
        j -= 1
    a[j+1] = v
print(" ".join(map(str, a)))



Measured memory_bytes: 5600
import static java.lang.Math.*;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            int sum = 0;
            for (int i = 1; i <= 6; i++) {
                sum += n / pow(5, i);
            }
            System.out.println(sum);
        }
    }
}


Measured memory_bytes: 25984
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	int now=0;
	rep(i,n){
		cin >> a[i];
		now=now^a[i];
	}
	rep(i,n){
		int ans=now^a[i];
		printf("%d ",ans);
	}
return 0;
}


Measured memory_bytes: 4044
def solve():
    H,W = map(int,input().split())
    field = [list(map(int,input().split())) for _ in range(H)]

    nh = 0
    nw = 0
    ans = []
    haveCoin = False
    while True:

        if field[nh][nw] % 2 != 0:
            if haveCoin:
                haveCoin = False
            else:
                haveCoin = True
        
        frm = [nh+1,nw+1]

        if nh % 2 == 0:
            nw += 1
            if nw == W:
                nh += 1
                nw = W-1
        else:
            nw -= 1
            if nw == -1:
                nh += 1
                nw = 0
        
        to = [nh+1,nw+1]

        if nh == H:
            break
            
        if haveCoin:
            ans.append(frm+to)
    
    print(len(ans))
    for elem in ans:
        print(*elem)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 74972
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

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

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


    return 0;
}

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

int main(void){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> sum(100020);
    vector<int> max(100100);
    rep(i,n) sum[a[i]]++;
    for(int i=0; i<100010; i++){
        max[i] = sum[i]+sum[i+1]+sum[i+2];
    }
    int ans = 0;
    for(int i=0; i<100010; i++){
        if(ans<max[i]) ans=max[i];
    }
    cout << ans << endl;
    return 0;
}


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

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

  int red = 0;
  for (char c : S) {
    if (c == 'R') {
      red++;
    }
  }
  if (red > (N / 2)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    n,k = map( int , input().split() )
    A = [ 0 for i in range( 10 ** 5 + 1 ) ]
    for i in range(n):
        a,b = map( int , input().split() )
        A[ a ] += b
    
    i = 0
    sum = 0
    while( sum < k ):
        i += 1
        sum += A[i]
    print(i)



main()

Measured memory_bytes: 11708
#include <stdio.h>

int main()
{
	int H, W;
	while(scanf("%d %d", &H, &W), (W || H))
	{
		for(int y = 0; y < H; ++y)
		{
			for(int x = 0; x < W; ++x)
			{
				putchar('#');
			}
			putchar('\n');
		}
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 2104
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    long K = scanner.nextLong();
    int N = 50;
    long[] k = new long[N];

    long l = K / N;
    int r = (int) (K % N);
    for (int i = 0; i < r; i++) k[i] = l + 1;
    for (int i = r; i < N; i++) k[i] = l;

    System.out.println(N);
    for (int i = 0; i < N; i++) {
      long a = (N + 1) * k[i] + N - K - 1;
      System.out.printf("%d ", a);
    }
    System.out.println();
  }
}


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

int main(){
  int n, k; cin >> n >> k;
  vector<int> H(n);
  int ans = 0;
  for(int i=0; i<n; i++){
    cin >> H[i];
  }
  for(int i=0; i<n; i++){
    if(H[i] >= k){ans += 1;}
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	string s; cin >> s;
	int ans = 700;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o')ans += 100;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3612
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var count = 0;
            for (var i = 2; i < n; i++)
            {
                if ((array[i] > array[i - 1] && array[i - 1] > array[i - 2])
                    || array[i - 2] > array[i - 1] && array[i - 1] > array[i])
                    count++;
            }
            Console.WriteLine(count);
        }
    }
}


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

#define N_MAX 100000
int csum=0;
//cost[i]:艦攻スプi~i+1までの移動距離
int cost[N_MAX+1]={0};

int main(){
  int i,N,after,before;
  cin >> N;
  before=0;
  for(i=0;i<N;i++){
    cin >> after;
    cost[i]=after-before;
    csum+=abs(cost[i]);
    before=after;
  }
  cost[i]=0-before;
  csum+=abs(cost[i]);
  
  for(i=0;i<N;i++){
    cout << csum-abs(cost[i])-abs(cost[i+1])
      +abs(cost[i]+cost[i+1]) << endl;
  }
  return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	int ans = 1e9;
	for(int i = -100; i <= 100; ++i) {
		int tmp = 0;
		for(int j = 0; j < n; ++j) {
			tmp += (a[j] - i) * (a[j] - i);
		}
		ans = min(ans, tmp);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
using System;

namespace Station_and_Bus
{
    class Program
    {
        static void Main(string[] args)
        {
            String S = Console.ReadLine();
            if (S[0] == S[1] && S[1] == S[2])
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

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

    if(a <= b){
        cout << a << endl;
    }else{
        cout << a-1 << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        int N = sc.nextInt();
        var x = new String[N];
        var u = new String[N];
        for (int i = 0; i < N; i++) {
            x[i] = sc.next();
            u[i] = sc.next();
        }

        decimal ans = 0;
        for (int i = 0; i < N; i++) {
            if (u[i] == "JPY") {
                ans += Convert.ToDecimal(x[i]);
            } else {
                ans += Convert.ToDecimal(x[i]) * 380000;
            }
        }
        WriteLine(ans.ToString("F5"));
    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
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 namespace std;
typedef pair<ll, ll> pint;


void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }



}

const int MOD = 1000000007;

void add(long long &a, long long b) {a+=b;if(a>=MOD)a-=MOD;}

int main(){
    int H, W, K;
    cin >> H >> W >> K;
    --K;
    vector<vector<ll>> dp(H+1, vector<long long>(W, 0));
    dp[0][0] = 1;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            for (int bit = 0; bit < 1 << (W-1); ++bit) {
                bool ok = true;
                for (int k = 0; k < W-2; ++k) {
                    if ((bit & (1 << k)) && (bit & (1 << (k+1)))) ok = false;
                }
                if (!ok) continue;
                int nj = j;
                if (bit & (1<<j)) nj = j+1;
                else if (j > 0 && (bit & (1<<(j-1)))) nj = j - 1;
                add(dp[i+1][nj], dp[i][j]);
            }
        }
    }
    cout << dp[H][K];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
#define eps 1e-6
#define MOD 1000000007
typedef long long ll;
using namespace std;

ll n, a, b, ans, inv[200010], prod[200010];

ll qpow(ll x, ll y){
	ll t = 1;
	while(y){
		if(y & 1) t = t * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return t;
}

ll solve(ll a, ll b){
	ll t = 1;
	for(ll i = a; i >= a - b + 1; i--)
		t = t * i % MOD;
	return t * inv[b] % MOD;
}

int main(){

	cin >> n >> a >> b;
	prod[0] = prod[1] = inv[1] = 1;
	for(ll i = 2; i <= 200000; i++)
		prod[i] = prod[i - 1] * i % MOD;
	for(ll i = 2; i <= 200000; i++)
		inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
	for(ll i = 2; i <= 200000; i++)
		inv[i] = inv[i - 1] * inv[i] % MOD;
		
	ans = qpow(2, n);
	ans = (ans - 1 + MOD) % MOD;
	ans = (ans - solve(n, a) + MOD) % MOD;
	ans = (ans - solve(n, b) + MOD) % MOD;
	printf("%lld\n", ans); 

	return 0;
}


Measured memory_bytes: 3328
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    int N, K; cin >> N >> K;

    vector<bool> judge(N, true);

    for (int i = 0; i < K; i++) {
        int d; cin >> d;
        for (int j = 0; j < d; j++) {
            int a; cin >> a; a--;
            judge[a] = false;
        }
    }

    int ans = accumulate(judge.begin(), judge.end(), 0);

    cout << ans << endl;
}   


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

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define de(c) cout << #c << " = " << c << endl
#define dd(c) cout << #c << " = " << c << " "
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}());
const ll mod=100000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 233333;
int T;
int n;
ll a[maxn];

int main(int argc, char const *argv[])
{
#ifdef indiewar
    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
//    cin >> T;
    T =1;
    while(T--)
    {
       cin >> n;
       for (int i = 0; i < n; i++) {
           cin >> a[i];
       }
       ll ans = 0;
       ll mx = a[0];
       for (int i = 0; i < n; i++) {
           if (a[i] < mx) {
               ans += mx - a[i];
           }
           else {
               mx = a[i];
           }
       }
       cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5160
#include <iostream>
#include <stdio.h>
#include <math.h>

//I は1, V は5, X は10, L は50, C は100, D は500, M は1000,

#define I 1
#define V 5
#define X 10
#define L 50
#define C 100
#define D 500
#define M 1000

using namespace std;

int main(){

	string str;
	while(cin>>str){
		int data[200];
		int sum = 0;
		
		//データの数値化
		for(int i=0;i<str.size();i++){
			switch(str[i]){
				case 'I':
					data[i]=I;
					break;
				case 'V':
					data[i]=V;
					break;
				case 'X':
					data[i]=X;
					break;
				case 'L':
					data[i]=L;
					break;
				case 'C':
					data[i]=C;
					break;
				case 'D':
					data[i]=D;
					break;
				case 'M':
					data[i]=M;
					break;
			}
		}

		for(int i=0;i<str.size();i++){
			if(i==str.size()-1){
				sum+=data[i];
			}
			else{
				if(data[i]<data[i+1]){
					sum+= (data[i+1]-data[i]);
					i++;
				}
				else{
					sum+=data[i];
				}
			}
		}

		cout<<sum<<endl;
	}

	return 0;

}

/*
IV
CCCCLXXXXVIIII
CDXCIX
*/

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

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

using namespace std;

const int INF=1<<29;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(3*n);
	rep(i,3*n) scanf("%d",&a[i]), a[i]--;

	int cnt=0;
	vector dp(n,vector(n,-INF));
	vector dp_max1(n,-INF); // dp_max1[x] = max_y dp[x][y]
	int dp_max2=-INF;       // dp_max2 = max_{x,y} dp[x][y]

	auto update=[&](int x,int y,int val){
		dp[x][y]=max(dp[x][y],val);
		dp[y][x]=max(dp[y][x],val);
		dp_max1[x]=max(dp_max1[x],dp[x][y]);
		dp_max1[y]=max(dp_max1[y],dp[y][x]);
		dp_max2=max(dp_max2,dp[x][y]);
	};

	update(a[0],a[1],0);
	for(int i=2;i<3*n-2;i+=3){
		int x=a[i],y=a[i+1],z=a[i+2];

		// 前回残した二つを残す
		if(x==y && x==z){
			cnt++;
			continue;
		}

		vector<tuple<int,int,int>> next;
		// x, y を残す
		next.emplace_back(x,y,max(dp_max2,dp[z][z]+1));
		// y, z を残す
		next.emplace_back(y,z,max(dp_max2,dp[x][x]+1));
		// z, x を残す
		next.emplace_back(z,x,max(dp_max2,dp[y][y]+1));
		rep(w,n){
			// 前回残した一つと x を残す
			next.emplace_back(w,x,dp_max1[w]);
			if(y==z) next.emplace_back(w,x,dp[w][y]+1);
			// 前回残した一つと y を残す
			next.emplace_back(w,y,dp_max1[w]);
			if(z==x) next.emplace_back(w,y,dp[w][z]+1);
			// 前回残した一つと z を残す
			next.emplace_back(w,z,dp_max1[w]);
			if(x==y) next.emplace_back(w,z,dp[w][x]+1);
		}

		for(auto [x,y,val]:next) update(x,y,val);
	}

	printf("%d\n",max(dp_max2,dp[a[3*n-1]][a[3*n-1]]+1)+cnt);

	return 0;
}


Measured memory_bytes: 19588
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
signed main(){
  int m=0,n=0,h=0;
  string a;
  cin>>a;
  if(a=="abc" || a=="acb" || a=="bac" || a=="bca" || a=="cab" || a=="cba"){
    cout<<"Yes\n";
  }
  else{
    cout<<"No\n";
  }
  return(0);
}

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

using namespace std;

int solve(int n, string str)
{
    int counter = 0;
    bool flag = false;
    for(int i = 0; i < n; i+=1) {
        if (str[i] == 'o') {
            counter += 1;
            flag = false;
            continue;
        }

        if (flag) {
            return counter;
        }
        counter += 1;
        flag = true;
    }
    return counter;
}

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

    cout << solve(n, str) << endl;
    return 0;
}


Measured memory_bytes: 3364
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp  make_pair
#define pb  push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
void c_p_c(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
const int max1=1001;
char s[max1][max1];
void maxs(int &a,int b){
    a+=b;
    if(a>=1e9+7){
        a-=1e9+7;
    }
    //return a;
}
void solve(){
    int n,m;
    cin>>n>>m;
    rep(i,0,n){
        cin>>s[i];
    }
    vector<vector<int>>dp(n,vector<int>(m));
    dp[0][0]=1;
    rep(i,0,n){
        rep(j,0,m){
            for(int x:{i,i+1}){
                int c=j;
                if(x==i){
                    c=j+1;
                }
                if(x<n and c<m and s[x][c]=='.')
                maxs(dp[x][c],dp[i][j]);
            }
        }
    }
    cout<<dp[n-1][m-1]<<endl;
    
}
int32_t main(){
    c_p_c();
    int t;
    t=1;
    //cin>>t;
    while(t--){
       solve(); 
    }
	return 0;
}


Measured memory_bytes: 12092