akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>

typedef long long ll;
const ll INF = 1e18 + 1;
const ll MOD = 1e9 + 7;

void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << std::distance(begin, it) << "] " << *it << " ";
    if (std::distance(begin, it) % 50 == 49) { std::cout << std::endl; }
  }
  std::cout << std::endl;
}

int main(int argc, char* argv[])
{
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  char A, B;
  std::cin >> A >> B;

  char C;
  if (A == 'H' && B == 'H') {
    C = 'H';
  } else if (A == 'H' && B == 'D') {
    C = 'D';
  } else if (A == 'D' && B == 'H') {
    C = 'D';
  } else {
    C = 'H';
  }

  print(C);
  return 0;
}


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

#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

int main() {
  int n, b, ans = 0;
  string s;
  cin >> b >> n;
  vector<int> a(n);
  cin >> a.at(0);
  rep(i, n - 1) {
    cin >> a.at(i + 1);
    if(i >= 1 && ans < a.at(i + 1) - a.at(i)) ans = a.at(i + 1) - a.at(i);
  }
  if(ans < a.at(0) + b - a.at(n - 1)) ans = a.at(0) + b - a.at(n - 1);
  cout << b - ans << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
typedef long long ll;
const int Maxn=200000;
int a[Maxn+5];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int maxn=a[1];
	ll ans=0;
	for(int i=2;i<=n;i++){
		if(a[i]<maxn){
			ans+=maxn-a[i];
		}
		else{
			maxn=a[i];
		}
	}
	printf("%lld\n",ans);
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define ppb pop_back
#define INF 1e18
typedef long long ll;

using namespace std;

int main(int argc,char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin>>n;

    int sum = 0;
    int time = 1;
    while(sum < n)
    {
        sum += time;
        time++;
    }

   cout<<time-1<<endl; 


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair 
#define pb push_back 
#define fi first
#define se second

#define MOD 1000000007
#define DOMOD(d) if ((d) >= MOD) d %= MOD;
#define DONEGMOD(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;

#define inp(a) scanf("%d", &a)
#define inp2(a,b) scanf("%d %d", &a, &b)
#define inp3(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define inp4(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)

#define inpl(a) scanf("%lld", &a)
#define inpl2(a,b) scanf("%lld %lld", &a, &b)
#define inpl3(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define inpl4(a,b,c,d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repv(u) for (int i=0;i<(int) u.size() ; i++ ) 
#define mset(a,val) memset(a,val,sizeof(a))
#define printv(v) for (int i=0;i<(int) v.size(); i++) cout<<v[i]<<" " 
#define MAX 10005
using namespace std ;
typedef long long int ll ;
typedef pair<int,int> pii ;
typedef pair<long long , long long > pll ;

map<int,int> d; 
bool prime[1005] ;
vector<int> p ;

void sieve() {
	mset(prime,true) ;
	for (int i=2;i<=1000;i++) {
		if (prime[i]) {
			for (int j=i*i;j<=1000;j+=i) prime[j] = false ;
			p.pb(i) ;
		}
		
	}
	}

void factor(int x) {
	
	int i = 0 ;	
	int temp ;
	while (x > 1) 
	{
		temp = p[i] ;
		if (x%temp==0) {
			while (x % temp == 0) {
				x/=temp ;
				d[temp]++ ;
			}
			
			
		}
		i++ ;
	}
	
}

int main()
{
  
  
  int n ; inp(n) ;
  sieve() ;
  for (int i=1;i<=n;i++) {
	  factor(i) ;
  }
  ll ans = 1 ;
  for (auto it : d) {
	  ans = (ans*(it.se + 1)) % MOD ;
	  
  }
  cout<<ans<<endl ;
  return 0 ;
}




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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = ReadInts();
            var a = ReadInts();

            var k = nk[1] - 1;
            var n = nk[0] - 1;

            var x = 0;
            if (n % k != 0)
            {
                x = 1;
            }
            WriteLine((n / k) + x);
        }
        

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


Measured memory_bytes: 18912
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a!=c)
	cout<<1<<endl;
	else
	cout<<0<<endl;
	
	return 0;
}

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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
constexpr int MOD = mod;
constexpr ll inf = 1e9+5;
const int MAX=510000;
int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    int a,b,t;
    cin>>a>>b>>t;
    cout << (t/a)*b << endl;
    return 0;
}



Measured memory_bytes: 256
a, b, c = map(int, input().split())
d = [b] * a

for i in range(c):
  e = int(input())
  d[e-1] +=1
  
f = [i-c for i in d]

for i in f:
  if i<1:
    print('No')
  else:
    print('Yes')

