akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<bitset>


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; i++)
#define repn(i, st, ed) for(ll i=st; i<=ed; i++)
#define repb(i, ed, st) for(ll i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
int main()
{
	string s;
	cin>>s;
	ll ans = 0;
	rep(i, 0, s.length())
	{
		if(s[i] != s[s.length()-1-i]) ans++;
	}
	cout<<ans/2<<endl;
}


Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Char
import Data.Ratio
import Data.Ord
import Data.Array.IO
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete



main = do
    list <- map ((!!1) . wordsBy (==',')) . lines <$> getContents
    mapM_ print $ map (\t -> length . filter (==t) $ list) ["A", "B", "AB", "O"]

Measured memory_bytes: 3496
#include <stdio.h>
#include <math.h>
#include <string.h>

#define M_PI 3.141592653589793


int main(void) {

	int i, j, k;

	char str[1200];

	scanf("%[^\n]", str);

	for (i = 0; i < strlen(str); i++) {
		if (str[i] >= 97 && str[i] <= 122) {
			str[i] = str[i] - 32;
		}
		else if (str[i] >= 65 && str[i] <= 90) {
			str[i] = str[i] + 32;
		}
	}
	printf("%s\n", str);
	

	return 0;

}

Measured memory_bytes: 2600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<int, string> PSI;

int n, m;

int a[110];

int main(){
	cin >> n >> m;
	REP(i, n)cin >> a[i];
	FOR(i, 1, m + 1){
		REP(j, n - 1){
			if (a[j] % i > a[j + 1] % i){
				swap(a[j], a[j + 1]);
			}
		}
	}
	REP(i, n){
		cout << a[i] << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

using namespace std;

typedef long long ll;

int main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    map<char, char> m = {
        {'A', 'T'},
        {'T', 'A'},
        {'C', 'G'},
        {'G', 'C'},
    };

    char c;
    cin >> c;

    cout << m[c] << std::endl;
    

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N = 2e5+50;
const int M = 1e6;
const ll oo = 1e18;
const int mod = 1e9+7;

int a[N][3],dp[N][3];

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		for(int j=0;j<3;j++){
			cin>>a[i][j];
			dp[i][j] = a[i][j];
		}
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			for(int x=0;x<3;x++){
				if(j == x)continue;
				dp[i][j] = max(dp[i][j],dp[i-1][x] + a[i][j]);
			}
		}
	}
	cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 #define PI 3.141592653
using namespace std;

int A[51];
void solve(){
	ll n; cin>>n;
	for(int i=0; i<n ;i++) cin>>A[i];
		sort(A, A+n);
	long double ans = A[0];
	for(int i=1; i<n; i++){
		ans = (ans+A[i])/2.0;

	}
	cout<<ans;


}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout<<fixed<<setprecision(12);
	int t =1; //cin>>t;
	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}


Measured memory_bytes: 256
#include<iostream> 
#include<vector> 
#include<algorithm> 
#include<iomanip> 
#include<stack> 
#include<unordered_map>
#include<queue> 
#include<map>
#include<climits>
#include<set> 
#include<string> 
#include<bits/stdc++.h> 
using namespace std; 
#define lld long long int 
#define eb emplace_back
//to insert pair use eb
#define mp make_pair
#define fi first
#define se second
#define pb push_back

#define X 1000000007
#define Y 998244353
#define E4 10000
#define E5 100000
#define E6 1000000
#define inf 1001001001
#define longinf 2001001001001001001
#define pi 3.1415926535

# define rec2(i,a,b) for(lld i=a;i<b;i++) 
#define rec(i,n) for(lld i=0;i<n;i++)
#define rev(i,a,b) for(lld i=b-1;i>=a;i--)
#define all(v) (v).begin(), (v).end()
#define large(v)  *max_element(all(v))
#define small(v)  *min_element(all(v)) 
#define v vector
const double EPS = 1e-6;

void google(int i)
{  cout<<"Case #"<<i<<":"<<endl; }

