akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int k[n],a[n][30];
  for (int i = 0; i < n; i++) {
    k[i] = 0;
    for (int j = 0; j < 30; j++) {
      a[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> k[i];
    int x= k[i];
    for (int j = 0; j < x; j++) {
      cin >> a[i][j];
    }
  }
  int y[m] = { 0 };
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 30; j++) {
      if (a[i][j] != 0) {
        int x = a[i][j]-1;
        y[x]++;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < m; i++) {
    if (y[i] == n) {
      ans++;
    }
  }
  cout << ans << endl;
}
  

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 2000000000
typedef long long ll;
bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
int main(){

    ll N,K ,a[4019];
    ll d1,d10;
    ll ans1=0,ans2=0,wa,ansk;
    cin >>N >> K;
    rep(i,N) cin >> a[i];

    
    rep(i,N){
        for(int k = i+1;k < N; k++){
            if(a[i] > a[k]){
                ans1++;
            }
        }
    }

   rep(i,N) a[N+i] = a[i];

   rep(i,N*2){
        for(int k = i+1;k < N*2; k++){
            if(a[i] > a[k]){
                ans2++;
            }
        }
    }
    if((K%2) == 1){
        wa = ((2*ans1+(K-1)*(ans2-2*ans1)))/2;
        ansk = ((K%mod)*(wa%mod))%mod;
    }else{
        wa = ((2*ans1+(K-1)*(ans2-2*ans1)));
        ansk = (((K/2)%mod)*(wa%mod))%mod;
    }
    //if(ansk > mod/2)
    //cout << ans1 << endl;
    //cout << ans2 << endl;
    //cout << wa << endl;
    cout << ansk << endl;
    

    
    
    return 0;
    

}

Measured memory_bytes: 256
x = int(input())
ans = x // 11 + x % 11
if x % 11 >= 7:
    ans = (x//11) * 2 + 2
elif x % 11 == 0:
    ans = (x // 11) * 2
else:
    ans = (x //11) * 2 + 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;


void solve()
{
	string s;
	cin>>s;
	int n[2]={0,0};
	rep(i,3){
		n[s[i]-'A']++;
	}
	if(n[0]&&n[1]){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 100005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif


void solve(){
    string s; cin>>s;
    int cts = 0;
    int ctt = 0;
    For(i, 0, sz(s)){
    	if(s[i]=='S')
    		cts++;
    	else{
    		ctt++;
    		if(cts > 0){
    			cts--;
    			ctt--;
    		}
    	}
    }
    cout<<cts+ctt;
}


signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int t=1;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}





Measured memory_bytes: 720
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<cmath>
#include<cstdio>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++) 
#define lint long long
#define all(x) (x).begin(), (x).end()


int main(){
    int n, m; cin>>n>>m;
    int table[31]={};
    rep(i,n){
        int k; cin>>k;
        rep(j,k){
            int a; cin>>a;
            table[a-1]++;
        }
    }
    int ans = 0;
    rep(i,m){
        if(table[i] == n) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

struct edge { 
    int to;
    ll cost;
};

typedef vector<vector<edge>> Graph;

vector<ll> dijkstra(Graph G, ll s) {
    ll inf = 1e18;
    priority_queue<Pll, vector<Pll>, greater<Pll>> que;
    vector<ll> d(G.size(), inf);
    d[s] = 0;
    que.push(Pll(0, s));
    
    while (!que.empty()) {
        Pll p = que.top();
        que.pop();
        
        ll v = p.second;
        if (d[v] < p.first) continue;
        for (auto &i : G[v]) {
            edge e = i;
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(Pll(d[e.to], e.to));
            }
        }
    }
    return d;
}

int main() {
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--;  t--;
    Graph G(n), H(n);
    for (int i = 0; i < m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--;  v--;
        G[u].push_back({v, a});
        G[v].push_back({u, a});
        H[u].push_back({v, b});
        H[v].push_back({u, b});
    }

    vector<ll> p = dijkstra(G, s);
    vector<ll> q = dijkstra(H, t);

    ll ans[n + 1] = {}, inf = 1e15;
    ans[n] = inf;
    for (int i = n - 1; i >= 0; i--) {
        ans[i] = min(ans[i + 1], p[i] + q[i]);
    }
    for (int i = 0; i < n; i++) cout << inf - ans[i] << endl;

}


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


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            char[] s = Console.ReadLine().ToCharArray();
            char[] ans = { 'a', 'b', 'c' };
            Array.Sort(s);

            for(int i = 0; i<s.Length; i++)
            {
                if(s[i] != ans[i])
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");




            //if(s[0] == 'a' && s[1] == 'b' && s[2] == 'c')
            //{
            //    Console.WriteLine("Yes");
            //}
            //else
            //{
            //    Console.WriteLine("No");
            //}
            

            //string ans = "abc";

            ////Console.WriteLine(str);
            //Console.WriteLine(ans);

            //if(Equals(s.ToString(), ans))
            //{
            //    wr.wri("Yes");
            //}
            //else
            //{
            //    wr.wri("No");
            //}
        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <set>
#include <cmath>

using namespace std;

int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

void check_factor(set<int>& factors, bool& pairwise_coprime, int p)
{
    if (factors.count(p) == 1)
        pairwise_coprime = false;
    else
        factors.insert(p);
}

int main()
{
    int n;
    cin >> n;
    set<int> factors;
    int cur_gcd;
    bool pairwise_coprime = true;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        int a_copy = a;

        if (pairwise_coprime)
        {
            if (a % 2 == 0)
                check_factor(factors, pairwise_coprime, 2);
            while (a % 2 == 0)
                a /= 2;

            for (int p = 3; p <= sqrt(a); p += 2)
            {
                if (a % p == 0)
                    check_factor(factors, pairwise_coprime, p);
                while (a % p == 0)
                    a /= p;
            }

            if (a > 2)
                check_factor(factors, pairwise_coprime, a);
        }

        if (i == 0)
            cur_gcd = a_copy;
        else
            cur_gcd = gcd(cur_gcd, a_copy);
    }
    if (pairwise_coprime)
        cout << "pairwise coprime" << endl;
    else if (cur_gcd == 1)
        cout << "setwise coprime" << endl;
    else
        cout << "not coprime" << endl;
	return 0;
}

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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;
const ll llmx = 2e18;

int main(void){
  
  string S,T;
  cin >> S;
  cin >> T;
  
  if(S.length()+1 == T.length()){
    char c=T[T.length()-1];
    string hikaku = T.substr(0,T.length()-1);
    if('a' <= c && c <= 'z' && hikaku == S){
      cout << "Yes";
    }else{
      cout << "No";
    }
  }else{
    cout << "No";
  }
  
  return 0;
}


Measured memory_bytes: 3596
"""
アルゴリズムとデータ構造 P.116
をPythonで書いた
"""

s = input()
stack1 = list()
stack2 = list()
sm = 0

for i, c in enumerate(s):
    if c == '\\':
        stack1.append(i)
        continue

    if c == '/' and len(stack1) > 0:
        j = stack1.pop()
        sm += i - j
        a = i - j
        while len(stack2) > 0 and stack2[-1][0] > j:
            a += stack2.pop()[1]
        stack2.append((j, a))

print(sm)
ans = list()
ans.append(len(stack2))
for _, a in stack2:
    ans.append(a)
print(" ".join([str(i) for i in ans]))



Measured memory_bytes: 6212
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(0 <= x-r && x+r <= W && 0 <= y-r &&y+r <= H){
        cout << "Yes" << endl;
    } 
    else{
        cout  << "No" << endl;
    }return 0 ;
    
}



Measured memory_bytes: 3104
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
    int h,w,line[110],row[110];
    string a[110];
    cin >> h >> w;
    for(int i = 0;i < h;i++){cin >> a[i]; line[i] = 0;}
    for(int i = 0;i < w;i++){row[i] = 0;}
    for(int i = 0;i < h;i++)
    {
        bool judge = true;
        for(int j = 0;j < w;j++)
        {
            if(a[i][j] == '#'){judge = false; break;}
        }
        if(judge){line[i] = 1;}
    }
    for(int i = 0;i < w;i++)
    {
        bool judge = true;
        for(int j = 0;j < h;j++)
        {
            if(a[j][i] == '#'){judge = false; break;}
        }
        if(judge){row[i] = 1;}
    }
    for(int i = 0;i < h;i++)
    {
        bool judge = false;
        for(int j = 0;j < w;j++)
        {
            if(line[i] == 0 && row[j] == 0){cout << a[i][j]; judge = true;}
        }
        if(judge){cout << endl;}
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <deque>
using namespace std;

int main() {
	string s;
	cin >> s;
	deque<char> d;
	
	for(char x : s){
		d.push_back(x);
	}
	
	int q;
	
	cin >> q;
	
	bool left = true;
	for(int i = 0; i < q; i++){
		int type;
		cin >> type;
		
		if (type == 1){
			left = !left;
		}else {
			int t;
			char ch;
			cin >> t >> ch;
			if (t == 1){
				if (left){
					d.push_front(ch);
				}else {
					d.push_back(ch);
				}	
			}else {
				if (left){
					d.push_back(ch);
				}else {
					d.push_front(ch);
				}
			}
		}
	}
	
	if (left) {
		for(int i = 0; i < d.size(); i++)
			cout << d[i];
	}else {
		for(int i = d.size() - 1; i >= 0; i--)
			cout << d[i];
	}
	return 0;
}






Measured memory_bytes: 896
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;

const int N=1e5+1e3+7;

int n,t[N],x[N],y[N];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d%d",&t[i],&x[i],&y[i]);
	for(int i=1;i<=n;i++)
	{
		int k=t[i]-t[i-1];
		if(k<abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))
		{
			puts("No");
			return 0;
		}
		int v=k-(abs(x[i]-x[i-1])+abs(y[i]-y[i-1]));
		if(v%2==1)
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 1408
#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;

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


void solve() {
    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    for (auto &a:h) {
        cin >> a;
    }

    vector<ll> dp(n, numeric_limits<ll>::max());
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j <= k && i + j < n; ++j) {
            chmin(dp[i + j], abs(h[i + j] - h[i]) + dp[i]);
        }
    }
    cout << dp[n - 1] << endl;
}

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

    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
using namespace std;
bool vis[105];
int main()
{

    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<n;i++)
    {
        ans+=(n-1)/i;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 3756
local l = io.read("*l")
l = math.tointeger(tonumber(l))
local result = math.tointeger(0)
if l == 1 then 
  result = 0
elseif l % 2 == 0 then
  result = (l - 1) * (l // 2)
else
  result = (l - 2) * (l // 2) + l - 1
end
print(result)

Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
   ll a, b, c;
   cin >> a >> b >> c;
   
   if((a==b)&&(b==c)&&!(a&1)){
        cout << -1;
        return 0;
   }
   ll ans = 0;
   while(true){
       if((a&1||b&1)||c&1)break;
       ans++;
       ll ta, tb, tc;
       ta = b/2+c/2;
       tb = a/2+c/2;
       tc = a/2+b/2;
       a = ta, b = tb, c = tc;
   }
   cout << ans << endl;
}

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

namespace ABC132
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int[] input = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
			int count = 0;
			for(int i = 1; i < n - 1; i++)
			{
				int[] range = { input[i - 1], input[i], input[i + 1] };
				Array.Sort(range);
				if (range[1] == input[i]) count++;
			}

			Console.WriteLine(count);
		}
	}
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n,k;
	cin >> n >> k;
	VL h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	SORT(h);
	LL ans = INT64_MAX;
	for (int i = 0; i < n-k+1; i++) {
		ans = min(ans,h[i+k-1] - h[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B,P1;
  cin >> N >> A >> B;
  
  P1 = N * A;
  
	if (P1 > B) {
		cout << B << endl;
    }
  else {
      cout << P1 << endl;
  } 
}

Measured memory_bytes: 3584
//g++ -std=gnu++14 a.cpp
//#include <bits/stdc++.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int count(int x,int y,int n){
  int res = 0;
  for(int i = 1;i <= n;i++){
    //int a = int(to_string(i).at(0)) - int('0');
    int b = i%10;
    if(b == y){
      int a = i;
      while(a/10 > 0){
        a /= 10;
      }
      if(a == x)res++;
    }
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  int ans = 0;

  for(int i = 0;i <= 9;i++){
    for(int j = 0;j <= 9;j++){
      int a = count(i,j,N);
      int b = count(j,i,N);
      ans += a*b;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.size()==k or s.size()<k)
	{
		cout<<s<<endl;
	}
	else
	{
		for(int i=0;i<k;i++)
		{
			cout<<s[i];
		}
		cout<<"..."<<endl;
	}
	
	
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repe(i,n) for(int i=0;i<n;i++)
#define repa(i,j,n) for(int i=j;i<n;i++)
//#define v.all() v.begin(),v.end()
#define repr(i,n) for(int i=n;i>=0;i--)
#define int long long int
#define vi vector<int>
#define vpi vector<pair<int,int>>
int gcd(int a,int b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
vi primef(int n){
	vi a,ref;
	a.push_back(1);
	while(n%2==0) {
		a.push_back(2);
		n/=2;
	}
	for(int i=3;i<=sqrt(n);i+=2){
		while(n%i==0){
			a.push_back(i);

			n/=i;
		}
	}
	if(n>2) a.push_back(n);
	sort(a.begin(), a.end());
	ref.push_back(a[0]);
	for(int i=1;i<a.size();i++){
		if(a[i]!=a[i-1]) {
			ref.push_back(a[i]);
		}
	}
	return ref;
}

signed  main(){
	int t=1;
	//cin>>t;
	while(t--) {
		int ai,bi;
		cin>>ai>>bi;
		vi a,b;
		a=primef(ai);
		b=primef(bi);
		// for(int i=0;i<a.size();i++){
		// 	cout<<a[i]<<" ";
		// }
		// cout<<endl;
		// for(int i=0;i<b.size();i++){
		// 	cout<<b[i]<<" ";
		// }
		// cout<<endl;
		int ct=0;
		map<int,int> m;
		rep(i,a.size()) m[a[i]]=0;
		rep(i,b.size()) m[b[i]]=0;
		rep(i,a.size()) m[a[i]]=1;
		rep(i,b.size()){
			if(m[b[i]]==1) {ct++;}
		}
		cout<<ct<<endl;
	}
	return 0;
}

Measured memory_bytes: 3612
package main

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

var sc = bufio.NewScanner(os.Stdin)
const inf = 1 << 60
func init() {
	sc.Split(bufio.ScanWords)
}
func ri() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func diff(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}
func chmin(a *int, b int) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}
func main() {
	a, b, q := ri(), ri(), ri()
	ss := make([]int, a)
	for i := range ss {
		ss[i] = ri()
	}
	ts := make([]int, b)
	for i := range ts {
		ts[i] = ri()
	}
	xs := make([]int, q)
	for i := range xs {
		xs[i] = ri()
	}
	ss = append([]int{-inf}, ss...)
	ss = append(ss, inf)
	ts = append([]int{-inf}, ts...)
	ts = append(ts, inf)
	for _, x := range xs {
		fmt.Println(query(x, ss, ts))
	}
}
func query(x int, ss, ts []int) int {
	sr := ss[binarysearch(ss, x)]
	tr := ts[binarysearch(ts, x)]
	sl := ss[binarysearch(ss, x)-1]
	tl := ts[binarysearch(ts, x)-1]
	minDist := inf
	chmin(&minDist, diff(x, sr)+diff(sr, tr))
	chmin(&minDist, diff(x, sr)+diff(sr, tl))
	chmin(&minDist, diff(x, sl)+diff(sl, tr))
	chmin(&minDist, diff(x, sl)+diff(sl, tl))
	chmin(&minDist, diff(x, tr)+diff(tr, sr))
	chmin(&minDist, diff(x, tr)+diff(tr, sl))
	chmin(&minDist, diff(x, tl)+diff(tl, sr))
	chmin(&minDist, diff(x, tl)+diff(tl, sl))
	return minDist
}
func binarysearch(a []int, target int) int {
	isOK := func(i int) bool { return a[i] > target }
	return sort.Search(len(a), isOK)
}


Measured memory_bytes: 8704
n=int(input())
A = list(map(int, input().split()))
result=1
limit=10**18
flg0=0
flg=0
for i in range(n):
  if A[i] == 0:
    flg0=1
    print('0')
for i in range(n):
  if flg0 == 1:
    break
  result *= A[i]
  if result > limit:
    print('-1')
    flg=1
    break
if flg != 1 and flg0 != 1:
  print(result)

Measured memory_bytes: 21580
N = int(input())
A = list(map(int, input().split()))
res = 0
n = 0
quot = (10 ** 9) + 7
while 1:
  p = 0
  q = 0
  temp = 0
  for i, var in enumerate(A):
    if var % 2 == 1:
      p += 1
    else:
      q += 1
    A[i] = A[i] >> 1
    temp += var
  
  if temp == 0:
    break
  res += p*q*(2**n)
  res %= quot
  n += 1
print(res)  


Measured memory_bytes: 124536
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		int n = Integer.parseInt(reader.readLine());
		while (n-- > 0) {
			String lines = reader.readLine();
			int[] nums = new int[lines.length()];
			char[] chs = new char[lines.length()];
			for (int i = 0; i < lines.length(); i++) {
				chs[i] = lines.charAt(i);
			}
			Arrays.sort(chs);
			char[] chs2 = new char[chs.length];
			int count = 0;
			for (int i = chs.length-1; i >= 0; i--) {
				chs2[count] = chs[i];
				count++;
			}
			int a = Integer.parseInt(String.valueOf(chs2));
			int b = Integer.parseInt(String.valueOf(chs));
			System.out.println(a - b);

		}

	}
}

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

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

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

int main() {
	ll N, K;
	cin >> N >> K;

	vector<ll> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	ll count1 = 0, count2 = 0;

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (A[i] > A[j]) count1++;
		}
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (A[i] > A[j]) count2++;
		}
	}

  ll ans = 0;
  ll temp = 1e9 + 7;
  ans = (K - 1) * K / 2;
  ans %= temp;
  ans *= count2;
  ans %= temp;
  ans += count1 * K;
  ans %= temp;
  cout << ans << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 2147483647;
const ll MOD = 1e9 + 7;

int n, cnt = 0;
int S[500000];

void merge(int A[], int left, int mid, int right)
{
    int n1 = mid - left, n2 = right - mid;
    int L[n1], R[n2];
    for (int i = 0; i < n1; i++) {
        L[i] = A[left + i];
    }
    for (int i = 0; i < n2; i++) {
        R[i] = A[mid + i];
    }
    L[n1] = R[n2] = INF;
    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        if (L[i] <= R[j]) {
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
        cnt++;
    }
}

void mergeSort(int A[], int left, int right)
{
    if (left + 1 < right) {
        // cnt++;
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, n) { cin >> S[i]; }
    mergeSort(S, 0, n);
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << S[i];
    }
    cout << "\n"
         << cnt << endl;
    return 0;
}


Measured memory_bytes: 6944
#include<iostream>
#include<string>

using namespace std;
typedef long long ll;

ll dp[100010][2];
int C = 1000000007;

int main()
{
  string S;
  cin >> S;
  for( int i=0;i<S.length()+5;i++)
    {
      dp[i][0] = 0;
      dp[i][1] = 0;
    }
  dp[0][0] = 1;

  for( int i=0;i<S.length();i++)
    {
      if(S[i] == '0')
	{
	  dp[i+1][0] = dp[i][0];
	  dp[i+1][1] = (3*dp[i][1])%C;
	}
      else
	{
	  dp[i+1][0] = (2*dp[i][0])%C;
	  dp[i+1][1] = (3*dp[i][1]+dp[i][0])%C;	  
	}
    }

  cout << (dp[S.length()][0]+dp[S.length()][1])%C << endl;
  
}


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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

int n, m, r, ans = inf;
int d[514][514];
int x[19];

void out() {
	rep(i, n) {
		rep(j, n) {
			if (d[i][j] == inf) cout << "INF";
			else {
				cout << d[i][j] << " ";
			}
		}
		cout << endl;
	}
	cout <<  endl;
}

void warshall_floyd(int n) {              //ｎは頂点の数
	for (int i = 0; i < n; i++) {         //経由する頂点
		for (int j = 0; j < n; j++) {     //開始頂点
			for (int k = 0; k < n; k++) { //終点
				d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
			}
		}
	}
}

signed main() {
	cin >> n >> m >> r;
	rep(i, n) {
		rep(j, n) {
			d[i][j] = inf;
		}
	}
	rep(i, n) d[i][i] = 0;
	rep(i, r) {
		cin >> x[i];
		x[i]--;
	}
	rep(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		d[a][b] = c, d[b][a] = c;
	}

	warshall_floyd(n);

	sort(x, x + r);
	do {
		int cnt = 0;
		for (int i = 1; i < r; i++) {
			cnt += d[x[i - 1]][x[i]];
		}
		ans = min(ans, cnt);
	} while (next_permutation(x, x + r));
	cout << ans << endl;

	return 0;
}


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

int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;

  if (a > 0) {
    cout << (b - a) * e << endl;
  } else if (a == 0) {
    cout << d + (b - a) * e << endl;
  } else {
    cout << (-a) * c + d + b * e << endl;
  }

  return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <vector>   
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main() {
  int n, x;
  string ans;
  cin >> n;
  if (n > 10) {
    x = n % 10;
  } else {
    x = n;
  }
  if (x == 3) {
     ans = "bon";
  } else if (x == 0 || x ==1 || x == 6 || x == 8) {
    ans =  "pon";
  } else {
    ans =  "hon";
  }
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 3144
#include<cstdio>
int f0[2005], f1[2005];
int a[2005];

int max(int a,int b){ return a>b?a:b; }

int min(int a,int b){ return a>b?b:a; }

int abs(int a){ return a>=0?a:-a; }

int main(){
    int n,z,w;
    scanf("%d%d%d",&n,&z,&w);
    for(int i = 1; i <= n; i++) scanf("%d",&a[i]);
    for(int i = n; i >= 1; i--){
        int last = a[i-1];
        if(i==1) last = w;
        //printf("last = %d\n",last);
        f0[i] = abs(a[n]-last);
        for(int j = i; j < n; j++) f0[i] = max(f0[i],f1[j+1]);
        last = a[i-1];
        if(i==1) last = z;
        f1[i] = abs(a[n]-last);
        for(int j = i; j < n; j++) f1[i] = min(f1[i],f0[j+1]);
        //printf("f0[%d] = %d, f1[%d] = %d\n",i,f0[i],i,f1[i]);
    }
    printf("%d\n",f0[1]);
    return 0;
}


Measured memory_bytes: 1688
import Foundation

// 標準入力からnとmを受け取る
let nm = readLine()!.split(separator:" ").map{Int($0)!}
let n = nm[0]
let m = nm[1]

// 標準入力からkとsを受け取る
// 要素がすべて0で初期化されたn*mの2次元配列Sを用意
var S = [[Int]](repeating:[Int](repeating:0, count:m), count:n)
// Sに入力値を入れていく
for i in 0..<m{
    let s = readLine()!.split(separator:" ").map{Int($0)!}
    // s[0]==k
    for j in 0...s[0]{
        // kは除く
        if j == 0 {
            continue
        }
        S[s[j]-1][i] = 1
    }
}

// 標準入力からpを受け取る (答えの配列)
let p = readLine()!.split(separator:" ").map{Int($0)!}

// 答えを入れる変数を用意
var ans = 0

// 要素数nの集合についてbit全探索を行う
// 0~n^2のループ
for bit in 0..<(1<<n){

    // 電球の状態を持つ配列 (点灯しているなら1,消えているなら0)
    var check = [Int](repeating:0, count:m)
    
    // 順に左にシフトさせ最下位bitのチェックを行う
    for i in 0..<n{
    
        // フラグが立っているかどうかの判定
        if bit & 1<<i > 0 {
        
            // フラグが立っていた時の処理 (フラグが立つ = スイッチを入れる)
            // 各電球に対して全探索
            for j in 0..<m{
            
                // S[i][j] == 1ならばスイッチと電球はつながっている
                // スイッチを入れると点灯と消灯が反転する
                if S[i][j] == 1 && check[j] == 1{
                    check[j] = 0
                }
                else if S[i][j] == 1 && check[j] == 0{
                    check[j] = 1
                }
            }
        }
    }
    
    // 一致しているならすべて点灯している
    if p == check{
        ans += 1
    }
}

// 答えの出力
print(ans)

Measured memory_bytes: 13664
#include<bits/stdc++.h>
using namespace std;
const int N=20;
int a[N];
int x[N][N];
int y[N][N];
inline int lowbit(int n){
    return n&(-n);
}
inline int one_number(int n){
    int t=0;
    while(n){
        n-=lowbit(n);
        t++;
    }
    return t;
}
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        for(int j=1;j<=a[i];++j){
            cin>>x[i][j]>>y[i][j];
        }
    }
    int ans=0;
    for(int i=1;i<(1<<n);++i){
        bool flag=true;
        bool f=false;
        for(int j=1;j<=n;++j){
            if((i>>j-1)&1){
                for(int k=1;k<=a[j];++k){
                    if((i>>(x[j][k]-1)&1)^y[j][k]){
                        flag=false;
                        f=true;
                        break;
                    }
                }
                if(f) break;
            }
        }
        if(flag) ans=max(ans,one_number(i));
    } 
    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <iostream>

using namespace std;

namespace {

struct Process {
  char name[10];
  // required time to process this task.
  int time;
};

// Ring-buffer based queue. Enqueue and dequeue run in O(1).
template <typename T, int N>
class Queue {
 public:
  // Note: leave one element empty so that we can distinguish
  // that the ring buffer is empty or full.
  Queue() : size_(N + 1),
            begin_((T *)data_), end_((T *)data_ + N + 1),
            head_((T *)data_), tail_((T *)data_) {}

  void Enqueue(T p) {
    assert(!IsFull());
    *tail_ = p;
    tail_ = next(tail_);
  }

  T Dequeue() {
    assert(!Empty());
    auto p = head_;
    head_ = next(head_);
    return *p;
  }

  bool IsFull() const {
    return head_ == next(tail_);
  }

  bool Empty() const { return head_ == tail_; }

 private:
  T* next(T* p) const {
    return p + 1 == end_ ? begin_ : p + 1;
  }

  char data_[sizeof(T) * (N + 1)];
  const int size_;
  T* const begin_;
  T* const end_;
  T* head_;
  T* tail_;
};

} // namespace

int main() {
  int n;
  int q;
  cin >> n >> q;

  Queue<Process, 100000> queue;
  for (int i = 0; i < n; ++i) {
    Process p;
    cin >> p.name >> p.time;
    queue.Enqueue(p);
  }

  int current_time = 0;
  while (!queue.Empty()) {
    auto p = queue.Dequeue();
    const int used = min(p.time, q);
    p.time -= used;
    current_time += used;

    if (p.time <= 0) {
      cout << p.name << " " << current_time << endl;
      continue;
    }
    queue.Enqueue(p);
  }
  return 0;
}

Measured memory_bytes: 4552
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──████AJ████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/

#include<bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll unsigned long long

int main() {
	ll mod = 1e9 + 7;
	int H, W;
	char c;
	cin >> H >> W;
	vector<vector<ll>> matrix(H, vector<ll>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c;
			matrix[i][j] = c == '#' ? -1 : 0;
		}
	}

	matrix[0][0] = 1;

	for (int j = 1; j < W; j++) {
		if (matrix[0][j] == 0) {
			matrix[0][j] = 1;
		}
		else {
			break;
		}
	}


	for (int i = 1; i < H; i++) {
		if (matrix[i][0] == 0) {
			matrix[i][0] = 1;
		}
		else {
			break;
		}
	}

	for (int i = 1; i < H; i++) {
		for (int j = 1; j < W; j++) {
			if (matrix[i][j] != -1) {
				matrix[i][j] = ((matrix[i - 1][j] != -1 ? matrix[i - 1][j] : 0)
				                + (matrix[i][j - 1] != -1 ? matrix[i][j - 1] : 0)  % mod);
			}
		}
	}

	cout << (matrix[H - 1][W - 1] % mod) << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, A; scanf("%d %d", &N, &A);
  vector<int> X(N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &X[i]);
    X[i] -= A;
  }

  int T = N * 50;
  vector<vector<ll>> dp(N + 5, vector<ll>(2 * T + 5, 0));
  dp[0][T] = 1;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= 2 * T; ++j) {
      dp[i][j] = dp[i - 1][j] + dp[i - 1][j - X[i - 1]];
    }
  }

  ll ans = dp[N][T] - 1;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n, k;
  cin >> n >> k;
  ll ans = 0;
  ll a = 0, b = 0, c = 0;
  vector<ll> num(k);
  for(int i = 1 ; i <= n; ++i){
    num[i%k]++;
  }

  if(k % 2){
    ans += pow(num[0], 3);
  } else {
    ans += pow(num[0], 3);
    ans += pow(num[k / 2], 3);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define Rint register int
#define MP make_pair
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
template<typename T>
inline void read(T &x){
    int ch = getchar(); x = 0;
    bool f = false;
    double d = 1;
    for(;ch != '-' && (ch < '0' || ch > '9');ch = getchar());
    if(ch == '-'){f = true; ch = getchar();}
    for(;ch >= '0' && ch <= '9';ch = getchar()) x = x * 10 + ch - '0';
    if(ch == '.') for(ch = getchar();ch >= '0' && ch <= '9';ch = getchar()) x += (ch - '0') * (d *= 0.1);
    if(f) x = -x;
}
template<typename T>
inline bool chkmax(T &a, const T &b){if(a < b) return a = b, 1; return 0;}
template<typename T>
inline bool chkmin(T &a, const T &b){if(a > b) return a = b, 1; return 0;}
const int N = 100003;
int n, fa[N], f, r;
set<int> S[N];
map<pii, int> M;
pii q[N];
inline int getfa(int x){
	while(x != fa[x]) x = fa[x] = fa[fa[x]];
	return x;
}
int main(){
	read(n);
	for(Rint i = 1;i <= n;++ i) fa[i] = i;
	for(Rint i = 1, u, v;i <= 2 * (n - 1);++ i){
		read(u); read(v);
		S[u].insert(v); S[v].insert(u);
		++ M[MP(u, v)]; ++ M[MP(v, u)];
		if(M[MP(u, v)] == 2) q[r ++] = MP(u, v);
	}
	while(f < r){
		int u = q[f].fi, v = q[f].se; ++ f;
		u = getfa(u); v = getfa(v);
		if(S[u].size() < S[v].size()) swap(u, v);
		fa[v] = u; S[u].erase(v); S[v].erase(u);
		for(Rint x : S[v]){
			S[x].erase(v); S[x].insert(u); S[u].insert(x);
			M[MP(x, v)] = M[MP(v, x)] = 0;
			++ M[MP(x, u)]; ++ M[MP(u, x)];
			if(M[MP(x, u)] == 2) q[r ++] = MP(x, u);
		}
		S[v].clear();
	}
	puts(r == n - 1 ? "YES" : "NO");
}

Measured memory_bytes: 56704
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
  int N,K; cin>> N >> K;
  int l[50];
  for ( int i = 0; i < N; i++ ) cin >> l[i];
  sort(l,l+N,greater<int>());
  int sum = 0;
  for ( int i = 0; i < K; i++ ) {
    sum += l[i];
  }

  cout <<sum << endl;
  return 0;
}


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

