akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

int main(){
    int n;
    cin>>n;
    string s;
    vector<string> vec;
    rep(i,n){
        cin>>s;
        vec.pb(s);
    }
    int a=INF,b=INF,c=INF;
    string str;
    int num;
    rep(i,n){
        rep(j,n){
            if(i==j)continue;
            str=vec[i]+vec[j];
            num=stoi(str);
            if(num<a){
                c=b;
                b=a;
                a=num;
            }else if(num<b){
                c=b;
                b=num;
            }else if(num<c){
                c=num;
            }
        }
    }
    cout<<c<<endl;
}

Measured memory_bytes: 1660
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int main(int argc, char* argv[])
{
    int n;
    scanf("%ld", &n);
    printf("%d\n", n%2==0? n: n*2);

}

Measured memory_bytes: 128
a = raw_input().split(" ")
b = int(a[1])
a = int(a[0])
total = 0

if a ==1 and b == 1:
  total += 400000
  
if a == 1:
  total += 300000
if a == 2:
  total += 200000
if a == 3:
  total += 100000
if b == 1:
  total += 300000
if b == 2:
  total += 200000
if b == 3:
  total += 100000
  
print(total)

Measured memory_bytes: 2568
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int v,e;
	cin>>v>>e;
	vvi cost(v,vi(v,inf));
	while(e--){
		int a,b,c;
		cin>>a>>b>>c;
		cost[a][b]=c;
	}
	vvi dp(1<<v,vi(v,inf));
	dp[(1<<v)-1][0]=0;
	for(int i=(1<<v)-2;i>=0;i--){
		rep(j,v){
			rep(k,v){
				if(!(i>>k&1))
					dp[i][j]=min(dp[i][j],dp[i|(1<<k)][k]+cost[j][k]);
			}
		}
	}
	if(dp[0][0]==inf)cout<<-1<<endl;
	else cout<<dp[0][0]<<endl;
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];
int ara[2*n_size];
vi v1,v;

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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara2[n_size];

	cin>>n;
	//vector<set<int>>v;
	multimap<int,int>mp;

	f(i,0,n-1){
        int a;
        cin>>a;
        //mp[a]++;
        mp.insert({a,i});
        v1.pb(a);
        //v.pb(a);
	}
	v=v1;
	sort(v.bb,v.ee);
	k=n/2;
	int a=v[k];
	int b=v[k-1];



//	i=0;
//	multimap<int,int>mp2;
//	for(auto it=mp.bb;it!=mp.end();it++){
//        it->se=i;
//        i++;
//	}
//	k=n/2;
//	for(auto it=mp.bb;it!=mp.end();it++){
//        if(it->se==k-1) m=it->fi;
//        else if(it->se==k) {k=it->fi;break;}
//	}




	f(i,0,n-1){
        int x=v1[i];
        if(x<a) cout<<a<<endl;
        else{
            cout<<b<<endl;
        }

	}

}


Measured memory_bytes: 13172
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  int N;
  cin >> N;

  vector<ll> as(N), bs(N), cs(N), dpa(N, 0), dpb(N, 0), dpc(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> as[i] >> bs[i] >> cs[i];
  }

  dpa[0] = as[0];
  dpb[0] = bs[0];
  dpc[0] = cs[0];
  for (int i = 1; i < N; i++) {
    ll ba = dpb[i - 1] + as[i];
    ll ca = dpc[i - 1] + as[i];
    dpa[i] = max(ba, ca);
    ll ab = dpa[i - 1] + bs[i];
    ll cb = dpc[i - 1] + bs[i];
    dpb[i] = max(ab, cb);
    ll ac = dpa[i - 1] + cs[i];
    ll bc = dpb[i - 1] + cs[i];
    dpc[i] = max(ac, bc);
  }

  ll ans = max(dpa[N-1], dpb[N-1]);
  ans = max(ans, dpc[N-1]);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4992
//{{{
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define sz(x) (int)((x).size())
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
// clang-format off
void _print() { cerr << "]\033[0m\n"; }
template <typename T> void __print(T x) { cerr << x; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifdef LOCAL
#define debug(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m["; _print(x)
#define debug_arr(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m" << (x) << "\033[0m\n"
#else
#define debug(x...)
#define debug_arr(x...)
#endif
// clang-format on
//}}}

const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

int n;
LL dp[N][4];

void add(LL& a, LL b) { a = (a + b) % mod; }

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (cin >> n)
    {
        clr(dp, 0);
        dp[1][0] = 8;
        dp[1][1] = 1;
        dp[1][2] = 1;

        for (int i = 2; i <= n; i++)
        {
            add(dp[i][0], dp[i - 1][0] * 8);

            add(dp[i][1], dp[i - 1][0]);
            add(dp[i][1], dp[i - 1][1] * 9);

            add(dp[i][2], dp[i - 1][0]);
            add(dp[i][2], dp[i - 1][2] * 9);

            add(dp[i][3], dp[i - 1][1]);
            add(dp[i][3], dp[i - 1][2]);
            add(dp[i][3], dp[i - 1][3] * 10);
        }
        cout << dp[n][3] << endl;
    }

    return 0;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a+b < c+d)
    cout << "Right" << endl;
  else if(a+b > c+d)
    cout << "Left" << endl;
  else
    cout << "Balanced" << endl;
}

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

