akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int a,b,c,d,maxi=1e18;
map<int,int> ans; 
int solve(int x,int y){
	int t=maxi/x;
	if(t>=y){
		RE d*y;
	}else RE maxi;
}
int dfs(int x){
	if(!x)RE 0;
	if(x==1)RE d;
	if(ans.count(x)){
		RE ans[x];
	}
	int re;
	re=solve(d,x);
	int t;
	if(x%2!=0){
		t=x/2;
		t=t*2;
		gmin(re,dfs(t/2)+(x-t)*d+a);
		t+=2;
		gmin(re,dfs(t/2)+(t-x)*d+a);
	}else gmin(re,dfs(x/2)+a);
	if(x%3!=0){
		t=x/3;
		t=t*3;
		gmin(re,dfs(t/3)+(x-t)*d+b);
		t+=3;
		gmin(re,dfs(t/3)+(t-x)*d+b);
	}else gmin(re,dfs(x/3)+b);
	if(x%5!=0){
		t=x/5;
		t=t*5;
		gmin(re,dfs(t/5)+(x-t)*d+c);
		t+=5;
		gmin(re,dfs(t/5)+(t-x)*d+c);
	}else gmin(re,dfs(x/5)+c);
	RE ans[x]=re;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin>>t;
	while(t--){
		int x;
		ans.clear();
		cin>>x>>a>>b>>c>>d;
		cout<<dfs(x)<<'\n';
	}
	RE 0;
}




Measured memory_bytes: 4468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

int A, B;

int main(void){
    
    scanf("%d %d", &A, &B);
    A = (A == 1) ? 14 : A;
    B = (B == 1) ? 14 : B;
    if(A == B) printf("Draw\n");
    else if(A > B) printf("Alice\n");
    else printf("Bob\n");
    
    return 0;
}

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

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

    int ans = 0;
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i])
        {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#107b
import numpy as np

def trans(l):
    l=np.array(l)
    l=l.T
    l=l.tolist()
    return l

h,w=map(int,input().split())
temp1=[]
temp2=[]
ans=[]

for i in range(h):
    ans.append(list(input()))

for i in ans[:]:
    if set(i)!={'.'}:
        temp1.append(i)

     
ans=trans(temp1)

for i in ans[:]:
    if set(i)!={'.'}:
        temp2.append(i)

ans=trans(temp2)
        
for i in ans:
    print(''.join(i))

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

using namespace std;
#define int long long
signed main(){
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int n,k;
	cin>>n>>k;
	int ans=0,x;
	for (int i = 0; i < n; ++i)
	{
		cin>>x;
		if(x>=k)ans++;
	}
	cout<<ans;
	return 0;
}

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

int main() {
  string a,b;
  cin>>a>>b;
  int n,m;
  n=a.size();
  m=b.size();
  if(n==m){
    for(int i=0;i<n;i++){
      if(a[i]>b[i]){
        cout<<"GREATER";
        break;
      }
      else if(a[i]<b[i]){
        cout<<"LESS";
        break;
      }
      else if(a[i]==b[i] && i==n-1)
        cout<<"EQUAL";
    }
  }
    
    else if(n>m)
      cout<<"GREATER";
    else cout<<"LESS";
    
}

Measured memory_bytes: 256
# スペース区切りの整数入力
N,M,K = map(int, input().split())

fcnum = [ 0 for i in range(N+1)]
fring = [[] for i in range(N+1)]
frno =  [-1 for i in range(N+1)]

ab = []
for i in range(M):
    aa,bb = map(int, input().split())
    if aa > bb:
        aa,bb = bb,aa
    fcnum[aa] -= 1
    fcnum[bb] -= 1
    ab.append([aa,bb])

for aa,bb in ab:
    if frno[aa] == -1 and frno[bb] == -1:
        frn = aa
        frno[aa] = frn
        frno[bb] = frn
        fring[frn].append(aa)
        fring[frn].append(bb)
    elif frno[aa] == -1 and frno[bb] != -1:
        frn = frno[bb]
        frno[aa] = frn
        fring[frn].append(aa)
    elif frno[aa] != -1 and frno[bb] == -1:
        frn = frno[aa]
        frno[bb] = frn
        fring[frn].append(bb)
    else:
        if frno[aa] != frno[bb]:
            if len(fring[frno[aa]]) > len(fring[frno[bb]]):
                frnto = frno[aa]
                frnfrom = frno[bb]
            else:
                frnto = frno[bb]
                frnfrom = frno[aa]
            fring[frnto].extend(fring[frnfrom])
            for mvf in fring[frnfrom]:
                frno[mvf] = frnto
            fring[frnfrom] = []

for i in range(K):
    cc,dd = map(int, input().split())
    if frno[cc] == frno[dd] and frno[cc] != -1:
        fcnum[cc] -= 1
        fcnum[dd] -= 1

for k in range(1,len(fring)):
    cnum = len(fring[k]) - 1
    for ff in fring[k]:
        fcnum[ff] += cnum

for i in range(1,len(fcnum)):
    print(fcnum[i]," ",end="")

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int n, k, s;
	cin >> n >> k >> s;
	int as = (s==1?2:s-1);
	REP(i, 0, k) cout << s << " ";
	REP(i, k, n) cout << as<< " ";

}


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