//prime sieve if needed 
//prime factors of number
lld prime[E6+1]; 
void sieve(lld n) 
{ rec(i,n+1) 
    prime[i]=1; 
   for(lld i=2;i*i<=n;i++) 
     { if(prime[i]!=1) 
          continue; 
         for(lld j=i*i;j<=n;j=j+i) 
          if(prime[i]==1)
           prime[j]=i; 
      }
}

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

//fermat a^(m-2)%mod
lld binarymul(lld a,lld n,lld m)
{  lld res=1; 
 while(n) 
  { if(n%2) 
      { res=(res*a)%m; 
         n--; 
      } 
     a=(a*a)%m; 
     n/=2; 
  }
  return res; 
}
void contest(); 
int main()
{
   ios_base::sync_with_stdio(false); 
   cin.tie(0);
     #ifdef PUNEET_GOEL
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif
   //sieve(E6); 
    lld t; 
//    cin>>t; 
t=1; 
    rec(i,t) 
    {
     //google(i+1); 
      contest(); 
    }
	return 0;
}

void contest()
{ 
  lld n,d; 
  cin>>n>>d; 
  d=d*d; 
  lld ans=0; 
   rec(i,n) 
    { lld a,b; 
    cin>>a>>b; 
     a=a*a+b*b; 
     if(d>=a) 
      ans++; 
    }
   cout<<ans<<endl; 
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
struct mint {
    ll x;
    mint(ll x = 0):x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
/* global variables */
/* function */
ll sum (ll l, ll r) { return (l + r) * (r - l + 1) / 2; }
/* main */
int main(){
    int N, K;
    cin >> N >> K;
    mint ans = 0;
    for (int i = K; i <= N + 1; i++) {
        ll l = sum(0, i - 1), r = sum(N - (i-1), N);
        ans += r - l + 1;
    }
    cout << ans << '\n';
}


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

using namespace std;
using ll = long long;
using P = pair<int, uint>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

const int CASES = 3;

void solve(){
    ll H, W; cin >> H >> W;
    ll a=0,b=0,c=0;

    ll ans = INF64;
    for(int h = 0; h <= H; h++){
        if(W % 2==0){
            a = h*W/2;
            b = h*W/2;
        }
        else{
            a = h*(W-1)/2;
            b = h*(W+1)/2;
        }
        c = W*(H-h);

        ll s_max = max(max(a,b),c);
        ll s_min = min(min(a,b),c);
        ans = min(ans, s_max - s_min);

        a = h*W;
        if((H-h)%2==0){
            b = (H-h)/2 * W;
            c = b;
        }
        else{
            b = (H-h-1)/2 * W;
            c = (H-h+1)/2 * W;
        }

        s_max = max(max(a,b),c);
        s_min = min(min(a,b),c);
        ans = min(ans, s_max - s_min);
    }

    for(int w = 0; w <= W; w++){
        if(H%2==0){
            a = H/2*w;
            b = a;
        }
        else{
            a = (H-1)/2*w;
            b = (H+1)/2*w;
        }
        c = H*(W-w);

        ll s_max = max(max(a,b),c);
        ll s_min = min(min(a,b),c);
        ans = min(ans, s_max - s_min);

        a = w*H;
        if((W-w)%2==0){
            b = H*(W-w)/2;
            c = b;
        }
        else{
            b = H*(W-w-1)/2;
            c = H*(W-w+1)/2;
        }
        s_max = max(max(a,b),c);
        s_min = min(min(a,b),c);
        ans = min(ans, s_max - s_min);
    }

    cout << ans << endl;

    return;
}



int main() {
    #ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
    #else

    solve();

    #endif
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
  
  int h1,w1;
  int h2,w2;
  
  scanf("%d%d",&h1,&w1);
  scanf("%d%d",&h2,&w2);

  printf("%d",(h1-h2)*(w1-w2));
  
  return 0;
}

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

int main() {
	int n;
	int l[101];
	cin >> n;
	for (int i = 1;i <= n;i++) cin >> l[i];
	int cnt = 0;
	sort(l+1, l + n + 1);
	for (int i = 1;i <= n;i++) {
		for (int j = i+1;j <= n;j++) {
			for (int k = j+1;k <= n;k++) {
				if (l[i] != l[j] && l[j] != l[k] && l[i]+l[j]>l[k]) {
					cnt++;
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}	

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
string s,t;
main()
{
	cin>>s>>t;
	int now=0;
	for(int i=0;i<t.size();i++)
	{
		if(t[i]==s[now])
		{
			now+=2;
		}
		if(now>=s.size())
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	now=1;
	for(int i=0;i<t.size();i++)
	{
		if(t[i]==s[now])
		{
			now+=2;
		}
		if(now/2>=s.size()/2)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
}



Measured memory_bytes: 3176
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main() {
    int x;
    scanf("%d", &x);
    if (x >= 30) {
        printf("Yes");
        return 0;
    } else {
        printf("No");
        return 0;
    }

    return 0;
}

Measured memory_bytes: 3244
fun canMakePeaces(l: Int, minLimit:Int, maxLimit:Int, peaceSizes:Array<IntArray>, memo: Array<Boolean?>): Boolean {
    return when{
        l >= memo.size -> true
        memo[l] != null -> memo[l]!!
        else -> {
            var i = l
            while (i < memo.size && peaceSizes[l][i - l] < minLimit) ++i
            memo[l] = if (i == memo.size) false
            else {
                var res = false
                while (i < memo.size && peaceSizes[l][i - l] <= maxLimit && !res){
                    res = canMakePeaces(++i, minLimit, maxLimit, peaceSizes, memo)
                }
                (i - l < memo.size) && res
            }
            memo[l]!!
        }
    }
}
fun minDiff(minLimit: Int, peaceSizes: Array<IntArray>, memo: Array<Boolean?>, currentMin: Int = Int.MAX_VALUE): Int {
    var left = minLimit
    var right = if (currentMin != Int.MAX_VALUE) minLimit + currentMin else peaceSizes[0].last()
    while (left < right){
        val mid = (left + right) / 2
        memo.fill(null)
        if (canMakePeaces(0, minLimit, mid, peaceSizes, memo)) {
            right = mid
        }else {
            left = mid + 1
        }
    }
    return right - minLimit
}
fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val lines = IntArray(n){readLine()!!.toInt()}
    val peaceSizes = Array(n){l -> IntArray(n - l){r -> lines[l + r]}.also{
        for (i in 1 until it.size){
            it[i] += it[i - 1]
        }
    }}
    val memo = Array(n){null as Boolean?}
    var min = Int.MAX_VALUE
    for (i in 0 until n) for (j in i until n){
        if (i != 0 || j != n - 1) {
            val temp = minDiff(peaceSizes[i][j - i], peaceSizes, memo, min)
            if (min > temp) min = temp
        }
    }
    println(min)
}


Measured memory_bytes: 25980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(void) {
	int a, b, c; cin >> a >> b >> c;
	int d = a * 100 + b * 10 + c;
	if(d % 4  == 0)printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

int main(){
    ll N;
    cin >> N;   
    string S;
    cin >> S;
    ll ans=0;
    ll checker=0;
    for(ll i=0;i<10;i++){
     for(ll j=0;j<10;j++){
        for(ll k=0;k<10;k++){
            checker=0;
            for(ll l=0;l<N;l++){
                int s=S[l]-'0';
                if(checker==0&&s==i)checker++;
                else if(checker==1&&s==j)checker++;
                else if(checker==2&&s==k){checker++;break;}
            ;}
            if(checker==3)ans++;
            
        }
     ;}
    ;}
    cout<<ans<<endl;


return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b; 
    cin >> a >> b;
    
    if(a > b){
        cout << "a > b" << endl; 
    }
    else if(a < b){
        cout << "a < b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
    return 0;
}
        
        
        
    
        
    



Measured memory_bytes: 3020
#include<bits/stdc++.h>
#define Abra_Ka_Dabra ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
 
int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
 
    Abra_Ka_Dabra
 
    int n, m;
    cin>>n>>m;
    int res=0;
    while(n--){
    	double x, y;
    	cin>>x>>y;
    	double d = sqrt((x*x)+(y*y));
    	if (d<=m) res++;
    }
    cout<<res<<"\n";
 
    return 0;
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int cnt=0,maxi=0;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
		cnt++;}
		else {
		maxi=max(cnt,maxi);
		cnt=0;}
	}
		cout<<max(maxi,cnt);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    ll A[4];
    rep(i,1){
        cin >> A[i];
    }
    cout << (A[0]<1200 ? "ABC" : (A[0]<2800 ? "ARC" : "AGC")) << endl;
}

Measured memory_bytes: 256
/**
*   author:  akifpathan
*   created: Tuesday 15.09.2020 06:51:34 PM
**/

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

#ifdef LOCAL
#include "debug.h"
#else
#include<bits/stdc++.h>
using namespace std;
#define debug(x...)
#endif
 
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> 
using ordered_set= tree<T, null_type, 
		less<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
template<class T> 		
using ordered_mset= tree<T, null_type, 
		less_equal<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
		
*/
 
/*
 
PBDS
-------------------------------------------------
			0 based indexing
-------------------------------------------------			 
1) insert(value)
2) erase(value)
3) order_of_key(value) // Number of items strictly smaller than value
4) *find_by_order(k) : K-th element in a set (counting from zero)
 
*/
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());	

void solve()
{
	ll n,p;
	cin>>n>>p;
	
	vector<pll>fact;
	
	for(ll i=2;i*i<=p;i++)
	{
		ll cnt=0;
		while(p%i==0)
		{
			cnt++;
			p/=i;
		}
		
		if(cnt) fact.push_back({cnt,i});
	}
	
	if(p>1) fact.push_back({1,p});
	
	ll ans=1;
	
	for(auto it: fact)
	{
		ll koyta=it.first;
		ll ke=it.second;
		
		koyta/=n;
		
		while(koyta--) ans*=it.second;
	}
	
	cout<<ans;
}		

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int testcase=1;
	//cin>>testcase;
	
	for(int i=1;i<=testcase;i++)
	{
		//cout<<"Case "<<i<<": ";
		solve();
	}
	
	#ifdef LOCAL
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	#endif
	
	
	return 0;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
template<class T>inline bool chmax(T& a, T b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T& a, T b){if(a > b){a = b; return 1;}return 0;}
const ll INF = 1LL<<60;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n; cin >> n;
    vector<double> a(n);
    REP(i, n) cin >> a[i];
    sort(RALL(a));
    double ideal = a[0]/2.0, tmpdiffmin = 1000000001, res;
    //cout << ideal << endl;
    for(int i=1; i<n; i++){
        double diff = abs(ideal - a[i]);
        //cout << diff << endl;
        if(diff <= tmpdiffmin){
            tmpdiffmin = diff;
            res = a[i];
        }
    }
    ll res1 = a[0], res2 = ll(res);
    cout << res1 << " " << res2 << endl;
}

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


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

int main() {
	//おまじない
	cin.tie(0);
	ios::sync_with_stdio(false);
	

	int N;
	cin >> N;

	if (N > 999) cout << "ABD" << "\n";
	else cout << "ABC" << "\n";

	Would you please return 0;
}


Measured memory_bytes: 256
D = int(input())
A = [[0]*26]*D
S = 0
C = list(map(int,input().split()))
P = 0
ld =[0]*26#最後に行った日の格納
for i in range(D):
  A[i] = list(map(int,input().split()))
for j in range(D):
  maxvalue = max(A[j])
  index = A[j].index(maxvalue)
  for n in range(26):
    ld[n] = ld[n]+1
  ld[index] = 0 
  P=0
  for k in range(26):
    P = P+C[k]*ld[k]
  S = S+maxvalue-P
  print(index+1)

Measured memory_bytes: 9392
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
#define chmax(a,b) if(b>a) a = b
#define chmin(a,b) if(b<a) a = b
typedef long long ll;
using namespace std;

using namespace std;

int main(){
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        int n,k; cin >> n >> k;
        vector<int > p(n);
        rep(i,n) cin >> p[i];
        sort(all(p));
        int ans = 0;
        rep(i,k) ans += p[i];
        cout << ans << endl;
        
        return 0;
}


Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] strArgs) throws Exception {
		BufferedReader br = null;

		try {
			br = new BufferedReader(new InputStreamReader(System.in));

			String str = br.readLine().replace("hi", "");
			System.out.println(str.length() > 0 ? "No" : "Yes");
		} finally {
			br.close();
		}
	}
}


Measured memory_bytes: 21844
#include<stdio.h>

int main(){

int i, N, sum=0;

  scanf("%d", &N);
  int C[N], V[N];
  for(i=0;i<N;i++) scanf("%d", &V[i]);
  for(i=0;i<N;i++) scanf("%d", &C[i]);
  
  for(i=0;i<N;i++){ 
    if(C[i]<V[i]) sum+=(V[i]-C[i]);
  }
  
  printf("%d", sum);
}

Measured memory_bytes: 128
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for i in range(n)]
l = [["." for i in range(w)] for j in range(h)]
for i in range(n):
    if xya[i][2] == 1:
        l = [["#" if j < xya[i][0] else "#" if l[k][j] == "#" else "." for j in range(w)] for k in range(h)]
    elif xya[i][2] == 2:
        l = [["#" if j >= xya[i][0] else "#" if l[k][j] == "#" else "." for j in range(w)] for k in range(h)]
    elif xya[i][2] == 3:
        l = [["#" if k < xya[i][1] else "#" if l[k][j] == "#" else "." for j in range(w)] for k in range(h)]
    elif xya[i][2] == 4:
        l = [["#" if k >= xya[i][1] else "#" if l[k][j] == "#" else "." for j in range(w)] for k in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        if l[i][j] == ".":
            ans += 1
print(ans)

Measured memory_bytes: 9376
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n,m;
	std::cin >> n >> m;
	std::vector<std::pair<int,int> > a(m);
	rep(i,m) std::cin >> a[i].first >> a[i].second;
	for(int x=0;x<=1000;x++) {
		std::string s = std::to_string(x);
		if(n!=s.size()) continue;
		debug(x,s);
		int bad = false;
		rep(i,m) if((int)(s[a[i].first-1]-'0')!=a[i].second) bad=true;
		if(bad) continue;
		print(x);
		return 0;
	}
	print(-1);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int R;
  cin>>R;
  if(R<1200){
    cout<<"ABC"<<endl;
  }
  else if(R<2800){
    cout<<"ARC"<<endl;
  }
  else{
    cout<<"AGC"<<endl;
  }
 

}


