akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};


const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}



int main(){
    ll N,K; cin >> N >> K;
    init();
    for (int i = 1; i <= K; i++){
        ll ans = ( COM(N-K+1, i)*COM(K-1, i-1) )%MOD;
        cout << ans << endl;
    }
}

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

using namespace std;

int main(){
    int H, W, A, B; cin >> H >> W >> A >> B;
    vector<vector<int>> v(H, vector<int>(W, 0));
    for(int i=0;i<B;i++){
        for(int j=A;j<W;j++) v[i][j] = 1;
    }
    for(int i=B;i<H;i++){
        for(int j=0;j<A;j++) v[i][j] = 1;
    }
    for(auto& r : v){
        for(auto& t : r) cout << t;
        cout << endl;
    }
}

Measured memory_bytes: 5120
#include <stdio.h>
#include <string.h>
int main()
{
  int n,c;
  char s[100];
  scanf("%d",&n);
  (void) getchar();
  scanf("%s",s);
  for (int i = 0; i < n; i++) {
    if ( s[i] == 'R' ) c++;
    else c--;
  }
  if( c > 0 ) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll chk(vvP& to, ll pat, ll p, ll u, ll v) {
  if (u == v) return pat;
  for (P ue : to[u]) {
    ll unx, enx;
    tie(unx, enx) = ue;
    if (unx == p) continue;
    ll ret = chk(to, pat | (1LL << enx), u, unx, v);
    if (ret > 0) return ret;
  }
  return 0;
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, m;
  cin >> n;

  vvP to(n);
  rep(i, n - 1) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    to[a].emplace_back(b, i);
    to[b].emplace_back(a, i);
  }

  cin >> m;

  vll pats(n - 1, 0);
  rep(i, m) {
    ll u, v;
    cin >> u >> v;
    u--, v--;
    ll pat = chk(to, 0, -1, u, v);
    rep(j, n - 1) {
      if ((pat >> j) & 1) pats[j] |= (1LL << i);
    }
  }

  vll dp(1 << m, 0);
  dp[0] = 1;
  rep(i, n - 1) {
    vll ndp = dp;
    rep(s, 1 << m) {
      ll t = s | pats[i];
      ndp[t] += dp[s];
    }
    swap(ndp, dp);
  }

  cout << dp.back() << endl;

  return 0;
}


Measured memory_bytes: 20016
#include <stdio.h>

int main(){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int max = 0;
    int min = 10001;
    int middle = 0;
    
    if(a > max) max = a;
    if(b > max) max = b;
    if(c > max) max = c;

    if(a < min) min = a;
    if(b < min) min = b;
    if(c < min) min = c;
    
    middle = (a+b+c) - max - min;

    printf("%d %d %d\n", min, middle, max);
}


Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,LL> PL;

const int MOD=998244353;
int INF=100100100;
LL dp[3010][3010];

LL add(LL a,LL b){
  return (a+b)%MOD;
}
LL prod(LL a,LL b){
  return (a*b)%MOD;
}
int main(){
  LL n,s;cin>>n>>s;
  LL a[3010];
  for(LL i=1;i<=n;i++)cin>>a[i];
  dp[0][0]=1;
  for(LL i=0;i<=n;i++){
    for(LL j=0;j<=s;j++){
      dp[i+1][j]=add(dp[i+1][j],prod(2,dp[i][j]));
      if(j+a[i+1]<=s)dp[i+1][j+a[i+1]]=add(dp[i+1][j+a[i+1]],dp[i][j]);
      //cout<<dp[i][j]<<" ";
    }
//cout<<endl;
  }
  cout<<dp[n][s]<<endl;
  return 0;
}

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

int main(){
	string s;
	ll ans = 10000000;
	cin >> s;
	ll len = s.size(); 
	for(ll i=0;i<len-1;i++){
		if(s[i]!=s[i+1]){
			ans = min(ans,max(i+1,len-i-1));
		}
	}
	if(ans>len)ans=len;
	cout << ans << endl;
}

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

