akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int A;
int B;
int C;
int X;
int Y;
int main(){
  int k, res=1073709056;
  rd(A);
  rd(B);
  rd(C);
  rd(X);
  rd(Y);
  chmin(res, A * X + B * Y);
  k =min_L(X, Y);
  chmin(res, A * (X-k) + B * (Y-k) + 2*k * C);
  k =max_L(X, Y);
  chmin(res, 2*k * C);
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int A, B, C, X, Y;
// {
//   int k, res = int_inf;
//   rd(A,B,C,X,Y);
// 
//   res <?= A * X + B * Y;
// 
//   k = min(X,Y);
//   res <?= A * (X-k) + B * (Y-k) + 2k * C;
// 
//   k = max(X,Y);
//   res <?= 2k * C;
// 
//   wt(res);
// }


Measured memory_bytes: 764
#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, m;
  cin >> n >> m;
  int hw_sum = 0;
  int x;
  rep(i, m){
    cin >> x;
    hw_sum += x;
  }
  
  cout << max(-1, n - hw_sum);
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n);i++)
#define rep1(i,n) for(int i=1; i<(n); i++)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0, b = 0;
    repe(i, s){
        if(i == 'R') r++;
        else b++;
    }
    cout << (r > b ? "Yes" : "No" ) << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    string w;
    cin>>w;
    vector<long long> a(26,0);
    f(i,0,w.size()){
        a[w[i]-'a']++;
    }
    f(i,0,26){
        if(a[i]%2!=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


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

long long A[3][3];

int main(){
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++) {
			cin >> A[i][j];
		}
	}

	long long N;
	cin >> N;
	for(long long i = 0; i < N; i++) {
		long long tmp;
		cin >> tmp;
		for(int k = 0; k < 3; k++) {
			for(int j = 0; j < 3; j++) {
				if(A[k][j] == tmp) {
					A[k][j] = -1;
				}
			}
		}
	}

	for(int i = 0; i < 3; i++) {
		bool ok = true;
		for(int j = 0; j < 3; j++) {
			if(A[i][j] != -1) {
				ok = false;
			}
		}
		if(ok) {
			cout << "Yes" << endl;
		return 0;
		}
	}

	for(int i = 0; i < 3; i++) {
		bool ok = true;
		for(int j = 0; j < 3; j++) {
			if(A[j][i] != -1) {
				ok = false;
			}
		}
		if(ok) {
			cout << "Yes" << endl;
		return 0;
		}
	}

	if(A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1) {
		cout << "Yes" << endl;
		return 0;
	}

	if(A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;


}

Measured memory_bytes: 3604
/**
**	author : Raghav
**	codechef:raghav_456
**	codeforces:raghavramola7
**/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void Raghav()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
//int x = 1e6;
int a[1000000];
bool isPrime(int n)
{
	for (int i = 2; i <= sqrt(n) + 1; i++)
	{
		if (n % i == 0 && i != n)
		{
			return false;
		}
	}
	return true;
}
int32_t main()
{
	Raghav();
	string s1,s2;
	cin>>s1;
	cin>>s2;
	int ans=0;
	for(int i=0;i<s1.length();i++)
	{
		if(s1[i]!=s2[i])
			ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc166/abc166_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, M;
  cin >> N >> M;
  
  vector<int> h(N);
  rep(i, N) { cin >> h[i]; }

  vector<int> g(N, -1);
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a] = max(g[a], h[b]);
    g[b] = max(g[b], h[a]);
  }

  ll ans = 0;
  rep(i, N) {
    if (g[i] == -1 || h[i] > g[i]) ans++;
  }

  cout << ans << endl;
}

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

typedef pair<int,int> pii;

int n,k;
pair<int,int> a[55];

priority_queue<pii> pq,pq2;
vector<int> ans;

