akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;



int main() {
	
	long long int x;
	cin >> x;
	long long int ans = 0;
	int t = 0,i;
	for ( i = 1; ; i++) {
		ans += i;
		if (ans >= x)break;
	}
	cout << i << endl;
	return 0;

}


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

using namespace std;

struct Combination {
	vector<int64_t> _fact, _rfact, _inv;
	int64_t MOD;

	Combination(size_t sz, int64_t mod) : _fact(sz + 1), _rfact(sz + 1), _inv(sz + 1), MOD(mod) {
		_fact[0] = _rfact[sz] = _inv[0] = 1;
		for (int i = 1; i <= sz; ++i) {
			_fact[i] = _fact[i - 1] * i % MOD;
		}
		_rfact[sz] = inverse(_fact[sz]);
		for (int i = sz - 1; i >= 0; --i) {
			_rfact[i] = _rfact[i + 1] * (i + 1) % MOD;
		}
		for (int i = 1; i <= sz; ++i) {
			_inv[i] = _rfact[i] * _fact[i - 1] % MOD;
		}
	}

	inline int64_t fact(int k) const { return _fact[k]; }
	inline int64_t rfact(int k) const { return _rfact[k]; }
	inline int64_t inv(int k) const { return _inv[k]; }

	int64_t inverse(int64_t x) const { return pow(x, MOD - 2); }
	int64_t pow(int64_t x, int64_t n) const {
		int64_t ret = 1;
		while (n > 0) {
			if (n & 1) { (ret *= x) %= MOD; }
			(x *= x) %= MOD;
			n >>= 1;
		}
		return ret;
	}

	int64_t P(int n, int r) const {
		if (r < 0 || n < r) { return 0; }
		return fact(n) * rfact(n - r) % MOD;
	}
	int64_t C(int n, int r) const {
		if (r < 0 || n < r) { return 0; }
		return fact(n) * rfact(r) % MOD * rfact(n - r) % MOD;
	}
};

int main() {
	const Int MOD = 1e9 + 7;
	Int N, K;
	cin >> N >> K;

	Combination cb(200010, MOD);
	Int ans = 0;
	for (int i = 0; i <= min(N - 1, K); ++i) {
		(ans += cb.C(N - 1, i) * cb.C(N, i) % MOD) %= MOD;
	}
	cout << ans % MOD << endl;

	return 0;
}


Measured memory_bytes: 4992
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  string s;
  cin >> s;
  for(int i=0;i<=1;i++){
    bool can = true;
    for(int j=0;j<3;j++){
      if(s[i]!=s[i+j]){
        can = false;
      }
    }
    if(can){
      cout << "Yes\n";
      return 0;
    }
  }
  cout <<"No\n";
}


Measured memory_bytes: 256
import numpy as np
import itertools

h, w, k = map(int, input().split())
field = [list(input()) for _ in range(h)]
npfield = np.array(field)
#%%
ans = 0
for i in itertools.product([False, True], repeat=h):
    for j in itertools.product([False, True], repeat=w):
        cnt = np.count_nonzero(npfield[np.ix_(i, j)] == '#')
        if cnt == k:
            ans += 1

print(ans)

