akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std ;

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

int main(){
  int a,b,c ;
  cin >> a >> b >> c ;
  if(a>b) swap(a,b) ;
  if(b>c) swap(b,c) ;
  cout << a+b+10*c << endl ;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cctype>
#include<map>
#include<algorithm>
#define reg register
using namespace std;
typedef long long ll;
map<ll,int>p,q;
const int N=2e5+5;
int n,a[N];
ll sum[N],ans,c[N][3];
inline int read()
{
	int x=0,w=1;
	char c=getchar();
	while (!isdigit(c)&&c!='-') c=getchar();
	if (c=='-') c=getchar(),w=-1;
	while (isdigit(c))
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*w;
}
int main()
{
	n=read();
	for (reg int i=0;i<=n;i++)
	{
		c[i][0]=1;
		if (i==0) continue;
		for (reg int j=1;j<=min(i,2);j++)
		  c[i][j]=c[i-1][j]+c[i-1][j-1];
	}
	for (reg int i=1;i<=n;i++)
	{
		a[i]=read(); 
		sum[i]=sum[i-1]+a[i];
		++p[sum[i]];
	}
	for (reg int i=1;i<=n;i++)
	{
		if (q[sum[i]]) continue;
		if (sum[i]==0) ans+=c[p[sum[i]]][2]+p[sum[i]];
		else if (p[sum[i]]>1) ans+=c[p[sum[i]]][2];
		q[sum[i]]=1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 32256
#include <stdio.h>

int main()
{
    int a=0,b=0,c=0,x=0,count=0;
    scanf("%d %d %d %d",&a,&b,&c,&x);

    for(int i=0;i<=a;i++){
	for(int j=0;j<=b;j++){
	    for(int k=0;k<=c;k++){
		if(x==500*i+100*j+50*k)
		    count++;
	    }
	}
    }

    printf("%d\n",count);

    return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int knum[50];

int main(){
	while(1){
		int n,p;
		cin >> n >> p;
		if(n==0&&p==0) break;
		REP(i,50) knum[i] = 0;
		int nowwan = p;
		int nowp = 0;
		int winner;
		while(1){
			if(nowwan==0){
				bool rst = true;
				REP(i,n) if(i!=nowp&&knum[i]!=0) rst = false;
				if(rst) {
					winner = nowp;
					break;
				}else{
					nowwan = knum[nowp];
					knum[nowp] = 0;
				}
			}else{
				nowwan--;
				knum[nowp]++;
			}
			if(nowp == n-1) nowp = 0;
			else nowp++;
		}
		cout << winner << endl;
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)

int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   int a , b;
   cin >> a >> b;
   cout << (a + b - 1) / b << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define write(x) printf("%d\n", x)
using namespace std;
typedef long long ll;
template <typename T>
void read(T &x)
{
	x = 0;
	char c;
	while (!isdigit(c = getchar()));
	do
	{
		x = (x << 1) + (x << 3) + (c ^ 48);
	}while (isdigit(c = getchar()));
}
int main()
{
	int h, a;
	read(h);read(a);
	write((h + a - 1) / a);
	return 0;
}
 

Measured memory_bytes: 256
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        a[0] = 11;
        int num = a[0];
        System.out.println(a[0] + " ");

        boolean bl;
        for(int i=1; i<n; i++){
            do{
                num += 10;
            }while(primJudge(num) == false);
            a[i] = num;
            System.out.println(a[i] + " ");   
        }
    }

    public static  boolean primJudge (int k){
        boolean bl = true;
        for(int j=2; j*j<=k; j++){
            if(k % j == 0){
                bl = false;
                break;
            }
        }
        return(bl);
    }
}

Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  
  vector<ll>A(N);
  vector<ll>T(N);
  rep(i,N){
    cin>>T[i]>>A[i];
  }
  ll mul=1;
  for(ll i=1;i<N;i++){
if((T[i-1]*mul)/T[i]>(A[i-1]*mul)/A[i]){
  if((T[i-1]*mul)%T[i]==0){
    mul=(T[i-1]*mul)/T[i];
  }
  else{
mul=((T[i-1]*mul)/T[i])+1;
  }
}
    else{
       if((A[i-1]*mul)%A[i]==0){
    mul=(A[i-1]*mul)/A[i];
  }
  else{
mul=((A[i-1]*mul)/A[i])+1;
  }
      
    }
      

    
  }
cout<<A[N-1]*mul+T[N-1]*mul<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
int main(){
  string s, str;
  int n;
  while(cin >> n, n){
    cin.ignore();
    s.clear();
    str.clear();
    while(n--){
      getline(cin, s);
      str += s;
      str += " ";
    }
    //cout << str << endl;
    map<string, int> text;
    s = "";
    for(int i = 0 ; i < str.size() ; i++){
      if(str[i] == ' '){
	text[s]++;
	s.clear();
	i++;
      }
      s += str[i];
    }
    int cnt=0, nmax = 0;
    char search; 
    cin >> search;
    
    for(map<string,int>::iterator it = text.begin() ; it != text.end() ; it++){
      s = it->first;
      if(s[0] == search){
	cnt++;
      }
    }
    if(cnt == 0){
      cout << "NA" << endl;
      continue;
    }
    if(cnt > 5) cnt = 5;
    
    while(cnt--){
      nmax = 0;
      for(map<string,int>::iterator it = text.begin() ; it != text.end() ; it++){
	s = it->first;
	if(s[0] == search){
	  nmax = max(nmax, it->second);
	}
      }
      
      for(map<string,int>::iterator i = text.begin() ; i != text.end() ; i++){
	s = i->first;
	if(i->second == nmax && s[0] == search){
	  cout << s;
	  if(cnt == 0) cout << endl;
	  else cout << ' ';
	  i->second = -1;
	  break;
	}
      }
    }
  }
  return 0;
}

    
    
    

Measured memory_bytes: 0
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        int ans = 1;
        int N = sc.nextInt();
        while(ans*2<=N)ans*=2;
        System.out.println(ans);
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 23380
import itertools
import math

antena = []
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))
antena.append(int(input()))

mod = []
idx = 0
for i in range(len(antena)):
    mod.append(antena[i] % 10)
    if(mod[i] == 0):
        mod[i]=10

idx = mod.index(min(mod))
sum = 0
for i in range(len(antena)):
    if i != idx:
        sum += math.ceil(antena[i]/10) * 10
print(sum + antena[idx])


Measured memory_bytes: 38384
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define whole(x) begin(x), end(x)
using ll = long long;
using namespace std;

int main() {
    // input
    int n, p; scanf("%d%d", &n, &p);
    vector<ll> a(n), b(n); repeat (i, n) scanf("%lld%lld", &a[i], &b[i]);
    // solve
    vector<int> order(n);
    iota(whole(order), 0);
    int result = 0;
    ll aa = 0, bb = accumulate(whole(b), 0ll);
    sort(whole(order), [&](int i, int j) {
        return (100 - p) * a[i] + p * b[i] > (100 - p) * a[j] + p * b[j];
    });
    for (int i : order) {
        aa += a[i];
        bb -= b[i];
        result += 1;
        if ((100 - p) * aa >= p * bb) break;
    }
    // output
    printf("%d\n", result);
    return 0;
}


Measured memory_bytes: 2176
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説通りに作成したソースコード
 * 
 * https://atcoder.jp/contests/abc087/submissions/5890910 にも参考
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), m = scanner.nextInt();
			UnionFind uf = new UnionFind(n);
			boolean result = true;
			for (int i = 0; i < m; i++) {
				int l = scanner.nextInt() - 1, r = scanner.nextInt() - 1, d = scanner.nextInt();
				if (uf.same(l, r)) {
					if (uf.diff(l, r) != d) {
						result = false;
						break;
					}
				} else {
					uf.unite(l, r, d);
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}

	/**
	 * Union Findの実装<br/>
	 * https://atcoder.jp/contests/abc087/submissions/5890910 を参考に作成
	 */
	private static class UnionFind {
		int[] par;
		int[] rank;
		int[] diff_weight;

		UnionFind(int n) {
			par = new int[n];
			rank = new int[n];
			diff_weight = new int[n];
			IntStream.range(0, n).forEach(i -> {
				par[i] = i;
				rank[i] = 0;
				diff_weight[i] = 0;
			});
		}

		int find(int x) {
			if (par[x] == x) {
				return x;
			}
			int r = find(par[x]);
			diff_weight[x] += diff_weight[par[x]];
			return par[x] = r;
		}

		int weight(int x) {
			find(x);
			return diff_weight[x];
		}

		boolean same(int x, int y) {
			return find(x) == find(y);
		}

		void unite(int x, int y, int w) {
			w += weight(x);
			w -= weight(y);
			x = find(x);
			y = find(y);
			if (x == y)
				return;
			if (rank[x] < rank[y]) {
				int tmp = x;
				x = y;
				y = tmp;
				w -= w;
			}
			par[y] = x;
			diff_weight[y] = w;
			return;
		}

		int diff(int x, int y) {
			return weight(y) - weight(x);
		}
	}
}