Measured memory_bytes: 256
use std::error::Error;
use std::io;

pub fn main() {
    if let Err(_e) = run() {
        panic!("failed.");
    }
}

fn run() -> Result<(), Box<dyn Error>> {
    let mut input = String::new();
    io::stdin().read_line(&mut input)?;
    let s: Vec<char> = input.trim().chars().collect();
    input.clear();
    io::stdin().read_line(&mut input)?;
    let t: Vec<char> = input.trim().chars().collect();
    input.clear();

    let mut count = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            count += 1;
        }
    }

    println!("{}", count);
    Ok(())
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// if(!str.compare("abc")) cout << "yes" << endl; (stringの比較方法)

int main(){
    int n, x, t;
    cin >> n >> x >> t;
    int count = (n + x - 1) / x;
    cout << count * t << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  vector<int64_t> cand(4);
  cand[0] = a * c;
  cand[1] = a * d;
  cand[2] = b * c;
  cand[3] = b * d;
  sort(cand.begin(),cand.end());
  cout << cand[3] << endl;
  return 0;
}

Measured memory_bytes: 3616
#!/usr/bin/env python3

h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

ans = 0
for i in range(1<<h):
    for j in range(1<<w):
        cnt = 0
        for y in range(h):
            for x in range(w):
                if (i >> y & 1) or (j >> x & 1):
                    continue
                if c[y][x] == '#':
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)     