Measured memory_bytes: 27000
#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
ll a[N],b[N],aa[N],bb[N],x[N];
int main()
{
    int n,m,q;
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    for(int i=1;i<=m;i++)
        scanf("%lld",&b[i]);
    for(int i=1;i<=q;i++)
        scanf("%lld",&x[i]);

    for(int i=1;i<=n;i++)
        aa[i]=a[n-i+1];
    for(int i=1;i<=m;i++)
        bb[i]=b[m-i+1];

    for(int i=1;i<=q;i++)
    {
        int la,lb,ra,rb;
        ll ans=1e12;
        la=lower_bound(aa+1,aa+1+n,x[i],greater<ll>())-aa;
        lb=lower_bound(bb+1,bb+1+m,x[i],greater<ll>())-bb;
        ra=lower_bound(a+1,a+1+n,x[i])-a;
        rb=lower_bound(b+1,b+1+m,x[i])-b;

        if(la<=n&&lb<=m)
            ans=min(ans,x[i]-min(aa[la],bb[lb]));

        if(ra<=n&&rb<=m)
            ans=min(ans,max(a[ra],b[rb])-x[i]);

        if(la<=n&&rb<=m)
        {
            ll res=b[rb]-aa[la];
            res+=min(b[rb]-x[i],x[i]-aa[la]);
            ans=min(ans,res);
        }
        if(ra<=n&&lb<=m)
        {
            ll res=a[ra]-bb[lb];
            res+=min(a[ra]-x[i],x[i]-bb[lb]);
            ans=min(ans,res);
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    IOS;
    //freopen("inputfile.txt","r",stdin);
   char c;cin>>c;
   if(c>=97 && c<=122)cout<<"a"<<endl;
   else cout<<"A"<<endl;
    return 0;
}



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

int main()
{
	
	long long a, b, as = 0, bs = 0;
	cin >> a >> b;
	if(a < 3)
	{
		for(int i = 1; i <= a - 1; i++)
		{
			as ^= i;
		}
	}else
	{
		long long ac = a - 1;
		ac -= 3;
		ac /= 4;
		ac *= 4;
		ac += 4;
		for(; ac <= a - 1; ac++)
		{
			as ^= ac;
		}
	}
	if (b < 3)
	{
		for (int i = 1; i <= b; i++)
		{
			bs ^= i;
		}
	}
	else
	{
		long long bc = b;
		bc -= 3;
		bc /= 4;
		bc *= 4;
		bc += 4;
		for (; bc <= b; bc++)
		{
			bs ^= bc;
		}
	}
	cout << (as ^ bs) << "\n";
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
 
const long INF = (1l << 30);
const long LINF = (1l << 60);

long a, b;

int main(){
	scanf("%ld%ld", &a, &b);
	if(a >= 13){
		printf("%ld\n", b);
	}else if(a >= 6){
		printf("%ld\n", b / 2);
	}else{
		printf("0\n");
	}
	return 0;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int flag = in.nextInt();
		while (flag != 0) {
			int n = flag;
			Island[] island = new Island[n];
			int w = 0;
			for (int i = 0; i < n; i++) {
				island[i] = new Island(in.nextInt(), in.nextInt());
				w += island[i].juel;
			}
			Arrays.sort(island);
			boolean isYes = true;
			for (Island a : island) {
				if (w > a.bridge) {
					isYes = false;
					break;
				}
				w -= a.juel;
			}
			System.out.println(isYes ? "Yes" : "No");
			flag = in.nextInt();
		}
	}

	static class Island implements Comparable<Island> {
		final int juel;
		final int bridge;

		Island(int juel, int bridge) {
			this.juel = juel;
			this.bridge = bridge;
		}

		@Override
		public int compareTo(Island o) {
			return o.bridge < bridge ? -1 : o.bridge == bridge ? 0 : 1;
		}

	}
}

Measured memory_bytes: 12000
n = int(input())
s = list(input())
w = b = 0
mn = 0
# 境界線(ex: "..#.....(ココ)###..####")より(左にある黒の数)+(右にある白の数)が求めるべき値
# これが最小になるように前から確認してmnを更新していく
for i in range(n):
    if s[i]=="#":
        b+=1
    else:
        w+=1
    if mn>b-w:
      mn = b-w
      #print(i,mn,b,w)
      
#　最後に全体の白の数を足すことで、
# 境界線より (左の黒の数-白の数)+(全体の白の数) = (左にある黒の数)+(右にある白の数)
print(mn+w)


Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
int main(void){
 
    int N;
    cin >> N;
    
    long long A[N+1];
    long long B[N];
    for(int i = 0; i < N + 1; i++)cin >> A[i];
    for(int i = 0; i < N; i++)cin >> B[i];
    
    long long sum = 0;
    long long res = 0;    
    for(int i = 0; i < N;i++){
        
        res = B[i];
        
        if(A[i] - B[i] > 0){
            //cout<< "a" << endl;
            A[i] = A[i] - B[i]; 
            B[i] = 0;
        }else{
            
            
            B[i] = B[i] - A[i];
            A[i] = 0;
            if(A[i+1] - B[i] > 0){
                //cout<< "b" << endl;
                A[i+1] = A[i+1] - B[i];    
                B[i] = 0;
            }else{
                // cout<< "c" << endl;
               
                B[i] = B[i] - A[i+1];
                A[i+1] = 0;
            }

        }
        // cout << A[i] << endl;
        // cout << A[i+1] << endl;
        // cout << B[i] << endl;
        // cout << res << endl;
        sum += res - B[i];
        
    }    
    
    cout << sum << endl;
    
}
 

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = in.nextInt();
        final int m = in.nextInt();
        final long k = in.nextLong();
        in.nextLine();
        final long[] prefixA = new long[n + 1];
        for (int i = 0; i < n; i++) {
            prefixA[i + 1] = in.nextLong() + prefixA[i];
        }
        in.nextLine();
        final long[] prefixB = new long[m + 1];
        for (int i = 0; i < m; i++) {
            prefixB[i + 1] = in.nextLong() + prefixB[i];
        }
        in.nextLine();
        int res = 0;
        int j = m;
        for (int i = 0; i <= n; i++) {
            long curr = k - prefixA[i];
            if (curr < 0) {
                break;
            }
            while (j > 0 && prefixB[j] > k - prefixA[i]) {
                j--;
            }
            res = Math.max(res, i + j);
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 63904
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int a,b;
string s;
int main(){
    cin>>s;
    if(s=="SUN")cout<<7;
    if(s=="MON")cout<<6;
    if(s=="TUE")cout<<5;
    if(s=="WED")cout<<4;
    if(s=="THU")cout<<3;
    if(s=="FRI")cout<<2;
    if(s=="SAT")cout<<1;
    cout<<endl;
}

Measured memory_bytes: 256
import sys
a,b,c,d = input()
for i in ["+","-"]:
    for j in ["+","-"]:
        for k in ["+","-"]:
                if eval(a+i+b+j+c+k+d) == 7:
                    print(a+i+b+j+c+k+d+ "=7")
                    sys.exit()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int a,b,c;cin>>a>>b>>c;
    set<int> set;
    int num=0;
    for(;;){
        if(set.count(num%b)){
            coutN; return 0;
        }
        if(num%b==c){
            coutY; return 0;
        }
        set.insert(num%b);
        num+=a;


    }
}

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

int main(void)
{
	double v, times, hight, street;
	int ans;

	while (cin >> v) {
		times = v / 9.8;
		hight = 4.9 * times * times;
		street = (hight + 5.0) / 5.0;
		if (street - (int)street) ans = (int)(street + 1.0);
		else ans = street;
		printf("%d\n", ans);
	}
	
	return 0;
}

Measured memory_bytes: 1208
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    S = input()
    if S == "AC":
        AC += 1
    elif S == "WA":
        WA += 1
    elif S == "TLE":
        TLE += 1
    else:
        RE += 1
print("AC x {}".format(AC))
print("WA x {}".format(WA))
print("TLE x {}".format(TLE))
print("RE x {}".format(RE))


Measured memory_bytes: 69848
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  lint K;
  cin>>K;
  lint X=0;
  REP(i,1e7){
    X*=10;
    X+=7;
    X%=K;
    if(X==0){
      cout<<i+1<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 3580
c = readlines.map{|m| m.split.map(&:to_i)}
a = [0] * 3
b = [0] * 3
ans = true

0.upto(100) do |n|
  a[0] = n
  b[0] = c[0][0] - a[0]
  b[1] = c[0][1] - a[0]
  b[2] = c[0][2] - a[0]
  a[1] = c[1][0] - b[0]
  a[2] = c[2][0] - b[0]

  3.times do |i|
    3.times do |j|
      ans = false if c[i][j] != a[i] + b[j]
    end
  end
  break if ans == true
end

puts ans == true ? "Yes" : "No"


Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define dalao main
#define ll long long
#define debug(x) {cerr<<#x<<" = "<<(x)<<endl;}
using namespace std;
int dalao()
{
    ios::sync_with_stdio(false);
    int w;
    cin>>w;
    int re=1000-w%1000;
    if(re==1000) cout<<"0";
    else cout<<re;
    return 0;
}


Measured memory_bytes: 3636
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int s = scan.nextInt();
		List<Integer> list = new ArrayList<>();
		
		while(!list.contains(s)) {
			list.add(s);
			if (s % 2 == 0) {
				s /= 2;
			} else {
				s = 3 * s + 1;
			}
		}
		
		System.out.println(list.size() + 1);
		
		scan.close();
	}
}

Measured memory_bytes: 23124
n, x, y = gets.split.map(&:to_i)

ans = Array.new(n, 0)
(1..n).to_a.combination(2) do |s, t|
    d = [t - s, (x - s).abs + 1 + (y - t).abs].min
    ans[d] += 1
end

ans[1..-1].each {|e| puts e}

Measured memory_bytes: 1788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			int a = Integer.parseInt(chr[0]);
			int b = Integer.parseInt(chr[1]);
			int c = Integer.parseInt(chr[2]);

			int x=Math.max((Math.max(a, b)),c);
			int y=Math.min((Math.min(a, b)),c);
			System.out.println(x-y==a || x-y==b|| x-y==c?"Yes":"No");

		}
	}
}


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

