akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int a[1000000][2];
int main()
{
  int i,j,k,n,x,s;
  k = 0;
  for(i=2;i<1000000;i++){
    if(!a[i][0]){
      k++;
      for(j=2;i*j<1000000;j++){
	a[i*j][0] = 1;
      }
    }
    a[i][1] = k;
  }
  for(;;){
    cin >> n;
    if(n==0)break;
    s = 0;
    while(n--){
      cin >> i >> j;
      k = (i+j) >= 1000000 ? 999999 : i+j;
      x = a[k][1];
      k = (i-j-1) < 0 ? 0 : i-j-1;
      x -= a[k][1];
      if(x > 0) s += x-1;
      else s--;
    }
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 8680
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ; 
const ll INF = 1e9 + 10;
ll n;
vector<double>h;
double dfs(ll i){
	if(i>=n)return 1;
	double choice1 = h[i] * dfs(i+1);
	double choice2 = (1-h[i]) * dfs(i+1);
	return choice1+choice2;
}
int main(){
	fastio;
	int n;
	cin>>n;
	string s;
	cin>>s;
	string v="";
	v+=s[0];
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1]){
			v+=s[i];
		}
	}
	cout<<v.size()<<endl;
}	

Measured memory_bytes: 592
# ABC148D - Brick Break
def main():
    N, *A = map(int, open(0).read().split())
    remaining = 0
    target = 1
    for i in A:
        if i == target:
            remaining += 1
            target += 1
    print(N - remaining if remaining else -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25116
#include<iostream>
#include<math.h>
using namespace std;

int main(){
  int m,n,s;
  cin >> n >> m;
  int x[n];
  x[0]=0;
  for(int i=1;i<n;i++){
    cin >> s;
    x[i]=x[i-1]+s;
  }
  int ans=0,now=0;
  for(int i=0;i<m;i++){
    cin >> s;
    if(s>0)ans+=x[s+now]-x[now];
    else ans-=x[s+now]-x[now];
    ans%=100000;
    now+=s;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1548
import sys
a,b,c=map(int,input().split())
if a==b==c:
    print(0)
    sys.exit()
if a%2 == b%2 == c%2:
    m = max([a,b,c])
    print((m-a)//2+(m-b)//2+(m-c)//2)
else:
    if a%2==b%2:
        a+=1
        b+=1
        m = max([a,b,c])
        print((m-a)//2+(m-b)//2+(m-c)//2+1)
    elif b%2==c%2:
        b+=1
        c+=1
        m = max([a,b,c])
        print((m-a)//2+(m-b)//2+(m-c)//2+1)
    else:
        c+=1
        a+=1
        m = max([a,b,c])
        print((m-a)//2+(m-b)//2+(m-c)//2+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int n, ans;
	cin >> n;
	ans = n * 800 - (n / 15 * 200);
	cout << ans<<endl;
}


Measured memory_bytes: 256
x = int(input())

def get_is_prime(x):
  if x <= 1:
    return False
  for i in range(2, x):
    if i ** 2 >= x:
      break
    if x % i == 0:
      return False
  return True

while True:
  if get_is_prime(x):
    print(x)
    break
  else:  
  	x += 1
  

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
const int INF = 1<<29;
using namespace std;
using ll = long long;
int main(){
    int N;
    cin >> N;
    vector <int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    int count = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            for(int k = 0; k < N; k++){
                if(i < j && j < k && A[i] != A[j] && A[j] != A[k] && A[i] != A[k]){
                    vector <int> v(3);
                    v[0] = A[i];
                    v[1] = A[j];
                    v[2] = A[k];
                    sort(v.begin() , v.end());
                    if(v[0] + v[1] > v[2]){
                        count++;
                    }
                }
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}



int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    RSORT(A);
    // vout(A);
    ll sum=0, j=0;
    for (long long i = 0; i < N; i++) {
        if(i==0) continue;
        if(i==1) {
            sum+=A[0];
            j++;
            continue;
        }
        sum+=A[j];
        if(i%2==1) j++;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define N	 100
void solve(){
	int n, ans = 0;
	cin>>n;
	rep(i,0,n){
		int a, b;
		cin>>a>>b;
		ans+=b-a+1;
	}
	cout<<ans<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pub push_back 
#define pob pop_back 
#define puf push_front
#define pof pop_front
#define mp make_pair
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#include<iomanip>
#include<cmath>
using namespace std ;
string str ;

void processr(int &x , int &y , int ind)
{
	x = 0 ;
	y = 0 ;
	for(int i = ind ; i < str.size() ; i++)
	{
		if(str[i] == 'R')
			break ;
		else
		{
			if((i - ind)%2 == 0)
				x++ ;
			else
				y++ ;
		}
	}
	return ;
}

void processl(int &x , int &y , int ind)
{
	x = 0 ;
	y = 0 ;
	for(int i = ind ; i >= 0 ; i--)
	{
		if(str[i] == 'L')
			break ;
		else
		{
			if((ind - i)%2 == 0)
				x++ ;
			else
				y++ ;
		}
	}
	return ;
}

int main()
{
	cin >> str ;
	int arr[str.size()] ;
	for(int i = 0 ; i < str.size() ; i++)
		arr[i] = 0 ;
	for(int i = 0 ; i < str.size()-1 ; i++)
	{
		if(str[i] == 'R' && str[i+1] == 'L')
		{
			arr[i] = 1 ;
			arr[i+1] = 1 ;
			int x , y ;
			processr(x , y , i+2);
			//cout << x << ' ' << y << endl ;
			arr[i] += x ;
			arr[i+1] += y ;
			processl(x, y , i-1);
			arr[i] += y ;
			arr[i+1] += x ;
		}
	}
	for(int i = 0 ; i  < str.size() ; i++)
	{
		if(i)
			cout << ' ';
		cout << arr[i] ;
	}
	cout << endl ;
	return 0 ;
}

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

#define max(X, Y) ((X) > (Y) ? (X) : (Y))

int bit_sum(int x);

int dp[35][1 << 16];

int main()
{
    int n, c;
    int i, j, k;

    scanf("%d %d", &n, &c);

    while (n != 0 && c != 0) {
        int a[35] = {}, bit;
        int push[35] = {};

        for (i = 0; i < n; i++) {
            for (j = 0; j < 16; j++) {
                a[i] = a[i] << 1;
                scanf("%d", &bit);
                a[i] = a[i] | bit;
            }
        }
        for (i = 0; i < c; i++) {
            for (j = 0; j < 16; j++) {
                push[i] = push[i] << 1;
                scanf("%d", &bit);
                push[i] = push[i] | bit;
            }
        }

        memset(dp, -1, sizeof(dp));
        dp[0][0] = 0;
              
        for (i = 0; i < n; i++) {
            for (j = 0; j < (1 << 16); j++) {
                if (dp[i][j] < 0) continue;
                int nx = (j | a[i]);
                for (k = 0; k < c; k++) {
                    int tx = (nx & (~push[k]));
                    dp[i + 1][tx] = max(dp[i + 1][tx], dp[i][j] + bit_sum(nx & push[k]));
                }
            }
        }

        int ans = 0;
        for (i = 0; i < (1 << 16); i++) {
            ans = max(ans, dp[n][i]);
        }
    
        printf("%d\n", ans);

        scanf("%d %d", &n, &c);
    }
    
    return 0;
}

int bit_sum(int x)
{
    int ret = 0;

    while ( x != 0) {
        ret += (x & 1);
        x = x >> 1;
    }

    return ret;
}



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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

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

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

long long stoi(string str) {
	long long ret;
	stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ull gcd(ull a, ull b) {
	if (b > a)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a%b);
}

void solve() {
	int n, m;
	cin >> n >> m;
	vector<tuple<ll, ll, ll> > v;
	rep(i, n) {
		ll a, b, c;
		cin >> a >> b >> c;
		tuple<ll, ll, ll> t = make_tuple(a, b, c);
		v.push_back(t);
	}
	vector < vector<ll> > w(8);
	int ma[8] = { 1,1,1,1,-1,-1,-1,-1 };
	int mb[8] = { 1,1,-1,-1,1,1,-1,-1 };
	int mc[8] = { 1,-1,1,-1,1,-1,1,-1 };
	rep(i, n) {
		ll a, b, c;
		a = get<0>(v[i]);
		b = get<1>(v[i]);
		c = get<2>(v[i]);
		rep(j, 8) {
			w[j].push_back(a*ma[j] + b*mb[j] + c*mc[j]);
		}
	}
	rep(i, 8) {
		sort(w[i].rbegin(), w[i].rend());
	}
	ll maxi = -1;
	rep(i, 8) {
		ll sum = 0;
		rep(j, m) {
			sum += w[i][j];
		}
		maxi = max(maxi, sum);
	}
	cout << maxi << endl;
}

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


Measured memory_bytes: 384
def brain(l):
    c = l[1] - l[0]
    if 0 < c:
        result.append(c)
        del lis[0]
        del lis[0]
    else:
        lis.append(l[0])
        del lis[0]
        
def cisco(l):
    for i in range(len(l)):
        if l[i] == 'I':
            l[i] = 1
        elif l[i] == 'V':
            l[i] = 5
        elif l[i] == 'X':
            l[i] = 10
        elif l[i] == 'L':
            l[i] = 50
        elif l[i] == 'C':
            l[i] = 100
        elif l[i] == 'D':
            l[i] = 500
        elif l[i] == 'M':
            l[i] = 1000
    return l

while True:
    result = []
    try:
        lis = list(raw_input())+['*']
        while lis:
            if not (lis[0] == '*' or lis[1] == '*'):
                l = cisco([lis[0], lis[1]])
                brain(l)
            elif lis[0] == '*':
                del lis[0]
                break
            elif lis[1] == '*':
                l = cisco([lis[0]])
                lis.append(l[0])
                del lis[0]
                del lis[0]
                break
        result.append(sum(lis))
        print sum(result)
    except EOFError:
        break

Measured memory_bytes: 4292
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ul unsigned long long int
#define vi vector<int>
#define vl vector<int64_t>
#define all(x) x.begin(),x.end()
#define pb push_back
#define fo(x,a,b) for(int x=a; x<b; x++)
#define rfo(x,a,b) for(int x=a; x>=b; x--)
#define fi first
#define sec second
#define mp make_pair
int sgn(int x) { return x>0 ? 1 : ( x<0 ? -1 : 0); }
typedef pair<int,int> pairs;
double pi = 3.14159265358979323846;
ll mod = 1000000007;

int main()
{
#ifdef _DEBUG
    freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);
    char c;
    ll l,r,d;
    cin>>l>>r>>d;
    cout<<r/d-l/d+(l%d==0)<<"\n";
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
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 mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=200005;
int n;
ll k;
int a[maxn];
vector<int>pos[maxn];

int main(){
	scanf("%d%lld",&n,&k);
	REP(i,n)scanf("%d",&a[i]),pos[a[i]].pb(i);
	int cur=1,len=1;
	for(;;){
		int nxt=upper_bound(pos[a[cur]].begin(),pos[a[cur]].end(),cur)-pos[a[cur]].begin();
		if(nxt==pos[a[cur]].size())nxt=0,len++;
		if(pos[a[cur]][nxt]==n)break;
		cur=pos[a[cur]][nxt]+1;
	}
	k%=len;
	if(k==0){
		puts("");
		return 0;
	} 
	cur=1;len=1;
	while(cur<=n){
		int nxt=upper_bound(pos[a[cur]].begin(),pos[a[cur]].end(),cur)-pos[a[cur]].begin();
		if(nxt==pos[a[cur]].size()){
			if(len==k)printf("%d ",a[cur]),cur++;
			else cur=pos[a[cur]][0]+1,len++;
		}
		else cur=pos[a[cur]][nxt]+1;
	}
	puts("");
	return 0;
} 

Measured memory_bytes: 13184
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
    int n;
    cin >> n;
    int a[n+1];
    int ans = 1e8;
    for(int i=1;i<=n;i++){
        int cur = 0;
        cin >> a[i];
        while(a[i]%2==0){
            cur++;
            a[i]/=2;
        }
        ans = min(ans,cur);
    }
    cout << ans << endl;


return 0;
}
///....


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589
int power(int x,int y){
    int r=1,z=x;
    while(y){
        if(y & 1)r*=z;
        z*=z;y=y>>1;}
    return r;}
int powerm(int x,int y,int p){
    int r=1;
    while(y){
        if(y & 1)r=(r*x)%p;
        y=y>>1;
        x=(x*x)%p;}
    return r%p;}
int modinv(int x,int m){
    return powerm(x,m-2,m);}
int logarithm(int a,int b){
    int x=0;
    while(a>1){
        x++;
        a/=b;}
    return x;}
int dp[100005];
int32_t main(){
    fast;
    int n,w;
    cin>>n>>w;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=0;i<=100000;i++)
        dp[i]=1e18;
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=100000;j>=b[i];j--)
            dp[j]=min(dp[j],dp[j-b[i]]+a[i]);
    }
    for(int i=100000;i>=0;i--){
        if(dp[i]<=w  ){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  string s;
  cin >> s;
  int n = s.size();
  int cnt = 0;
  rep(i, n) {
    if (s[i] == 'o') cnt++;
  }
  cerr << n << endl;
  cerr << cnt << endl;
  if (15-n + cnt >= 8) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

string s,t;

signed main() {
    cin >> s >> t;
    cout << t << s << endl;
}




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

public class Main{
	private static final int mod=1000000007;
	static final Scanner s=new Scanner(System.in);
	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}
	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}
	static IntStream INS(int n){
		return REPS(n).map(i->getInt());
	}
	static int getInt(){
		return Integer.parseInt(s.next());
	}
	public static void main(String[]__){
		int d=getInt(),m=getInt();
		
		if(Math.abs(d-m)>=2) {
			System.out.println(0);
			return;
		}
		
		
		long r=1;
		
		for(int i=1;i<=d;i++) {
			r*=i;
			r%=mod;
		}
		for(int i=1;i<=m;i++) {
			r*=i;
			r%=mod;
		}
		
		System.out.println(d==m?r*2%mod:r);
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
//#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

const double PI = 3.1415926535897;

int main()
{
	double r;
	scanf("%lf", &r);
	double c = 2 * r * PI;
	
	printf("%.9lf\n", c);
	
	return 0;
}

Measured memory_bytes: 1748
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  char x=a.at(0)-0x20,y=b.at(0)-0x20,z=c.at(0)-0x20;
  cout<<x<<y<<z<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
#define pii pair<int,int>
int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(All(a));
    ll ans = 0;
    rep(i,k) ans+=a[i];
    cout << ans << endl;
}

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

int main() {
  int x, y;
  string ans = "No";
  cin >> x >> y;
  if((2 * x <= y) && (4 * x >= y) && (y % 2 == 0)) ans = "Yes";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
def gcd(a, b):
        while a != b:
                if a == 0:
                        return b
                elif b == 0:
                        return a
                if a > b :
                        a %= b
                else:
                        b %= a
        return a

N, X=map(int, input().split())

print(3*(N - gcd(N, X)))


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

while M > 0:
    A.sort(reverse=True)
    if A[0] == 0:
        break
    ham = A[0] // 2
    for i, a in enumerate(A):
        if ham < a and M > 0:
            A[i] = A[i] // 2
            M -= 1
        else:
            break
print(sum(A))


Measured memory_bytes: 14224
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAXN = 110;
int n,m;
string s[MAXN];
int dp[MAXN][MAXN],bad[MAXN][MAXN];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n >> m;
  for(int i=1;i<=n;i++){
    cin >> s[i];
    s[i] = " "+s[i];
    for(int j=1;j<=m;j++){
      if(s[i][j]=='#')bad[i][j]=1;
    }
  }
  for(int i=2;i<=m;i++){
    dp[0][i] = mod;
  }
  for(int i=2;i<=n;i++){
    dp[i][0] = mod;
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      dp[i][j] = mod;
      if(bad[i][j]){
        dp[i][j] = min(dp[i-1][j]+1,dp[i][j-1]+1);
        if(bad[i-1][j]){
          dp[i][j] = min(dp[i][j],dp[i-1][j]);
        }
        if(bad[i][j-1]){
          dp[i][j] = min(dp[i][j],dp[i][j-1]);
        }
      }
      else {

        dp[i][j] = min(dp[i-1][j],dp[i][j-1]);
      }
    }
  }
  // cout << dp[1][1] << endl;
  cout << dp[n][m] << endl;

return 0;
}
///....


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

typedef long long ll;

int main()
{
    ll N, x;
    cin >> N >> x;
    vector<ll> a;

    for (int i = 0; i < N; ++i)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
    }
    sort(a.begin(), a.end());
    ll i = 0;
    ll ans = 0;

    for (int i = 0; i < a.size(); ++i)
    {

        if (x >= a[i])
        {
            x -= a[i];
            ++ans;
        }
        else
        {
            cout << ans << endl;
            return 0;
        }
    }
    if (x > 0)
    {
        cout << ans - 1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int N,C;
const int MAX = 100010;
int cs[30][MAX];
int ss[MAX];

int main() {
  IOS;
  cin >> N >> C;
  REP(i,N) {
    int s,t,c;
    cin >> s >> t >> c;
    c--; s--;
    cs[c][s]++;
    cs[c][t]--;
  }

  REP(i,C) REP(j,MAX-1) cs[i][j+1] += cs[i][j];
  REP(i,C) REP(j,MAX-1) {
    if (cs[i][j]) ss[j]++;
  }

  int ans = 0;
  REP(i,MAX) { chmax(ans, ss[i]); }
  COUT(ans);

  return 0;
}


Measured memory_bytes: 15760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
long double a,b,h,m;
 cin>>a>>b>>h>>m;
 static const long double pi = 3.141592653589793238462643;
long double kaku=0.00000000000000;
long double rag=0.0000000000000;
long double ans;
 if (h*30+m/2>m*6)
 {
    kaku=h*30+m/2-m*6;
 }
 else
 {
      kaku=m*6-(h*30+m/2);
 }

 
rag=kaku*pi/180.000000000000;
 ans=sqrt(a*a+b*b-2*a*b*cos(rag));
 cout<< std::setprecision(20)<<ans<<endl;
 
 
 
}

Measured memory_bytes: 4164
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define rep(i, n) for (int (i) = 0; (i) < n; (i)++)
#define until(x) while (!x)
#define fail(s) assert(!s)
#define ULL unsigned long long
const int INF = 0x3f3f3f3f;
const int EPS = 1e-6;
int n, k;
const int MAXN = 100010;
int a[MAXN];
int dp[MAXN];
int vis[MAXN];
typedef pair <int, int> Edge;
#define v first
#define w second
vector <Edge> G[MAXN];
int DP(int u) {
	if (vis[u])return dp[u];
	vis[u] = 1;
	for (auto e : G[u])dp[u] = min(dp[u], DP(e.v) + e.w);
	return dp[u]; 
}
int main()
{
	memset(dp, INF, sizeof(dp));
	cin >> n >> k;
	rep(i, n)cin >> a[i];
	rep(i, n) {
		for (int j = i; j <= min(n - 1, i + k); j++) {
			G[j].push_back(make_pair(i, abs(a[i] - a[j])));
		}
	}
	dp[0] = 0;vis[0] = 1;
	cout << DP(n - 1) << endl;
	return 0;
}


Measured memory_bytes: 105344
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> T(N);
  for (int i = 0; i < N; i++) {
    cin >> T[i];
  }

  ll ans = 0;
  for(int i = 1; i < N; i++) {
    if (T[i] - T[i - 1] > K) {
      ans += K;
    } else {
      ans += T[i] - T[i - 1];
    }
  }
  cout << ans + K << endl;

  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include <stdio.h>

using namespace std;

int main(){
  std::string s1,s2;
  cin >> s1 >> s2;
  std::string buf = s1 + s2;
  // printf("%s\n", buf.c_str());
  int number = std::stoi(buf);
  for(int i=0;i<=1000;i++){
    if(i*i==number){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No"<< endl;
  return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    N = ini()
    d = N % 1000
    if d == 0:
        return 0
    return 1000 - d


print(solve())


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

typedef long long ll;

char opp[256];
pair<int, int> d[256];
int h, w, n;
int r, c;
string a, b;

bool check(pair<int, int> t, char dc)
{
  return 1 <= t.first && t.first <= h && 1 <= t.second && t.second <= w;
}

bool fuck(char dc) {
  pair<int, int> t = {r, c};
  for(int i=0; i<n; i++)
  {
    if(a[i] == dc)
    {
      t.first += d[dc].first;
      t.second += d[dc].second;
    }

    if(!check(t, dc)) return false;

    if(b[i] == opp[dc])
    {
      t.first -= d[dc].first;
      t.second -= d[dc].second;
    }

    if(!check(t, dc))
    {
      t.first += d[dc].first;
      t.second += d[dc].second;
    }
  }

  return true;
}

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

  opp['R'] = 'L';
  opp['L'] = 'R';
  opp['U'] = 'D';
  opp['D'] = 'U';

  d['R'] = {0, 1};
  d['L'] = {0, -1};
  d['U'] = {-1, 0};
  d['D'] = {1, 0};

  cin >> h >> w >> n;
  cin >> r >> c;
  cin >> a >> b;

  if(fuck('R') &&
     fuck('L') &&
     fuck('U') &&
     fuck('D')) cout << "YES";
  else cout << "NO";
  cout << endl;

  return 0;
}



Measured memory_bytes: 920
import java.util.*;
public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    if (s.equals("ABC")) {
      System.out.println("ARC");
    } else {
      System.out.println("ABC");
    }

    sc.close();

  }
}

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

typedef long long ll;

int main() {
    int N, tmax = 0;
    cin >> N;
    string S;
    map<string, int> mp;
    rep(i, N) {
        cin >> S;
        mp[S]++;
        tmax = max(tmax, mp[S]);
    }
    for (auto i : mp) {
        if (i.second == tmax) cout << i.first << endl;
    }
}

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

using namespace std;

typedef pair<int,int> ii;

int n;
int a[300001];
ii f[300001];

int main() 
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n;
	for (int i=0;i<(1<<n);i++)
	{
		cin >> a[i];
		f[i].first = a[i];
	}
	for (int i=0;i<=17;i++)
		for (int mask=1;mask<(1<<n);mask++)
			if ((1<<i) & mask)
			{
				if (f[mask ^ (1<<i)].first > f[mask].first)
				{
					f[mask].second = max(f[mask].first,f[mask ^ (1<<i)].second);
					f[mask].first = f[mask ^ (1<<i)].first;
				}
				else
					f[mask].second = max(f[mask].second,f[mask ^ (1<<i)].first);
			}
	int mx = 0;
	for (int i=1;i<(1<<n);i++)
	{
		mx = max(mx,f[i].first + f[i].second);
		cout << mx << '\n';
	}
	return 0;
}

Measured memory_bytes: 6144
from collections import Counter as C
N = 10 ** 6
X = [-1] * (N+1)
L = [[] for _ in range(N+1)]
k = 2
while k <= N:
    X[k] = 1
    L[k].append(k)
    for i in range(k*2, N+1, k):
        X[i] = 0
        L[i].append(k)
    d = 2
    while k**d <= N:
        for i in range(k**d, N+1, k**d):
            L[i].append(k)
        d += 1
    while k <= N and X[k] >= 0:
        k += 1
P = [i for i in range(N+1) if X[i] == 1]
D = {p: 0 for p in P}

###
P = 10**9+7
N = int(input())
A = [int(a) for a in input().split()]
s = sum([pow(a, P-2, P) for a in A]) % P
for a in A:
    c = C(L[a])
    for f in c:
        D[f] = max(D[f], c[f])

l = 1
for f in D:
    l = l * pow(f, D[f], P) % P

print(s * l % P)

Measured memory_bytes: 172004
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();
        int K = nextInt();
        int[] h = new int[N];

        int Answer = 0;

        for(int i=0; i<N; i++){
            h[i] = nextInt();
        }

        for (int i=0; i<N; i++) {
        	if (h[i] >= K) {
        		Answer += 1;
        	}
        }

        println(Answer);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}

Measured memory_bytes: 47488
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# 最小公倍数
def gcd(a, b):
	if a < b:
		a, b = b, a
	while a % b != 0:
		a, b = b, a % b
	return b
 
# 最大公約数 
def lcm(a, b):
	y = a*b / gcd(a, b)
	return int(y)

def primes_for(n):
  is_prime = [True] * (n + 1)
  is_prime[0] = False
  is_prime[1] = False
  for i in range(2, n + 1):
      for j in range(i * 2, n + 1, i):
          is_prime[j] = False
  return [i for i in range(n + 1) if is_prime[i]]

# O(√A)
def isPrime(n):
  if n < 2:
    # 2未満は素数でない
    return False
  if n == 2:
    # 2は素数
    return True
  for p in range(2, n):
      if n % p == 0:
        # nまでの数で割り切れたら素数ではない
        return False
  # nまでの数で割り切れなかったら素数
  return True

A = LIST()
if sum(A) >= 22:
  print("bust")
else:
  print("win")


Measured memory_bytes: 5200
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
  long double a;
  while(cin >> a){
    long double sum = a;
    for(int i = 1; i < 10; i++){
      if(i%2) a *= 2;
      else a /= 3;
      sum += a;
    } 
    cout.precision(20);
    cout << sum << endl;
  }
}

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

typedef long long lli;

lli gcd(lli a, lli b) {
  return b == 0 ? a : gcd(b, a%b);
}

int main() {
  lli N, M;
  cin >> N >> M;
  bool flag = false;
  lli g = 0;
  for(int i = 0; i < M; ++i) {
    lli L;
    cin >> L;
    if(gcd(N, L) == 1) flag = true;
    g = gcd(g, L);
  }
  if(g == 1) flag = true;
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

ll dp[41][401][401] = {0LL};
signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase >= 0;testcase++){
    int3(n, ma, mb);
    ll res = 123456789LL;
    rep(i, n + 1)rep(j, 401)rep(k, 401)dp[i][j][k] = res;

    dp[0][0][0] = 0LL;

    rep(i, n){
      int3(a, b, c);
      rep(j, 401)rep(k, 401)if(dp[i][j][k] < res){
        //pri3(i, j, k);
        dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + (ll)c);
        dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
      }
    }
    //rep(j, 15)rep(k, 15)if(dp[n][j][k] < res)pri3(j, k, dp[n][j][k]);

    rep1(j, 401)rep1(k, 401)if(j * mb == k * ma){
      res = min(res, dp[n][j][k]);
    }
    if(res < 123456789LL)pri(res);
    else pri(-1);

/*/

//*/ break;
  }
  return 0;
}


Measured memory_bytes: 51712
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int 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];
    VSORT(A);
    VSORT(C);
    ll ans=0;
    for(auto &b : B){
        ll tmp=1;
        tmp*=lower_bound(A.begin(),A.end(),b)-A.begin();
        tmp*=C.end()-upper_bound(C.begin(),C.end(),b);
        ans+=tmp;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    string n;
    scan(n);

    bool yn = n[0 .. 3].to!int % 111 == 0 || n[1 .. 4].to!int % 111 == 0;

    writeln(yn ? "Yes" : "No");
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}