int main(){
  int a, b;
  cin >> a >> b;

  int n = min(a, b);

  for(int i=0; i<max(a, b); ++i){
    cout << n;
  }
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d %d\n%s" @@ fun n k s ->
  let ss = Array.make n 1 in
  let ls = Array.make n 0 in
  for i = 1 to n - 1 do
    if s.[i - 1] = s.[i]
    then begin
      ss.(i) <- ss.(i - 1);
      ls.(ss.(i)) <- 1 + ls.(ss.(i))
    end else begin
      ss.(i) <- ss.(i - 1) + 1
    end
  done;
  Printf.printf "%d\n" @@
  Array.fold_left ( + ) 0 ls + min (ss.(n - 1) - 1) (2 * k)


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

int main()
{
  int A,B,K;
  cin >> A >> B >> K;
  if((B-A+1)<=2*K){
    for(int i = 0;i < (B-A+1);i++){
      cout << (A+i) << endl;
    }
  } else{
    for(int i = 0;i < K;i++){
      cout << (A+i) << endl;
    }
    for(int i = K -1;i >= 0;i--){
      cout << (B - i) << endl;
    }
  }
  return 0;
}


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

using namespace std;



void solve() {
	int n;
	cin >> n;
	vector<int> a(n);

	int res = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	//set<int> cur(s.begin(), s.end());
	//vector<int> a(cur.begin(), cur.end());

	//n = cur.size();


	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			for (int k = j + 1; k < n; ++k) {
				if (a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) {
					continue;
				}
				res += (a[i] + a[j] > a[k]);
			}
		}
	}
	cout << res << endl;
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);

	int t;
	//cin >> t;
	t = 1;

	for (int tt = 0; tt < t; ++tt) {
		solve();
	}


	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m, w;
	cin >> n >> m >> w;
	char a[n][m];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	// for (int i = 0; i < n; i++) {
	// 	for (int j = 0; j < m; j++) {
	// 		cout << a[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	int ans = 0;
	for (int mask1 = 0; mask1 < (1 << n); mask1++) {
		for (int mask2 = 0; mask2 < (1 << m); mask2++) {
			int have = 0;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					if (!((mask1 >> i) & 1) && !((mask2 >> j) & 1) && a[i][j] == '#') {
						have++;
					}
				}
			}
			if (have == w)ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define endl "\n"
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 
using namespace std;