int main() {
    long long n, k;
    cin >> n >> k;
    vector<pair<long long, long long>> obj(n);
    vector<long long> dp(k + 1, 0);
    for (int i = 0; i < n; i++)
        cin >> obj[i].first >> obj[i].second;
    for (int i = 0; i < n; i++) {
        vector<long long> next(k + 1, 0);
        for (int j = 0; j <= k; j++) {
            next[j] = obj[i].first > j
                          ? dp[j]
                          : max(dp[j], dp[j - obj[i].first] + obj[i].second);
            if (j > 0)
                next[j] = max(next[j], next[j - 1]);
        }
        dp = next;
    }
    cout << dp[k] << endl;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    if (n == 1) {
        cout << m << endl;
        return 0;
    }
    int ans = 0;
    for (int i=1; i*n<=m; ++i) {
        if (m%i == 0) {
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	for {
		var n int
		fmt.Scan(&n)
		if n == 0 {
			break
		}

		scores := make([]float64, n)
		var total float64
		for i := 0; i < n; i++ {
			fmt.Scan(&scores[i])
			total = total + scores[i]
		}
		ave := total / float64(n)

		var sumDivs float64
		for i := 0; i < n; i++ {
			sumDivs = sumDivs + ((math.Abs((scores[i] - ave))) * (math.Abs((scores[i] - ave))))
		}
		ss := sumDivs / float64(n)

		fmt.Printf("%.8f\n", math.Sqrt(float64(ss)))
	}
}



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

int main() {
  int n,k; cin>>n>>k;
  int a[n];
  rep(i, n) cin>>a[i];
  
  int mina=9999999;
  int minplace=-1;
  rep(i, n){
    if(mina>a[i]){mina=a[i];
                  minplace=i;}
  }

  
  int left=(minplace+k-2)/(k-1);
  int right=(n-minplace+k-3)/(k-1);
  
  cout<<(n+k-3)/(k-1)<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <stack>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <vector>
#include <cmath>
#include <utility>
#define ll long long
using namespace std;
bool cmp(pair<int,int> a,pair<int,int> b){
    if(a.first==b.first){
        if(a.second>b.second)
            return 1;
        return 0;
    }
    if(a.first<b.first)
        return 1;
    return 0;
}


pair<int,int> a[100100];
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        scanf("%d %d",&a[i].first,&a[i].second);
    }
    sort(a,a+m,cmp);
    int l=a[0].first,r=a[0].second;
    int c=1;
    for(int i=0;i<m;i++){
        //cout<<a[i].first<<' '<<a[i].second<<'\n';
        l=max(l,a[i].first);
        r=min(r,a[i].second);
        if(l>=r){
            l=a[i].first;
            r=a[i].second;
            c++;
        }
    }
    if(c>n-1)
        printf("%d",n-1);
    else
        printf("%d",c);
}



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

//各桁の和を計算する関数

int SumofDigits(int n) {
  int sum =0;
  while (n>0) { //nが０になるまで
    sum += n% 10;
    n /= 10;
  }
  return sum;
}


int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int total=0;
  for(int i=0; i<=N ; i++){
    int sum=SumofDigits(i);
    if(sum >= A && sum <= B){
      total += i;
    }
  }
  cout << total;
}


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