#define ll long long
#define endl "\n"

inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m;
    cin>>m;
    return m;
}
void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
ll cnt1[10000005],ans[10000005];
void modSeive(){
     for(int i = 1; i <=10000001; ++i){
          for(int j = i; j <=10000001; j += i)
               ++cnt1[j];
        ans[i]=cnt1[i]*i;
     }
}
int main()
{
    fast();
    int n =D();
    modSeive();
    ll sum=0;
    for(int i=1;i<=n;++i){
        sum+=ans[i];
      //cout<<ans[i]<<" "<<cnt1[i]<<endl;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 159848
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(1, 1E8); \
                 auto rnd = bind(__dis, __gen)

const int INF = 1E18;
const int mod = 1E9 + 7;
const int maxn = 100 + 5;

int32_t main() {
    fastIO();
    
    int n, m;
    cin >> n >> m;
    
    int vec[n][m];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) cin >> vec[i][j];
    }
    
    vector<pair<pii, pii>> op;
    for (int i = 0; i < n; ++i) {
        if (i < n-1) {
            for (int j = 0; j < m; ++j) {
                if (vec[i][j] & 1) {
                    op.pb({{i+1, j+1}, {i+2, j+1}});
                    ++vec[i+1][j];
                }
            }
        }
        else {
            for (int j = 0; j < m-1; ++j) {
                if (vec[i][j] & 1) {
                    op.pb({{i+1, j+1}, {i+1, j+2}});
                    ++vec[i][j+1];
                }
            }
        }
    }
    
    cout << op.size() << "\n";
    for (auto x : op) cout << x.X.X << " " << x.X.Y << " " << x.Y.X << " " << x.Y.Y << "\n";
    
    return 0;
}

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

int main()
{
  int H,W;
  cin >> H >> W;
  vector<string> a(H);
  for (int i = 0; i < H; i++) {
    cin >> a.at(i);
  }
  vector<bool> thrH(H);
  vector<bool> thrW(W);
  for (int i = 0; i < H; i++) {
    thrH.at(i) = true;
    for (int j = 0; j < W; j++) {
      if (a.at(i)[j] == '#') {
        thrH.at(i) = false;
        break;
      }
    }
  } 
  for (int j = 0; j < W; j++) {
    thrW.at(j) = true;
    for (int i = 0; i < H; i++) {
      if (a.at(i)[j] == '#') {
        thrW.at(j) = false;
        break;
      }
    }
  }
  for (int i = 0; i < H; i++) {
    if (thrH.at(i))
      continue;
    for (int j = 0; j < W; j++) {
       if(thrW.at(j) ) 
         continue;
       cout << a.at(i)[j];
     }
     cout << endl;
   } 
}

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

using namespace std;

const int MA = 1000;

bool exi[1000][1000];

int rsum[1000][1000], csum[1000][1000];

vector<int> rs[1000], cs[1000];

char ch[330][330];
int H, W;

void input(){
	scanf("%d%d", &H, &W);
	for(int i = 0; i < H; ++i){
		scanf("%s", ch[i]);
	}
}

long long solve(){
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			if(ch[i][j] == '#'){
				int a = i + j + 1;
				int b = i - j + W + 1;
				exi[a][b] = true;
			}
		}
	}
	for(int i = 0; i < MA; ++i){
		for(int j = 1; j < MA; ++j){
			rsum[i][j] = rsum[i][j - 1];
			if(exi[i][j]){
				rsum[i][j]++;
				rs[i].push_back(j);
				cs[j].push_back(i);
			}
		}
	}
	for(int j = 0; j < MA; ++j){
		for(int i = 1; i < MA; ++i){
			csum[i][j] = csum[i - 1][j];
			if(exi[i][j]) csum[i][j]++;
		}
	}
	long long ans = 0;
	long long right = 0;
	for(int i = 0; i < MA; ++i){
		for(int j = 0; j < rs[i].size(); ++j){
			for(int k = j + 1; k < rs[i].size(); ++k){
				int d = rs[i][k] - rs[i][j];
				int i2 = i - d;
				if(i2 >= 0){
					ans += rsum[i2][rs[i][k]] - rsum[i2][rs[i][j] - 1];
					if(exi[i2][rs[i][k]]) right++;
					if(exi[i2][rs[i][j]]) right++;
				}
				i2 = i + d;
				if(i2 < MA){
					ans += rsum[i2][rs[i][k]] - rsum[i2][rs[i][j] - 1];
					if(exi[i2][rs[i][k]]) right++;
					if(exi[i2][rs[i][j]]) right++;
				}
			}
		}
	}
	for(int j = 0; j < MA; ++j){
		for(int x = 0; x < cs[j].size(); ++x){
			for(int y = x + 1; y < cs[j].size(); ++y){
				int l = cs[j][x], r = cs[j][y];
				int d = r - l;
				int j2 = j - d;
				if(j2 >= 0){
					ans += csum[r][j2] - csum[l - 1][j2];
				}
				j2 = j + d;
				if(j2 < MA){
					ans += csum[r][j2] - csum[l - 1][j2];
				}
			}
		}
	}
	return ans - right;
}