Measured memory_bytes: 10480
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

template<class T> struct LSSUM{
    int n;
    T e;
    vector<T> dat,lazy;

    LSSUM(T n_,T e_=0){
        n=1;e=e_;
        while(n<n_) n*=2;
        dat.resize(2*n-1,e);
        lazy.resize(2*n-1,e);
    }

    void prop(int k,int l,int r){
        if(lazy[k]==0) return;
        dat[k]+=lazy[k];
        if(r-l>1){
            lazy[2*k+1]+=lazy[k]/2;
            lazy[2*k+2]+=lazy[k]/2;
        }
        lazy[k]=0;
    }

    void ud(int be,int en,T t,int k,int l,int r){
        prop(k,l,r);
        if(r<=be||en<=l) return;
        if(be<=l&&r<=en){
            lazy[k]+=t*(r-l);
            prop(k,l,r);
            return;
        }
        ud(be,en,t,k*2+1,l,(l+r)/2);
        ud(be,en,t,k*2+2,(l+r)/2,r);
        dat[k]=dat[2*k+1]+dat[2*k+2];
    }

    void ud(int be,int en,T t){
        ud(be,en,t,0,0,n);
    }

    T gt(int be,int en,int k,int l,int r){
        if(r<=be||en<=l) return e;
        prop(k,l,r);
        if(be<=l&&r<=en) return dat[k];
        return gt(be,en,k*2+1,l,(l+r)/2)+gt(be,en,k*2+2,(l+r)/2,r);
    }

    T gt(int be,int en){
        return gt(be,en,0,0,n);
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,q,s,t,x;
    cin>>n>>q;
    LSSUM<ll> sg(n);
    bool f;
    fr(i,q){
        cin>>f;
        if(f){
            cin>>s>>t;
            cout<<sg.gt(--s,t)<<endl;
        }
        else{
            cin>>s>>t>>x;
            sg.ud(--s,t,x);
        }
        //fr(j,2*sg.n-1) cout<<"["<<sg.dat[j]<<","<<sg.lazy[j]<<"] ";
        //cout<<endl;
    }
}


Measured memory_bytes: 7064
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <string>

using namespace std;
const int MOD = 2019;

void solve(int L, int R) {
  int ans = 2019;
  for (int i = L; i <= R; i++) {
    for (int j = i + 1; j <= R; j++) {
      ans = min(ans, (i % MOD) * (j % MOD) % MOD);
      if (ans == 0) {
        printf("%d\n", ans);
        return;
      }
    }
  }
  printf("%d\n", ans);
}

int main() {
  int L, R;
  cin >> L >> R;
  solve(L, R);
  return 0;
}

Measured memory_bytes: 256
D, G = map(int, input().split())
G = G // 100
P = []
C = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c//100)

minnum = 1e9
for i in range(0, 2**D):
    total = 0
    num = 0
    serach0 = [0] * D
    for j in range(D):
        if (i >> j) & 1:
            total += P[j]*(j+1) + C[j]
            num += P[j]
            serach0[j] = 1

    if total >= G:
        minnum = min(minnum, num)
        continue
    
    while 0 in serach0:
        idx = serach0.index(0)
        total_ = total
        num_ = num
        for _ in range(P[idx]):
            total_ += idx+1
            num_ += 1
            if total_ >= G:
                minnum = min(minnum, num_)
                break
        serach0[idx] = 1
print(minnum)

Measured memory_bytes: 43500
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li,li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li,li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

void Yes(li b){
  if(b)cout<<"Yes";
  else cout<<"No";
}
void yes(li b){
  if(b)cout<<"yes";
  else cout<<"no";
}

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cout.precision(16);

  li A,B;
  cin >>A>>B;

  Rep1(i,1250){
  	if(i*8/100 == A&&i/10==B){
  		cout<<i; return 0;
  	}
  }
  cout <<-1;
}



Measured memory_bytes: 3664
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

const int mod = 1e9+9;
const long double pi = acos(-1);

// FOR DEBUGGING
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", ";
	else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifndef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

ll power(ll x, ll y){
	x %= mod;
	ll ans = 1;
	while(y){
		if(y&1) ans = (ans*x)%mod;
		y /= 2;
		x = (x*x)%mod;
	}
	return ans;
}

void solve(){

	int s,w;
	cin >> s >> w;
	if(w>=s) cout << "unsafe";
	else cout << "safe";

	return;
}

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\n";
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

Measured memory_bytes: 3844
#include <iostream>
#include <vector>