struct Queue(T) {
    private {
        int N, head, tail;
        T[] data;
    }

    this(int n) {
        N = n + 1;
        data = new T[](N);
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return (tail + 1) % N == head;
    }

    T front() {
        return data[head];
    }

    void push(T x) {
        assert(!full);
        data[tail++] = x;
        tail %= N;
    }

    void pop() {
        assert(!empty);
        head = (head + 1) % N;
    }

    void clear() {
        head = tail = 0;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main(){
    int n;
    cin>>n;
    int arr[10][10]={0};
        
    for (int i = 1; i <= n; i++)
    {
        string s=to_string(i);
        arr[s[0] - '0'][s.back() - '0']++;
    }
    long long int ans = 0;
    for(int i=0;i< 10;i++){
        for (int j = 0; j < 10; j++)
        {
            ans += arr[i][j] * arr[j][i];
        }        
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define MAX 1e9+7
#define MIN -MAX
#define i(a) cin>>a
#define in(a,b) cin>>a>>b
#define o(a) cout<<a
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loop1(i,a,b) for(ll i=a;i<=b;i++)
#define v(a) vector<ll>a
#define mp(a,b) make_pair(a,b)
using namespace std;
int main()
{
    ll n;
    cin >> n;
    ll a[n+1],dp[n+1];
    //memset(dp,MAX,sizeof dp);
    loop1(i,1,n){
        i(a[i]);
    }
    dp[1]=0;
    dp[2]=abs(a[2]-a[1]);
    //dp[3]=min(abs(a[3]-a[1]),dp[2]+abs(a[2]-a[1]));
    for(ll i=3;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i-2]-a[i]));
    }
    /*for(ll i=1;i<=n;i++){
        cout<<dp[i]<<" ";
    }*/
    cout << dp[n] <<"\n";

}


Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N;
	cin >> N;