int main(void){
  int a,b,cnt=0,sum=0,sum2=0;
  char ch;

  while(cin>>a>>ch>>b){
    sum += a * b;
    sum2 += b;
    cnt++;
  }
  cout<<sum<<endl<<round((double)sum2/cnt)<<endl;

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main()
{
long long int sum,a,b,c,k;
cin>>a>>b>>c>>k;
if(k<=a) sum=k;
else
{
if(k-a<=b) sum=a;
else sum=2*a-k+b;
}
cout<<sum;
return 0;
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
string s;
  cin >> s;
  long int n,k,i;
  n=0;
  k=0;
  for(i=0;i<s.size();++i)
  {
  n=n+int(s.at(s.size()-1-i)-'0')*pow(10,i);
  k=k+int(s.at(i)-'0');
  }
  if(n%k==0) cout <<"Yes";
  else cout << "No";

return 0;
}

Measured memory_bytes: 4012
program one_two_three_triangle
  implicit none
  integer :: n, a(1000000) = 0, m, i, j
  character(1000000) :: s
  logical :: f = .false.
  read(*,*) n
  read(*,*) s
  do i = 1, n
    a(i) = ichar(s(i:i)) - 49
    if (a(i) == 1) f = .true.
  end do
  do i = 1, n
    if (a(i) == 2) a(i) = merge(0, 1, f)
  end do
  do i = 31, 0, -1
    if (.not.btest(n - 1, i)) cycle
    m = lshift(1, i)
    n = n - m
    do j = 1, n
      a(j) = xor(a(j), a(j + m))
    end do
  end do
  write(*,'(i0)') a(1) * merge(1, 2, f)
end program one_two_three_triangle

Measured memory_bytes: 8392
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int H, W, K;
    cin >> H >> W >> K;

    vector<vector<int> > S(H, vector<int>(W));
    REP(i, H) {
        string s;
        cin >> s;
        REP(j, W) S[i][j] = s[j] - '0';
    }

    vector<vector<int> > acum_row(H, vector<int>(W));

    REP(i, H) {
        if(S[i][0] == '1') acum_row[i][0] = 1; 
        FOR(j, 1, W-1)
            if(S[i][j] == '1') acum_row[i][j] = acum_row[i][j-1] + 1;
            else acum_row[i][j] = acum_row[i][j-1];
    }

    int ans = 2000;
    for(int i=0; i < (1<<(H-1)); i++) {
        bool feasible = true;
        vector<int> group(H);
        int g = 0;
        REP(h, H) {
            group[h] = g;
            if((i >> h) & 1) g++;
        }
        g++;
        vector<int> counts(g);
        int tmp_ans = g - 1;

        REP(w, W) {
            vector<int> counts_in_col(g);
            REP(h, H) counts_in_col[group[h]] += S[h][w];

            bool do_partition = false;
            REP(g_idx, g) {
                if(counts[g_idx] + counts_in_col[g_idx] > K) do_partition = true;
                if(counts_in_col[g_idx] > K) feasible = false;
            }

            if(do_partition) {
                tmp_ans++;
                counts = counts_in_col;
            } else {
                REP(g_idx, g) counts[g_idx] += counts_in_col[g_idx];
            }
        }
        if(feasible && ans > tmp_ans) ans = tmp_ans;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
def main():
    n, k = map(int, input().split())

    if n == k:
        ans = 0
    elif n > k:
        a = n // k
        ans = min(n - a * k, abs(n - (a + 1) * k))
    elif n < k:
        ans = min(n, k - n)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61900
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: usize = sc.read();
    let b: usize = sc.read();
    let c: usize = sc.read();
    println!("{}", std::cmp::min(c, b / a));
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

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


Measured memory_bytes: 8572
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 x, y;
  cin >> x >> y;
  if (x % y != 0)
    cout << x << endl;
  else
    cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

type scanner struct {
	sc *bufio.Scanner
}

func (sc *scanner) next() string {
	sc.sc.Scan()
	return sc.sc.Text()
}

func (sc *scanner) nextInt() int {
	i, err := strconv.Atoi(sc.next())
	if err != nil {
		panic(err)
	}
	return i
}

func newScanner(r io.Reader) *scanner {
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)
	return &scanner{
		sc: sc,
	}
}

var sc = newScanner(os.Stdin)

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	n := sc.nextInt()
	k := sc.nextInt()
	x := sc.nextInt()
	y := sc.nextInt()
	fmt.Println(min(n, k)*x + max(n-k, 0)*y)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define M 1000000007
#define pb push_back
#define ll long long int
using namespace std;

int main()
{

	int n;
	cin>>n;
	int h[n];
	int i;
	for(int i = 0;i<n;i++)
		cin>>h[i];
	int dp[n];
	dp[n-1] = 0;
	dp[n-2] = abs(h[n-2]-h[n-1]);
	for(i=n-3;i>=0;i--)
	{
		dp[i] = min(dp[i+1]+abs(h[i]-h[i+1]),dp[i+2]+abs(h[i]-h[i+2]));
	}
	cout<<dp[0]<<"\n";
	return 0;

}


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

int main(){
  int n;
  cin >> n;
  int a, b;
  int sum=0;
  for(int i=0; i<n; ++i){
    cin >> a >> b;
    sum += b-a+1;
  }

cout << sum << endl;
}
    

Measured memory_bytes: 256
use proconio::input;
use itertools::Itertools;

fn main() {
    input! {
        base: String,
    }
    input! {
        modded: String,
    }
    let mut shorten = modded.clone();
    shorten.truncate(base.len());
    if (shorten == base) {
        println!("Yes");
    }
    else {
        println!("No");
    }
}


Measured memory_bytes: 2168
#include <limits>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <unordered_set>
#include <vector>
using namespace std;

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

	for(int n; cin >> n && n;) {
		vector<int> powers(n);
		for(auto &e : powers) cin >> e;

		const int total = accumulate(powers.begin(), powers.end(), 0);
		unordered_set<int> s{0};
		for(const auto &p : powers) {
			unordered_set<int> tmp(s);
			for(const auto &sum : tmp) {
				s.insert(sum + p);
			}
		}

		int ans = numeric_limits<int>::max();
		for(const auto &sum : s) {
			ans = min(ans, abs(sum - (total - sum)));
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read() {
    ll x=0,f=1; char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())
        if(ch=='-')f=-f;
    for(;ch>='0'&&ch<='9';ch=getchar())
        x=x*10+ch-'0';
    return x*f;
}
inline void chkmin( int &a,int b ) { if(a>b) a=b; }
inline void chkmax( int &a,int b ) { if(a<b) a=b; }
#define _ read()
#define ln endl
const int N=1e5+5;
int n,m,ans;
priority_queue< int > q;
struct node { int a,b; }a[N];
inline bool cmp( node a,node b ) { return a.a<b.a; }
int main() {
	n=_; m=_;
	for( int i=1;i<=n;i++ ) a[i].a=_,a[i].b=_;
	sort(a+1,a+n+1,cmp);
	int j=1;
	for( int i=1;i<=m;i++ ) {
		for(;j<=n;j++) if(a[j].a<=i) q.push(a[j].b); else break;
		if(!q.empty()) { ans+=q.top(); q.pop(); } 
	}
	cout<<ans<<ln;
}

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

using namespace std;

int main(){
	int n,m;
	cin>>n>>m;
	if(m<n){
		for(int i=0;i<n;i++){
			cout<<m;
		}
	}
	else{
		for(int i=0;i<m;i++){
			cout<<n;
		}
	}
}

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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

//using namespace __gnu_pbds;
using namespace std ;

typedef pair<int, int> pi ;
//typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const i64 mod = 1000000007LL ;

#define maxn 2000005

/*
     *os.find_by_order(k) -> returns the k'th smallest element (indexing starts from 0)
      os.order_of_key(v)  -> returns how many elements are strictly smaller than v
*/

int a[maxn] , zrc[maxn] , last[maxn] , dp[maxn] , dpSum[maxn] , sum[maxn] , cum[maxn] ;

int main()
{
    int n ;
    scanf("%d",&n) ;
    for(int i=1 ; i<=n ; i++) scanf("%d",&a[i]) ;

    for(int i=1 ; i<=n ; i++) cum[i] = (cum[i-1]^a[i]) ;
    for(int i=1 ; i<=n ; i++)
    {
        zrc[i] = zrc[i-1] ;
        if( cum[i]==0 ) zrc[i]++ ;
    }

    for(int i=1; i<=n ; i++)
    {
        if(cum[i]==0) continue ;

        if( last[ cum[i] ]!=0 )
        {
            int idx = last[cum[i]] ;
            dp[i] = (1LL*dpSum[idx]*( zrc[i]-zrc[idx] ) + sum[idx] + 1)%mod ;

            dpSum[i] = (dpSum[idx] + dp[i])%mod ;
            sum[i] = (1LL*dpSum[idx]*( zrc[i]-zrc[idx] ) + sum[idx])%mod ;
        }
        else{
            dp[i] = 1 ;
            dpSum[i] = 1 ;
        }
        last[ cum[i] ] = i ;
    }

    if( cum[n] != 0 ) printf("%d\n",dp[n]) ;
    else{
        int ans = 1 ;
        for(int i=1 ; i<zrc[n] ; i++) ans = (2LL*ans)%mod ;

        for(int i=1 ; i<=n ; i++) ans = (ans+dp[i])%mod ;

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


    return 0 ;
}


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

int main()
{
    int A, B, M, mn = 999999999, mn1 = 9999999999;
    cin >> A >> B >> M;
    int a[A], b[B];
    for(int i = 0; i < A; i++){
        cin >> a[i];
        if(a[i] < mn) mn = a[i];
    }
    for(int i = 0; i < B; i++){
        cin >> b[i];
        if(b[i] < mn1) mn1 = b[i];
    }

    int ans = mn + mn1;
    for(int i = 0; i < M; i++){
        int x, y, c;
        cin >> x >> y >> c;
        int sum = a[x - 1] + b[y - 1] - c;
        if(sum < ans) ans = sum;
    }

    cout << ans << endl;

    return 0;
}


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

int main(void){
    int a, b;
    std::cin >> a >> b;

    int doubleB = b * 2;

    int ans = std::max(0, a - doubleB);
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	if (n < 65)puts("0");
	else if (n <= 90)puts("1");
	else if (n < 97)puts("0");
	else if (n <= 122)puts("2");
	else puts("0");

	Please AC;
}


Measured memory_bytes: 3116
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
char a[1000005];
int n,ans=0;
int main() {
	scanf("%s",a+1);
	n=strlen(a+1);
	a[0]='0';
	for(int i=n;i>=0;i--){
		if(a[i]<'5'||(a[i]=='5'&&a[i-1]<'5'))ans+=a[i]-'0';
		else {
			a[i-1]++;
			ans+='9'-a[i]+1;
			int j=i-1;
			while(a[j]>'9'){
				a[j]='0';
				a[j-1]++;
				j--;
			}
			i=j+1;
		}
	}
	cout<<ans;
	return 0;
}

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

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

    vector<int> a(n);
    vector<int> b(n);
    for (auto i = 0; i < n - 1; i++) {
        cin >> a[i];
        b[a[i] - 1]++;
    }


    for (auto i = 0; i < n; i++) {
        cout << b[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 4840
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int x, y, sum;
		Scanner scanner = new Scanner(System.in);

		x = scanner.nextInt();
		y = scanner.nextInt();

		sum = x + (y / 2);

		System.out.println(sum);
	}

}

Measured memory_bytes: 21844
#include <stdio.h>

 int main(void){
 	int a, b, c;
 	scanf("%d%d%d", &a, &b, &c);

    int ispoor = 0;
    if (a == b && b != c) ispoor = 1;
    if (b == c && c != a) ispoor = 1;
    if (c == a && a != b) ispoor = 1;

    if (ispoor) {
        puts("Yes");
    } 
    else {
        puts("No");
   }
 
   return 0;
}

Measured memory_bytes: 3132
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in reversed(range(n)):
  if b[i]>=a[i+1]:
    a[i+1], b[i], ans = 0, b[i]-a[i+1], ans+a[i+1]
  else:
    a[i+1], b[i], ans = a[i+1]-b[i], 0, ans+b[i]
  if b[i]>=a[i]:
    a[i], b[i], ans = 0, b[i]-a[i], ans+a[i]
  else:
    a[i], b[i], ans = a[i]-b[i], 0, ans+b[i]
print(ans)

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

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

  map<int, int> dm;
  for (int i = 0; i < n; ++i) {
    int d;
    cin >> d;
    if (dm.find(d) == dm.end())
      dm.emplace(d, 0);
    dm[d]++;
  }

  cin >> m;

  vector<int> t(m);
  for (int i = 0; i < m; ++i)
    cin >> t[i];

  for (int i = 0; i < m; ++i) {
    if (dm.find(t[i]) == dm.end() || dm[t[i]] < 1) {
      cout << "NO" << endl;
      return 0;
    }
    dm[t[i]]--;
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))
#define cio ios::sync_with_stdio(false);

const int N = 2e5 + 10;
int n,k;
int a[N];

bool jud(int m)
{
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if (a[i]!=m) ans += a[i] / m;
        if (ans > k) {
        	return 0;
        }
    }
    if(ans<=k) {
    	return 1;
    }else {
    	return 0;
    }
}

int main()
{
    scanf("%d%d",&n,&k);
    int l = 1;
    int r = -1;
    for(int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        if (i == 1) {
            r = a[i];
        } else {
            r = max(r,a[i]);
        }
    }
    int ans = 1;
    while (l < r) {
        int m = (l + r) / 2;
        if(!jud(m)) {
        	l = m + 1;
        } else {
        	r = m;
            ans = m;
        }
    }
    printf("%d\n", r);
    return 0;
}


Measured memory_bytes: 4576
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>

using namespace std;



int main(int argc, char *argv[])
{
	int n, k;
	string s;

	//input
	cin >> n >> k;
	cin >> s;

	//calc
	s[k - 1] += 32;



	//ans
	cout << s << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int n;
	cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 0, pre = 0;
    for (int i = n-1; i >= 0; i--) {
        if (a[i] < pre - 1) {
            cout << -1 << endl;
            return 0;
        } else if (a[i] != pre - 1) {
            ans += a[i];
        }
        pre = a[i];
    }
    if (a[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1920
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0; i<n; i++)

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

    vector<ll> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];

    int ans = 0;
    rep(i, n) {
        if (x[i]*x[i] + y[i]*y[i] <= d*d) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6420
#include <iostream>
#include <cmath>

using namespace std;

int partialSum(int a) {
	int ans = 0;
	while(true) {
		if (a == 0) {
			break;
		}
		ans += a % 10;
		a /= 10;
	}
	return ans;


}


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

	int mimValue = 999999999;
	for (int i = 1; i < N; i++) {
		mimValue = min(mimValue, partialSum(i) + partialSum(N - i));
	}
	cout << mimValue << endl;

	return 0;
}

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

int hantei(string s) {
  int last = s.size()-1;
  if(s[last-5]=='e' && s[last-4]=='r' && s[last-3]=='a' && s[last-2]=='s' && s[last-1]=='e' && s[last]=='r')
    return 5;
  else if(s[last-4]=='e' && s[last-3]=='r' && s[last-2]=='a' && s[last-1]=='s' && s[last]=='e')
    return 4;
  else if(s[last-4]=='d' && s[last-3]=='r' && s[last-2]=='e' && s[last-1]=='a' && s[last]=='m')
    return 4;
  else if(s[last-6]=='d' && s[last-5]=='r' && s[last-4]=='e' && s[last-3]=='a' && s[last-2]=='m' && s[last-1]=='e' && s[last]=='r')
    return 6;
  else
    return -1;
}

int main() {
  string s;
  cin >> s;
  bool possible = true;
  while(s.size() != 0) {
    int h = hantei(s);
    if (h == -1) {
      possible = false;
      break;
    }
    else {
      for(int j =0; j < h+1; j++) {
        s.pop_back();
      }
    }
  }
  if (possible)
    cout << "YES" << endl;  
  else
    cout << "NO" << endl;

  return 0;
}


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

void solve(long long N, long long D, std::vector<std::vector<long long>> X) {
  long long count = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i >= j)
        continue;
      long double dist = 0;
      for (int d = 0; d < D; d++) {
	  dist += pow(X[i][d] - X[j][d], 2);
      }
      dist = sqrt(dist);
      if (fmod(dist,1) == 0) {
	  count++;
      }
    }
  }
  cout << count << endl;
}