#define int ll
//#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair 
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
#define PI 3.141592653589
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
using pld = pair <ld, ld>;

template <class T>
istream& operator>> (istream &in, vector <T> &a)
{
    for (auto &i : a)
        in >> i;
    return in;
}

template <class T> 
ostream& operator<< (ostream &out, vector <T> a)
{
    for (auto &i : a)
        out << i << ' ';
    return out;
}

template <class T, class U>
istream& operator>> (istream &in, pair <T, U> &p)
{
    in >> p.first >> p.second;
    return in;
}

template <class T, class U>
ostream& operator<< (ostream &out, pair <T, U> p)
{
    out << p.first << " " << p.second << " ";
    return out;
}

inline void Start()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
}

signed main()
{
    Start();
    int h, w, hh, ww;
    cin >> h >> w >> hh >> ww;
    cout << h * w - h * ww - hh * w + hh * ww;
    return 0;
}


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 105;
const ll mm = 1e+18;
int dist(pair<int,int>a,pair<int,int>b){
    return abs(a.f-b.f)+abs(a.s-b.s);
}
void solve()
{
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>>a(n);
    vector<pair<int,int>>b(m);
    rep0(i,n) cin>>a[i].f>>a[i].s;
    rep0(i,m) cin>>b[i].f>>b[i].s;
    rep0(i,n){
        set<pair<int,int>>s;
        rep0(j,m){
            s.insert({dist(a[i],b[j]),j+1});
        }
        auto it=s.beg;
        cout<<it->second<<"\n";
    }
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

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

typedef long long int ll;
typedef pair<int,int> pi;
priority_queue<pi, vector<pi>, greater<pi> > pq; //min heap

#define dodebug(i, n, arr)	for(int i=0;i<n;++i)	cout<<arr[i]<<" ("<<i<<")\n";

ll gcd(ll a,ll b){	if(b == 0)	return a;return gcd(b,a%b);}
ll binpow(ll n,ll x){	ll ans = 1;while(x){if(x & 1)	ans *= n;n *= n;x >>= 1;}return ans;}

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

	int n, k;
	cin>>n>>k;
	vector<int> h(n);
	for(int i=0;i<n;++i)	cin>>h[i];
	vector<int> dp(n+1, 1e9);
	dp[0] = 0;
	for(int i=0;i<n;++i){
		for(int j=1;j<=k;++j){
			if(i+j >= n)	break;
			dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
		}
	}
	
	cout<<dp[n-1]<<"\n";

	return 0;
}

Measured memory_bytes: 3996
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		int odd = (n % 2 == 0) ? n / 2 : (n / 2) + 1;
		System.out.println((double)odd / n);
	}
}

Measured memory_bytes: 23764
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE BangPatterns #-}

module Main where

import Debug.Trace
--import Data.List
--import qualified Data.Set.Strict as Set
--import qualified Data.Map.Strict as Map

main :: IO ()
main = do
  a <- getLine
  b <- getLine
  --a `traceShow`
  print $ solve a b

solve :: String -> String -> Int
solve as bs = foldr (\(a, b) s -> if a == b then s else s + 1) 0 $ zip as bs


Measured memory_bytes: 21660
S = input().split(" ")
n = int(S[0])
k = int(S[1])

