akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

#define array_sort_asc(array,size) sort(array, array+size);
#define array_sort_desc(array,size) sort(array, array+size,greater<>());

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

    int height = 0;
    int accept_cnt = 0;
    REP(i, n){
        cin >> height;
        if(height >= k) accept_cnt++;
    }
    cout << accept_cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n;
double x, dp[3007][3007], ans = 0;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++){
		cin >> x;
		for(int j = 0; j < i; j++){
			dp[i][j] += dp[i - 1][j] * x;
			dp[i][j + 1] += dp[i - 1][j] * (1.0 - x);
		}
	}
	for(int i = 0; i <= n; i++){
		if(n - i > i) ans += dp[n][i];
	}
	cout << (fixed) << setprecision(15) << ans;
}


Measured memory_bytes: 69120
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

int main()
{
    ll n,m,i,a=0,b=0,k,t,j;
    string s1,s2;
    string s;
    cin>>n>>s1>>s2;
    for(i=0;i<s1.size();i++)
    {
        s.pb(s1[i]);
        s.pb(s2[i]);
    }
    cout<<s;
}

Measured memory_bytes: 3636
#!/usr/bin/env python3
import sys
import heapq
from collections import deque


inf = float("inf")

def solve(N: int, a: "List[int]"):
    L = a[:N]
    R = [-x for x in a[2*N:]]
    heapq.heapify(L)
    heapq.heapify(R)
    M = a[N:2*N]
    sumL = [0 for _ in range(N+1)] # sumL[i]: a[0]からa[N-1+i]までの大きい順にN個の和
    sumR = [0 for _ in range(N+1)] # sumR[i]: -(a[N-1+i]からa[3*N-1]までの小さい順にN個の和)

    sumL[0] = sum(L)
    sumR[N] = sum(R)

    for i in range(N):
        l = heapq.heappop(L)
        diff = M[i] - l
        if diff > 0:
            sumL[i+1] = sumL[i] + diff
            heapq.heappush(L, M[i])
        else:
            sumL[i+1] = sumL[i]
            heapq.heappush(L, l)
    
    for i in range(N-1, -1, -1):
        r = heapq.heappop(R)
        diff = -M[i] - r
        if diff > 0:
            sumR[i] = sumR[i+1] + diff
            heapq.heappush(R, -M[i])
        else:
            sumR[i] = sumR[i+1]
            heapq.heappush(R, r)
    
    res = -inf
    for suml, sumr in zip(sumL, sumR):
        res = max(res, suml + sumr)
    print(res)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(3*N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


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

int main(){
  int i,j,k,cnt=0;
  ll n,a,b;
  cin>>n>>a>>b;
  ll x[n];
  for(i=0;i<n;i++)cin>>x[i];
  ll y[n-1];
  for(i=0;i<n-1;i++)y[i]=x[i+1]-x[i];
  ll sum=0;
  for(i=0;i<n-1;i++){
    sum+=min(b,a*y[i]);
  }
  cout<<sum;
}


Measured memory_bytes: 1792
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]

// language: Rust(1.42.0)
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"
// My Library Repo' is at "https://github.com/Loptall/prcn_lib"

/*
    6月で水色になるぞ〜!!!
*/

// from std...
use std::cmp::{
    max, min,
    Ordering::{Equal, Greater, Less},
    Reverse,
};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;
use std::ops::*;
use std::process::exit;
use std::{f32, f64, i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

// Dep' crates are...
use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_complex::Complex;
use num_integer::{binomial, gcd, lcm, Integer};
use num_rational::Rational;
use num_traits::{one, zero, One, Zero};
use permutohedron::Heap;
use petgraph::unionfind::UnionFind;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::random;

pub const MOD: usize = 1000000007;
pub const MAX: usize = 1usize << 63usize;
pub const MIN: i64 = i64::MIN;
pub const PI: f64 = f64::consts::PI;
pub const A: u8 = 'A' as u8;

// code...
// #[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n]
    }

    let mut c = 0usize;
    for i in a.iter() {
        c ^= *i;
    }

    let all = c;

    let ans = a.into_iter().map(|x| all ^ x).join(" ");
    println!("{}", ans);
}


Measured memory_bytes: 7908
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll lmax(ll a, ll b){if(a>= b) return a;return b;}
ll lmin(ll a, ll b){if(a>= b) return b;return a;}
static const ll INF = 1e18;

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

  string ans;

  while(n){
    --n;
    ll x = n % 26;
    ans += (x +'a');
    n /= 26;
  }

  reverse(ALL(ans));
  cout << ans << endl;
}