// 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)
int main() {
  long long N;
  scanf("%lld", &N);
  long long D;
  scanf("%lld", &D);
  std::vector<std::vector<long long>> X(N, std::vector<long long>(D));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      scanf("%lld", &X[i][j]);
    }
  }
  solve(N, D, std::move(X));
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

constexpr int MAX_PR = 250000;

bool is_prime[MAX_PR];
vector<int> primes;

void solve(int N,int P){
    vector<int> v;

    int idx = upper_bound(all(primes),N) - primes.begin();
    for(int i=idx;i<idx+100;i++){
        for(int j=i;j<idx+100;j++){
            v.push_back(primes[i]+primes[j]);
        }
    }

    sort(all(v));
    cout << v[P-1] << endl;
}


int main(){
    // prime
    rep(i,MAX_PR) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i=2;i<MAX_PR;i++){
        if(is_prime[i]){
            for(int j=2;i*j<MAX_PR;j++) is_prime[i*j] = false;
        }
    }
    for(int i=2;i<MAX_PR;i++) if(is_prime[i]) primes.push_back(i);

    while(1){
        int n,p;
        cin >> n >> p;
        if(n==-1 and p==-1) break;
        solve(n,p);
    }
}



Measured memory_bytes: 3380
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int d = sc.nextInt();
		long g = sc.nextLong();

		int[] p = new int[d];
		int[] c = new int[d];
		int sum = 0;
		for (int i = 0; i < d; i++) {
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
			sum += p[i];
		}

		long[] dp = new long[sum + 1];
		Arrays.fill(dp, -1);
		dp[0] = 0;
		
		for (int i = 0; i < d; i++) {
			for (int j = sum; j >= 0; j--) {
				if (dp[j] < 0) {
					continue;
				}

				for (int k = 1; k <= p[i]; k++) {
					int score = 100 * (i + 1) * k;
					if (k == p[i]) {
						score += c[i];
					}
					dp[j + k] = Math.max(dp[j + k], dp[j] + score);
				}
			}
		}

		for (int i = 1; true; i++) {
			if (dp[i] >= g) {
				pr.println(i);
				break;
			}
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, a, b;
string s;

int main() {
    cin >> n >> a >> b >> s;
    int tot = 0, bb = 0;
    forn(i, n) if (s[i] == 'a') {
        if (tot < a + b) {
            printf("Yes\n");
            ++tot;
        } else {
            printf("No\n");
        }
    } else if (s[i] == 'b') {
        if (tot < a + b && bb < b) {
            printf("Yes\n");
            ++tot;
            ++bb;
        } else {
            printf("No\n");
        }
    } else {
        printf("No\n");
    }
    return 0;
}


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

int main() {
	int i,n;
	string S;
	cin>>S;
	n=S.size();
	for (i = 0; i <n; ++i)
	{
		S[i]='x';
	}
	cout<<S<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PL;
typedef pair<int,int> P;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

void solve(int n,int m) {
    vector<int> power3(n + 1,1); rep(i,n) power3[i + 1] = power3[i]*3;
    int init_state = 0;
    int a; cin >> a;
    rep(i,a) {int num; cin >> num;}
    int b; cin >> b;
    rep(i,b) {int num; cin >> num; init_state += power3[num - 1];}
    int c; cin >> c;
    rep(i,c) {int num; cin >> num; init_state += power3[num - 1]*2;}

    vector<int> dist(power3[n],-1);
    dist[init_state] = 0;
    queue<int> que;
    que.push(init_state);
    while (que.size()) {
        int p = que.front(); que.pop();
        int a_max = -1,b_max = -1,c_max = -1;
        for (int i = 0;i < n; i++) {
            if ((p/power3[i])%3 == 0) a_max = i;
            else if ((p/power3[i])%3 == 1) b_max = i;
            else  c_max = i;
        }

        if (a_max < b_max) {
            int q = p - power3[b_max];
            if (dist[q] < 0) {
                dist[q] = dist[p] + 1;
                que.push(q);
            }
        }

        if (a_max > b_max) {
            int q = p + power3[a_max];
            if (dist[q] < 0) {
                dist[q] = dist[p] + 1;
                que.push(q);
            }
        }

        if (b_max > c_max) {
            int q = p + power3[b_max];
            if (dist[q] < 0) {
                dist[q] = dist[p] + 1;
                que.push(q);
            }
        }

        if (b_max < c_max) {
            int q = p - power3[c_max];
            if (dist[q] < 0) {
                dist[q] = dist[p] + 1;
                que.push(q);
            }
        }
    }

    if (dist[0] < 0 && dist.back() < 0) cout << -1 << endl;
    else if (dist[0] < 0) {if (dist.back() <= m) cout << dist.back() << endl;}
    else if (dist.back() < 0) {if (dist[0] <= m) cout << dist[0] << endl;}
    else if (min(dist[0],dist.back()) <= m) cout << min(dist[0],dist.back()) << endl;
    else cout << -1 << endl;
}

int main() {
    while (1) {
        int n,m; cin >> n >> m;
        if (n == 0) return 0;
        solve(n,m);
    }
}


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

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

  if ((b / k) - (a / k) > 0) {
    cout << "OK" << endl;
  }
  else if ((a % k) == 0 && (b / k) - (a / k) == 0) {
    cout << "OK" << endl;
  }
  else {
    cout << "NG" << endl;
  }
}


Measured memory_bytes: 3592
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (r, g, b, n) = i.read4::<usize, usize, usize, usize>();
    writeln!(o, "{}", solve(r, g, b, n)).unwrap();
}
fn solve(r: usize, g: usize, b: usize, n: usize) -> usize {
    let mut count = 0;
    for r0 in 0..n / r + 1 {
        let n1 = n - r0 * r;
        for g0 in 0..(n - r0 * r) / g + 1 {
            let n2 = n1 - g0 * g;
            if n2 % b == 0 {
                count += 1;
            }
        }
    }
    count
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }

    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 4352