def calculate(n,k):
    if k % 2 == 0:
        #选取所有能被K整除的数
        s1 = n // k
        s2 = 0
        for i in range(1,n+1):
            if i % k == k/2:
                s2 = s2 + 1
        return s1**3 + s2**3
    else:
        s1 = n // k
        return s1**3

result = calculate(n,k)

print(result)

Measured memory_bytes: 3060
n = int(input())
A = list(map(int, input().split()))
print(' '.join(str(a) for a in A))
for i in range(1, n):
    v = A[i]
    j = i -1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(' '.join(str(a) for a in A))

Measured memory_bytes: 7748
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb(a) push_back(a)
#define MAX(a, b) ((a < b)?b:a)
#define MIN(a, b) ((a > b)?b:a)
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;

template<typename T> void cinpb(vector<T>& x) { T n; cin >> n; x.push_back(n); }
ull gcd(ull a, ull b) { return b ? gcd(b, a%b) : a; }
ull lcm(ull m, ull n) {	return ((0 == m) || (0 == n)) ? 0 : ((m / gcd(m, n)) * n); }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

void yesno(bool f) { cout << (f ? "Yes" : "No") << endl; }

//

class drink
{
public:
	ll a; //値段
	ll b;
	bool operator<(const drink &rhs) const
	{
		return a < rhs.a;
	};
};

int main()
{
	ll N, M;
	cin >> N >> M;
	vector<drink> drinks;

	rep(i, N)
	{
		drink d;
		cin >> d.a >> d.b;
		drinks.pb(d);
	}

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

	ll price = 0;
	ll count = 0;

	rep(i, N)
	{
		if ( drinks[i].b + count >= M )
		{
			price += drinks[i].a * (M - count);
			break;
		}
		else
		{
			price += drinks[i].a * drinks[i].b;
			count += drinks[i].b;
		}
	}

	cout << price << endl;

	return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    char arr[3];
    cin >> arr[0] >> arr[1] >> arr[2];
    sort(arr, arr + 3);
    if (arr[0] == arr[1] && arr[2] != arr[1] || (arr[2] == arr[1] && arr[2] != arr[0]))
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class  Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //泊数
        int k = sc.nextInt(); //泊数
        int x = sc.nextInt(); //金額
        int y = sc.nextInt(); //金額
        
        if (n > k){
        System.out.println(x * k + y*(n-k));
        }else{
        System.out.println(x * n);
        }
    }
}

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


#define mod 1000000007
#define ull unsigned long long int
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
/* TYPE DEFINITIONS */
typedef     long long int        ll;
typedef     vector<ll>     vi;
typedef     pair<ll,ll>   pi;
 
 
 
/* MATH */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
ll pow(ll a,ll b,ll m)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}