int main(){
    int n;
    std::cin >> n;
    std::vector<int> v0(n), v1(n);
    for (int i = 0; i < n; i++){
        int a;
        std::cin >> a;
        v0[i] = a;
        v1[i] = a;
    }
    int q;
    std::cin >> q;
    while(q--){
        int b, m, e;
        std::cin >> b >> m >> e;
        for (int i = b; i < e; i++){
            int idx = b + ((i + e - b - m) % (e - b));
            int tmp = v0[idx];
            v0[idx] = v1[i];
        }
        v1 = v0;
    }
    for (int i = 0; i < n; i++){
        std::cout << v0[i];
        if (i < n - 1) std::cout << " ";
    }
    std::cout << std::endl;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;

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

typedef tree<int,null_type,less<int>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;


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

   
   
  int n,k;
  cin>>n>>k;

  vector<int>v(n);
  vector<int>af(n),all(n);
  for(int i=0;i<n;i++)
  {
    cin>>v[i];
    for(int j=0;j<i;j++)
    {
      if(v[j]<v[i])all[i]++;
    }
  }
  for(int i=0;i<n;i++)
  {
    for(int j=i+1;j<n;j++)
    {
      if(v[j]<v[i]){
        all[i]++; af[i]++;
      }
    }
  }

  int ans=0;
  for(int i=0;i<n;i++)
  {
    ans=(ans+(af[i]*k)%mod + ((k*(k-1)/2)%mod * all[i])%mod )%mod; 
  }
  cout<<ans<<"\n";
    
   
   

}



Measured memory_bytes: 256
N = input()
N = list(map(int, N))

if len(N) == 1:
    print(N[0])
else:
    if not all(map(lambda n: n == 9, N[1:])):
        for i in range(len(N)):
            if i == 0:
                N[i] -= 1
            else:
                N[i] = 9

    print(sum(N))

Measured memory_bytes: 3060
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e5+69, INF=2e9+6969;

ll n,T[R];
vector <ll> v,t;

int main()
{
	cin >> n;
	for(ll i=0;i<n;++i) cin >> T[i];
	t.pb(T[0]);
	for(ll i=1;i<n;++i) if(T[i]!=T[i-1]) t.pb(T[i]);
	v.pb(T[0]);
	for(ll i=1;i<t.size()-1;++i)
	{
		if(t[i]>t[i-1] && t[i]>t[i+1]) v.pb(t[i]);
		if(t[i]<t[i-1] && t[i]<t[i+1]) v.pb(t[i]);
	}
	v.pb(t[t.size()-1]);
	ll ans = 1000;
	ll st = 0;
	for(ll i=0;i<v.size()-1;++i)
	{
		//  prllf("%d ", v[i]);
		if(v[i]<v[i+1])
		{
			ll cur = ans / v[i];
			st = cur;
			ans %= v[i];
		}
		else if(v[i]>v[i+1])
		{
			ll cur = st*v[i];
			ans += cur;
			st = 0;
		}
	}
	if(st>0)
	{
		ans += st*v[v.size()-1];
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3772
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

#define MAX_A 100000

// i日後に支払われるのかでまとめる。
vector<int> salary[MAX_A];

int main()
{
	const int MAX_N = 100000;
	int n, m;
	cin >> n >> m;

	for (int i = 0; i < n; i++)
	{
		int _a, _b;
		cin >> _a >> _b;
		salary[_a].push_back(_b);
	}


	priority_queue<int> getMoneyJob;
	int answer = 0;

	// 期限まで1日前からはじめて、報酬を得られる仕事を追加していく。
	// 行った仕事は削除していく
	for (int i = 1; i <= m; i++)
	{
		// 報酬取得可能な仕事の追加
		int iSize = salary[i].size();
		if (iSize > 0)
		{
			for (int j = 0; j < iSize; j++)
				getMoneyJob.push(salary[i][j]);
		}

		// 最も高額なものを取り出す
		if (!getMoneyJob.empty())
		{
			answer += getMoneyJob.top();
			getMoneyJob.pop();
		}
	}

	cout << answer;


	return 0;
}



Measured memory_bytes: 5632
#include "bits/stdc++.h"

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

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

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

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

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

    var(size_t, x, y, z);

    output(y * x / 2);

    return 0;
}


Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define N 100010
int n,m,k;
int main()
{
	cin>>n>>m>>k;
	for(int i=0,ans;i<=n;i++)
	{
		ans=i*m;
		if(ans==k)
		{
			puts("Yes");
			goto aa;
		}
		for(int j=1;j<=m;j++)
		{
			ans+=n-i-i;
			if(ans==k)
			{
				puts("Yes");
				goto aa;
			}
		}
	}
	puts("No");
	aa:;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

#(方針)累積和が同じになっている箇所に注目してカウント（累積和が同じ = その部分の和が0）
#カウンタ
import collections
def counter_list(A):
  counter = collections.Counter(A)
  counter =  [list(e) for e in counter.items()]
  #counter.sort() #sortしたい場合はつける
  return counter

sum_acu = [] #累積和
tmp_sum = 0
for i in range(N):
  tmp_sum += A[i]
  sum_acu.append(tmp_sum)

ans = 0
count = counter_list(sum_acu)
for i in range(len(count)):
  if(count[i][0] == 0):
    l = count[i][1]
    ans += (l*(l+1))//2
  else:
    k = count[i][1]
    ans += ((k-1)*k)//2
print(ans)    

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

multimap<string,int> maap;
int x,q,tipe;
string r,l,key;

int main(){
    scanf("%d",&q);
    while(q--){
        scanf("%d",&tipe);
        if(tipe==0){
            cin>>key>>x;
            maap.insert(make_pair(key,x));
        } else if(tipe==1){
            cin>>key;
            int temp = maap.count(key);
            multimap <string,int>::iterator i;
            for (i = maap.equal_range(key).first;i!=maap.equal_range(key).second;i++)cout<<(*i).second<<endl;
        } else if(tipe==2){
            cin>>key;
            maap.erase(key);
        } else if(tipe==3){
            cin>>r>>l;
            multimap<string,int>::iterator itlow,itup;
            itlow = maap.lower_bound(r);
            itup = maap.upper_bound(l);
            for (auto i= itlow;i!=itup;i++){
                cout<<i->first<<" "<<i->second<<endl;
            }
        }
    }
return 0;
}



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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

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

       ld x;

       cin>>x;

       li tp=100;

        f(i,1,4000)
        {
            tp+=(0.01*(ld)tp);

            if(tp>=x)
            {
                cout<<i;
                return 0;
            }
        }

    return 0;
}

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

int main(void) {
	int n, m, a[100], total = 0,c = 0;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		total += a[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] * 4 * m >= total) c++;
	}
	if (c >= m)cout << "Yes" << endl;
	else cout << "No" << endl;
	 return 0;
	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