#include<stdio.h>
  
int main()
{
  int t[4][14];
  int n, i,j,c;
  char m, d;
  for(i=0; i < 4; i++){
    for(j=0; j < 14; j++){
      t[i][j]=0;
    }
  }
 scanf("%d", &c);
  for(i = 0; i < c; i++){
    scanf("%c", &d);
    scanf("%c %d", &m, &n);
    if(m == 'S'){
      t[0][n] = 1;
    }
    else if(m == 'H'){
      t[1][n] = 1;
    }
    else if(m == 'C'){
      t[2][n] = 1;
    }
    else if(m == 'D'){
      t[3][n] = 1;
    }
  }
  for(j=1; j < 14; j++){
    if(t[0][j] != 1){
      printf("S %d\n", j);
    }
  }
  
 for(j=1; j < 14; j++){
    if(t[1][j] != 1){
      printf("H %d\n", j);
    }
  }
  
 for(j=1; j < 14; j++){
    if(t[2][j] != 1){
      printf("C %d\n", j);
    }
  }
  
 for(j=1; j < 14; j++){
    if(t[3][j] != 1){
      printf("D %d\n", j);
    }
  }
 return 0;
}


Measured memory_bytes: 2088
n,m = map(int,input().split())

abl = []
for _ in range(n):
    a,b = map(int,input().split())
    abl.append((a,b))