	vector<long long> A(N, 0);
	int minus_cnt = 0;
	long long accum = 0;
	long long min_abs_a = 1e9;

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

		if (A[i] < 0) minus_cnt++;

		long long abs_a = abs(A[i]);
		accum += abs_a;
		min_abs_a = min(min_abs_a, abs_a);
	}

	if (minus_cnt % 2 == 0)
	{
		cout << accum;
	}
	else
	{
		cout << accum - 2 * min_abs_a;
	}

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int pos,n;
string s;
string f();
string expr(){
	string a=f();
	while(isdigit(s[pos])||isalpha(s[pos])){
		if(a.size()>n)
			break;
		a+=f();
	}
	return a;
}
string f(){
	string t="",p;
	if(isdigit(s[pos])){
		int ret=0,i=0;
		for(;isdigit(s[pos]);pos++){
			ret*=10;
			ret+=s[pos]-'0';
		}
		p=f();
		for(;i<ret;i++){
			t+=p;
			if(t.size()>n)
				break;
		}
	}else if(s[pos]=='('){
		pos++;
		t=expr();
		pos++;
	}else{
		for(;isalpha(s[pos]);pos++){
			t+=s[pos];
			if(t.size()>n)
				break;
		}
	}
	return t;
}
int main(){
	while(cin>>s>>n,s!="0"||n){
		pos=0;
		s+="#";
		string t=expr();
		if(t.size()-1<n)
		cout<<0<<endl;
		else
		cout<<t[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3956
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
typedef long long ll;

int main()
{
    int a[105];
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    int minn=99999999;
    for(int i=0;i<100;i++)
    {
        int sum=0;
        for(int j=0;j<n;j++)
        {
            sum=sum+pow(a[j]-(i+1),2);
           //printf("%d\n",a[j]-a[i]);
           //printf("%lf\n",pow(a[j]-a[i],2));
        }
        //printf("%d\n",sum);
        if(sum<minn)
        {
            minn=sum;
        }
    }
    printf("%d",minn);
    return 0;
}




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

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

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

  cout << a*b;
 return 0;
}

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

int main() {
  int numbers[4];
  int inputNumber;
  cin >> inputNumber;

  for (int i = 0; i < 4; i++) {
    numbers[i] = inputNumber % 10;
    inputNumber /= 10;
  }

  if (numbers[1] != numbers[2] ||
      (numbers[0] != numbers[1] && numbers[2] != numbers[3])) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string x,y;
	cin >> x >> y;

	int a = std::stoi(x, nullptr, 16);
	int b = std::stoi(y, nullptr, 16);

	if (a>b) {
		printf(">");
	}
	else if (a == b) {
		printf("=");
	}else{
		printf("<");
	}

	return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Scanner;

public class  Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String K = (sc.next());
		BigDecimal X = new BigDecimal(K);
		BigInteger t = BigInteger.valueOf(100);
		BigDecimal T = new BigDecimal(t);
		int year = 1;
		while ((T.multiply(BigDecimal.valueOf(1.01))).compareTo(X) == -1) {
			t = (T.multiply(BigDecimal.valueOf(1.01))).toBigInteger();
			T = new BigDecimal(t);
			year++;
		}
		System.out.println(year);
	}
}


Measured memory_bytes: 30872
// ABC 154-A
// 2020.2.9 bal4u

#include <stdio.h>
#include <string.h>

int main()
{
	int A, B;
	char S[15], T[15], U[15];
	
	scanf("%s%s%d%d%s", S, T, &A, &B, U);
	if (strcmp(S, U) == 0) A--; else B--;
	printf("%d %d\n", A, B);
	return 0;
}


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

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

  vector<ll> b(n);
  for (ll i = 0; i < n; i++) {
    b[i] = a[i] - (i + 1);
  }
  sort(b.begin(), b.end());
  ll m      = b.size() / 2;
  ll median = b.size() % 2 == 0 ? (b[m] + b[m - 1]) / 2 : b[m];

  ll sum  = 0;
  ll sum2 = 0;
  for (ll i = 0; i < n; i++) {
    sum += abs(a[i] - (median + (i + 1)));
    sum2 += abs(a[i] - (median * -1 + (i + 1)));
  }
  cout << min(sum, sum2) << endl;
}

Measured memory_bytes: 3328
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = Integer.parseInt(sc.next());
		int w = Integer.parseInt(sc.next());
		String[] a = new String[h];
		for (int i = 0; i < h; i++) {
			a[i] = sc.next();
		}
 
		boolean[] hi = new boolean[h];
		//全要素の初期値 false
		Arrays.fill(hi, false);
		boolean[] we = new boolean[w];
		Arrays.fill(we, false);
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (a[i].charAt(j) == '#') {
					hi[i] = true;
					we[j] = true;
				}
			}
		}
 
		for (int i = 0; i < h; i++) {
			if (hi[i]) {
				for (int j = 0; j < w; j++) {
					if (we[j]) {
						System.out.print(a[i].charAt(j));
					}
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 38468