Measured memory_bytes: 68432
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main()
{
    IOS;
    int k;
    string s;
    cin>>k>>s;
    if(s.length()<=k)
        cout<<s;
    else
        cout<<s.substr(0,k)+"...";
}

Measured memory_bytes: 3656
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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; }

string S[3];

int main(){
    rep(i,3){
        cin>>S[i];
        printf("%c",toupper(S[i][0]));
    }
    cout<<endl;
    
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
typedef long long ll;
const int INF = 1e+9+7;
const int H_MAX = 510;
const int W_MAX = 510;
int H,W;
vector<vector<int>> a(H_MAX,vector<int>(W_MAX,0));

int main(){
    cin >> H >> W;
    rep(i,H){
        rep(j,W){
            cin >> a[i+1][j+1];
        }
    }
    vector<int> ans;

    int cnt=0;
    rep(i,H){
        rep(j,W){
            if(a[i+1][j+1]%2==1){
                if(j+2<=W){
                    ans.push_back(i+1);
                    ans.push_back(j+1);
                    ans.push_back(i+1);
                    ans.push_back(j+2);
                    a[i+1][j+2]++;
                    cnt++;
                }else if(i+2<=H){
                    ans.push_back(i+1);
                    ans.push_back(j+1);
                    ans.push_back(i+2);
                    ans.push_back(j+1);
                    a[i+2][j+1]++;
                    cnt++;
                }
                
            }
        }
    }

    cout << cnt << endl;
    rep(i,ans.size()){
        cout << ans[i];
        if(i%4==3) cout << endl;
        else cout << " ";   
    }
}


Measured memory_bytes: 5232
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long i = 100;
        int k = 0;
        while(i < x){
            i = i + i / 100;
            k++;
        }
        System.out.println(k);
        sc.close();
    }
}