int main(int argc, char const *argv[])
{
	long double a, b, h, m; cin >> a >> b >> h >> m;
	long double deg = 2*3.14159265358979323846264338327950L*(h/12.0 + (m/60.0)/12.0 - m/60.0);
	long double c = a*a + b*b - 2*a*b*cosl(deg);
	cout << fixed << setprecision(20) << sqrt(c);
	return 0;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  sort(all(a));
  sort(all(b));
  if(n % 2) {
    cout << b[n / 2] - a[n / 2] + 1 << endl;
    return 0;
  }
  ll x = (a[n / 2] + a[n / 2 - 1]);
  ll r = x % 2;
  x /= 2;
  ll y = (b[n / 2] + b[n / 2 - 1]);
  ll s = y % 2;
  y /= 2;
  ll ans = (y - x) * 2 + 1;
  if(r) ans--;
  if(s) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 6352
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N, M;
vector<ll> X, Y;

signed main(){
    cin >> N >> M;
    X.resize(N);
    rep(i, N) cin >> X[i];
    sort(all(X));
    Y.resize(M);
    rep(i, M) cin >> Y[i];
    sort(all(Y));

    ll tmp1 = 0;
    rep(i, N-1){
        tmp1 += (X[i+1]-X[i])*(i+1)%MOD*(N-i-1)%MOD;
    }
    tmp1 %= MOD;
    ll tmp2 = 0;
    rep(i, M-1){
        tmp2 += (Y[i+1]-Y[i])*(i+1)%MOD*(M-i-1)%MOD;
    }
    tmp2 %= MOD;
    cout << tmp1 * tmp2 % MOD << endl;
}

Measured memory_bytes: 4804
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define MOD 1000000007
#define ar array
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);

