akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

//拡張ユークリッドの互除法
//ax+by=gcd(a, b)の特殊解を計算
//返り値はgcd(a, b)
ll extgcd(ll a, ll b, ll& x, ll& y) {
	if (b == 0) {
		x = (a >= 0) ? 1 : -1;
		y = 0;
		return abs(a);
	}
	else {
		ll res = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
		return res;
	}
}


//xとmは互いに素であるとする
//法mにおけるaの逆元とはab%m=1なる唯一のb<m
//逆元（拡張ユークリッド）
//ax+my=1なる(x, y)が求まればax%m=(1-my)%m=1よりb=x
ll mod_inverse(ll a, ll m) {
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

const ll N = 5000;

//順列
//nPk mod MODを返す
//f[i]はi!（階乗）mod MODを指す
vector<ll> f(N);

ll P(ll n, ll k) {
	if (n < k) return 0;
	return (f[n] * mod_inverse(f[n - k], MOD)) % MOD;
}


//組合せ
//nCk mod MODを返す
ll C(ll n, ll k) {
	if (n < 0) return 0;
	return (P(n, k) * mod_inverse(f[k], MOD)) % MOD;
}

signed main() {
	ll n, k;

	cin >> n >> k;

	f[0] = 1;
	FOR(i, 1, N) {
		f[i] = (f[i - 1] * i) % MOD;
	}

	ll ans;
	ll now = 2;

	REP(i, k) {
		if (n - k < i) {
			cout << 0 << endl;
			now++;
		}
		else {
			ans = C(now + n - k - i - 1, n - k - i) % MOD;
			ans *= C(k - 1, i) % MOD;
			cout << ans % MOD << endl;
			now++;
		}
	}
}

Measured memory_bytes: 256
n = int(input())
chars = 'Xabcdefghijklmnopqrstuvwxyz'
res = ''
while True:
    x = n%26
    if x == 0:
        x = 26
    res += chars[x]
    n -= x
    if n == 0 :
        break
    n //= 26
print(res[::-1])

Measured memory_bytes: 9160
import math
a,b,n=map(int, input().split()) 
max = 0
tmp = 0

if n >= b:
    max = math.floor(a * (b - 1) / b) - a * math.floor((b - 1) / b)
else:
    max = math.floor(a * n / b) - a * math.floor(n / b)
print(max)

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

int main(){
  string s;
  cin>>s;
  if(s.substr(0,7)=="keyence"||(s.substr(0,6)=="keyenc"&&s.at(s.size()-1)=='e')||(s.substr(0,5)=="keyen"&&s.substr(s.size()-2,2)=="ce")||(s.substr(0,4)=="keye"&&s.substr(s.size()-3,3)=="nce")||(s.substr(0,3)=="key"&&s.substr(s.size()-4,4)=="ence")||(s.substr(0,2)=="ke"&&s.substr(s.size()-5,5)=="yence")||(s.at(0)=='k'&&s.substr(s.size()-6,6)=="eyence")||s.substr(s.size()-7,7)=="keyence"){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  
}

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

int main(){
	char s[5];
  	cin >> s;
    	if(s[2] == s[3] && s[4] == s[5]){
        	cout << "Yes" << endl;
        }else{
        	cout << "No" << endl;
        }
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
lst = []
lst = list(map(int, input().split()))

ans = 0
ansmax = 0
flg = 0
a = len(lst)
for i in range(a-1):
    if lst[i] >= lst[i+1]:
        ans += 1
    else:
        if ansmax < ans:
            ansmax = ans
        ans = 0

print( ans if ans > ansmax else ansmax )



Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef pair <int,int> pr;
#define fr(i, n) for(int i = 0; i < n; i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c)(c).begin(), (c).end()
#define tr(c, i) for (typeof ((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x)((c).find(x) != (c).end())
#define cpresent(c, x)(find(all(c), x) != (c).end())
// for mod power a^b%m use power<lli> (a,b,m)
template < class mytype >
mytype power(mytype a, mytype b, mytype m){if (b == 1) return a % m;if (b == 0) return 1;
mytype root = power < lli > (a, b / 2, m);mytype ans = (root * root) % m;if (b % 2) ans = (ans * a) % m;
return ans;
}
// for gcd use gcd<int> (a,b)
template < class type >type gcd(type a, type b){if (a == 0) return b;else return gcd(b % a, a);}
template < class type >type mod_inv(type a, type p) {return power(a, p - 2, p);}
const lli MOD = 1e9 + 7;

int main()
{
   int n, k;
   cin >> n >> k;
   vector<int> v(n);
   for(int i = 0 ; i < n ; i++ ) cin >> v[i];
    vector<lli> dp(k+1) , dpcopy(k+1);
   for(int i = 0 ; i <= k ; i++) {
        if(i <= v[0]) dp[i] = 1;
        else dp[i] = 0;
   }lli sum = v[0];
   for(int i = 1 ; i < n ; i++){
    sum += v[i];int count = 0;dpcopy = dp;
    for(int j = 1 ; j <= k && j < sum; j++) {
            if(j <=  v[i])dp[j] = (dp[j] + dp[j-1]) % MOD;
            else{
                dp[j] = (dp[j] + dp[j-1] - dpcopy[count] + MOD) % MOD;
                count++;
            }
    }

    if(sum <= k) dp[sum] = 1;
   }
   cout << dp[k] << endl;
    return 0;
}












Measured memory_bytes: 1792
/*
 * red_and_black.cpp
 *
 *  Created on: 2017/02/10
 *      Author: Nishio
 */

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
#define mp(a,b) make_pair(a,b)
using namespace std;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int main(){
	int H,W;

	while(cin>>W>>H&&W){
		queue<pair<int,int>> q;
		bool dp[21][21]={false};
		int nowx,nowy,nextx,nexty,count=1;
		char c[21][21];
		REP(i,0,H){
			REP(j,0,W){
				cin>>c[i][j];
				if(c[i][j]=='@'){
					dp[i][j]=true;

					q.push(mp(i,j));
				}
			}
		}
		while(!q.empty()){
			nowy=q.front().first;
			nowx=q.front().second;
			q.pop();
			REP(i,0,4){
				nextx=nowx+dx[i];
				nexty=nowy+dy[i];
				if(0<=nextx && nextx<W && 0<=nexty &&nexty<H){
					if(!dp[nexty][nextx]&&c[nexty][nextx]=='.'){
						dp[nexty][nextx]=true;
						q.push(mp(nexty,nextx));
						count++;
					}
				}
			}
		}
		p(count);
	}
	return 0;
}

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

vector<int> graph[200005];
int cost[200005];

void dfs(int from = 0, int p = -1, int sum = 0){
    sum += cost[from];
    for(int to : graph[from]){
        if(to == p) continue;
        dfs(to, from, sum);
    }
    sum -= cost[from];
    cost[from] += sum;
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, q;
    cin >> n >> q;
    for(int i = 0; i < n - 1; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    for(int i = 0; i < q; ++i){
        int p, x;
        cin >> p >> x;
        --p;
        cost[p] += x;
    }
    dfs();
    for(int i = 0; i < n; ++i){
        cout << cost[i];
        cout << ((i == n - 1) ? "\n" : " ");
    }
}

Measured memory_bytes: 26624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Otoshidama
    {
        public double value;
        public string type;
        public double sum
        {
            get
            {
                if (type == "BTC")
                {
                    return value * 380000.0;
                }
                else
                {
                    return value;
                }
            }
        }
    }

    class Program
    {

        static void Main()
        {
            //ここから


            int N = ReadLineToInt();
            Otoshidama[] otoshidamas = new Otoshidama[N];
            double ans = 0;

            for(int i = 0; i < N; i++)
            {
                string[] temp = Console.ReadLine().Split();
                Otoshidama otoshidama = new Otoshidama();
                otoshidama.value = double.Parse( temp[0]);
                otoshidama.type = temp[1];
                ans += otoshidama.sum;
            }

            //ここまで


            Console.WriteLine(ans);
            Console.ReadKey();
        }


        static public void Swap<T>(ref T a,ref T b) { T temp = a;a = b;b = temp; }
        static public long GCD(int a, int b){ return b != 0 ? GCD(b, a % b) : a;}
        static public long LCM(int a, int b){ return (long)a * b / GCD(a, b); }



        
        static public string ReadLineToString(){return Console.ReadLine();}
        static public int ReadLineToInt(){return int.Parse(Console.ReadLine());}
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray(){return Console.ReadLine().Split(' ').ToArray();}
        static public int[] ReadLineToIntArray(){return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();}
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList(){return Console.ReadLine().Split(' ').ToList();}
        static public List<int> ReadLineToIntList(){return Console.ReadLine().Split(' ').Select(int.Parse).ToList();}
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }



    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    vector<int> A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K; cin >> K; K--;
    cout << A[K] << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 28);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	int N;
	cin>>N;
	vector<ll> A(N);
	REP(i,N)cin>>A[i];

	ll base = 0;
	REP(i,N)
		if(i%2==0)base+=A[i];
		else base -=A[i];
	cout<<base;
	FOR(i,1,N){
		base = A[i-1]-base/2;
		base*=2;
		cout<<" "<<base;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 2048
import heapq

n = int(input())
d = [float("inf") for i in range(n)]
d[0] = 0
g = []
q = []

for i in range(n):
    heapq.heappush(q, (d[i], i))
    inp = list(map(int, input().split()))
    tmp = []
    for j in range(inp[1]):
        tmp.append(inp[2*j+2:2*j+4])
    g.append(tmp)

while q:
    q_pop = heapq.heappop(q)
    i = q_pop[1]
    if q_pop[0] > 100000*100000:
        continue
    for node in g[i]:
        d_tmp = d[i] + node[1]
        if d_tmp < d[node[0]]:
            d[node[0]] = d_tmp
            heapq.heappush(q, (d_tmp, node[0]))

for i in range(n):
    print(i, d[i])

Measured memory_bytes: 85888
#include <stdio.h>
#include <cmath>
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
using namespace std;

int main(void) {
	vector<string> r;
	while (true)
	{
		double n=0;
		scanf("%lf",&n);
		if (n==0){
			break;
		}
		double px=0,py=0,vx=0,vy=0;
		scanf("%lf %lf %lf %lf", &px,&py,&vx,&vy);
		double d=0;
		if (abs(px) <= __FLT_EPSILON__)
		{
			if (vx == 0)
			{
				if (py*vy>0)
				{
					d = 2.0-abs(double(py));
				} else {
					d = abs(double(py));
				}
			} else {
				d=51;
			}
		} else {
			if (vx != 0)
			{
				if (abs(py/px - vy/vx) <= __FLT_EPSILON__)
				{
					if (px*vx>0)
					{
						d = 2.0-sqrt(px*px+py*py);
					} else {
						d = sqrt(px*px+py*py);
					}
				} else {
					d=51;
				}
			} else {
				d=51;
			}
		}
		if (n<d)
		{
			r.push_back("impossible");
		} else {
			ostringstream os;
			os << setprecision(14) << d;
			r.push_back(os.str());
		}
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n;
	while(cin >> n, n){
		vector<vi> f(n, vi(30));
		vector<ll> m(n);
		rep(i, n){
			int k; cin >> k;
			rep(j, k){
				int x; cin >> x;
				f[i][x - 1] = 1;
			}
			m[i] = 1ll << i;
		}
		rep(i, 30){
			ll sum = 0;
			rep(j, n) if(f[j][i]) sum |= m[j];
			rep(j, n) if(f[j][i]) m[j] = sum;
			if(sum == (1ll << n) - 1){
				cout << i + 1 << endl;
				goto END;
			}
		}
		cout << -1 << endl; END:;
	}
	
	return 0;
}


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

typedef long long LL;

const int N = 400;
unordered_map<LL,int> occ;
LL arr[N + 5][4];
LL f[N + 5];
LL tmp[4];

void shifting(LL x, int add) { //rotate 
	for(int i = 0;i < 4;i++) {
		occ[x] += add;
		x = ((x >> 10) | ((x & 1023) << 30));
	}
}

LL hashw(LL a, LL b, LL c, LL d) { //hashing four corner color into one integer
	return (a << 30) | (b << 20) | (c << 10) | d;
}


int main(){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
	int n;
	cin>>n;
	for(int i = 0;i < n;i++) {
		for(int j = 0;j < 4;j++) cin>>arr[i][j];
		f[i] = hashw(arr[i][0], arr[i][1], arr[i][2], arr[i][3]);
		shifting(f[i], 1);
	}
	LL tot = 0;
	for(int i = 0;i < n;i++) {
		shifting(f[i], -1); //fixing front side
		for(int j = i + 1;j < n;j++) {
			shifting(f[j], -1); //fixing back side
			for(int k = 0;k < 4;k++) {
				tmp[0] = hashw(arr[i][3], arr[i][2], arr[j][(1 + k) % 4], arr[j][k % 4]);
				tmp[1] = hashw(arr[i][2], arr[i][1], arr[j][(2 + k) % 4], arr[j][(k + 1) % 4]);
				tmp[2] = hashw(arr[i][1], arr[i][0], arr[j][(3 + k) % 4], arr[j][(k + 2) % 4]);
				tmp[3] = hashw(arr[i][0], arr[i][3], arr[j][(k) % 4], arr[j][(k + 3) % 4]);
				LL res = 1;
				for(int i = 0;i < 4;i++) {
					res *= occ[tmp[i]];
					shifting(tmp[i], -1);
				}
				tot += res;
				for(int i = 0;i < 4;i++) shifting(tmp[i], 1);
			}
			shifting(f[j], 1); 
		}
	}
	cout<<tot<<endl;
	return 0;
}




Measured memory_bytes: 239576
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N, K; cin >> N >> K;
    ll a[N]; rep(i, N) cin >> a[i];
    ll sum[N + 1]; //sum[i] : [0, i) の和
    sum[0] = 0;
    rep(i, N) sum[i + 1] = sum[i] + a[i];
    vector<ll> b;
    for(int i = 0; i < N; ++i) {
        for(int j = i + 1; j <= N; ++j) {
            b.pb(sum[j] - sum[i]);
        }
    }
    ll ans = 0;
    for(ll i = 40; i >= 0; --i) {
        int cnt = 0;
        for(ll v : b) {
            if(((ans + ll(1LL << i)) & v) == (ans + ll(1LL << i))) ++cnt;
        }
        if(cnt >= K) ans += ll(1LL << i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6512
def is_prime(n):
    assert n >= 1,  'Argument Error! n is "1 <= n".'
    for i in range(2, n + 1):
        if i ** 2 > n:
            break
        if n % i == 0:
            return False
    return n != 1

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

a, b = sorted(list(map(int, input().split())))
divisors_ = set(divisors(a)) & set(divisors(b))

prime_divisors = [x for x in divisors_ if is_prime(x)]
print(len(prime_divisors) + 1)

Measured memory_bytes: 5068
#if 0

#endif
#include <iostream>
#include <memory>
#include <vector>
#include <string>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <queue>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define INF (1 << 30)
using namespace std;
using ll = long long;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll K, A, B;

    cin >> K >> A >> B;

    if (B - A <= 1) {
        cout << K + 1 << endl;
        return 0;
    } else {
        ll rest = K - A + 1;
        if (rest < 1) {
            cout << K + 1 << endl;
            return 0;
        }

        ll b = A;
        if (0 == rest % 2) {
            b += (rest / 2) * (B - A);
            cout << b << endl;
        } else {
            b += (rest / 2) * (B - A);
            cout << b + 1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
use std::cmp;

fn main() {
    let sc = std::io::stdin();
    let mut sc = Scanner { reader: sc.lock() };

    let n: usize = sc.read();
    let w: usize = sc.read();
    let mut dp = vec![0; w + 1];
    for _ in 0..n {
        let weight: usize = sc.read();
        let value: u64 = sc.read();
        for cur in (0..w).rev() {
            if cur + weight > w {
                continue;
            }
            dp[cur + weight] = cmp::max(dp[cur + weight], dp[cur] + value);
        }
    }

    let ans: u64 = *dp.iter().max().unwrap();
    println!("{}", ans);
}

pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Foldable
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VMM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import qualified Data.Set as S
import System.IO.Unsafe
import Debug.Trace

unew :: VU.Unbox a => Int -> VM.IOVector a
unew !n = accursedUnutterablePerformIO $ VM.unsafeNew n

uread :: VU.Unbox a => Int -> VM.IOVector a -> a
uread !i !v = accursedUnutterablePerformIO $ VM.unsafeRead v i

uwrite :: VU.Unbox a => Int -> a -> VM.IOVector a -> VM.IOVector a
uwrite !i !a !v =
  accursedUnutterablePerformIO $ VM.unsafeWrite v i a >> return v

umodify :: VU.Unbox a => Int -> (a -> a) -> VM.IOVector a -> VM.IOVector a
umodify !i !f !v =
  accursedUnutterablePerformIO $ VM.unsafeModify v f i >> return v

uthaw :: VU.Unbox a => VU.Vector a -> VM.IOVector a
uthaw !v = accursedUnutterablePerformIO $ VU.unsafeThaw v

ufreeze :: VU.Unbox a => VM.IOVector a -> VU.Vector a
ufreeze !v = accursedUnutterablePerformIO $ VU.unsafeFreeze v

solve :: Int -> Int -> B.ByteString -> Bool
solve !x !y !bs =
  foldl' go dpX rx VU.! toIndex x && foldl' go dpY ry VU.! toIndex y
 where
  go !prev !i = VU.generate
    (maxN * 2 + 1)
    (\(!k') ->
      let k = k' - maxN
      in  (if (k + i) < maxN then prev VU.! toIndex (k + i) else False)
            || (if (k - i) >= -maxN then prev VU.! toIndex (k - i) else False)
    )

  maxN = B.length bs
  dpX  = VU.fromList [ i == rx0 | i <- [-maxN .. maxN] ]
  dpY  = VU.fromList [ i == 0 | i <- [-maxN .. maxN] ]

  toIndex !k = k + maxN

  (!rx0, !rx, !ry) =
    let
      (bs0, bs1)     = B.span (== 'F') bs
      (rx, ry, _, _) = if B.length bs1 == 0
        then ([], [], B.empty, 0)
        else fix
          (\f (!rx, !ry, !bs, !parity) ->
            let (bs0, bs1) = B.span (== 'F') bs
                r          = B.length bs0
                next       = if B.length bs1 == 0 then id else f
                bs1'       = if B.length bs1 == 0 then B.empty else B.tail bs1
                cons       = if r > 0 then (r :) else id
            in  if parity == 0
                  then next $ (cons rx, ry, bs1', 1)
                  else next $ (rx, cons ry, bs1', 0)
          )
          ([], [], B.tail bs1, 1)
    in
      (B.length bs0, rx, ry)

main = do
  let readInt = fmap (second B.tail) . B.readInt

  bs     <- B.getLine
  (x, y) <-
    (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> B.getLine
  putStrLn $ if solve x y bs then "Yes" else "No"


Measured memory_bytes: 1660
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fo(i,start,end) for(int i=start;start<end?i<end:i>end;start<end?i+=1:i-=1)
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vop vector<pll>
#define vov vector<vector<ll>>
using namespace std;

const long long mod1=1e9+7;
const long long mod2=1e18;
const ll mod3=9e18;

long long power(ll  x, ll n){if(n==0)return 1;ll temp=power(x,n/2);if(n%2==0)return temp*temp;else return x*temp*temp;}
ll MAX(ll a,ll b){return a>b?a:b;}
ll MAX(ll a,ll b,ll c){return max(max(a,b),c);}
ll MIN(ll x,ll  y){return x+y-max(x,y);}
ll MIN(ll x,ll y,ll z){return min(min(x,y),z);}
void swap(int* a, int* b){int t = *a;*a = *b;*b = t;}
bool f(ll x,ll y){return x>y;}
const ld pi=3.14159265358;





int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n,m;
    cin>>n>>m;
    ll tem=n;
    fo(i,0,m){
        ll t;
        cin>>t;
        tem-=t;
    }
if(tem<0)cout<<"-1";
else cout<<tem;


    return 0;
}

Measured memory_bytes: 3660
n=int(input())
count=0
s=[]
a=0
b=0
ba=0
for i in range(n):
    s1=input()
    count+=s1.count('AB')
    if s1[0]=='B' and s1[-1]=='A':
        ba+=1
    elif s1[0]=='B':
        b+=1
    elif s1[-1]=='A':
        a+=1
if ba==0:
    if a>0 and b>0:
        count+=min(a,b)
else:
    if a>=1 and b>=1:
        count+=ba+min(a,b)
    elif a>0 or b>0:
        count+=ba
    else:
        count+=ba-1
print(count)

Measured memory_bytes: 3064
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    using namespace std;
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
 
    #define pb push_back
    #define MP make_pair
    #define F first
    #define S second
    #define int long long
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define deb(x) cout<<#x<<" "<<x<<endl;
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    
    const int MOD =  1000000007 ;
    const int MAX = 2e6 + 7;
    const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
    const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    vector<pi> v,vv;
    int pr,x,y;
    void solve()
    {
        cin>>n;
        fo(i,0,n)
        {
            cin>>x>>y;
            v.pb(make_pair(x+y,x-y));
        }

        sort(v.begin(),v.end());
        vv.pb(make_pair(v[0].S,v[0].F));
        pr=v[0].F;
        fo(i,1,n)
        {
            l=v[i].S;
            r=v[i].F;
            if(l>=pr)
            {
                vv.pb(make_pair(l,r));
                pr=r;
            }

        }
        cout<<vv.size()<<endl;
        // fo(i,0,vv.size())
        // {
        //     cout<<vv[i].F<<vv[i].S<<endl;
        // }
        
    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          GAME STARTS FROM HERE                            //
 
    int32_t main() 
      {
        
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        
        // cin>>t;while(t--)
        solve();
        
      return 0;
      }

Measured memory_bytes: 4848
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない
//UnionFind

const int maxn=50;

int main(){
    
    int n,k;
    ll ans=0;
    cin >> n>>k;
    ll v[maxn];
    
    rep(i,n){
        cin >> v[i];
    }

    
    for(int i=0;i<=k;i++){
        for(int j=0;i+j<=min(k,n);j++){
            int rest = k-i-j;
            ll sum=0;
            priority_queue<ll> have;
            rep(l,i){
                sum+=v[l];
                if(v[l]<0)have.push(-v[l]);
            }
            rep(r,j){
                sum+=v[n-1-r];
                if(v[n-1-r]<0)have.push(-v[n-1-r]);
            }
            rep(k,rest){
                if(have.empty())break;
                ll sute = have.top();
                have.pop();
                sum+=sute;
            }
            
            ans=max(ans,sum);
            
        }
    }
    
    cout << ans<<endl;
    
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  for(int i = 0; i < N; i++) {
    cin >> X[i];
  }
  sort(X.begin(), X.end());
  
  int ans = 1000000000;
  int tmp = 0;
  for(int i = X[0]; i <= X[N-1]; i++) {
    for(int j = 0; j < N; j++) {
      tmp += (i-X[j]) * (i-X[j]);
    }
    if(ans > tmp) {
      ans = tmp;
    }
    tmp = 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;

int main(){
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF){
        int k=0,s=b;
        while(s){
            s/=10;
            k++;
        }
        int h=a*pow(10,k)+b;
        int m=sqrt(h);
        if(m*m!=h){
            printf("No\n");
        }
        else printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int par[100002];
int rk[100002];
int sz[100002];
void init(int n){
	for(int i=0; i<n; i++){
		par[i]=i; sz[i]=1;
	}
}
 
int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}
 
void unite(int x, int y){
	x=find(x);
	y=find(y);
	if(x==y) return;
	if(rk[x]<rk[y]){
		par[x]=y; sz[y]+=sz[x];
	}else{
		par[y]=x; sz[x]+=sz[y];
		if(rk[x]==rk[y]) rk[x]++;
	}
}
 
bool same(int x, int y){
	return find(x)==find(y);
}
int main()
{
	int n, m; cin>>n>>m;
  ll ans[100002];
  int a[100002], b[100002];
  for(int i=0; i<m; i++){
    cin>>a[i]>>b[i];
    a[i]--; b[i]--;
  }
  init(n);
  ll c=0;
  for(int i=m-1; i>=0; i--){
    ans[i]=c;
    int x=a[i], y=b[i];
    if(same(x, y)){
      continue;
    }
    x=find(x), y=find(y);
    ll s1=sz[x], s2=sz[y];
    c-=(s1*(s1-1)/2);
    c-=(s2*(s2-1)/2);
    unite(x, y);
    x=find(a[i]);
    ll s=sz[x];
    c+=(s*(s-1)/2);
  }
  ll a0=(ll)n*(ll)(n-1)/2;
  for(int i=0; i<m; i++){
    cout<<a0-ans[i]<<endl;
  }
	return 0;
}

Measured memory_bytes: 4096
import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int H = scan.nextInt();
                int W = scan.nextInt();
                int K = scan.nextInt();
                
                char[][] c= new char[H][W];
                for(int i=0; i<H; i++){
                    String cstring = scan.next();
                    for(int j=0; j<W; j++){ 
                        c[i][j] = cstring.charAt(j);
                    }
                }

                int ans=0;
                int black =0;
                for(int i=0; i< (1<< H);i++){
                    for(int j=0; j< (1<<W);j++){
                        black = 0;
                        for(int k=0; k<H; k++){
                            if((i&(1<<k))==0){
                                for(int l=0; l<W; l++){
                                    if((j&(1<<l))==0){
                                        if(c[k][l]=='#'){
                                            black++;
                                        }
                                    }
                                }
                            }
                        }
                        if(black==K){
                            ans++;
                        }
                    }
                }
                
                System.out.println(ans);
        }               
}

Measured memory_bytes: 36192
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var hs = new HashSet<string>();
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = line[0];  var b = line[1];
            switch (a)
            {
                case "insert":
                    hs.Add(b);
                    break;
                case "find":
                    if (hs.Add(b)) { Console.WriteLine("no"); hs.Remove(b); }
                    else Console.WriteLine("yes");
                    break;
            }
        }
    }
}


Measured memory_bytes: 39840
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

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

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

#include <limits>

int main() {
  int64 divide_by = 1e9 + 7;
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int64> s(26);
  for (int i = 0; i < N; i++) {
    int64 tmp = S[i] - 'a';
    s[tmp]++;
  }
  debug(s);
  int64 ans = 1;
  for (int i = 0; i < 26; i++) {
    if (s[i] != 0) {
      ans *= s[i] + 1;
      ans %= divide_by;
    }
  }
  cout << ans - 1 << endl;
  return 0;
}

Measured memory_bytes: 3752
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残すな
//数値計算 基本はdouble
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}   // 

int main() {
	double T, X; cin >> T >> X;
	cout << setprecision(20) << T / X << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int X,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
    int p[A],q[B],r[C];
    priority_queue<int> que;
    rep(i,A){
        cin>>p[i];
    }
    rep(i,B){
        cin>>q[i];
    }
    rep(i,C){
        cin>>r[i];
        que.push(r[i]);
    }
    sort(p,p+A);
    sort(q,q+B);
    reverse(p,p+A);
    reverse(q,q+B);
    rep(i,X){
        que.push(p[i]);
    }
    rep(i,Y){
        que.push(q[i]);
    }
    int ans=0;
    rep(i,X+Y){
        int a=que.top();
        que.pop();
        ans+=a;
    }
    cout << ans << endl;
    




}


Measured memory_bytes: 8816
class Node
  attr_accessor :parent, :rank
  def initialize(n)
    @parent = n
    @rank = 0
  end
end

class UnionFind
  def initialize(n)
    @nodes = (0..n).map { |i| Node.new(i) }
  end

  def unite(a, b)
    pa = find(a)
    pb = find(b)
    return if pa == pb

    if @nodes[pa].rank < @nodes[pb].rank
      @nodes[pb].parent = pa
    else
      @nodes[pa].parent = pb
      @nodes[pa].rank += 1 if @nodes[pa].rank == @nodes[pb].rank
    end
  end

  def same?(a, b)
    find(a) == find(b)
  end

  def find(x)
    return x if @nodes[x].parent == x
    @nodes[x].parent = find(@nodes[x].parent)
  end
end

n, m = gets.chomp.split(' ').map(&:to_i)
p = gets.chomp.split(' ').map{ |i| i.to_i - 1 }
uf = UnionFind.new(n)
(0...m).each do
  x, y = gets.chomp.split(' ').map{ |i| i.to_i - 1 }
  uf.unite(x, y)
end

c = 0
(0...n).each do |i|
  v = p[i]
  c += 1 if uf.same?(v, i)
end
puts c

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

int main(){
  int N,D;
  cin >> N >> D;
  float X[N][D];
  for(int i = 0; i < N; i++){
    for(int s = 0; s < D; s++){
      cin >> X[i][s];
    }
  }
  int count = 0;
  
  for(int i = 0; i < N; i++){
    for(int s = 0; s < N; s++){
  	  if(i == s){continue;}
      float sum = 0;
      for(int t = 0; t < D; t++){
        float Lx = X[i][t] - X[s][t];
        sum += pow(Lx, 2);
      }
      float distance = pow(sum,0.5);
      if( distance == floor(distance)){
        count++;
      }
    }
  }
  cout << count/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#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()
using namespace std;
typedef long long ll;

int main(){
    int n;
    int V[40], C[40];
    cin >> n;
    REP(i, n){
        cin >> V[i];
    }
    REP(i, n){
        cin >> C[i];
    }


    int ma =-1;
    for(int mask=0; mask < (1 << n); mask++){
        // cout << "mask is "<< mask<< endl;
        int X=0,Y=0;
        for(int i=0; i<n; i++)
            if( (mask >> i) &1){
                // cout << "Vi is " << V[i] << " Ci is " << C[i] << endl;
                X+=V[i];  
                Y+=C[i];
            } 
        // cout << "X is " <<X << " Y is " << Y << endl;
        ma = max(ma, X-Y);
    }
    cout << ma << endl;

    return 0;
}

Measured memory_bytes: 888
import java.io.*;
import java.util.*;
public class Main{
   public static void main(String[] args) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   int[] kazu = new int[10];
   for(int a = 0; a <= 9; a++){
   kazu[a] = Integer.parseInt(br.readLine());
   }
   int n = 10;
   int kari;
   for(int b = 0; b <= n-2; b++){
   int x = b;
   for(int c = b+1; c <= n-1; c++){
   if(kazu[x] < kazu[c]){
   x = c;
   }
   }
   if(x != b){
   kari = kazu[x];
   kazu[x] = kazu[b];
   kazu[b] = kari;
   }
   }
   for(int d = 0; d <= 2; d++){
   System.out.println(kazu[d]);
   }
   }
}
   

Measured memory_bytes: 24248
X = int(input())
def is_prime(n):
    if n == 1: return False
    for k in range(2, int(n**(0.5)) + 1):
        if n % k == 0:
            return False
    return True

while True:
  if is_prime(X):
    break
  else:
    X += 1
print(X)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6, MOD = 998244353;
int add(int a, int b) { return (a + b) % MOD; }
int mul(int a, int b) { return 1LL * a * b % MOD; }

int n, a[200000], sum[MAX + 1], w[MAX + 1], inv[MAX + 1];
int main() {
    scanf("%d", &n);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
        sum[a[i]] = add(sum[a[i]], a[i]);
        ans = add(ans, -a[i]);
    }

    inv[1] = 1;
    for (int i = 2; i <= MAX; ++i) inv[i] = -mul(MOD / i, inv[MOD % i]);

    for (int d = 1; d <= MAX; ++d) {
        w[d] = add(w[d], inv[d]);
        int s = sum[d];
        for (int e = 2 * d; e <= MAX; e += d) s = add(s, sum[e]), w[e] = add(w[e], -w[d]);
        ans = add(ans, mul(w[d], mul(s, s)));
    }

    ans = mul(ans, inv[2]);
    if (ans < 0) ans += MOD;
    printf("%d\n", ans);
}

Measured memory_bytes: 12800
# ABC084C - Snuke Festival
from bisect import bisect_left, bisect_right

n = int(input())
lst_a = sorted(list(map(int, input().rstrip().split())))
lst_b = list(map(int, input().rstrip().split()))
lst_c = sorted(list(map(int, input().rstrip().split())))
lgth = len(lst_c)
ans = 0
for i in lst_b:
    ans += bisect_left(lst_a, i) * (lgth - bisect_right(lst_c, i))
print(ans)

Measured memory_bytes: 106212
#include <iostream>
using namespace std;
int main() {
    long long A,B,K;
    cin >> A >> B >> K;
    if (A <= K) {
        K = K - A; A = 0;
    } else {
        A = A - K; K = 0;
    }
    if (B <= K) {
        K = K - B; B = 0;
    } else {
        B = B - K; K = 0;
    }
    cout << A << ' ' << B << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))



//*
//遅延セグ木ここから
//↓ここを変える
typedef struct sayouso{ll a,b;}sayouso;
typedef struct atai{ll a;}atai;
//↑ここを変える

typedef struct node{sayouso T;atai x;}node;
node *lsegN,*lseg;
ll lsegNUM,lsegk;

//↓ここから変える
sayouso sid={1,0};
atai aid={0};
atai xx(atai x,atai y){
	atai ret;
	ret.a=x.a+y.a;
	return ret;
}
atai Tx(sayouso T,atai x){
	atai ret;
	ret.a=T.a*x.a+T.b;
	return ret;
}
sayouso TT(sayouso S,sayouso T){
	sayouso ret;
	ret.a=S.a*T.a;
	ret.b=S.b+S.a*T.b;
	return ret;
}
sayouso fT(sayouso T,ll k){
	sayouso ret;
	ret.a=T.a;
	ret.b=T.b<<k;
	return ret;
}
//↑ここまで変える

//要素数(2ベキ)でこれを呼ぶ
void lseguse(ll n){
	lsegN=(node*)calloc(2*n,sizeof(node));
	lsegNUM=n;
	lseg=lsegN+lsegNUM;
	lsegk=0;while(n/=2)lsegk++;
	rep(i,1,2*lsegNUM){
		lsegN[i].x=aid;
		lsegN[i].T=sid;
	}
}
//lseg[i].xに値を与えてから初期化
void lseginit(){
	for(ll i=lsegNUM-1;i>0;i--)lsegN[i].x=xx(lsegN[2*i].x,lsegN[2*i+1].x);
}
void lsegupdatesub(ll l,ll r,sayouso T,ll i,ll cl,ll cr,ll ck){
	if(l>=r)return;
	//disjointなとき
	if(cr<=l||r<=cl)return;
	//完全に含むとき
	if(l<=cl&&cr<=r){
		lsegN[i].T=TT(T,lsegN[i].T);
		return;
	}
	//どちらでもないとき
	//遅延伝播
	lsegN[2*i  ].T=TT(lsegN[i].T,lsegN[2*i  ].T);
	lsegN[2*i+1].T=TT(lsegN[i].T,lsegN[2*i+1].T);
	//再帰的に更新
	ll cm=(cl+cr)/2;
	lsegupdatesub(l,r,T,2*i  ,cl,cm,ck-1);
	lsegupdatesub(l,r,T,2*i+1,cm,cr,ck-1);
	//自身のnodeを更新
	lsegN[i].x=xx(Tx(fT(lsegN[2*i].T,ck-1),lsegN[2*i].x),Tx(fT(lsegN[2*i+1].T,ck-1),lsegN[2*i+1].x));
	lsegN[i].T=sid;
}
void lsegupdate(ll l,ll r,sayouso T){lsegupdatesub(l,r,T,1,0,lsegNUM,lsegk);}
atai lsegcalcsub(ll l,ll r,ll i,ll cl,ll cr,ll ck){
	if(l>=r)return aid;
	//完全に含むとき
	if(l<=cl&&cr<=r)return Tx(fT(lsegN[i].T,ck),lsegN[i].x);

	ll cm=(cl+cr)/2;
	//遅延伝播(変更はないので配るだけで良い)
	lsegN[2*i  ].T=TT(lsegN[i].T,lsegN[2*i  ].T);
	lsegN[2*i+1].T=TT(lsegN[i].T,lsegN[2*i+1].T);
	lsegN[i].x=Tx(fT(lsegN[i].T,ck),lsegN[i].x);
	lsegN[i].T=sid;

	//左側だけ
	if(r<=cm)return lsegcalcsub(l,r,2*i  ,cl,cm,ck-1);
	//右側だけ
	if(cm<=l)return lsegcalcsub(l,r,2*i+1,cm,cr,ck-1);
	//両方
	return xx(lsegcalcsub(l,r,2*i,cl,cm,ck-1),lsegcalcsub(l,r,2*i+1,cm,cr,ck-1));
}
atai lsegcalc(ll l,ll r){return lsegcalcsub(l,r,1,0,lsegNUM,lsegk);}
//遅延セグ木ここまで
//*/


int main(){
	int n,q;
	scanf("%d%d",&n,&q);
	lseguse(1<<17);
	while(q--){
		int t;
		scanf("%d",&t);
		if(t){
			int x,y;
			scanf("%d%d",&x,&y);
			printf("%lld\n",lsegcalc(x,y+1).a);
		}
		else{
			int x,y,b;
			scanf("%d%d%d",&x,&y,&b);
			sayouso T={0,b};
			lsegupdate(x,y+1,T);
		}
	}
}


Measured memory_bytes: 8008
import java.util.*;

public class Main{
	public static boolean check(Map<Integer, Integer> map){
		boolean flag = true;
		for(Integer x : map.keySet()){
			if( x != map.get(x) ){
				flag = false;
				break;
			}
		}
		return flag;
	}
	
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);		
		List<String> result = new ArrayList<String>();
		int n;
		while( (n = stdIn.nextInt()) != 0 ){
			Map<Integer, Integer> map = new HashMap<Integer, Integer>();
			int[] x = new int[n];
			int count = 0;
			for(int i = 0; i < x.length; i++){
				x[i] = stdIn.nextInt();
				map.put(x[i], (map.get(x[i]) == null) ? 1 : map.get(x[i])+1);
			}
			while( !check(map) ){
				for(int i = 0; i < x.length; i++){
					x[i] = map.get(x[i]);
				}
				map.clear();
				for(int i = 0; i < x.length; i++){
					map.put(x[i], (map.get(x[i]) == null) ? 1 : map.get(x[i])+1);
				}
				count++;
			}
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < x.length; i++){
				sb.append(x[i] + " ");
			}
			sb.deleteCharAt(sb.length()-1);		
			result.add(Integer.toString(count));
			result.add(sb.toString());
			
		}
		for(String str : result){
			System.out.println(str);			
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back

using namespace std;

int n,even;

int main()
{
    cin >> n;
    even=n/2;
    double odd=n-even;
    cout << fixed << setprecision(6) << (odd/n) << endl;
    return 0;
}


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

bool check(int value) {
  stringstream ss;
  ss << value;
  string v = ss.str();
  for (int i = 0; i < (int)v.size() - 1; i++) {
    if (v[i + 1] - v[i] != 1) return false;
  }
  return true;
}

int main (){
  int N;
  cin >> N;
  vector<int> an(N);
  for (int i = 0; i < N; i++) cin >> an[i];
  int ans = -1;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int value = an[i] * an[j];
      if (check(value)) {
	ans = max(ans, value);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3240
#include <stdio.h>

int collatz(int n){
  if(n%2==0) return n/2;
  else return 3*n+1;
}

int main(){
  int s;
  scanf("%d",&s);
  int i,m;
  int visited[100001];
  for(i=0;i<100001;i++) visited[i]=0;
  visited[s]=1;

  i=2;
  while(1){
    s=collatz(s);
    if(visited[s]==1){
      m=i;
      break;
    }else{
      visited[s]=1;
      i++;
    }
  }

  printf("%d\n",m);
  return 0;
}



Measured memory_bytes: 512
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {

      
 public static void main(String[] args) {
    
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    int N = in.nextInt();
    long sum = 0;
    for(int i = 1; i <= N; i++) {
        if(i%5 == 0 && i%3 == 0){
        }
        else if(i%5 == 0) {
        }
        else if(i%3 == 0) {
        }
        else {
            sum += i;
        }
    }
    
    System.out.println(sum);
    
  }
  
  
}

Measured memory_bytes: 35872
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

const int MAX_C = 100;

vector<vl> C(MAX_C,vl(MAX_C,-1));

void calcC(){
	for(int i=0; i<MAX_C; i++){
		for(int j=0; j<=i; j++){
			if(j==0||j==i)C[i][j]=1LL;
			else{
				C[i][j] = C[i-1][j-1] + C[i-1][j];
			}
		}
	}
}

int main(){
	calcC();
	int n, A, B;
	cin >> n >> A >> B;
	map<ll, int> mp;
	rep(i, n) {
		ll t;
		cin >> t;
		mp[-t]++;
	}
	int cnt = 0;
	ll sum = 0LL;
	for(auto& p: mp) {
		//cout << p.fi<<" "<<p.se<<endl;
		//cout << " "<<sum<<" "<<cnt<<endl;
		if(cnt == 0 && p.se >= A) {
			ll tmp = 0LL;
			for(int i = A; i <= min(p.se, B); i++) {
				tmp += C[p.se][i];
			}
			printf("%.15lf\n", (double)(-p.fi));
			printf("%ld\n", tmp);
			return 0;
		}
		if(cnt + p.se >= A) {
			int dif = cnt + p.se - A;
			sum -= (ll)(A - cnt)*p.fi;
			//cout<<sum<<endl;
			printf("%.15lf\n", (double)sum/A);
			printf("%ld\n", C[p.se][dif]);
			return 0;
		}
		sum -= (ll)p.se*p.fi;
		cnt += p.se;
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
   int ta=0, tb=0, n;
   cin >> n;
   vector<int> a(n);
   rep(i, n){
     cin >> a.at(i);
   }
   sort(a.rbegin(), a.rend());
   rep(i, n){
     if(i % 2 == 0)ta+=a.at(i);
     else tb+=a.at(i);
   }
   cout << ta-tb << endl;
}

Measured memory_bytes: 256