Measured memory_bytes: 61636
//#pragma GCC optimize(\"Ofast,no-stack-protector\")
//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx\")
//#pragma GCC target(\"avx,tune=native\")
// Neil

#include<bits/stdc++.h>

using namespace std;

typedef complex<double> base;
typedef long double ld;
typedef long long ll;

#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define pll pair< ll , ll >
#define vi vector<int>
#define vvi vector< vi >
const int MAXN=(int)(2e5+5);
const ll MOD=(ll)(1e9+7);
int t;
int dct[26];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    string str;
    cin>>str;
    bool fl = 0;
    for(int i=0;i<str.size()-1;i++){
        if(str[i]==str[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            fl = 1;
            break;
        }
    }
    if(!fl){
        for(int i=2;i<str.size();i++){
            memset(dct, 0, sizeof(dct));
            for(int j = i-2;j<=i;j++){
                dct[str[j]-'a']++;
            }
            for(int j=0;j<26;j++){
                if(dct[j]==2){
                    fl = 1;
                    cout<<i-1<<" "<<i+1<<endl;
                    break;
                }
            }
            if(fl==1)
                break;
        }
    }
    if(fl==0)
        cout<<-1<<" "<<-1<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
#include <stack>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n ; cin >> n ;
	stack<ll> s ;
	vb cat(100,false) ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		if(a<0){
			a *= -1 ;
			if(s.empty()||s.top()!=a){
				cout << i+1 << endl ;
				return 0 ;
			}else{
				s.pop() ;
				cat.at(a-1) = false ;
			}
		}else{
			if(cat.at(a-1)){
				cout << i+1 << endl ;
				return 0 ;
			}else{
				s.push(a) ;
				cat.at(a-1) = true ;
			}
		}
	}
	cout << "OK" << endl ;
}



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