Measured memory_bytes: 3636
N = int(input())

S = [input() for _ in range(N)]

C = [0] * 4

for s in S:
    if s == "AC":
        C[0] += 1
    elif s == "WA":
        C[1] += 1
    elif s == "TLE":
        C[2] += 1
    else:
        C[3] += 1


print("AC x " + str(C[0]))
print("WA x " + str(C[1]))
print("TLE x " + str(C[2]))
print("RE x " + str(C[3]))


Measured memory_bytes: 16328
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define for1(i,n) for(int i=1;i<=(int)(n);i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
const int MOD = 1e9 + 7 ;
int mpow(int a,int b,int p=MOD){  a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int n;
      cin>>n;
      cout<<3*n*n;
}
// I never lose. I either win or I learn

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    int n, ans = 1e9, i;
    vector <pair<int, int>> v, w;
    map <int, int> mp1, mp2;
    map <int, int>::iterator it;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        int x;
        
        scanf("%d", &x);
        
        if (i % 2 == 0) {
            mp1[x]++;
        } else {
            mp2[x]++;
        }
    }
    
    mp1[1e9] = 0;
    mp2[1e9] = 0;
    
    for (it = mp1.begin(); it != mp1.end(); it++) v.push_back(make_pair(it->second, it->first));
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    
    for (it = mp2.begin(); it != mp2.end(); it++) w.push_back(make_pair(it->second, it->first));
    sort(w.begin(), w.end());
    reverse(w.begin(), w.end());
    
    for (i = 0; i < v.size(); i++) {
        int p = 0;
        
        if (v[i].second == w[0].second) p = 1;
        
        ans = min(ans, n - (v[i].first + w[p].first));
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 6136
#include <bits/stdc++.h>
using namespace std;
char s[105];
vector<int> rep;
int inter;
int main(){
    scanf("%s\n",s);
    long long k;
    scanf("%lld",&k);
    char c=s[0];
    int cnt=1;
    for(int i=1;i<strlen(s);i++){
        if(s[i]!=c){
            rep.push_back(cnt);
            cnt=1;
            c=s[i];
        }
        else cnt++;
    }
    rep.push_back(cnt);
    if(rep.size()==1){
        printf("%lld",(long long)(strlen(s))*k/2LL);
        return 0;
    }
    if(s[strlen(s)-1]==s[0]){
        inter=rep[0]+rep[rep.size()-1];
        long long tot=(k-1LL)*(long long)(inter/2),cyc=0;
        for(int i=1;i<rep.size()-1;i++)cyc+=(long long)(rep[i]/2);
        tot+=cyc*k;
        tot+=(long long)(rep[0]/2+rep[rep.size()-1]/2);
        printf("%lld",tot);
    }
    else{
        int tot=0;
        for(int i=0;i<rep.size();i++)tot+=rep[i]/2;
        printf("%lld",(long long)(k*tot));
    }
}

Measured memory_bytes: 256
import sys
from collections import deque
import numpy as np
import copy
def main():
    N, K = map(int, input().split())
    dp = np.zeros(N)
    count = 0 
    for i in range(K):
        d = int(input())
        A = [int(t) - 1 for t in input().split()]
        for u in range(d):
            dp[A[u]] += 1
    for i in range(N):
        if dp[i] == 0:
            count += 1
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27120
from collections import deque

N = int(input())
G = [[] for _ in range(N)]
for i in range(N-1):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  G[a].append([b, i])
  G[b].append([a, i])

ans = [0]*(N-1)
q = deque([(0, -1)])
while q:
  v, pc = q.popleft()
  c = 1 if pc != 1 else 2
  for nv, i in G[v]:
    if ans[i] == 0:
      ans[i] = c
      q.append((nv, c))
      c += 1 if c+1 != pc else 2

print(max(ans))
print(*ans, sep="\n")

Measured memory_bytes: 48024
N = int(input())
List = [list(input().split()) for i in range(N)]

for i in range(N):
    List[i].append(i+1)
    List[i][1] = int(List[i][1])
    
List.sort(key = lambda x:(x[0],-x[1]))

for i in range(N):
    print(List[i][2])

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

int main() {
  int N,A,B;
  
  cin >> N >> A >> B;
  
  int a = A * N;
    
  if (a >= B) {
    cout << B << endl;
  }
  else if (a < B) {
    cout << a << endl;
  }
}

Measured memory_bytes: 256
from collections import deque

S = deque(input())
num_of_query = int(input())

is_reverse = False

for _ in range(num_of_query):
    query = list(input().split())
    
    if query[0] == '1':
        is_reverse = not is_reverse
    else:
        if query[1] == '1':
            if is_reverse:
                S.append(query[2])
            else:
                S.appendleft(query[2])

        else:
            if is_reverse:
                S.appendleft(query[2])
            else:
                S.append(query[2])

S = list(S)

if is_reverse:
    S = S[::-1]

print(''.join(S))

Measured memory_bytes: 8564
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
 
typedef long long ll;

#define MP make_pair
#define F first
#define S second

int main(){
	ll n;
  	cin >> n;
  	vector<ll> h(n);
  	for(ll i=0;i<n;i++){
    	cin >> h[i];
    }
  	sort(h.begin(),h.end());
    ll x=h[0],y=h[n/3],z=h[2*n/3];
    if(x==0){
    	if(x==h[n-1]) cout << "Yes";
      	else if(x==h[n/3-1]&&y==h[n-1]) cout << "Yes";
      	else cout << "No"<< endl; 
    }else{
  		bool ans=true;
  		if(n%3!=0) ans=false;
  		if(x!=h[n/3-1]|| y!=h[2*n/3-1]|| z!=h[n-1]) ans=false;
  		if(((x^y)^z)!=0) ans=false;
  		if(ans){cout <<"Yes" << endl;}else{
    		cout << "No" << endl;
    	}
    }
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  //
  ll a, b;
  cin >> a >> b;
  if (b % a == 0)
    cout << a + b << endl;
  else
    cout << b - a << endl;
  return 0;
}


Measured memory_bytes: 256
function Main(arg)
{
  var S = arg.split("\n")[0];

  if (S.length % 2 !== 0) {
        console.log("No");
        return;
  }

  for (var i = 0; i < S.length; i++){
    if (i % 2==0) {
      if (S[i] !== "h") {
        console.log("No");
        return;
      }
    }
    else {
      if (S[i] !== "i") {
        console.log("No");
        return;
      }
    }
  }

  console.log("Yes");
  return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

bool check(char op, bool f1, bool f2) {
    switch (op) {
    case '*':
        return f1 && f2;
    case '+':
        return f1 || f2;
    case '>':
        return !(f1 && !f2);
    }
    assert(0);
}

bool formula(string& form, int& idx) {
    for (; idx < (int)form.length(); idx++) {
        switch (form[idx]) {
        case 'T':
            return true;
        case 'F':
            return false;
        case '-':
            return !formula(form, ++idx);
        case '(':
            bool f1 = formula(form, ++idx);
            char op = form[++idx];
            bool f2 = formula(form, ++idx);
            ++idx;
            return check(op, f1, f2);
        }
    }
    assert(0);
}

bool equation(string form, int vars) {
    REP(i, form.length()) {
        char c = form[i];
        if (isalpha(c) && c != 'T' && c != 'F') {
            if (vars & (1 << (c - 'a'))) {
                form[i] = 'T';
            } else {
                form[i] = 'F';
            }
        }
    }
    int idx = 0;
    return formula(form, idx);
}

int main() {
    while (1) {
        string line;
        getline(cin, line);
        if (line == "#") break;

        stringstream f1, f2;
        bool next = false;
        REP(i, line.length()) {
            char c = line[i];
            if (c == '-' && line[i+1] == '>') {
                c = '>';
                i++;
            }
            if (c == '=') {
                next = true;
            } else if (!next) {
                f1 << c;
            } else {
                f2 << c;
            }
        }

        bool eq = true;
        REP(vars, 1 << 11) {
            if (equation(f1.str(), vars) != equation(f2.str(), vars)) {
                eq = false;
                break;
            }
        }
        cout << (eq ? "YES" : "NO") << endl;
    }
}

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

using namespace std;

int main()
{
	vector<int> x(5);
	for (auto& x_i : x) {
		cin >> x_i;
	}

	auto ans = 1 + find(x.begin(), x.end(), 0) - x.begin();
	cout << ans << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
 int N;
 cin>>s;
N=s.length();
for( int i=0;i<N;i++)
{
if(s[i]>='A'&&s[i]<='Z')
s[i]='A';
else if(s[i]>='a'&&s[i]<='z')
 s[i]='a';
 }
cout<<s;
return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
int T1, T2, A1, A2, B1, B2;
void solve() {
    int C, D;
    int ans = 0;
    C = A1 - B1;
    D = A2 - B2;
    if (C * T1 + D * T2 == 0) {
        cout << "infinity" << endl;
        return;
    }
    int a, b;
    a = C * T1;
    b = D * T2;
    if (a + b > 0 && a > 0) {
        ans = 0;
    } else if (a + b < 0 && a < 0) {
        ans = 0;
    } else if (a + b < 0 && a > 0) {
        itn n = (-1 * b) / (-a - b);
        ans = n * 2 - 2;
        ans += 1;
        if (n * (-a - b) == -b) {
            ans--;
        }
    } else {
        a *= -1;
        b *= -1;
        itn n = (-1 * b) / (-a - b);
        ans = n * 2 - 2;
        ans += 1;
        if (n * (-a - b) == -b) {
            ans--;
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
    solve();
    return 0;
}


Measured memory_bytes: 256
S = input()
n = len(S)
ans = 0
for i in range(2 ** (n-1)):
    tmp = S[n-1]
    for k in range(n-1):
        if 1 & i>>k:
            ans += int(tmp)
            tmp = S[n-k-2]
        else:
            tmp = S[n-k-2] + tmp
    ans += int(tmp)
print(ans)

Measured memory_bytes: 3060
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N,K = LI()
h = LI()
cnt = 0
for i in range(N):
    if h[i] >= K:
        cnt += 1
print(cnt)

Measured memory_bytes: 14488
# -*- coding: utf-8 -*-

def main():
    while 1:
        n, p = list(map(int, input().split()))
        if n + p == 0:
            return 1
        s = [0] * n
        ans = -1
        while 1:
            if p > n:
                i = p // n
                p = p % n
                s = [s_ + i for s_ in s]
            else:
                for i in range(n):
                    if p > 0:
                        p -= 1
                        s[i] +=1
                        if p == 0 and sum(s)==s[i]:
                            ans = i
                            break
                    else:
                        p = s[i]
                        s[i] = 0
            if ans >-1:
                break
        print(ans)

if __name__ == "__main__":
    main()



Measured memory_bytes: 5608
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 

#include <boost/math/special_functions/binomial.hpp>

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

int N, M; cin >> N >> M;


cout << (N >= 2 ? (int)boost::math::binomial_coefficient<double>(N, 2) : 0) + 
(M >= 2 ? (int)boost::math::binomial_coefficient<double>(M, 2) : 0)
<< "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
def bugged(ss):
    ss2 = list(sorted(ss))
    total = sum(ss2)
    if total % 10 != 0:
        return total
    elm = None
    for s in ss2:
        if s % 10 != 0:
            elm = s
            break
    return total - elm if elm else 0

def main():
    N = int(input())
    ss = []
    for i in range(N):
        ss.append(int(input()))
    print(bugged(ss))

main()
    
def test():
    print(bugged([5,10,15]))
    print(bugged([10,10,15]))
    print(bugged([10,20,30]))
    print(bugged([32,53252,212,4324,122,10,43,32,3232,120]))
    print(bugged([12,23,45,65,43,42]))
  

Measured memory_bytes: 3064
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)[::-1]
num=0
ans=0
cnt=1
i=0
while cnt<N:
    if i==0:
        ans+=A[i]
        i+=1
    else:
        if num==0:
            ans+=A[i]
            num+=1
        else:
            ans+=A[i]
            i+=1
            num=0
    cnt+=1
print(ans)

Measured memory_bytes: 31556
#include<bits/stdc++.h>
using namespace std;
int n,k,t;
char c1,c2;
int main(){
    scanf("%d%d",&n,&k);
    getchar();
    int ans=n-1;
    for(int i=0;i<n;i++){
        c1=c2;
        c2=getchar();
        if((c1=='L'&&c2=='R')||(c1=='R'&&c2=='L')) ans--; 
    }
    ans+=2*k;
    printf("%d",min(ans,n-1));
    return 0;
}
/*
13 3
LRRLRLRRLRLLR
LRRRLLRRLRLLR
LRRRRRLLLRLLR
LRRRRRRLLLLLR
*/

Measured memory_bytes: 3780
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var x = o.a();
  var a = [1], b = [1];
  for(var i = 1; i <= n; i++){
    a[i] = a[i-1] * 2 + 3;
    b[i] = b[i-1] * 2 + 1;
  }
  return f(n,x);
  function f(n,x){
    if(a[n] === x)return b[n];
    if(x <= 0)return 0;
    if(n === 0)return 1;
    var m = (a[n]+1) / 2;
    if(x === m)return b[n-1] + 1;
    if(x < m)return f(n-1, x-1);
    return b[n-1] + 1 + f(n-1, x-m);
  }
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	int ts=0,xs=0,ys=0;
	REP(i,N){
		int tg=in(),xg=in(),yg=in();
		int xl=xg-xs,yl=yg-ys,tl=tg-ts;
		int dl=abs(xl)+abs(yl);
		if(dl>tg){
			out("No");
			return 0;
		}
		if((tl-dl)%2){
			out("No");
			return 0;
		}
		xs=xg,ys=yg,ts=tg;
	}
	out("Yes");
	return 0;
}


Measured memory_bytes: 256
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]

s_dic = {}
t_dic = {}

for i in s:
  if i in s_dic.keys():
    s_dic[i] += 1
  else:
    s_dic[i] = 1
    
for i in t:
  if i in t_dic.keys():
    t_dic[i] += 1
  else:
    t_dic[i] = 1
    
all_list = []

for i in s_dic.keys():
  if i in t_dic.keys():
    all_list.append(s_dic[i] - t_dic[i])
  else:
    all_list.append(s_dic[i])
    
for i in t_dic.keys():
  if i in s_dic.keys():
    all_list.append(s_dic[i] - t_dic[i])
  else:
    all_list.append(-t_dic[i])
    
print(max(max(all_list), 0))

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

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

  int A[4];
  rep(i,4){
    cin >> A[i];
  }
  sort(A,A+4);
  if(A[0] == 1 && A[1] == 4 && A[2] == 7 && A[3] == 9){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

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

using namespace std;

#define vi vector<int>
#define pb push_back
#define lli long long int
#define INF 1000000001
#define endl "\n"

void solve() {
	int a, b; cin >> a >> b;
	cout << a*b << endl;
}


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

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);
#endif

	solve();




	return 0;

}


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


int N, M;
vector<int> visited;
vector<vector<int>> vec;
int num_visited = 0;
int ans = 0;

void dfs(int now) {
    visited[now] = 1;
    if (++num_visited == N) ans++;

    for (int i = 0; i < vec[now].size(); i++) {
        int next = vec[now][i];
        if (!visited[next]) dfs(next);
    }

    visited[now] = 0;
    num_visited--;
}

void solve(long long N, long long M, vector<vector<int>> vec){
    dfs(0);
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    cin >> N >> M;
    vec = vector<vector<int>>(N);
    visited = vector<int>(N, 0);
    for(int i = 0 ; i < M ; i++){
        int a, b;
        cin >> a >> b;
        // zero origin
        a--;
        b--;
        vec[a].push_back(b);
        vec[b].push_back(a);
    }

    solve(N, M, vec);
    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        String s = std.next();
        int[][] dp = new int[n + 1][n + 1];
        dp[0][0] = 0;

        for (int i = n - 1; i >= 0; i--) {
            char first = s.charAt(i);
            for (int j = n - 1; j >= 0; j--) {
                char second = s.charAt(j);
                if (first == second) {
                    dp[i][j] = dp[i + 1][j + 1] + 1;
                } else {
                    dp[i][j] = 0;
                }
            }
        }

        int ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i > j) {
                    continue;
                }

                int now = Math.min(dp[i][j], j - i);
                ans = Math.max(ans, now);
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 168240
#include <iostream>
using namespace std;
 
const int N = 200005;
 
int n, a, ans = 0, cnt[N];
 
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        ans = max(ans, cnt[a] = cnt[a - 1] + 1);
    }
    cout << n - ans;
}