int main(){
	map<string, int> m;
	int num;
	char x;
	string blood;
	while(cin >> num >> x >> blood){
		m[blood]++;
	}

	cout << m["A"] << endl << m["B"] << endl << m["AB"] << endl << m["O"] << endl;
}

Measured memory_bytes: 1216
N,M = (int(x) for x in input().split())

max_l = 1
min_r = N+1
for i in range(M):
    Li, Ri = (int(x) for x in input().split())
    max_l = max(max_l, Li)
    min_r = min(min_r, Ri+1)

n = max(min_r - max_l, 0)

print(n)


Measured memory_bytes: 3060
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;

   cin>>n;


     ll ara[n+2];

     input(ara,n);

     if(is_sorted(ara,ara+n))cout<<"YES"<<endl;

     else
     {
         for(i=0; i<n; i++)
         {
             if(ara[i]!=i+1)
             {
                 for(j=i+1; j<n; j++)
                 {
                     if(ara[j]!=j+1)
                     {
                         swap(ara[i],ara[j]);
                         break;
                     }
                 }
                 break;
             }
         }

         if(is_sorted(ara,ara+n))cout<<"YES"<<endl;

         else cout<<"NO"<<endl;
     }












}



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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define pb push_back

const int N = 100000;
vector<int> G[N];
bool vis[N];
int par[N],dep[N];