int top, S[1000];

void push(int x){
	S[++top] = x;
}
int pop(){
	top--;
	return S[top+1];
}

int main(){
	int a, b;
	top = 0;
	char s[100];

	while (scanf("%s",s) != EOF){
		if (s[0] == '+'){
			a = pop();
			b = pop();
			push(a + b);
		}
		else if (s[0] == '-'){
			b = pop();
			a = pop();
			push(a - b);
		}
		else if(s[0] == '*'){
			a = pop();
			b = pop();
			push(a * b);
		}
		else{
			push(atoi(s));
		}
	}
	
	printf("%d\n", pop());
	return 0;
}


Measured memory_bytes: 2128
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll n,m;
	cin>>n>>m;
	if(n==1&&m==1){cout<<1<<endl; return 0;}
	if(n==1 || m==1){cout<<n*m-2LL<<endl; return 0;}
	else cout<<(n-2LL)*(m-2LL)<<endl;
	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (3e9)

using namespace std;
typedef long long int ll;

int N;
int main(void){
    cin >> N;
    bool f = false;
    for(int i=1;i<10;i++) for(int j=1;j<10;j++)
        if(i*j==N) f = true;
    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
n=int(input())
s=input()
ans=s.count("R")*s.count("G")*s.count("B")
for j in range(n):
  J=s[j]
  for i in range(j):
    k=2*j-i
    if k<n:
      I=s[i]
      K=s[k]
      if I!=J!=K!=I:
        ans-=1   
print(ans)

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

#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define f(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pc __builtin_popcount // counts number of 1's in bin(num)

const double pi = 2*acos(0.0);
//__gcd(n1, n2);
//cout << fixed;
//cout << setprecision(6); //fixes # of dp



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

    cout << fixed << setprecision(7);
	
    int n, k; 
    cin >> n >> k;
    double exp[n+1];
    exp[0] = 0;
    f(i, 1, n+1){
        cin >> exp[i];
        exp[i] = (1 + exp[i])/2;
    }
    f(i, 1, n+1){
        exp[i] += exp[i-1];
    }
    double maxx = exp[k-1];
    f(i, k, n+1){
        maxx = max(maxx, exp[i] - exp[i-k]);
    }
    cout << maxx;

}   








Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>

using namespace std;


char mat[102][102];
int dirs[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int m, n, res;

void dfs(int x, int y) {
  char t = mat[x][y];
	mat[x][y] = '.';  //标记，标记过的就是一个连通区域了
	int xx, yy;
	for (int i = 0; i < 4; i++) {
		xx = x + dirs[i][0];
		yy = y + dirs[i][1];
		if (xx >= 0 && xx < m && yy >= 0 && yy < n && mat[xx][yy] == t) {
			dfs(xx, yy);
		}
	}
}

void solve() {
	res = 0;
	for (int i = 0; i < m; i++) cin >> mat[i];
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
      if (mat[i][j] != '.') {
        res++;
        dfs(i, j);
      }
		}
	}
}

