akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
//#define int long long

signed main(){
    int n, m;
    cin >> n >> m;
    double minimum = 0;
    priority_queue<int> q;
    rep(i,n){
        int a; cin >> a;
        q.push(a);
        minimum += a;
    }
    minimum = minimum / (4.0*m);
    
    while(!q.empty()){
        if(q.top() < minimum) break;
        m--;
        q.pop();
    }
    
    cout << (m <= 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
num = list(map(int, input().split(" ")))
if num[0] >= 0 and num[2] >= 0 or num[0] >= 0 and num[3] >=0 or num[2] >= 0 and num[1] >= 0:
    print(num[1]*num[3])
elif num[1] <= 0 and num[3] <= 0 or num[1] <= 0 and num[2] <=0 or num[0] <= 0 and num[3] <= 0:
    print(num[0]*num[2])
elif num[0] >= 0 and num[3] <= 0:
    print(num[0]*num[3])
elif num[1] <= 0 and num[2] >= 0:
    print(num[1]*num[2])
else:
    if num[0]*num[2] >= num[1]*num[3]:
        print(num[0]*num[2])
    else:
        print(num[1]*num[3])

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

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

    int ans = 0, tmp = 0;
    for(int i = 0; i < S.size(); i++)
    {
        if(S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C')
        {
            tmp++;
        }
        else
        {
            if(ans < tmp)
            {
                ans = tmp;
                tmp = 0;
            }
        }
    }

    cout << max(ans, tmp) << endl;
}

Measured memory_bytes: 256
N = gets.to_i
arr = gets.split.map(&:to_i)
arrsrt = arr.sort
center = N / 2
a = arrsrt[center]
b = arrsrt[center - 1]
N.times do |i|
  # ２分探索の必要無し
  # if arrsrt.bsearch_index{|x|x >= arr[i]} < center
  if arr[i] < a
    puts a
  else
    puts b
  end
end

Measured memory_bytes: 24512
#include <bits/stdc++.h>    //C++の標準ライブラリのヘッダを全て読み込む
 
int main() {
    using std::cout;
    using std::endl;
    using std::cin;
    using std::string;

    int N;
    string s[100];
    int P = 0, W = 0, G = 0, Y = 0;
    cin >> N;
 
    for(int i = 0; i < N; i++)
    {
        cin >> s[i];
    }

    for(int i = 0; i < N; i++)
    {
        if(s[i] == "P"){
            P = 1;
        } else if(s[i] == "W"){
            W = 1;
        } else if(s[i] == "G"){
            G = 1;
        } else if(s[i] == "Y"){
            Y = 1;
        } else {
            
        }
    }

    if(P+W+G+Y > 3){
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include <vector>
using namespace std;
#define pi M_PI

int main(){
    int a, b;
    cin >> a >> b;
    int p, s, m;
    p = a + b;
    s = a - b;
    m = a * b;
    
    if(p >= s && p >= m){
        cout << p << endl;
    }
    else if(s >= p && s >= m){
        cout << s << endl;
    }
    else if(m >= p && m >= s){
        cout << m << endl;
    }
    else if(p == s && s == m){
        cout << p << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

signed main() {
    int N, Z, W;
    cin >> N >> Z >> W;
    vi a(N);
    rep(i, N) cin >> a[i];

    int res;
    if(N==1) res = abs(a[0]-W);
    else res = max(abs(W-a[N-1]), abs(a[N-1]-a[N-2]));

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
    int seconds;
    int h, m, s;

    scanf("%d", &seconds);

    h = seconds / 3600;
    m = (seconds - h * 3600) / 60;
    s = seconds % 60;

    printf("%d:%d:%d\n", h, m, s);

    return 0;
}

Measured memory_bytes: 592
#include <stdio.h>
int main(void){
    int X;
    scanf("%d",&X);
    int dp[100000 + 1 + 105]={};
    dp[0]=1;
    for (int i=0; i<X; i++) {
        if(dp[i] == 1){
            for (int j=100; j<=105; j++) {
                dp[i+j]=1;
            }
        }
    }
    printf("%d\n",dp[X]);
    return 0;
    
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll s;
    cin >> s;
    ll t = 1000000000LL;
    if (s <= t) {
        cout << 0 << " " << 0 << " " << s << " " << 1 << " " << 0 << " " << 1
             << endl;
    } else {
        ll a1 = s / t + (s % t > 0), b2 = t;
        ll a2 = 1, b1 = (t - s % t) % t;
        assert(a1 * b2 - a2 * b1 == s);
        cout << 0 << " " << 0 << " " << a1 << " " << a2 << " " << b1 << " "
             << b2 << endl;
    }
}


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

typedef long long ll;

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<=(n);i++)

template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;

int mod = 100000;

int main(){
    int a,b;
    ll ans = 0;
    cin >> a >> b;
    ll search = min(a,b);
    int other = max(a,b);
    reps(i,1,other){
        if(((i*search)%other)==0){
            ans = i*search;
            cout << ans << endl;
            return 0;
        } 
    }
    return 0;  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }



signed main(){

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int Lx = llabs(x1 - x2), Ly = llabs(y1 - y2);
    int N; cin >> N;
    int X, Y;
    map<int, int> m;
    int n = 0;
    REP(i, N){
        cin >> X >> Y;
        if(min(x1, x2) <= X && X <= max(x1, x2) && min(y1, y2) <= Y && Y <= max(y1, y2)){
            m[llabs(X - x1)] = llabs(Y - y1);
            n++;
        }
    }
    vec dp(n + 1, INF);
    dp[0] = 0;
    for(auto p: m){
        int X0 = p.first, Y0 = p.second;
        int i = Upper_bound(dp, Y0);
        dp[i] = Y0;
    }
    int k;
    IREP(i, n + 1){
        if(dp[i] < INF){
            k = i;
            break;
        }
    }
    double ans;
    if(k == min(Lx, Ly) + 1){
        ans = 100.0 * (Lx + Ly) - (20.0 - 5.0 * M_PI) * (k - 1) + 10.0 * M_PI - 20.0;
    }else{
        ans = 100.0 * (Lx + Ly) - (20.0 - 5.0 * M_PI) * k;
    }
    cout << setprecision(15) << ans;
    
    return 0;
}

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

using namespace std;

using ll = long long;

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

    int n, sum = 0;
    cin >> n;

    vector<int> t(n);
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
        sum += t[i];
    }

    int m;
    cin >> m;
    for (int i = 0, p, x; i < m; ++i) {
        cin >> p >> x;
        cout << sum - t[p - 1] + x << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int y = scanner.nextInt();
		
		if(x==2||y==2){
			System.out.println("No");
		}else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11)){
			System.out.println("Yes");
		}else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12)){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
//#include<cstdio>
#define ll long long
using namespace std;
int main()
{
    int n;
    cin>>n;
    char a;
    int x1=0,x2=0,x3=0,x4=0;
    for(int i=1;i<=n;++i)
    {

        cin>>a;
        if(a=='G')x1++;
        if(a=='W')x2++;
        if(a=='P')x3++;
        if(a=='Y')x4++;
    }
    if(x1>0&&x2>0&&x3>0&&x4>0)cout<<"Four";
    else cout<<"Three";
}


Measured memory_bytes: 256
use std::io::{self, Read, Write};
use std::str::{self, FromStr};

pub struct IO<R: Read, W: Write>(R, io::BufWriter<W>);

impl<R: Read, W: Write> IO<R, W> {
    pub fn new(reader: R, writer: W) -> Self {
        Self(reader, io::BufWriter::new(writer))
    }

    pub fn read<T: FromStr>(&mut self) -> T {
        let token = self
        .0
        .by_ref()
        .bytes()
        .map(|b| b.unwrap())
        .skip_while(|&b| (b as char).is_whitespace())
        .take_while(|&b| !(b as char).is_whitespace())
        .collect::<Vec<u8>>();

        unsafe { str::from_utf8_unchecked(token.as_slice()) }
        .parse()
        .ok()
        .expect("Can't parse it.")
    }

    pub fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


fn main() {
    let (r, w) = (io::stdin(), io::stdout());
    let mut rw = IO::new(r.lock(), w.lock());

    let n: usize = rw.read();
    let s: Vec<u32> = rw.vec(n);

    let ans = s.iter()
    .map(|&a| a.trailing_zeros())
    .min()
    .unwrap();

    println!("{}", ans);
}

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

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long;
using pll = pair<ll, ll>;

const ll MAXN = 1000001;
bool P[MAXN];
bool S[MAXN];

template<typename T> T gcdraw(T a, T b) { return a ? gcdraw(b%a, a) : b; }
template<typename T> T gcd(T a, T b)
{
    const auto aa = abs(a), bb = abs(b);
    return aa > bb ? gcdraw(aa, bb) : gcdraw(bb, aa);
}

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

    vector<ll> A(N);
    rep (i, N) { cin >> A[i]; }

    vector<ll> PS = { 1, 2 };
    for (ll i=3;i*i<=MAXN;i+=2) if (!P[i])
    {
        for (ll j=2*i;j*j<=MAXN;j+=i) { P[j] = true; }
        PS.emplace_back(i);
    }

    const auto isPairwise = [&]()
    {
        for (const auto& a: A)
        for (const auto& p: PS)
        {
            if (a < p * p) { break; }
            if (a % p) { continue; }

            const auto x = p;
            const auto y = a / p;

            if (x != 1 && S[x]) { return false; }
            if (y != 1 && S[y]) { return false; }

            S[x] = S[y] = true;
        }

        return true;
    };

    if (isPairwise())
    {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    ll setwise = A[0];
    for (ll i=1;i<N;++i) { setwise = gcd(setwise, A[i]); }

    if (setwise == 1)
    {
        cout << "setwise coprime" << endl;
        return 0;
    }

    cout << "not coprime" << endl;
    return 0;
}


Measured memory_bytes: 11180
import math

def main():
    X,Y = map(int,input().split())
    MOD = 10**9+7
    K = 2*X-Y
    L = 2*Y-X
    if K>=0 and L>=0 and (K+L)%3 == 0:
        A = K//3 + L//3
        B = min(K//3,L//3)
        num = num_ = 1
        for i in range(1,B+1):
            num = num * (A+1-i) % MOD
            num_ = num_ * i % MOD
        ans = num * pow(num_,MOD-2,MOD) % MOD
        print(ans)

    else:
        print(0)

if __name__ == "__main__":
    main()

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

int main(){
  string s;
  std::cin >> s;
  int k;
  std::cin >> k;
  for (int i = 0; i < s.length(); i++) {
    if('z' + 1 - s[i] <= k and s[i] != 'a'){
      k -= 'z' + 1 - s[i]; 
      s[i] = 'a';
    }
  }
  for (int i = 0; i < k; i++) {
    if(s[s.length() - 1] == 'z'){
      s[s.length() - 1] = 'a';
    }else{
      s[s.length() - 1]++;
    }
  }
  std::cout << s << std::endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;

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

	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll N,A[100010];
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	sort(A,A+N);
	ll ans = 0;
	if(N%2==1){
		for(int i=0;i<N/2;i++){
			ans -= 2*A[i];
		}
		for(int i=N-1;i>=N/2+1;i--){
			ans += 2*A[i];
		}
		ans = max(ans-A[N/2]+A[N/2-1],ans+A[N/2]-A[N/2+1]);
	}else{
		for(int i=0;i<N/2;i++){
			ans -= 2*A[i];
		}
		for(int i=N-1;i>=N/2;i--){
			ans += 2*A[i];
		}
		ans += A[N/2-1]-A[N/2];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;


ll combination(ll x){
	return x*(x - 1)/2;
}



int main(){
	int n;
	cin >> n;
	vector<string> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		sort(ALL(a[i]));
	}
	sort(ALL(a));
	ll x = 1;
	ll ans = 0;
	for(int i = 0; i < n - 1; i++) {
		if(a[i] ==a[i+1]){
			x++;
		}
		else{
			ans += combination(x);
			x = 1;
		}
	}
	ans += combination(x);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7296
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int N, t;
  cin >> N;
  vector<int> a(100003, 0); // -1, 0, ..., 100001

  rep(i, N){
    cin >> t; // 0 | 100000
    a[t+2]++; // 2, 1 
    a[t+1]++; // 1, 0
    a[t]++; // 0, -1
  }

  int max_num = 0, max_index = 0;
  rep(i, 100003){
    if(a[i] > max_num){
      max_num = a[i];
      max_index=i;
    }
  }
  // print(max_index-1);
  print(max_num);

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

int N, a[440], dp[440][440], sum[440];

int dfs(int l, int r)
{
    if(~dp[l][r])return dp[l][r];
    if(l + 1 == r){
        return dp[l][r] = 0;
    }
    int res = INFL;
    for(int i = l + 1; i < r; i++){
        res = min(res, dfs(l, i) + dfs(i, r) + sum[r] - sum[l]);
    }
    return dp[l][r] = res;
}

signed main()
{
    cin >> N;
    for(int i = 1; i <= N; i++){
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << dfs(0, N) << endl;



    return 0;
}
/*



*/




Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,n,m;
    cin>>a>>n>>m;
    ll y=1;
    ll x;
    ll ans=0;
    ll maki;
    while(1){
        x=pow(y+a,n);
        if(x>m)break;
        maki=0;
        while(x){
            maki+=(x%10);
            x/=10;
        }
        if(y==maki){
            ans++;
        }
        y++;
    }
    cout << ans<<endl;
    return 0;
}




Measured memory_bytes: 3344
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define INOUT freopen(name".inp","r", stdin); freopen(name".out","w",stdout);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pb push_back
#define ppb pop_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<=n;i++)
#define fab(i,a,b) for(i=a;i<=b;i++)
#define f0r(i,n) for(i=n-1;i>=0;i--)
#define f1r(i,n) for(i=n;i>=1;i--)
#define fabr(i,a,b) for(i=b;i>=a;i--)
#define hi cout<<"hi\n";

#define ln "\n"

using namespace std;
const ld pi=acos(-1);
const ll mod=1e9+7;
const ll MAX=INT_MAX;
const ll MIN=INT_MIN;
int main()
{
    FAST;
    ll t,n,i,j,k,len,x,y,z,c,f,flag,p,q,mx,mn,l,r,sum,ans,tmp,it,pos;
    t=1;
    while(t--)
    {
        cin>>n>>k;
        ll a[n+1];
        ll dp[n+1];
        f1(i,n)
        {
            cin>>a[i];
            dp[i]=MAX;
        }
        
        dp[0]=0;
        dp[1]=0;
        f1(i,n)
        {
            fab(j,i+1,i+k)
            {
                if(j<=n)
                dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));
            }
        }
        
        // f0(i,n+1)
        // cout<<dp[i]<<" ";
        cout<<dp[n];
    }
	return 0;
}

Measured memory_bytes: 1792
n,a,b=map(int,input().split())
#print(n,a,b)
mod=10000*100000+7
def mpow(a,b,m=100000*10000+7):#returns a**b%m
  ret=1
  while b>0:
    if b&1:
      ret=(ret*a)%m
    a=(a*a)%m
    b>>=1
  return ret
def nCr(n,r):#computes nCr
  num=1
  for i in range(n-r+1,n+1):
    num=(num*i)%mod
  den=1
  for i in range(1,r+1):
    den=(den*i)%mod
  den=mpow(den,mod-2)
  return (num*den)%mod
ans=mpow(2,n)-1
if ans<0:
  ans+=mod
ans-=nCr(n,a)
if ans<0:
  ans+=mod
ans-=nCr(n,b)
if ans<0:
  ans+=mod
print(ans)



Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fr(i,x,y) for(int i=x;i<=y;++i)
#define rf(i,x,y) for(int i=x;i>=y;--i)
#define LL long long
using namespace std;
const int N=3e5+10;
int a[N],b[N];

void fail(){
	printf("No\n");
	exit(0);
}

bool check(int l,int r){
	int L=0,R=0;
	fr(i,l,r){
		if(b[i]<l||b[i]>r) return false;
		if(b[i]<i)
			if(L>b[i]) return false;
			 else L=b[i];
		else if(b[i]>i)
			if(R>b[i]) return false;
			 else R=b[i];
	}
	return true;
}

int main(){
	int n;scanf("%d",&n);
	fr(i,1,n) scanf("%d",&b[i]),a[i]=(b[i]==i);
	fr(i,2,n-1) if(!a[i-1]&&!a[i]&&!a[i+1]) fail();
	fr(i,1,n){
		if(!a[i]){
			int l=i,r=i,nw=0;
			while((a[r+1]^nw)&&r+1<=n) r++,nw^=1;
			//printf("%d %d\n",l,r);
			if(!check(l,r)) fail();
			i=r;
		}
	}
	printf("Yes\n");
	return 0;
}

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

int main(){
  int a[5];
  rep(i, 5)  
  cin >> a[i];

  rep(i, 5)
    if(a[i] != i+1){
      cout << i+1 << endl;
      return 0;
    }
  return 0;
}


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

using namespace std;
const double EPS = 1e-8;

inline bool equals(double x, double y) {
    return fabs(x - y) <= EPS;
}

class Point {//Point类，点
public:
    double x, y;

    Point(double x = 0, double y = 0) : x(x), y(y) {}

    Point operator+(Point p) { return Point(x + p.x, y + p.y); }

    Point operator-(Point p) { return Point(x - p.x, y - p.y); }

    Point operator*(double a) { return Point(a * x, a * y); }

    Point operator/(double a) { return Point(x / a, y / a); }

    double abs() { return sqrt(norm()); }

    double norm() { return x * x + y * y; }

    bool operator<(const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator==(const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};

typedef Point Vector;//Vector类，向量

struct Segment {//Segment 线段
    Point p1, p2;
};

double dot(Vector a, Vector b) {//内积
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {//外积
    return a.x * b.y - a.y * b.x;
}

bool isOrthogonal(Vector a, Vector b) {//判断正交
    return equals(dot(a, b), 0.0);
}

bool isOrthogonal(Point a1, Point a2, Point b1, Point b2) {//判断正交
    return isOrthogonal(a1 - a2, b1 - b2);
}

bool isOrthogonal(Segment s1, Segment s2) {//判断正交
    return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

bool isParallel(Vector a, Vector b) {//判断平行
    return equals(cross(a, b), 0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2) {//判断平行
    return isParallel(a1 - a2, b1 - b2);
}

bool isParallel(Segment s1, Segment s2) {//判断平行
    return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

Point project(Segment s, Point p) {//投影 对于给定的三个点p1、p2、p，从点p向通过
//p1、p2的直线引一条垂线，求垂足x的坐标。（点p在直线p1p2上的投影）
    Vector base = s.p2 - s.p1;
    double r = dot(p - s.p1, base) / base.norm();
    return s.p1 + base * r;
}

int main() {
    Point p1, p2, p;
    cin >> p1.x >> p1.y >> p2.x >> p2.y;

    Segment s;
    s.p1 = p1;
    s.p2 = p2;

    int q;
    cin >> q;

    while (q--) {
        cin >> p.x >> p.y;
        p = project(s, p);
        printf("%.10f %.10f\n", p.x, p.y);
    }
}



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

int main(){
	ll n,k; cin >> n >> k;
	vl h(n) rep(i,n)cin >> h[i];
	sort(h.begin(), h.end());
	ll ans = 0;
	rep(i,n-k)ans += h[i];
	cout << ans << endl;
}

Measured memory_bytes: 1792
class Main{
    public static void main(String[] a){
    	for (int i = 1; i < 10; i++) {
			for (int j = 1; j < 10; j++) {
				int s = i*j;
				System.out.println(i + "x" +j + "=" + s);
			}
		}
    }
}

Measured memory_bytes: 16856
N = int(input())
S = list(input())
z = ord("Z")
for i in range(len(S)):
    if ord(S[i])+ N > z:
        S[i] = chr(ord(S[i])+N-26)
    else:
        S[i] = chr(ord(S[i])+N)
print("".join(S))

Measured memory_bytes: 3060
using System;
using System.Linq;
namespace A_9x9
{
    class Program
    {
        static void Main(string[] args)
        {
             var line = Console.ReadLine().Trim().Split(' ').Select(s => int.Parse(s)).ToArray();
             int a=line[0];
             int b=line[1];
             int sum=-1;
             if(a<10&&b<10)
             {
                 sum=a*b;
             }
             Console.WriteLine(sum);
        }
    }
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

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

    ll N;
    cin >> N;

    vector<ll> A(N);
    rep (i, N) {
        cin >> A[i];
    }

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

    vector<ll> p(N);
    rep (i, N-1) {
        if (i%2) {
            p[i]--;
            p[i+1]++;
        } else {
            p[i]++;
            p[i+1]--;
        }
    }

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

    ll sum1 = 0;
    ll sum2 = 0;

    rep (i, N) {
        sum1 += p[i]*A[i];
        sum2 -= p[i]*A[N-(i+1)];
    }

    cout << max(sum1, sum2) << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1 ; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1 ; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const bool debug = 0;
/***************************************/

int dist(int h, int w) {
	return h * h + w * w;
}

int main() {
	int H, W;
	while (cin >> H >> W, H || W) {
	int mi = INF;
	pii ans(INF, 0);
	int d = dist(H, W);

	FOR(h, 1, 151) {
		FOR(w, h + 1, 151) {
			int curd = dist(h, w);
			if (curd > d || (curd == d && h > H)) {
				if (chmin(mi, curd)) ans = pii(h, w);
				else if (mi == curd) chmin(ans, pii(h, w));
			}
		}
	}
	if (debug) putchar('@');
	cout << ans.fi << " " << ans.se << endl;
	}
return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;

class LowLink{
public:
	int n, cnt1;
	vector<vector<int> > G, G2;	//G2は作ったグラフ(木)
	vector<int> pre, low, cmp, used;	//cmpは作成後のindex
	void init(int m){
		n = m;cnt1 = 0;
		pre.resize(n);low.resize(n);used.resize(n);
		G.resize(n);G2.resize(n);cmp.resize(n);
		fill(all(pre), -1);
	}
	void add_edge(int x, int y){
		G[x].pb(y);G[y].pb(x);
	}
	int dfs(int v = 0, int par = -1){	//橋の検出
		if(pre[v] >= 0)return pre[v];
		pre[v] = low[v] = cnt1++;
		rep(i,G[v].size())if(par != G[v][i]){
			int res = dfs(G[v][i], v);
			low[v] = min(low[v], res);
		}
		return low[v];
	}
	int build(int v = 0, int x = 0){	//橋のみを残した木の構築
		int mx = x;cmp[v] = x;
		used[v] = 1;
		rep(i,G[v].size())if(!used[G[v][i]]){
			if(pre[G[v][i]] == low[G[v][i]]){			//橋
				G2[cmp[v]].pb(x+1);G2[x+1].pb(cmp[v]);
				chmax(mx, build(G[v][i], x+1));x++;
			}else chmax(mx, build(G[v][i], cmp[v]));
		}
		return mx;
	}
	int lowlink(){
		rep(i,n)if(!used[i])dfs(i);
		fill(all(used), 0);
		int k = 0;
		rep(i,n)if(!used[i])k += (build(i, k)-k)+1;
		return k;
	}
};

vector<P> ans;
vector<vector<int> > G, G2;
signed main(){
	LowLink low;
	int n, m;
	scanf("%lld%lld", &n, &m);
	G.resize(n);
	low.init(n);
	rep(i,m){
		int v, u;
		scanf("%lld%lld", &v, &u);
		low.add_edge(v, u);
		G[v].pb(u);G[u].pb(v);
	}
	int size = low.lowlink();
	vector<vector<int> > G2 = low.G2;
	vector<int> cmp = low.cmp;
	rep(i,n){
		rep(j,G[i].size()){
			int from = cmp[i], to = cmp[G[i][j]];
			if(from != to and i < G[i][j])ans.push_back(P(i, G[i][j]));
		}
	}
	ZIP(ans);
	size = ans.size();
	rep(i,size)printf("%lld %lld\n", ans[i].fi, ans[i].se);
	return 0;
}







Measured memory_bytes: 7424
#include<bits/stdc++.h>
using namespace std;
inline void read(int& x)
{
	x = 0; char c = getchar();
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
}
char s[1000005];
int a[1000005], ans;
int main()
{
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	for (int i = n; i; --i) a[n + 1 - i] = s[i] - '0';
	for (int i = 1; i <= n + 1; ++i)
	{
		if (a[i] == 5)
		{
			ans += a[i];
			if (a[i + 1] >= 5) ++a[i + 1];
			continue;
		}
		if (a[i] < 5) ans += a[i];
		else ans += 10 - a[i], ++a[i + 1];
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 5120
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int s[100005];
int main()
{
    int n,k,i,sum=0;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%d",&s[i]);
    }
    n=n-k;
    sum=1;
    if(n>0)
    {
        sum=sum+n/(k-1);
        n=n-(sum-1)*(k-1);
    }
    if(n>0)
        sum=sum+1;
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long re = Main.count(A, B);
		int count =1;
		for (long i=2;i*i<=re;i++) {
			if (re%i==0) {
				while (re%i==0) {
					re/=i;
				}
				count ++;
			}
		}
		if (re>1) {
			count ++;
		}
		System.out.println(count);
	}

	public static long count(long A,long B) {
		if (A<B) {
			return count(B,A);
		}
		if (B==0) {
			return A;
		}
		return count(B,A%B);
	}
}

Measured memory_bytes: 35860
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <limits>
#include <iomanip>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '

const int MAXN = 200;
//ll a[MAXN], ST[MAXN * 4], LZ[MAXN*4];

/*bool perfectSquare(ll x){
    ll s = sqrt(x);
    if(s *s == x) return true;
    else return false;
}*/
typedef long double ld;

int main() { 
    ll r = 0;
    cin >> r;
    ld p = 3.14159;
    cout << setprecision(10) << r*2*p << endl;
  
    return 0; 
} 


Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
#define repeat(i,a,b) for(int i=(a),_=(b);i<_;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,_=(a);i>=_;i--)
#define mst(a,a0) memset(a,a0,sizeof(a))
#define vector basic_string
#define fi first
#define se second
#ifndef qwq
int cansel_sync=(ios::sync_with_stdio(0),cin.tie(0),0);
#endif
//mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N=200010; const double err=1e-11; typedef long long ll; const int inf=~0u>>2; const ll INF=~0ull>>2; ll read(){ll x; if(scanf("%lld",&x)==-1)exit(0); return x;} typedef double lf; typedef long double llf; const lf pi=acos(-1.0); lf readf(){lf x; if(scanf("%lf",&x)==-1)exit(0); return x;} template<typename T> T sqr(const T &x){return x*x;} typedef pair<int,int> pii;
const int mod=(1?1000000007:998244353); ll mul(ll a,ll b,ll m=mod){return a*b%m;} ll qpow(ll a,ll b,ll m=mod){ll ans=1; for(;b;a=mul(a,a,m),b>>=1)if(b&1)ans=mul(ans,a,m); return ans;} ll getinv(ll v,ll m=mod){return qpow(v,m-2,m);}
#define int ll
int a,b,n,x;
signed main(){
	cin>>a>>b>>n; x=b-1; if(x>n)x=n;
	cout<<a*x/b-a*(x/b)<<endl;
	return 0;
}

Measured memory_bytes: 3612
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
ans = "NO"
if A < B:
  x = A + V * T
  y = B + W * T
  if x >= y:
    ans = "YES"
else:
  x = A - V * T
  y = B - W * T
  if x <= y:
    ans = "YES"
print(ans)

Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define INF 10000000001
#define DIM 200001
#define mod 1000000007
#define PI 3.1415926535897932384626433
#define se second
#define fi first
#define pb push_back
#define T true
#define F false
#define endl "\n"
typedef char ch;
typedef bool boll;
typedef string st;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef set < string > sst;
typedef set < long long > sl;
typedef queue < long long > que;
typedef vector < long long > vec;
typedef map < long long, long long > mll;
typedef pair < long long, long long > pll;
typedef vector < pair < long long, long long > > vpl;
typedef pair < long long, unsigned long long > pul;
ll a,b,n,z,x,c,s,t;
int main()
{
    fast;
    cin>>x;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>z,s+=z;
    if(s>=x)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import math
 
def gcd(x, y):
	while y != 0:
		z = x % y
		x = y
		y = z
	return x
 
a, b = map(int, input().split())
x    = gcd(a, b)
y    = int(math.sqrt(x))
c    = 1

for i in range(2, y + 1):
	if y < i:
		break;
	if x % i == 0:
		c += 1
		while x % i == 0:
			x //= i
			
if 1 < x:
	c += 1

print(c)


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

int main() {
  int N, R;
  cin >> N >> R;
  
  if (N >= 10) {
    cout << R << endl;
  }
  
  if (N < 10) {
    cout << R + 100 * (10 - N) << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>

int n, k;
std::string st;

int main()
{
    std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
    std::cin >> n >> k; --n, --k;
    std::cin >> st;
    if (st[k] == 'A')
        st[k] = 'a';
    else if (st[k] == 'B')
        st[k] = 'b';
    else
        st[k] = 'c';
    std::cout << st << std::endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int a, b, c;
	int num = 0;

	cin >> a >> b >> c;

	for (int i = a; i <= b; ++i) {
		if (c % i == 0) num++;
	}

	cout << num << "\n";

	return 0;
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define INF 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

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

	int X,A;
	cin >> X >> A;

	if(X<A){
		cout << 0 << endl;
	}
	else{
		cout << 10 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define endl '\n'
using namespace std;
const int N=1e3+100,M=5e3+100;
ll dp[N];
ll val[N];
vector <int> g[N];
ll pd[N][M];
ll dfs(ll v){
    if (g[v].size()==0){
        dp[v]=0;
        return 0;
    }
    for (auto u : g[v]){
        dfs(u);
    }
    for (int i=0;i<=g[v].size();i++){
        for (int j=0;j<M;j++){
            pd[i][j]=1e9;
        }
    }
    pd[0][0]=0;
    for (int i=1;i<=g[v].size();i++){
        ll u=g[v][i-1];
        for (int j=0;j<=val[v];j++){
            if (j>=val[u]){
                pd[i][j]=min(pd[i][j],pd[i-1][j-val[u]]+dp[u]);
               // cout << v << " " << i << " " << j << " " << pd[i][j] << endl;
            }
            if (j>=dp[u]){
                pd[i][j]=min(pd[i][j],pd[i-1][j-dp[u]]+val[u]);
            //    cout << v << " " << i << " hg " << j << " " << pd[i][j] << endl;
            }
        }
       // cout << pd[i][0] << endl;
    }
    dp[v]=1e9;
    for (int i=0;i<=val[v];i++){
      //  cout << pd[g[v].size()][i] << " " << v << " " << dp[v] << endl;
        dp[v]=min(dp[v],pd[g[v].size()][i]);
    }
    if (dp[v]==1e9){
        cout << "IMPOSSIBLE";
        exit(0);
    }
  //  cout << v << " " << dp[v] << endl;
}
int32_t main(){
    sync;
    ll n;
    cin >> n;
    for (int i=2;i<=n;i++){
        ll x;
        cin >> x;
        g[x].pb(i);
    }
    for (int i=1;i<=n;i++){
        cin >> val[i];
    }
    dfs(1);
    cout << "POSSIBLE";
}


Measured memory_bytes: 41216
def main():
    n = int(input())
    hts = list(map(int,input().split()))
    max_val = 0
    count = 0
    for i in range(n-1):
        if hts[i+1] <= hts[i]:
            count += 1
        else:
            max_val = max(max_val,count)
            count = 0
    max_val = max(max_val,count)
    print(max_val)

main()
    


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define INF 1145141919
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int ny, nx;
typedef long long int ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
////////////////////////////////////////////////////////////////////
int main(){
    ll n; cin >> n;
    string s; cin >> s;
    ll ans=1;
    REP(i,26){
        ans *= count(s.begin(),s.end(),'a'+i)+1;
        ans = ans % 1000000007;
    }
    cout << ans-1 << endl;
    return 0;
}


Measured memory_bytes: 512
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap};

use std::iter::FromIterator;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}

fn main() {
    let n: usize = util::get();
    let xy: Vec<(usize, usize)> = (0..n)
        .map(|_| {
            let t = util::get2();
            (min(t.0, t.1), max(t.0, t.1))
        })
        .collect();

    let g_min = xy.iter()
        .flat_map(|t| vec![t.0, t.1].into_iter())
        .min()
        .unwrap();
    let g_max = xy.iter()
        .flat_map(|t| vec![t.0, t.1].into_iter())
        .max()
        .unwrap();

    let r_min_b_max = {
        let mut r = (xy[0].0, xy[0].0);
        let mut b = (xy[0].1, xy[0].1);

        for &(x, y) in xy[1..].iter() {
            r = (min(r.0, x), max(r.1, x));
            b = (min(b.0, y), max(b.1, y));
        }
        (r.1 - r.0) * (b.1 - b.0)
    };

    let r_min_r_max = {
        let mut b = BinaryHeap::from_iter(xy.iter().map(|&(x, y)| (y, x)));

        loop {
            let (x, y) = b.peek().cloned().unwrap();
            if y < x && y != g_min {
                b.pop();
                b.push((y, x));
            } else {
                break;
            }
        }

        let v = b.into_vec();
        let b_min = v.iter().map(|t| t.0).min().unwrap();
        let b_max = v.iter().map(|t| t.0).max().unwrap();
        let r_min = v.iter().map(|t| t.1).min().unwrap();
        let r_max = v.iter().map(|t| t.1).max().unwrap();

        (b_max - b_min) * (r_max - r_min)
    };

    println!("{}", min(r_min_r_max, r_min_b_max));

}


Measured memory_bytes: 12540
n = int(input())
ans = [0] * (10**5)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            ans[i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i-1] += 1
for i in range(n):
    print(ans[i])

Measured memory_bytes: 9768
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int flag=1;
    string s,sn;
    cin>>s>>sn;
    for(char some='a';some<='z';some++)
    {
        if(s+some==sn)
        {
            flag=0;
        }
    }
    if(flag==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
}

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

long long n;
vector<long long> a;

long long solve();

int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  vector<vector<long long>> dp;
  dp.assign(n + 1, vector<long long>(3, -1e18));
  dp[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= 2; ++j) {
      if (dp[max(0, i - 1)][j] != -1e18)
        dp[i + 1][j] = dp[max(0, i - 1)][j] + a[i];
      if (j != 0 && i >= 3 && dp[i - 2][j - 1] != 1e18)
        dp[i + 1][j] = max(dp[i + 1][j], dp[i - 2][j - 1] + a[i]);
    }
  }
  long long res = 0;
  for (int i = n - 1; i > 0; i -= 2) res += a[i];
  if (n % 2) res = max(res, dp[n][2]);
  res = max(res, dp[n][1]);
  if (n % 2) res = max(res, dp[n - 1][1]);
  res = max({res, dp[n - 1][0]});
  return res;
}

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

#define int long long
const int MOD=1e9+7;
int pw(int n,int k){
  assert(k>=0);
  int res=1;
  while(k){
    if(k&1)(res*=n)%=MOD;
    (n*=n)%=MOD;
    k>>=1;
  }
  return res;
}
std::vector<int> Factorial(5e6),Finverse(5e6);
void Cinit(){// limit is 5e6 /// write pw /// this takes 792ms at AtCoder
  Factorial[0]=1;
  for(int i=1;i<5e6;i++)Factorial[i]=(Factorial[i-1]*i)%MOD;
  for(int i=0;i<5e6;i++)Finverse[i]=pw(Factorial[i],MOD-2);
}
int nCk(int n,int k){
  if(n<k)return 0;if(k<0)return 0;
  if(!Factorial[0])Cinit();
  int res=Factorial[n];
  (res*=Finverse[k])%=MOD;
  (res*=Finverse[n-k])%=MOD;
  return res;
}
void f(int &a){
  a%=MOD;if(a<0)a+=MOD;
}
int seki(int a,int b,int c,int d){
  f(a);f(b);f(c);f(d);
  f(a*=b);f(a*=c);f(a*=d);
  return a;
}

signed main(){
  int n,m;cin>>n>>m;
  Cinit();
  int ans=0;
  for(int k=0;k<=n;k++)ans+=(k&1?-1:1)*seki(Factorial[m-k],Factorial[n],Finverse[n-k],Finverse[k]);
  cout<<seki(ans,Factorial[m],Finverse[m-n],Finverse[m-n])<<endl;
}


Measured memory_bytes: 81236
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb1=new StringBuilder();
		StringBuilder sb2=new StringBuilder();
		String b=" ",n="\n";
        String[] rc=br.readLine().split(b);
        int r=Integer.parseInt(rc[0]);
        int c=Integer.parseInt(rc[1]);
        int[][] h=new int[r+1][c+1];
        
        for(int i=0;i<r;i++){
        	String[] row=br.readLine().split(b);
        	int j=0;
        	for(String num:row){
        		h[i][j]=Integer.parseInt(num);
        		h[i][c]+=h[i][j];
        		h[r][j]+=h[i][j];
        		sb1.append(h[i][j]+b);
        		if(i==r-1){
        			h[r][c]+=h[r][j];
        			sb2.append(h[r][j]+b);
        		}
        		j++;
        	}
        	sb1.append(h[i][c]+n);
        }
        sb2.append(h[r][c]);
        System.out.print(sb1);
        System.out.println(sb2);
	}
}

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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORD(i, m, n) for (int i = m; i >= n; i--)
#define REP(i, n) for (int i = 0; i < n; i++)
#define REP1(i, n) for (int i = 0; i <= n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int x;
	REP(i,5){
		cin>>x;
		if(x==0){
			cout << i+1 << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define LL long long
#define re register
#define SIZE 105
using namespace std;
template <typename T>
inline void read(T &x)
{
	int f;char c;
	x=0,f=0,c=getchar();
	while(c<'0' && '9'<c)	f|=(c=='-'),c=getchar();
	while('0'<=c && c<='9')	x=(x<<3)+(x<<1)+c-48,c=getchar();
	x=f?-x:x;
}
LL n,W,V=100000;
LL w[SIZE];
LL v[SIZE];
LL dp[100005],ans=0;
int main()
{
	read(n);read(W);
	for(re int i=1;i<=n;++i)
		read(w[i]),read(v[i]);
	memset(dp,0x7f7f7f,sizeof(dp));
	dp[0]=0;
	for(re int i=1;i<=n;++i)
		for(re int j=V;j>=0;--j)
			if(j-v[i]>=0)
				dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
	for(re int i=V;i>=0;--i)
		if(dp[i]<=W)
		{
			printf("%d\n",i);
			break;
		}
	return 0;
}

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

using namespace std;

#define PB push_back
#define MP make_pair
#define X first
#define Y second

#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define err(x) cerr << #x << " = " << x << endl;
#define read(a) freopen(a,"r",stdin)
#define write(a) freopen(a,"w",stdout)
#define forall(i,a,b) for(int i=a;i<b;i++)
#define foreach(v, c) for(typeof((c).begin())v=(c).begin();v!=(c).end();++v)

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

clock_t start;
void Time(bool timeIt) {
	if (!timeIt) return;
	clock_t end = clock();
	double elapsed_time = ((db)end - (db)start) / (db)CLOCKS_PER_SEC;
	printf("Time elapsed = %0.4lf\n", elapsed_time); 
}

#define LINF (long long)1e18
#define EPS 1e-9
#define INF 1000000007ll
#define SIZE 100010
#define MAX_A 1000010

int dp[1 << 16], d[SIZE] = {0}, cnt[16] = {0}, x[1 << 16];

int ans(int mask) {
	if (dp[mask] != -1) return dp[mask];
	dp[mask] = 0;
	for (int i = (mask - 1) & mask ; i >= 0 ; i = (i - 1) & mask) {
		if (!x[i]) dp[mask] = max(dp[mask], 1 + ans(i));
		if (i == 0) break;
	}
	return dp[mask];
}

int main() {
	start = clock();
	int n;
	scanf("%d", &n);
	for (int i = 1 ; i < n ; ++i) {
		int u, v, w;
		scanf("%d %d %d", &u, &v, &w);
		d[u] ^= w;
		d[v] ^= w;
	}
	for (int i = 0 ; i < (1 << 16) ; ++i) dp[i] = -1;

	int mask = 0, res = 0;
	for (int i = 0 ; i < n ; ++i) {
		mask ^= (1 << d[i]);
		if (d[i] != 0 && (mask & (1 << d[i])) == 0) ++res;
	}
	for (int i = 0 ; i < (1 << 16) ; ++i) {
		x[i] = 0;
		for (int j = 0 ; j < 16 ; ++j) {
			if (i & (1 << j)) x[i] ^= j;
		}
	}
	dp[0] = 0;
	if (mask > 0) res += __builtin_popcount(mask) - ans(mask);

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

	Time(false);
	return 0;
}

Measured memory_bytes: 1152