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

int main() {
    /* 入力処理 */
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i =0;i<N;i++) {
        cin >> a.at(i);
    }

    /* 変数宣言 */
    int count = 0; //ボタンを押した回数のカウンター
    int j = 0; //最初のボタン1(すなわち、j=0)

    /* ボタンを押していく */
    for(int i=0;i<N;i++) {
        count++; // ボタンを押した回数のカウンター

        if(a.at(j) == 2) { //もしボタンjを押してボタン2に行ったら
            cout << count << endl; //ボタンを押した回数を出力して、プログラムの終了
            exit(0); //プログラムの強制終了
        }

        j = a.at(j) - 1; //次のボタンの番号（配列は0スタートのため、-1する）
    }
    
    cout << -1 << endl; //for文でN個のボタンに対して計算しても、ボタン2に至らなかった場合、-1を出力
}

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

namespace kozaiyApp
{
    public class KagamiMochi
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            int[] d = new int[N];
            int[] Mochi = Enumerable.Repeat<int>(1000, N).ToArray();

            for (int i = 0; i < N; i++)
            {
                d[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(d);

            for (int i = 0; i < N; i++)
            {
                if (0 > Array.BinarySearch(Mochi, d[i]))
                {
                    int index = Array.IndexOf(Mochi, 1000);
                    Mochi[index] = d[i];
                }
            }

            if (0 > Array.IndexOf(Mochi, 1000))
            {
                Console.WriteLine(d.Length);
                return;
            }
            Console.WriteLine(Array.IndexOf(Mochi, 1000));
        }
    }
}


Measured memory_bytes: 13152
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

string categ = "VMF";

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;

    int l = 0, r = N - 1;
    string s;
    int lt, rt;
    cout << l << endl;
    cin >> s;
    rep(i, 3) {
        if (s[0] == categ[i]) {
            lt = i;
        }
    }
    if (lt == 0) {
        return 0;
    }

    cout << r << endl;
    cin >> s;
    rep(i, 3) {
        if (s[0] == categ[i]) {
            rt = i;
        }
    }
    if (rt == 0) {
        return 0;
    }

    // 一つ目の添え字がその区間が偶数(0)か奇数(1)か、二つ目の添え字が異性(0)か同性(1)か
    vector<vector<int>> has_vac = {
        {1, 0},
        {0, 1}
    };

    rep(i, 18) {
        int c = (l + r) / 2;
        int ct;
        cout << c << endl;
        cin >> s;
        rep(j, 3) {
            if (s[0] == categ[j]) {
                ct = j;
            }
        }
        if (ct == 0) {
            return 0;
        }

        int is_odd = (c - l) % 2;
        int is_same = 0;
        if (lt == ct) {
            is_same = 1;
        }

        if (has_vac[is_odd][is_same]) {
            r = c;
            rt = ct;
        } else {
            l = c;
            lt = ct;
        }
    }
    return 0;
}

/*
3	
0
Male	
1
Female	
2
Vacant	
*/

Measured memory_bytes: 852
h, w = gets.split(' ').map(&:to_i)
letter_count = {}
four_count = 0
h.times do
  a = gets.chomp.split(//)
  a.each do |aa|
    if letter_count.key?(aa)
      if letter_count[aa] == 3
        four_count += 1
        letter_count[aa] = 0
      else
        letter_count[aa] += 1
      end
    else
      letter_count[aa] = 1
    end
  end
end

h, w = w, h if h % 2 == 1

if h % 2 == 0 && w % 2 == 0
  if four_count * 4 == h * w
    puts 'Yes'
  else
    puts 'No'
  end 
elsif h % 2 == 0 && w % 2 == 1
  if four_count * 4 >= h * (w - 1) && letter_count.values.all? { |v| v % 2 == 0 }
    puts 'Yes'
  else
    puts 'No'
  end
else
  if four_count * 4 >= (h - 1) * (w - 1) && letter_count.values.count { |v| v % 2 == 1} == 1
    puts 'Yes'
  else
    puts 'No'
  end
end

Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  cout << N/3 << endl;
  
  return 0;
}


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

//#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;

#ifndef LOCAL
#define int long long
#endif

mt19937 rnd(time(0));
#define ioss ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("dead", "r", stdin); freopen("tmp.out", "w", stdout);
#define s second
#define f first
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pii pair<int,int>
#define res resize
#define PI acos(-1)

template<class T>
ll upmax(T &a, T b) { return (b > a) ? a = b, 1 : 0; }

template<class T>
ll upmin(T &a, T b) { return (b < a) ? a = b, 1 : 0; }

const ll INF = 1e9;//9223372036854775807L; //LONG_MAX;
constexpr ll mod = 1e9 + 7, dopmod = 6914882281337;