Measured memory_bytes: 35712
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
using Pl = pair<ll, int>;

/*** MOD CALCULATION ***/

const int MOD = 1e9+7;
const int MAX = 510000;

ll addM(ll a, ll b){
	return (a + b) % MOD;
}

ll mulM(ll a, ll b){
	ll temp = (a * b) % MOD;
  	while(temp<0){ temp += MOD; }
  	return temp;
}

ll powM(ll a, ll b){
	if(b == 0) return 1;
  	else if(b == 1) return a%MOD;
  	else if(b%2==0) return mulM(powM(a,b/2),powM(a,b/2));
  	else return mulM(a,mulM(powM(a,(b-1)/2),powM(a,(b-1)/2)));
}

// b^{-1} = b^{p-2} (mod p)
// a/b = a*b^{p-2} (mod p)
ll divM(ll a, ll b){ 
  	return mulM(a,powM(b,MOD-2));
}

// n!, (n!)^{-1} のテーブル作成
ll fac[MAX], finv[MAX], inv[MAX];
void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    rep3(i,2,MAX-1){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

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

/*** MOD CALCULATION ここまで ***/

void Main() {
	int n, k;
	cin >> n >> k;
	COMBinit();
	
    rep3(i, 1, k) {
        cout << mulM( COMB(n-k+1, i), COMB(k-1, i-1)) << endl;
    }
    
    return;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 12160
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
using namespace std;
typedef long long ll;

int main(){
	int N;
	string S;
	cin>>S;
	N = S.size();
	int ct = 0;
	if(S.size() == 1){
		cout<<'0'<<endl;
		return 0;
	}
	for(int i = 1; i < S.size(); i++){
		if(S[i - 1] != S[i]){
			continue;
		}else{
			ct++;
			if(S[i] == '1')S[i] = '0';
			else S[i] = '1';
		}
	}
	cout<<ct<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }

int lcm(int x, int y) { return x / gcd(x, y) * y; }

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

  int a, b, c;
  cin >> a >> b >> c;

  int ans = 0;
  if (b + c >= a) {
    ans = (b + c) - a;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 888
import java.util.*;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String a = sc.next(), b = sc.next();
        String str = a + b;
        int num = Integer.parseInt(str);
        int result = (int)Math.sqrt(num);
        String ans;
        ans = (result*result) == num ? "Yes" : "No"; 
        System.out.println(ans);

    }
}


Measured memory_bytes: 23252
N=int(input())
A=list(map(int, input().split()))
def calc_mod(n):
    return n %(10**9+7)
AA=list(map(calc_mod, A))
X=0
XX=0
for i in range(N-1):
  XX+=AA[N-i-1]
  X+=AA[N-i-2]*XX
  X=X%(10**9+7)
print(X)

Measured memory_bytes: 102144
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    char arr[n+1],tmp;
    int cnt=1;
    scanf("%s",arr);
    tmp=arr[0];
    for(i=1;arr[i]; i++)
    {
        if(arr[i]!=tmp)
    {
        tmp=arr[i]; cnt++;
    }



    }


    cout<<cnt<<endl;

    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,vpt,unroll-loops,shrink-wrap-separate,loop-nest-optimize")
#define mp make_pair
using namespace std;

inline int read()
{
	char c = getchar_unlocked();
	int t = 0, f = 1;
	while (!isdigit(c))
        f = (c == '-' ? -1 : 1), c = getchar_unlocked();
	while (isdigit(c))
        t = t * 10 + c - '0', c = getchar_unlocked();
	return t * f;
}

const int N = 500001, len = 705;
int a[N], cnt[N], ans[N];

struct Query {
    int l, r, i;
    inline bool operator<(const Query& q) const
    {
        return mp(l / len,r) < mp(q.l / len,q.r);
    }
} q[N];

int main()
{
    int n = read(), m = read(), l = 1, r = 0, cur = 0;
    for (int i = 1; i <= n; ++i)
        a[i] = read();
    for (int i = 0; i < m; ++i)
        q[i] = {read(), read(), i};
    sort(q,q + m);
    for (int i = 0; i < m; ++i) {
        while (l > q[i].l)
            cur += !cnt[a[--l]]++;
        while (r < q[i].r)
            cur += !cnt[a[++r]]++;
        while (l < q[i].l)
            cur -= !--cnt[a[l++]];
        while (r > q[i].r)
            cur -= !--cnt[a[r--]];
        ans[q[i].i] = cur;
    }
    for (int i = 0; i < m; ++i)
        printf("%d\n",ans[i]);
    return 0;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int n;
	map<string, int> K;
	vecs(S);
	cin >> n;
	int maxi = 0;
	fx(n) {
		string s;
		cin >> s;
		K[s]++;
		pb(S, s);
		maxi = max(maxi,K[s]);
	}
	vecs(ans)
	fx(n) {
		if (K[S[x]]==maxi) {
			pb(ans, S[x]);
			K[S[x]] = 0;
		}
	}
	sorts(ans);
	fx(ans.size()) {
		ce(ans[x])
	}

    return 0;
}



Measured memory_bytes: 28400
n = int(input())
a = list(input().split())
b = a[:]
s = "Stable"
c, d = [[] for i in range(9)], [[] for i in range(9)]
for i in range(n):
    c[int(a[i][1])-1].append(a[i][0])
for _ in range(n):
    for i in range(n-1,0,-1):
        if int(b[i][1]) < int(b[i-1][1]):
            b[i], b[i-1] = b[i-1], b[i]
print(" ".join(map(str,b)))
print(s)
for i in range(n):
    min = a[n-1]
    ch = n - 1
    for j in range(n-2,i-1,-1):
        if int(a[j][1]) <= int(min[1]):
            min = a[j]
            ch = j
    a[i], a[ch] = a[ch], a[i]
for i in range(n):
    d[int(a[i][1])-1].append(a[i][0])
if c != d:
    s = "Not stable"
print(" ".join(map(str,a)))
print(s)


Measured memory_bytes: 5616
import sys
readline = sys.stdin.buffer.readline


class SegmentTree:
    def __init__(self, N, func, I):
        self.N = N
        self.sz = 2**(N-1).bit_length()
        self.func = func
        self.I = I
        self.seg = [I] * (self.sz * 2)

    def assign(self, k, x):
        self.seg[k + self.sz] = x

    def build(self):
        for i in reversed(range(1, self.sz)):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])

    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k >>= 1
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])

    def query(self, a, b):
        L = self.I
        R = self.I
        a += self.sz
        if b == self.N:
            b = self.sz
        b += self.sz
        while a < b:
            if a & 1:
                L = self.func(L, self.seg[a])
                a += 1
            if b & 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a >>= 1
            b >>= 1
        return self.func(L, R)