Measured memory_bytes: 1024
N,Q = map(int,input().split())
S = input()

AC_list = [0]*(N+1)
for i in range(N):
    if S[i:i+2] == "AC":
        AC_list[i+1] = AC_list[i]+1
    else:
        AC_list[i+1] = AC_list[i]

for i in range(Q):
    l, r = map(int,input().split())
    print(AC_list[r-1]-AC_list[l-1])

Measured memory_bytes: 6188
(function() {
    'use strict';

    var fs = require('fs');
    var contents = fs.readFileSync('/dev/stdin', 'utf-8');

    var printRec = function(contents) {
        var lines = contents.trim().split("\n");
        for (var i = 0; i < lines.length; i++) {
            var b = lines[i].split(" ");
            var H = parseInt(b[0]);
            var W = parseInt(b[1]);

            if (H === 0 && W === 0) {
                break;
            }
            for (var h = 0; h < H; h++) {
                for (var w = 0; w < W; w++) {
                    process.stdout.write("#");
                }
                process.stdout.write("\n");
            }
            process.stdout.write("\n");
        }
    }
    printRec(contents);
})();

Measured memory_bytes: 17664
#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()
{
    ll n;
    cin >> n;
    ll sum,num3, num5, num15;
    num3 = n / 3;
    num5 = n / 5;
    num15 = n/ 15;

    sum = n*(n+1)/2 - 3 * num3*(num3+1)/2 - 5* num5 *(num5+1)/2 + 15 *num15*(num15+1)/2;

    cout << sum << endl; 

    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main() {
    string s;
    cin >> s;
    bool exist[3] = {};
    for (int i=0; i<3; i++) {
        if (s[i] == 'a') {
            exist[0] = true;
        } else if (s[i] == 'b') {
            exist[1] = true;
        } else if (s[i] == 'c') {
            exist[2] = true;
        }
    }
    if (exist[0] && exist[1] && exist[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
constexpr ll MOD = 1000000007;
constexpr ll T = 2019;


int main(int argc, char **argv)
{
	string str; cin >> str;

	ll N = (ll)str.size();
	vector<ll> val(2020, 0);
	ll tenfactor = 1;
	ll cur = 0;
	++val[cur];
	for (ll i = 0; i < N; ++i)
	{
		(cur += (str[N-1-i] - '0') * tenfactor) %= 2019;
		(tenfactor *= 10) %= 2019;
		++val[cur];
	}

	ll res{0};
	for (ll i = 0; i < 2019; ++i)
	{
		res += val[i] * (val[i]-1)/2;
	}
	
	std::cout << res << std::endl;
}


Measured memory_bytes: 3740
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

class Edge {
    int to;
    int cost;

    Edge(int to, int cost) {
        this.to = to;
        this.cost = cost;
    }
}

class Pair implements Comparable<Pair> {
    int dist;
    int index;

    Pair(int dist, int index) {
        this.dist = dist;
        this.index = index;
    }

    public int compareTo(Pair p2) {
        return dist - p2.dist;
    }
}
 
public class Main {
    static final int INF = 1000000;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        List<List<Edge>> g = new ArrayList<>();
        for(int i = 0; i < n; i++) {
            List<Edge> tmp = new ArrayList<>();
            g.add(tmp);
        }
        for(int i = 0; i < n; i++) {
            int u = sc.nextInt();
            int k = sc.nextInt();
            for(int j = 0; j < k; j++) {
                int v = sc.nextInt();
                int c = sc.nextInt();
                g.get(u).add(new Edge(v, c));
            }
        }

        int[] d = new int[n];
        for(int i = 0; i < n; i++) {
            d[i] = INF;
        }
        d[0] = 0;

        PriorityQueue<Pair> que = new PriorityQueue<>();
        que.add(new Pair(0, 0));
        while(!que.isEmpty()) {
            Pair p = que.poll();
            int v = p.index;
            if(d[v] < p.dist) continue;

            for(int i = 0; i < g.get(v).size(); i++) {
                Edge e = g.get(v).get(i);
                if(d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.add(new Pair(d[e.to], e.to));
                }
            }
        }

        for(int i = 0; i < n; i++) {
            System.out.printf("%d %d\n", i, d[i]);
        }
 
        sc.close();
    }
}


Measured memory_bytes: 41380
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;
void solve(){
    int n, m;
    cin >> n >> m;
    vector <pii> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i].first >> a[i].second;
    }
    sort(all(a));
    
    //for(int i = 0; i < n; i++) cout << a[i].first << ' ' << a[i].second << endl;
    
    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(m >= a[i].second){
            m -= a[i].second;
            ans += a[i].first * 1ll * a[i].second;
        }
        else if(m > 0){
            ans += a[i].first * 1ll * m;
            break;
        }
        else break;
    }
    cout << ans;
}


