akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
#define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 10000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < vi, int > a, pair < vi, int > b)//true for a before b
{
	if(a.F.empty())
		return 1;
	if(b.F.empty())
		return 0;
	int i;
	fo(i,0,min(sz(a.F),sz(b.F)))
	{
		if(a.F[i] < b.F[i])
			return 1;
		else if(a.F[i] > b.F[i])
			return 0;
	}
	return (sz(a.F) <= sz(b.F));
}

const int N = (1e5) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 900;
const int SQRT = BUCK+9;

bool mark[N];
ll dp[N];

void solve()
{
	int n, m, i, a;
	cin >> n >> m;
	fo(i,0,n+1)
		mark[i] = 1;
	fo(i,1,m+1)
	{
		cin >> a;
		mark[a] = 0;
	}
	dp[0] = 1;
	dp[1] = (mark[1]) ? 1 : 0;
	fo(i,1,n+1)
	{
		dp[i] = (dp[i-1] + dp[i-2])%mod;
		if(!mark[i])
			dp[i] = 0;
	}
	cout << dp[n] << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	// io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(15);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

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

int main()
{
    string s; cin>>s;
    string y="";
    string m="";
    string d="";
    for(int i=0;i<4;i++) y+=s[i];
    for(int i=5;i<7;i++) m+=s[i];
    for(int i=8;i<10;i++) d+=s[i];
    int yi=stoi(y);
    int mi=stoi(m);
    int di=stoi(d);
    if(yi>2019)cout<<"TBD"<<endl;
    else if(yi<2019)cout<<"Heisei"<<endl;
    else{
        if(mi<=4)cout<<"Heisei"<<endl;
        else if(mi>4)cout<<"TBD"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

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

const max int = 1000 + 1
var A [][]int

func lcs(x, y string) int {
	x = " " + x
	y = " " + y
	for i:=0;i<len(x); i++ {
		for j:=0;j<len(y); j++ {
			A[i][j] = 0
		}
	}
	for i:=1; i<len(x); i++ {
		for j:=1; j<len(y); j++ {
			if x[i] == y[j] {
				A[i][j] = A[i-1][j-1] + 1
			} else if A[i-1][j] > A[i][j-1] {
				A[i][j] = A[i-1][j]
			} else {
				A[i][j] = A[i][j-1]
			}
		}
	}
	return A[len(x)-1][len(y)-1]
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num 
}

func nextStr(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}


func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	A = make([][]int, max)
	for i := range A {
		A[i] = make([]int, max)
	}
	n := nextInt(scanner)
	for i:=0; i<n; i++ {
		x := nextStr(scanner)
		y := nextStr(scanner)
		fmt.Printf("%d\n", lcs(x, y))
	}
}


Measured memory_bytes: 9820
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdbool.h>

#define COL 'Y'

int main(void) {
	int n, i;
	char c;
	bool four_flag = false;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%c", &c);
		if (c == COL) four_flag = true;
	}

	if (four_flag) puts("Four");
	else puts("Three");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }

int n, a[17][17];
ll cost[1 << 16];

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

    cin >> n;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            cin >> a[i][j];
    for(int mask = 0; mask < (1 << n); mask++){
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                if((mask & (1 << i)) && (mask & (1 << j)))
                    cost[mask] += a[i][j];
            }
        }
    }
    for(int mask = 0; mask < (1 << n); mask++){
        for(int sbmask = mask; sbmask > 0; sbmask = (sbmask - 1) & mask){
            cost[mask] = max(cost[mask], cost[sbmask] + cost[mask ^ sbmask]); 
        }
    }
    cout << cost[(1 << n) - 1];
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, k; cin >> n >> k;
    string s; cin >> s;
    s[k - 1] = tolower(s[k - 1]);
    cout << s << "\n";
}


Measured memory_bytes: 256
n = int(input())
aa = list(map(int,input().split()))

minus_count = sum([1 for v in aa if v<0])
a = [abs(v) for v in aa]

if minus_count % 2 == 0:    
  print(sum(a))
else:
  print(sum(sorted(a)[1:]) - min(a))

Measured memory_bytes: 14412
class UnionFind
  attr_accessor(:table)

  def initialize(n)
    @table = Array.new(n, -1)
  end

  def root(x)
    st = []
    tb = @table
    while tb[x] >= 0
      st.push(x)
      x = tb[x]
    end
    
    st.each do |y|
      @table[y] = x
    end
    
    return x
  end
  
  def find(x, y)
    return root(x) == root(y)
  end

  def union(x, y)
    r1 = root(x)
    r2 = root(y)
    return if r1 == r2
    
    d1 = @table[r1]
    d2 = @table[r2]
    if d1 <= d2
      @table[r2] = r1
      @table[r1] += d2
    else
      @table[r1] = r2
      @table[r2] += d1
    end
  end