abl = sorted(abl)

ans = 0
for a,b in abl:
    if m <= 0:
        break
    ans += min(b, m) * a
    m -= b
print(ans)



Measured memory_bytes: 54104
import java.util.Optional;
import java.util.Scanner;

public class Main {

    private static final String HELLO_WORLD = "Hello World";

    public static String process(TestCase testCase) {
        final int N = testCase.N;

        switch (N) {
            case 1:
                return HELLO_WORLD;
            case 2: {
                final int A = unsafeGet(testCase.A, "A");
                final int B = unsafeGet(testCase.B, "B");
                return String.valueOf(A + B);
            }
            default: {
                throw unknownN(N);
            }
        }
    }

    private static int unsafeGet(Optional<Integer> argument, String argumentName) {
        return argument.orElseThrow(() -> new IllegalArgumentException("Missing Argument " + argumentName));
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final String result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        switch (N) {
            case 1: {
                sc.close();
                return new TestCase(N);
            }
            case 2: {
                int A = sc.nextInt();
                int B = sc.nextInt();
                sc.close();
                return new TestCase(N, A, B);
            }
            default: {
                throw unknownN(N);
            }
        }
    }

    private static IllegalArgumentException unknownN(int N) {
        return new IllegalArgumentException("Unknown N: " + N);
    }