ll ncr(int n, int k)  
{  
    if(k>n)return 0;
    ll res = 1;  
    if ( k > n - k )  
        k = n - k;  
    for (int i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
} 
  
//
/* MACROS */
 
#define  all(A)         (A).begin() , (A).end()
#define  arrall(A,n)    (A),((A)+(n))
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 
#define  deb(x)       cout << '>' << #x << ':' << x << endl;

void  solve()
{
    set<int> s;
    forn(i,3)
    {
        int a;
        cin>>a;
        s.insert(a);
    }
    if(s.size()==2)cout<<"Yes"<<endl;
    else cout<<"No";
}


int main()
{
 
    FastIO;
   // init();
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 LN           PIC X(13).
01 N            PIC 9(10).
01 K            PIC 9(2).
01 cnt          PIC 9(2).
01 ans          PIC Z9.

PROCEDURE DIVISION.
  ACCEPT LN.
  UNSTRING LN DELIMITED BY SPACE INTO N K.
  MOVE 1 TO cnt.
  PERFORM UNTIL N < K ** cnt
      ADD 1 TO cnt
  END-PERFORM.
  MOVE cnt TO ans.
  DISPLAY ans.
  STOP RUN.


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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007 //998244353
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll binpow(ll a,ll b){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a; a=a*a; b=b>>1;}	return ans;}


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	int a,b;cin>>a>>b;db(a*b);
	
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int n, y;
int main(void){
    // Your code here!
    bool uso = true;
    cin >> n >> y;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n - i; j++) {
            if (y == 10000 * i + 5000 * j + 1000 * (n - i - j)) {
                uso = false;
                cout << i << " " << j << " " << n - i - j << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
#include <iostream>
      #include <string>
      #include <vector>
      #include <algorithm>
      #include <utility>
      using namespace std;
      typedef long long ll;
      #define rep(i, n) for (int i=0;i < (int)(n);i++)



      int main(){
         int n,x;
         cin >> n >> x;
         vector<int> v(n);
         rep(i,n) cin >> v[i];
         int crnt = v[0]+v[1];
         ll ans =0;
         if (crnt > x){
            if (crnt-x <= v[1]) {
               v[1]-= (crnt-x);
               ans += ll(crnt-x);
            }else{
               v[1] =0;
               ans+=ll(crnt-x);
            } 
         }
         for (int i=2;i < n;i++){
            crnt = v[i-1]+v[i];
            if (crnt > x){
               if (crnt-x <= v[i]) {
                  v[i]-= (crnt-x);
                  ans += ll(crnt-x);
               }else{
                  v[i] =0;
                  ans+=ll(crnt-x);
               }
            } 
         }
         cout << ans << endl;
         
         return 0;
         
      }



Measured memory_bytes: 640
#pragma GCC optimize("O3")
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 300010


int main() {
	long long n;
	vector<pair<long long, long long> >a;
	vector<long long>b;
	vector<long long>c;
	long long c0 = 0;
	long long c1 = 0;
	long long x, ans;
	scanf("%lld", &n);
	f(i, n) {
		scanf("%lld", &x);
		b.push_back(x);
	}
	f(i, n) {
		scanf("%lld", &x);
		c.push_back(x);
	}
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	f(i, n) {
		if (b[i] <= c[i]) {
			a.push_back(make_pair(b[i], 0));
			a.push_back(make_pair(c[i], 3));
		}
		else{
			a.push_back(make_pair(c[i], 1));
			a.push_back(make_pair(b[i], 2));
		}
	}
	sort(a.begin(), a.end());
	ans = 1;
	f(i, 2 * n) {
		if (a[i].second == 0)c0++;
		else if (a[i].second == 1)c1++;
		else if (a[i].second == 2) {
			ans = (ans*c1) % MOD;
			c1--;
		}
		else {
			ans = (ans*c0) % MOD;
			c0--;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8500
#UnionFind木
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y:
      return

    if self.parents[x] > self.parents[y]:
            x, y = y, x

    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def same(self, x, y):
        return self.find(x) == self.find(y)

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i] = map(int, input().split())
  A[i] -= 1
  B[i] -= 1

ans = []

A = A[::-1]
B = B[::-1]
uf = UnionFind(N)
total = N*(N-1)//2
ans.append(total)
for i in range(M):
  if uf.same(A[i],B[i]):
    ans.append(total)
    continue
  m = abs(uf.parents[uf.find(A[i])])
  n = abs(uf.parents[uf.find(B[i])])
  #print(uf)
  #print(A[i]+1,m,B[i]+1,n)
  uf.union(A[i],B[i])
  total -= m*n
  ans.append(total)
  
#print(ans)   

print(*ans[:-1][::-1], sep='\n')


Measured memory_bytes: 19156
package main

import (
	"fmt"
)

func main() {
	var x, y, z, w int64
	fmt.Scan(&x, &y, &z, &w)
	ans := Max(x*y, z*w)
	fmt.Println(ans)
}

func Min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func Max(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 512
#include <cstdio>
using ll = long long;
constexpr int MOD = 998244353;
inline int Sum(int x, int y) { return (x += y) >= MOD ? (x - MOD) : x; }
inline int Sub(int x, int y) { return (x -= y) < 0 ? (x + MOD) : x; }
inline int quick_pow(int a, int n)
{
	int res = 1;
	while (n)
	{
		if (n & 1)
			res = (ll)res * a % MOD;
		a = (ll)a * a % MOD;
		n >>= 1;
	}
	return res;
}
inline void FWT(int *arr, int n, bool flg)
{
	int coef = flg ? (MOD + 1) / 2 : 1;
	for (int len = 1; len < n; len <<= 1)
	{
		for (int i = 0; i < n; i += len << 1)
		{
			for (int j = i; j < i + len; j++)
			{
				int x = arr[j], y = arr[j + len];
				arr[j] = (ll)(x + y) * coef % MOD;
				arr[j + len] = (ll)(x - y + MOD) * coef % MOD;
			}
		}
	}
}
int ans[300005], arr[300005], goal[300005];
int main()
{
	// freopen("AGC034-F.in", "r", stdin);
	int n, sum = 0;
	scanf("%d", &n);
	for (int i = 0; i < 1 << n; i++)
	{
		scanf("%d", arr + i);
		sum += arr[i];
	}
	sum = quick_pow(sum, MOD - 2);
	for (int i = 0; i < 1 << n; i++)
		arr[i] = (ll)arr[i] * sum % MOD;
	arr[0] = Sub(arr[0], 1);
	FWT(arr, 1 << n, false);
	for (int i = 0; i < 1 << n; i++)
		goal[i] = MOD - 1;
	goal[0] = Sum(goal[0], 1 << n);
	FWT(goal, 1 << n, false);
	for (int i = 0; i < 1 << n; i++)
		ans[i] = (ll)goal[i] * quick_pow(arr[i], MOD - 2) % MOD;
	FWT(ans, 1 << n, true);
	for (int i = 0; i < 1 << n; i++)
		printf("%d\n", Sub(ans[i], ans[0]));
	return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>


int main() {
	int a, b; std::cin >> a >> b;
	std::cout << std::max(0, a - 2 * b) << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;

int N;

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    int ans = 0;
    FOR (i, 1, N + 1) {
        if (i % 3 && i % 5)
            ans += i;
    }
    cout << ans << endl;


    solve();
    return 0;
}


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

struct edge{int to,cost;};

//pair<int,int> ??????first??????????????¢,second??????????????????

int v;
vector<edge> g[10000];
int d[10000];
const int INF = 10000000;

//s?????????????????????!
void dijkstra(int s){

  priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > que;
  fill(d,d+v,INF);
  d[s] = 0;
  que.push(pair<int,int>(0,s));


  while(!que.empty()){
    pair<int,int> p = que.top(); que.pop();
    int k = p.second;
    if(d[k] < p.first) continue;

    for(int i=0; i<g[k].size();i++){
      edge e = g[k][i];
      if(d[e.to] > d[k] + e.cost){
        d[e.to] = d[k] + e.cost;
        que.push(pair<int,int>(d[e.to],e.to));
      }
    }
  }

  for(int i=0; i<v;i++){
    cout << i << " " << d[i] << endl;
  }
}

int main(){

    cin >> v;

    int u,k,b,c;

    for(int i=0;i<v;i++){
      cin >> u >> k;
      for(int j=0;j<k;j++){
        cin >> b >> c;
        edge ed;
        ed.to = b;
        ed.cost = c;
        g[i].push_back(ed);
      }
    }

    dijkstra(0);


    return 0;
}

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

int main() {
  
  int N;
  int num = 0;
  int num2 = 0;
  int num3;
  int num4;
  int answer = 1e9;
  
  cin >> N;
  
  vector<int> W(N);
  
  for(int i = 0;i < N;++i){
    cin >> W[i];
  }
  
  for(int i = 0;i < N;++i){
    num = W[i] + num;
  }
  
  for(int i = 0;i < N;++i){
    
    num2 = W[i] + num2;
    num3 = num - num2;
    num4 = abs(num2 - num3);
    answer = min(answer,num4);
  }
   
  cout << answer << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  int ans = 1;
  for(int i = 1; i*i <= M; ++i){
    if(M%i) continue;
    if(M/i < N) continue;
    ans = max(ans, i);
    if(i < N) continue;
    ans = max(ans, M/i);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	int ans = 1e9;
	for(int i = -100; i <= 100; i++){
		int cnt = 0;
		rep(j,n){
			cnt += (i - a[j]) * (i - a[j]);
		}
		chmin(ans, cnt);
	}
	std::cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//ABC140 C - Maximal Value
//20190907

using System;
using System.Linq;
// using System.Math;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] B = Console.ReadLine().Split().Select(int.Parse).ToArray();



            double ans = B[0];

            for (int i = 1; i < N-1; i++)
            {
                ans += Math.Min(B[i], B[i - 1]);
            }
            
            ans += B[N-2];

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double long
#define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i)
#define rrep(i, m, n) for(ll i = (ll)(m); i > (ll)(n); --i)
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;

int n, m, x, now, minmoney = 90000000;
int a[12][12], c[12], rikai[12];
bool can = false, use[12];

void rec(int num){
    if(num == n){
        rep(i, 0, n){
            if(use[i]){
                now += c[i];
                rep(j, 0, m){
                    rikai[j] += a[i][j];
                }
            }
        }
        bool is_more = true;
        rep(i, 0, m) {
            if(rikai[i] < x) is_more = false;
            rikai[i] = 0;
        }
        if(is_more){
            minmoney = min(minmoney, now);
            can = true;
        }
        now = 0;
        return;
    }
    use[num] = false;
    rec(num+1);
    use[num] = true;
    rec(num+1);
    return;
}

int main(void){
    cin >> n >> m >> x;
    minmoney = 90000000;
    rep(i, 0, n){
        cin >> c[i];
        rep(j, 0, m) cin >> a[i][j];
    }
    rec(0);
    cout << (can? minmoney:-1) << endl;
    return 0;
}

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

int main(){
  ll S;
  cin >> S;
  if (S == 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<bool> V(32,false);
  for (ll i = 0; i < 32; i++){
    ll hoge = pow(2,i);
    if (S % (hoge * 2) != 0) {
      V.at(i) = true;
      if (i % 2 == 0) S -= hoge;
      else S += hoge;
    }
  }
  bool h = false;
  for (int i = 31; i >= 0; i--) {
    if (V.at(i)) {
      h = true;
      cout << 1;
    }
    else if (h) {
      cout << 0;
    }
  }
  cout << endl;
}

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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

string S, T;
signed main() {
    cin >> S >> T;
    int ans = 0;
    for (int i = 0; i < 3; i++) { ans += S[i] == T[i]; }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=200200;
int n;
int a[N];
map<int,int> st;
bool test(int cnt){
	st.clear();
	for(int i=1;i<=n;i++){
		if(a[i]<=a[i-1]){
			int j=a[i];
			while(++st[j]==cnt){
				j--;
				if(j==0||cnt==1){
					return false;
				}
			}
			while(!st.empty()&&(--st.end())->first>j){
				st.erase(--st.end());
			}
		}
	}
	return true;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	a[0]=0;
	int l=1,r=n;
	while(l<r){
		int mid=(l+r)>>1;
		if(test(mid)){
			r=mid;
		}
		else{
			l=mid+1;
		}
	}
	printf("%d\n",l);
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
using namespace std;
#define tubo 3.305785
 
double ans(int a , int b ){
  double res;
 
  res = (a*b)/tubo;
 
  return res;
}
 
int main(void){
  int a,b;
 
  cin >> a >> b;
  printf("%.6f\n" ,ans(a,b));
 
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = sz(s);
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    }
    if(n < 26){
        vector<int> data(26,0);
        set<int> let;
        rep(i,26) let.insert(i);
        rep(i,n) let.erase(s[i]-'a');
        s += (char)('a' + *begin(let));
        cout << s << endl;
        return 0;
    }else{
        string t = s;
        next_permutation(all(t));
        rep(i,n){
            cout << t[i];
            if(t[i] != s[i]) break;
        }
        cout << endl;
        return 0;
    }
}

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

int main() {
  uint64_t n, m;
  std::cin >> n >> m;
  std::vector<uint64_t> a(n);
  std::map<uint64_t, uint64_t> sum;
  std::map<uint64_t, uint64_t> sum2;

  uint64_t s = 0;
  for (auto &i : a) {
    std::cin >> i;
    i %= m;
    s += i;
    s %= m;
    if (sum.find(s) != sum.end()) {
      sum[s]++;
    } else {
      sum.insert(std::make_pair(s, 1));
    }
  }

  s = 0;
  uint64_t count = 0;
  for (auto &i : a) {
    uint64_t su, su2;
    if (sum.find(s) != sum.end()) {
      su = sum[s];
    } else {
      su = 0;
    }
    if (sum2.find(s) != sum2.end()) {
      su2 = sum2[s];
    } else {
      su2 = 0;
    }
    count += su - su2;
    s += i;
    s %= m;

    if (sum2.find(s) != sum2.end()) {
      sum2[s]++;
    } else {
      sum2.insert(std::make_pair(s, 1));
    }
  }

  std::cout << count << std::endl;
  return 0;
}

Measured memory_bytes: 8960
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

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

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

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	ll N; cin >> N;
	for (ll h = 3500; ; --h)
	{
		for (ll n = 3500; n >= 1; --n)
		{
			ll tmp = 4 * h*n - N * h - N * n;
			if (tmp <= 0)continue;
			if (N*h*n%tmp == 0)
			{
				cout << h << " " << n << " " << (N*h*n) / tmp << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(ll i=a;i>=b;i--)
#define FOR(m) Rep(i,1,m)
#define For(m) Rep(i,0,m-1)
#define Rbl(x,a) for(auto &x : a)
#define FIO ios::sync_with_stdio(0);   cin.tie(0);
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
const ll INF = 0x3f3f3f3f3f3f3f3fll;
#define mod 1000000007
 
const int mxN = 2e5 + 1;
ll n;
 
 
int main()
{
FIO
 
    cin >> n;
    bool can[n][n];
    For(n) Rep(j,0,n-1) cin >> can[i][j];
    vt<ll> dp(1 << n);
    dp[0] = 1;
    for(int mask = 0; mask < (1 << n); mask++)
    {
        int i = __builtin_popcount(mask);
        for(int j = 0; j < n; j++)
        {
            if(can[i][j] && !(mask & (1 << j)))
            {
                int new_mask = mask | (1 << j);
                dp[new_mask] += dp[mask];
                dp[new_mask] %= mod;
            }
        }
    }

    cout << dp[(1 << n)-1];
}

Measured memory_bytes: 19564
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a, b := nextInt(), nextInt()

	switch {
	case a+b >= a-b && a+b >= a*b:
		fmt.Println(a + b)
	case a-b >= a+b && a-b >= a*b:
		fmt.Println(a - b)
	default:
		fmt.Println(a * b)
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
using namespace std;

int main() {
    long long n;
    int k,x,y=1;
    cin >> n >> k;
    while (1) {
        x = n / k;
        if (x == 0) break;
        else {
            ++y;
            n = x;
        }

    }
    cout << y << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace Math_Functions
{
    class Distance
    {
        static void Main(string[] args)
        {
            var token = Console.ReadLine().Split(' ').Select(s => double.Parse(s)).ToArray();
            Console.WriteLine(Math.Sqrt(Math.Pow(token[0] - token[2], 2) + Math.Pow(token[1] - token[3], 2)));
        }
    }
}

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

int main() {
    ll x, y;
    cin >> x >> y;
    if (x == y || abs(x - y) == 1) puts("Brown");
    else puts("Alice");
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector <vll> vvll;
typedef pair <ll,ll> pll;
typedef vector <pll> vpll;

#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back
#define newl '\n'
#define gcd __gcd
#define fo(i,k,n) for(ll i=k;i<n;i++)
#define rev(i,k,n) for(ll i=k;i>n;i--)
#define MOD 1000000007 //10^9 + 7
#define deb(x) cout<<x<<" "<<#x<<newl
#define all(x) x.begin(),x.end()
#define print(x) for(auto i=x.begin();i!=x.end();i++)cout<<*i<<' ';cout<<endl;

ll INF = 1000000000000000005LL;

ll power(ll x, ll y, ll p=MOD){ //positive y
    ll res = 1;
    x = x % p; 
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 

ll inverse(ll a,ll m=MOD){
    return power(a,m-2,m);
}

vvll matmul(const vvll &a,const vvll &b,ll M=MOD){
    ll n=a.size(),m=a[0].size(),l=b[0].size();
    assert(m==b.size());
    vvll c(n,vll(l,0));
    fo(i,0,n)
    fo(j,0,l)
    fo(k,0,m)
    {
        c[i][j]=(c[i][j]+a[i][k]*b[k][j])%M;
    }
    return c;
}

vvll matpow(vvll a,ll p,ll M=MOD){
    assert(a.size()==a[0].size());
    ll n=a.size();
    vvll res(n,vll(n,0));
    fo(i,0,n)   res[i][i]=1;
    while(p>0)
    {
        if(p&1) res=matmul(res,a,M);
        a=matmul(a,a,M);
        p>>=1;
    }
    return res;
}

void solve(){
    ll n;
    cin>>n;

    string s;
    cin>>s;
    
    ll sol = n+1;

    vll r(n,0),w(n,0);

    if(s[0] == 'W') w[0] = 1;
    else r[0] = 1;

    fo(i,1,n){
        if(s[i] == 'R'){
            r[i] = r[i-1]+1;
            w[i] = w[i-1];
        }else{
            w[i] = w[i-1]+1;
            r[i] = r[i-1];
        }

    }

    if(r.back() == 0 || w.back() == 0){
        cout<<"0";
        return;
    }

    fo(firstR,0,n){

        if(s[firstR] == 'W') continue;

        ll lW = w[firstR];
        ll rR = r.back() - r[firstR];

        //deb(lW);
        //deb(rR);

        ll ans = 0;

        if(lW <= rR){
            ans += lW;
            ans += rR-lW;
            sol = min(ans,sol);
        }else{
            ans += rR;
            ans += lW-rR;
            sol = min(ans,sol);
        }

    }

    cout<<sol;

}

int main() {
    
    // fast io
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    
    //Number of Test cases
    ll T=1; 
    //cin>>T;
    
    while(T--){
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 6780
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long x = in.nextLong();

			long ans = 1;
			for (int i = 2; i <= (long)Math.sqrt(x)+1; i++) {
				for (int j = 2; (long)Math.pow(i, j) <= x; j++) {
					ans = Math.max(ans, (long)Math.pow(i, j));
				}
			}
			out.println(ans);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public int[] nextIntArray1Index(int n) {
			int[] res = new int[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public long[] nextLongArray1Index(int n) {
			long[] res = new long[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextLong();
			}
			return res;
		}

		public double[] nextDoubleArray(int n) {
			double[] res = new double[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextDouble();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 23380
#include<iostream>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main(){
    double a, b, c;
    double rad;
    double PI = acos(-1);
    
    cin >> a >> b >> c;
    rad = c * PI / 180;
    printf("%lf\n",a * b * sin(rad) * 0.5);
    printf("%lf\n",sqrt(a*a + b * b - 2*a*b*cos(rad)) + b + a);
    printf("%lf\n",a * b * sin(rad) / a);
    
    return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef unsigned long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
//const int mod = 1000000007;
const ll mod = INF / 1000;

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

    if (a < b) {
        swap(a, b);
    }

    if ((a - b) % 2 == 0) {
        cout << (a - b) / 2 << endl;
    } else {
        ll ans = 0;
        {
            ll now = 0;
            // 右経由
            ll right = n - a;
            now = right;
            ll nb = b + right;
            now += (n - nb + 1) / 2;
            ans = now;
        }
        {
            ll now = 0;
            // 左経由
            ll left = b - 1;
            now = left;
            a -= left;
            now += (a + 1) / 2;

            cmin(ans, now);
        }
        cout << ans << endl;
    }


}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<string.h>
#include<vector>
#include<set>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
int b[110000];
long long rem[110000];
char c[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",b+i);
		if(i<a-1)scanf("%s",c+i);
	}
	long long tmp=0;
	for(int i=a-1;i>=0;i--){
		tmp+=b[i];
		rem[i]=tmp;
	}
	long long ret=-inf;
	long long cur=b[0];
	bool flag=true;
	for(int i=0;i<a-1;i++){
		if(c[i]=='-'){
			flag=false;
			int len=0;
			long long val=-b[i+1];
			for(int j=i+1;j<a-1;j++){
				if(c[j]=='+')len++;
				else break;
				val-=b[j+1];
			}
			if(len==0){
				ret=max(ret,cur-b[i+1]+rem[i+2]);break;
			}
			ret=max(ret,cur+val+rem[i+len+2]);
			cur-=b[i+1];
			for(int j=i+1;j<a-1;j++){
				if(c[j]=='+')len++;
				else break;
				cur+=b[j+1];
			}
			
		}else if(flag){
			cur+=b[i+1];
		}
	}
	ret=max(ret,cur);
	printf("%lld\n",ret);
}


Measured memory_bytes: 1408