int main(){
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}
// vse dolzhny vyiti v internet po hhtp


Measured memory_bytes: 1024
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int ans = 0;
		for (int i=0; i<S.length(); i++){
			int count = 0;
			for (int j=i; j<S.length(); j++){
				if (S.charAt(j) == 'A' || S.charAt(j) == 'C'
						|| S.charAt(j) == 'G' || S.charAt(j) == 'T'){
					count++;
				}else{
					break;
				}
			}
			if (count>ans){
				ans = count;
			}
		}
		System.out.println(ans);

	}

}

Measured memory_bytes: 35440
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int K = in.nextInt();
		int a =K/2;
		if(K%2==1) {
			System.out.print(a*(a+1));	
		}else {
			System.out.print(a*a);
			
		}

	}
}


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

int main() {
  int N,M,k;
  k=0;
  cin >>N>>M;
  vector<int> x(M),l(M-1);
  for(int i=0;i<M;i++){
    cin >>x[i];
  }
  sort(x.begin(),x.end());
  for(int i=0;i<M-1;i++){
    l[i]=x[i+1]-x[i];
  }
  sort(l.begin(),l.end());
  if(N>=M){
    cout<<0<<endl;
  }
  else{
    for(int i=0;i<N-1;i++){
      k+=l[M-2-i];
    }
    cout <<x[M-1]-x[0]-k<<endl;
  } 
}