int main(){
	input();
	long long ans = solve();
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 9856
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li,li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li,li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

intl modpow(intl a, intl n, intl p){
  intl res = 1;
  while (n > 0){
    if (n&1){res = (res * a) % p;}
	a = (a * a) % p;
    n >>= 1;
  }
  return res;
}

void Yes(li b){
  if(b)cout<<"Yes";
  else cout<<"No";
}
void yes(li b){
  if(b)cout<<"yes";
  else cout<<"no";
}

li calc(li x, li y, li z){
	return x*x+y*y+z*z+x*y+y*z+z*x;
}

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cout.precision(16);

  li N;
  cin >>N;

  char x;
  deque<bool> X;

  li mpcnt=0;
  Rep(i,N){
  	cin >>x;
  	X.ef(x-'0');
  	mpcnt += x-'0';
  }

  //X.ef(0);

  if(mpcnt==1){
  	Rep1(i,N){
  		if(X[N-i]){cout<<'0'<<'\n';}
  		else if(i!=N){cout<<1<<'\n';}
  		else{cout<<2<<'\n';}
  	}
  	return 0;
  }

  if(mpcnt==0){
  	Rep(i,N){
  		cout<<1<<'\n';
  	}
  	return 0;
  }

  li mresp=0;
  li pn = mpcnt-1;
  li mresn=0;
  li pp = mpcnt +1;
  Rep(i,N){
  	if(X[i]){
  	mresp += modpow(2,i,mpcnt+1);
  	mresn += modpow(2,i,mpcnt-1);
  }
  mresp%=mpcnt+1;
  mresn%=mpcnt-1;
  }

  li r;

  Rep1(i,N){
  	li cnt =0;
  	if(X[N-i]){
  		if(!pn){cout<<'0'<<'\n';}
  		cnt++;
  		r = mresn -modpow(2,N-i,mpcnt-1);
  		r %= pn;
  		if(r<0){r+=pn;}
  		while(r!=0){
  			bitset<20> b(r);
  			r = r%b.count();
  			cnt ++;
  		}
  		cout<<cnt<<'\n';
  	}
  	else{
  		cnt ++;
  		r = mresp +modpow(2,N-i,mpcnt+1);
  		r %= pp;
  		if(r<0){r+=pp;}
  		while(r!=0){
  			bitset<20> b(r);
  			r = r%b.count();
  			cnt ++;
  		}
  		cout<<cnt<<'\n';
  	}


  }

}

Measured memory_bytes: 3840
test = list(map(int, input().split()))
A = test[0] #体力
B = test[1] #攻撃
C = test[2] #体力
D = test[3] #攻撃
flag = True
while flag:
    C -= B
    if C <=0:
        print('Yes')
        flag = False
        break
    A -= D
    if A <= 0:
        print('No')
        flag = False
        break

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int ans,count;
  ans=1;
  count=0;
  while(count<1)
  {
    if((n-4)*(n-2)*(n-1)==0){count++; break;}
    if(n%2==0){n=n/2;}
    else{n=3*n+1;}
    ans++;
  }
  cout<<ans+3;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 1000000
main()
{
  int i,j,k,n,v,A[N],cnt,m;
  scanf("%d",&n);
  int G[12];
  for(i = 0; i < n; i++) scanf("%d",&A[i]);

  i = 0;
  G[i] = 1;
  m = 1;

  while (3 * G[m-1] + 1 < n) {
    G[m] = 3 * G[m-1] + 1;
    m++;
  }

  for (i = 0; i < m / 2; i++) {
    v = G[i];
    G[i] = G[m-1-i];
    G[m-1-i] = v;
  }


  printf("%d\n",m);
  cnt = 0;

  for(i = 0; i < m; i++){
    for(j = G[i]; j < n; j++){
      v = A[j];
      k = j - G[i];
      while(k >= 0 && A[k] > v){
	A[k+G[i]] = A[k];
	k = k - G[i];
	cnt++;
      }
      A[k+G[i]] = v;
    }
  }

  for (i = 0; i < m; i++) {
    if (i != m - 1) printf("%d ", G[i]);
    else printf("%d\n", G[i]);
  }

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

    for(i = 0; i < n; i++)printf("%d\n",A[i]);
    return 0;
}

