akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define pb push_back
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define endl "\n"
#define pii pair<int,int>
#define mii map<int,int>
#define int long long int
#define fbo find_by_order
#define ook order_of_key
#define in insert
#define F first
#define S second
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a) for(auto ws: a)cout<<ws<<" "; cout<<endl
#define print1(a,b) for(int ws=0;ws<b;ws++) {cout<<a[ws]<<" ";} cout<<endl
#define all(a) a.begin(), a.end()
#define si set<int>
#define print2(a) for(auto ws: a)cout<<"("<<ws.F<<","<<ws.S<<") "; cout<<endl

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr (names + 1, ',');
    cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}
vpi v;
int cache[101][100001];
int n, allowed;
int dp(int i, int val, int w)
{
    if (i == n)return val;
    int &ans = cache[i][w];
    if (ans != -1)return ans;
    ans = 0;
    if (w + v[i].S > allowed)return ans = dp(i + 1, val, w);
    return ans = max(v[i].F + dp(i + 1, val, w + v[i].S), dp(i + 1, val, w));

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

    cout << setprecision(9) << fixed;

    cin >> n >> allowed;
    v.resize(n);
    memset(cache, -1, sizeof(cache));
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i].S;
        cin >> v[i].F;
    }
    cout << dp(0, 0, 0);
    return 0;
}

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

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

    int n;
    cin >> n;
    map<char, int> cnt;
    for (int i = 0; i < n; i++) {
        char c;
        cin >> c;
        cnt[c]++;
    }
    cout << (cnt.size() == 3 ? "Three" : "Four") << endl;
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    ll K, A, B;
    cin >> K >> A >> B;
    ll m = A - B;
    ll s = std::max(K - A, 0LL);
    if (s > 0) {
        if (m <= 0)
            cout << -1 << endl;
        else
            cout << 1 + 2 * ((s + m - 1) / m);
    }
    else
        cout << 1 << endl;

    return 0;
}

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