end

n, m = gets.chomp.split.map(&:to_i)
uf = UnionFind.new(n)
m.times do |i|
  a, b = gets.chomp.split.map(&:to_i)
  uf.union(a - 1, b - 1)
end
puts uf.table.min * (- 1)

Measured memory_bytes: 15848
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main() {
    int a,b,c,k; cin >> a >> b >> c >> k;
    int count = 0;
    while(b <= a){
        b *= 2;
        count ++;
    }
    while(c <= b){
        c *= 2;
        count ++;
    }

    if(count <= k) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rs(a, b) ((a) >> (b))
#define ls(a, b) ((a) << (b))
#define gcd __gcd
#define lcm(a, b) ((a * b) / gcd(a, b))
#define pq priority_queue
#define um unordered_map
#define lb lower_bound
#define ub upper_bound
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define nani(x) cerr << #x << " is " << x << endl;
#define ch(x) (x - 'a' + 1)
#define mp make_pair
#define pb push_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scan(x, n) loop(i, 0, n) cin >> x[i];
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define print(x, n) loop(i, 0, n) cout << x[i] << " ";
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef vector<ii> vii;
typedef vector<pll> vll;
typedef um<int, int> umii;
typedef um<char, int> umci;
typedef map<char, int> mci;
typedef map<int, int> mii;

int sum[300001];
int main()
{
    fast;
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    int a[n];
    scan(a, n);
    sort(a, a + n);
    cout << a[n >> 1] - a[rs(n, 1) - 1];
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <string>
#include <iostream>
#include <list>

using namespace std;
int main(){
	cin.tie(0);
    ios_base::sync_with_stdio(0);	
	int n,num;
	cin >> n;
	list<int> l;
	list<int>::iterator iter; //回傳一個 iterator 
	for(int i=0 ; i<n ; i++){
		string str;
		cin >> str;
		if(str=="insert"){
			cin >> num;
			l.push_front(num);
		}			
		else if(str=="delete"){
			cin >> num;
			for(iter=l.begin() ; iter!=l.end() ; iter++){
				if(*iter == num){
					l.erase(iter);
					break;
				}		
			}
		
		}		
		else if(str=="deleteFirst")
			l.pop_front();	
		else if(str=="deleteLast")
			l.pop_back();	
	}
	for(iter=l.begin() ; iter!=l.end() ; iter++){
		if(iter!=l.begin())
			cout << " ";
		cout << *iter;
	}
	cout << "\n";
}


Measured memory_bytes: 34340
using System;

namespace ABC125
{
    class Program
    {
        static void Main(string[] args)
        {
			// ProblemB.solve();
			// 入力受付
			//const uint N = uint.Parse(Console.ReadLine()); // constはリテラルしか代入できない
			//readonly uint N = uint.Parse(Console.ReadLine()); // 変更ができない事を示すなら、readonlyを用いる...が、これはクラス内でしか使えない
			uint N = uint.Parse(Console.ReadLine()); // 仕方ないのでこう。キレそう。
			int[] V = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); // LINQを使っても良い。なんだそれ。
			int[] C = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); // なお、C#はガベージコレクションが自動的に働くので、こいつらの解放は気にしなくて良い。
			if (V.Length < N || C.Length < N)
			{
				// 配列外参照
				Console.WriteLine("wrong input.");
				return;
			}
			// 計算(V[i]-C[i]を求めて、正なら買えば良い)
			int ans = 0;
			for (uint i = 0; i < N; i++)
			{
				int sub = V[i] - C[i];
				if (sub > 0)
				{
					ans += sub;
				}
			}

			// 結果出力
			Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main() {
    int k,x,a,b;
    cin>>k>>x;
    a=x-k+1;
    b=x+k-1;
    for(int i=a;i<=b;i++) {
        cout<<i<<" ";
    }
return 0;
}


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

using namespace std;

const int inf = 1e9;

signed main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    vector<int> dp(n, inf);
    
    dp[0] = 0;
    
    for (int i = 1; i < n; i++) {
        if (i - 1 >= 0) {
            dp[i] = min(dp[i], dp[i - 1] + abs(a[i] - a[i - 1]));
        }
        if (i - 2 >= 0) {
            dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]));
        }
    }
    
    cout << dp[n - 1];
    
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define TLE() cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms.\n";
const ll MOD = 1E9+7;
const ll IINF = 1E18;
const int INF = 1e9;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}