int main() {
	while (cin >> m >> n && m > 0 && n > 0) {
		solve();
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 3492
#include <iostream>
#include <sstream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define PrintLn(X) cout << X << endl
#define Loop(n) for(int loop_ = n; loop_; --loop_)
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int T[100000];
int main(void)
{
	int N, C, K;
	cin >> N >> C >> K;
	Rep(i, N){
		cin >> T[i];
	}
	sort(T, T+N);
	int t = T[0];
	int I = 0;
	int ans = 1;
	Rep(i, N){
		if(i == I + C){
			I = i;
			t = T[i];
			ans++;
		}else if(T[i] > t + K){
			I = i;
			t = T[i];
			ans++;
		}
	}
	PrintLn(ans);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main()
{
	ios::sync_with_stdio(false);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	cout<<pow(n,3);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define md(a, b)		((a) % b + b) % b
#define mod(a)			md(a, MOD)
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define forn(i, n)			for(int i = 0; i < n; i++)
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
//int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef long long 		ll;
typedef long double ld;	
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1); 
int res[1000000];
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("asd.txt", "r", stdin);
	//freopen("qwe.txt", "w", stdout);
	int n;
	cin>>n;

	fore(i, 1, 100)
	fore(j, 1, 100)
	fore(k, 1, 100)
	{
		res[i * i + j * j + k * k + i * j + i * k + j * k]++;
	}
	fore(i, 1, n + 1)
	cout<<res[i]<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2	

Measured memory_bytes: 3880
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ll long long
using namespace std;

int main() {
  int n;
  cin >> n;
  if(n <= 999) cout << "ABC\n";
  else cout << "ABD\n";
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
using namespace std;

bool compare(vector<int> former, vector<int> latter){
    if(former[0] == latter[0]){
        return abs(former[1]) > abs(latter[1]);
    }else return former[0] < latter[0];
}

int main(void){
    int N, Q;
    cin >> N >> Q;

    vector<vector<int>> Events;
    int Sbuf, Tbuf, Xbuf, Dbuf;

    for(int i=0; i<N; i++){
        scanf("%d %d %d", &Sbuf, &Tbuf, &Xbuf);
        Events.push_back({Sbuf-Xbuf, 1, Xbuf}); //1:insert
        Events.push_back({Tbuf-Xbuf, -1, Xbuf}); //-1:delete
    }
    for(int i=0; i<Q; i++){
        scanf("%d", &Dbuf);
        Events.push_back({Dbuf, 0, i}); //0:query
    }

    sort(Events.begin(), Events.end(), compare);

    vector<int> dist(Q);
    multiset<int> roadwork;

    for(auto event: Events){
        if(event[1] == 1)roadwork.insert(event[2]);
        else if(event[1] == -1)roadwork.erase(roadwork.lower_bound(event[2]));
        else{
            dist[event[2]] = (roadwork.empty() ? -1 : *(roadwork.begin()));
            if(event[2] == Q-1)break;
        }
    }

    for(int d: dist)printf("%d\n", d);
    return 0;
}


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

#define ll long long
#define mod 1000000007

using namespace std;

ll a[100010];

int main()
{
    int n;
    ll x,b;
    cin >> n >> x >> b;

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

    ll ans = 0;

    for(int i=1;i<n;i++)
    {
        ll temp = a[i] - a[i-1];

        if(temp*x < b)
            ans += temp*x;
        else
            ans += b;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

struct freqency {
  
  int num;
  int freq;

}f[1000];

int main(void) {

  int n;

  int size=0;
  int max_freq=0;

  int mode[1000];
  int s=0;

  int i,j,temp;
  int flag;

  while(scanf("%d",&n)!=EOF) {
    //for(j=0;j<12;j++) {
    //scanf("%d",&n);
    flag=0;

    for(i=0;i<size;i++) {

      if(f[i].num==n) {
	flag=1;
	f[i].freq++;
      }

    }

    if(flag==0) {
	f[size].num=n;
	f[size].freq=1;
	size++;
    }

  }
  
  //for(j=0;j<10;j++) printf("%d %d\n",f[j].num,f[j].freq);

  for(i=0;i<size;i++) {

    if(max_freq<=f[i].freq) {
      max_freq=f[i].freq;
      mode[s]=f[i].num;
      s++;
    }

  }

  for(i=0;i<s;i++) {
    for(j=0;j<s-i-1;j++) {
      if(mode[j]>mode[j+1]) {
	temp=mode[j];
	mode[j]=mode[j+1];
	mode[j+1]=temp;
      }
    }
  }

  for(i=0;i<s;i++) {
    printf("%d\n",mode[i]);
  }

  

  return 0;

}

   

    

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;


int main() {
	ll n, m; cin >> n >> m;
	if (n == 1 && m == 1) {
		cout << 1 << endl;
		return 0;
	}
	if (n == 1 || m == 1) {
		int a = max(n, m);
		cout << a - 2 << endl;
		return 0;
	}
	cout << (n - 2)*(m - 2) << endl;
	return 0;
}

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

import sys
from bisect import bisect_left

s = input().strip()  # e.g., "contest"
t = input().strip()  # e.g., "son"
# s = "contest"
# t = "son"
# t = "programming"
# t = "sentence"

# 文字列 s 二周分の文字の出現位置マップを作る
s_map = [[] for _ in range(26)]
for i, ch in enumerate((s + s)):
    s_map[ord(ch) - ord('a')].append(i)

# t を舐めながら回答を作る
p = ans = 0
for ch in t:
    ch_position_list = s_map[ord(ch) - ord('a')]
    if len(ch_position_list) == 0:
        print('-1')
        sys.exit()

    p = ch_position_list[bisect_left(ch_position_list, p)] + 1
    if len(s) <= p:
        ans += len(s)
        p -= len(s)

ans += p
print(ans)


Measured memory_bytes: 13616
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
// const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

const int MAX = 1000010;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// int main() {
//     // 前処理
//     COMinit();

//     // 計算例
//     cout << COM(100000, 50000) << endl;
// }


int main () {

    COMinit();

    int h,w,a,b;cin>>h>>w>>a>>b;

    ll ans = COM(h-1+w-1,h-1);
    ll rest = 0;

    for (int i=1;i<=b;i++) {
        ll first = COM(h-a-1+i-1,i-1);
        ll second = (first*COM(w-1-i+1+a-1,a-1))%MOD;
        rest = (rest+second)%MOD;
    }

    cout<<(ans-rest+MOD)%MOD<<endl;

    // cout<<COM(3,0)<<endl;

}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int f[2010][2010],fac[4000010],inv[4000010];
inline int qpow(int a,int b) {
	int ans=1;
	while(b) {
		if(b&1)ans=1ll*ans*a%mod;
		a=1ll*a*a%mod;
		b>>=1;
	}
	return ans;
}
inline int C(int n,int m) {
	if(n<m)return 0;
	return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main() {
	int n,k;
	scanf("%d%d",&n,&k);
	if(k==1) {
		puts("1");
		return 0;
	}
	fac[0]=1;
	for(int i=1;i<=n*k;i++)fac[i]=1ll*fac[i-1]*i%mod;
	inv[n*k]=qpow(fac[n*k],mod-2);
	for(int i=n*k-1;i>=0;i--)inv[i]=1ll*inv[i+1]*(i+1)%mod;
	f[0][0]=1;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=i;j++) {
			f[i+1][j]=(f[i+1][j]+f[i][j])%mod;
			f[i][j+1]=(f[i][j+1]+1ll*C(n*k-i-j*(k-1)-1,k-2)*f[i][j])%mod;
		}
	printf("%lld\n",1ll*f[n][n]*fac[n]%mod);
	return 0;
}

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

int main()
{
	string s1, s2, s3;

	cin >> s1 >> s2 >> s3;

	cout << (char)(s1[0] - 'a' + 'A') << (char)(s2[0] - 'a' + 'A') << (char)(s3[0] - 'a' + 'A') << endl;

	return 0;
}


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

using namespace std;

int main() {
	int n, l; cin >> n >> l;
	vector<string> s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++) {
		cout << s[i];
}

	return 0;
}



Measured memory_bytes: 256
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int testsalam;cin >> testsalam;while(testsalam--)
#define Mod 100000007
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
#define endl '\n'
//void inversemod(ll n, ll mod, ll invmod[],ll MOD){for(int i=2; i<=n; ++i) invmod[i]=MOD-MOD/i*invmod[MOD%i]%MOD;}
//void bigmod( ll a, ll b ,ll mod){ll r = 1;a = a%mod;while(b){if( b%2 ) r = (r*a)%mod;b = b/2;a = (a*a)%mod; }return (ll)r;}

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll sum=min(a,d);
    d-=a;
    d-=b;
    d=max(0ll,d);
    sum-=(d);
    cout<<sum<<endl;
}


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

int ch2i(char ch) {
	int n = 0;
	switch (ch) {
	case'1':
		n += 1;
		break;
	case'2':
		n += 2;
		break;
	case'3':
		n += 3;
		break;
	case'4':
		n += 4;
		break;
	case'5':
		n += 5;
		break;
	case'6':
		n += 6;
		break;
	case'7':
		n += 7;
		break;
	case'8':
		n += 8;
		break;
	case'9':
		n += 9;
		break;
	}
	return n;
}


int main() {
	std::string input;
	while (std::cin >> input) {
		if (input == "0")
			break;
		int sum = 0;
		for (std::string::iterator i = input.begin(); i != input.end(); ++i) {
			sum += ch2i(*i);
		}
		std::cout << sum << std::endl;
	}
	return 0;
}

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

int main() {
    string N;
    cin >> N;
    if ((N[0] == N[1] && N[1]== N[2]) || (N[1] == N[2] && N[2] == N[3])) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
vector <int> wow(1000001);

bool prime(int m){
	if(m < 2)return false;
	if(m == 2)return true;
	if(m%2 == 0)return false;

	for(int i = 3; i*i <= m; i += 2){
		if(m%i == 0)return false;
	}
		return true;
}

int main(){

	for(int i = 0; i < 1000001; ++i){
	if(prime(i)){
					wow[i] = 1;
				}else{
					wow[i] = 2;
				}
	}


	int n;
	
	while(cin >> n){
		int a=0;
		for(int i = 1; i <= n; ++i){
		if(wow[i] == 1){
				++a;
			}
	}
		cout << a << '\n';
	}
}

Measured memory_bytes: 0
N = int(input())


def yakusuu(num):
    res = 0
    for i in range(num):
        if num%(i+1) == 0:
            res += 1
    return res

ans = 0
for i in range(0,N,2):
    if yakusuu(i+1) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 3060
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()
b=n1()
c=n1()

a.sort()
b.sort()
c.sort()

from bisect import bisect_left,bisect_right
b2=[]
for i in b:
    b2.append(bisect_left(a,i))

import itertools
b3=list(itertools.accumulate(b2))
    
ans=0
for i in c:
    t=bisect_left(b,i)
    if t>0:
        ans+=b3[t-1]
    
print(ans)

Measured memory_bytes: 24312
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<61);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


ll divide(ll x,ll y,ll w,ll D){
  if(x%y!=0){
    abort();
  }
  if(x/y*(y-1)>=w/D)return w;
  return min(x/y*(y-1)*D,w);
}
ll dd(ll x,ll y){
  return x/y+(x%y>0?1:0);
}
ll A,B,C,D;
ll solve(ll N){
  if(N==0)return 0;
  if(N==1)return D;
  priority_queue<pll,vector<pll>,greater<pll>> q;
  set<ll> visited;
  q.push(pll(0,N));
  while(!q.empty()){
    auto cur=q.top();q.pop();
    ll cost=cur.first,num=cur.second;
    if(visited.count(num))continue;
    visited.insert(num);
    if(num==0)return cost;
    auto push=[&](pll x){
      if(visited.count(x.second)==0){
        q.push(x);
      }
    };
    if(num<=LLONG_MAX/D&&num*D<=LLONG_MAX-cost){
      push(pll(cost+num*D,0));
    }
    if(num>=2)push(pll(cost+divide(num/2*2,2,A,D)+num%2*D,num/2));
    if(num%2)push(pll(cost+divide(num/2*2+2,2,A,D)+D*(2-num%2),num/2+1));
    if(num>=3)push(pll(cost+divide(num/3*3,3,B,D)+num%3*D,num/3));
    if(num%3)push(pll(cost+divide(num/3*3+3,3,B,D)+D*(3-num%3),num/3+1));
    if(num>=5)push(pll(cost+divide(num/5*5,5,C,D)+num%5*D,num/5));
    if(num%5)push(pll(cost+divide(num/5*5+5,5,C,D)+D*(5-num%5),num/5+1));
  }
}
int main(){
  cout<<setprecision(1000);
  ll T;
  cin>>T;
  For(times,T){
    ll N;
    cin>>N>>A>>B>>C>>D;
    ll ans=solve(N);
    cout<<ans<<endl;
  }
  return 0;
}


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

int main() {
    int X, uresisa1000, uresisa5;
    cin >> X;
    uresisa1000 = X/500;
    uresisa5 = (X%500)/5;
    cout << (uresisa1000*1000 + uresisa5*5) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>

struct Pole{
	int red_ratio,blue_ratio,red_topole,blue_topole;
	int sum_ball;
	Pole(){sum_ball=-1;}
};

bool ask_ball(const Pole &a,const Pole &b){
	if(a.sum_ball>b.sum_ball)return true;
	return false;
}

int gcd(int a,int b){
	int c;
	if(b>a)c=a,a=b,b=c;
	while(b!=0)c=b,b=a%b,a=c;
	return a;
}


int main(){
	int n;
	while(std::cin>>n){
		Pole pole[101];
		if(n==0)break;
		for(int i=0;i<n;i++)std::cin>>pole[i].red_ratio>>pole[i].blue_ratio>>pole[i].red_topole>>pole[i].blue_topole;
		for(int k=0;k<n;k++){	
			for(int i=0;i<n;i++){
				if(pole[i].sum_ball==-1){
					int ball=gcd(pole[i].red_ratio,pole[i].blue_ratio);
					if(pole[i].red_topole==0&&pole[i].blue_topole==0)pole[i].sum_ball=(pole[i].red_ratio/ball)+(pole[i].blue_ratio/ball);
					else if(pole[i].red_topole==0&&pole[pole[i].blue_topole-1].sum_ball!=-1){
						for(int j=pole[pole[i].blue_topole-1].sum_ball;;j+=pole[pole[i].blue_topole-1].sum_ball){
							double red=(double)(pole[i].blue_ratio*j)/pole[i].red_ratio;
							if(ceil(red)==floor(red)){
								pole[i].sum_ball=red+j;
								break;
							}
						}
					}
					else if(pole[i].blue_topole==0&&pole[pole[i].red_topole-1].sum_ball!=-1){
						for(int j=pole[pole[i].red_topole-1].sum_ball;;j+=pole[pole[i].red_topole-1].sum_ball){
							double blue=(double)(pole[i].red_ratio*j)/pole[i].blue_ratio;
							if(ceil(blue)==floor(blue)){
								pole[i].sum_ball=blue+j;
								break;
							}
						}
					}
					else if(pole[pole[i].red_topole-1].sum_ball!=-1&&pole[pole[i].blue_topole-1].sum_ball!=-1){
						int red=pole[pole[i].red_topole-1].sum_ball,blue=pole[pole[i].blue_topole-1].sum_ball;
						while(1){
							if(red*pole[i].red_ratio<blue*pole[i].blue_ratio)red+=pole[pole[i].red_topole-1].sum_ball;
							else if(red*pole[i].red_ratio>blue*pole[i].blue_ratio)blue+=pole[pole[i].blue_topole-1].sum_ball;
							else break;
						}
						pole[i].sum_ball=red+blue;
					}
				}
			}
		}
		std::sort(pole+0,pole+n,ask_ball);
		std::cout<<pole[0].sum_ball<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 1168
# coding: utf-8
# Your code here!
import math

def main():
    n = int(input())
    judge = {"AC":0, "WA":0, "TLE":0, "RE":0}
    for _ in range(n):
        s = input()
        judge[s] += 1
    for key in judge.keys():
        print(f'{key} x {judge[key]}')
    
main()

Measured memory_bytes: 9184
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll power(ll x, ll y, ll p)
{ll res = 1;x = x % p;while (y > 0){if (y & 1) res = (res*x) % p;y = y>>1;x = (x*x) % p;}return res;}
ll modInverse(ll n, ll p)
{return power(n, p-2, p);}
ll nCr(ll n, ll r, ll p)
{if (r==0) return 1;ll fac[n+1];fac[0] = 1;for(ll i=1 ; i<=n; i++)fac[i] = fac[i-1]*i%p;return (fac[n]*modInverse(fac[r], p) % p * modInverse(fac[n-r], p) % p) % p;}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll i, j, k, n, m, t, p, temp, flag, x, y, z, count, a, b, c, d, sum, ans;
	cin >> n;
	ll arr[100009], hash[100009]={0};
       	sum=0;
	for(i=0; i<n; i++)
	{
		cin >> arr[i];
		hash[arr[i]]++;
		sum+=arr[i];
	}
	ll q;
	cin >> q;
	while(q--)
	{
		cin >> b >> c;
		sum+=(c-b)*hash[b];
		hash[c]+=hash[b];
		hash[b]=0;
		cout << sum << "\n";
	}
	return 0;
}



Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,M;
cin >> N >> M;
const int nmmax=50;
char A[nmmax][nmmax],B[nmmax][nmmax];
for(int y=0;y<N;++y){
for(int x=0;x<N;++x){
cin >> A[y][x];
 }
 }

for(int y=0;y<M;++y){
 for(int x=0;x<M;++x){
 cin >> B[y][x];
 }
 }
 bool exist=false;

 for(int ly=0;ly<N;++ly){
 for(int lx=0;lx<N;++lx){
 if(ly+M-1>=N or lx+M-1>=N) continue;

 bool match=true;
 for(int y=0;y<M;++y){
 for(int x=0;x<M;++x){
 if(A[ly+y][lx+x]!=B[y][x]) match=false;
 }
 }
 if(match) exist=true;
 }
 }

 if(exist)
 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<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N),B(N),C(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N) cin >> C[i];
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    ll ans = 0;
    rep(i,N){
        ll b = B[i];
        ll ida = lower_bound(A.begin(), A.end(), b) - A.begin();
        if(ida == 0)continue;
        ll idc = upper_bound(C.begin(), C.end(), b) - C.begin();
        if(idc == N)continue;
        ans += ida*(N-idc);
    }
    cout << ans << endl;
}


Measured memory_bytes: 2688
n = int(input())
a = list(map(int, input().split()))
rate = [0] * 9
for i in range(n):
    if a[i] < 400:
        rate[0] += 1
    elif a[i] < 800:
        rate[1] += 1
    elif a[i] < 1200:
        rate[2] += 1
    elif a[i] < 1600:
        rate[3] += 1
    elif a[i] < 2000:
        rate[4] += 1
    elif a[i] < 2400:
        rate[5] += 1
    elif a[i] < 2800:
        rate[6] += 1
    elif a[i] < 3200:
        rate[7] += 1
    else:
        rate[8] += 1

counter = 0
for i in range(8):
    if rate[i] >= 1:
        counter += 1


print(max(1, counter), counter + rate[8])


Measured memory_bytes: 9176
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;

signed main(){
    int r,d,x;
    cin >> r >> d >> x;
    rep(i,10){
        x = r*x-d;
        cout << x << endl;
    }
    
    

    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc127.contest.atcoder.jp/tasks/abc127_a

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;
class Main{
    public static void main(String[]args){
        //BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
      	Scanner scan = new Scanner(System.in);
      	int a,b;
        try{
            a = scan.nextInt();
          	b = scan.nextInt();
        }catch(Exception e){
          	a = 0;
          	b = 0;
        }
        System.out.print(a*b + " ");
        System.out.print((a+b)*2);
        System.out.println();
    }
}


Measured memory_bytes: 26148
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int h, n; cin >> h >> n;
  int sum = 0;
  for(int i = 0; i < n; i++) {
    int a; cin >> a;
    sum += a;
  }

  if(sum >= h) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
	  #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
	   ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
		   # #  # # #                   # #      ###### #    # #    # #      #####
	  #    # #   #  #              #    # #      #    # #    # #    # #      #   #
	   ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LL i = 0; i < (n); i++)
#define FOR(in) for(LL i=1; i <= (n); i++)
#define pb push_back
#define sr(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 
 
LL concate(LL a, LL b)
{
	ostringstream os;
	os <<a <<b;
	istringstream is(os.str());
	LL c;
	is>> c;
	return c;
}
 
 
LL check(char c)
{
	return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
}
LL mod = 1e9+7;
 
 
int main()
{
	LL q,t;
	//cin>>t;
	//while(t--)
	//{
	   LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
		LL aa[1000];
		LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
		LL ma=0, mi=100000000;
		LL mid=0, temp=0, stop=0, start=0;
		double pi= 3.141592653589793;
		double d1=0.0, d2, d3, d4;
		VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
		VS vs, vs1, vs2, vs3, vs4;
		VP vp, vp1,vp2;
		char ch, ch1, ch2[1001];
		string str, str1, str2, str3, str4, str5;
		pair<LL, LL> pa;
		list<LL> li, li1;
		map<LL, LL> mp, mp1;
		set<LL> st;
		map<LL ,LL> :: iterator imll;
		VLL :: iterator ivll;
		set<LL> :: iterator isll;
		VP :: iterator ivp;
 
		
		cin>>a>>b;
		if(a+b<24)cout<<a+b<<endl;
		else if(a+b==24)cout<<0<<endl;
		else 
		{
			x = 24-a;
			y = b-x;
			cout<<y<<endl;
		}
		
	
	exit()
 
 
}


Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   int H, W;
   cin >> H >> W;
   if (H % 3 == 0 || W % 3 == 0) {
      cout << 0 << endl;
      return 0;
   }

   ll ans = 1e10;
   for (ll h = 1; h < H; h++) {
      ll A = h * W;
      ll j = H - h;
      if (W % 2 == 0) {
         ll B = j * (W / 2);
         chmin(ans, llabs(A - B));
      } else {
         ll MAX = llmax(A, llmax(j * (W / 2), j * (W / 2 + 1)));
         ll MIN = llmin(A, llmin(j * (W / 2), j * (W / 2 + 1)));
         chmin(ans, llabs(MAX - MIN));
      }
   }
   for (ll h = 1; h < H; h++) {
      ll A = h * W;
      ll j = H - h;
      if (j % 2 == 0) {
         ll B = (j / 2) * W;
         chmin(ans, llabs(A - B));
      } else {
         ll MAX = llmax(A, llmax((j / 2) * W, (j / 2 + 1) * W));
         ll MIN = llmin(A, llmin((j / 2) * W, (j / 2 + 1) * W));
         chmin(ans, llabs(MAX - MIN));
      }
   }
   for (ll w = 1; w < W; w++) {
      ll A = w * H;
      ll j = W - w;
      if (H % 2 == 0) {
         ll B = j * (H / 2);
         chmin(ans, llabs(A - B));
      } else {
         ll MAX = llmax(A, llmax(j * (H / 2), j * (H / 2 + 1)));
         ll MIN = llmin(A, llmin(j * (H / 2), j * (H / 2 + 1)));
         chmin(ans, llabs(MAX - MIN));
      }
   }
   for (ll w = 1; w < W; w++) {
      ll A = w * H;
      ll j = W - w;
      if (j % 2 == 0) {
         ll B = (j / 2) * H;
         chmin(ans, llabs(A - B));
      } else {
         ll MAX = llmax(A, llmax((j / 2) * H, (j / 2 + 1) * H));
         ll MIN = llmin(A, llmin((j / 2) * H, (j / 2 + 1) * H));
         chmin(ans, llabs(MAX - MIN));
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256