int main(void){
    int a,b,c;
    double S,L,h,rad;
    scanf("%d %d %d", &a,&b,&c);
    rad = M_PI / 180.0 * c;
    h = b * sin(rad);
    S = a*b*sin(rad)/2.0;
    L = a + b + sqrt(a*a+b*b-2.0*a*b*cos(rad));
    printf("%f\n%f\n%f\n",S,L,h);
    return(0);
}

Measured memory_bytes: 636
// BCC
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
#include <queue>

// GCC
// #include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define each(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define pb push_back
#define mp make_pair

typedef long long ll;

const int INF = 1 << 28;
const ll INFLL = 1ll << 56;


/**
 * ??¨????????????????????????
 * ?´???°??¨??¨?´???°?????????????????????
 */

const int SIEVE_SIZE = 1000000;

bool is_prime[SIEVE_SIZE];
vector<int> primes;

void eratosthenes()
{
	primes.clear();
	for (int i = 2; i < SIEVE_SIZE; i++) is_prime[i] = true;
	
	for (int i = 2; i * i < SIEVE_SIZE; i++){
		if (!is_prime[i]) continue;
		for (int j = i * i; j < SIEVE_SIZE; j += i){
			is_prime[j] = false;
		}
	}
	
	for (int i = 2; i < SIEVE_SIZE; i++){
		if (is_prime[i]) primes.pb(i);
	}
}

int sum[1000000];

int main()
{
	eratosthenes();
	each(p, primes) sum[*p]++;
	rep(i, 999999) sum[i + 1] += sum[i];
	
	int n;
	while (~scanf("%d", &n)){
		printf("%d\n", sum[n]);
	}
}

Measured memory_bytes: 6404
#pragma GCC optimize ("-Ofast")
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(a) (long long)a.size()
#define all(a) a.begin(), a.end()
#define reset(a, n) a.clear(), a.resize(n)
#ifndef ONLINE_JUDGE
#define cin ___in
#endif
std::ifstream ___in("input.in");
using namespace std;
using ll = long long;
typedef pair<ll, ll> pi;
typedef vector<ll> vec;
typedef vector<vector<ll> > vvec;
typedef vector<pair<ll, ll> > vecpi;
typedef vector<vector<pair<ll, ll> > > vvecpi;
typedef set<ll> seti;
typedef set<pair<ll, ll> > setpi;
typedef multiset<ll> mseti;
typedef multiset<pair<ll, ll> > msetpi;
typedef map<ll, ll> mpi;