int main(){
	int N;
	cin>>N;
	vector<int> b(N);
	for(int i=0;i<N;i++){
		cin>>b[i];
	}
	vector<int> ans;
	
	for(int i=0;i<N;i++){
		if(i+1<b[i]){
			cout<<-1<<endl;
			return 0;
		}
	}
	
	while(b.size()!=0){
		for(int i=b.size()-1;i>=0;i--){
			if(i+1==b[i]){
				ans.push_back(b[i]);
				b.erase(b.begin()+i);
				break;
			}
		}
	}
	reverse(ans.begin(),ans.end());
	
	for(int i=0;i<N;i++){
		if(i!=0)cout<<' ';
		cout<<ans[i];
	}
	cout<<endl;
	
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
#define ll long long
typedef unsigned long long ull;
typedef long double ld;

#define pii         pair<ll ,ll >
#define vi          vector<ll >
#define vii         vector<pii>
#define mi          map<ll ,ll >
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define pb          push_back
#define hell        1000000007 
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define take        rep(i,0,n) cin>>v[i];
#define MAXN        1000005


#define allr(c) (c).rbegin(),(c).rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}



void solve()
{
	string s,t;
	cin>>s>>t;
	
	ll n=s.length();
	ll tn=t.length();
	ll mx=tn;
	for(ll i=0;i+tn-1<n;i++)
	{
		ll g=0;
		for(ll j=i;j<=i+tn-1;j++)
		{
			if(s[j]!=t[j-i])
			{
				g++;
			}
		}
		mx=min(mx,g);
	}
	cout<<mx<<endl;
}
int main()
    {
    	ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
      
        ll t;
        
        t=1;
        
    
 //   cin>>t;
        while(t--)
        solve();
    }

Measured memory_bytes: 3660
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func getFloat() float64 {
	sc.Scan()
	n, _ := strconv.ParseFloat(sc.Text(), 64)
	return n
}

func sum(n []int) int {
	a := 0
	for _, v := range n {
		a += v
	}
	return a
}

func partseFloat(s string) (n float64) {
	n, _ = strconv.ParseFloat(s, 64)
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m := getInt(), getInt()

	a := make([]int, m)

	for i := 0; i < m; i++ {
		a[i] = getInt()
	}

	x := make([]bool, n+1)

	j := 0
	for i := 0; i <= n; i++ {
		if j < m && i == a[j] {
			x[i] = false
			j++
		} else {
			x[i] = true
		}
	}

	dp := make([]int64, n+1)
	dp[0] = 1
	if x[1] {
		dp[1] = 1
	} else {
		dp[1] = 0
	}

	for i := 2; i <= n; i++ {
		if x[i] {
			dp[i] = dp[i-1] + dp[i-2]
			dp[i] %= 1000000007
		} else {
			dp[i] = 0
		}
	}
	fmt.Println(dp[n] % 1000000007)
}


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

int main(){
    string s;
    cin >> s;
    for(int i = 0; i < (s.size()-1)/4; i++){
        if(s[i] != s[(s.size()-1)/2 - 1 - i]){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = (s.size()+3)/2 - 1; i < (s.size()+3)/2 + (s.size()-1)/4; i++){
        if(s[i] != s[s.size() - i - 2 + (s.size()+3)/2]){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i = 0; i < s.size()/2; i++){
        if(s[i] != s[s.size()-i-1]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#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 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  int n;
  cin>>n;
  string s;
  cin>>s;
  int count[26];
  REP(i,26){
    count[i] = 0;
  }
  REP(i,n){
    int t = s[i] - 'a';
    count[t]++;
  }
  llong ans=1;
  REP(i,26){
    ans *= (count[i]+1);
    ans = ans%((llong)pow(10,9)+7);
  }

  cout<<ans-1<<endl;
 

  return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> V(N);
	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	for (int i = N - 1; i >= 0; i--){
		cout << V[i];
		if (i > 0)
			cout << " ";
		else
			cout << endl;
	}
}



Measured memory_bytes: 3100
/*
...........__________                                                                           ___  __
.............|       |                                                                           |   /
.............|       |                                                                           |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
...........__|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
#define inf 1e18
const int mod=1e9+7;
const int N=2e5+9;

void raushan_kumar(){

    /////////////////variables///////////////
    int e=0,f=0,g=0;
    double f1=0.0,f2=0.0,f3=0.0;
    int flag=0,ans=0,res=0,cnt=0,sum=0;
    /////////////////////////////////////////
    
    int a,b,c,d;cin>>a>>b>>c>>d;
    e=ceil(c*1.0/b);
    f=ceil(a*1.0/d);

    if(e>f){
    	cout<<"No";
    }
    else{
    	cout<<"Yes";
    }
    
}

int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    fast;int t=1;
    //cin>>t;
    while(t--){
        raushan_kumar();
    }

}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    string S;
    cin >> S;
    ll a=0;
    while(a<S.size()-1){
        if(S[a]=='B'&&S[a+1]=='C'){
            S=S.substr(0,a)+'D'+S.substr(a+2);
        }a++;
    }
    ll ans=0;
    ll acounter=0;
    for(ll i=0;i<S.size();i++){
        if(S[i]=='A')acounter++;
        else if(S[i]=='D')ans+=acounter;
        else acounter=0;
    ;}
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1148
def sort(a):
    n = len(a)
    nswaps = 0
    for i in range(n):
        minv = None
        minp = -1
        for j in range(i, n):
            if minv == None or minv > a[j]:
                minv = a[j]
                minp = j
        a[minp], a[i] = a[i], a[minp]
        if i != minp:
            nswaps += 1
    return nswaps

n = int(raw_input())
a = map(int, raw_input().split(' '))
nswaps = sort(a)
print ' '.join(map(str, a))
print nswaps

Measured memory_bytes: 6460
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B; cin >> A >> B;

    string res = "Yay!";
    if(max(A, B) > 8){
        res = ":(";
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int p, q, r;
    int ans;
    scanf("%d %d %d",&p ,&q ,&r);
    if(p+q < q+r && p+q <= p+r){
        ans = p+q;
    }
    else if(q+r <= p+q && q+r <= r+p){
        ans = q+r;
    }
    else{
        ans = r+p;
    }
    printf("%d",ans);
    return 0;
    
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int H, W;
char s[20][20];
bool visited[20][20];

typedef struct location {
	int x, y, c;
} L;

int bfs(int x, int y) {
	rep(i, H) rep(j, W) visited[i][j] = false;

	queue<L> q;
	q.push(L{ x, y, 0 });

	int c = 0;
	while (!q.empty()) {
		L tmp = q.front();
		q.pop();
		x = tmp.x;
		y = tmp.y;
		c = tmp.c;

		if (s[x][y] == '#' || visited[x][y]) continue;
		visited[x][y] = true;

		if (x + 1 < H && s[x + 1][y] == '.') q.push(L{ x + 1, y, c + 1});
		if (0 <= x - 1 && s[x - 1][y] == '.') q.push(L{ x - 1, y, c + 1});
		if (y + 1 < W && s[x][y + 1] == '.') q.push(L{ x, y + 1, c + 1});
		if (0 <= y - 1 && s[x][y - 1] == '.') q.push(L{ x, y - 1, c + 1});
	}
	return max(0, c - 1);
}

int main() {
	cin >> H >> W;

	int ans = 0;

	rep(i, H) rep(j, W) cin >> s[i][j];
	rep(i, H) rep(j, W) ans = max(ans, bfs(i, j));

	cout << ans << endl;

	return 0;
}

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

int main( void )
{
    int a, b, c;
    cin >> a >> b >> c;
    if ( a == b && b == c )
    {
        cout << 1 << endl;
    }
    else if ( a == b | b == c | c == a )
    {
        cout << 2 << endl;
    }
    else
    {
        cout << 3 << endl;
    }

    return 0;
}


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



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


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

const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int v, int N, bool visited[nmax]) {
	bool all_visited = true;
	for (int i = 0;i < N;++i) {
		if (visited[i] == false)all_visited = false;
	}
	if (all_visited) {
		return 1;
	}
	int ret = 0;
	for (int i = 0;i < N;++i) {
		if (graph[v][i] == false) continue;
		if (visited[i]) continue;
		visited[i] = true;
		ret += dfs(i, N, visited);
		visited[i] = false;
	}
	return ret;
}

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0;i < m;++i) {
		int a, b;
		cin >> a >> b;
		graph[a - 1][b - 1] = graph[b - 1][a - 1] = true;
	}
	bool visited[nmax];
	for (int i = 0;i < n;++i) {
		visited[i] = false;
	}
	visited[0] = true;
	cout << dfs(0, n, visited) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#include <limits>
using namespace std;
// numeric_limits<double>::epsilon()
 
// #define int int64_t
#define pr(x) cout << x << endl;
#define vi vector<int>
#define vii vector< vector<int> >
#define mp make_pair
#define f(i,n) for(i =0 ; i< n ; i++)
#define ff first
#define ss second
#define pb push_back
#define INF 1e9
#define SIZE 200001
#define mod 1000000007
void solve();


int power(int a, int b)
{
    if(b==0) return 1;
    else if(b&1) return a*power(a*a,b/2);
    else return power(a*a, b/2);
}
 


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}
bool AreSame(double a, double b) {
    return std::fabs(a - b) < std::numeric_limits<double>::epsilon();
}
 
int  j=1, n, t, m=0, dot=0, i, k, a, x, y, n1, m1, l;

// void extendGcd(int m, int n)
// {
//     if(n==0)
//     {
//         x=1;
//         y=0;
//         dot=m;
//     }
//     else
//     {
//         extendGcd(n,m%n);
//         q = x;
//         x = y;
//         y = q - (m/n)*y;
//     }
    

// }



string s1, s2,s3;
void solve()
{
    // cin >> t;while(t--)
    {
        cin >> x >> y;
        if((x-y)&1) pr("IMPOSSIBLE")
        else pr(min(x,y)+(abs(x-y)/2))
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,a) for(i=0;i<a;i++)
using namespace std;

int partition(vector<int> &A, int p, int r) {
    int i,j,x;
    x = A[r];
    i = p-1;

    for(j=p; j <= r-1; j++) {
        if(A[j] <= x){
            i = i+1;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

int main(void) {
    int n,i,buf;
    vector<int> A;
    
    cin >> n;
    rep(i,n) {
        cin >> buf;
        A.push_back(buf);
    }
    buf = partition(A,0,n-1);
    
    rep(i,n) {
        cout << A[i];
	if(i != n-1 && i != buf) {
	  cout << " ";
	}
        if(i == buf-1) {
            cout << "[";
        } else if(i == buf) {
            cout << "] ";
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1668
input_line = input()
info = input_line.split()
N = int(info[0])
M = int(info[1])

A_B = []
for i in range(N):
    input_line = input()
    temp = input_line.split()
    a_b = [int(x) for x in temp]
    A_B.append(a_b)

A_B.sort(key=lambda x:x[0])
#print(A_B)
bought = [0, 0] #[money, num]
p = 0
while (bought[1]<M):
    bought[0] += A_B[p][0]*A_B[p][1]
    bought[1] += A_B[p][1]
    if bought[1]>M:
        diff = bought[1]-M
        bought[0] -= A_B[p][0]*diff
        bought[1] -= diff
    p += 1
print(bought[0])

Measured memory_bytes: 64856
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
#define pri(str) cout << str << endl
using ll = long long;
using P = pair<int, int>;

const ll MX = 1e18;
const long double PI = acos(-1);

vector<pair<ll, int>> divisor(ll n)
{
    vector<pair<ll, int>> ret;
    for(ll i = 2; i * i <= n; ++i)
    {
        int x = 0;
        while(n % i == 0)
        {
            n /= i;
            ++x;
        }
        ret.emplace_back(i, x);
    }
    if(n != 1) ret.emplace_back(n,1);
    return ret;
}

int main()
{
    ll n; cin >> n;
    auto fs = divisor(n);

    int ans = 0;
    for(auto a: fs)
    {
        int x = a.second;
        int b = 1;
        while(b <= x)
        {
            x -= b;
            ++b;
            ++ans;
        }
    }
    pri(ans);
    return 0;
}


Measured memory_bytes: 19660
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll ans = 0;
ll intceil(ll a, ll b) {
	return (a + (b - 1)) / b;
}
int main() {
	int a[5];
	int mn = 10;
	for (int i = 0; i < 5; i++) {
		cin >> a[i];
		if (a[i] % 10 != 0) {
			mn = min(a[i] % 10, mn);
		}
		if (a[i] % 10 > 0)a[i] = 10 * (a[i] / 10 + 1);
		ans += a[i];
	}
	cout << ans - (10 - mn) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>

using namespace std;

int main(){
  int D,N;
  cin>>D>>N;
  int ans=0;
  if (D==0){
    ans=N;
    if (N==100){
      ans=101;
    }
  }
  if (D==1){
    ans=N*100;
    if (N==100){
      ans=10100;
    }
  }
  if (D==2){
    ans=N*10000;
    if (N==100){
      ans=1010000;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

signed main(){
    int n,m,a,b;
    vector<pair<int,int>>ab;
    priority_queue<int>que;
    cin>>n>>m;
    while(cin>>a>>b)
        ab.emplace_back(a,b);
    sort(ab.begin(),ab.end());
    int ans=0;
    for(int day=m-1,i=0;day>=0;day--){
        while(i<n&&ab[i].first+day==m)
            que.push(ab[i++].second);
        if(!que.empty()){
            ans+=que.top();
            que.pop();
        }
    }
    cout<<ans<<endl;
}


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

using ll = long long;


int main() {
    long N;
    long K;
    cin >> N >> K;
    
    long a = N % K;
    long b = abs(a - K);
    long m = min(min(a,b), N);
    cout << m << endl;
}

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

int main() {
  int n, len;
  int a[100];
  int nums[100] = {};
  std::cin >> n;
  for (int ni = 0; ni < n; ++ni) {
    std::cin >> a[ni];
    ++nums[a[ni]];
  }
  len = *std::max_element(a, a + n);
  for (int x = 0; x <= len; ++x) {
    --nums[std::max(len - x, x)];
  }
  if (*std::min_element(nums, nums + 100) < 0 or
      *std::max_element(nums, nums + (len + 1) / 2 + 1) > 0) {
    std::cout << "Impossible" << std::endl;
    return 0;
  }
  std::cout << "Possible" << std::endl;
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<set>
using namespace std;

char a[105];
char b[105];
int main(){
	scanf("%s",a);
	scanf("%s",b);
	int ans = strcmp(a,b);
	if(strlen(a) < strlen(b))ans = -1;
	if(strlen(a) > strlen(b))ans = 1;
	if(ans > 0)
		printf("GREATER");
	else if(ans < 0)
		printf("LESS");
	else
		printf("EQUAL");
}

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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

ll solve(const vi& a) {
  ll ans = 0;
  int cur = a[0];
  FOR(i, 1, a.size()) {
    if (cur < 0 and cur + a[i] <= 0) {
      ans += 1 - (cur + a[i]);
      cur = 1;
    } else if (cur > 0 and cur + a[i] >= 0) {
      ans += cur + a[i] + 1;
      cur = -1;
    } else {
      cur += a[i];
    }
  }
  return ans;
}

int main() {
  int n;
  cin>>n;
  vi a(n);
  REP(i, n) cin>>a[i];

  ll b = a[0];
  ll ans = solve(a);
  ll anst = abs(1 - b);
  a[0] = 1;
  ans = min(ans, anst + solve(a));
  anst = abs(b - (-1));
  a[0] = -1;
  ans = min(ans, anst + solve(a));

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(int &f){
	f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}

int main(){
    int a,b,n;
    cin>>n;
    cin>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%n==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a)
{
	return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts)
{
	return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

void execute()
{
	int N;
	cin >> N;
	//AGC ACG GAC AxGC AGxC
	//vector<vector<vector<vector<lint>>>> DP(N + 1, vector<vector<vector<lint>>>(5, vector<vector<lint>>(5, vector<lint>(5, 0))));
	auto DP = make_vec<lint>(N + 1, 5, 5, 5);
	DP[0][0][0][0] = 1;

	for (int i = 0; i < N; i++)
	{
		for (int current = 1; current < 5; current++)
		{
			for (int b1 = 0; b1 < 5; b1++)
			{
				for (int b2 = 0; b2 < 5; b2++)
				{
					if (current == 1 && b1 == 2 && b2 == 3)
						continue;
					if (current == 1 && b1 == 3 && b2 == 2)
						continue;
					if (current == 2 && b1 == 1 && b2 == 3)
						continue;

					for (int b3 = 0; b3 < 5; b3++)
					{
						if (current == 1 && b2 == 2 && b3 == 3)
							continue;
						if (current == 1 && b1 == 2 && b3 == 3)
							continue;
						DP[i + 1][current][b1][b2] += DP[i][b1][b2][b3];
						DP[i + 1][current][b1][b2] %= INV;
					}
				}
			}
		}
	}

	int ans = 0;
	for (int current = 0; current < 5; current++)
	{
		for (int b1 = 0; b1 < 5; b1++)
		{
			for (int b2 = 0; b2 < 5; b2++)
			{
				ans += DP[N][current][b1][b2];
				ans %= INV;
			}
		}
	}

	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 512
l = []; t = True
for i in range(5):
  l.append(int(input()))
k = int(input())
for i in range(5):
  for j in range(i+1,5):
    if abs(l[j] - l[i]) > k:
      t = False
      break
if t:
  print('Yay!')
else:
  print(':(')

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
#define guard(x) if( not ( x ) ) continue;
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n, k; scan(n, k);
      std::vector<std::pair<Int, Int>> ps(n);
      std::vector<Int> xs;
      std::vector<Int> ys;
      for(Int i = 0; i < n; ++i) {
         scan(ps[i].first, ps[i].second);
         xs.push_back(ps[i].first);
         ys.push_back(ps[i].second);
      }
      std::sort(xs.begin(), xs.end());
      std::sort(ys.begin(), ys.end());
      Int res = (1LL << 62);
      for(Int y1 : ys) {
         for(Int y2 : ys) {
            for(Int x1 : xs) {
               for(Int x2 : xs) {
                  Int count = 0;
                  for(Int i = 0; i < n; ++i) {
                     Int x = ps[i].first, y = ps[i].second;
                     if( y1 <= y and y <= y2 and x1 <= x and x <= x2 ) count += 1;
                  }
                  if( count >= k ) {
                     res = std::min(res, (y2 - y1) * (x2 - x1));
                  }
               }
            }
         }
      }
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




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

int main(){

  int N,a;
  int hai=0,tya=0,midori=0,mizu=0,ao=0,ki=0,daidai=0,aka=0;
  int diff=0,all=0;
  cin>>N;

  for(int i=0;i<N;i++){
    cin>>a;
    if(a<=399){if(hai==0)diff++;hai++;}
    else if(a<=799){if(tya==0)diff++;tya++;}
    else if(a<=1199){if(midori==0)diff++;midori++;}
    else if(a<=1599){if(mizu==0)diff++;mizu++;}
    else if(a<=1999){if(ao==0)diff++;ao++;}
    else if(a<=2399){if(ki==0)diff++;ki++;}
    else if(a<=2799){if(daidai==0)diff++;daidai++;}
    else if(a<=3199){if(aka==0)diff++;aka++;}
    else all++;
  }

  int min,max;

  //最大値 all+diff
  max=all+diff;

  //最小値
  if(all<N){//3199以下がいる
    min=diff;
  }
  else{//全員3200以上
    min=1;
  }

  cout<<min<<" "<<max<<endl;
  
  return 0;
}


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

using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt {
	fint64 x;
	ModInt():x(0){}
	ModInt(fint64 x):
		x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
		{}
	// 負号
	ModInt operator -() const{
		return ModInt(-x);
	}
	// 加算
	ModInt &operator +=(const ModInt &rhs){
		x+=rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator +(const ModInt &rhs) const{
		return ModInt(*this)+=rhs;
	}
	// 減算
	ModInt &operator -=(const ModInt &rhs){
		x+=MOD-rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator -(const ModInt &rhs) const{
		return ModInt(*this)-=rhs;
	}
	// 乗算
	ModInt &operator *=(const ModInt &rhs){
		x*=rhs.x;
		if(x>=MOD) x%=MOD;
		return (*this);
	}
	ModInt operator *(const ModInt &rhs) const{
		return ModInt(*this)*=rhs;
	}
	// 除算
	ModInt &operator /=(const ModInt &rhs){
		(*this)*=rhs.inverse();
		return (*this);
	}
	ModInt operator /(const ModInt &rhs) const{
		return ModInt(*this)/=rhs;
	}
	// 等号
	bool operator ==(const ModInt &rhs){
		return x==rhs.x;
	}
	bool operator !=(const ModInt &rhs){
		return x!=rhs.x;
	}
	// 累乗
	ModInt pow(fint64 n) const{
		fint64 tmp=x;
		fint64 ret=1;
		while(n>0){
			if(n&1) ret=ret*tmp%MOD;
			tmp=tmp*tmp%MOD;
			n>>=1ll;
		}
		return ModInt(ret);
	}
	// 逆元
	ModInt inverse() const{
		fint64 a=x,b=MOD,s=1,t=0;
		while(b>0){
			fint64 u=a/b;
			a-=u*b;
			s-=u*t;
			swap(a,b);
			swap(s,t);
		}
		return ModInt(s);
	}
	// 入出力
	friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
		fint64 x; lhs>>x;
		rhs=ModInt<MOD>(x);
		return lhs;
	}
	friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
		return lhs<<rhs.x;
	}
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;
map<pair<int64_t, int64_t>, int> mp;
int main() {
	int n; cin >> n;
	mint zero = 0;
	for(int i = 0; i < n; ++i) {
		int64_t a, b; cin >> a >> b;
		if(a == 0 and b == 0) {
			zero += 1;
			continue;
		}
		if(a == 0) {
			++mp[{0, 1}];
		} else if(b == 0) {
			++mp[{1, 0}];
		} else {
			int64_t g = gcd(a, b);
			if((a > 0 and b > 0) or (a < 0 and b < 0)) {
				a = abs(a);
				b = abs(b);
				++mp[{a / g, b / g}];
			} else {
				a = abs(a);
				b = abs(b);
				++mp[{a / g, -b / g}];
			}
		}
	}
	mint ans = 1;
	for(auto e : mp) {
		int64_t x, y;
		tie(x, y) = e.first;
		if(mp[{x, y}] == 0) continue;
		int64_t nx = -y, ny = x;
		mint po = 2;
		if(mp.count({nx, ny})) {
			ans *= (po.pow(mp[{x, y}]) + po.pow(mp[{nx, ny}]) - 1);
			mp[{nx, ny}] = 0;
		} else if (mp.count({-nx, -ny})) {
			ans *= (po.pow(mp[{x, y}]) + po.pow(mp[{-nx, -ny}]) - 1);
			mp[{-nx, -ny}] = 0;
		} else {
			ans *= po.pow(mp[{x, y}]);
		}
	}
	cout << ans + zero - 1 << '\n';
	return 0;
}

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

struct UnionFind {
 private:
  vector<int> data;
  vector<int> rank;

 public:
  int num;

  UnionFind(int N) : data(N, -1), rank(N, 0), num(N) {}

  int root(int x) {
    if (data[x] < 0) return x;
    return data[x] = root(data[x]);
  }

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (rank[x] < rank[y]) swap(x, y);
      if (rank[x] == rank[y]) rank[x]++;
      data[x] += data[y];
      data[y] = x;
      num--;
    }
    return x != y;
  }

  bool same(int x, int y) { return root(x) == root(y); }

  int size(int x) { return -data[root(x)]; }
};

struct Edge {
  int to, w;
  Edge(int t, int w) :to(t), w(w) {}
};

struct Tree {
  int N;
  vector<vector<Edge>> edges;

  Tree(int N) :N(N), edges(N) {}

  void addDEdge(int a, int b) { addDEdge(a, b, 1); }
  void addDEdge(int a, int b, int w) { edges[a].emplace_back(b, w); }
  void addEdge(int a, int b) { addEdge(a, b, 1); }
  void addEdge(int a, int b, int w) { 
    edges[a].emplace_back(b, w);
    edges[b].emplace_back(a, w);
  }
};

struct Graph {
  int N, M;
  vector<vector<Edge>> edges;

  Graph(int N) : N(N), edges(N) {}

  void addDEdge(int a, int b) { addDEdge(a, b, 1); }
  void addDEdge(int a, int b, int w) { edges[a].emplace_back(b, w); }
  void addEdge(int a, int b) { addEdge(a, b, 1); }
  void addEdge(int a, int b, int w) {
    edges[a].emplace_back(b, w);
    edges[b].emplace_back(a, w);
  }

  vector<tuple<int, int, int>> edgeList;
  long long MSTcost;
  Tree kruskal() {
    rep(i, N) for (Edge e : edges[i]) {
      int a = i, b = e.to;
      if (a > b) continue;
      edgeList.emplace_back(e.w, a, b);
    }
    sort(edgeList.begin(), edgeList.end());
    UnionFind uf(N);
    Tree T(N);
    MSTcost = 0;
    for (auto t : edgeList) {
      int w, a, b;
      tie(w, a, b) = t;
      if (uf.same(a, b)) continue;
      T.addEdge(a, b, w);
      uf.unite(a, b);
      MSTcost += w;
    }
    return T;
  }
};

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> X, Y;
  rep(i, N) {
    int x, y;
    cin >> x >> y;
    X.emplace_back(x, i);
    Y.emplace_back(y, i);
  }
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());

  Graph G(N);
  rep(i, N - 1) {
    G.addEdge(X[i].second, X[i + 1].second, X[i + 1].first - X[i].first);
    G.addEdge(Y[i].second, Y[i + 1].second, Y[i + 1].first - Y[i].first);
  }

  G.kruskal();

  cout << G.MSTcost << endl;
}


Measured memory_bytes: 18788
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <deque> 
using namespace std;
 
int main() {
  int N;
  cin >> N;
  //string S[200000]; //// 2×10^5
  map<string,int> m;
  //memset(S,0,sizeof(S));
  int max = 0;
  for(int i=0;i<N;i++){
    string tmp;
    cin >> tmp;
    m[tmp] = m[tmp]+1;
    int tmp_max = m[tmp];
    if(tmp_max > max){max = tmp_max;}
  }
  
  vector<string> v;
  map<string,int>::iterator it = m.begin();
  for(;it!=m.end();++it){
    if(it->second == max){
      v.push_back(it->first);
    }
  }
  
  sort(v.begin(), v.end());
  vector<string>::iterator it2 = v.begin();
  for(;it2!=v.end();++it2){
    cout << *it2 << endl;
  }
  
  return 0;
}
 

Measured memory_bytes: 26868
#include<iostream>

using namespace std;
int main()
{
	string s;
	cin >> s;
	int tmp[26] = {0};
	for(char ans='a'; ans<='z'; ans++){
		if(s.find(ans) == string::npos){
			cout << ans << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
	long long n;
	double ans = 0.0;
	cin >> n;
	vector<long long> v(n);
	for (long long i = 0; i < n; i++)
		cin >> v[i];

	sort(v.begin(), v.end());

	ans += (double)(v[0] + v[1]) / 2;

	for (long long i = 2; i < v.size(); i++)
	{
		ans = (double)(ans + v[i]) / 2;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  sort(ALL(vec));
  int MAX = vec[N-1];
  int M = -1*INF;
  double dist = I32_MAX;
  for (int i = 0; i < N; i++)
  {
    if(abs(double(vec[i]) - double(MAX)/double(2)) <dist)
    {
      dist = abs(double(vec[i]) - double(MAX)/double(2)) ;
      M = vec[i];
    }
  }
  cout<<MAX<<" "<<M<<endl;
  
  
  
  
  

  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


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

int main() {
   string s, t;
   cin >> s >> t;

   // 文字列を後ろから見ていく
   for (int i = s.size()-1; i >= 0; i--) {
      // sからt.size()文字分抜き出す
      string p = s.substr(i, t.size());
      if (p.size() != t.size()) continue;

      // 置けるかどうかを判定
      bool ok = true;
      for (int j = 0; j < p.size(); j++) {
         if (p[j] == '?') continue;
         if (p[j] != t[j]) ok = false;
      }

      // 置けるならそこに置いて出力して終了
      if (ok) {
         int cnt = 0;
         for (int j = i; j < i+t.size(); j++) {
            s[j] = t[cnt];
            cnt++;
         }
         replace(s.begin(), s.end(), '?', 'a');
         cout << s << endl;
         return 0;
      }
   }

   // 最終的に置けないならこれを出力
   puts("UNRESTORABLE");

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    lli n;
    cin>>n;
    lli i,j;
    long double p[n+1],dp[n+1][n+1],ans=0;
    memset(dp,0.0,sizeof(dp));
    dp[0][0]=1;
    
    for(i=1;i<=n;i++) cin>>p[i];
    
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=(i+1);j++)
        {
            dp[i][j]=dp[i-1][j]*(1-p[i]);
            if(j>0) dp[i][j]+=dp[i-1][j-1]*p[i];
        }
    }
    
    for(i=(n+1)/2;i<=n;i++) ans+=dp[n][i];
	cout << fixed << setprecision(16) << ans;
    return 0;
}

Measured memory_bytes: 140928
#include<iostream>
using namespace std;
int main(){
	int S,h,m,s;
	cin >> S;
	h = S / 3600;
	m = (S - 3600 * h) / 60;
	s = S - 3600 * h - 60 * m;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 3088
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


# MOD = 998244353


class UnionFind:
    def __init__(self, size=None, nodes=None):
        """
        size か nodes どっちか指定。
        nodes は set、size は list を使う。
        :param int size:
        :param collections.Iterable nodes:
        """
        assert size is not None or nodes is not None
        if size is not None:
            self._parents = [i for i in range(size)]
            self._ranks = [0 for _ in range(size)]
            self._sizes = [1 for _ in range(size)]
        else:
            self._parents = {k: k for k in nodes}
            self._ranks = {k: 0 for k in nodes}
            self._sizes = {k: 1 for k in nodes}

    def unite(self, x, y):
        """
        x が属する木と y が属する木を併合
        :param x:
        :param y:
        """
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return

        # rank が小さい方が下
        if self._ranks[x] > self._ranks[y]:
            # x が root
            self._parents[y] = x
            self._sizes[x] += self._sizes[y]
        else:
            # y が root
            self._parents[x] = y
            self._sizes[y] += self._sizes[x]
            if self._ranks[x] == self._ranks[y]:
                self._ranks[y] += 1

    def root(self, x):
        """
        x が属する木の root
        :param x:
        """
        if self._parents[x] == x:
            return x
        self._parents[x] = self.root(self._parents[x])
        return self._parents[x]

    def size(self, x):
        """
        x が属する木のノード数
        :param x:
        """
        return self._sizes[self.root(x)]


def argsort(li, key=None, reverse=False):
    return [i for _, i in sorted(
        [(a, i) for i, a in enumerate(li)], key=(lambda t: key(t[0])) if key else None, reverse=reverse
    )]


N, M = list(map(int, sys.stdin.buffer.readline().split()))
A, B = list(zip(*[map(int, sys.stdin.buffer.readline().split()) for _ in range(N)]))
VU = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]

# from libs.debug import plot_graph
#
# plot_graph(VU)

graph = [[] for _ in range(N)]
for v, u in VU:
    v -= 1
    u -= 1
    graph[v].append(u)
    graph[u].append(v)

# 解説
# C[v] = A[v] - B[v]
# C の小さい順にグラフを構築して、部分グラフごとに答えを持つ
reqs = [max(0, a - b) for a, b in zip(A, B)]
uses = list(B)

idx = argsort(reqs)
uf = UnionFind(size=N)
seen = [False] * N
ans = [INF] * N
for v in idx:
    # v: 今までに見た中で C が最大の頂点
    seen[v] = True
    roots = set()
    for u in graph[v]:
        if not seen[u]:
            continue
        roots.add(uf.root(u))

    use_all = uses[v]
    for r in roots:
        use_all += uses[r]
    # v を最初にする場合
    req_v = reqs[v] + use_all
    for r in roots:
        # r のどれかを root とする部分グラフを最初にする場合
        # C[v] が今まで見たうち最大なので v に来たあとは好きな頂点まで行ける
        req_v = min(req_v, max(reqs[r], reqs[v]) + use_all - uses[r])

    for r in roots:
        uf.unite(v, r)
    reqs[uf.root(v)] = req_v
    uses[uf.root(v)] = use_all
ans = reqs[uf.root(0)]
print(ans)


Measured memory_bytes: 69908
#include<stdio.h>
int main(){
  int Y[]={0,-1,0,1};
  int X[]={1,0,-1,0};
  int n,m,i,j,x,y,w,h,l;
  char c,s[]={"ESWN"};
  while(scanf("%d",&n),n){
    int d[50][50]={0};
    x=y=10;
    for(i=j=0;i<n;i++){
      scanf("%d %d",&w,&h);
      d[h][w]=1;
    }
    scanf("%d",&m);
    while(m--){
      scanf(" %c %d",&c,&l);
      for(i=0;c-s[i];i++);
      while(l--){
	j+=d[y+=Y[i]][x+=X[i]];
	d[y][x]=0;
      }//printf("%d %d\n",y,x);
    }
    printf("%s\n",n-j?"No":"Yes");
  }
  return 0;
}

Measured memory_bytes: 600
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        lr: [[usize; 2]; n],
    }

    let mut sum = 0;
    for i in 0..n {
        sum += lr[i][1]-lr[i][0]+1;
    }

    println!("{}", sum);

}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    string s;
    cin >> s;
    vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
    for(i = n-1;i >= 0;--i){
        for(j = n-1;j >= 0;--j){
            if(s.at(i) == s.at(j)) dp.at(i).at(j) = dp.at(i+1).at(j+1) + 1;
        }
    }
    ll ans = 0;
    for(i = 0;i < n;++i){
        rep(j,n){
            ll tmp = min(dp.at(i).at(j), i-j);
            ans = max(ans,tmp);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 195968
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int mod=1000000007;
    int a,b,c;
    int ans[2]={0,0};
    while (scanf("%d,%d,%d",&a,&b,&c)!=EOF) {
        if (a==b) ans[1]+=1;
        else if (a*a+b*b==c*c) ans[0]+=1;
    }
    printf("%d\n%d\n",ans[0],ans[1]);
    return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000007;
const long double PI=3.14159265358979;
const ll MAX=0;

int main() {
  rep(i,5){
    ll a;
    cin>>a;
    if(a==0){
      cout<<i+1;
    }
  }
}


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

int main() {
    string S;
    cin >> S;
    ll N = S.size();
    string L=S,R=S;
    int ans=0;
    int ar=0,al=0;
    char c;
    for(int i=0;i<S.size();i++){
        if(i==0){
            c=R[i];
        }
        else{
            if(c==R[i]){
                R[i]=(c=='0')?'1':'0';
                ar++;
            }
            c=R[i];
        }
    }
    string M=S;
    int am=0;
    for(int i=0;i<S.size();i++){
        if(i==0){
            c=(M[i]=='0')?'1':'0';
            am++;
        }
        else{
            if(c==M[i]){
                M[i]=(c=='0')?'1':'0';
                am++;
            }
            c=R[i];
        }
    }
    for(int i=0;i<S.size();i++){
        if(i==0){
            c=L[N-i-1];
        }
        else{
            if(c==L[N-1-i]){
                L[N-1-i]=(c=='0')?'1':'0';
                al++;
            }
            c=L[N-1-i];
        }
    }
    cout << min(am,ar) << endl;
}

Measured memory_bytes: 640