int main(){
   cin >> n >> k;
   int tot = 0;
   for(int i=1;i<=n;i++){
      cin >> a[i].first;
      tot += a[i].first;
      a[i].second = i;
      pq.push(a[i]);  
   }
   int bef = 0;
   int la = 0;
   for(int i=0;i<=k;i++){
      while(!pq.empty()){
         pii tmp = pq.top();
         pq.pop();
         if(tmp.second == bef){
            if(i == k){
//               if(tmp.first < 1){
//                  cout << "-1\n";
//                  return 0;
//               }
            }
            pq2.push(tmp);
            continue;
         }
         ans.push_back(tmp.second);
         tmp.first--;
         if(tmp.first<0){
            cout << "-1\n";
            return 0;
         }
         la = tmp.second;
         pq2.push(tmp);
      }
      while(!pq2.empty()){
         pq.push(pq2.top()); pq2.pop();
      }
//      if(i==k)ans.push_back(bef);
      bef = la;
   }
   cout << ans.size() << endl;
   for(int i=0;i<ans.size();i++){
      if(i>0) cout << " ";
      cout << ans[i];
   }
   cout << endl;
   /*
   a[n+1].first = 10000;
   sort(a+1,a+n+1);
//   cout << a[1].first << " comp with " << (k+2)/2 << endl;
//   cout << a[2].first << " comp with " << 
   if(a[1].first >= (k+2)/2 && a[2].first >= (k+3)/2 && a[3].first>=k+1){
      cout << tot << endl;
      swap(a[1],a[2]);
      swap(a[2],a[n]);
      int l = 1;
      int tam = -1;
      bool spas = 0;
      while(tot!=0){
         if(a[l].first == 0) continue;
         a[l].first--;  
         if(spas) cout << " ";
         spas = 1;
         cout << a[l].second;
         tot--;
         if(l == n || l==1) tam*=-1;
         l+=tam;
//         cout << "> " << tot << endl;
      }
      return 0;
   }
   bool valid = 1;
   int beru = (n-1)*(k+1) + 1;
   int sisa = beru % n;
   beru = (beru)/n;
   if(a[n-sisa+1].first < beru+1) valid = 0;
   if(a[1].first < beru) valid = 0;
   if(!valid) cout << "-1\n";
   else{
      cout << tot << endl;
      bool spas = 0;
      while(tot!=0){
         for(int i=n;i>=1;i--){
            if(a[i].first == 0) continue;
            a[i].first--;  
            if(spas) cout << " ";
            spas = 1;
            cout << a[i].second;
            tot--;
         }
      }
      cout << endl;
   }
   */
	return 0;
}


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

using namespace std;

int main(){
	int n,m,res,a;
	cin>>n>>m;
	vector<int> lista,dist;
	for(int i=0;i<m;i++){
		cin>>a;
		lista.push_back(a);
	}
	res=0;
	sort(lista.begin(),lista.end());
	for(int j=0;j<lista.size()-1;j++){
		dist.push_back(lista[j+1]-lista[j]);
		res+=lista[j+1]-lista[j];
	}
	sort(dist.begin(),dist.end());
	reverse(dist.begin(),dist.end());
	for(int j=0;j<n-1;j++){
		if(j<dist.size()) res-=dist[j];
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
int main() {
  int a, b, c, d;
  std::cin >> a >> b >> c >> d;
  int e = c - a;
  int f = d - b;
  int g = e - f;
  int h = e + f;
  int i = -f;
  int j = e;
  std::cout << g + a << ' ' << h + b << ' ' << i + a << ' ' << j + b << std::endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                {
                    let mut out = Vec::<u8>::new();
                    solve($input,&mut out);
                    let out_str =str::from_utf8(&out).unwrap();
                    assert_eq!(&out_str, &$output);
                }
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
#[allow(unused_mut)]
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, isize1) => {
        read_value!($iter, isize) - 1
    };
    ($iter:expr,str) => {
        $iter.next().unwrap()
    };

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

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

#[allow(dead_code)]
fn to_yesno(yesno: bool) -> &'static str {
    if yesno {
        "Yes"
    } else {
        "No"
    }
}

fn main() {
    let mut out = std::io::stdout();

    solve(&stdin!(), &mut out);
}

#[allow(unused_mut)]
fn solve<W: std::io::Write>(src: &str, out: &mut W) {
    #[allow(unused_macros)]
    macro_rules! out {
        ($arg:expr) => {{
            let _ = out.write_fmt(format_args!("{}",$arg));
        }};
        ($fmt:expr, $($args:tt)*) => {{
            let _ = out.write_fmt(format_args!($fmt, $($args)*));
        }};
    }
    #[allow(unused_macros)]
    macro_rules! outln {
        ($arg:expr) => {{
            out!("{}\n",$arg);
        }};
        ($fmt:expr, $($args:tt)*) => {{
            out!(concat!($fmt, "\n"), $($args)*);
        }};
    }

    input! {
        source = src,
        x:usize,
    }

    out!(if x == 1 { 0 } else { 1 });
}
test! {}


Measured memory_bytes: 2160
A = list(input().split())
a_list = []
a = ''
for i in range(int(A[0])):
    a += A[1]
a_list.append(a)
b = ''
for i in range(int(A[1])):
    b += A[0]
a_list.append(b)
a_list.sort(reverse=False)
print(a_list[0])

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;
struct edge { ll from; ll to; ll cost; };


int main() {
	int w, h;
	cin >> w >> h;
	vector<pair<ll,int>>edges;

	rep(i, 0, w) {
		ll p;
		cin >> p;
		edges.pb({p,0});
	}

	rep(i, 0, h) {
		ll q;
		cin >> q;
		edges.pb({ q,1 });
	}

	sort(all(edges));

	w++;
	h++;

	ll ans = 0;
	fore(e,edges) {
		if (e.second == 0) {
			ans += h*e.first;
			w--;
		}
		else {
			ans += w * e.first;
			h--;
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 6384
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int n;
	cin >> n;
	int c=0;
	c=n%10;
	if(c==3){
		cout << "bon"<<endl;
	}
	else if(c==2 || c==4 || c==5 || c==7 || c==9)
		cout << "hon" << endl;
	else cout << "pon" << endl;
	
	return 0;
}

Measured memory_bytes: 3640
//R<3S
#include <bits/stdc++.h>
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define initarr(a,n,x) for (int i=0;i<n;++i) a[i]=x
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define invect(data,n) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);}
#define inset(data,n) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.insert(tmp);}
#define ll long long
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


using namespace std;

void solve()
  {

	int k,a,b;cin>>k>>a>>b;
	int div=a/k;
	if(a%k==0){cout<<"OK";return;}
	div++;
	if(div*k<=b){cout<<"OK";return;}
	cout<<"NG";
  }



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


   return 0;
}