    private static void output(String result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;
        final Optional<Integer> A;
        final Optional<Integer> B;

        public TestCase(int N) {
            this.N = N;
            this.A = Optional.empty();
            this.B = Optional.empty();
        }

        public TestCase(int N, int A, int B) {
            this.N = N;
            this.A = Optional.of(A);
            this.B = Optional.of(B);
        }
    }
}


Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//�]���؂�グ�� =>  (a + b - 1) / b 

signed main(){
	char s; cin>>s;
  if(s=='a' || s=='i' || s=='u' || s=='e' || s=='o'){
    cout<<"vowel"<<endl;
  }
  else cout<<"consonant"<<endl;
	
	return 0;
}

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

int main()
{
    ll n,a,b,k,l;
    while(cin>>n>>a>>b){
        ll res=0;
        cin>>l;
        for(int i=1; i<n; i++){
            cin>>k;
            res+=min((k-l)*a,b);
            l=k;
        }
        cout<<res<<endl;
    }
    return 0;
}


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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXN=6005;
char s[MAXN];
string res[MAXN],dp;
int n,ca,cb,tot,a[MAXN],b[MAXN],rk[MAXN];
int main() {
	scanf("%d%s",&n,s+1);
	for(int i=1;i<=n*2;++i)if(s[i]=='a')a[++ca]=i,rk[i]=ca;else b[++cb]=i,rk[i]=cb;
	for(int i=1,lst=0;i<=n;++i)if(i==n||max(a[i],b[i])<min(a[i+1],b[i+1])){
		if(a[i]<b[i]){
			res[++tot]="";
			int pre=0;
			for(int j=lst+1;j<=i;++j)if(a[j]>b[pre])res[tot]+="ab",pre=j;
		}else{
			res[++tot]="";
			for(int j=lst+1;j<=i;++j){
				string tmp="";
				for(int k=b[j];k<=a[i];++k)if(rk[k]>=j)tmp+=s[k];
				res[tot]=max(res[tot],tmp);
			}
		}
		lst=i;
	}
	for(int i=tot;i>=1;--i)dp=max(dp,res[i]+dp);
	cout<<dp<<endl;
	return 0;
}

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