int32_t main() {
	fast_io;

	// int t; cin >> t;
	// while (t--) {
		
	// }
	int n;
	cin >> n;
	vector<double> p_head(n);
	vector<double> p_tail(n);
	for (int i = 0; i < n; i++) {
		cin >> p_head[i];
		p_tail[i] = 1 - p_head[i];
	}
	vector<vector<double>> dp(n + 1, vector<double> (n + 1, 0));
	dp[0][0] = 1;
	double tail_prob = 1;
	for (int i = 1; i <= n; i++) {
		tail_prob *= p_tail[i - 1];
		dp[i][0] = tail_prob;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			dp[i][j] = dp[i - 1][j]*(1 - p_head[i - 1]) + dp[i - 1][j - 1]*p_head[i - 1];
		}
	}
	double res = 0;
	for (int head = (n + 1)/2; head <= n; head++) {
		res += dp[n][head];
	}
	cout << fixed;
	cout << setprecision(10) << res << endl;

	return 0;
}

Measured memory_bytes: 73724
#include<bits/stdc++.h>
using namespace std;
long long a,b,ans=999999999999999,n;//ans一定要开始赋值大一点
int main()
{
    cin>>a;
    for(int s=0;s<a;s++)
    {
        cin>>b;
        n=0;
        while(b%2==0)//不断的除
        {
            b=b/2;
            n++;
        }
        ans=min(ans,n);//除二次数最少的那个数的次数
    }
    cout<<ans<<endl;//输出
    return 0;
}