Measured memory_bytes: 4504
import sys
input = sys.stdin.readline


def read():
    N, X, T = map(int, input().strip().split())
    return N, X, T


def solve(N, X, T):
    t = 0
    x = 0
    while x < N:
        x += X
        t += T
    return t


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 9176
N = input()

answer = 'Yes'
for i in range(1, len(N)+1):

    # even
    if i % 2 == 0:
        if N[i-1] == 'R':
            answer = 'No'
            break
    else:
        if N[i-1] == 'L':
            answer = 'No'
            break

print(answer)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> Count(N,0);
  for(int i =0; i<N-1; i++) cin >> A[i];
  
  for(int i=0; i<N-1; i++){
      Count[A[i]-1] += 1;
  }
  
  for(int i=0; i<N; i++) cout << Count[i] << endl;
  
}

Measured memory_bytes: 4800
/*
 * main.c
 *
 *  Created on: 2019/04/06
 *      Author: family
 */


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

unsigned long long int A[1000] = {0};
unsigned long long int B[1000] = {0};
unsigned long long int C[1000] = {0};
unsigned long long int ans[200000] = {0};

int sort_dec(const void *a, const void *b)
{
    unsigned long long int da = *(unsigned long long int*)a;
    unsigned long long int db = *(unsigned long long int*)b;
    int val = 0;
    if(da > db) {
        val = -1;
    } else if (da == db) {
        val = 0;
    } else {
        val = 1;
    }

    return val;
}