template <typename _tp> inline void read(_tp&x) {
	char ch=getchar(),ob=0;x=0;
	while(ch!='-'&&!isdigit(ch))ch=getchar();if(ch=='-')ob=1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();if(ob)x=-x;
}

const int N = 501000;
int n, L;

struct node {
	double t, v;
	friend inline node operator * (const node&A, const node&B) {
		return (node) {(A.t*A.v + B.t*B.v) / (A.v + B.v), A.v + B.v};
	}
} p[N];

int main() {
	read(n), read(L);
	int l = 1, r = 0, t, v;
	double heat = 0, volume = 0;
	for(int i=1;i<=n;++i) {
		read(t), read(v);
		while(volume + v > L) {
			double dec = min(p[l].v, volume + v - L);
			volume -= dec;
			heat -= p[l].t * dec;
			if(!(p[l].v -= dec)) ++l;
		}
		heat += (double)t * v, volume += v;
		p[++r] = (node) {t, v};
		while(l < r and p[r-1].t > p[r].t) p[r-1] = p[r-1] * p[r], --r;
		printf("%.7lf\n", (double)heat / volume);
	}
	return 0;
}

Measured memory_bytes: 16896
N = int(input())
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

ans = num2alpha(N)
print(ans.lower())

Measured memory_bytes: 9164
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