Measured memory_bytes: 256
x, n = gets.split.map(&:to_i)
if n == 0
    puts x
    exit 0
end

array = gets.split.map(&:to_i)

min = 100
ans = 0

-1.step(101) do |i|
    next if array.include?(i)
    if (x - i).abs < min
        min = (x - i).abs
        ans = i
    end
end

puts ans


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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
char chlit(char c){return c+32;}
char chbig(char c){return c-32;}

int main(){
  int h[1000],w[1000];
  rep(i,1000){
    cin >> h[i] >> w[i];
    if(h[i] == 0&&w[i] == 0)break;
  }
  for(int k=0;k<1000;k++){
    if(h[k] == 0&&w[k] ==0 )break;
    for(int i=0;i<w[k];i++)cout << "#";
    cout << endl;
    for(int i=0;i<h[k]-2;i++){
      cout << "#";
      for(int j=0;j<w[k]-2;j++)cout << ".";
      cout << "#" << endl;
    }
    for(int i=0;i<w[k];i++)cout << "#";
    cout << endl << endl;
  }
  return 0;
}



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

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

    int a , b, c, d;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0) {
        c = c - b;
        if(c <= 0) {
            cout << "Yes" << "\n";
            return 0;
        }
        a = a - d;
        if(a <= 0) {
            cout << "No" << "\n";
            return 0;
        }
    }
    if(a > c)
        cout << "Yes" << "\n";
    else
        cout << "No" << "\n";

    return 0;
}