def main():
    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    N = int(readline())
    L = map(int, readline().split())
    seg = SegmentTree(N, gcd, 0)
    for i, n in enumerate(L):
        seg.assign(i, n)
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans, gcd(seg.query(0, i), seg.query(i+1, N)))
    print(ans)


main()

Measured memory_bytes: 60528
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn first_digit(mut n: usize) -> usize {
    while n >= 10 {
        n /= 10;
    }
    n
}
fn last_digit(n: usize) -> usize {
    n % 10
}

fn main() {
    input!{
        N: usize,
    }
    let mut m = HashMap::new();
    for i in 1..(N+1) {
        let e = m.entry((first_digit(i), last_digit(i))).or_insert(0);
        *e += 1;
    }
    let mut ans = 0;
    for i in 1..(N+1) {
        let f = first_digit(i);
        let l = last_digit(i);
        ans += match m.get(&(l, f)) {
            Some(&i) => i,
            None => 0,
        };
    }
    println!("{}", ans);
}


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

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    // vector<ll> tmp(n-k+1,1);

    // for(int i = 0; i < k; i++) {
    //     tmp[0] *= a[i];
    // }

    // for(int i = 1; i <= n-k; i++) {
    //     tmp[i] = tmp[i-1] / a[i-1];
    //     tmp[i] *= a[i+k-1];
    // }

    // for(int i = 0; i < n-k; i++) {
    //     if(tmp[i+1] > tmp[i]) cout << "Yes" << endl;
    //     else cout << "No" << endl;
    // }

    for(int i = 0; i < n-k; i++) {
        double x = (double) a[k+i] / a[i];
        // cout << x << endl;
        if(x > 1) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 4052
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[]=new int[3];
    a[0]=sc.nextInt();
      a[1]=sc.nextInt();
      a[2]=sc.nextInt();
      
      Arrays.sort(a);
      if(a[2]==a[1]+a[0]){
      System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }}