static const bool tc = 0;
static const ll mod = LLONG_MAX - 24;

void solve() {
        ll n, ans = 0;
        cin >> n;
        vec a(n);
        for(auto &it : a) cin >> it;
        for(int i = 0; i < n - 2; ++i) {
                for(int j = i + 1; j < n - 1; ++j) {
                        for(int k = j + 1; k < n; ++k) {
                                if(a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) continue;
                                //cout << a[i] << " " << a[j] << " " << a[k] << "\n";
                                ans += (a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i]);
                        }
                }
        }
        cout << ans;
}

int main() {
        srand(time(0));
        int T = 1;
        if(tc) cin >> T;
        for(int i = 1; i <= T; ++i) {
                #ifndef ONLINE_JUDGE
                cout << "----- " << i << " -----\n";
                #endif
                solve();
        }
        return 0;
}


Measured memory_bytes: 3600
N,X = list(map(int,input().split()))

f=[1]
p=[1]

for n in range(N):
    f.append(2*f[n]+3)
    p.append(2*p[n]+1)

def get_p(N,X):
    if N == 0:
        if X <= 0:
            return 0
        else:
            return 1
    if X == 1:
        return 0
    elif X > 1 and X <= f[N-1] + 1:
        return get_p(N-1,X-1)
    elif X == f[N-1] + 2:
        return p[N-1]+1
    elif X > f[N-1] + 2 and X <= 2*f[N-1] + 1: 
        return p[N-1] + 1 + get_p(N-1,X-(f[N-1]+2))
    else:
        return p[N]
    
print(get_p(N,X))

Measured memory_bytes: 61712
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,count=0; cin>>n>>m;
    vector <pair<int,int>> naka(m);
    for(int i=0;i<m;i++){
        int a,b; cin>>a>>b;
        naka[i]=make_pair(a,b);
    }
    int stop=1e9;
    sort(naka.begin(),naka.end());
    int x=0;
    for(int i=0;i<=n;i++){
        if(i==stop){
            count++;
            stop=1e9;
        }
        while(naka[x].first==i){
            stop=min(stop,naka[x].second);
            x++;
        }
    }
    cout<<count<<endl;
}

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

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

typedef vector<vector<int> > Graph;

vector<ll> A, ans;
Graph g;
vector<bool> visited ;
void dfs(const int cur, const ll sum) {
  //  cout << "DFS" << cur << "=" << sum << endl;
  visited[cur] = true;
  ans[cur] += sum;
  REP(i, g[cur].size()) {
    int nxt = g[cur][i];
    if(visited[nxt]) continue;
    dfs(nxt, ans[cur]);

  }
}