inline int read(){
	char ch=getchar();int x=0,op=0;
	while(!isdigit(ch))op|=(ch=='-'),ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return op?-x:x;
}

const int mod=998244353;
const int N=1000005,rev2=(mod+1)/2;
int fac[N],rev[N],n,m,ans;

inline int power(int x,int p){
	int res=1;
	for(;p;p>>=1,x=(ll)x*x%mod)
		if(p&1)res=(ll)res*x%mod;
	return res;
}

void init(int lim){
	fac[0]=1;
	rep(i,1,lim)
		fac[i]=(ll)fac[i-1]*i%mod;
	rev[lim]=power(fac[lim],mod-2);
	per(i,lim,1)
		rev[i-1]=(ll)rev[i]*i%mod;
}
inline int C(int n,int m){
	if(m<0||m>n)return 0;
	return (ll)fac[n]*rev[m]%mod*rev[n-m]%mod;
}

int main(){
	cin>>n>>m;
  	if(n<m) swap(n,m);
	init(n+m);
	ans=(ll)max(n,m)*C(n+m,n)%mod;
	rep(i,1,min(n,m))
		ans=(ans+mod+(ll)C(i+i,i)*C(n+m-i-i,n-i)%mod
					*rev2%mod)%mod;
	ans=(ll)ans*power(C(n+m,n),mod-2)%mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8064
#include <iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    int w,h,x,y;
    cin>>w>>h>>x>>y;
    double erea=1.0*w*h;
    erea/=2;
    printf("%.9lf ",erea);
    int flag=1;
    if(w%2==0&&h%2==0)
    {
        if(x==w/2&&y==h/2)
            flag=0;
    }
    if(flag)
        printf("0\n");
    else
        printf("1\n");
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int out = Integer.MAX_VALUE;
        for(int i = 0; i <= 100000; i++){
            out = Math.min(out, 2 * i * c + a * Math.max(0, (x - i)) + b * Math.max(0, (y - i)));
        }
        System.out.println(out);
    }


    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 35512
a, b = list(map(int, input().split()))
if b-a >= 2019:
  print(0)
  quit()

lis = list(range(a, b+1))
  
ans = 2019

for i in range(b-a+1):
  for j in range(i+1, b-a+1):
    #print("i: " + str(lis[i]) + "  j: "+ str(lis[j]))
    temp = ((lis[i]%2019)*(lis[j]%2019))%2019
    #print(temp)
    if temp < ans:
      ans = temp
print(ans)
    

Measured memory_bytes: 3060