Measured memory_bytes: 3604
n=int(input())
ans=[]
for i in range(n):
  u,k,*v=list(map(int,input().split()))
  s = [0 for i in range(n)]
  for j in v:
    s[j-1]=1
  ans.append(s) 

for i in ans:
  I=map(str,i)
  print(" ".join(I))


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

int main() {
  int X;
  cin >> X;
  
  if (X >= 400 && X <= 599) {
    cout << 8;
  }
  else if (X >= 600 && X <= 799) {
    cout << 7;
  }
  else if (X >= 800 && X <= 999) {
    cout << 6;
  }
  else if (X >= 1000 && X <= 1199) {
    cout << 5;
  }
  else if (X >= 1200 && X <= 1399) {
    cout << 4;
  }
  else if (X >= 1400 && X <= 1599) {
    cout << 3;
  }
  else if (X >= 1600 && X <= 1799) {
    cout << 2;
  }
  else if (X >= 1800 && X <= 1999) {
    cout << 1;
  }
  
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <functional>
typedef long long ll;
typedef long double ld;
using namespace std;

ll divup(ll a, ll b)
{
	if (a % b == 0) return a / b;
	return a / b + 1;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n, x, t;
	cin >> n >> x >> t;
	cout << divup(n, x) * t << endl;
	return 0;
}

Measured memory_bytes: 3644