Measured memory_bytes: 1152
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N, T, E; cin >>N >>T >>E;
  int ans = -1;
  REP(i, N){
    int x; cin >>x;
    int _x = x;
    while(T + E >= _x){
      if(T - E <= _x && T + E >= _x) ans = i + 1;
      _x += x;
    }
  }
  cout <<ans <<endl;
  return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <cstdlib>
using namespace std;
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}

int main() {
	long long N;
	cin >> N;
	long long i, j;
	long long ans = 0;
	long long A = 0;
	long long B = 0;
	long long BA = 0;
	vector<string> S;
	for (i = 0; i < N; i++) {
		string s;
		cin >> s;
		S.push_back(s);
		for (j = 0; j < s.size() - 1; j++) {
			if (s.at(j) == 'A' && s.at(j + 1) == 'B') {
				ans++;
			}
		}
		long long flag = 0;
		if (s.at(0) == 'B') {
			B++;
			flag++;
		}
		if (s.at(s.size() - 1) == 'A') {
			A++;
			flag++;
		}
		if (flag == 2) {
			BA++;
		}
	}
	ans += min(A, B);
	if (BA == A && BA == B && BA>=1) {
		cout << ans - 1;
	}
	else {
		cout << ans;
	}
}

Measured memory_bytes: 1404
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