void solve() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (auto &i : a)cin >> i;
    for (auto &i : b)cin >> i;
    for (int i = 0; i < n; i++)c[i] = i + 1;
    int A = 0, B = 0, id = 1;
    do {
        if (a == c)A = id;
        if (b == c)B = id;
        id++;

    } while (next_permutation(c.begin(), c.end()));
    cout << abs(A - B) << '\n';
}

signed main() {
    int t = 1;                                                                                                                                                                        //ll
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner  sc = new Scanner(System.in);
		double total = 0;
		double products = sc.nextInt();
		double popular = sc.nextInt();
		boolean pass = true;
		ArrayList<Integer> votenum = new ArrayList<Integer>();

		for(int i = 0; i < products; i++) {
			int vote = sc.nextInt();
			votenum.add(i, vote);
			total += vote;
		}

		sc.close();
		Collections.sort(votenum, Collections.reverseOrder());
		double comparison = total / (4 * popular);

		for(int i = 0; i < popular;  i++) {
			 if(votenum.get(i)  < comparison) {
				 pass = false;
				 break;
			 }
		}
		if(pass == true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

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

int main(){
  int a,b,k,cnt=0;
  cin >> a >> b >> k;
  
  for( int i=min(a,b); i>0; i-- ){
    if( a%i==0 && b%i==0 ){
      cnt++;
      if( cnt == k ){
		cout << i << endl;
       	return 0; 
      }
    }
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

#define FOR(a, b) for (int i = a; i < b; ++i)
#define FOR_EACH(container) for (const auto& p: container)
#define SORT(container) sort(container.begin(), container.end())
#define DSORT(container) sort(container.begin(), container.end(), greater<>())

using namespace std;
using pii = pair<int, int>;

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

    int A, B, T;

    cin >> A >> B >> T;

    int biscuits = 0;
    int i;
    for (i = A; i - T < 0.5; i += A)
    {
        biscuits += B;
    }

    cout << biscuits << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(){
 
  int	K;
  int	len;
  char	S[128] = {0};
  
  scanf("%d", &K);
  scanf("%s", S);

  len = strlen(S);
  
  if( len <= K ){
    printf("%s", S);

  }else{
    S[K] = '.';
    S[K+1] = '.';
    S[K+2] = '.';
    S[K+3] = '\0';
    
    printf("%s", S); 
  }
  
  
  return 0;
  
}

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e20;
const int INF = 1e9;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<bool> flag(n+1, false);
  REP(i, m){
    int b;
    cin >> b;
    flag[b] = true;
  }
  VL dp(n+1);
  int it = 0;
  int st = 2;
  dp[0] = 1;
  if(flag[1] == 1) {
    dp[2] = 1;
    st = 3;
  }
  else dp[1] = 1;
  bool no = false;
  FOR(i, st, n+1){
    if(flag[i]) continue;
    else if(flag[i-1] && flag[i-2]) {
      no = true;
      break;
    }
    else if(flag[i-1]) dp[i] = dp[i-2];
    else if(flag[i-2]) dp[i] = dp[i-1];
    else dp[i] = dp[i-1] + dp[i-2];
    dp[i] = dp[i] % MOD;
  }
  if(no) dp[n] = 0;
  out(dp[n] % MOD);
  return 0;
}


Measured memory_bytes: 1024
n = int(input())
a = [int(x) for x in input().split()]

def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p
  
ans = max(a)
for i in range(n):
    ans = gcd(ans, a[i])
print(ans)

Measured memory_bytes: 14224
// http://yumai6.hatenablog.com/entry/2015/12/21/222930

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

//---------------------------------------------------------------
// 整数 N が与えられます。
// 1 以上 N 以下の整数のうち、七五三数 は何個あるでしょうか？
//
// ここで、七五三数とは以下の条件を満たす正の整数です。
//
// 十進法で表記したとき、数字 7, 5, 3 がそれぞれ 
// 1 回以上現れ、これら以外の数字は現れない。
//---------------------------------------------------------------

string N;

int dp[10][2][2][2][2];		// rec の引数と対応する

// メモ化再帰用の関数"
// k : 処理中の桁数  tight : 制限あり  seven, five, three : 既にあったかどうか
int rec(int k = 0, bool tight = true, bool seven = false, bool five = false, bool three = false) {
//		cout << "start  k=" << k << " tight=" << tight << " 7=" << seven << " 5=" << five << " 3=" << three << endl;

	// 最後の桁
	if(k == N.size()) {
//		cout << "return  k=" << k << " tight=" << tight << " 7=" << seven << " 5=" << five << " 3=" << three << endl;
		return	(seven && five && three);
	}
	
	// 今見ている桁の数
	int x = N[k] - '0';

	// tight が true なら x までしか遷移しないようにする
	int r = (tight ? x : 9);
	
	int &res = dp[k][tight][seven][five][three];
	if(~res)	return res;
	res = 0;
	
	// r "まで" 遷移することに注意！未満ではありません
	REP(i, r + 1) {
		if(i == 7 ) {
			res += rec(k + 1, tight && (i == r), true, five, three);
		} else if(i == 5) {
			res += rec(k + 1, tight && (i == r), seven, true, three);
		} else if(i == 3) {
			res += rec(k + 1, tight && (i == r), seven, five, true);
		} else if(i == 0 && !seven && !five && !three ) {
			res += rec(k + 1, tight && (i == r), seven, five, three);
		}
	}
	return res;
}

signed main(){
	cin >> N;

	memset(dp, -1, sizeof(dp));
	cout << rec() << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,n) for(lli i=0;i<n;i++)
#define repb(i,n) for(lli i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
#define all(X) X.begin(),X.end()
#define iterate(X) for(it=X.begin();it!=X.end();it++)
lli combi(lli n,lli k)
{
    lli ans=1;
    k=k>n-k?n-k:k;
    lli j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
lli findlcm(vector <lli> arr, lli n)
{
    lli ans = arr[0];
    for (lli i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli a,b,k;
    cin>>k>>a>>b;
    lli check=0;
    for(lli i=a;i<=b;i++){
    	if(i%k==0){
    		check=1;
    		break;
		}
	}
	if(check==0)
	cout<<"NG";
	else
	cout<<"OK";
    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
  int n;
  cin>>n;
  map<int,int> m;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    m[a]++;
  }
  ll n1=0,n2=0;
  for(auto i:m){
    if(i.second>=4){
      n1=i.first,n2=i.first;
    }else if(i.second>=2){
      swap(n1,n2);
      n1=i.first;
    }
  }
  cout<<n1*n2<<endl;
  return 0;
}

Measured memory_bytes: 8288
using namespace std;
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
#define pb push_back
#define mp make_pair
#define ft first
#define sc second
#define bs binary_search
#define INF 1000000000
#define rc(s) return cout << s,0
const int mod = 1e9 + 7;

int main()
{
	/**///------------------------///**/
	/**/ios::sync_with_stdio(false);/**/
	/**///------------------------///**/
	int n;
	cin >> n;
	int a;
	vi nums;
	for(int i = 0; i < n; i++)
	{
		cin >> a;
		nums.pb(a);
	}
	int ans1=0;
	int cnt1[100005]={0};
	int cnt2[100005]={0};
	for(int i = 0; i < n; i++)
	{
		if(i%2)
		{
			cnt1[nums[i]]++;
		}
		else
		{
			cnt2[nums[i]]++;
		}
	}
	int mx1=0,mx2=0,m1=0,m2=0;
	for(int i = 0; i < 100005; i++)
	{
		if(mx1<cnt1[i])mx1=max(mx1,cnt1[i]),m1=i;
		if(mx2<cnt2[i])mx2=max(mx2,cnt2[i]),m2=i;
	}
	sort(cnt1,cnt1+100005);
	sort(cnt2,cnt2+100005);
	reverse(cnt1,cnt1+100005);
	reverse(cnt2,cnt2+100005);
	if(m1!=m2)
	{
		ans1 = n - cnt1[0] - cnt2[0];
	}
	else
	{
		ans1 = n - cnt1[0] - max(cnt1[1],cnt2[1]);
	}
	rc(ans1);
	//THIS IS THE END
}

Measured memory_bytes: 1528
#include <iostream>
#include <cmath>
#include <vector>
#include <cstring>
#include <set>
using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define ms(arr, val) memset(arr, val, sizeof(arr))
#define incl(i, a, b) for(int i = a; i < b; i++)
#define decl(i, a, b) for(int i = a; i > b; i--)

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

    int n, temp; cin >> n;
    multiset<int> wtf;
    vector<int> v;

    incl(i, 0, n)
    {
        cin >> temp;
        wtf.insert(temp);
        v.pb(temp);
    }

    incl(i, 0, n)
    {
        wtf.erase(wtf.find(v[i]));
        cout << *(--wtf.end()) << endl;
        wtf.insert(v[i]);
    }

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  const int mod = 1000000007;
  long power = 1;
  
  for (int i = 0 ; i < N ; i++ ){
    power = power * (i+1) % mod;
  }
  
  cout << power;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int H = scan.nextInt();
        int W = scan.nextInt();
        boolean dot;
        int h =0;
        int w = 0;
        while(H !=0 && W != 0){
            while(h < H){
                if(h == 0 || h % 2 == 0){
                    dot = false;
                }
                else{
                    dot = true;
                }
                while(w < W){
                    if(dot){
                        System.out.print(".");
                        dot = false;
                    }
                    else{
                        System.out.print("#");
                        dot = true;
                    }
                    if(w == W-1){
                        System.out.println();
                    }
                    w++;
                }
                w=0;
                h++;
            }
            w = 0;
            h = 0;
            H = scan.nextInt();
            W = scan.nextInt();
            System.out.println();
        }
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  int q;
  cin >> q;
  vector<ll> b(q);
  vector<ll> c(q);
  rep(i, q) cin >> b[i] >> c[i];

  ll sum = 0;
  map<ll, int> m;
  for(auto v : a) {
    m[v]++;
    sum += v;
  }

  rep(i, q) {
    ll bi = b[i];
    ll ci = c[i];
    ll bi_cnt = m[bi];
    m[bi] = 0;
    m[ci] += bi_cnt;

    sum = sum - bi * bi_cnt + ci * bi_cnt;
    cout << sum << endl;
  }
  return 0;
}


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

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

    bool approved = true;
    int A_i;
    for (int i = 0; i < N; i++)
    {
        cin >> A_i;
        if (A_i % 2 == 0 && A_i % 3 != 0 && A_i % 5 != 0)
        {
            approved = false;
            break;
        }
    }
    if (approved)
        cout << "APPROVED" << endl;
    else
        cout << "DENIED" << endl;
}

Measured memory_bytes: 256
fun main(args:Array<String>) {
    val ans = if(getAns(readLine()!!)) "YES" else "NO"
    println(ans)
}

fun getAns(txt:String):Boolean {
    if(txt.length <= 1) {
        return true
    }
    val distinct = txt.toSet()
    if(txt.length <= 2) {
        if(distinct.size == 2) {
            return true
        }
    }
    if(distinct.size <= 2) {
        return false
    }
    val cnt = distinct.map { a->txt.count { it == a } }.sorted()
    if(cnt[2] - cnt[0] <= 1) {
        return true
    }
    return false
}

Measured memory_bytes: 41404
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    llong A, V;
    llong B, W;
    llong T;
    cin >> A >> V;
    cin >> B >> W;
    cin >> T;

    if (B >= A) {
        llong dir = 1;
        llong PosB = B + dir * W * T;
        llong PosA = A + dir * V * T;
        if (PosA >= PosB)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    else {
        llong dir = -1;
        llong PosB = B + dir * W * T;
        llong PosA = A + dir * V * T;
        if (PosA <= PosB)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}


Measured memory_bytes: 3636
N, K = [int(s) for s in raw_input().split()]
ws = [int(raw_input()) for _ in xrange(N)]
lo, hi = max(ws) - 1, sum(ws)

while hi - lo > 1:
    p = P = (lo + hi) / 2
    k = 1
    for w in ws:
        if w > p:
            p = P
            k += 1
        p -= w
    if k <= K:
        hi = P
    else:
        lo = P

print hi

Measured memory_bytes: 9356
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
from collections import deque
Sa = input().rstrip()
Sb = input().rstrip()
Sc = input().rstrip()

S = {"a":deque(Sa), "b":deque(Sb), "c":deque(Sc)}

char = "a"
while len(S[char]) > 0:
    char = S[char].popleft()

print(char.upper())

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

typedef pair<ll, ll> p;

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

    int N, K;
    cin >> N >> K;

    vector<p> xy(N);

    for(int i = 0; i < N; i++) {
        ll x, y;
        cin >> x >> y;
        xy[i] = make_pair(x, y);
    }

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

    ll ans = 4000000000000000005;

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            ll y1 = xy[i].second;
            ll x1 = xy[j].first;
            for(int k = 0; k < N; k++) {
                ll y2 = xy[k].second;
                if(y1 > y2) continue;
                ll x2;
                int c = 0;
                for(int l = j; l < N; l++) {
                    if(y1 <= xy[l].second && xy[l].second <= y2) {
                        c++;
                        if(c == K) {
                            x2 = xy[l].first;
                            break;
                        }
                    }
                }
                if(c < K) continue;
                ans = min(ans, (x2 - x1) * (y2 - y1));
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a,b,c;
signed main()
{
	cin>>a>>b>>c;
	c=c-a-b;
	if(c<0||c*c<=4*a*b)
	printf("No");
	else
	printf("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

signed main()
{
    ll n, ans = 0, ne = 0;
    cin >> n;

    vector<ll> dif(n);

    rep(i, n)
    {
        cin >> dif[i];
    }

    rep(i, n)
    {
        ll x;
        cin >> x;
        dif[i] -= x;
    }

    sort(all(dif));

    rep(i, n)
    {
        if (dif[i] < 0)
        {
            ans++;
            ne += -dif[i];
        }
    }

    if (ne <= 0)
    {
        cout << ans << endl;
        return 0;
    }

    reverse(all(dif));
    rep(i, n)
    {
        if (dif[i] > 0)
        {
            ne -= dif[i];
            ans++;
            if (ne <= 0)
            {
                cout << ans << endl;
                return 0;
            }
        }
    }

    cout << -1 << endl;
}

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

#define rep(i,a,b) for(ll i=(a);i<=(b);i++)
#define END(x) do{cout<<(x)<<endl;exit(0);}while(0)
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define exp2(x)  (1LL<<(x))

using namespace std;
using ll=long long;


int main() {
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
  string s; cin >> s;
  if (s[0]==s[1] or s[1]==s[2] or s[2]==s[3]) END("Bad"); else END("Good"); 
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
using ll=long long;
using namespace std;
//const int INF = 7+(1e+9);
ll GCD(ll x, ll y)
{
    if (y == 0)
    {
        return x;
    }
    else
    {
        return GCD(y, x % y);
    }
}
ll LCM(ll x, ll y)
{
    return x / GCD(x, y) * y;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main(){
  // ...
  
  
  int v,e;
  cin>>v>>e;
  vector<vector<int>> vec(e,vector<int>(3));
  for(int i=0;i<e;i++){
      int s,t,w;
      cin>>s>>t>>w;
    //  s--;t--;
      vec[i][0]=w;
      vec[i][1]=s;
      vec[i][2]=t;
     // cout<<w<<endl;
  }
  sort(vec.begin(),vec.end());
  int sum=0;
  UnionFind tree(v);
  for(int i=0;i<e;i++){
      int x=vec[i][1];
      int y=vec[i][2];
      //cout<<x<<endl;
      if(!tree.same(x,y)){
        //  cout<<x<<endl;
          tree.unite(x,y);
          sum+=vec[i][0];
        //  cout<<vec[i][0]<<endl;
      }
      
  }
     // int sum=0;
  cout<<sum<<endl;
}


Measured memory_bytes: 8376
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  if (a < b) {
    rep(i, b) cout << a;
  } else if (b < a) {
    rep(i, a) cout << b;
  } else {
    rep(i, min(a, b)) cout << a;
  }

  cout << endl;

  return 0;
}


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

char s[14];

int main() {
	scanf("%s", s);
	for (int i = 12; i >= 5; --i)s[i] = s[i - 1];
	s[4] = 0;
	printf("%s %s\n", s, s + 5);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	int a, b, c, d; cin >> a >> b >> c >> d;
	int ab = abs(a - b);
	int bc = abs(b - c);
	int ac = abs(a - c);
	cout << (((ab <= d && bc <= d) || ac <= d) ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
visited = {0: -1}
height = 0
pools = []
for i, c in enumerate(input()):
    if c == '\\':
        height -= 1
    elif c == '/':
        height += 1
        if height in visited:
            width = i - visited[height]
            sm = 0
            while pools and pools[-1][0] > visited[height]:
                x, l = pools.pop()
                sm += l
            pools.append((i, sm + width - 1))
    visited[height] = i

print(sum(l for x, l in pools))
if pools:
    print(len(pools), ' '.join(str(l) for x, l in pools))
else:
    print(0)

Measured memory_bytes: 8824
N,X,Y = list(map(int,input().split()))
X,Y = X-1,Y-1
ans = [0]*N

for i in range(N):
    for j in range(i+1,N):
            a = min(j-i,abs(X-i)+abs(Y-j)+1,abs(X-j)+abs(Y-i)+1)
            ans[a]+=1
            #print(i,j,a)

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


Measured memory_bytes: 47580
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int N, H, W; cin >> N >> H >> W;
  vector<int> A(N), B(N); REP(i, N) cin >> A[i] >> B[i];

  int ans = 0;
  for (int i = 0; i < N; ++i) {
    if (A[i] >= H and B[i] >= W) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

// 最大流O(V^2E)
struct Dinic {
private:
    struct edge {
        int to;
        ll cap;
        int rev;
        bool isrev;
        int idx;
    };

    vector< vector< edge > > graph;
    vector< int > min_cost, iter;


    bool bfs(int s, int t) {
        min_cost.assign(graph.size(), -1);
        queue< int > que;
        min_cost[s] = 0;
        que.push(s);
        while (!que.empty() && min_cost[t] == -1) {
            int p = que.front();
            que.pop();
            for (auto &e : graph[p]) {
                if (e.cap > 0 && min_cost[e.to] == -1) {
                    min_cost[e.to] = min_cost[p] + 1;
                    que.push(e.to);
                }
            }
        }
        return min_cost[t] != -1;
    }

    ll dfs(int idx, const int t, ll flow) {
        if (idx == t) return flow;
        for (int &i = iter[idx]; i < graph[idx].size(); i++) {
            edge &e = graph[idx][i];
            if (e.cap > 0 && min_cost[idx] < min_cost[e.to]) {
                ll d = dfs(e.to, t, min(flow, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    graph[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
public:

    Dinic(int V) : graph(V) {}

    // from から to への容量capの有向辺
    void add_edge(int from, int to, ll cap, int idx = -1) {
        graph[from].push_back({to, cap, (int)graph[to].size(), false, idx});
        graph[to].push_back({from, 0, (int)graph[from].size() - 1, true, idx});
    }


    // from s to t
    ll max_flow(int s, int t) {
        ll flow = 0;
        while (bfs(s, t)) {
            iter.assign(graph.size(), 0);
            ll f = 0;
            while ((f = dfs(s, t, 1e9 + 6)) > 0) flow += f;
        }
        return flow;
    }

    void output() {
        for (int i = 0; i < graph.size(); i++) {
            for (auto &e : graph[i]) {
                if (e.isrev) continue;
                auto &rev_e = graph[e.to][e.rev];
                cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/" << e.cap + rev_e.cap << ")" << endl;
            }
        }
    }
};

int main() {
    int x, y, e; cin >> x >> y >> e;
    Dinic G(x + y + 2);
    for (int i = 0; i < e; i++) {
        int a, b; cin >> a >> b;
        G.add_edge(a, x + b, 1);
    }
    for (int i = 0; i < x; i++) {
        G.add_edge(x + y, i, 1);
    }
    for (int i = 0; i < y; i++) {
        G.add_edge(x + i, x + y + 1, 1);
    }
    cout << G.max_flow(x + y, x + y + 1) << endl;
    return 0;
}


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

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

	bool ac = true;
	int countC = 0;
	for (size_t i = 0; i < s.size(); ++i)
	{
		if (i == 0) {
			if (s[i] != 'A') {
				ac = false;
				break;
			}
			continue;
		}

		if (2 <= i && i <= s.size() - 2) {
			if (s[i] == 'C') {
				++countC;
				continue;
			}
		}

		if ('A' <= s[i] && s[i] <= 'Z') {
			ac = false;
			break;
		}
	}

	if (countC != 1) {
		ac = false;
	}

	if (ac) {
		cout << "AC" << endl;
	}
	else {
		cout << "WA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
int n,m,c;
int a[30][30];
int b[30];
int count;
int count2;
int kotae=0;
int sum;
scanf("%d %d %d",&n,&m,&c);

for(count=1;count!=m+1;count++){
    scanf("%d",&b[count]);
    
}


for(count2=1;count2!=n+1;count2++){
    for(count=1;count!=m+1;count++){
        scanf("%d",&a[count2][count]);
        }
}

count=1;
count2=1;
sum=0;

for(;;){
    
for(;;){
    sum=sum+b[count]*a[count2][count];
    count++;
    if(count==m+1){break;}

}

sum=sum+c;
if(sum>0){kotae++;}

sum=0;
count=1;
count2++;
if(count2==n+1){break;}

}

printf("%d",kotae);

return 0;
}

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

int main() {
  int w, d;
  while (cin >> w >> d, w) {
    map<int, int> mp;
    int ans = 0;
    for (int i = 0; i < w; i++) {
      int h;
      cin >> h;
      ans += h;
      mp[h]++;
    }
    for (int i = 0; i < d; i++) {
      int h;
      cin >> h;
      ans += h;
      if (mp.find(h) != end(mp) && mp[h] > 0) {
        mp[h]--;
        ans -= h;
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3092
import collections
s = collections.deque(input())
rev = 0
for i in range(int(input())):
    q = list(input().split())
    if len(q) == 1:
        rev += 1
    else:
        if q[1] == "1":
            if rev % 2 == 0:
                s.appendleft(q[2])
            else:
                s.append(q[2])
        else:
            if rev % 2 == 1:
                s.appendleft(q[2])
            else:
                s.append(q[2])
if rev % 2 == 1:
    s.reverse()
print("".join(s))

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

using namespace std;

int main(){
    int N; cin >> N;
    for (int i = 1; i < 10; i++){
        if (N % i == 0 && N / i < 10){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
open Batteries

let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let s = Scanf.scanf "%s " (fun a -> a) in

  let char_arr = Array.of_list (String.to_list s) in
  let res = ref 0 in

  for i = 0 to (n-1) do
    let left = Array.sub char_arr 0 i in
    let right = Array.sub char_arr i (n-i) in

    let left_l = List.unique (Array.to_list left) in
    let right_l = List.unique (Array.to_list right) in

    let intersection xs ys =
      List.fold_left (fun a b -> if List.mem b ys then (b::a) else a) [] xs
    in

    let v = List.length (intersection left_l right_l) in
    if v > !res then res := v

  done;

  print_endline (string_of_int (!res))


Measured memory_bytes: 1920
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;

int main() {
	char s[100] = {};
	while (fgets(s,sizeof(s),stdin)) {
		int start = 0, ofs=0,ofs2,chk=1;
		int buf;
		for (int i = 0; s[i] != '\n'; i++) {
			if (s[i] == ' ' || s[i] == '.') {
				if (i - start == 3) {
					chk = 1;
					ofs2 = (int)'t' - (int)(s[start]);
					for (int j = 1; j < 3; j++) {
						buf = (int)s[start + j] + ofs2;
						if (buf > (int)'z')
							buf -= 26;
						if (buf < (int)'a')
							buf += 26;
						if (j == 1 && buf != (int)'h') {
							chk = 0;
							break;
						}
						if (j == 2 && buf != (int)'e')
							chk = 0;
					}
					if (chk == 1) {
						ofs = ofs2;
						break;
					}
				}
				if (i - start == 4){
					chk = 1	;
					ofs2 = (int)'t' - (int)s[start];
					for (int j = 1; j < 4; j++) {
						buf = (int)s[start + j] + ofs2;
						if (buf > (int)'z')
							buf -= 26;
						if (buf < (int)'a')
							buf += 26;
						if (j == 1 && buf != (int)'h') {
							chk = 0;
							break;
						}
						if (j == 2 && buf == (int)'a')
							chk = 2;
						if (j == 2 && buf == (int)'i')
							chk = 3;
						if (j == 2 && buf != (int)'i'&&buf != (int)'a') {
							chk = 0;
							break;
						}
						if (j == 3 && chk == 2) {
							if (buf == (int)'t')
								chk = 1;
							else {
								chk = 0;
								break;
							}
						}
						if (j == 3 && chk == 3) {
							if (buf == (int)'s')
								chk = 1;
							else {
								chk = 0;
								break;
							}
						}
					}
					if (chk == 1) {
						ofs = ofs2;
						break;
					}
				}
				start = i + 1;
			}
		}
		for (int i = 0; s[i] != '\n'; i++) {
			int buf;
			if (s[i] != ' '&& s[i]!='.') {
				buf = (int)s[i] + (int)ofs;
				if (buf > (int)'z')
					buf -= 26;
				if (buf < (int)'a')
					buf += 26;
				s[i]=(char)buf;
			}
		}
		cout << s;
	}
	return 0;
}



Measured memory_bytes: 3024
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<iostream>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

ll dp[100010][3],a[100010][3];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    for (ll i = 0; i < N; ++i) for (ll j = 0; j < 3; ++j) cin >> a[i][j];

    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK

    // ループ
    for (ll i = 0; i < N; ++i){
        for (ll j = 0; j < 3; ++j){
            for (ll k = 0; k < 3; ++k){
                if (j == k) continue;
               dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
    }

    // 答え
    ll res = 0;
    for (ll j = 0; j < 3; ++j) res=max(res,dp[N][j]);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 6400
using System;

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int Y = int.Parse(input[1]);

            bool arieru = false; //こいつをフラグとする

            int a = -1;
            int b = -1;
            int c = -1;

            for(int i = 0; i <= N; ++i)
            {
                if(arieru == true)
                {
                    break;
                }

                for(int j = 0; j <= N; ++j)
                {
                    int k = N - i - j;
                    int O = 0;
                    if(k >= 0)
                    {
                        O = (10000 * i) + (5000 * j) + (1000 * k);
                    }

                    if(O == Y)
                    {
                        arieru = true;
                        a = i;
                        b = j;
                        c = k;

                        break;
                    }
                }
            }

            Console.WriteLine(a + " " + b + " " + c);

        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <math.h>
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define endl '\n'
#define EPS 1e-9
#define PI acos(-1)
 
using ll = long long;
using pll = pair<ll,ll>;
using ii = pair<int,int>;
using iii = pair<pair<int,int>,int>;
using viii = vector<iii>;
using vi = vector<int>;
using vii = vector<ii>;
using vll = vector<ll>;
using ui = unsigned int;


int main() {
    ofstream out("output.txt");
    ios_base::sync_with_stdio(false);

    string s;
    int n;

    cin>>n>>s;
    string res = "";
    for(char c : s){
        char nuevo = ((c+n));
        if(nuevo > 'Z'){
            nuevo = 65 + ((c+n)-91);
        }
        res += (nuevo);
    }
    cout<<res<<endl;

    return 0;
}   


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

int main () {
    int N;
    cin >> N;
    int total = 0, sum = 0;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            total = 4 * i + 7 * j;
            if (N == total) {
                sum++;
                break;
            }
        }
    }
    if (sum > 0) {
        cout << "Yes" << endl; 
    }
    else {
        cout << "No" << endl;
    }
}

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

int main() {
  int n;
  while (cin >> n, n) {
    vector<int> dp(n + 1, 1);
    dp[1] = 1;
    dp[2] = 2;
    for (int i = 3; i < n + 1; ++i) dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
    cout << (dp[n] + 3650 - 1) / 3650 << endl;
  }
  return 0;
}



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

using namespace std;

int main() {
    string s;
    cin >> s;
    vector<int> vec(s.size());

    for (int i = 0; i < s.size(); ++i) {
        string temp;
        temp = s.at(i);
        vec.at(i) = stoi(temp);
    }

    int ans = 0;
    for (int i :vec) {
        ans += i;
    }

    if (ans % 9 == 0) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 4376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int A = in(),B = in(),C = in(),D = in();
    cout << (A*B > C*D ? A*B : C*D) << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	cin>>a;
	for(int i=0;i<a.length();i++)
	{
		if(a[i]=='C')
		{
			for(int j=i+1;j<a.length();j++)
			{
				if(a[j]=='F')
				{
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	cout<<"No";
    return 0;
}

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

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

int main(){
map<string,int> mp;
int n;
cin>>n;
string Sn[n];
rep(i,n){
cin>>Sn[i];
mp[Sn[i]]++;
}
int m;
cin>>m;
string Sm[m];
rep(i,m){
cin>>Sm[i];
mp[Sm[i]]--;
}
int M=0;
rep(i,n){
  M=max(mp[Sn[i]],M);
}
cout<<M<<endl;

  return 0;
}


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

#define ll long long



using namespace std;

int n;

double x[9], y[9];

int v[9];

double sq (double x)
{
    return x * x;
}

double f (int i, int j)
{
    return sqrt(sq(abs(x[i] - x[j])) + sq(abs(y[i] - y[j])));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> x[i] >> y[i];
    int fact = 1;
    for(int i = 1; i <= n; i++)
    {
        v[i] = i;
        fact *= i;
    }
    double ans = 0;
    for(int i = 1; i <= fact; i++)
    {
        double lg = 0;
        for(int i = 2; i <= n; i++)
            lg += f(v[i - 1], v[i]);
        ans += lg;
        next_permutation(v + 1, v + n + 1);
    }
    ans /= fact;
    cout << fixed << setprecision(15) << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const double PI = 3.14159265358979323846;
const int MAX = 1e7;
const int MOD = 1e9+7;

int main(int argc, char *args[]) {
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for (int i = 0; i < h; i++) cin >> s[i];
	vector<vector<int>> cnt(h, vector<int>(w));
	for (int i = 0; i < h; i++) {
		vector<int> done(w);
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#')continue;
			if (done[j])continue;
			int l = 0;
			while (j + l < w) {
				if (s[i][j + l] == '#')break;
				++l;
			}
			for (int k = 0; k < l; k++) {
				cnt[i][j + k] += l;
				done[j + k] = 1;
			}
		}
	}
	for (int j = 0; j < w; j++) {
		vector<int> done(h);
		for (int i = 0; i < h; i++) {
			if (s[i][j] == '#')continue;
			if (done[i])continue;
			int l = 0;
			while (i + l < h) {
				if (s[i + l][j] == '#')break;
				++l;
			}
			for (int k = 0; k < l; k++) {
				cnt[i + k][j] += l;
				done[i + k] = 1;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			ans = max(ans, cnt[i][j] - 1);
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define ll long long
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}


double getdistance(pair<int, int> p, pair<int, int> q){

    double a = p.first * 1.0;
    double b = p.second * 1.0;

    double c = q.first * 1.0;
    double d = q.second * 1.0;

    double dis = sqrt(pow(abs(c - a), 2) + pow(abs(d - b), 2));

    return dis;
}

ll fact(int n){
    if (n == 1) return 1;
    return n * fact(n-1);
}

int main(){
    IOS;
    cout.precision(10);

    int n;
    cin >> n;

    vector<pair<int, int>> vv(n);

    for (int i = 0; i < n; i++){
        cin >> vv[i].first;
        cin >> vv[i].second;
    }

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

    double total = 0;
    do {
        for (int i = 0; i < n -1; i++){
            double dist = getdistance(vv[i], vv[i+1]);
            total += dist;
        }
    } while(next_permutation(vv.begin(), vv.end()));


    cout << total / fact(n) << endl;
    return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
typedef vector<lint> poly;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 998244353;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int R[4010], B[4010];
lint dp[4010][4010];

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int curr=0, curb=0;
    rep(i, n){
        if(s[i]=='0') {
            R[curr++]=i; R[curr++]=i;
        }
        else if(s[i]=='1'){
            R[curr++]=i; B[curb++]=i;
        }
        else{
            B[curb++]=i; B[curb++]=i;
        }
    }

    rep(i, curr+1)rep(j, curb+1) dp[i][j]=0;
    dp[0][0]=1;
    rep(i, curr+1)rep(j, curb+1)if(dp[i][j]){
                if(i<curr && R[i]<=i+j) (dp[i+1][j]+=dp[i][j])%=mod;
                if(j<curb && B[j]<=i+j) (dp[i][j+1]+=dp[i][j])%=mod;
            }
    printf("%lld\n", dp[curr][curb]);
}

Measured memory_bytes: 123392