const int N=(1<<18)+5;
int n,res;
int a[N];
set<pair<int,int>> f[N];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	REP(i,1<<n) cin>>a[i];
	FOR(k,1,(1<<n)-1){
		f[k].emplace(a[0],0);
		f[k].emplace(a[k],k);
		REP(i,18)
			if(getbit(k,i))
				for(auto x:f[k^(1<<i)])
					f[k].emplace(x);
		while(sz(f[k])>2){
			auto it=f[k].begin();
			f[k].erase(it);
		}
		auto it=f[k].end();
		it--;
		int x=(*it).fi;
		it--;
		int y=(*it).fi;
		res=max(res,x+y);
		cout<<res<<'\n';
	}
}



Measured memory_bytes: 41568
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;


map<int ,int > res;
void prime_factor(int n){
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            res[i]++;
            n/=i;
        }
    }
    if(n!=1) res[n]++;
    return;
}

ll factorial(ll n, ll mod) {
    ll ret = 1;
    for (ll i = 1; i <= n; i++) {
        ret = (ret * i) % mod;
    }
    return ret;
}

ll inv_mod(ll n, ll mod) {
    ll a = n % mod, b = mod - 2, ret = 1;
    while (b > 0) {
        if (b & 1) ret = (ret * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ret;
}

ll nPr(ll n, ll r, ll mod) {
    ll ret = 1;
    for (ll i = n; i >= n - r + 1; i--) {
        ret = ret * (i % mod) % mod;
    }
    return ret;
}

ll nCr(ll n, ll r, ll mod) {
    return nPr(n,r,mod) * inv_mod(factorial(r,mod),mod) % mod;
}

ll nHr(ll n, ll r, ll mod) {
    return nCr(n+r-1,r,mod);
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    prime_factor(m);
    ll ans=1LL;
    for(auto itr : res){
        ans*=nCr(itr.second+n-1,itr.second,MOD);
        ans%=MOD;
    }
    std::cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
int main(){
	int hig,wid,tmp,sta[35],fin[35],ans[35];
	char x;
	cin>>hig>>wid;
	for(int i=0;i<wid;i++){
		cin>>sta[i]>>x>>fin[i];
	}
	for(int i=1;i<=hig;i++){
		ans[i-1]=i;
	}
	for(int i=0;i<wid;i++){
		tmp=ans[sta[i]-1];
		ans[sta[i]-1]=ans[fin[i]-1];
		ans[fin[i]-1]=tmp;
	}
	for(int i=0;i<hig;i++){
		cout<<ans[i]<<endl;
	}
}

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

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

    double num = 0;
    double ans = 0;

    if(N % 2){
        //Nが奇数
        num = (N + 1) / 2;
    }
    else{
        num = N / 2;
    }

    ans = num / N;
    cout << ans << endl;
}

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

int main(void){
  int n, flg=0;
  string s, ss, str[4]={"SS","SW","WS","WW"};
  cin >> n >> s;
  for(int i=0;i<4;++i){
    ss = str[i];
    for(int j=1;j<s.size()-1;++j){
      if(ss[j]=='S'){
        if(ss[j-1]=='S'){
          if(s[j]=='o'){
            ss += 'S';
          }else{
            ss += 'W';
          }
        }else{
          if(s[j]=='o'){
            ss += 'W';
          }else{
            ss += 'S';
          }
        }
      }else{
        if(ss[j-1]=='S'){
          if(s[j]=='o'){
            ss += 'W';
          }else{
            ss += 'S';
          }
        }else{
          if(s[j]=='o'){
            ss += 'S';
          }else{
            ss += 'W';
          }
        }
      }
    }
    if(ss[n-1]=='S'){
      if(ss[0]==ss[n-2]){
        if(s[n-1]=='x'){
          continue;
        }
      }else{
        if(s[n-1]=='o'){
          continue;
        }
      }
    }else{
      if(ss[0]==ss[n-2]){
        if(s[n-1]=='o'){
          continue;
        }
      }else{
        if(s[n-1]=='x'){
          continue;
        }
      }
    }
    if(ss[0]=='S'){
      if(ss[1]==ss[n-1]){
        if(s[0]=='o'){
          flg = 1;
          break;
        }
      }else{
        if(s[0]=='x'){
          flg = 1;
          break;
        }
      }
    }else{
      if(ss[1]==ss[n-1]){
        if(s[0]=='x'){
          flg = 1;
          break;
        }
      }else{
        if(s[0]=='o'){
          flg = 1;
          break;
        }
      }
    }
  }
  if(flg) cout << ss << endl;
  else cout << "-1" << endl;
}

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

int main() {
    ll N, M;
    cin >> N >> M;
    priority_queue<ll> q;
    q.push(0);
    rep(i, N) {
        ll a;
        cin >> a;
        q.push(a);
    }

    bool con = true;
    while(con) {
        ll temp = q.top();
        if(temp == 0LL) break;
        q.pop();
        //cout << "a"<< endl;
        while(temp >= q.top()) {           
            M--;
            temp /= 2LL;
            if(temp == 0) break;
            if(M == 0LL) {
                con = false;
                break;
            }
        }
        q.push(temp);
    }

    ll res = 0LL;
    rep(i, N) {
        res += q.top();
        q.pop();
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int A, P;
  std::cin >> A >> P;
  P += A * 3;
  std::cout << P/2 << '\n';
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    bool res = true;
    int tmp;
    for (int i = 0; i < N; i++) {
        cin >> tmp;
        if (tmp % 2 != 0 || tmp % 3 == 0 || tmp % 5 == 0) {
            continue;
        }
        res = false;
    }
    if (res) {
        cout << "APPROVED";
    } else {
        cout << "DENIED";
    }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Jun  9 13:21:18 2018
ALDS1-9c
@author: maezawa
"""
import heapq as hq
        
h = []

while True:
    s = input()
    if s == 'end':
        break
    if s == 'extract':
        print(-hq.heappop(h))
        continue
    opcode, operand = s.split()
    data = int(operand)
    if opcode == 'insert':
        hq.heappush(h, -data)




Measured memory_bytes: 45316
#include<cstdio>

int main() {
    int x,y;
    for(int i = 1; i <= 3000; i++){
        scanf("%d %d",&x,&y);
        if(x == 0 && y == 0){
            break;
        }
        if(x >= y){
            printf("%d %d\n",y,x);
        }
        else{
            printf("%d %d\n",x,y);
        }
    }
return 0;
}


Measured memory_bytes: 2600
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  long long l, r; cin >> l >> r;
  if (r - l >= 2017) {
    cout << 0 << '\n';
    return 0;
  }
  l %= 2019; r %= 2019;
  int ans = INF;
  FOR(i, l, r + 1) FOR(j, i + 1, r + 1) {
    ans = min(ans, i * j % 2019);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>

typedef long long ll;

using namespace std;

int H, W;
char map[2001][2001];
int R[2001][2001];
int L[2001][2001];
int D[2001][2001];
int U[2001][2001];

int main(void) {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> map[i][j];
        }
    }

    // for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cout << map[i][j]; } cout << endl; }

    for (int i = 0; i < H; i++) {
        L[i][0] = map[i][0] == '#' ? -1 : 0;
        R[i][W - 1] = map[i][W - 1] == '#' ? -1 : 0;
        for (int j = 1; j < W; j++) {
            if (map[i][j] == '#')
                L[i][j] = -1;
            else
                L[i][j] = map[i][j - 1] == '#' ? 0 : L[i][j - 1] + 1;
        }
        for (int j = W - 2; j >= 0; j--) {
            if (map[i][j] == '#')
                R[i][j] = -1;
            else
                R[i][j] = map[i][j + 1] == '#' ? 0 : R[i][j + 1] + 1;
        }
    }
    for (int j = 0; j < W; j++) {
        U[0][j] = map[0][j] == '#' ? -1 : 0;
        D[H - 1][j] = map[H - 1][j] == '#' ? -1 : 0;
        for (int i = 1; i < H; i++) {
            if (map[i][j] == '#')
                U[i][j] = -1;
            else
                U[i][j] = map[i - 1][j] == '#' ? 0 : U[i - 1][j] + 1;
        }
        for (int i = H - 2; i >= 0; i--) {
            if (map[i][j] == '#')
                D[i][j] = -1;
            else
                D[i][j] = map[i + 1][j] == '#' ? 0 : D[i + 1][j] + 1;
        }
        
    }

    int mv = -1;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (map[i][j] != '#') {
                int count = U[i][j] + D[i][j] + L[i][j] + R[i][j] + 1;
                mv = max(mv, count);
                // cout << i << " " << j << ":" << count << endl;
            }
        }
    }
    cout << mv << endl;
}

Measured memory_bytes: 66688
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll N_MAX = 100;

ll N;
string S;

void input() {
	cin>>N>>S;
}

void solve() {
	ll begin=0;
	ll begin1=0;
	rep(i,N){
		if(S[i]=='('){
			begin++;
		}else{
			if(begin==0)begin1++;
			else begin--;
		}
	}


	while(begin1--)cout<<'(';
	cout<<S;
	while(begin--)cout<<')';
	cout<<endl;
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {

	var K int

	fmt.Scan(&K)

	sum := 0

	for i := 1; i <= K; i++ {

		for j := 1; j <= K; j++ {

			for z := 1; z <= K; z++ {

				sum += GCD(GCD(i,j),z)

			}
		}

	}

	fmt.Println(sum)

}
//GCD 最大公約数を求める
func GCD(a, b int) int {

	if b == 0 {

		return a

	}

	return GCD(b, a%b)

}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main()
{
    int a, b;
  cin >> a >> b;
  if((a % 3 == 0) || (b % 3 == 0) || ((a + b) % 3 == 0)){
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
    return 0;
}


Measured memory_bytes: 256
from itertools import combinations

N = int(input())
L = list(map(int, input().split()))
ans = 0
for v in combinations(L, 3):
    if len(set(v)) == 3:
        a, b, c = v
        if a + b > c and c + a > b and b + c > a:
            ans += 1
print(ans)

Measured memory_bytes: 9112
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=1e5;
const int inf=1e9;
int main(){
	string t; cin>>t;
	int n = t.size();
	for(int i = n-1; i >= 0; i--){
		if(t[i] == '?') t[i] = 'D';
	}cout<<t<<endl;
}

Measured memory_bytes: 3724
import java.util.*;

public class Main{
    public static void main(String[] args){
	        Scanner sc = new Scanner(System.in);
	        int a = sc.nextInt();
	        int b = sc.nextInt();
	        int c = sc.nextInt();
	        if(a < b && b < c){
	            System.out.println("Yes");
	        }else{
	            System.out.println("No");
	        }
	    }
}


Measured memory_bytes: 26328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  ll n;
  cin >> n;
  vector<int> a;
  while(n>0){
    a.push_back(n%10);
    n /= 10;
  }
  reverse(a.begin(),a.end());
  int l = a.size();
  ll ans = 0;
  rep(i,pow(2,l-1)){
    ll s = 0;
    ll now = a.at(0);
    rep(j,l-1){
      if( i >> j & 1){
        s += now;
        now = a.at(j+1);
      }else{
        now *= 10;
        now += a.at(j+1);
      }
    }
    s += now;
    ans += s;
    
  }
  cout << ans << endl;
}
        
        

  
  

Measured memory_bytes: 256
/***     
 * When I wrote this
 * only God & I understood
 * what I was doing
 * Now, God only knows 
 /***/ 
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <iomanip>
#include<map>
typedef long long ll;
#define rep(i,a,n) for (int i=a;i<=n;i++)/*i为循环变量，a为初始值，n为界限值，递增*/
#define per(i,a,n) for (int i=a;i>=n;i--)/*i为循环变量， a为初始值，n为界限值，递减*/
const int mod = 1e9+7;
using namespace std;
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
//fixed<< setprecision(2)
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n;
    while (cin >> n)
    {
        ll *p=new ll[n+5];
        for(int i=0;i<n;i++)cin>>p[i];
        sort(p,p+n);
        ll ans=0;
        for(int i=0;i<n-2;i++)
        {

            for(int j=i+1;j<n-1;j++)
            {
                if(p[i]==p[j])continue;
                for(int k=j+1;k<n;k++)
                {
                    if(p[k]==p[i]||p[k]==p[j])continue;
                  if((p[i]+p[j])>p[k]){
                      ans++;}
                  else break;
                }
            }
        }cout<<ans<<'\n';
    }
}

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

int main()
{
    char ch[51][51];
    int mp[51][51];
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0; i<n; i++)
        scanf("%s",ch[i]);
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
        {
            int cnt=0;
            if(ch[i][j]=='#')continue;
            if(ch[i-1][j]=='#') cnt++;
            if(ch[i+1][j]=='#') cnt++;
            if(ch[i][j-1]=='#') cnt++;
            if(ch[i][j+1]=='#') cnt++;
            if(ch[i-1][j-1]=='#') cnt++;
            if(ch[i+1][j+1]=='#') cnt++;
            if(ch[i-1][j+1]=='#') cnt++;
            if(ch[i+1][j-1]=='#') cnt++;
            mp[i][j]=cnt;
        }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {    if(ch[i][j]=='#')
                {
                    printf("#");
                    continue;
                }
            printf("%d",mp[i][j]);

        }

        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b,c,vis[100005],inque[100005],d[100005],flag;
struct node{
	int to;
	int v;
	node(int a,int b)
	{
		to=a;
		v=b;
	}
};
vector<node>v[100005];
void dfs(int x)
{
	if(flag) return;
	vis[x]=true;
	inque[x]=true;
	for(int i=0;i<v[x].size();i++)
	   {
	   		int y=v[x][i].to;
	   		if(d[y]>d[x]+v[x][i].v)
	   		{
	   		  d[y]=d[x]+v[x][i].v;
	   			if(inque[y])
				   {
				   	flag=1;
				   	return;
					}
				else dfs(y);
	   		}
	   }
	inque[x]=false;
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	    {
		cin>>a>>b>>c;
		v[a].push_back(node(b,c));
		v[b].push_back(node(a,-c));
		}
	memset(d,0,sizeof(d));
	for(int i=1;i<=n;i++)
	{
		if(vis[i]) continue;
		d[i]=0;
		dfs(i);	
	}
	if(flag) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;	
}

Measured memory_bytes: 11776
#include <iostream>
#include <algorithm>
#define MOD 673

using namespace std;
typedef long long ll;

int main(void) {
	ll l, r, ans = 0, i, j;
	cin >> l >> r;
	if (r - l < 2)
		ans = ((r % 2019) * (l % 2019)) % 2019;
	else if (r - l < 672) {
		ans = 2019;
		for (i = l; i < r; i++) {
			for (j = i + 1; j <= r; j++)
				ans = min(ans, (i % 2019) * (j % 2019) % 2019);
		}
	}
	cout << ans << "\n";
	return 0;
}

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

using namespace std;
using ll = long long;
int main(int argc, const char *argv[]) {
  ll n, d;
  cin >> n >> d;
  vector<pair<ll, ll>> vp(n);
  for (int i = 0; i < n; ++i) {
    cin >> vp[i].first >> vp[i].second;
  }

  ll ans = 0;
  for (auto &p : vp) {
    ll dist = p.first * p.first + p.second * p.second;
    if (dist <= d * d) {
      ans++;
    }
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 6420
def main():
    import sys
    input = sys.stdin.readline
    
    H,W,D = map(int,input().split())
    A = [list(map(int,input().split())) for i in range(H)]
    Q = int(input())
    
    a = {}
    for i in range(H):
        for j in range(W):
            a[A[i][j]] = [i,j]
    
    c = [0]*(H*W+1)
    for i in range(1,H*W+1):
        if i+D <= H*W:
            j,k = a[i]
            x,y = a[(i+D)]
            c[i+D] = abs(x-j) + abs(y-k)

    import copy
    d =  copy.deepcopy(c)
    
    for i in range(1,D+1):
        tmp = i
        while tmp+D <= H*W:
            d[tmp+D] += d[tmp]
            tmp += D
    #print(c)
    #print(d)
    for i in range(Q):
        L,R = map(int,input().split())
        ans = d[R] - d[L]
        print(ans)
    
    
    
main()

Measured memory_bytes: 72536
#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int n;
	cin >> n;
	int ans = 100000;
	for (int i = 0; i < n; i++)
		ans = ceil(ans * 1.05 / 1000) * 1000;
	cout << ans << endl;
}


Measured memory_bytes: 3000
na = lambda: list(map(int, input().split()))
n, x = na()
a = sorted(na())
ans = 0
if a[0] > x:
    print(0)
    exit()
for i in a:
    if i > x:
        x = 0
        break
    x -= i
    ans += 1
if x != 0:
    ans -= 1
print(ans)

Measured memory_bytes: 3064
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  d = int(input())
  if d == 25:
    print('Christmas')
  elif d==24:
    print('Christmas Eve')
  elif d==23:
    print('Christmas Eve Eve')
  else:
    print('Christmas Eve Eve Eve')
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5240
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
int A=b-a;
int B=c-b;
if(A==B)
{
	cout<<"YES"<<endl;
 } 
 else
 {
 	cout<<"NO"<<endl;
 }
return 0;

}

Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce
from operator import xor
from heapq import heappush, heappop
INF = float("inf")
sys.setrecursionlimit(10**7)

# 4近傍（右, 下, 左, 上）
dy4, dx4 = [0, -1, 0, 1], [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def ceil(a, b):return (a + b - 1) // b


def solve(N, d_list):
    ans = 0
    now = INF
    for d in sorted(d_list, reverse=True):
        if now > d:
            now = d
            ans += 1
    return ans


def main():
    N = int(input())
    d_list = [int(input()) for _ in range(N)]
    print(solve(N, d_list))


if __name__ == '__main__':
    main()


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

#define ll long long
#define ld long double

using namespace std; 
void solve(); 
int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
  
    int t = 1; 
    // cin >> t; 
    while (t--) { 
        solve(); 
    } 
  
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
    return 0; 
} 

void solve() 
{ 
	int n, temp;
    vector<int> x;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> temp;
        x.push_back(temp);
    }

    int mean = round(accumulate(x.begin(), x.end(), 0.0) / (float)x.size());
    int ans = 0;


    for (int i = 0; i < (int)x.size(); i++) {
        ans += pow((x[i] - mean), 2);
    }

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


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

int main() {
  int n;
  cin >> n;
  vector<int> dir(n);
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    dir.at(i) = d - 1;
  }
  vector<bool> passed(n, false);
  int idx = 0;
  int counter = 0;
  passed.at(0) = true;
  while (idx != 1) {
    idx = dir.at(idx);
    counter++;
    if (passed.at(idx)) {
      cout << -1 << endl;
      return 0;
    } else {
      passed.at(idx) = true;
    }
  }
  cout << counter << endl;
  return 0;
}


Measured memory_bytes: 640
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    let mut flag = true;
    let (mut nx, mut ny, mut nt) = (0, 0, 0);
    for _ in 0..n {
        let (t, x, y): (isize, isize, isize);
        input!(t, x, y);
        let dist = (x - nx).abs() + (y - ny).abs();
        if dist > t - nt {
            flag = false;
        } else {
            let dist = dist - t + nt;
            if dist % 2 != 0 {
                flag = false;
            }
        }
        nt = t;
        ny = y;
        nx = x;
    }
    if flag {
        p("Yes");
    } else {
        p("No");
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)

using namespace std;

int main() {
    // Input
    int A, B, K;
    scanf("%d%d%d", &A, &B, &K);
    // Output
    vector<int> list1, list2, ans;
    int len = B - A + 1;

    for(int i = 0; (i < K) && (i < len); i++) {
        list1.push_back(A + i); list2.push_back(B - i);
    }
    sort(list2.begin(), list2.end());
    set_union(list1.begin(), list1.end(), list2.begin(), list2.end(), back_inserter(ans));

    rep(i, (int)ans.size()) {
        printf("%d\n", ans[i]);
    }

    return 0;
}

Measured memory_bytes: 256
/*
 _____ ____ _____   ___   ___   ___   ___ 
|_   _/ __ \_   _| |__ \ / _ \ |__ \ / _ \
  | || |  | || |      ) | | | |   ) | | | |
  | || |  | || |     / /| | | |  / /| | | |
 _| || |__| || |_   / /_| |_| | / /_| |_| |
|_____\____/_____| |____|\___/ |____|\___/ 
*/
#include <bits/stdc++.h>
#include <fstream>
//#include "ele.h"
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
// assert(x==y); gives run time when false
using namespace std;
int main()
{
    CIN;
    int n,m;
    cin >> n >> m;
    if(m>=n){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, div2, div4, x;
int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x;
        if (x % 4 == 0) {
            div4++;
        } else if (x % 2 == 0) {
            div2++;
        }
    }
    div4 += div2 / 2;
    if (div4 >= N - div4 - 1) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 200000
struct edge{int nx,t;}e[MN*2+5];
int h[MN+5],en,d[MN+5],S[MN+5];
char s[MN+5];
long long ans;
inline void ins(int x,int y)
{
	e[++en]=(edge){h[x],y};h[x]=en;
	e[++en]=(edge){h[y],x};h[y]=en;
}
void dfs(int x,int fa)
{
	S[x]=s[x]-'0'; 
	for(int i=h[x];i;i=e[i].nx)if(e[i].t!=fa)
	{
		dfs(e[i].t,x);
		d[x]=max(d[x],d[e[i].t]+1);
		S[x]+=S[e[i].t];
	}
}
void solve(int x,int fa,int df,int sf)
{
	if(fa&&min(S[x]?d[x]:1e9,sf?df-1:1e9)<=min(d[x],df-1))++ans;
	int d1=0,d2=0,d3=s[x]^'0'?0:1e9;
	for(int i=h[x];i;i=e[i].nx)if(e[i].t!=fa)
	{
		if(d[e[i].t]>=d1)d2=d1,d1=d[e[i].t]+1;
		else if(d[e[i].t]>=d2)d2=d[e[i].t]+1;
		if(S[e[i].t])d3=min(d3,d[e[i].t]+1);
	}
	for(int i=h[x];i;i=e[i].nx)if(e[i].t!=fa)
		solve(e[i].t,x,max(df,d1==d[e[i].t]+1?d2:d1)+1,sf+S[x]-S[e[i].t]);
	if(df>d1)d2=d1,d1=df;else if(df>d2)d2=df;
	if(sf)d3=min(d3,df);
	if(d3<=d2)ans+=d2-d3+1;
}
int main()
{
	int n=read(),i;
	for(i=1;i<n;++i)ins(read(),read());
	scanf("%s",s+1);
	dfs(1,0);solve(1,0,0,0);
	printf("%lld",ans);
}

Measured memory_bytes: 20096
#include<bits/stdc++.h>
using namespace std;
string sr;
int n=0,e=0,s=0,w=0;
int main(){
	cin >> sr;
	for(int i=0;sr[i];i++){
		if(sr[i]=='N'){
			n=1;
		}else if(sr[i]=='S'){
			s=1;
		}else if(sr[i]=='E'){
			e=1;
		}else{
			w=1;
		}
	}
	if(n!=s||w!=e){
		printf("No");
	}else printf("Yes");
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;
ll fact(ll n, ll p){
	ll ans = 1;
	for(ll i = 1; i <= n; i++){
		ans *= i;
		ans %= p;
	}
	return ans;
}
ll power(ll x, ll n, ll p){
	ll res = 1;
	if(n == 1) return x%p;
	if(n%2 == 1) res = x%p;

	ll temp = power(x,n/2,p);
	return res*((temp*temp)%p)%p;
}
ll inv(ll a, ll p){
	return power(a,p-2,p);
}
ll nCr(ll n, ll r, ll p){
	if(r > n) return 0;
	ll t1 = fact(n,p);
	ll t2 = inv(fact(r,p),p);
	ll t3 = inv(fact(n-r,p),p);

	return (((t1*t2)%p)*t3)%p;
}
vector<vector<ll> > multiply(vector<vector<ll> > &a, vector<vector<ll> > &b, ll p){
	int r1,c1,r2,c2;
	r1 = a.size(); c1 = a[0].size();
	r2 = b.size(); c2 = b[0].size();

	vector<vector<ll> > result(r1,vector<ll>(c2,0));

	if(c1 != r2) return result;

	for(int i = 0; i < r1; i++){
		for(int j = 0; j < c2; j++){
			for(int k = 0; k < c1; k++){
				result[i][j] += a[i][k]*b[k][j];
				result[i][j] %= p;
			}
		}
	}
	return result;
}
vector<vector<ll> > power(vector<vector<ll> >&a,ll n, ll p){
	int r = a.size();
	vector<vector<ll> > result(r,vector<ll>(r,0));
	for(int i = 0; i < r; i++) result[i][i] = 1;

	while(n > 0){
		if(n%2 == 1){
			result = multiply(result,a,p);
		}
		n /= 2;
		a = multiply(a,a,p);
	}
	return result;
}
// template ends here

void solve(){
	// code starts from here
	map<string,int> mp;
	ll N;
	cin >> N;
	while(N--){
		string str;
		cin >> str;
		mp[str]++;
	}
	cout << mp.size() << endl;
}

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

	int T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 19276
#include<stdio.h>
int main(void){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  int label[n];
  for(int i=0;i<n;i++){
	label[i]=0;
  }
  for(int i=0;i<n;i++){
    label[a[i]-1]++;
  }
  /* for(int i=0;i<n;i++){
	printf("%d ",label[i]);
  }
  printf("\n");*/
  long sum=0;
  //for(int k=0;k<n;k++){
   // label[a[k]]--;
    for(int i=0;i<n;i++){
     // printf("%d\n",label[i]);
     // printf("%d\n",label[i]*(label[i]-1));
       sum+=(long)label[i]*(long)(label[i]-1)/2;
    }
   // printf("%d\n",sum);
    //label[a[k]]++;
    //sum=0;
  
 
  for(int i=0;i<n;i++){
    sum-=label[a[i]-1]-1;
    printf("%ld\n",sum);
    sum+=label[a[i]-1]-1;
                 }
  return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	long long n;

	std::cin >> n;

	long long hani = -10000000000LL;
	long long ans = 0;

	std::vector<std::pair<long long, long long> > v(n);
	for (long long i = 0; i < n; i++)
	{
		long long x, l;

		std::cin >> x >> l;

		v[i] = { x + l, x - l };
	}

	std::sort(v.begin(), v.end());

	for (long long i = 0; i < n; i++)
	{
		long long x = v[i].first, l = v[i].second;

		if (hani <= l) {
			hani = x;
		}
		else {
			ans++;
		}
	}

	std::cout << n - ans << std::endl;

	return 0;
}

Measured memory_bytes: 1792
// https://ynucpc.github.io/blog/2018/04/15/cp_vscode/
// http://www.atmarkit.co.jp/ait/articles/1509/08/news019.html

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rep3(i,n,m) for(ll i=(n);i<(ll)(m);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
// #define max(a, b) ((a) > (b) ? (a) : (b))
// #define min(a, b) ((a) < (b) ? (a) : (b)) 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int stoi (string s, int tmp=10){
	istringstream stm(s);
	int res;
	stm >> res;
	return res;
}
double stod(string s, int tmp=10){
	istringstream stm(s);
	double res;
	stm >> res;
	return res;
}


// 降順ソート: sort(A, A+N, greater<>());
// min: *min_element(A, A+N)
// argmin: min_element(A, A+N)-A



int main(){	
	// ll A;
    // cin >> A;
	// cout << "hello" << endl;
	// cout << stoi("14") << endl;
	// cout << max({1,3}) << endl;
	ll N, M;
	cin >> N >> M;
	ll f[M] = {};
	rep(i, N){
		ll K;
		cin >> K;
		rep(j, K){
			ll A;
			cin >> A;
			f[A-1]++;
		}
	}
	ll ans=0;
	rep(i, M)if(f[i]==N)ans++;
	cout << ans << endl;

}








Measured memory_bytes: 256