int main() {
  int N, Q; cin>>N>>Q;
  ans = vector<ll> (N, 0);
  g = Graph(N);
  visited = vector<bool>(N, false);
  REP(i,N-1) {
    int a, b; cin>>a>>b; a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  REP(i,Q) {
    int p, x;
    cin>>p>>x; p--;
    ans[p] += x;
  }
  //  pp(A, N);
  dfs(0,0);
  REP(i,N) {
    if(i > 0) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 24320
N,W = map(int, input().split())
dp = [0]*(W+1)
temp = [0]*(W+1)

for i in range(1,N+1):
    v,w = map(int,input().split())
    for j in range(w, W+1):
        dp[j] = max(temp[j-w]+v,temp[j])
    temp[0:W+1] = dp[0:W+1]

print(dp[W])

Measured memory_bytes: 6660
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		//対象の文字列をセット
		String strTgt = sc.next();

		//文字の位置をセット
		long lngCharPos = sc.nextLong();

		char charResult = 0;
		for(int i = 0;  i < strTgt.length() && i < lngCharPos; i++) {

			//i番目の文字を取得
			charResult = strTgt.charAt(i);

			//「1」以外の場合
			if(charResult != '1') {
				break;
			}

		}

		//アウトプット
		System.out.println(charResult);

	}

}


Measured memory_bytes: 35768
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
h = w = 0

for i, cnt in Counter(A).items():
    if cnt >= 2 and i > w:
        if i > h:
            if cnt >= 4:
                h = i
                w = i
            else:
                w = h
                h = i
        else:
            w = i
            
print(w * h)

Measured memory_bytes: 18600
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int n,H,in[405],out[405],B[405],s[405],tote,size[405];
inline int getfa(int x){return s[x]?s[x]=getfa(s[x]):x;}
inline void Merge(int f,int t){if(getfa(f)!=getfa(t)) size[getfa(t)]+=size[getfa(f)],s[getfa(f)]=getfa(t);}
int main()
{
    n=read();H=read();
    for(int i=1;i<=n;++i)
    {
        int a=read(),b=read(),c=read(),d=read();
        int f=c?c+H:a,t=d?d:b+H;
        if(f==t) B[f]=1; else
        {
            ++out[f],++in[t];
            Merge(f,t);++size[getfa(f)];++tote;
        }
      //  cout<<f<<" "<<t<<endl;
    }
    int S=0;
    for(int i=1;i<=H*2;++i)
    {
       // cout<<i<<" "<<in[i]<<" "<<out[i]<<endl;
        if(B[i]&&!in[i]&&!out[i]) return 0*puts("NO");
        if(i> H&&out[i]>in[i]) return 0*puts("NO");
        if(i<=H&&out[i]<in[i]) return 0*puts("NO");
        if(out[i]!=in[i])
            if(S) Merge(S,i);
            else S=i;
    }
    if(!S||size[getfa(S)]!=tote) return 0*puts("NO");
    puts("YES");
    return 0;
}


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

using namespace std;

int main(){
string s;
cin >> s;
if(s=="zyxwvutsrqponmlkjihgfedcba"){cout << -1; return 0;}
int a[26];
for(int i = 0;i<26;i++) a[i] = 0;
for(int i = 0;i<s.size();i++){
    a[s[i]-'a'] = 1;
}
for(int i = 0;i<26;i++){
    if(a[i]==0){
        cout << s << char(i+'a');
        return 0;
    }
}
vector<int> b(26);
for(int i = 0;i<26;i++){
    b[i] = (int)(s[i] - 'a');
}
//for(auto x : b) cout << x << ' ';
//cout << endl;
next_permutation(b.begin(),b.end());
//for(auto x : b) cout << x << ' ';
//cout << endl;
for(int i = 0;i<26;i++){
    if(b[i]==s[i]-'a') cout << s[i];
    else{cout << char(b[i] + 'a'); return 0;}
}


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> ent(N);
    
    rep(i, Q){
        int A;
        cin >> A;
        ent.at(A-1)++;
    }
    
    rep(i, N){
        if(ent.at(i) - Q + K > 0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}


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

using ll = long long;

ll mod = 2019;

ll power(ll a, ll n){
    if(n == 0) return 1;
    else if(n % 2 == 0){
        ll ret = power(a, n/2) % mod;
        return (ret * ret) % mod;
    }
    else{
        return (a * power(a, n-1)) % mod;
    }
}

int main (){
    string s;
    cin >> s;    
    ll n = s.size();
    //reverse(s.begin(),s.end());
    ll m[n + 1]; // j文字目までのmod2019の値
    m[0] = 0;
    for(ll i = n; i > 0; --i){
        m[n - i + 1] = (m[n - i] + power(10, n - i) * (s[i - 1] - '0')) % mod;
        //cout << m[n - i + 1] << endl;
    }
    ll cnt[mod];
    ll ans = 0;
    fill(cnt,cnt+mod,0);
    for(ll i = 0; i <=n; ++i){
        ans += cnt[m[i]];
        cnt[m[i]]++;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 5328
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int h,w;
    in>>h>>w;
    vector<string> s(h);
    for(auto&c:s) in>>c;
    vector<vector<int>> dp(h,vector<int>(w,INT_MAX));
    dp[0][0]=(s[0][0]=='#');
    fr(i,h) fr(j,w){
            if(i<h-1){
                if(s[i][j]!=s[i+1][j]) dp[i+1][j]=min(dp[i+1][j],dp[i][j]+1);
                else dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            }
            if(j<w-1){
                if(s[i][j]!=s[i][j+1]) dp[i][j+1]=min(dp[i][j+1],dp[i][j]+1);
                else dp[i][j+1]=min(dp[i][j+1],dp[i][j]);
            }
    }
    if(s[h-1][w-1]=='#') ++dp[h-1][w-1];
    cout<<dp[h-1][w-1]/2<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define int  long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
 
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define mod %1000000009
#define pi 3.14159265358979323846//20 decimals
#define ld long double
#define inf 1000000000
bool less_vectors(const vector<int>& a,const vector<int>& b) 
{
  return a.size() < b.size();
}
#define N 1000000

int32_t main()
{                
    IOS;
    /*#ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif*/
    int n;
    cin>>n;
    vi v(n+1);
    for(int i=1;i<=n;i++)
        cin>>v[i];
    vi pre(n+1,0);
    int x=0;
    vi cf(n+1,0);
    int c=0;
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        x^=v[i];
        pre[i]=x;
        c+=v[i];
        cf[i]=c;

    }
    for(int i=1;i<=n;i++)
    {
        int lo=1;
        int hi=i;
        while(lo<hi)
        {
            int mid=(lo+hi)>>1;
            int x=pre[mid-1]^pre[i];
            //trace3(mid,x,cf[i]-cf[mid-1]);
            if(x==cf[i]-cf[mid-1])
                hi=mid;
            else
                lo=mid+1;
        }
        //trace2(i,lo);
        ans+=(i-lo+1);
    }
    cout<<ans;


    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N, T;
int A[3010], B[3010];
vector<pii> food;
int dp[3010][3010];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> T;
    for(int i = 0; i < N; ++i){
        int A, B;
        cin >> A >> B;
        food.push_back({A, B});
    }
    sort(food.begin(), food.end());
    for(int i = 0; i < N; ++i){
        int A = food[i].first, B = food[i].second;
        for(int j = 0; j <= T; ++j){
            chmax(dp[i + 1][j], dp[i][j]);
            if(j + A < T) chmax(dp[i + 1][j + A], dp[i][j] + B);
            else if(j != T) chmax(dp[i + 1][T], dp[i][j] + B);
        }
    }
    int ans = 0;
    for(int i = 0; i <= T; ++i){
        chmax(ans, dp[N][i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35584
n,m=map(int,input().split())
a=[]
for i in range(m):
	x,y=map(int,input().split())
	a.append([x,y])
ans=0
for i in range(m):
	b=[a[i][0]]
	for j in range(n):
		for k in range(m):
			if k!=i and a[k][0] in b:
				b.append(a[k][1])
			elif k!=i and a[k][1] in b:
				b.append(a[k][0])
	if a[i][1] not in b:
		ans+=1
print(ans)


Measured memory_bytes: 3064
N, M = map(int, input().split())
limL = 1
limR = N
for i in range(M):
  L, R = map(int, input().split())
  limL = max([limL, L])
  limR = min([limR, R])

print(limR-limL+1) if limR-limL+1>0 else print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;
struct node {
    node() : children {vector<int>()}, parent {-1}, depth {} {};
    node(vector<int> cs) : children {cs}, parent {-1}, depth {} {};
    vector<int> children;
    int parent;
    int depth;
};

void const_tree(node* xs, int r){
    auto cs = xs[r].children;
    for(auto it = cs.begin(); it != cs.end(); ++it){
        xs[*it].parent = r;
        xs[*it].depth = xs[r].depth+1;
        const_tree(xs, *it);
    }
}

void print_tree(node* xs, int n){
    for(int i = 0; i < n; ++i){
        printf("node %d: parent = %d, depth = %d, ", i, xs[i].parent, xs[i].depth);
        if(xs[i].parent < 0){
            printf("root");
        } else if(xs[i].children.size() > 0){
            printf("internal node");
        } else {
            printf("leaf");
        }
        printf(", [");
        for(auto it = xs[i].children.begin(); it != xs[i].children.end(); ++it){
            if(it == xs[i].children.begin()){
                printf("%d", *it);
            } else {
                printf(", %d", *it);
            }
        }
        printf("]\n");
    }
}

int main(){
    int n;
    cin >> n;
    node ts[n];
    auto fs = new bool[n];
    for(int i = 0; i < n; ++i){
        int id;
        int cn;
        cin >> id >> cn;
        vector<int> cs {};
        for(int j = 0; j < cn; ++j){
            int temp;
            cin >> temp;
            fs[temp] = true;
            cs.push_back(temp);
        }
        ts[id] = node(cs);
    }
    int root = -1;
    for(int i = 0; i < n; ++i){
        if(!fs[i]){
            root = i;
            break;
        }
    }
    const_tree(ts, root);
    print_tree(ts, n);
}

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

class Program
{
	static void Main(string[] args)
    {
    	var input = Console.ReadLine();
      	Stack<string> s = new Stack<string>();
      	foreach (var i in input)
        {
        	if (i == '1')
            {
            	s.Push(i.ToString());
            }              
            if (i == '0')
            {
            	s.Push(i.ToString());
            }
          	if (i == 'B' && s.Count() > 0)
            {
            	s.Pop();
            }
        }
      	var count = s.Count();
        var a = "";
      	for (var i = 0; i < count; i ++)
        {
        	a += s.Pop();
        }
      	Console.WriteLine(string.Join("", a.Reverse()));
    }
}

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

namespace ITP1_8_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            string line = ReadSt();
            string target = ReadSt();

            for (int i = 0 ; i < line.Length ; i++)
            {
                string rS = line.Substring(i, line.Length - i) + line.Substring(0, i);
                if(rS.Contains(target))
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 17860
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>

using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;

int main()
{

    ll n, y;
    cin >> n;
    cin >> y;
    int aa = -1, bb = -1, cc = -1;

    for (int a = 0; a <= n; ++a)
    {
        for (int b = 0; b <= n; ++b)
        {
            if (a + b > n)
                break;
            int c = n - a - b;

            if (a * 10000 + b * 5000 + c * 1000 == y)
            {
                cout << a << " " << b << " " << c << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;
    return 0;
}

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

using namespace std;

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

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

const int MAX_R=1e5,MAX_C=1e5,MAX_N=1e5;
const ll INF=1e12;

int R,C;
int N;

vector<P> G[MAX_R+MAX_C];
bool flg[MAX_R+MAX_C];
ll val[MAX_R+MAX_C];

void dfs(int v){
	REP(i,(int)G[v].size()){
		P e=G[v][i];
		if (!flg[e.first]){
			val[e.first]=e.second-val[v];
			flg[e.first]=true;
			dfs(e.first);
		}
	}
}

void dfs2(int v,ll &x,ll &y){
	if (v<R){
		x=min(x,val[v]);
	}else{
		y=min(y,val[v]);
	}
	REP(i,(int)G[v].size()){
		P e=G[v][i];
		if (!flg[e.first]){
			flg[e.first]=true;
			dfs2(e.first,x,y);
		}
	}
}

void solve(){
	REP(i,R+C){
		if (flg[i]){
			continue;
		}
		flg[i]=true;
		val[i]=0;
		dfs(i);
	}
	//矛盾が起きてないかチェック
	REP(i,R+C){
		REP(j,(int)G[i].size()){
			P e=G[i][j];
			if (val[i]+val[e.first]!=e.second){
				printf("No\n");
				return;
			}
		}
	}
	//全てのvalを0以上にできるか
	memset(flg,false,sizeof(flg));
	REP(i,R+C){
		if (!flg[i]){
			ll x,y;
			x=y=INF;
			flg[i]=true;
			dfs2(i,x,y);
			if (x+y<0){
				printf("No\n");
				return;
			}
		}
	}
	printf("Yes\n");
}

int main(){
	scanf("%d %d",&R,&C);
	scanf("%d",&N);
	REP(i,N){
		int r,c,a;
		scanf("%d %d %d",&r,&c,&a);
		r--;
		c--;
		G[r].push_back(P(R+c,a));
		G[R+c].push_back(P(r,a));
	}
	solve();
	return 0;
}


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

int main(){
    string o,e,ans;
    cin >> o;
    cin >> e;

    rep(i,(o.size()+1)){
        if(i < o.size())ans.push_back(o[i]);
        if(i < e.size())ans.push_back(e[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    ll mx = -1e7, mi = 1e7;
    int mx_cur = -1, mi_cur = -1;
    rep(i,n){
        cin >> a[i];
        if(mx < a[i]){
            mx = a[i];
            mx_cur = i;
        }
        if(a[i] < mi){
            mi = a[i];
            mi_cur = i;
        }
    }
    cout << 2*(n-1) << endl;
    if(abs(mx) >= abs(mi)){
        for(int i = 1; i < n; ++i){
            a[i] += mx*2;
            mx = a[i];
            cout << mx_cur + 1 << " " << i+1 << endl;
            cout << mx_cur + 1 << " " << i+1 << endl;
            mx_cur = i;
        }
    }
    else{
        for(int i = n-2; i >= 0; --i){
            a[i] += mi*2;
            mi = a[i];
            cout << mi_cur + 1 << " " << i+1 << endl;
            cout << mi_cur + 1 << " " << i+1 << endl;
            mi_cur = i;
        }
    }
    return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            int[] iarray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int N = iarray[0];
            int K = iarray[1];
            string val = Sinsu(N, K, "");
            Console.WriteLine(val.Length);

        }

        public static string Sinsu(int n, int k, string str)
        {
            str = n % k + str;
            n /= k;
            if (n != 0)
                return Sinsu(n, k, str);
            return str;
        }
    }
}


Measured memory_bytes: 13268
S2 = input()
N = len (S2)
Z2 = '0'
O2 = '1'
for i in range(1,N):
    if (i+1)%2==0:
        Z2+='1'
        O2+='0'
    else:
        Z2+='0'
        O2+='1'

S10 = int(S2,2)
Z10 = int(Z2,2)
O10 = int(O2,2)
ChangeSZ=bin(S10^Z10).count('1')
ChangeSO=bin(S10^O10).count('1')
print(min(ChangeSZ,ChangeSO))

Measured memory_bytes: 3444