//??\???
#define MAX_N 100
#define W_LIM 150
int N;

int main() {
  ios::sync_with_stdio(false);


  while( cin >> N ) {

    if ( N== 0 ) break;

    map<int,int> mp;
    int w, a, b;
    for(int i = 0; i < N; i++) {
      cin >> w >> a >> b;
      mp[a] += w;
      mp[b] -= w;
    }

    int acc_w = 0;
    bool lim_exc = false;
    map<int,int>::iterator it;
    for(it = mp.begin(); it != mp.end(); it++) {

      acc_w += it -> second;
      // cout << it->first <<" " << it-> second << " : " << acc_w <<"\n";
      if( acc_w > W_LIM ) {
        lim_exc = true;
        break;
      }

    }

    cout << (lim_exc ? "NG" : "OK") << "\n";
  }

}

Measured memory_bytes: 2968
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    int res = 0;
    int p = 0, g = 0;

    rep(i, n) {
        char c = s[i];
        if (c == 'g') {
            if (p+1 <= g) {
                res++;
                p++;
            }
            else {
                g++;
            }
        }
        else {
            if (p+1 <= g) {
                p++;
            }
            else {
                g++;
                res--;
            }
        }  
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define SORT(v) sort(v.begin(), v.end());
#define REVERSE(v)  reverse(v.begin(), v.end());
typedef long long ll;
using namespace std;

int main() {
  int D,G; cin>>D>>G;
  vector<ll> p(D),c(D); REP(i,D) cin>>p[i]>>c[i];

  ll res=1<<29;
  for(int bit=0; bit<(1<<D); ++bit) {
    ll sum=0;
    ll num=0;
    REP(i,D) {
      if(bit & (1<<i)) sum += c[i] + p[i] * 100 * (i+1), num += p[i];
    }
    if(sum >= G) res = min(res, num);
    else {
      for(int i=D-1; i>=0; --i) {
        if(bit & (1<<i)) continue;
        for(int j=0; j<p[i]; ++j) {
          if(sum >= G) break;
          sum += 100 * (i+1);
          ++num;
        }
      }
      res = min(res, num);
    }
  }
  cout<<res<<endl;
}

Measured memory_bytes: 256
def median(array):
    L = len(array)
    if L%2==0:
        return (array[L//2-1]+array[L//2])/2
    else:
        return array[L//2]

N = int(input())
A = []
for i, a in enumerate(map(int, input().split())):
    A.append(a-i)
A.sort()
b = median(A)
res = 0
for a in A:
    res += abs(a-b)
print(round(res))

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

int main() {
  int n; cin >> n;
  vector<int> a(n), sort_a(n);
  rep(i,n) cin >> a[i];
  sort_a = a;
  sort(sort_a.begin(), sort_a.end());
  int a_max = sort_a[n-1];
  int a_max2 = sort_a[n-2];
  rep(i,n) {
    if (a_max != a[i]) cout << a_max << endl;
    else cout << a_max2 << endl;
  }
}

Measured memory_bytes: 3200
require"matrix";n,m=gets.split.map &:to_i;s=n.times.map{Vector[*gets.split.map(&:to_i)]};p 8.times.map{|b|v=Vector[b[2]*2-1,(b&2)-1,b[0]*2-1];s.map{|w|w.dot v}.max(m).inject :+}.max||0

Measured memory_bytes: 2812
//by (111110101)2
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
string s;
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		cout<<'x';
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
using namespace std;
 
int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int ans = max(a*b, c*d);
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int ha, sa, hb, sb;
        cin >> ha >> sa >> hb >> sb;

        while(ha > 0) {
            hb -= sa;
            if(hb <= 0)
                break;
            ha -= sb;
        }

        if(ha > 0)
            cout << "Yes\n";
        else
            cout << "No\n";
        
    }
    
    return 0;
}



Measured memory_bytes: 3584
#include "bits/stdc++.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
#define io ios::sync_with_stdio(0)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rson rt << 1 | 1, mid + 1, r
#define lson rt << 1, l, mid
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eps 1e-12
#define int long long
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
    int ans = 1;
    for (; b; b >>= 1, a = a * a % mod)
        if (b & 1)
            ans = ans * a % mod;
    return ans;
}

signed main()
{
    io;
    int a,b;cin>>a>>b;
    if(a>b)swap(a,b);
    rep(i,1,b)cout<<a;
    getchar(); //
    getchar();
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define ALL(v) (v).begin(), (v).end()
#define PUTS(x) cout << (x) << endl;
#define PB push_back
#define MP make_pair
vector<Int> IntsIn(int n) {
    auto v = vector<Int>(0);
    for (int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        v.push_back(a);
    }
    return v;
}

#define INF 100000000000LL
int main() {
    Int h, n;
    cin >> h >> n;
    auto v = vector<pair<Int, Int>>();
    rep(i, n) {
        Int a, b;
        cin >> a >> b;
        v.PB(MP(a, b));
    }
    auto dp = vector<Int>(h + 1, 0);
    reps(i, h) {
        Int result = INF;
        rep(j, n) {
            auto x = v[j];
            auto a = x.first;
            auto b = x.second;
            if (i >= a) {
                result = min(dp[i - a] + b, result);
            } else {
                result = min(b, result);
            }
        }
        dp[i] = result;
    }
    PUTS(dp[h]);
}


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

int main()
{
	int n,x,y;
	cin>>n;
	priority_queue<int>q;
	for(int i=0;i<n;i++){cin>>x;q.push(x);}
	
	while(q.size()>1)
	{
		x=q.top();q.pop();
		y=q.top();q.pop();
		x%=y;
		if(x)q.push(x);
		q.push(y);
	}
	cout<<q.top()<<endl;
}



Measured memory_bytes: 3924
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

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

   if(a % b == 0){
       if(c == 0)print("YES");
       else print("NO");
   }else{
       bool flag = false;
       for (int i = 1; i <= 100; ++i) {
           if(a * i % b == c){
               flag = true;
               print("YES");
               break;
           }
       }
       if(!flag)print("NO");
   }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func pow2(n int) int {
	if n == 0 {
		return 1
	} else {
		return pow2(n-1) * 2
	}
}

func main() {
	var k int
	vs := make([]int, 3)
	fmt.Scan(&vs[0], &vs[1], &vs[2], &k)
	sort.Ints(vs)
	fmt.Println(vs[0] + vs[1] + vs[2]*pow2(k))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

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

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

  priority_queue<int> pq;
  rep(i,n) {
    int a;
    cin >> a;
    pq.push(a);
  }

  while (m > 0) {
    int x = pq.top(); pq.pop();
    x /= 2;
    m--;
    pq.push(x);
  }

  ll ans = 0;
  while (!pq.empty()) {
    ll x = pq.top(); pq.pop();
    ans += x;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <map>
#include<set>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
const int mod=1e9+7;
typedef long long ll;
int main()
{
	int n;
	cin>>n;
	vector<int> a(n+1);
	vector<int> N(n+1);
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int asum=0;
	for(int i=1;i<=n;i++)
	{
		if(i%2!=0)
			asum+=a[i];
		else
			asum-=a[i];
	}
	N[1]=asum;
	for(int i=2;i<=n;i++)
	{
		N[i]=(a[i-1]-N[i-1]/2)*2;
	}
	for(int i=1;i<n;i++)
		cout<<N[i]<<" ";
	cout<<N[n]<<endl;
	return 0;
}

Measured memory_bytes: 2048