Measured memory_bytes: 3636
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3

output:
0 0
1 2
2 2
3 1
4 3
"""

import sys
import heapq as hp

WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(5e10 + 1)


def generate_adj_table(v_table):
    for each in v_table:
        v_index, v_adj_length, *v_adj_list = map(int, each)
        # assert len(v_adj_list) == v_adj_length * 2
        for pair in zip(v_adj_list[::2], v_adj_list[1::2]):
            init_adj_table[v_index][pair[0]] = pair[1]

    return init_adj_table


def dijkstra_path_heap():
    # path search init
    path_list[init_vertex_index] = 0
    path_heap = []
    # heapq: rank by tuple[0], at here it's d[u]
    hp.heappush(path_heap, (0, init_vertex_index))

    while len(path_heap) >= 1:
        current_vertex = hp.heappop(path_heap)[1]

        color[current_vertex] = BLACK

        for adj_vertex, adj_weight in adj_table[current_vertex].items():
            if color[adj_vertex] is not BLACK:
                # alt: d[u] + w[u,v]
                alt_path = path_list[current_vertex] + adj_weight
                if alt_path < path_list[adj_vertex]:
                    # update path_list
                    path_list[adj_vertex] = alt_path
                    # update heap
                    hp.heappush(path_heap, (alt_path, adj_vertex))
                    parent_list[adj_vertex] = current_vertex
                    color[adj_vertex] = GRAY

    return path_list


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num = int(_input[0])
    init_vertices_table = map(lambda x: x.split(), _input[1:])
    # assert len(init_vertices_table) == vertices_num

    parent_list, path_list = [-1] * vertices_num, [D_MAX] * vertices_num
    color = [WHITE] * vertices_num
    init_adj_table = tuple(dict() for _ in range(vertices_num))
    init_vertex_index = 0

    adj_table = generate_adj_table(init_vertices_table)
    ans = dijkstra_path_heap()
    for i, v in enumerate(ans):
        print(i, v)

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

using namespace std;

int main(){
    
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    
    if (x>=r&&y>=r&&x+r<=w&&y+r<=h)cout << "Yes" << endl;
    else cout << "No" << endl;
    
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  string S;
  cin >> N >> S;

  VI ws(N+1), ss(N+1);
  REP(i,N){
	ws[i+1] = ws[i] + (S[i] == 'W');
	ss[i+1] = ss[i] + (S[i] == 'E');
  }
  

  int ans = N;
  REP(i,N){
	mini(ans, ws[i] + ss[N] - ss[i+1]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2964
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main()
{
    string str;
    cin >> str;
    int len = (int)str.length();
    int s[len - 2];
    for (int i = 0; i < len - 2; i++){
        s[i] = 100*(str[i] - '0') + 10*(str[i + 1] - '0') + (str[i + 2] - '0');  
        s[i] = abs(753 - s[i]);  
    }
    sort(s,s+len-2);
    cout << s[0] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	
	
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		String s = sc.next();
		int count = 0;
		for (int i=0;i<n;i++) {
			if (s.charAt(i)=='L' && (i==0 || s.charAt(i-1)=='R')) {
				count++;
			} else if (s.charAt(i)=='R' && (i==n-1 || s.charAt(i+1)=='L')) {
				count++;
			}
		}
		
		System.out.println(n-Math.max(1,count-2*k));
	}
}

Measured memory_bytes: 25556
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
  int n, W;
  cin>>n>>W;
  int v[n], w[n];
  for(int i=0; i<n; ++i)
  {
    cin>>w[i]>>v[i];
  }
  int dp[W+1]={}, dp_[W+1]={};
  for(int i=0; i<=W; ++i)
  {
      if(w[0]<=i)
        dp[i]=v[0];
  }
  for(int i=1; i<n; ++i)
  {
      for(int j=0; j<=W; ++j)
      {
          dp_[j]=dp[j];
          if(w[i]<=j)
            dp_[j]=max(dp_[j], dp[j-w[i]]+v[i]);
      }
      for(int j=0; j<=W; ++j)
        dp[j]=dp_[j];
  }
  cout<<dp[W];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    string s;
    cin >> s;
    int n=s.size();
    if (s.at(n-1)=='1' || s.at(0)=='0') {cout << -1 << endl;return 0;}
    rep(i,n/2){
        if (s.at(i)!=s.at(n-2-i)) {cout << -1 << endl;return 0;}
    }
    s.at(n-1)='1';
    vector<int> a(0);
    rep(i,n){
        if (s.at(i)=='1') a.push_back(i+1);
    }
    rep(i,n-1){
        auto it=upper_bound(all(a),i+1);
        cout << i+1 << " " << *it << endl;
    }
}


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

#define int long long

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

const int mod = 1e9+7;

int N;
auto dp = vectors(111, 9, 9, 9, -1); // dp[i][x][y][z]: i文字目までみたとき、iの3文字前がx、2文字前がy、1文字前がzのとき、AGC文字列以外の組み合わせの数
vector<int> AGCT = {'A', 'G', 'C', 'T'}; // 使用する文字リスト
// 文字とDPに使うインデックスの対応付け
map<char, int> mp = {
  {'A', 1},
  {'G', 2},
  {'C', 3},
  {'T', 4},
  {'*', 5},
};

// 渡されたリストがAGCになるかの判定
bool isAGC(vector<int> C) {
  return C[0] == 'A' and C[1] == 'G' and C[2] == 'C';
}

int rec(int idx, int c3, int c2, int c1) {
  if (idx >= N) {
    return !isAGC({c3, c2, c1});
  }

  if (dp[idx][mp[c3]][mp[c2]][mp[c1]] != -1) {
    return dp[idx][mp[c3]][mp[c2]][mp[c1]];
  }

  int ret = 0;

  for (char now : AGCT) {
    vector<int> t = {c3, c2, c1, now};
    bool ok = true;

    // tがAGC文字列になるかを判定する
    if (isAGC({c3, c2, c1}) or isAGC({c2, c1, now})) {
      ok = false;
    }

    // tをスワップしてAGC文字列になるかを判定する
    for (int i = 0; i < AGCT.size()-1; i++) {
      vector<int> tt = t;
      swap(tt[i], tt[i+1]);
      if (isAGC({tt[0], tt[1], tt[2]}) or isAGC({tt[1], tt[2], tt[3]})) {
        ok = false;
      }
    }

    // tがAGC文字列にならないなら遷移させる
    if (ok) {
      Add(ret, rec(idx + 1, c2, c1, now));
    }
  }

  return dp[idx][mp[c3]][mp[c2]][mp[c1]] = ret;;
}

signed main() {
  cin >> N;

  int ans = rec(0, '*', '*', '*');

  cout << ans << endl;

  return 0;
}


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

using namespace std;
#define ll long long
#define ld long double

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int n;
    cin >> n;
    int x = ceil(n / 1.08);
    if((int)floor(x * 1.08) == n) cout << x << endl;
    else cout << ":(" << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
    
int main() {
    long long h, w;
    cin >> h >> w;

    if(h == 1 || w == 1) {
        cout << 1 << endl;
    } else {
        cout << (h+1)/2*((w+1)/2) + h/2*(w/2) << endl;
    }
}

Measured memory_bytes: 256
N_MAX = 200000
MOD = 10**9 + 7
fac, finv, inv = [0]*N_MAX, [0]*N_MAX, [0]*N_MAX
def com_init():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, N_MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

def com(n, k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD



def main():
    n, k = map(int, input().split()) 
    if n == k:
        for i in range(1,k+1):
            if i==1:print(1)
            else:print(0)
        return
    com_init()
    for i in range(1,k+1):
        b = k
        r = n-k
        ans = com(b-1,i-1) * com(r-1, i-1) * 2 + com(b-1,i-1) * com(r-1, i-1-1) + com(b-1,i-1) * com(r-1, i+1-1)
        print(ans%MOD)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 27084
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main()
{
    int N, M;
    string ab;
    int ai, bi;
    cin >> N >> M;
    cin >> ab;
    map<int, map<int, int>> mat;
    for(int i=0;i<M;i++){
        cin >> ai >> bi;
        if(mat.count(ai-1)==0) mat[ai-1] = map<int, int>();
        if(mat.count(bi-1)==0) mat[bi-1] = map<int, int>();
        mat[ai-1][bi-1] = ab[bi-1]=='A'? 1:2;
        mat[bi-1][ai-1] = ab[ai-1]=='A'? 1:2;
    }
    set<int> goodV;
    queue<int> checkList;
    for(auto m : mat){ goodV.insert(m.first); }
    for(auto m : mat){ checkList.push(m.first); }
    while(!(checkList.empty())){
        int i = checkList.front();
        checkList.pop();
        bool haveA = false;
        bool haveB = false;
        if (mat.count(i)==0) continue;
        for(auto itr2=mat[i].begin();itr2 != mat[i].end(); itr2++){
            if((*itr2).second==1) haveA = true;
            if((*itr2).second==2) haveB = true;
        }
        if ( !(haveA && haveB) ){
            goodV.erase(i);
            vector<int> eraseList;
            for(auto itr2=mat[i].begin();itr2 != mat[i].end(); itr2++){
                int j = (*itr2).first;
                checkList.push(j);
                //mat[j].erase(i);
                eraseList.push_back(j);
            }
            for(auto iE : eraseList) mat[iE].erase(i);
            mat.erase(i);
        }
    }
    if(goodV.size()!=0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 41988
#include<iostream>
using namespace std;
int a[200010];
int b[200010];
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int c,d;
		cin>>c>>d;
		if(c==1) a[d]=1;
		if(d==n) b[c]=1;
	}
	for(int i=1;i<n;i++){
		if(a[i]==1&&b[i]==1){
			cout<<"POSSIBLE"<<endl;
			return 0;
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    ll X,K,D;
    cin >> X >> K >> D;
    X = abs(X);
    if (log10(K) + log10(D) < log10(X)) OUT(X-K*D)
    else {
        ll d = X / D;
        if ((K-d) % 2 == 0) OUT(X-d*D)
        else OUT(abs(X-d*D-D));
    }

    return 0;
}

Measured memory_bytes: 3908
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
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;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
ll n,maxn=-INF;
string a[200005];
map<string,ll> m;
set<string> s[200005];
int main()
{
    //IOS;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    for(int i=1;i<=n;i++)
    {
        maxn=max(maxn,m[a[i]]);
        s[m[a[i]]].insert(a[i]);
    }
    for(auto i:s[maxn])
    {
        cout<<i<<endl;
    }
    return 0;
}
/*

*/


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

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

lst = [[0] * (N + 1) for _ in range(N + 1)]

for _ in range(M):
    L, R = map(int, input().split())
    for l in range(L + 1):
        lst[l][R] += 1

for l in range(N + 1):
    for r in range(N):
        lst[l][r + 1] += lst[l][r]

# for tmp in lst:
#     print (tmp)

for _ in range(Q):
    p, q = map(int, input().split())
    print (lst[p][q])

Measured memory_bytes: 54876
/*
AizuOnline A1130
Red and Black
*/
#include <stdio.h>

char tile[20][21];
int W,H;

void find_start(int * x,int * y)
{
  int i,j;

  for(i=0;i<H;i++)
    for(j=0;j<W;j++)
      if(tile[i][j] == '@')
	{
	  *x = j;
	  *y = i;
	  return;
	}
  *x=*y=0;
}
int count_black(x,y)
{ int ret;
  ret=0;

  if(tile[y][x]=='@' || tile[y][x]=='.')
    {
      ret=1;
      tile[y][x]='*';
      if(x < W-1)
	ret += count_black(x+1,y);
      if(x > 0)
	ret += count_black(x-1,y);
      if(y < H-1)
	ret += count_black(x,y+1);
      if(y > 0)
	ret += count_black(x,y-1);
    }
  return(ret);
}

main()
{
  int i,x,y,ret;

  while(EOF!=scanf("%d %d",&W, &H) && ((W > 0) || (H > 0)))
    {
      for(i=0;i<H;i++)
	scanf("%s",&(tile[i][0]));

      find_start(&x,&y);

      ret=count_black(x,y);

      printf("%d\n",ret);
    }


return(0);
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	list<ll> l;
	string s;
	ll Q, t, f;
	char c;
	
	cin >> s >> Q;
	zep(i, 0, s.size()){
		l.push_back(s[i]-'a');
	}
	
	bool jun = true;
	zep(i, 0, Q){
		cin >> t;
		if(t == 1){
			jun = !jun;
		}
		else{
			cin >> f >> c;
			if((jun && f == 2) || (!jun && f == 1)){
				l.push_back(c-'a');
			}
			else{
				l.push_front(c-'a');
			}
		}
	}
	
	if(jun){
		for(auto it = l.begin(); it != l.end(); it++){
			cout << char(*it+'a');
		}
	}
	else{
		for(auto it = l.rbegin(); it != l.rend(); it++){
			cout << char(*it+'a');
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 10064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<char, int> P;
map <char,int> mp;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=100000;
static const int NMAX=50;
static const int MMAX=50;

int main(){
    string s; cin>>s;
    for(int i=0;i<s.size();i++) mp[s[i]]++;

    bool flag=true;
    for(auto p:mp){
        if(p.second%2)flag=false;
    }
    cout<<(flag?"Yes":"No")<<"\n";

    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,q,i,j=9;
    cin>>n;
    if (n>81) cout<<"No"<<endl;
    else
    {
      for (j=1;j<10;j++)
       {

        for (i=1;i<=9;i++)
        {
           if (i*j==n)
           {
               cout<<"Yes"<<endl;
               return 0;

           }

        }
       }
         cout<<"No"<<endl;

    }
}


Measured memory_bytes: 256
N = gets.to_i

end_with_a = 0
start_with_b = 0
intersection = 0
ans = 0

N.times do
 s = gets.chomp
 if s[0] == "B" && s[s.length-1] != "A"
   start_with_b += 1
 end

 if s[s.length-1] == "A" && s[0] != "B"
   end_with_a += 1
 end

 if s[0] == "B" && s[s.length-1] == "A"
   intersection += 1
 end


 0.upto(s.length-2) do |i|
   if s[i] == "A" && s[i+1] == "B"
     ans += 1
   end
 end
end
# puts ans
# puts start_with_b
# puts end_with_a
# puts intersection

ans += [intersection - 1, 0].max

if intersection >= 1
  if start_with_b >= 1
    ans += 1
    start_with_b -= 1
  end

  if end_with_a >= 1
    ans += 1
    end_with_a -= 1
  end
end

ans +=
  if start_with_b == 0 && end_with_a == 0
    0
  elsif start_with_b > end_with_a
    end_with_a
  else
    start_with_b
  end



puts ans


Measured memory_bytes: 1916
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int n,i,a,b;
string s;
int main ()
{
	scanf("%d%d",&a,&b);
	cin>>s;
	for(i=0;i<s.size();i++)
	{
		if(i==a)
		{
			if(s[i]!='-')
			{
				puts("No");
				return 0;
			}
			continue;
		}
		if(!(s[i]>='0'&&s[i]<='9'))
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int a, b, c, cnt, tmp;


int main() {

	cin >> a >> b >> c;

	while (c > tmp) {
		cnt++;
		tmp += a;
		if (cnt % 7 == 0)tmp += b;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 3112
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

LL N, a[312345];
LL ans;

int main()
{
	in >> N;
	rep(i, 3*N) { in >> a[i]; }

	int cou = 0;
	std::sort(a, a + 3 * N,std::greater<LL>());
	for (int i = 1; i < 3 * N; i += 2)
	{
		if (cou == N) { break; }
		ans += a[i];
		++cou;
	}

	out << ans << std::endl;
	return 0;
}

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

int main(){
  int n;
  string c;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> c;
    if(c == "Y"){
      cout << "Four" << endl;
      return 0;
    }
  }
  
  cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int a,b,c,d;
int main(void) {
  scanf("%d%d%d%d",&a,&b,&c,&d);
if(a>b&c>d){
printf("%d",(b+d));
}
if(a<b&c>d){
printf("%d",(a+d));
}
if(a>b&c<d){
printf("%d",(b+c));
}
if(a<b&c<d){
printf("%d",(a+c));
}
if(a==b&c<d){
printf("%d",(a+c));
}
if(a==b&c>d){
printf("%d",(a+d));
}
if(a<b&c==d){
printf("%d",(a+c));
}
if(a>b&c==d){
printf("%d",(b+c));
}
if(a==b&c==d){
printf("%d",(a+c));
}
 
 
 
 
  return 0;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T, class T2> void smin(T& a, T2 val) {if (a > val) a = val;}template<class T, class T2> void smax(T& a, T2 val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], b[N];

double getMedian(vector<int> &v){
   int n = (int)(v.size());
   if (n % 2){
      return v[n/2];
   }
   return (v[n/2] + v[n/2-1]) / 2.0;
}

int32_t main(){_
   
   cin>>n;

   vector<int> v, A;
   for (int i = 0; i < n; ++i)
   {
      cin>>a[i]>>b[i];
      v.push_back(a[i]);
      A.push_back(b[i]);
   }


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


   if (n % 2){
      int low = getMedian(v);
      int high = getMedian(A);
      cout<<high - low + 1;
      exit(0);
   }
   else{
      double low = getMedian(v);
      double high = getMedian(A);      
      double ok = high - low;
      cout<<(int)(2*ok + 1);
      exit(0);
   }
   

   return 0;
}

Measured memory_bytes: 10104
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main(){
	string s;
	cin>>s;
	int c=0;
	int ans=0;
	for(int i=0;i<3;i++){
		if(s[i]=='R'){
			c++;
		}else{
			ans=max(ans,c);
			c=0;
		}
	}
    ans=max(ans,c);
	cout<<ans<<endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i <= Math.max(x, y); i++) {
            int xx = x - i;
            if(xx < 0) {
                xx = 0;
            }
            int yy = y - i;
            if(yy < 0) {
                yy = 0;
            }
            int tmp = (c * 2) * i + (a * xx) + (b * yy);
            ans = Math.min(tmp, ans);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35668
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String c = sc.next();
    boolean isVowel = ("a".equals(c)) ||
                      ("i".equals(c)) ||
                      ("u".equals(c)) ||
                      ("e".equals(c)) ||
                      ("o".equals(c)) ;

    System.out.println( isVowel ? "vowel" : "consonant" );
  }
}


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

using namespace std;

int main() {
    string s;
    getline(cin, s);
    for (int i = 0; i < s.length(); ++i) {
        if (65 <= s[i] && s[i] <= 90) {
            s[i] = tolower(s[i]);
        } else if (97 <= s[i] && s[i] <= 122) {
            s[i] = toupper(s[i]);
        }
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
const int mod = 1000000007;

ll gcd(ll a, ll b){return b ? gcd(b,a%b) : a;};//最大公約数
ll lcm(ll a, ll b){return a*b/gcd(a,b);};//最小公倍数
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
//ll a[100000];
//ll dom[100001];

int main(){
  ll n;
  cin>>n;
  if(n%2==1) cout<<0;
  else{
    ll ans=0;
    ll ch=1;
    ll tmp=10;
    while(ch){
      ans+=n/tmp;
      if(n>tmp) tmp*=5;
      else ch=0;
    }
    cout<<ans;
  }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
  typedef long long int ll;
int A, B, C;
cin >> A >> B >> C;
bool ans = false;
if(B - A == C - B)ans = true;
if(ans)cout << "YES" << endl;
else cout << "NO" << endl;
        return 0;
}

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

int main() {
    ll x,y;
    cin >> x >> y;
    ll now=x;
    int cnt=0;
    while(now<=y){
        now*=2; 
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int w[30][30];
int &pos(int y,int x){
  return w[y+10][x+10];
}

int main(){
  const int d[3][5][5] ={
    {
      {0,0,0,0,0},
      {0,0,1,0,0},
      {0,1,1,1,0},
      {0,0,1,0,0},
      {0,0,0,0,0}
    },
    {
      {0,0,0,0,0},
      {0,1,1,1,0},
      {0,1,1,1,0},
      {0,1,1,1,0},
      {0,0,0,0,0}
    },
    {
      {0,0,1,0,0},
      {0,1,1,1,0},
      {1,1,1,1,1},
      {0,1,1,1,0},
      {0,0,1,0,0}
    }
  };
  int x,y,s;

  while(~scanf("%d,%d,%d",&x,&y,&s)){
    s -= 1;
    x -= 2;
    y -= 2;
    REP(i,5) REP(j,5)
      pos(x+i,y+j) += d[s][i][j];
  }
  int bl = 0;
  int mx = 0;
  REP(i,10) REP(j,10){
    if(pos(i,j) == 0) bl++;
    mx = max(mx, pos(i,j));
  }
  cout << bl << endl << mx << endl;
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>

using namespace std;

#undef LONG_MAX
#undef LONG_MIN

#define LONG_MAX	9223372036854775807
#define LONG_MIN	(-LONG_MAX  -1)

#define ll long long

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {
	string s;
	string t;
	ll cnt = 0;
	
	cin >> s >> t;
	

	REP(i, 3) {
		if(s[i] == t[i]) {
			cnt++;
		}
	}

	
	
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
num1 = int(input())
arr1 = list(map(int,input().split()))

num2 = int(input())
arr2 = list(map(int,input().split()))

count = 0

for i in range(num2):
    try:
        a = arr1.index(arr2[i])
        count +=1
    except:
        pass

print(count)



Measured memory_bytes: 6552
#include <iostream>

using namespace std;

int main ()
{
	for (int u = 0; u < 100; u++)
	{
		int n,a[100][5];

		cin >> n;
		if (n == 0)
		{
			break;
		}

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < 5; j++)
			{
				cin >> a[i][j];
			}
		}
		int gg = 0,ggg = 1000,co;

		for (int i = 0; i < n; i++)
		{
			co = 0;
			for (int j = 0; j < 5; j++)
			{
				co += a[i][j];
			}

			if (gg < co)
			{
				gg = 0;
				gg = co;
			}
			if (ggg > co)
			{
				ggg = 0;
				ggg = co;
			}
		}

		cout << gg << " " << ggg << endl;
	}
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v) for (auto &&V : v)
#define all(x) (x).begin(), (x).end()
using lint = long long;
const int INF = 1 << 29;
const double EPS = 1e-9;
using namespace std;

template <typename T>
class SegmentTree {
  template <typename B>
  struct BinaryOperation {
    const static B unit = numeric_limits<B>::max();
    B operator()(const B &a, const B &b) const { return min(a, b); }
  };
  BinaryOperation<T> bo;
  const T   unit;
  vector<T> tree;
  int v_size;

  public:
  SegmentTree(const int n = 0, const T unit = BinaryOperation<T>::unit) : unit(unit) { init(n); }
  SegmentTree(const vector<T> &v, const T unit = BinaryOperation<T>::unit) : unit(unit) { init(v); }
  void init(int n) {
    v_size = 1;
    while (v_size < n) v_size <<= 1;
    tree.assign(2 * v_size, unit);
  }
  void init(const vector<T> &v) {
    init(v.size());
    copy(v.begin(), v.end(), tree.end() - v_size);
    for (int i = v_size - 1; i > 0; --i) tree[i] = bo(tree[i * 2], tree[i * 2 + 1]);
  }
  void update(int i, const int x) {
    i += v_size;
    tree[i] = x;
    while (i >>= 1) tree[i] = bo(tree[i * 2], tree[i * 2 + 1]);
  }
  T query(int l, int r) const {
    T ret = unit;
    for (l += v_size, r += v_size; l < r; l = (l + 1) >> 1, r >>= 1) {
      if (l & 1) ret = bo(ret, tree[l]);
      if (r & 1) ret = bo(ret, tree[r - 1]);
    }
    return ret;
  }
  int size(void) const { return v_size; }
  T   operator[](const int i) const { return tree[i + v_size]; }
};

int main(void) {
  int n, q;
  cin >> n >> q;
  SegmentTree<int> st(n);
  vector<int> c(q), x(q), y(q);
  rep (i, q) {
    cin >> c[i] >> x[i] >> y[i];
  }
  rep (i, q) {
    if (c[i]) {
      cout << st.query(x[i], y[i] + 1) << endl;
    } else {
      st.update(x[i], y[i]);
    }
  }
  return 0;
}


Measured memory_bytes: 4928
#include<stdio.h>
int main ()
{
   int a,b,c,d,e;
   scanf ("%d %d %d",&a,&b,&c);
   d=a-b;
   e=c-d;
   if (d>=0&&e>=0)
   {
       printf ("%d\n",e);
   }
   else
   {
       printf ("0\n");
   }
   return 0;
}


Measured memory_bytes: 1704
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;

constexpr int INF = 1e9;
constexpr ll BIGINF = 1e18;
constexpr double EPS = 1e-16;
constexpr int MOD = 1e9 + 7;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int n;

void input() {
  cin >> n;
}

void solve() {
  ll ans = 1;

  for (int i = 0; i < n; ++i) {
    ans *= i + 1;
    ans %= MOD;
  }

  cout << ans;
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve();
}


Measured memory_bytes: 256