Measured memory_bytes: 23764
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,q = list(map(int, input().split()))

class UnionFindTree:
    def __init__(self, n):
        self.n = n
        self.parent = list(range(n))
        self.size = [1] * n

    def root(self, i):
        inter = set()
        while self.parent[i]!=i:
            inter.add(i)
            i = self.parent[i]
        r = i
        for i in inter:
            self.parent[i] = r
        return r

    def connect(self, i, j):
        ri = self.root(i)
        rj = self.root(j)
        if ri==rj:
            return
        if self.size[ri]<self.size[rj]:
            self.parent[ri] = rj
            self.size[rj] += self.size[ri]
        else:
            self.parent[rj] = ri
            self.size[ri] += self.size[rj]
uf = UnionFindTree(n)
for i in range(q):
    t,u,v = map(int, input().split())
    if t==0:
        uf.connect(u,v)
    else:
        if uf.root(u)==uf.root(v):
            print(1)
        else:
            print(0)

Measured memory_bytes: 75528
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100000000000000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

ll dp[3010];

int main(){
   double A,B,C,D,E,F,M = 0;
   cin >> A >> B >> C >> D >> E >> F;
   ll AW = 0,S = 0;
   dp[0] = 1;
   rep(i,3010){
       rep(j,3010){
           if(dp[j] && j + C < 3010) dp[j+(ll)C] = 1;
           if(dp[j] && j + D < 3010) dp[j+(ll)D] = 1;
       }
   }
   rep(i,A+1){
       rep(j,B+1){
           if(100*(i*A+j*B) > F) continue;
           if(i == 0 && j == 0) continue;
           rrep(k,F - 100 * (i*A+j*B)+1){
               if((i*A+j*B) * E >= k && dp[k]){
                   if(k >= M * (i*A+j*B)){
                       M = (double)k / (double)(i*A+j*B);
                       AW = (i*A+j*B)*100+k;
                       S = k;
                       break;
                   }
               }
           }
       }
   }
   cout << AW << ' ' << S << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Graphi = vector<vi>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;
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; }
struct edge {
    int to; 
    int weight;
    edge(int t, int w) : to(t),weight(w) {}
};

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){

    ll n; cin >> n;
    vector<pair<ll,ll>> ans = prime_factorize(n);
    ll cnt = 0;
    rep(i,ans.size()){
        ll k = ans.at(i).second;
        int p = 0;
        while(k>=0){
            k -= p;
            p++;
        }
        p -= 2;
        cnt += p;
    }
    cout << cnt << endl;
    return 0;

}

Measured memory_bytes: 3628