int p,q;
void dfs(int x){
    vis[x] = true;
    for(int e:G[x])if(e!=par[x]){
        if(vis[e]){
            p=x;
            q=e;
        }
        else{
            dep[e] = dep[x]+1;
            par[e] = x;
            dfs(e);
        }
    }
}

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

    rep(i,n){
        int u,v;
        cin >>u >>v;
        --u;
        --v;
        G[u].pb(v);
        G[v].pb(u);
    }

    dep[0] = 0;
    par[0] = -1;
    dfs(0);
    // printf(" (%d %d)\n", p,q);

    vector<bool> cycle(n);
    cycle[p] = cycle[q] = true;

    while(p!=q){
        if(dep[p]>dep[q]){
            p = par[p];
            cycle[p] = true;
        }
        else{
            q = par[q];
            cycle[q] = true;
        }
    }

    int Q;
    cin >>Q;
    rep(i,Q){
        int a,b;
        cin >>a >>b;
        --a;
        --b;

        int ans = 1;
        if(cycle[a] && cycle[b]) ans = 2;
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 14192
#include <bits/stdc++.h>
#define ll long long


using namespace std;

const int MAXN = (int) 50;

ll v[MAXN + 1];



int main() {
    //fstream cin("A.in");
    //ofstream cout("A.out");
    int i, n, j;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i <= n; i++)
        cin >> v[i];
    bool flag = 1;
    ll ans = 0;
    while(flag) {
        //std::sort(v + 1, v + n + 1, greater<int>());
        if(*max_element(v + 1, v + n + 1) < n)
            flag = 0;
        else {
            for(i = 1; i <= n; i++) {
                for(j = 1; j <= n; j++)
                    if(i != j)
                       v[j] += v[i] / n;
                ans += v[i] / n;
                v[i] %= n;
            }
        }
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


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

import math

def main():
    N = int(input())
    S1 = input().strip()
    S2 = input().strip()

    ans = 1
    tate = False
    i = 0
    if S1[i] == S2[i]: # 縦スタート
        ans *= 3
        tate = True
        i += 1
    else: # 横スタート
        ans *= 6
        tate = False
        i += 2

    mod = 1000000007
    while i <= N-1:
        if tate:
            tate = S1[i] == S2[i]
            if tate: # 縦縦
                ans = ans * 2 % mod
                i += 1
            else: # 縦横
                ans = ans * 2 % mod
                i += 2
        else:
            tate = S1[i] == S2[i]
            if tate: # 横縦
                ans = ans * 1 % mod
                i += 1
            else: # 横横
                ans = ans * 3 % mod
                i += 2
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    int h, w, k; cin >> h >> w >> k;
    vector< vector<char> > S(h, vector<char>(w,0));
    vi h_cnt(h, 0), w_cnt(w, 0);
    int ans = 0, sum = 0;
    rep(i, h){
        rep(j, w){
            cin >> S[i][j];
        }
    }
    rep(i, h){
        rep(j, w){
            if (S[i][j] == '#') {
                h_cnt[i]++;
                w_cnt[j]++;
                sum++;
            }
        }
    }

    for (int bit_h=0; bit_h < (1<<h); bit_h++) {
        for (int bit_w=0; bit_w < (1<<w); bit_w++) {
            int cmp = sum;
            vi seen_h, seen_w;
            rep(i, h){
                if (bit_h & (1<<i)) {
                    cmp -= h_cnt[i];
                    seen_h.push_back(i);
                }
            }
            rep(j, w){
                if (bit_w & (1<<j)) {
                    cmp -= w_cnt[j];
                    seen_w.push_back(j);
                }
            }
            for (int i : seen_h) {
                for (int j : seen_w) {
                    if (S[i][j] == '#') cmp++;
                }
            }
            if (cmp == k) ans++;
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{

	int a;
	int b;
	int c;
	char op;
	
	while(true){
		
		cin >> a >> op >> b ;
	
		if(op == '+'){
			c=a+b;
		} else if(op == '-'){
			c=a-b;
		} else if(op == '*'){
			c=a*b;
		} else if(op == '/'){
			c=a/b;
		} else if(op == '?'){
			break;
		}
		cout << c <<endl;
	}
}

Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    REP (i, 0, N) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    cout << v.size() << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>
#include<chrono>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));


struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ll mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
}

ll const maxn = 3e6 + 6;
ll fact[maxn];

ll C(ll n, ll k) {
    return mul(fact[n], inv(mul(fact[n - k], fact[k])));
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("output.txt", "w", stdout);
    fact[0] = 1;
    for (ll i = 1; i < maxn; i++) fact[i] = mul(fact[i - 1], i);


    ll k;
    string s;
    cin >> k >> s;
    ll n = s.size() + k;
    ll ans = 0;
    for (ll i = 0; i <= n - s.size(); i++) {
        ll kek = poww(26, i);
        ll rofl = C(n - i - 1, s.size() - 1);
        rofl = mul(rofl, poww(25, n - i - s.size()));
        ans += mul(rofl, kek);
        ans %= mod;
    }

    cout << ans << endl;

    return 0;
}

/*

*/

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

int main() {
  int n; cin >> n;
  int answer = 0;
  
  for (int i = 2; i < 10; i++) {
    for (int j = 1; i < 1000; j++) {
      if (pow(j, i) > n) {
        answer = max(answer, (int)pow(j - 1, i));
        break;
      }
    }
  }
  
  cout << answer << endl;
}

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

int main() {
  int n,tmp;
  cin >> n;
  vector<pair<ll,ll>>a(n);
  rep(i,n) {
  	cin>> tmp;
  	a.at(i)=make_pair(tmp,i+1);
  }
  sort(a.begin(),a.end());
  rep(i,n) cout << a.at(i).second << endl; 
}


Measured memory_bytes: 2432
x,y = map(int,input().split())

def h(x):
    if x == 3:
        return 100000
    elif x == 2:
        return 200000
    elif x == 1:
        return 300000
    return 0

print(h(x)+h(y)+(400000 if x == y == 1 else 0))

Measured memory_bytes: 38384
program Ringo
	integer D, N
    read(*, *) D, N
    if (N.NE.100) then
    X = (100**D)*N
    print '(i0)', int(X)
    else if (N.EQ.100) then
    X = (100**D)*(N + 1)
	print '(i0)', int(X)
    end if
end program

Measured memory_bytes: 256
#include<stdio.h>
#include <memory.h>
int main(void){

  int n,m,l,i,j,k;
  
  scanf("%d%d%d",&n,&m,&l);
int A[n][m],B[m][l];
long long int C[n][l];


memset(C,0,sizeof(C));

  
  
  for(i=0;i<n;i++){
      for(j=0;j<m;j++){
         scanf("%d",&A[i][j]);
       }
   }
  for(i=0;i<m;i++){
	for(j=0;j<l;j++){
    scanf("%d",&B[i][j]);
	}
  }
  

  for(i=0;i<n;i++){
      for(j=0;j<l;j++) {
	  for(k=0;k<m;k++) {
	  C[i][j]+=A[i][k]*B[k][j];
	   }
   	  if(j==l-1) printf("%lld",C[i][j]);
		else printf("%lld ",C[i][j]);
	}
	printf("\n");
  }
  
  
  
 return 0;
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 266666;
int n,d[N],tot,dis[N],Fa[N],dep[N],q[N],dp[N],f[N],sz[N],val[N];Vi e[N];bool mrk[N],gg[N];
Vi dot[N];
void dfs1(int u, int fa, int Dep){
	sz[u]=mrk[u];dep[u]=Dep;dot[Dep].pb(u);Fa[u]=fa;
	rep(i,0,SZ(e[u])-1)if(e[u][i]!=fa)
		dfs1(e[u][i],u,Dep+1),sz[u]+=sz[e[u][i]];
}
void dfs2(int u, int fa){
	f[u]=val[u];
	rep(i,0,SZ(e[u])-1)if(e[u][i]!=fa)
		dfs2(e[u][i],u),umin(f[u],val[u]+f[e[u][i]]);
}
void dfs(int u, int fa){
	int mn=1e9,mn1=1e9;
	rep(i,0,SZ(e[u])-1)if(e[u][i]!=fa)
		if(f[e[u][i]]+val[u]<mn)mn1=mn,mn=f[e[u][i]]+val[u];
		else if(f[e[u][i]]+val[u]<mn1)mn1=f[e[u][i]]+val[u];
	rep(i,0,SZ(e[u])-1)if(e[u][i]!=fa)
		dp[e[u][i]]=val[e[u][i]]+min(dp[u],(mn==f[e[u][i]]+val[u]?mn1:mn));
	rep(i,0,SZ(e[u])-1)if(e[u][i]!=fa)dfs(e[u][i],u);
}
int main() {
	read(n);rep(i,1,n-1){
		int u,v;read(u);read(v);e[u].pb(v);e[v].pb(u);
	}
	static char S[N];scanf("%s",S+1);
	rep(i,1,n)if(S[i]=='W')d[i]^=1,mrk[i]=1,tot++;
	if(!tot){puts("0");return 0;}
	dfs1(1,0,0);rep(i,1,n)gg[i]=sz[i]==0||sz[i]==tot;
	bool find=0;
	per(i,n,0)rep(j,0,SZ(dot[i])-1)if(sz[dot[i][j]]==tot&&!find){
		find=1;gg[dot[i][j]]=0;
	}
	int res=1e9,rt=0;
	rep(i,1,n)if(Fa[i]&&!gg[i]&&!gg[Fa[i]])d[i]^=1,d[Fa[i]]^=1;
	per(i,n,1)if(!gg[i])val[i]=(d[i]?-1:1)-1,dp[i]=val[i],rt=i;
	dfs2(rt,0);dfs(rt,0);
//	cerr<<rt<<endl;
//	rep(i,1,n)if(!gg[i])printf("%d:%d %d %d %d\n",i,val[i],dp[i],f[i],d[i]);
	rep(i,1,n)if(!gg[i])umin(res,1-(d[i]?-1:1)+min(dp[i],f[i]));
	rep(i,1,n)if(!gg[i])res+=d[i],res+=2;res-=2;cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 35584
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

int main(){
    ll H,N;cin>>H>>N;
    vector<P> magics;
    vector<ll> dp(H+1,1000000000);
    for(int i = 0;i < N;i++){
        int a,b;cin>>a>>b;
        magics.push_back(P{a,b});
    }
    for(int i = 0;i < H+1;i++){
        if(i == 0){
            dp[i]=0;
            continue;
        }
        for(int j = 0;j < N;j++){
            ll p = magics[j].first;
            ll c = magics[j].second;
            
            dp[i] = min(dp[i], dp[max(0ll,i-p)]+c);
        }
    }
    cout<<dp[H]<<endl;
}

Measured memory_bytes: 384
local mod = 1000000007
local function bmul(x, y) return (x * y) % mod end
local n = io.read("*n", "*l")
local s1 = io.read()
local s2 = io.read()
local cur = 1
local ret = 1
local prv = true
while cur <= n do
  if s1:sub(cur, cur) == s2:sub(cur, cur) then
    if cur == 1 then
      ret = 3
    elseif prv then
      ret = bmul(ret, 2)
    end
    cur = cur + 1
    prv = true
  else
    if cur == 1 then
      ret = 6
    elseif prv then
      ret = bmul(ret, 2)
    else
      ret = bmul(ret, 3)
    end
    cur = cur + 2
    prv = false
  end
end
print(ret)


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

main(){
  int H, W;
  char c;
  cin >> W >> H >> c;

  assert(3 <= W && W <= 21);
  assert(3 <= H && H <= 21);
  assert( W%2 && H%2 && 'A' <= c && c <= 'Z' );

  for ( int i = 0; i < H; i++ ){
    for ( int j = 0; j < W; j++ ){
      if ( i == 0 && j == 0 ||
           i == 0 && j == W-1 ||
           i == H-1 && j == 0 ||
           i == H-1 && j == W-1 ){
        cout << '+';
      } else if ( i == 0 || i == H-1 ){
        cout << '-';
      } else if ( j == 0 || j == W-1 ){
        cout << '|';
      } else if ( i == H/2 && j == W/2 ){
        cout << c;
      } else {
        cout << '.';
      }
    }
    cout << endl;
  }
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
namespace ZDY{
#define fir freopen("2.in","r",stdin)
#define ll long long
#define Fur(i,x,y) for(int i=x;i<=y;i++)
#define fur(i,x,y) for(i=x;i<=y;i++)
#define Fdr(i,x,y) for(int i=x;i>=y;i--)
#define in2(x,y) in(x),in(y)
#define in3(x,y,z) in2(x,y),in(z)
#define in4(a,b,c,d) in2(a,b);in2(c,d)
#define clr(x,y) memset(x,y,sizeof(x))
#define cpy(x,y) memcpy(x,y,sizeof(x))
#define fl(i,x) for(ll i=head[x],to;to=e[i].to,i;i=e[i].next)
#define inf 2147483647
}
namespace FAST{
#define pob (fwrite(fob::b,sizeof(char),fob::f-fob::b,stdout),fob::f=fob::b,0)
#define pc(x) (*(fob::f++)=(x),(fob::f==fob::g)?pob:0)
#define gc ((*fib::f)?(*(fib ::f++)):(fgets(fib::b,sizeof(fib::b),stdin)?(fib::f=fib::b,*(fib::f++)):-1))
namespace fib{char b[300000]= {},*f=b;}
inline void in(ll &x){x=0;char c;bool f=0;while((c=gc)>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=gc)<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;}
inline void in(int &x){x=0;char c;bool f=0;while((c=gc)>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=gc)<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;}
namespace fob{char b[300000]= {},*f=b,*g=b+300000-2;}struct foce{~foce(){pob;fflush(stdout);}} _foce;namespace ib{char b[100];}
inline void out(ll x){if(x==0){pc(48);return;}if(x<0){pc('-');x=-x;}char *s=ib::b;while(x) *(++s)=x%10,x/=10;while(s!=ib::b) pc((*(s--))+48);}inline void outn(ll x){out(x);pc('\n');}
inline void out(int x){if(x==0){pc(48);return;}if(x<0){pc('-');x=-x;}char *s=ib::b;while(x) *(++s)=x%10,x/=10;while(s!=ib::b) pc((*(s--))+48);}inline void outn(int x){out(x);pc('\n');}
inline char sc(){char c=gc;while(!(('A'<=c&&c<='Z')||('a'<=c&&c<='z')||('0'<=c<='9')))c=gc;return c;}
inline ll jdz(ll x){return x>0?x:-x;}
inline ll max(ll x,ll y){return x>y?x:y;}
}using namespace FAST;using namespace ZDY;using namespace std;
#define N 100001
int n,a[4],ans=0;
int main(){
	Fur(i,1,3)in(a[i]);
	sort(a+1,a+3+1);
	Fur(i,2,3)ans+=a[i]-a[i-1];
	outn(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<bl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.b()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<bl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
ll fast_exp(ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       exp/=2;
    }
    return res%MOD;
}
ll fib(ll n)
{
    if(n < 2)
        return n;
    ll a = 0,b = 1,ans;
    int i = 1;
    while(i < n)
    {
        ans = (a+b) % MOD;
        a = b;
        b = ans;
        i++;
    }
    return ans;
} 
int main()
  {
      fastio();
      ll x;
      cin>>x;
      for(int i=-200;i<=200;i++)
      {
          for(int j=-200;j<=200;j++)
          {
              if(pow(i,5)-pow(j,5)==x)
              {
                  cout<<i<<" "<<j<<"\n";
                  return 0;
              }
          }
      }

      
  }


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

int main() {
  
  
  
  vector<long> vec(4);
  for (int i = 0; i < 4; i++){
    int x; 
    cin >> x;
    vec.at(i) = x;
  }
  
  long total = vec.at(0) * vec.at(2);
  
  if(vec.at(0) * vec.at(3) > total){
    total = vec.at(0) * vec.at(3);
  }
  
  if(vec.at(1) * vec.at(2) > total){
    total = vec.at(1) * vec.at(2);
  }
  
  if(vec.at(1) * vec.at(3) > total){
   total = vec.at(1) * vec.at(3);
  }
  
  
  cout << total << endl;
 

}



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

using namespace std;
typedef long long ll;

int main(){
    
    ios_base::sync_with_stdio(0);
    int a,b;
    cin>>a>>b;
    cout<<a/b<<" "<<a%b<<" "<<fixed<<setprecision(5)<<(double)a/b<<endl;

    return 0;
}




Measured memory_bytes: 3276
import sys
input = sys.stdin.readline
 
def warshal_floyd(d, n):
  for k in range(n):
    for i in range(n):
      for j in range(n):
        d[i][j] = min(d[i][j], d[i][k]+d[k][j])
        
  return d
 
h, w = map(int, input().split())
m = [str(input()) for _ in range(h)]
d = [[float('inf') for i in range(h*w)] for j in range(h*w)]
for i in range(h*w):
  d[i][i] = 0
  
for i in range(h*w):
  for j in range(h*w):
    py, px = i//w, i%w
    qy, qx = j//w, j%w
    if (px == qx and abs(py-qy) == 1) or (py == qy and abs(px-qx) == 1):
      pm = m[py][px]
      qm = m[qy][qx]
      if qm == '.' and pm == '.':
        d[i][j] = 1
        
#print(d)
d = warshal_floyd(d, h*w)
#print(d)
 
ans = 0
for i in range(h*w):
  for j in range(h*w):
    if d[i][j] != float('inf'):
      ans = max(ans, d[i][j])
print(ans)

Measured memory_bytes: 137224
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

  class Main{
    public static void main(String[] args){
    try{
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String str = reader.readLine();
        String[] arr  = str.split(" ");
        int a = Integer.parseInt(arr[0]);
        int b = Integer.parseInt(arr[1]);
        int c = Integer.parseInt(arr[2]);
        int temp = 0;
        if(a>b){
           temp= a ;
            a=b;
           b= temp;
         }if(b>c){
          
           temp = b;
           b=c;
           c=temp;
        }if(a>b){
            temp= a ;
            a=b;
           b= temp;
            }
        System.out.println(a+" "+b+" "+c);
    }catch(IOException e){
     e.printStackTrace();
    }
}
}

Measured memory_bytes: 24344
X,K,D = map(int,input().split())

X = abs(X)

# Dだけ原点に向かって移動したとき，最も原点に近い座標
r = X%D
# rまでに要した移動回数
q = X//D

# rに到達後は残りの移動回数が偶数か奇数かで場合分け
# K回を超えている場合
if K <= q:
    print(X-D*K)
else:
    # 残り移動可能回数
    rem = K - q

    # 残り移動可能回数が偶数なら，その場所にとどまることできる
    if rem%2 == 0:
        print(r)
    # 奇数なら，絶対に負の側でゴールすることになる．よってr-Dの絶対値であるD-rが解
    else:
        print(D-r)

        

Measured memory_bytes: 9088
N, M = map(int, input().split())
P = [-1 for i in range(N)]
def par(a):
    L = []
    while P[a] >= 0:
        L.append(a)
        a = P[a]
    for l in L:
        P[l] = a
    return a
def unite(a, b):
    if par(a) != par(b):
        if P[par(b)] >= P[par(a)]:
            if P[par(b)] == P[par(a)]: P[par(a)] -= 1
            P[par(b)] = par(a)
        else:
            P[par(a)] = par(b)

ans = N - 1
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    if par(a) == par(b): continue
    unite(a, b)
    ans -= 1
print(ans)


Measured memory_bytes: 74952
K, N = STDIN.gets.split(' ').map(&:to_i)
A = STDIN.gets.split(' ').map(&:to_i).map.with_index(1) {|a, i| [i, a] }.to_h

max = A[1] + (K - A[N])

A.values.each_cons(2) do |(a1, a2)|
  dif = a2 - a1
  max = dif if max < dif
end

print K - max


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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;

typedef long long int ll;

void solve(){
	string str;
	cin >> str;
	if(str == "AAA" || str == "BBB"){
		cout << "No" << endl;
	}
	else cout << "Yes" << endl;
}

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

	int T;
	//cin >> T;
	T= 1;
	while(T--){
		solve();
	}
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

void solve(const int& N){
    vl A(N);
    FOR(i,0,N)cin >> A[i];
    ll avg = 0;
    FOR(i,0,N)avg += A[i];
    ll ans = 0;
    FOR(i,0,N){
        if(N * A[i] <= avg)ans++;
    }
    cout << ans << endl;
}

signed main(){
    int n;
    while(cin >> n){
        if(n == 0)break;
        solve(n);
    }
}


Measured memory_bytes: 3260
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

use std::cmp::min;

fn main() {
    input!{
        a: usize,
        b: usize,
        c: usize
    }
    println!("{}", min(a+b+1,c) + b);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const long long MOD = 1000000007;

int main(){
  vector<int> v(3);
  cin>>v[0]>>v[1]>>v[2];
  sort(v.begin(), v.end());
  int x = v[2]-v[1];
  v[0] += x;
  if((v[2]-v[0])%2==0)
    std::cout << x+(v[2]-v[0])/2 << std::endl;
  else
    std::cout << 1+x+(v[2]-v[0]+1)/2 << std::endl;
  
  return 0;
}



Measured memory_bytes: 256