int main()
{
    int X, Y, Z, K;
    int i = 0, mini = 0;
    int j = 0, k = 0, l = 0;
    scanf("%d %d %d %d", &X, &Y, &Z, &K);
    for(i = 0; i < X; i++) {
        scanf("%llu", &A[i]);
    }
    for(i = 0; i < Y; i++) {
        scanf("%llu", &B[i]);
    }
    for(i = 0; i < Z; i++) {
        scanf("%llu", &C[i]);
    }

    qsort(A, X, sizeof(unsigned long long int), sort_dec);
    qsort(B, Y, sizeof(unsigned long long int), sort_dec);
    qsort(C, Z, sizeof(unsigned long long int), sort_dec);
    i = 0;
    for(j = 0; j < X; j++) {
        for(k = 0; k < Y; k++) {
            for(l = 0; l < Z; l++) {
                if(((j+1)*(k+1)*(l+1)) <= K) {
                    //printf("%d %d %d = %d\n",j+1, k+1, l+1, ((j+1)*(k+1)*(l+1)) );
                    ans[i] = A[j] + B[k] + C[l];
                    i++;
                } else {
                    break;
                }
            }
        }
    }

    qsort(ans, i, sizeof(unsigned long long int), sort_dec);
    for(i = 0; i < K; i++) {
        printf("%llu\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 1916
#include <stdio.h>

int main(){

int a=0,b=0,c=0;

	scanf("%d %d %d",&a,&b,&c);

	if(a<b&&b<c&&a<c)
	printf("Yes\n");
	else if(a>b||b>c||a>c)
	printf("No\n");
	else 
	printf("No\n");

return 0;

}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
  ll N, Q; cin >> N >> Q;
  UnionFind tree(N);
  for(ll i = 1; i <= Q; i++){
    ll t, u, v; cin >> t >> u >> v;
    if(t==0) tree.unite(u, v);
    if(t==1){
      if(tree.same(u, v))cout << 1 << endl;
      else cout << 0 << endl;
    }
  }
    return 0;
  }
    

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

using namespace std;

using ll = long long;
using ld = long double;
using li = __int128;
using uli = unsigned __int128;

#define fi first
#define se second

template <typename T> void s_min(T& a, T b) {
	if (a > b) a = b;
}

template <typename T> void s_max(T& a, T b) {
	if (a < b) a = b;
}

const int MAXN = 305;
int N, a[4];
double dp[MAXN][MAXN][MAXN];
bool vis[MAXN][MAXN][MAXN];

double rec(int x, int y, int z) {
	if (x < 0 || y < 0 || z < 0) return 0;
	if (x == 0 && y == 0 && z == 0) return 0;
	if (vis[x][y][z]) return dp[x][y][z];
	vis[x][y][z] = true;
	int rem = x + y + z;
	double val = N + x * rec(x - 1, y, z) + y * rec(x + 1, y - 1, z) + z * rec(x, y + 1, z - 1);
	return dp[x][y][z] = val / rem;
}

int main() {
	ios_base::sync_with_stdio(0);

	cin >> N;
	for (int i = 0; i < N; i++) {
		int x; cin >> x;
		a[x]++;
	}
	double ans = rec(a[1], a[2], a[3]);
	cout << fixed << setprecision(12) << ans;

	return 0;
}

Measured memory_bytes: 127256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
       
        static void SolveA()
        {
            int n = ReadAndParseInt();
            int[] a = ReadAndParseIntArr();
            var dicA = new Dictionary<int, int>();// key i, val num
            for(int i=0;i<a.Length;++i)
            {
                if (!dicA.ContainsKey(a[i]))
                {
                    dicA.Add(a[i], 1);
                }
                else
                {
                    dicA[a[i]]++;
                }
            }
            int ans = 0;
            foreach(var pair in dicA)
            {
                int i = pair.Key;
                int total = pair.Value;
                if( i == total) { continue; }
                else if( i > total)
                {
                    ans += total;
                }
                else
                {
                    ans += total - i;
                }
            }
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if( x == 2) { return true; }
            if( x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while( i * i <= x)
            {
                if( x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }

        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 25824
using System;

namespace _0000_QQ {

	public static class Program {

		public static void Main() {
			for (int i = 1; i <= 9; i++) {
				for (int j = 1; j <= 9; j++) {
					Console.WriteLine("{0}x{1}={2}", i, j, i * j);
				}
			}
		}

	}

}

Measured memory_bytes: 9012
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) (((a%MOD+MOD)%MOD+(b%MOD+MOD)%MOD)%MOD)
#define MUL(a, b) ((((a%MOD+MOD)%MOD)*((b%MOD+MOD)%MOD))%MOD)
#define CHADD(a, b) (a = ADD(a, b))
#define CHMUL(a, b) (a = MUL(a, b))
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b){ if(a>b){ a=b; return true; } return false; }
template<typename I> int ACC(I f, I l, int i){ return accumulate(f, l, i); }


int N, K;


signed main(){
    cin >> N >> K;

    int ans = 0;
    repe(i, K+1, N) ans += (i-K)*(N/i)+max(0LL, N%i+1-K);
    if(!K) ans -= N;

    cout << ans << endl;

    return 0;
}

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

int cntdiv(int n)
{
	int ans = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (n % i == 0) ans++;
	}
	return ans;
}

int main()
{
	int N;
	cin >> N;
	int temp = 1, ans = 0;
	while(temp <= N)
	{
		if (cntdiv(temp) == 8) ans++;
		temp += 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
static const int MAX = 1000000007;
static const int MAXN = 100001;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll perm[MAXN], inv[MAXN];
void init(){
    perm[0] = 1;
    inv[0] = 1;
    for(int i = 1; i <= MAXN; i++){
        perm[i] = (perm[i-1] * i) % MAX;
        inv[i] = modinv(perm[i], MAX);
    }
}
ll comb(ll n, ll r){
    ll ans = perm[n];
    ans = (ans * inv[n-r]) % MAX;
    ans = (ans * inv[r]) % MAX;
    return ans;
}

class BIT
{
public:
    vector<ll> bit;
    int M;

    BIT(int M):
        bit(vector<ll>(M+1, 0)), M(M) {}

    ll sum(int i) {
        if (!i) return 0;
        return (bit[i] + sum(i-(i&-i)) ) % MAX;
    }

    void add(int i, int x) {
        if (i > M) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }
};

int main(){
    init();
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);

    rep(i,N){
        ll x;
        cin >> x;
        A[i] = x + MAX;
    }
    sort(A.begin(), A.end());

    BIT T(N);
    for(int i = 1; i <= N; i++){
        T.add(i,A[i-1]);
    }

    ll ans = 0;
    for(int i = K-2; i <= N - 2; i++){
        ll b = 0;
        int k;
        if(N-i-1 > i+1) k = N-i-1;
        else k = i+1;
        b = (b + MAX + T.sum(N) - T.sum(k)) % MAX;
        if(i < N-i-2) k = i;
        else k = N-i-2;
        b = ( b + MAX - T.sum(k+1)) % MAX;
        ans = ( ( b * comb(i, K-2) ) % MAX + ans ) % MAX;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3328
import sys
N , M = (map(int , input().split()))
if M == 0:
    print(N)
    sys.exit()
A = list(map(int , input().split()))
aa = [i for i in range(-102,102)]
ans_list = {}
for i in aa:
    if i not in A:
        ans_list.update({i:abs(N-i)})
for i in ans_list:
    if ans_list[i] == min(list(ans_list.values())):
        print(i)
        sys.exit()

Measured memory_bytes: 9212
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 105

vector<string> s(ARRAY_MAX);
ll cnt[ARRAY_MAX][ARRAY_MAX];
ll cnt2[ARRAY_MAX][ARRAY_MAX];


int main(){

    ll n,m,d;
    cin >> n >> m >> d;
    REP(i,n){
        cin >> s[i];
    }

    ll ans = 0;
    //横累積和
    REP(i,n){
        ll tmp = 0;
        REP(j,m){

            if(s[i][j] == '.'){
                tmp++;
            }else{
                tmp = 0;
            }
            cnt[i][j] = tmp;
        }
    }

    REP(i,n){
        REP(j,m){
            if(cnt[i][j] >= d){
                ans++;
            }
        }
    }

    //縦累積和
    REP(i,m){
        ll tmp = 0;
        REP(j,n){
            if(s[j][i] == '.'){
                tmp++;
            }else{
                tmp = 0;
            }
            cnt2[j][i] = tmp;
        }
    }

    REP(i,m){
        REP(j,n){
            if(cnt2[j][i] >= d){
                ans++;
            }
        }
    }
    cout << ans << endl;





    return 0;
}



Measured memory_bytes: 3360
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

ll lcm(ll a, ll b) { //最小公倍数
  return a * b / gcd(a, b);
}

ll digit_sum(ll a){ //10進桁和
  ll ans=0;
  while(a>0){
    ans+=a%10;
    a/=10;
  }
  return ans;
}



int main()
{
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  if(s=="abc"){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

  return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
const int INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1000*1000*1000+7;
lli bpow(lli a, lli b) {
	if(b == 0) return 1;
	if(b == 1) return a % MOD;
	lli r = bpow(a, b >> 1);
	r = (r * r) % MOD;
	return (r * (((b&1)?a:1) % MOD)) % MOD;
}
lli multInverse(lli a) {
	return bpow(a, MOD - 2);
}
lli modMult(lli a, lli b) {
	return (a * b) % MOD;
}
lli modSub(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli modAdd(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	string s;
	cin >> s;
	int n = s.length();
	s = "#" + s;
	for(int i = 1; i <= n; i++) {
		if(s[i-1] == s[i]) {
			cout << (i-1) << " " << i << "\n";
			return 0;
		}	
		if(i > 1 && s[i-2] == s[i]) {
			cout << (i-2) << " " << i << "\n";
			return 0;
		}
	}
	cout << "-1 -1\n";
	return 0;
}

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

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B){
    cout<<C<<endl;
  }
  else if(A==C){
    cout<<B<<endl;
  }
  else{
    cout<<A<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX_N 100
using namespace std;

int main(void) {
  string S, T;
  cin >> S >> T;

  int Ans = 0;
  rep(i, 3) {
    if (S[i] == T[i]) Ans++;
  }
  cout << Ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int Y;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.Y = sc.nextInt();
    }
    
    //解答処理
    private int[] solve() {
        int[] answer = new int[3];
        answer[0] = -1;	//10000円
		answer[1] = -1;	//5000円
		answer[2] = -1;	//1000円
        
        for(int i=0;i<=N;i++){
            for(int j=0;j<=N-i;j++){
              int k = N-i-j;
              if(Y == 10000*i + 5000*j + 1000*k){
            	  answer[0] = i; //10000円
            	  answer[1] = j; //5000円
            	  answer[2] = k; //1000円
              }
            }
          }
        
        return answer;
    }
    
    //出力
    public void show(int[] answer) {
    	for (int i=0; i<3; i++) {
    		System.out.print(answer[i]);
    		System.out.print(" ");	
    	}
    }

}


Measured memory_bytes: 35808
/*Filename: aoj0010.cpp
 *Author: Mushiyo
 */

#include <stdio.h>
#include <iostream>
#include <cmath>

using namespace std;

struct Point {
	double x;
	double y;
};

double countDist(Point p1, Point p2) {
	double xDist = abs(p1.x - p2.x);
	double yDist = abs(p1.y - p2.y);

	return sqrt(xDist * xDist + yDist * yDist);
}

// find the circumcenter by finding the intersection of the perpendicular bisectors.
Point getCircumcenter (Point p1, Point p2, Point p3) {
	Point bias = p1;

	// a, b & c for ax + by = c
	double a1 = p2.x - p1.x, b1 = p2.y - p1.y, c1 = (a1 * a1 + b1 * b1) / 2;
	double a2 = p3.x - p1.x, b2 = p3.y - p1.y, c2 = (a2 * a2 + b2 * b2) / 2;
	/* translate the origin to p1
	 * let the center of the circumscribed circle be (x, y)
	 * we can get the value of (x, y) by solve the following simultaneous equations to :
	 * a1 * x + b1 * y = c1 --(1)
	 * a2 * x + b2 * y = c2 --(2)
	 *
	 * 1. after rearrange eq.1, we have:
	 * y = (c1 - a1 * x) / b1
	 * plugging this into eq.2, we have:
	 * x = (b1 * c2 - b2 * c1) / (a2 * b1 - a1 * b2)
	 *
	 * 2. after rearrange eq.1, we have:
	 * x = (c1 - b1 * y) / a1
	 * plugging this into eq.2, we have:
	 * y = (a1 * c2 - a2 * c1) / (a1 * b2 - a2 * b1)
	 *   = (a2 * c1 - a1 * c2) / (a2 * b1 - a1 * b2)
	*/
	double d = a2 * b1 - a1 * b2;
	Point center;
	center.x = bias.x + (b1 * c2 - b2 * c1) / d;
	center.y = bias.y + (a2 * c1 - a1 * c2) / d;

	return center;
}

int main() {
	int n;

	while (cin >> n) {
		while (n > 0) {
			Point a, b, c;
			cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;

			Point center = getCircumcenter(a, b, c);
			double radius = countDist(center, a);

			printf("%.3f %.3f %.3f\n", center.x, center.y, radius);

			--n;
		}
	}

	return 0;
}

Measured memory_bytes: 1244
import java.util.*;

public class Main {
    static boolean canPass[][];
    static boolean visited[];
    static int n;
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int m = sc.nextInt();
        int[] p = new int[m];
        int[] q = new int[m];
        canPass = new boolean[n][n];
        visited = new boolean[n];
        
        for (int i = 0; i < m; i++) {
            p[i] = sc.nextInt() - 1;
            q[i] = sc.nextInt() - 1;
            canPass[p[i]][q[i]] = true;
            canPass[q[i]][p[i]] = true;
        }
        
        int count = 0;
        for (int i = 0; i < m; i++) {
            Arrays.fill(visited, false);
            
            // i番目の辺を通行止めにする
            canPass[p[i]][q[i]] = false;
            canPass[q[i]][p[i]] = false;

            dfs(0);
            
            // System.out.println(Arrays.toString(visited));
            // if (Arrays.asList(visited).contains(false)) {
            //     count++;
            // }
            
            boolean connected = true;
            for (int j = 0; j < n; j++) {
                if (!visited[j]) {
                    connected = false;
                    break;
                }
            }
            if (!connected) {
                count++;
            }
            
            canPass[p[i]][q[i]] = true;
            canPass[q[i]][p[i]] = true;

        }
        System.out.println(count);

    }
    public static void dfs(int p) {
        if (visited[p]) return;
        
        visited[p] = true;
        for (int q = 0; q < n; q++) {
            if (canPass[p][q]) {
                dfs(q);
            }
        }
    }
}


Measured memory_bytes: 24020
h, w = map(int, input().split())

index=0
liForli=[]
while index < h:
    li = list(input())
    liForli.append(li)
    index+=1

index2=0
while index2 < len(liForli):
    index3=0
    while index3 < w:
        if liForli[index2][index3]=="#":
            pass
        else:
            liForli[index2][index3]=0
        index3+=1
    index2+=1

index4=0
while index4 < len(liForli):
    index5=0
    while index5 < w:
        if liForli[index4][index5]=="#":
            if index4+1 < h:
                if index5+1 < w and liForli[index4+1][index5+1]!="#":
                    liForli[index4+1][index5+1]+=1
                if index5-1 > -1 and liForli[index4+1][index5-1]!="#":
                    liForli[index4+1][index5-1]+=1
                if liForli[index4+1][index5]!="#":
                    liForli[index4+1][index5]+=1
            if index4-1 > -1:
                if index5+1 < w and liForli[index4-1][index5+1]!="#":
                    liForli[index4-1][index5+1]+=1
                if index5-1 > -1 and liForli[index4-1][index5-1]!="#":
                    liForli[index4-1][index5-1]+=1
                if liForli[index4-1][index5]!="#":
                    liForli[index4-1][index5]+=1
            if index5+1 < w and liForli[index4][index5+1]!="#":
                liForli[index4][index5+1]+=1
            if index5-1 > -1 and liForli[index4][index5-1]!="#":
                liForli[index4][index5-1]+=1
        index5+=1
    index4+=1

for li in liForli:
    print("".join(list(map(str, li))))
            




Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
long long A[100][100];
main(){
    long long n;
    cin >> n;
    vector<pair<long long,long long> > v;
    for(long long i = 0; i < n; i++){
        string s;
        cin >> s;
        long long ok = 0, af = 0, x  =0;
        for(int i = 0; i < s.size(); i++){
            if(s[i] == '.') {ok = 1; continue;}
            if(ok) af++;
            x = x * 10 + s[i] - '0';
        }
        while(af < 9)
            x*=10, af++;
        long long f = 0, t = 0;
        while( x %  2 == 0) x/=2, t++;
        while(x % 5 == 0) x /= 5, f++;
        v.push_back({f, t});

        A[f][t]++;
    }
    for(long long i = 60; i >= 0; i--){
        for(long long j = 60; j >= 0; j--){
            A[i][j] += A[i+1][j] + A[i][j+1] - A[i+1][j+1];
        }
    }
    long long ans = 0;
    for(auto x : v){
        long long a  = x.first-9, b = x.second-9;
        ans += A[max(0ll,-a+9)][max(0ll,-b+9)];
        if(a >= 0 && b >= 0) ans --;
    }
    cout<<ans/2<<endl;

}


Measured memory_bytes: 7404
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int n, l;
int icicles[100005];
ll memo[100005];

ll life (int i )
{
	if (memo[i] != -1LL ) return memo[i];

	ll res = (ll)(l - icicles[i]);
	// i 番目のつららが一番大きい
	if (icicles[i-1] < icicles[i] && icicles[i] > icicles[i+1] ){
		return memo[i] = res;
	}else	// 前のつららが大きく、後ろのつららが小さい
	if (icicles[i-1] > icicles[i] && icicles[i] > icicles[i+1] ){
		return memo[i] = (life (i-1) + res );
	}else	// 前のつららが小さく、後ろのつららが大きい
	if (icicles[i-1] < icicles[i] && icicles[i] < icicles[i+1] ){
		return memo[i] = (life (i+1) + res );
	}else{	// i 番目のつららが一番小さい
		return memo[i] = (max (life (i-1), life (i+1) ) + res );
	} // end if
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.icicles6", "r", stdin );
	while (scanf ("%d %d", &n, &l ) != EOF ){
		memset (icicles, 0, sizeof (icicles ) );
		memset (memo, -1LL, sizeof (memo ) );

		for (int i = 1; i <= n; i++ ){
			scanf ("%d", &icicles[i] );
		} // end rep
		
		ll res = 0LL;
		for (int i = 1; i <= n; i++ ){
			ll curr = life (i );
			res = max (res, curr );
		} // end for

		printf ("%ld\n", res );
	} // end loop
		
	return 0;
}

Measured memory_bytes: 4708
'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7

def main():
    n = int(ipt())
    d = defaultdict(int)
    #nまでの素数の配列を返す関数
    def primes(n):
        if n == 1:
            return []
        else:
            tbl = [True]*(n+1)
            pri = [2]
            for i in range(2,n+1,2):
                tbl[i] = False
            k = 3
            while k <= n:
                if tbl[k]:
                    pri.append(k)
                    for i in range(k,n+1,k):
                        tbl[i] = False
                k += 2
            return pri
    p = primes(n)
    for i in range(2,n+1):
        ii = i
        for j in p:
            while True:
                if ii%j == 0:
                    d[j] += 1
                    ii //= j
                else:
                    break
            if ii == 1:
                break
    d2 = 0
    d4 = 0
    d14 = 0
    d24 = 0
    d74 = 0
    for i in d.values():
        if i >= 2:
            d2 += 1
            if i >= 4:
                d4 += 1
                if i >= 14:
                    d14 += 1
                    if i >= 24:
                        d24 += 1
                        if i >= 74:
                            d74 += 1

    print(d4*(d4-1)*(d2-2)//2+d14*(d4-1)+d24*(d2-1)+d74)

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 9668
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++)cin>>h[i];
    int ans=0;
    int active=0;
    for(int i=0;i<n;i++){
        if(active>h[i]){
            active=h[i];
        }
        else{
            ans+=h[i]-active;
            active=h[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
A, B=map(int, input().split())

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
      if n % i == 0:
          divisors.append(i)
          if i != n // i:
              divisors.append(n//i)
  divisors.sort()
  return divisors
  
def f(list1, list2):
  output=[]
  a=0
  b=0
  len1=len(list1)
  len2=len(list2)
  
  while a<len1 and b<len2:
    if list1[a]<list2[b]:
      a+=1
    elif list1[a]>list2[b]:
      b+=1
    else:
      output.append(list1[a])
      a+=1
      b+=1
      
  return output

As=make_divisors(A)
Bs=make_divisors(B)

Cs=f(As, Bs)
lenc=len(Cs)
tag=[1]*lenc
for i in range(1, lenc):
  if tag[i]==1:
    for j in range(i+1, lenc):
      if Cs[j]%Cs[i]==0:
        tag[j]=0
        
print(sum(tag))

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

using namespace std;

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

    set <int> st;

    for(int i = 0, x; i < n; i++)   scanf("%d", &x), st.insert(x);

    puts(n == st.size() ? "YES" : "NO");
}


Measured memory_bytes: 9600