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

using namespace std;

typedef long long ll;

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)
#define sz(x)        ((ll)(x).size())
#define inf          1<<25

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

int main() {
    ll x, y, z;
    cin >> x >> y >> z;
    
    ll l = 0;
    ll r = x;
    while (l + 1 < r) {
        ll m = (l + r) / 2;
        
        if (m * y + (m + 1) * z <= x) l = m;
        else r = m;
    }
    cout << l << endl;
    return 0;
}

Measured memory_bytes: 256
// ABC 061 C

#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(v) int(v.size())

typedef long long ll;

using namespace std;

const int mod = 1000000007;
const int INF = int(1e+6);

int main(int argc, char** argv) {
  int n;
  ll k;
  cin >> n >> k;
  vector<pair<int, int>> foo(n);

  rep(i, n) {
    int a, b;
    cin >> a >> b;
    foo[i] = make_pair(a, b);
  }

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

  ll count = 0;
  rep(i, n) {
    count += foo[i].second;
    if (count >= k) {
      cout << foo[i].first << endl;
      break;
    }
  }

  return 0;
}


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

int main() {
	long long n, p; cin >> n >> p;
	if (n == 1) {
		cout << p << endl;
		return 0;
	}
	vector<pair<int, long long>> v;
	double sq = sqrt(p);
	for (int i = 2; i <= sq; i++) {
		int cnt = 0;
		while (p % i == 0) {
			p /= i;
			cnt++;
		}
		if (cnt >= n) v.push_back(make_pair(i, cnt));
	}
	long long ans = 1;
	for (auto p : v) {
		long long m = p.second / n;
		for (int i = 0; i < m; i++) ans *= p.first;
	}
	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;

void Main() {
    int r, g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    int a,b;
    string s;
    cin >> a >> b >> s;
    bool f = true;
    if (s[a] == '-') f = true;
    else f = false;
    for (int i = 0;i < s.size();i++){
        if (i != a){
            if (s[i] == '-') f = false;
        }
    }    
    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string s;
    cin>>s;
    bool Iss[26]={false};
    for(int i=0;i<s.size();i++){
        Iss[s[i]-'a']=true;
    }
    for(int i=0;i<26;i++){
        if(!Iss[i]){
            cout<<char(i+'a')<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
int main (void){
	int S;
	int h, m, s;
	scanf ("%d", &S);
	h=S/3600;
	m=(S-h*3600)/60;
	s=(S-h*3600)%60;
	printf ("%d:%d:%d\n", h, m, s);
	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std ;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define F  first
#define S  second

/*
bool compare (pair<ll,ll> x,pair<ll,ll> y)
    {   
        if(x.F==y.F)return x.S<y.S;
        return x.F<y.F;
    }
*/
/*
ll lcm(ll a,ll b)
    {
        return (a*b)/__gcd(a,b) ;
    }
*/
int main()
{
    /*  if you are getting wrong on test case 2 then think of another proper logic 
        if you are getting wrong on test case 4 then think of edge cases 
        like n=0,n=n-1&& k=0&& k=k-1;
    */
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t>0)
    {
        t--;
        ll n,k,b,c,x,y,z;
        ll max=LONG_MIN;
        ll min=LONG_MAX;
        ll flag=0,sum=0;
        ll cnt=0,ans=0,gcd=1;
        cin>>n;
        ll a[4]={0};
        while(n>0)
            {
                n--;
                string s;
                cin>>s;
                if(s.compare("AC")==0)a[0]++;
                else if(s.compare("WA")==0)a[1]++;
                else if(s.compare("TLE")==0)a[2]++;
                else if(s.compare("RE")==0)a[3]++;
            }
        for(ll i=0;i<4;i++)
            {
                if(i==0)cout<<"AC x "<<a[i]<<"\n";
                else if(i==1)cout<<"WA x "<<a[i]<<"\n";
                else if(i==2)cout<<"TLE x "<<a[i]<<"\n";
                else if(i==3)cout<<"RE x "<<a[i]<<"\n";
            }
    
    }
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
const int iINF = 1001001001;
const long long llINF = 1LL << 60;
bool isPrime(ll num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

	for (ll i = 3; i*i <= num; i += 2) {
		if (num % i == 0) {
			return false;
		}
	}
	return true;
}
int main()
{
	vector<ll> sim;
	for (ll i = 3; i <= 100000; i += 2) {
		if (isPrime(i) && isPrime((i + 1) / 2))	sim.push_back(i);
	}
	//rep(i, sim.size())	cout << sim[i] << endl;
	int simSize = sim.size();
	int q;
	cin >> q;
	ll l, r;
	rep(i, q) {
		cin >> l >> r;
		int ans;
		int lower = -1, upper = simSize;
		int cur = (upper + lower) / 2;
		while (1 < upper - lower) {
			if (sim[cur] <= r)	lower = cur;
			else upper = cur;
			cur = (upper + lower) / 2;
		}
		ans = lower + 1;
		lower = -1; upper = simSize;
		cur = (upper + lower) / 2;
		while (1 < upper - lower) {
			if (sim[cur] < l)	lower = cur;
			else upper = cur;
			cur = (upper + lower) / 2;
		}
		ans -= lower + 1;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3424
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

unordered_map <string, ll> s;

int main() {
    

    ll n;
    cin >> n;
    ll ansmax = 0;
    for (ll i=0;i<n;i++){
        string tmp;
        cin >> tmp;
        s[tmp]++;
        if(s[tmp] > ansmax){
            ansmax = s[tmp];
        }
    }
    set <string> anslis;
    for (auto itr = s.begin(); itr != s.end(); itr++){
        if(itr->second == ansmax){
            anslis.insert(itr->first);
        }
    }
    for (auto itr = anslis.begin(); itr != anslis.end(); itr++){
        cout << *itr << endl;
    }



}

Measured memory_bytes: 33480
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	ll a, b; cin >> a >> b;
	ll cnt = 0;
	a = max( a-1, 0ll );
	for( int i = 0; i < 41; ++i ){
		if( i == 0 ){
			// cout << (b+1)/2 << ", " << (a+1)/2 << endl;
			if( ( (b+1)/2 - (a+1)/2 ) % 2 == 1 ){
				cnt += (1ll<<i);
			}
		} else{
			ll gsa = ( (1ll<<i) * (a/(1ll<<(i+1))) + max( a%(1ll<<(i+1)) - ((1ll<<i)-1) , 0ll ) );
			ll gsb = ( (1ll<<i) * (b/(1ll<<(i+1))) + max( b%(1ll<<(i+1)) - ((1ll<<i)-1) , 0ll ) );
			// cout << gsb << ", " << gsa << endl;
			if( (gsb - gsa) % 2 == 1 ){
				cnt += (1ll<<i);
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<iterator>
#include<deque>
#include<algorithm>
using namespace std;
#define rep(i,n) for(long long i = 0; i <(n) ; i++)
#define rep2(i,s,n) for(long long i = (s); i<(n) ; i++)
#define ll long long

int main(){
 ll H,K;
 cin >> H >> K;
 vector<ll> v{istream_iterator<ll>(cin), istream_iterator<ll>()};
 sort(v.begin(),v.end(),greater<ll>());
 if(K>=H){
   cout << 0 << endl;
   return 0;
 }
 ll sum = accumulate(v.begin() + K,v.begin() + H,0LL);
 cout << sum <<endl;
 return 0;
}


Measured memory_bytes: 2420
n,T = map(int,input().split())

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

ans = T
tmp = T

for i in range(1,n):
    #print(ans,tmp)
    if tmp < t[i]:
        ans += T
        tmp = T + t[i]
    else:
        ans += T - ( tmp - t[i])
        tmp = T + t[i]
        
print(ans)

Measured memory_bytes: 25200
from collections import deque

n = int(input())

commnad = ''
key = 0
dll = deque()
cur = 0

for i in range(n):
    tmp = input()
    if ' ' in tmp:
        command, key = tmp.split(' ')
    else:
        command = tmp

    if command == 'insert':
        dll.appendleft(key)
    elif command == 'delete':
        try:
            dll.remove(key)
        except:
            pass
    elif command == 'deleteFirst':
        dll.popleft()
    elif command == 'deleteLast':
        dll.pop()

res = ''
for i in dll:
    res += i
    res += ' '
print(res[:-1])


Measured memory_bytes: 69736
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}



ll my_gcd(ll& a, ll& b) {
	if (b == 0) return a;
	ll temp = a % b;
	return my_gcd(b, temp);
}



// long long型 n を、base 進法での、i 桁目の数が入った vector にする。
void ll_to_vector(ll base, ll n, vector<ll>& v) {
	ll tempo = n;

	ll n_digit = floor(log10(n) / log10(base)) + 1;
	v.assign(n_digit, 0);

	//ll n_digit = v.size();

	for (ll i = 0; i < n_digit; i++) {
		v.at(i) = tempo / pow(base, n_digit - 1 - i);
		tempo -= v.at(i) * pow(base, n_digit - 1 - i);
	}
}







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

	char limit = 'Z' - N + 1;

	rep(i, S.size()) {
		if (limit > S.at(i)) {
			S.at(i) += N;
		}
		else {
			S.at(i) += N - 26;
		}
	}


	cout << S << endl;
}

Measured memory_bytes: 256
"use strict"

const main = arg => {
  arg = arg.trim().split("\n");
  const A = parseInt(arg[0].split(" ")[0]);
  const B = parseInt(arg[0].split(" ")[1]);
  const C = parseInt(arg[0].split(" ")[2]);
  const X = parseInt(arg[0].split(" ")[3]);
  const Y = parseInt(arg[0].split(" ")[4]);
  
  // ABセットはA,Bをバラで1枚づつ買うのに比べお得か？
  const AB = 2 * C;
  
  if(A + B > AB) {
      let priceAB = AB * Math.min(X, Y);
      let soloPrice = 0;
      
      if(X > Y) {
        soloPrice = A * (X - Y);
      } else if(Y > X) {
        soloPrice = B * (Y - X);  
      }
      
      let partialAB = priceAB + soloPrice;
      let allAB = AB * Math.max(X, Y);
      
      // 余りが出ても全てABセットで買う方法と
      // 一部ABセットで買って、残りをバラで買う方法を比較して安い方
      console.log(Math.min(allAB, partialAB));
  } else {
      console.log((A * X) + (B * Y));
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 998244353
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n,a[MAXN];
int fact[MAXN],invf[MAXN],cnt[MAXN];
void add(int &a,int b) {a+=b; if(a>=MOD) a-=MOD;}
void dec(int &a,int b) {a-=b; if(a<0) a+=MOD;}
int pow_mod(int a,int i)
{
    int s=1;
    while(i)
    {
        if(i&1) s=1LL*s*a%MOD;
        a=1LL*a*a%MOD;
        i>>=1;
    }
    return s;
}
int comb(int n,int k)
{
    if(n<k) return 0;
    return 1LL*fact[n]*invf[k]%MOD*invf[n-k]%MOD;
}
int main()
{
    fact[0]=invf[0]=1;
    for(int i=1;i<=100000;i++) fact[i]=1LL*fact[i-1]*i%MOD;
    invf[100000]=pow_mod(fact[100000],MOD-2);
    for(int i=99999;i>=1;i--) invf[i]=1LL*invf[i+1]*(i+1)%MOD;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        cnt[a[i]]++;
    }
    if(a[1]!=0||cnt[0]!=1) {puts("0"); return 0;}
    int ans=1;
    for(int i=1;i<=n-1;i++) ans=1LL*ans*pow_mod(cnt[i-1],cnt[i])%MOD;
    printf("%d\n",ans);
    return 0;
}


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

typedef long long int ll;

#define endl '\n'

ll n,w;
ll dp[105][100005];
ll arr[105][2];

ll solve(ll u,ll v)
{
    if(v==0)return 0;
    if(v<0)return 1e18;
    if(u==n and v==0){
        return 0;
    }
    if(u==n){
        return 1e18;
    }

    if(dp[u][v]==-1)
    {
        dp[u][v] = min(solve(u+1,v),arr[u][0]+solve(u+1,v-arr[u][1]));
    }
    return dp[u][v];

}

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));

    cin>>n>>w;

    for(ll i=0;i<n;i++){
        cin>>arr[i][0]>>arr[i][1];
    }

    for(ll i=1e5;i>=0;i--){

        ll wi = solve(0,i);

        if(wi<=w){
            cout<<i<<endl;return 0;
        }
    }



}


Measured memory_bytes: 82304
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
const int mod=998244353;
int sed[6]={3,233,23,19260817,97,101};
int vsed[6];
struct data
{
	int a[6];
	friend bool operator < (data a,data b)
	{
		for(int i=0;i<6;++i)if(a.a[i]!=b.a[i])return a.a[i]<b.a[i];
		return 0;
	}
};
inline int kpow(int a,int b)
{
	int s=1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1)s=1ll*s*a%mod;
	return s;
}
long long ans;
int n,c[6],d[6];
char s[250050];
pair<int,int>s1[6];
map<data,int>mp;
void work(char cur)
{
	for(int i=0;i<6;++i)
	{
		if(cur=='>')s1[i].first=1ll*s1[i].first*vsed[i]%mod;
		else if(cur=='<')s1[i].first=1ll*s1[i].first*sed[i]%mod;
		else if(cur=='+')(s1[i].second+=s1[i].first)%=mod;
		else (s1[i].second+=mod-s1[i].first)%=mod;	
	}
}
data get(int x[6])
{
	static data now;
	for(int i=0;i<6;++i)now.a[i]=(1ll*x[i]*s1[i].first+s1[i].second)%mod;
	return now;
}
int main()
{
	for(int i=0;i<6;++i)vsed[i]=kpow(sed[i],mod-2);
	scanf("%d %s",&n,s+1);
	for(int i=n;i;--i)
		for(int j=0;j<6;++j)
		{
			if(s[i]=='>')c[j]=1ll*c[j]*vsed[j]%mod;
			else if(s[i]=='<')c[j]=1ll*c[j]*sed[j]%mod;
			else if(s[i]=='+')(c[j]+=1)%=mod;
			else (c[j]+=mod-1)%=mod;			
		}
	for(int j=0;j<6;++j)s1[j].first=1;
	++mp[get(c)];
	for(int i=1;i<=n;++i)
	{
		work(s[i]);
		ans+=mp[get(d)];
		++mp[get(c)];
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 39552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    vector<double> v(n);
    for(int i =0 ; i < n; i++) cin >> v[i];
    while(v.size() != 1){
        sort(all(v));
        double x = (v[0] + v[1]) / 2;
        v.erase(v.begin());
        v.erase(v.begin());
        v.pb(x);
    }
    cout << fixed << setprecision(6) << v[0];
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/27  Problem: ABC 114 B / Link: http://abc114.contest.atcoder.jp/tasks/abc114_b  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	string s; cin >> s;
	ans = LINF;
	FOR(i, 0, SZ(s)) {
		string t = s.substr(i, 3);
		if (SZ(t) == 3) {
			int x = stoi(t);
			ans = min(ans, abs(x - 753LL));
		}
	}
	
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
s = gets.split().map { |i| i.to_i }
a = []
ans = 0
s[0].times do |i|
	a[i] = gets.split.map(&:to_i)
end

s[0].times do |i|
	if a[i][0] >= s[1] && a[i][1] >= s[2]
		ans += 1
	end
end

puts ans




Measured memory_bytes: 1788
from collections import deque
n=int(input())
graph=[[] for i in range(n)]#0-indexed
edges=[tuple(map(int,input().split())) for i in range(n-1)]#1-indexed
edge_color={(edges[i][0]-1,edges[i][1]-1):0 for i in range(n-1)}#0-indexed
vertex=[0 for i in range(n)]
for i in edges:
  a,b=i[0],i[1]
  a-=1;b-=1
  graph[a].append(b)
  graph[b].append(a)
color=0;most_connected=0
for i in range(n):
  if len(graph[i])>color:
    color=len(graph[i])
    most_connected=i
visited=[False]*n
bfs=deque([most_connected])
while bfs:
  v=bfs.popleft()
  visited[v]=True
  for i in graph[v]:
    if visited[i]:continue
    I,V=i,v
    if i<v:
      I,V=v,i
    
    edge_color[(V,I)]=vertex[v]%color+1
    vertex[V],vertex[I]=edge_color[(V,I)],edge_color[(V,I)] 
    bfs.append(i)
print(color)
for i in edges:
  print(edge_color[(i[0]-1,i[1]-1)])


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back

constexpr auto inf = numeric_limits<int>().max() - 1;
constexpr auto llinf = numeric_limits<ll>().max() - 1LL;

template<typename ForwardIterator>
void dump(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << *it << " ";
	}
	cout << endl;
}

template<typename ForwardIterator>
void dump_map(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << (*it).first << ":" << (*it).second << " ";
	}
	cout << endl;
}
template<typename T>
void debug(initializer_list<T> list) {
  for (auto el : list) {
    cout << el << " ";
  }
  cout << endl;
}

constexpr ll mod = ll(1e9 + 7);

ll mult(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }

ll power(ll a, ll b) {
	ll result = 1LL;
	while (b) {
		if (b % 2LL) result = mult(result, a);
		a = mult(a, a);
		b /= 2LL;
	}
	return result;
}

ll divide(ll a, ll b) { return mult(a, power(b, mod - 2)); }

ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }

ll subtract(ll a, ll b) { return ((a - b) % mod + mod) % mod; }

void solve() {
  int n, k;
  cin >> n >> k;
  set<int> ok;
  rep(i, k) {
    int d;
    cin >> d;
    rep(j, d) {
      int p;
      cin >> p;
      ok.insert(p);
    }
  }
  cout << n - sz(ok);
	cout << "\n";
}

#define REPEAT 0
#define CASE 0

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#if REPEAT
		int t;
		cin >> t;
		repa(i, 1, t) {
			#if CASE
				cout << "Case #" << i << ": ";
			#endif
			solve();
		}
	#else
		solve();
	#endif
	return 0;
}


Measured memory_bytes: 3684
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<string, int> P;
long long int INF = 1e18;
long long int MOD = 1000000007;

long long int a[210000], b[210000];

int main(){
	
	int N;
	cin >> N;
	
	long long int rem = 0, ans = 0;
	
	for(int i = 0; i < N; i++){
		cin >> a[i];
		rem ^= a[i];
	}
	for(int i = 0; i < N; i++){
		cin >> b[i];
		rem ^= b[i];
	}
	
	for(int dig = 1; dig < 30; dig++){
		vector<long long int> v;
		for(int i = 0; i < N; i++){
			v.push_back(a[i] % (1 << dig));
		}
		sort(v.begin(), v.end());
		long long int cnt = 0;
		for(int i = 0; i < N; i++){
			long long int num = (1 << dig) - b[i] % (1 << dig);
			cnt += distance(lower_bound(v.begin(), v.end(), num), v.end());
		}
		cnt %= 2;
		ans += cnt * (1 << dig);
	}
	
	if(N % 2 == 1){
		cout << (ans ^ rem) << endl;
	}else{
		cout << ans << endl;
	}
	
	return 0;
}

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

int main(){

	int i;
	int a,b,c;
	int count = 0;

	cin >> a >> b >> c;

	for(i = a;i <= b;i++){
		if(c % i == 0)count++;

	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 3100
import sys


def input():
    return sys.stdin.readline().rstrip()

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():

    N,M =map(int,input().split())
    U = UnionFind(N)

    for i in range(M):
        a,b =map(int,input().split())
        U.union(a-1,b-1)

    s =0
    for i in U.roots():
        s =max(s,U.size(i))
    print(s)












if __name__ == "__main__":
    main()


Measured memory_bytes: 82520
import java.io.*;
 
class Main {
    public static void main(String[] args ) throws IOException{
        BufferedReader input = new BufferedReader(new InputStreamReader (System.in));
        int x = Integer.parseInt(input.readLine());
        int y = (int)Math.pow(x,3);
        System.out.println(y);
    }
}

Measured memory_bytes: 16876
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <bitset>
#include <stack>
#include <queue>
#include <map>
using namespace std;

typedef pair<int, int> pii;
typedef vector<pii> vpii;

double T, X;

int main(void){
    cin >> T >> X;
    printf("%lf\n", T/ X);

    return 0;
}

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

int main(){
  int N;
  double d;
  cin >> N;
  for (int i = 1; i < 50000; i++){
    d = i * 1.08;
    if((int)d == N){
      cout << i;
      return 0;
    }
  }
  cout << ":(";
  return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, R;
    cin >> N >> R;

    if (N>=10){
        cout << R <<endl;
    }else{
        cout << R+(100*(10-N)) << endl;
    }

}


Measured memory_bytes: 256
//This Code was made by Chinese_zjc_.
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<bitset>
#include<cmath>
#include<queue>
#include<stack>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<set>
#include<time.h>
// #include<windows.h>
#define int long long
#define PI 3.14159265358979323
#define INF 0x3fffffffffffffff
#define MOD 20060208
#define BASE 29
using namespace std;
int n,cnt,have[26],ans;
string s[200005];
struct tree{
    int son[26],has[26],now;
    bool close;
}t[1000005];
void add(int i,int now,int u)
{
    if(now==(int)s[i].length())
    {
        return;
    }
    for(int j=0;j<26;++j)
    {
        t[u].has[j]+=have[j]>0;
    }
    --have[(int)s[i][now]];
    if(t[u].son[(int)s[i][now]])
    {
        add(i,now+1,t[u].son[(int)s[i][now]]);
    }
    else
    {
        t[++cnt].now=s[i][now];
        add(i,now+1,t[u].son[(int)s[i][now]]=cnt);
    }
}
void work(int i,int now,int u)
{
    if(now==(int)s[i].length()-1)
    {
        ans+=t[u].has[(int)s[i].back()]-1;
        return;
    }
    work(i,now+1,t[u].son[(int)s[i][now]]);
}
signed main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    t[0].now=-1;
    for(int i=1;i<=n;++i)
    {
        cin>>s[i];
        for(int j=0;j<<1<(int)s[i].length();++j)
        {
            swap(s[i][j],s[i][s[i].length()-j-1]);
        }
        for(int j=0;j<26;++j)
        {
            have[j]=0;
        }
        for(int j=0;j<(int)s[i].length();++j)
        {
            s[i][j]-='a';
            ++have[(int)s[i][j]];
        }
        add(i,0,0);
    }
    // cout<<cnt<<endl;
    // for(int i=0;i<=cnt;++i)
    // {
    //     cout<<t[i].now<<' '<<t[i].has[0]<<' '<<t[i].has[1]<<' '<<t[i].has[2]<<endl;
    // }
    for(int i=1;i<=n;++i)
    {
        work(i,0,0);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 432068
const main = arg => {
  const input = arg.trim().split("\n");


  var x = parseInt(input[0].split(" ")[0]);
  var y = parseInt(input[0].split(" ")[1]);
  var z = parseInt(input[0].split(" ")[2]);
  var tmp = 0;


  tmp = x;
  x = y;
  y = tmp;

  tmp = x;
  x = z;
  z = tmp;

  console.log(x + ' '  + y + ' ' + z);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 7372
h, w = map(int, input().split())
A = [input() for i in range(h)]
row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if A[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(A[i][j], end = '')
        print()

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

int main() {
  int N;
  cin >> N;
  
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int l, r;
    cin >> l >> r;
    
    ans += r - l + 1;
  }
  
  cout << ans << endl;
}

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

nums = []
nos = []
for no in range(N):
    num = A[no]  # 1, num = 3
    nums.append(num)
    nos.append(no)

Z = [str(x + 1) for _, x in sorted(zip(nums, nos))]

print(' '.join(Z))

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

typedef struct{
  char suit,value;
}Card;

void Bubble(Card A[],int n){
  int i,j;
  Card f;
  for(i=0;i<=n-1;i++){
    for(j = n-1;j>=i+1;j--){
      if(A[j].value<A[j-1].value){
          f = A[j];
          A[j]=A[j-1];
          A[j-1]=f;
        }
      }
    }
  }

void Selection(Card A[], int n){
  int i,j,minj,a,b;
  Card t;
  for(i=0;i<=n-1;i++){
      minj=i;
      for(j = i;j<=n-1;j++){
        if(A[j].value<A[minj].value){
          minj=j;
        }
      }
      t =A[i];A[i] = A[minj];A[minj]=t;
    }
  }

int isStable(Card C1[],Card C2[],int n){
  int i;
  for(i=0;i<n;i++){
    if(C1[i].suit != C2[i].suit)return 0;
  }
  return 1;
}

int main(){
  int i,j,n;
  Card C1[100],C2[100];
  char as,s[3];
  scanf("%d",&n);
  for(i = 0;i<n;i++){
    scanf("%s",s);
    C1[i].suit=s[0];
    C1[i].value=s[1];
  }
  for(i=0;i<n;i++)C2[i]=C1[i];
  Bubble(C1,n);
  Selection(C2,n);
  for(i=0;i<n-1;i++){
    s[0] = C1[i].suit;
    s[1]=C1[i].value;
    printf("%s ",s);
  }
  s[0] = C1[i].suit;
  s[1]=C1[i].value;
  printf("%s\n",s);
  printf("Stable\n");
  for(i=0;i<n-1;i++){
    s[0] = C2[i].suit;
    s[1]=C2[i].value;
    printf("%s ",s);
  }
  s[0] = C2[i].suit;
  s[1]=C2[i].value;
  printf("%s\n",s);
  if(isStable(C1,C2,n)){
    printf("Stable\n");
  }
  else{
    printf("Not stable\n");
  }
  return 0;
}

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

int a[110];

int main()
{
    int i, N, ans = 0;
    scanf("%d", &N);
    for(int i=1; i<=N; ++i){
        scanf("%d", &a[i]);
        if(i%2 && a[i]%2) ++ans;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (signed i = 0; i < (n); i++)
#define REP(i, s, n) for (signed i = (s); i < (n); i++)
#define int long long

signed main() {
    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    
    int x = 0, s = 0;
    int pre = 0, i = 0;
    int ans = 0;
    while(i <= N) {
        if (x == s) {
            ans += i - pre;
            x ^= A[i];
            s += A[i];
            i++;
        }
        else if (x < s) {
            x ^= A[pre];
            s -= A[pre];
            pre++;
        }

 
    }
    
    cout << ans << endl;
}

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

int main(){
    int N,M; cin >> N >> M;
    vector <int> A(M);
    vector <int> B(M);
    
    int maxA=1;
    int minB=1e5;
    rep(i,M){
        cin >> A[i] >> B[i];
        maxA=max(A[i],maxA);
        minB=min(B[i],minB);
    }
    if(minB-maxA>=0){
        cout << minB-maxA+1; 
    }else{
        cout << 0;
    }
}

Measured memory_bytes: 1152
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iostream>


using namespace std;

int main()
{
	map<string, int> count;
	int m = 0;
	string first;
	string second("");
	while (!cin.eof())
	{
		string s;
		cin >> s;
		if (count.count(s) == 0)
			count.insert(make_pair(s, 1));
		else
			count.find(s)->second++;

		if (count.find(s)->second > m)
		{
			first = s;
			m = count.find(s)->second;
		}

		if (s.size() > second.size())
			second = s;
	}
	cout << first << " " << second << endl;
	
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;


int main() {
	char s[3][105];
	
	for (int i = 0; i < 3; i++){
		scanf("%s", s[i]);
	}
	

	
	printf("A%cC\n",s[1][0]);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s;
    cin>>s;
    ll ans = 0;
    ll n = s.length();
    for (ll i = 0; i < n; i++){
        if (s[i] != s[n-1-i])ans++;
    }
    cout << ans/2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	set := make(map[int]int, 0)
	for i := 0; i < N; i++ {
		var v int
		fmt.Scan(&v)
		set[v]++
	}
	for i := 0; i < M; i++ {
		var b, c int
		fmt.Scan(&b, &c)
		set[c] += b
	}
	ks := make([]int, 0)
	for k := range set {
		ks = append(ks, k)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(ks)))
	// fmt.Println("N", N, "M", M, "set", set, "ks", ks)
	var ans int
	for i := 0; i < len(ks); i++ { // キーは降順に並んでいる。全部でN個になるまで大きい順に取り出していく
		if N-set[ks[i]] >= 0 {
			ans += ks[i] * set[ks[i]]
			N -= set[ks[i]]
		} else {
			ans += ks[i] * N
			N = 0
		}
		// fmt.Printf("i %d, ks[%d] %d, N %d, ans %d\n", i, i, ks[i], N, ans)
		if N == 0 {
			break
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 18432
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <stack>
#include <string>
#include <cmath>
#include <set>
#define SIZE 200005
#define MOD 1000000007
#define BT 20

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
typedef pair <P,P> PPP;

vector <int> vec[SIZE];
vector <int> nd[SIZE];
int dep[SIZE],id[SIZE];
int par[SIZE][BT];
int rev[SIZE];
int cnt[SIZE];
int now_id;
ll rt[SIZE];
int n;

void dfs(int v=0,int p=-1,int d=0)
{
	dep[v]=d;
	rev[now_id]=v;
	id[v]=now_id++;
	nd[d].push_back(v);
	par[v][0]=p;
	for(int i=0;i<vec[v].size();i++)
	{
		int to=vec[v][i];
		dfs(to,v,d+1);
	}
}
void make()
{
	for(int i=0;i+1<BT;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(par[j][i]==-1) par[j][i+1]=-1;
			else par[j][i+1]=par[par[j][i]][i];
		}
	}
}
int LCA(int a,int b)
{
	if(dep[a]>dep[b]) swap(a,b);
	for(int i=BT-1;i>=0;i--)
	{
		if(par[b][i]!=-1&&dep[par[b][i]]>=dep[a])
		{
			b=par[b][i];
		}
	}
	if(a==b) return a;
	for(int i=BT-1;i>=0;i--)
	{
		if(par[a][i]!=par[b][i])
		{
			a=par[a][i];
			b=par[b][i];
		}
	}
	return par[a][0];
}
int main()
{
	scanf("%d",&n);
	n++;
	for(int i=1;i<n;i++)
	{
		int p;
		scanf("%d",&p);
		vec[p].push_back(i);
	}
	for(int i=0;i<n;i++) cnt[i]=1;
	rt[0]=1;
	for(int i=1;i<=n;i++) rt[i]=rt[i-1]*2LL%MOD;
	dfs();
	make();
	ll ret=0;
	for(int i=0;i<n;i++)
	{
		if(nd[i].empty()) break;
		set <PP> st;
		set <PP>::iterator it;
		set <PPP> que;
		set <PPP>::iterator IT;
		for(int j=0;j<nd[i].size();j++)
		{
			int v=nd[i][j];
			st.insert(PP(id[v],P(1,1)));
			cnt[v]=1;
			if(j+1<nd[i].size())
			{
				int to=nd[i][j+1];
				int p=LCA(v,to);
				que.insert(PPP(P(-dep[p],p),P(id[v],id[to])));
			}
		}
		while(st.size()>1)
		{
			PPP p;
			int u,v;
			P q,r;
			
			IT=que.begin();
			p=*IT;
			que.erase(IT);
			u=p.second.first,v=p.second.second;
			u=rev[u],v=rev[v];
			it=st.lower_bound(PP(id[u],P(-1,-1)));
			q=it->second;
			it=st.lower_bound(PP(id[v],P(-1,-1)));
			r=it->second;
			
			
			st.erase(PP(id[u],q));
			st.erase(PP(id[v],r));
			int g=p.first.second;
			if(g!=u) q.second=(rt[cnt[u]]-q.first+MOD)%MOD;
			if(g!=v) r.second=(rt[cnt[v]]-r.first+MOD)%MOD;
			//if(i<=n) printf("%d %d : [%d %d %d] [%d %d %d]\n",i,g,u,q.first,q.second,v,r.first,r.second);
			cnt[g]=cnt[u]+cnt[v];
			P z=P(((ll) q.first*(ll) r.second+(ll) q.second*(ll) r.first)%MOD,(ll) q.second*(ll) r.second%MOD);
			it=st.lower_bound(PP(id[v],P(-1,-1)));
			if(it!=st.end())
			{
				int x=it->first;
				x=rev[x];
				int y=LCA(v,x);
				que.erase(PPP(P(-dep[y],y),P(id[v],id[x])));
				que.insert(PPP(P(-dep[y],y),P(id[g],id[x])));
			}
			if(it!=st.begin())
			{
				it--;
				int x=it->first;
				x=rev[x];
				int y=LCA(u,x);
				que.erase(PPP(P(-dep[y],y),P(id[x],id[u])));
				que.insert(PPP(P(-dep[y],y),P(id[x],id[g])));
			}
			st.insert(PP(id[g],z));
		}
		it=st.begin();
		P p=it->second;
		//printf("%d\n",p.first);
		ret+=(ll) p.first*(ll) rt[n-nd[i].size()]%MOD;
		if(ret>=MOD) ret-=MOD;
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 56436
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define BR cout<<endl;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const ll mod=1000000007;

ll powmod(ll x,ll y){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}

double expect(int x){
    double kitai,tem=0;
    for(int i=1;i<=x;i++){
        tem += i;
    }
    kitai = tem/x;
    cout << kitai << endl;
    return kitai;
    
}

int main(){
    int dist[5];
    rep(i,5)cin >> dist[i];

    int k;
    cin >> k;

    for(int j = 0;j < 5 ;j++){
    for(int i = 0;i < 5;i++){
        if(dist[i] - dist[j] > k){
            cout << ":(" << endl;
            return 0;
        }
    }
    }
     
    cout << "Yay!" << endl;

    


    return 0;
}



Measured memory_bytes: 3568
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	int n;
	cin >> n;
	
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	int q;
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		int b, e, t;
		cin >> b >> e >> t;

		swap_ranges(a.begin() + b, a.begin() + e, a.begin() + t);
	}

	bool sp = false;
	for (int i : a)
	{
		print((sp ? " " : "") << i);
		sp = true;
	}
	println("");
}


Measured memory_bytes: 3132
import java.util.Scanner;

public class Main {
	public static void main(String argv[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		int min = 1000000000;
		for(int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			if(arr[i] < min) min = arr[i];
		}

		for(int i = 1; i <= min; i++) {
			boolean devide = true;
			for(int j = 0; j < arr.length; j++) {
				if(arr[j] % i != 0) {
					devide = false;
				}
			}
			if(devide) System.out.println(i);
		}
	}
}


Measured memory_bytes: 26380
import java.time.LocalDate;
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String s = sc.next();
		LocalDate base = LocalDate.of(2019, 4, 30);
		LocalDate input = LocalDate.of(Integer.valueOf(s.substring(0, 4)),
				Integer.valueOf(s.substring(5, 7)),
				Integer.valueOf(s.substring(8, 10)));
		System.out.println(input.isAfter(base) ? "TBD" : "Heisei");
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;
const double PI = acos(-1);
struct P {
  double left, right;
  int lid;
  P(double left, double right) : left(left), right(right) { lid = -1; }
};

bool operator<(const P &a, const P &b) {
  return a.left < b.left;
}

// atan [-PI/2, 3*PI/2)
double my_atan2(double y, double x) {
  double res = atan2(y,x);
  if (res < -PI/2) res += 2*PI;
  return res;
}

double dpA[1500][1500];
double dpB[1500][1500];

int main() {
  int n, k;
  while(cin >> n >> k) {
    vector<P> S;
  
    double left[n], right[n];
    REP(i, n) {
      double x,y,r;
      cin>>x>>y>>r;
      double t1 = my_atan2(y, x);
      double t2 = asin(r/sqrt(x*x+y*y));
      double left = max(0.0, t1 - t2);
      double right = min(PI, t1 + t2);
      if (left >= PI || right <= 0) continue;
      S.push_back(P(left, right));
    }
    for (int i=S.size()-1; i>=0; --i) {
      REP(j, S.size()) {
        if (i==j) continue;
        if (S[j].left <= S[i].left && S[i].right <= S[j].right) {
          S.erase(S.begin() + i);
          break;
        }
      }
    }
    sort(ALL(S));
    REP(i, S.size()) {
      REP(j, i) {
        if (S[j].right > S[i].left) {
          S[i].lid = j;
          break;
        }
      }
    }
    REP(i, S.size()) {
      REP(j, k) {
        double len = S[i].right-S[i].left;
        int lid = S[i].lid;
        if (i==0 || j==0) {
          dpA[i][j] = len;
        } else if (lid == -1) { // 0~i-1 Å¤Êªð½à½È¢
          dpA[i][j] = dpB[i-1][j-1] + len;
        } else if (lid == 0) { // 0~i-1 Å¤Êªð½È¢ÌªêÂàÈ¢
          dpA[i][j] = dpA[0][1] + S[i].right - S[0].right;
        } else {                  
          dpA[i][j] = max(dpA[lid][j-1] + S[i].right-S[lid].right, // ¤ÊªðÂàÌÉ i ÔÚðÁ¦½àÌ
                          dpB[lid-1][j-1] + len);                  // ¤Êªð½È¢àÌÉ i ÔÚðÁ¦½àÌ
        }
        if (i==0) dpB[0][j] = len;
        else dpB[i][j] = max(dpB[i-1][j], dpA[i][j]);
      }
    }
    // REP(i, S.size())
    //   cout << S[i].left << " " << S[i].right << endl;
    // cout << dpB[S.size()-1][k-1] << endl;
    printf("%.12f\n", dpB[S.size()-1][k-1]/PI);
  }
}

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

long long MOD=1000000007LL;

int main(){
	int N;
	long long ans=1;
	cin >> N;
	
	map<int,long long> m;
	
	vector<bool> prime(1001,true);
	prime[1]=false;
	for(int i=2;i<=1000;i++){
		if(prime[i])for(int j=i+i;j<=1000;j+=i)prime[j]=false;
	}
	
	for(int i=1;i<=1000;i++){
		if(prime[i])m.insert(make_pair(i,0LL));
	}
	
	for(int i=2;i<=N;i++){
		int k=i;
		for(int p=2;p*p<=k;){
			if(k%p==0){
				k/=p;
				m[p]++;
			}else p++;
		}
		if(k>1)m[k]++;
	}
	
	for(auto p:m){
		ans*=p.second+1;
		ans%=MOD;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int ans = 0;
  int n;
  cin >> n;
  vector<int> L(n);
  for(int i=0;i<n;i++){
    cin >> L.at(i);
  }
  
  //昇順に並び替え
  sort(L.begin(),L.end());
  
  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(L.at(i)!=L.at(j) and L.at(j)!=L.at(k)){
          if(L.at(i)+L.at(j)>L.at(k)){
            ans++;
          }
        }
      }
    }
  }
  
  cout << ans << endl;

}

Measured memory_bytes: 3632
n = gets.to_i
ary = gets.split.map(&:to_i)

sum1 = 0
sum2 = ary.inject(:+)
ans = 10000000

n.times do |i|
  sum1 += ary[i]
  sum2 -= ary[i]
  ans = [ans, (sum1 - sum2).abs].min
end

puts ans


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e18;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

//約数列挙
template <class T>
vector<T> divisor(T x){
	vector<T> res;
	for(T i=1;i*i<=x;i++){
		if(x%i==0){
			res.push_back(i);
			if(i!=x/i){
				res.push_back(x/i);
			}
		}
	}
	return res;
}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> ret=divisor(n);
	ll ans=inf;
	for(auto x:ret){
		ll y=n/x;
		chmin(ans,x+y-2);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
package main

import "fmt"

func main() {
	var N, M, p, x int
	fmt.Scan(&N)
	t := make([]int, N)
	for i := range t {
		fmt.Scan(&t[i])
	}
	fmt.Scan(&M)
	for i := 0; i < M; i++ {
		fmt.Scan(&p, &x)
		r := 0
		for j := 0; j < len(t); j++ {
			if j+1 == p {
				r += x
			} else {
				r += t[j]
			}
		}
		fmt.Println(r)
	}
}

Measured memory_bytes: 512
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
b = q - k
c = [0]*n
for i in range(len(a)):
    a[i] -= 1
    c[a[i]] += 1
for i in range(n):
    if c[i] > b:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 8636
N, X, Y = map(int, input().split())
List = [0 for _ in range(N-1)]
for i in range(1,N):
  for j in range(i+1, N+1):
    num = min(j-i, abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X))
    List[num-1] += 1
for k in range(N-1):
  print(List[k])

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

using namespace std;

#define MAX 100005
#define ll long long
ll arr[MAX], cost[MAX];

int main()
{
    ll n;
    scanf("%lld", &n);
    for(ll i=1; i<=n; i++) scanf("%lld", &arr[i]);
    cost[1] = 0;
    for(ll i=2; i<=n; i++){
        ll x = max(i-1, 1LL);
        ll y = max(i-2, 1LL);
        ll ret1 = cost[x] + abs(arr[x]-arr[i]);
        ll ret2 = cost[y] + abs(arr[y]-arr[i]);
        cost[i] = min(ret1, ret2);
    }
    printf("%lld\n", cost[n]);
}


Measured memory_bytes: 1792