akhauriyash/Code-Regression huggingface dataset:
/**
 *  Hi, I'm Arpan.
 *
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v)         \
    for (auto &it : v) \
        cin >> it;
#define MOD 1000000007
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define fi first
#define se second
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

ll nCr(ll n, ll r) {
    ll res = 1;
    if (r > n - r) {
        r = n - r;
    }
    for(int i=0;i<r;i++) {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

/*******************************************/
//
void solve()
{
	int n;
	cin >> n;
	vi a(100000,0);
	set<vector<int>> s;
	for(int i=1;i<=99;i++){
		for(int j = 1;j<=99;j++){
			for(int k=1;k<=99;k++){
				int ans = i*i + j*j + k*k + i*j + j*k + k*i;
				//vi x = {i,j,k};
				//sortv(x);
				if(ans <= n){
					a[ans]++;
				}
			}
		}
	}

	for(int i=1;i<=n;i++){
		cout << a[i] << endl;
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
	//cin >> t;

    while (t--)
        solve();
    return 0;
}



Measured memory_bytes: 3660
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    int ans = n;
    rep(i, n) {
        bool ok = true;
        rep(j, n - i) {
            if (s[i+j] != t[j]) {
                ok = false;
            }
        }
        if (ok) {
            cout << ans << endl;
            return 0;
        }
        ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>

int main() {
  int array[5];
  for (int i = 0; i < 5; i++) {
    scanf("%d", &array[i]);
  }
  int tmp = 0;
  for (int i = 0; i < 5; i++) {
    if (array[i] == 0) {
      tmp = i + 1;
      break;
    }
  }
  printf("%d\n", tmp);
  return 0;
}

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

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int[] arrayA = new int[a];
        for (int i = 0; i < a; i++) {
            arrayA[i] = Integer.parseInt(sc.next());
        }
        int[] arrayB = new int[b];
        for (int i = 0; i < b; i++) {
            arrayB[i] = Integer.parseInt(sc.next());
        }
        int[] x = new int[m];
        int[] y = new int[m];
        int[] c = new int[m];
        for (int i = 0; i < m; i++) {
            x[i] = Integer.parseInt(sc.next());
            y[i] = Integer.parseInt(sc.next());
            c[i] = Integer.parseInt(sc.next());
        }

        // 主処理
        int minA = Arrays.stream(arrayA).min().getAsInt();
        int minB = Arrays.stream(arrayB).min().getAsInt();
        int result = minA + minB;
        for (int i = 0; i < m; i++) {
            int priceA = arrayA[x[i] - 1];
            int priceB = arrayB[y[i] - 1];
            int price = priceA + priceB - c[i];
            result = Math.min(result, price);
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 69176
import math
a,b,x=map(int,input().split())
ans = 0
if a*a*b==x:
    ans = math.pi/2
elif a*a*b/2 >= x:
    x/=a
    x=x*2/b
    ans = math.atan(x/b)
else:
    x/=a*a
    x=(b-x)*2
    ans = math.atan(a/x)
print(90-ans/math.pi*180)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int w[n];
    ll int g = 0;
    ll int h = 0;
    rep(i, n) {
        cin >> w[i];
        g += w[i];
    }
    ll int min_1 = 50000;
    rep(i, n){
        if(abs(g - h) < min_1){
            min_1 = abs(g - h);
            g -=w[i];
            h += w[i];
        }
    }
    cout << min_1 << endl;

}

Measured memory_bytes: 256
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N = int(readline())

    ans = N % 1000
    if ans == 0:
        print(0)
    else:
        print(1000-ans)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 10476
#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <tuple>

using namespace std;

#define INF 100000000;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
#define eps 1.0e-14;

int main(){
    string S;
    cin >> S;
    for(ll i = 0; i < S.size(); i += 2){
        cout << S[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata.Ecma335;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var c = ReadText();
            return c == "a" || c == "i" || c == "u" || c == "e" || c == "o" ? "vowel" : "consonant";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 25800
use proconio::input;

fn main() {
    input! {
        s: String,
    }

    solve(s);
}

fn solve(s: String) {
    if s.chars().nth(2) == s.chars().nth(3) && s.chars().nth(4) == s.chars().nth(5) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2160
#include <iostream>
#include <cmath>

using namespace std;

void solve()
{
	int N;
	cin >> N;
	while(N--)
	{
		double xa, ya, ra, xb, yb, rb;
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		if(d > ra + rb)
		{
			cout << 0 << endl;
		}
		else if(d + rb < ra)
		{
			cout << 2 << endl;
		}
		else if(d + ra < rb)
		{
			cout << -2 << endl;
		}
		else
		{
			cout << 1 << endl;
		}
	}
}

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

Measured memory_bytes: 1232
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String input = sc.next();
		if (N % 2 == 1) {
			System.out.println("No");
			System.exit(0);
		}
		for (int i = 0; i < N / 2; i++) {
			if (input.charAt(i) != input.charAt(N / 2 + i)) {
				System.out.println("No");
				System.exit(0);
			}
		}
		System.out.println("Yes");
	}
}


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

int main(){
int X, Y, Z;
cin >> X >> Y >> Z;

X -= Z;
int cnt = 0;

while(X >= 0){
X -= Y + Z;
if(X >= 0) cnt++;
}

print(cnt);
}



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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
int a, b;
cin >> a >> b;
if ((a + b) & 1) cout << "IMPOSSIBLE";
else cout << (a + b) / 2;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



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

int main() {
    
    char s[11],t1[12];
    
    scanf("%s",s);
    scanf("%s",t1);
    if(memcmp(s,t1,strlen(s))==0&&strlen(s)+1==strlen(t1))
    {
            printf("\nYes");
    }else{
        printf("\nNo");
    }
    
    
    return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (998244353)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

	int N; cin >> N;
	vl D(N); rep(i,N) cin >> D[i];
	if(D[0] != 0) {
		cout << 0 << endl;
		return 0;
	}
	rep1(i,N) {
		if(D[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	vl dp = D;
	sort(all(dp));
	dp.erase(unique(dp.begin(),dp.end()),dp.end());
	rep(i,dp.size()) {
		if(i != dp[i]) {
			cout << 0 << endl;
			return 0;
		}
	}
	ll ma = maxel(D);
	vl cnt(100005, 0); rep(i,N) cnt[D[i]]++;
	ll ans = 1;
	rep1(i,ma) {
		rep(j,cnt[i+1]){
			ans *= cnt[i];
			ans %= mod;
		}
	}
	cout << ans << endl;

	return 0;
}



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

int main() {
    int n;
    cin >> n;
    vector<ll> a (n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    ll x = 0;
    for(int i=1; i<=n; i++){
        if(i%2 == 0){
            x += -a.at(i-1);
        }
        else{
            x += a.at(i-1);
        }
    }
    cout << x << " ";
    for(int i=1; i<n; i++){
        cout << 2*a.at(i-1) - x << " ";
        x = 2*a.at(i-1) - x;
    }
}

Measured memory_bytes: 2048
#include<algorithm>
#include<queue>
#include<vector>
#include<iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;
    long long a[300010];
    long long back_sum[300100];
    long long front_sum[300010];
    for(int i = 0; i <= 300000; i++){
        back_sum[i] = 0;
        front_sum[i] = 0;
    }
    for(int i = 1; i <= 3 * n; i++){
        cin >> a[i];
    }
    priority_queue<long long , vector<long long>, greater<long long> > front;
    priority_queue<long long> back;
    for(int i = 1; i <= n; i++){
        front.push(a[i]);
        front_sum[n] += a[i];
    }
    for(int i = 2 * n + 1; i <= 3 * n; i++){
        back.push(a[i]);
    }
    for(int i = 2 * n + 1; i <= 3 * n; i++){
        back_sum[2 * n + 1] += a[i];
    }
    for(int i = n + 1; i <= 2 * n; i++){
        front_sum[i] = front_sum[i - 1] + a[i];
        front.push(a[i]);
        front_sum[i] -= front.top();
        front.pop();
    }
    for(int i = 2 * n; i >= n + 1; i--){
        back_sum[i] = back_sum[i + 1] + a[i];
        back.push(a[i]);
        back_sum[i] -= back.top();
        back.pop();
    }
    long long answer = front_sum[n] - back_sum[n + 1];
    for(int i = n + 1; i <= 2 * n; i++){
        answer = max(answer, front_sum[i] - back_sum[i + 1]);
    }
    cout << answer << endl;
    return 0;
}

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

int swap(int &a,int &b){
    int c;
    c=a;
    a=b;
    b=c;
}

int main(){
    int x,y,z;
    cin >>x >>y >>z;
swap(x,y);
swap(x,z);
cout <<x  <<" " <<y <<" " <<z <<endl;


return 0;
}

Measured memory_bytes: 256
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        print int(math.ceil(math.log(input(), 3)))
        
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

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

int main(void){
    long long int x, a, r, i, j, min;
    char s[5];
    scanf("%s", s);
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) printf("Bad");
    else printf("Good");
    
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
  int N, D, X;
  int A[100] = {};
  int i, j, k;
  scanf("%d", &N);
  scanf("%d %d", &D, &X);
  for(i = 0; i < N; i++){
    scanf("%d", &A[i]);
  }
  for(i = 0; i < N; i++){
    j = 0;
    while(j*A[i] + 1 <= D){
      X++;
      j++;
    }
  }
  printf("%d\n", X);
  return 0;
}


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

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

   int ans=0;
   for(int i=1;i<N;i++) if(a[i]>a[i-1]) ans++;
   cout<<ans<<endl;
   return 0;
}




Measured memory_bytes: 3120
W, H, N = map(int, input().split())

x1 = 0
x2 = W
y1 = 0
y2 = H

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        if x1 < x:
            x1 = x
    elif a == 2:
        if x2 > x:
            x2 = x
    elif a == 3:
        if y1 < y:
            y1 = y
    elif a == 4:
        if y2 > y:
            y2 = y

if x1 > x2 or y1 > y2:
    print(0)
else:
    print((x2 - x1) * (y2 - y1))

Measured memory_bytes: 3064
# coding: utf-8

x1,y1,x2,y2 = list(map(int,input().split()))

x3 = x2 - y2 + y1
y3 = y2 + x2 - x1
x4 = x1 - y2 + y1
y4 = y1 + x2 - x1

print(x3,y3,x4,y4)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
typedef pair<l_l,ll> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
template<class T> inline bool chmin(T& a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
ll h,w;
ll vis[55][55];
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
int main(){
    cin>>h>>w;
    vector<string> g(h);
    rep(i,h)cin>>g[i];
    ll bc=0;
    rep(i,h){
        rep(j,w){
            if(g[i][j]=='#')bc++;
        }
    }
    queue<lll> q;
    q.push({{0,0},1});
    rep(i,55){
        rep(j,55){
            vis[i][j]=0;
        }
    }
    vis[0][0]=1;
    while(q.size()){
        lll now=q.front();q.pop();
        ll nowx=now.fi.fi,nowy=now.fi.se,nowc=now.se;
        rep(i,4){
            if(nowx+dx[i]<0||nowx+dx[i]>=h||nowy+dy[i]<0||nowy+dy[i]>=w)continue;
            if(g[nowx+dx[i]][nowy+dy[i]]=='#'||vis[nowx+dx[i]][nowy+dy[i]])continue;
            q.push({{nowx+dx[i],nowy+dy[i]},nowc+1});
            vis[nowx+dx[i]][nowy+dy[i]]=nowc+1;
        }
    }
    if(!vis[h-1][w-1]){
        cout<<-1<<endl;
        return 0;
    }
    ll grid=h*w;
    ll ans=grid-bc-vis[h-1][w-1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3656
import java.util.*

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toLong)
    val lrcList = mutableListOf<Triple<Long, Long, Long>>()
    (1..m).forEach {
        val (l, r, c) = readLine()!!.split(' ').map(String::toLong)
        lrcList.add(Triple(l, r, c))
    }
    
    val branches = mutableMapOf<Long, MutableList<Pair<Long, Long>>>()
    (1..n).forEach { branches[it] = mutableListOf() }
    (1 until n).forEach { branches[it + 1]!!.add(Pair(it, 0)) }
    lrcList.forEach {
        branches[it.first]!!.add(Pair(it.second, it.third))
    }

    val queue = PriorityQueue<Pair<Long, Long>>(n.toInt(), Comparator { o1: Pair<Long, Long>?, o2: Pair<Long, Long>? ->
        if (o1!!.second > o2!!.second) 1 else -1
    })
    queue.add(Pair(1, 0))

    val minCost = Array(n.toInt() + 1) { Long.MAX_VALUE / 2 }
    minCost[1] = 0
    while (queue.isNotEmpty()) {
        val (cur, curCost) = queue.poll()
        val tos = branches[cur]!!
        for (branch in tos) {
            val (to, cost) = branch
            val nextCost = curCost + cost
            if (minCost[to.toInt()] > nextCost) {
                minCost[to.toInt()] = nextCost
                queue.add(Pair(to, nextCost))
            }
        }
    }

    val goalCost = minCost[n.toInt()]
    if (goalCost >= Long.MAX_VALUE / 2) {
        println(-1)
    } else {
        println(goalCost)
    }
}

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

int binSearch(int A[], int n, int key) {
	int left = 0, right = n,mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (A[mid] == key) return 1;
		else if (A[mid] < key) left = mid+1;   //+1???????????¨???????????§?????£??????
		else right = mid;                      //left<right
	}
	return 0;
}

int main() {
	int n,sum=0,q,S[100000],T[50000];
	cin>> n;
	for (int i = 0;i < n;i++) cin >> S[i];
	cin >> q;
	for (int i = 0;i < q;i++) {
		cin >> T[i];
		if(binSearch(S, n, T[i])) sum++;
	}
	cout << sum << endl;
}

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

#define int long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (long long)1000000007
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 500005


int32_t main(){
sp;
int a ,b;
cin>>a>>b;
int ans=0;
if(a<6)ans=0;
else if(a<13)ans=b/2;
else ans=b;
cout<<ans;
return 0;}


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

int H, W;

int main(){
	scanf("%d%d", &H, &W);
	long long small = LLONG_MAX;
	for(int i = 0; i < H; i++)
		if(i == 0 && H > 2){
			long long a = H / 3;
			long long b = (H - a) / 2;
			long long c = H - a - b;
			a *= W, b *= W, c *= W;
			small = min(small, max(a, max(b, c)) - min(a, min(b, c)));
		}else{
			long long area = (long long)H * W;
			long long a = (long long)i * W;
			long long x = W / 2, y = H - i;
			long long b = y * x;
			long long c = y * (W - x);
			small = min(small, max(a, max(b, c)) - min(a, min(b, c)));
		}
	for(int i = 0; i < W; i++)
		if(i == 0 && W > 2){
			long long a = W / 3;
			long long b = (W - a) / 2;
			long long c = W - a - b;
			a *= H, b *= H, c *= H;
			small = min(small, max(a, max(b, c)) - min(a, min(b, c)));
		}else{
			long long area = (long long)H * W;
			long long a = (long long)i * H;
			long long x = H / 2, y = W - i;
			long long b = y * x;
			long long c = y * (H - x);
			small = min(small, max(a, max(b, c)) - min(a, min(b, c)));
		}
	printf("%lld\n", small);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}



int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  ll n, d;
  cin >> n>> d;
  ll ans = 0;
  rep(i,n){
	  ll x, y;
	  cin >> x >> y;
	  if(x*x + y*y <= d*d){
		  ans++;
	  }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#define INF 1000000006
#define N 5000001
using namespace std;
int n,cnt;
int a[N],L[N],R[N];
void merge(int l,int m,int r){
  int n1=m-l,n2=r-m;
  for(int i=0;i<n1;i++) L[i]=a[l+i];
  for(int i=0;i<n2;i++)R[i]=a[m+i];
  L[n1]=INF,R[n2]=INF;
  int i=0,j=0;
  for(int k=l;k<r;k++){
    if(L[i]<=R[j]){
      a[k]=L[i],i++;
    }else {
      a[k]=R[j],j++;
    }
    cnt++;
  }
}
 
void msort(int l,int r){
  int m;
  if(l+1<r){
 m=(l+r)/2;
  msort(l,m);
  msort(m,r);
  merge(l,m,r);
  }
}
 
int main(){
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  msort(0,n);
  for(int i=0;i<n-1;i++) cout<<a[i]<<" ";
  cout<<a[n-1]<<endl<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 10332
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define double long double
#define pb push_back

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

const int inf = 2e18;

int calc(int n){
    int cnt=1, ans=0;
    while(cnt<=n){
        ans++;
        n-=cnt;
        cnt++;
    }
    return ans;
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;
    map<int , int > mp;
    if(n%2==0){
        while(n%2==0){
            mp[2]++;
            n/=2;
        }
    }
    for(int i=3;i*i<=n;i+=2){
        if(n%i==0){
            while(n%i==0){
                mp[i]++;
                n/=i;
            }
        }
    }
    if(n>2)mp[n]++;
    int ans=0;
    for(auto [x,y]: mp){
        ans+=calc(y);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define MOD 100000
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
 
int N, K;
vector<vector<int>> book(11);
vector<int> dp(2001, -1);

int main(void){
	
	scanf("%d %d", &N, &K);
	for(int i = 0; i < N; ++i){
	    int a, b; scanf("%d %d", &a, &b);
	    book[b].push_back(a);
	}
	
	for(int i = 1; i <= 10; ++i) if(book[i].size()) sort(book[i].begin(), book[i].end(), greater<int>());
	
    for(int i = 1; i <= 10; ++i){
        int sum = 0;
        for(int j = 0; j < book[i].size(); ++j){
            int t = j + 1;
            sum += book[i][j];
            book[i][j] = sum + (t - 1) * t;
        }
    }
    
    dp[0] = 0;
	for(int g = 1; g <= 10; ++g){
	    for(int k = K; k >= 0; --k){
	        if(dp[k] == -1) continue;
	        for(int b = 0; b < book[g].size(); ++b){
	            dp[k + b + 1] = max(dp[k + b + 1], dp[k] + book[g][b]);
	        }
	    }
	}
    printf("%d\n", dp[K]);
    
    return 0;
}



Measured memory_bytes: 3276
#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main(void)
{
	
	ll i,j,n,m;
	string s,t;
	cin>>s;
	cin>>t;
	n=s.length();
	m=t.length();
	
	
	ll dp[n][m];
	
	for(i=0;i<n;i++)
	for(j=0;j<m;j++)
	dp[i][j]=0;
	
	
	for(i=0;i<n;i++)
	{
		if(s[i]==t[0])
		{dp[i][0]=1;break;}
	}
	
	
	while(i<n)
	{
		dp[i][0]=1;
		i++;
	}
	i=0;
	for(j=0;j<m;j++)
	{
		if(s[0]==t[j])
		{dp[0][j]=1;break;}
	}
	
	while(j<m)
	{
		dp[0][j]=1;
		j++;
	}
	j=0;
	//cout<<"hey\n";
	for(i=1;i<n;i++)
	for(j=1;j<m;j++)
	{
		if(s[i]==t[j])
		{
			dp[i][j]=dp[i-1][j-1]+1;
		}
		
		else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		
	}
	
	//for(i=0;i<n;i++)
	//{for(j=0;j<m;j++)
	//	{
	//		cout<<dp[i][j]<<" ";
	//	}
	//	cout<<"\n";
	//}
	//cout<<"hello\n";
	string ans;
	
	for(j=m-1,i=n-1;j>0 && i>0;)
	{		
		if(s[i]==t[j])
		{ans+=s[i];i--;j--;}
		
		else {
				if(dp[i-1][j]>=dp[i][j-1])
				i--;
				else j--;
				
			 }
		
	}
	
		if(i==0 && dp[i][j]==1)
	{
		ans+=s[0];
	}
	
	else if(j==0 && dp[i][j]==1)
	{
		ans+=t[0];
	}
	
	ll l=ans.length();
	for(i=l-1;i>=0;i--)
	cout<<ans[i];
	
}

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

int main() {
  int N;
  double sum = 0.0,A;

  cin >> N;
  for(int i = 0; i < N; i++){
      cin >> A;
      sum += 1.0 / A;
  }

  sum = 1.0 / sum;

  cout << setprecision(16) << sum << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
      
        if(a == 5){
          if(b == 5){
            if(c == 7){
              System.out.println("YES");
            }else{
              System.out.println("NO");
            }
          }else if(b == 7){
            if(c == 5){
              System.out.println("YES");
            }else{
              System.out.println("NO");
            }
          }
        }else if(a == 7){
          if(b == 5){
            if(c == 5){
              System.out.println("YES");
            }else{
              System.out.println("NO");
            }
          }else{
            System.out.println("NO");
          }
        }else{
            System.out.println("NO");
        }
	}
}

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

using namespace std;

#define MAX 40000

int main(){
  int n, P1[MAX+1], P2[MAX+1], T[MAX+1];
  while(1){
    scanf("%d", &n);
    if ( n == 0 ) break;

    for ( int i = 1; i <= n; i++ ) {scanf("%d", &P1[i]); }
    for ( int i = 1; i <= n; i++ ) {scanf("%d", &P2[i]);}
    sort(P1+1, P1+n+1, greater<int>());
    sort(P2+1, P2+n+1, greater<int>());

    for ( int i = 0; i <= n; i++ ) T[i] = 0;

    int s = 1, t = 1;
    while( s <= n && t <= n ){
      while( P1[t] > P2[s] && t <= n ) t++;

      if ( t <= n && P2[s] >= P1[t] ){
    T[t]++;
    t++; s++;
      }
    }

    for ( int i = 1; i <= n; i++ ) T[i] += T[i-1];

    int k = -1;

    for ( int i = 1; i <= n; i++ ){
      if ( (i-T[i]) >= (i+2)/2 ) {
    k = i;
    break;
      }
    }

    if ( k == -1 || k == n ){ cout << "NA" << endl;}
    else  printf("%d\n",k);

  }
  return 0;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
const int MAXN = (1 << 20);

struct trie
{
	int psz, subtree_sz[MAXN];
    map<char, int> to[MAXN];

    trie() { psz = 0; }

    void init()
    {
    	for(int i = 0; i < psz; i++)
    		to[i].clear(), subtree_sz[i] = 0;
		psz = 1;
    }

    void add(string s)
    {
    	int u = 0;
    	subtree_sz[0]++;
    	for(char c: s)
    	{
    		if(!to[u].count(c))
                subtree_sz[psz] = 0, to[u][c] = psz++;
    		u = to[u][c];
    		subtree_sz[u]++;
    	}
    }
};

int n;
string s[MAXN];

void read()
{
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> s[i];
}

vector<int> que[MAXN];
trie t;

int k[MAXN], ans[MAXN], cnt[27][27];
string alph[MAXN];

void solve()
{
	t.init();
	for(int i = 0; i < n; i++)
		t.add(s[i]);

    int q;
    cin >> q;

    for(int i = 0; i < q; i++)
    {
    	cin >> k[i] >> alph[i];
		que[k[i] - 1].push_back(i);
    }

    for(int i = 0; i < n; i++)
	{
		for(int alpha = 0; alpha < 26; alpha++)
			for(int beta = 0; beta < 26; beta++)
                cnt[alpha][beta] = 0;

		int u = 0, to_add = 0;
		for(char c: s[i])
		{
			for(int l = 0; l < 26; l++)
				if(t.to[u].count(l + 'a'))
				{
					cnt[c - 'a'][l] += t.subtree_sz[t.to[u][l + 'a']];
					to_add -= t.subtree_sz[t.to[u][l + 'a']];
				}

			to_add += t.subtree_sz[u];
			u = t.to[u][c];
		}

		for(int Q: que[i])
		{
			ans[Q] += to_add + 1;
            for(int p = 0; p < 26; p++)
            	for(int j = p + 1; j < 26; j++)
                    ans[Q] += cnt[alph[Q][j] - 'a'][alph[Q][p] - 'a'];
		}
	}

    for(int i = 0; i < q; i++)
    	cout << ans[i] << endl;
}

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

	read();
	solve();
	return 0;
}


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

int main() {
 int N;
 cin >>N;
  ll a = 1;
  ll d = 1000000000+7;
  for(int i = 1;i<=N;i++){
    a = a*i%d;
  }
  cout << a << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int N;
vector<int> A;

int main()
{
	cin >> N;
	A = vector<int>(N);
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	
	sort(A.begin(), A.end(), greater<int>());
	int a, b;
	a = 0;
	b = 0;
	for (int i = 0; i < N; i++){
		if (A[i] == A[i + 1]){
			if (a == 0){
				a = A[i];
				i++;
			} else {
				b = A[i];
				break;
			}
		}
	}
	
	long long int ans = a;
	ans *= b;
	cout << ans << endl;
	
	return 0;
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int n;
  cin >> n;
  vector<ll> a(n + 1), b(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }

  whole(sort, a);
  whole(sort, b);

  ll res;

  if (n % 2 == 1) {
    res = b[(n + 1) / 2] - a[(n + 1) / 2] + 1;
  } else {
    res = (b[n / 2] + b[n / 2 + 1]) - (a[n / 2] + a[n / 2 + 1]) + 1;
  }

  cout << res << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 6336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,k;
  cin >> n >> k;
  ll lim=n*(n-1)/2-(n-1);
  if(lim<k) {
    cout << -1 << endl;
    return 0;
  }
  cout << n-1+lim-k << endl;
  lim-=k;
  for(ll i=0;i<n-1;i++) {
    cout << 1 << " " << i+2 << endl;
  }
  ll i=2,j=3;
  while(lim--) {
    cout << i << " " << j << endl;
    j++;
    if(j>n) {
      i++;
      j=i+1;
    }
  }
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


X = INT()

ans = 1

for i in range(int(X**0.5)+1):
	for p in range(2, 10):
		if i** p <= X:
			ans = max(ans, i**p)

print(ans)

Measured memory_bytes: 5156
#include <stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main(){
    int R[MAX], n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> R[i];
    
    int maxv = -2000000000;
    int minv= R[0];
    for (int i = 1; i < n; i++){
        maxv = max(R[i] - minv, maxv);
        minv = min(minv, R[i]);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3852
K=int(input())
R=K%50
L=K//50
a=[49+L]*50#50*L回掛かるモード
if R!=0:
  a=[49+L+50-R]*50
  a[0]+=1
  for i in range(50-R):
    a[i]-=51
print(50)
print(' '.join(map(str, a)))

Measured memory_bytes: 3060
cnt = 0
n = int(raw_input())
A = [int(raw_input()) for _ in range(n)]
G = [1] if n < 5 else [1, 4]
while G[-1]*3+1 <= n/3: G.append(G[-1]*3+1)
if n > 256: G.append(n/10*9)
G.reverse()

def insersionSort(g):
	global cnt
	for i in range(g, n):
		v = A[i]
		j = i - g
		while j >= 0 and A[j] > v:
			A[j+g] = A[j]
			j = j - g
			cnt += 1
		A[j+g] = v

def shellSort():
	for g in G:
		insersionSort(g)

shellSort()
print len(G)
print " ".join(map(str, G))
print cnt
print "\n".join(map(str, A))

Measured memory_bytes: 127152
import java.util.*;

public class Main 
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		
		HashSet<Integer> paper = new HashSet<Integer>();
		
		int count = 0;
		
		for(int i = 0; i < n ; i++)
		{
			int a = scan.nextInt();
			
			if(!paper.contains(a))
			{
				paper.add(a);
				count++;
			}
			else
			{
				paper.remove(a);
				count--;
			}
		}

		System.out.println(count);
		scan.close();
	}
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

int n, k;
vector<int> x_1(55), x_2(55), y_1(55), y_2(55), z_1(55), z_2(55);
map<int, int> mpx, mpy, mpz;

int compress(int n, int xyz, vector<int>& v1, vector<int>& v2) {
    vector<int> sx;
    for (int i = 0; i < n; i++) {
        int cmpx1 = v1[i];
        int cmpx2 = v2[i];
        sx.push_back(cmpx1);
        sx.push_back(cmpx2);
    }
    sort(sx.begin(), sx.end());
    sx.erase(unique(sx.begin(), sx.end()), sx.end());
    for (int i = 0; i < n; i++) {
        int idx1 = lower_bound(sx.begin(), sx.end(), v1[i]) - sx.begin();
        int idx2 = lower_bound(sx.begin(), sx.end(), v2[i]) - sx.begin();
        if (xyz == 0) {
            mpx[idx1] = v1[i];
            mpx[idx2] = v2[i];
        }
        else if (xyz == 1) {
            mpy[idx1] = v1[i];
            mpy[idx2] = v2[i];
        }
        else {
            mpz[idx1] = v1[i];
            mpz[idx2] = v2[i];
        }
    }
    return sx.size();
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> k;
    rep(i, n) {
        cin >> x_1[i] >> y_1[i] >> z_1[i];
        cin >> x_2[i] >> y_2[i] >> z_2[i];
    }
    int X = compress(n, 0, x_1, x_2);
    int Y = compress(n, 1, y_1, y_2);
    int Z = compress(n, 2, z_1, z_2);

    ll ans = 0;
    rep(x, X - 1) {
        rep(y, Y - 1) {
            rep(z, Z - 1) {
                int cnt = 0;
                rep(i, n) {
                    if (x_1[i] <= mpx[x] && mpx[x + 1] <= x_2[i]) {
                        if (y_1[i] <= mpy[y] && mpy[y + 1] <= y_2[i]) {
                            if (z_1[i] <= mpz[z] && mpz[z + 1] <= z_2[i]) cnt++;
                        }
                    }
                }
                if (cnt >= k) ans += (mpx[x + 1] - mpx[x]) * (mpy[y + 1] - mpy[y]) * (mpz[z + 1] - mpz[z]);
            }
        }
    }
    cout << ans << endl;
}

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

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int A[100010];
    fact();
    rep(i, N) cin >> A[i];
    sort(A, A + N, greater<int>());
    int ans = 0;
    rep(i, N) {
        ans = (ans + Mul(A[i], Mul(K, Div(P(N - i - 1, K - 1), P(N, K)))) + mod) % mod;
        //cout << Mul(ans, C(N, K)) << endl;
    }
    int ans2 = 0;
    sort(A, A + N);
    rep(i, N) {
        ans2 = (ans2 + Mul(A[i], Mul(K, Div(P(N - i - 1, K - 1), P(N, K)))) + mod) % mod;
        //cout << Mul(ans2, C(N, K)) << endl;
    }
    cout << Mul(ans - ans2 + mod, C(N, K)) << endl;

    return 0;
}


Measured memory_bytes: 17408
'''
ABC 131 D:Megalomania
Accepted    　:Yes
difficult   　: 
ペナルティ　  　:5分
実際の回答時間  :9分
WAの回数　     :0回
合計時間　　  　:9分
'''

def myAnswer(N:int,A:list,B:list) -> str:
   dic = {}
   # 締め切り時間をkey、作業時間をvalueにした辞書を作成
   for a,b in  zip(A,B):
      if(b in dic.keys()):
         dic[b].append(a)
      else:
         dic[b] = [a]
   now = 0
   dic = sorted(dic.items())
   for deadline,time in dic:
      time.sort()
      # print(deadline,time)
      for t in time:
         if(deadline < now + t):
            return "No"
         now += t
   return "Yes"

def modelAnswer(N:int,dic:dict) -> str:
   now = 0
   dic = sorted(dic.items())
   for deadline,time in dic:
      time.sort()
      for t in time:
         if(deadline < now + t):
            return "No"
         now += t
   return "Yes"

def main():
   N = int(input())
   dic = {}
   # A = []
   # B = []
   for _ in range(N):
      a,b = map(int,input().split())
      if(b in dic.keys()):
         dic[b].append(a)
      else:
         dic[b] = [a]
      # A.append(a)
      # B.append(b)
   print(modelAnswer(N,dic))
if __name__ == '__main__':
   main()

Measured memory_bytes: 60472
#include<iostream>
#include<cmath>
using namespace std;
int main(){
 int d,n;
  cin>>d>>n;
  if(d>=0&&d<=2&&n>=1&&n<=100){
  int hund=1;
  for(int i=0;i<d;i++)hund*=100;
  if(n==100)cout<<n*hund+1*int(pow(100,d))<<endl;
  else cout<<n*hund<<endl;
}
  return 0;
}


Measured memory_bytes: 256
def main():
  import math
  n=int(input())
  CSF=[list(map(int,input().split())) for _ in [0]*(n-1)]
  t=0
  for i in range(n-1):
    t=CSF[i][1]
    for csf in CSF[i:]:
      c,s,f=csf[0],csf[1],csf[2]
      t=math.ceil(max(s,t)/f)*f+c    
    print(t)
  print(0)
if __name__=='__main__':
  main()

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

int main()
{
    string ans = "No";
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= c && c <= b)
        ans = "Yes";
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,a[2222],res=0,m,l;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      m=max(a[i],a[j]);
      l=a[i]+a[j];
      for(int k=j+1;k<n;k++){
        if(l+a[k]>max(m,a[k])<<1)res++;
      }
    }
  }
  cout<<res;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int h,w;
    cin >>h>>w;
    vector<vector<char>> c(h,vector<char> (w,'.'));
    vector<vector<bool>> reach(h,vector<bool> (w,false));
    queue <pair<int,int>> q;
    rep(i,h){
        rep(j,w){
            cin >> c[i][j];
            if(c[i][j]=='#'){
                q.push(make_pair(i,j));
            }
        }
    }
    int count=0;
    int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
    while(!q.empty()){
        /*
        bool ans = true;
        bool Br = false;
        rep(k,h){
            rep(l,w){
                
                if(c[k][l]=='.'){
                    ans = false;
                    Br = true;
                    break;
                }
                
               //cout << c[k][l];
            }
            //cout<<endl;
            if(Br){
                break;
            }
        }
        if(ans){
            break;
        }
        */
        int size = q.size();
        for (int i = 0; i < size; i++)
        {
            pair<int, int> p = q.front();
            q.pop();
            rep(j, 4)
            {
                int ny = p.first + dy[j];
                int nx = p.second + dx[j];
                if (nx < 0 || ny < 0 || nx >= w || ny >= h)
                {
                    continue;
                }
                else if (c[ny][nx] == '#')
                {
                    continue;
                    //もう黒
                }
                else
                {
                    c[ny][nx] = '#';
                    //cout <<"dis["<<ny<<"]["<<nx<<"]="<<dis[ny][nx]<<endl;
                    q.push(make_pair(ny, nx));
                    //新しく確定マスをキューに入れる
                }
            }
        }
        count++;

        //cout <<"__________"<<endl;

    }
    cout << count-1<<endl;
}

Measured memory_bytes: 9616
n, k = map(int, input().split())
l = [_ for _ in range(n + 1)]

tmp_min = sum(l[0:k])
tmp_max = sum(l[-1:-k-1:-1])
x = tmp_max - tmp_min + 1

for i in range(n-k+1):
    tmp_min += l[k+i]
    tmp_max += l[-k-i-1]
    x += tmp_max - tmp_min + 1

print(x % (10**9+7))

Measured memory_bytes: 18296
#include<bits/stdc++.h>
using namespace std;
// include <ext/pb_ds/assoc_container.hpp>
// include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define ll long long
#define pll pair<ll,ll>
// typedef tree <ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi vector<ll>
#define vvi vector<vi>
#define P_Q priority_queue<ll>
#define p_q priority_queue<ll,vi,greater<ll>>
#define pb push_back
#define popb pop_back
#define ub upper_bound
#define lb lower_bound
#define loop(i,x,y,z) for(int i=x; i<=y; i+=z)
#define loopR(i,x,y,z) for(int i=x; i>=y; i-=z)
#define all(x) begin(x), end(x)
#define allR(x) rbegin(x), rend(x)
#define sum(x) accumulate(all(x),0LL)
#define minE(x) *min_element(all(x))
#define maxE(x) *max_element(all(x))
#define watch(x) cout<<(#x)<<" is "<<x<<'\n'
#define display(v,c) for(auto x:v) cout<<x<<c;
#define setbits(x) __builtin_popcount(x)
#define ctoi(x) (int)((x)-'a')
#define endl "\n"

int main(){
	IOS
	// do magic here
	ll n,ans=0;
	cin>>n;
	vi sticks(n);
	loop(i,0,n-1,1) cin>>sticks[i];
	sort(all(sticks));
	loop(i,0,n-1,1){
		loop(j,i+1,n-1,1){
			// cout<<sticks[i]<<" "<<sticks[j]<<endl;
			ll temp=sticks[i]+sticks[j];
			// watch(temp);
			ll x=lb(all(sticks),temp)-begin(sticks)-1;
			// watch(x);
			ans+=(x-j);
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256