akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a%2==1 && b%2 == 1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
  
    }

}


Measured memory_bytes: 23764
module ABC123

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: ABC123_A

  ! constants for this <module>
  character(len=4, kind=1), parameter, private :: string_communicatable     = 'Yay!'
  character(len=2, kind=1), parameter, private :: string_NOT_communicatable = ':('
  integer  (kind=INT8),     parameter, private :: num_antenna               = 5_INT8

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine ABC123_A

    ! variables for this <subroutine>
    integer(kind=INT8) :: coordinate_A, coordinate_E
    integer(kind=INT8) :: distance_max

    ! support variables for this <subroutine>
    integer(kind=INT8) :: itr

    ! STEP.01
    ! read out the coordinate of the antennas
    read(unit=INPUT_UNIT, fmt='(I3)') coordinate_A

    do itr = 2_INT8, num_antenna, 1_INT8
      read(unit=INPUT_UNIT, fmt='(I3)') coordinate_E
    end do

    ! STEP.02
    ! read out the maximum communicatable distance
    read(unit=INPUT_UNIT, fmt='(I3)') distance_max

    ! STEP.03
    ! judge the distance among the antennas
    if ( coordinate_E - coordinate_A .gt. distance_max ) then
      write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') string_NOT_communicatable
    else
      write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') string_communicatable
    end if

    ! STEP.END
    return

  end subroutine ABC123_A

end module ABC123

program main

  ! <module>s to import
  use, non_intrinsic :: ABC123

  ! require all variables to be explicitly declared
  implicit none

  call ABC123_A

end program main

Measured memory_bytes: 256
<?php
$dice_default = array (
    "Top" => 1
    , "North" => 5
    , "East" => 3
    , "South" => 2
    , "West" => 4
    , "Bottom" => 6
);
$dice = array();
$last_dice = array();
while (true) {
    $stdin = trim(fgets(STDIN));
    if ($stdin == 0) {
        break;
    }
    $dice = $dice_default;
    $result = $dice["Top"];
    for ($i = 0;$i < $stdin;$i++) {
        $command = trim(fgets(STDIN));
        $last_dice = $dice;
        switch ($command) {
            case "North":
                $dice["Top"] = $last_dice["South"];
                $dice["South"] = $last_dice["Bottom"];
                $dice["Bottom"] = $last_dice["North"];
                $dice["North"] = $last_dice["Top"];
            break;
            case "East":
                $dice["Top"] = $last_dice["West"];
                $dice["West"] = $last_dice["Bottom"];
                $dice["Bottom"] = $last_dice["East"];
                $dice["East"] = $last_dice["Top"];
            break;
            case "South":
                $dice["Top"] = $last_dice["North"];
                $dice["North"] = $last_dice["Bottom"];
                $dice["Bottom"] = $last_dice["South"];
                $dice["South"] = $last_dice["Top"];
            break;
            case "West":
                $dice["Top"] = $last_dice["East"];
                $dice["East"] = $last_dice["Bottom"];
                $dice["Bottom"] = $last_dice["West"];
                $dice["West"] = $last_dice["Top"];
            break;
            case "Right":
                $dice["North"] = $last_dice["West"];
                $dice["West"] = $last_dice["South"];
                $dice["South"] = $last_dice["East"];
                $dice["East"] = $last_dice["North"];
            break;
            case "Left":
                $dice["North"] = $last_dice["East"];
                $dice["East"] = $last_dice["South"];
                $dice["South"] = $last_dice["West"];
                $dice["West"] = $last_dice["North"];
            break;
            default:
            break;
        }
        $result += $dice["Top"];
    }
    echo $result."\n";
}
?>


Measured memory_bytes: 9276
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
  int f[26] = {0};

  string w;
  cin >> w;

  for (char c : w) {
    f[c-'a']++;
  }

  for (int i = 0; i < 26; ++i) {
    if (f[i] % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

  int ans = 0;
  int m = INF;

  cin >> n;
  REP(i, n) {
    int a;
    cin >> a;

    if(a < m) {
      ans++;
      m = a;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
#include <unordered_map>
unordered_map<ll,ll> dp[51];
int main(){
    int n, k;
    int s, t;
    cin >> n >> k >> s >> t;
    dp[0][(1<<18)-1] = 1;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        if((s&x)==s and (t|x)==t)for(int j = k - 1; j >= 0; j--){
            for(auto &y : dp[j]){
                dp[j+1][(((y.first >> 18)|x)<<18 )+ (y.first & x)] += y.second;
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= k; i++){
        ans += dp[i][((ll)t<<18) + s];
    }
    cout << ans << endl;
}


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

#define FOR(i,a,n) for (int i = a; i < (int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
    return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
template<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}

using ll = int_fast64_t;

constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);

int dp[100001];
int coin[12] = {1,6,9,36,81,216,729,1296,6561,7776,46656,59049};

int main() {
  int n; cin >> n;
  dp[0] = 0;
  dp[1] = 1;
  for (int i = 1; i <= n; ++i) {
    dp[i] = dp[i-1]+1;
    REP(j,12) {
      if (i-coin[j] < 0) break;
      chmin(dp[i], dp[i-coin[j]]+1);
    }
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>

using namespace std;
using ll = long long;

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

    string S;
    cin >> S;

    vector<int> l(Q);
    vector<int> r(Q);

    for (int i = 0; i < Q; ++i) {
        int li, ri;
        cin >> li >> ri;
        --li;
        --ri;

        l[i] = li;
        r[i] = ri;
    }

    vector<int> part_counts(N);

    part_counts[0] = 0;

    int count = 0;
    for (int i = 1; i < part_counts.size(); ++i) {
        if (S[i-1] == 'A' && S[i] == 'C') {
            ++count;
        }

        part_counts[i] = count;
    }

    for (int i = 0; i < Q; ++i) {
        int ans = part_counts[r[i]] - part_counts[l[i]];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 2176
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    for (int i = 0; i < h; ++i) {
        cin >> a[i];
    }
    vector<string> r(h, string(w, '.')), b(h, string(w, '.'));
    for (int i = 0; i < h; ++i) {
        r[i][0]     = '#';
        b[i][w - 1] = '#';
        for (int j = 1; j < w - 1; ++j) {
            if (i % 2 == 0)
                r[i][j] = '#';
            else
                b[i][j] = '#';
            if (a[i][j] == '#') {
                r[i][j] = b[i][j] = '#';
            }
        }
    }
    for (auto &rr : r) {
        cout << rr << "\n";
    }
    cout << endl;
    for (auto &bb : b) {
        cout << bb << "\n";
    }
    return 0;
}

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

MOD = 10**9 + 7

dp = [[[[0 for _ in range(5)] for _ in range(5)] for _ in range(5)] for _ in range(N+1)]

dp[0][0][0][0] = 1
A = 1
C = 2
G = 3
T = 4

for i in range(N):
    for p in range(5):
        for q in range(5):
            for r in range(5):
                for s in range(1, 5):
                    if p == A and q == G and s == C: 
                        continue
                    if p == A and r == G and s == C:
                        continue
                    if q == A and r == G and s == C: 
                        continue
                    if q == G and r == A and s == C:
                        continue
                    if q == A and r == C and s == G: 
                        continue
                    dp[i+1][q][r][s] += dp[i][p][q][r]
                    dp[i+1][q][r][s] %= MOD

ans = 0
for i in range(1,5):
    for j in range(1,5):
        for k in range(1,5):
            ans += dp[-1][i][j][k]
            ans %= MOD

print(ans) 

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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
                  
int main()
{                                  
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  ll n, a, b; cin >> n >> a >> b;
                
  if (n == 1 && a != b || a > b) {
    cout << 0;
    return 0;
  }
  if (a == b) {
    cout << 1;
    return 0;
  }    
  ll res = (n - 2) * (b - a) + 1;
  cout << res;


  return 0;
}






// Coded by Z..



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
//#define mod 1000000007
#define maxN 100005


int main()
{

	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
	double d, t, s;
	cin >> d >> t >> s;
	if (d / s <= t) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3736
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
        ab: [[usize; 2]; m],
    }

    let mut to: Vec<Vec<usize>> = vec![Vec::new();n];

    for i in 0..m {
        to[ab[i][0]-1].push(ab[i][1]-1);
        to[ab[i][1]-1].push(ab[i][0]-1);
    }

    for i in 0..n {
        println!("{}", to[i].len());
    }

}


Measured memory_bytes: 2168
#include<iostream>
int main()
{
	int result[50];
	int num;
	for(int i = 0;; i++)
	{
		result[i] = 0;
		int n;
		std::cin >> n;
		if(std::cin.eof())
		{
			num = i;
			break;
		}
		for(int j = 0; j <= 9; j++)
		{
			for(int k = 0; k <= 9; k++)
			{
				for(int l = 0; l <= 9; l++)
				{
					for(int m = 0; m <= 9; m++)
					{
						if(j + k + l + m == n)
						{
							result[i]++;
						}
					}
				}
			}
		}
	}
	for(int i = 0; i < num; i++)
	{
		std::cout << result[i] << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2996
#include<cstring>
#include<iostream>
using namespace std;
char c[111];
int le,f;
int main()
{
    cin>>c;
    le=strlen(c);
    for(int i=0;i<le;i++)
    {
        if(c[i]=='C'&&f==0)
        f=1;
        if(c[i]=='F'&&f!=0)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 510000;
const double pi=acos(-1);

int main(){
  rep(i,MOD){
    string s;
    cin >> s;
    if(s=="0") return 0;
    ll ans=0;
    rep(j,s.size()){
      ans+=s[j]-'0';
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  string s,t,ans="";
  cin >> n;
  cin >> s >> t;
  for(int i=0;i<n;i++){
    ans+=s.at(i);
    ans+=t.at(i);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    ll n;
    cin >> n;
    ll l[n];
    rep(i,n) cin >> l[i];

    sort(l,l+n);
    ll sum=0;
    rep(i,n-1) sum += l[i];
    if(l[n-1] < sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(void){
    ll n, k, ans;
    cin >> n >> k;
    n = n % k;
    while(true){
        ans = n;
        n = abs(n-k);
        if(ans < n) break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3412
N = int(input())
a = []
b = [[0]*3 for k in range(N+1)]

for j in range(N):
    a.append(list(map(int,input().split())))

b[0][0] = 0
b[0][1] = 0
b[0][2] = 0


for i in range(N):
    b[i+1][0] = max(b[i][1]+a[i][0],b[i][2]+a[i][0])
    b[i+1][1] = max(b[i][0]+a[i][1],b[i][2]+a[i][1])
    b[i+1][2] = max(b[i][0]+a[i][2],b[i][1]+a[i][2])

print(max(b[N]))


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

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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

const int mod=1000000007;

int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans;
    ll x[n];
    rep(i,n) cin>>x[i];
    rep(i,n-1){
        if(a*(x[i+1]-x[i])>b) ans+=b;
        else ans+=a*(x[i+1]-x[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
import math
A,B,X = map(int, input().split())
margin = A * A * B - X
#print(margin)
tansita = 2 * margin / (A ** 3)
#print(tansita)
if A * tansita <= B:
  Ans = math.degrees(math.atan(tansita))
  
else:
  tansita = 2 * X / (A * B * B)
  Ans = math.degrees(math.atan(tansita))
  Ans = 90 - Ans
#print(tansita)
print(Ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int cnt1[5000000]={},cnt2[5000000]={};
int main()
{
    int n,maxx1=0,maxx2=0,index1=0,index2=0,maxx11=0,maxx22=0,ans=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i+=2){
        cnt1[a[i]]++;
        if(cnt1[a[i]]>maxx1) maxx1=cnt1[a[i]],index1=a[i];
    }
    for(int i=1;i<n;i+=2){
        cnt2[a[i]]++;
        if(cnt2[a[i]]>maxx2) maxx2=cnt2[a[i]],index2=a[i];
    }
    for(int i=0;i<n;i+=2){
        if(cnt1[a[i]]>maxx11 && a[i]!=index1) maxx11=cnt1[a[i]];
    }
    for(int i=1;i<n;i+=2){
        if(cnt2[a[i]]>maxx22 && a[i]!=index2) maxx22=cnt2[a[i]];
    }
    if(index1==index2){
        ans=max((maxx1+maxx22),(maxx11+maxx2));
    }
    else ans=maxx1+maxx2;
    cout<<n-ans;
}


Measured memory_bytes: 4804
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<ll> v(n);
  ll ma1=0;
  ll ma2 = 0;
  rep(i,n){
      cin >> v[i];
      if(v[i]>=ma1){
          ma2 = ma1;
          ma1 = v[i];
      }else if(v[i]>=ma2){
          ma2 = v[i];
      }
  }
  rep(i,n){
      if(v[i]==ma1){
          cout << ma2 << endl;
      }else{
          cout << ma1 << endl;
      }
  }
}

Measured memory_bytes: 3200
n = int(input())
h = [int(x) for x in input().split(" ")]
 
for i in range(1, n):
  if h[-i]-h[-i-1] >= 0:
    continue  
  elif h[-i]-h[-i-1] == -1:
    h[-i-1] = h[-i-1] - 1
    continue
  elif h[-i]-h[-i-1] < -1:
    ans = "No"
    break
else:
  ans = "Yes"
  
print(ans)

Measured memory_bytes: 14396
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    if(n%x!=0)
        cout<<t*((n/x)+1)<<endl;
    else
        cout<<t*(n/x)<<endl;
    return 0;
}


Measured memory_bytes: 3616
h,w=map(int,input().split())
a=[]
for i in range(h):
    li=str(input())
    if len(set(li))!=1:
        a.append(li)
    elif len(set(li))==1 and li[0]=="#":
        a.append(li)
      
cnt=[]
b=[]
for j in range(w):
    for k in range(len(a)):
        b.append(a[k][j])
    if len(set(b))==2: 
      cnt.append(j)
    elif len(set(b))==1:
      if b[0]=="#":
        cnt.append(j)       
    b=[]            
ans=""
for m in range(len(a)):
  for l in cnt:
    ans+=a[m][l]
  print(ans)
  ans=""

Measured memory_bytes: 3064
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: i32 = read();
    let k: i32 = read();
    let _a: Vec<i32> = (0..n).map(|_| read()).collect();

    // (n-1)/(k-1) を切り上げ
    println!("{}", ((n - 1) + (k - 2)) / (k - 1));
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

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

using ll = long long;
using P = pair<int,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;

map<int, int> factor(int n){
    map<int, int> res;

    for (int i = 2; i*i <= n; ++i) {
        while(n % i == 0){
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;

    return res;
}

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

    int n;
    cin >> n;

    map<int, int> ans = factor(n);

    cout << n << ":";
    for (auto& p : ans) {
        rep(i, p.second){
            cout << " " << p.first;
        }
    }
    cout << "\n";

    return 0;
}



Measured memory_bytes: 3208
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
    ll n,k;cin>>n>>k;
    vector<ll> a(n);
    rep(i,0,n-1)cin>>a[i];
    ll ans = 0;
    for(int d = 40; d >= -1; --d){
        ll tmp = 0;
        for(int e = 40; e >= 0; --e){
            if(d!=-1 && !(k&1LL<<d))continue;
            
            ll num = 0;
            ll mask = 1LL<<e;
            rep(i,0,n-1){
                if(a[i]&1LL<<e)++num;
            }
            
            if(d<e){
                if(k&mask) tmp += mask*(n-num);
                else tmp += mask*num;
            }
            else if(d==e){
                tmp += mask*num;
            }
            else{
                tmp += mask*max(num,n-num);
            }
        }
        ans = max(ans,tmp);
    }
    cout<<ans<<endl;
}


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

int main(){
  int k;cin>>k;
  if(k%2){
    cout << k/2*(k+1)/2<<endl;
  }else{
    cout << pow(k/2,2) <<endl;
  }
  return 0;
}


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

int main(){
	char ch,ch2,ch3;
	int num;
	int counter[26]={0};
	
	while(cin>>ch){
		ch2=tolower(ch);
		num=ch2-'a';
		counter[num]++;
	}
	for(int i=0;i<26;i++){
		ch3='a'+i;
		cout<<ch3<<" : "<<counter[i]<<endl;
	}
  	return 0;
}

Measured memory_bytes: 3056
#include <cstdio>
#define MAX 10000
#define NIL -1

struct Node { int parent, left, right; };

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d) {
  if ( u == NIL ) return;
  D[u] = d;
  setDepth(T[u].left, d + 1);
  setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if ( T[u].left != NIL )
    h1 = setHeight(T[u].left) + 1;
  if ( T[u].right != NIL )
    h2 = setHeight(T[u].right) + 1;
  return H[u] = ( h1 > h2 ? h1 : h2 );
}

// ??????u??????????????????
int getSibling(int u) {
  if ( T[u].parent == NIL ) return NIL;
  if ( T[T[u].parent].left != u && T[T[u].parent].left != NIL )
    return T[T[u].parent].left;
  if ( T[T[u].parent].right != u && T[T[u].parent].right != NIL )
    return T[T[u].parent].right;
  return NIL;
}

void print(int u) {
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if ( T[u].left != NIL ) deg++;
  if ( T[u].right != NIL ) deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if ( T[u].parent == NIL ) {
    printf("root\n");
  } else if ( deg == 0 ) {
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

int main() {
  int v, l, r, root = 0;
  scanf("%d", &n);

  for ( int i = 0; i < n; i++ ) T[i].parent = NIL;

  for ( int i = 0; i < n; i++ ) {
    scanf("%d %d %d", &v, &l, &r);
    T[v].left = l;
    T[v].right = r;
    if ( l != NIL ) T[l].parent = v;
    if ( r != NIL ) T[r].parent = v;
  }

  for ( int i = 0; i < n; i++ ) if ( T[i].parent == NIL ) root = i;

  setDepth(root, 0);
  setHeight(root);

  for ( int i = 0; i < n; i++ ) print(i);

  return 0;
}

Measured memory_bytes: 2692
use std::io;

pub fn parse_line<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn parse_values<T: std::str::FromStr>(n: usize) -> Vec<T> {
    let line = parse_line::<String>();
    let mut split = line.split_whitespace();
    let mut values = Vec::with_capacity(n);
    for _ in 0..n {
        let v = split.next().unwrap().parse::<T>().ok().unwrap();
        values.push(v);
    }
    values
}

fn main() {
    let mut s: String = parse_line();
    let cs: Vec<char> = s.chars().collect();
    if cs[cs.len() - 1] != 's' {
        s.push('s');
        println!("{}", s);
    } else {
        s.push_str("es");
        println!("{}", s);
    }
}


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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	for(int n;cin>>n && n;){
		double res=0;
		map<int,double> dp; dp[0]=1;
		rep(_,n){
			map<int,double> dp2;
			for(auto p:dp) if(max(p.first,1)*p.second>1e-100){
				int cnt=p.first;
				double win=1./(1<<cnt),lose=1-win;
				win*=p.second,lose*=p.second;
				res+=cnt*lose;
				dp2[cnt+1]+=win;
				dp2[0]+=lose;
			}
			swap(dp,dp2);
		}
		for(auto p:dp) res+=p.first*p.second;
		printf("%.10f\n",res);
	}
}

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

int main(void) {
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];

    for(int i=1; i<N; i++){
      cout << A[0];
      for(int k=1; k<N; k++){
        cout << " " << A[k];
      }
      cout << endl;
      int v;
      v = A[i];
      int j = i-1;
      while(j>=0 && A[j]>v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
    }

    
    cout << A[0];
    for(int k=1; k<N; k++){
      cout << " " << A[k];
    }
    cout << endl;


    return 0;
}



Measured memory_bytes: 3100
a, b, k = map(int, input().split())
if 2 * k >= b - a + 1 : 
    i = a
    while i <= b :
        print(i)
        i += 1
else :
    i = a
    while i <= a + k - 1 :
        print(i)
        i += 1
    i = b - k + 1
    while i <= b :
        print(i)
        i += 1

Measured memory_bytes: 3060
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

      int a = sc.nextInt();
      int b = sc.nextInt();

 if (a < b){
System.out.println("a < b");
}else if (a > b){
System.out.println("a > b");
}else if (a == b){
System.out.println("a == b");
}

}
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  string s;
  while (cin >> s) {
    puts((s.front() == s.back()) ^ (s.size() % 2) ? "First" : "Second");
  }
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;

bool normal(ll n){
  if(n<=1) return false;
  for(int i=2;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}
int main(){
  ll n;
  cin>>n;
  while(!normal(n)) n++;
  COUT(n);
}

  

Measured memory_bytes: 256
#include "iostream"
#include "math.h"
#include "algorithm"
#include "string"
#include "vector"
#include "deque"
#include "cmath"
using namespace std;
typedef long long ll;

int main() {
	int a[30][30];
	int b[30];
	int n, m, c;
	cin >> n >> m >> c;
	for (int i = 1; i <= m; i++) {
		cin >> b[i];
	}
	for (int i = 1; i <=n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> a[i][j];
		}
	}
	int cnt = c;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cnt += a[i][j] * b[j];
		}
		if (cnt > 0) {
			ans++;
		}
		cnt = c;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define arep(i, x, n) for (int i = int(x); i < (int)(n); i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9 + 7

int x;
int N;

int main() {
    cin >> x >> N;
    vector<int> p(101);
    rep(i, 101) p.at(i) = 0;

    rep(i, N) {
        int input;
        cin >> input;
        p.at(input) = 1;
    }

    // arep(i, 1, 101){
    //     if(p.at(i) == 1){
    //         cout << i << endl;
    //     }
    // }
    bool isFind = false;
    int inc = 1;
    if (p.at(x) == 0) {
        cout << x << endl;
        return 0;
    }

    while (!isFind) {
        int minX = x - inc;
        int maxX = x + inc;
        if (minX < 1) {
            cout << 0 << endl;
            return 0;
        }
        
        if (p.at(minX) == 0) {
            cout << minX << endl;
            return 0;
        }
        if (maxX > 100) {
            cout << 101 << endl;
            return 0;
        }
        if (p.at(maxX) == 0) {
            cout << maxX << endl;
            return 0;
        }
        inc++;
    }

    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int main(){
  int n, i, j, u, k, v, Adj[100][100] = {0};

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d%d", &u, &k);
    u--;
    for(j = 0; j < k; j++){
      scanf("%d", &v);
      Adj[u][--v] = 1;
    }
  }

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(0 < j)   printf(" ");
      printf("%d", Adj[i][j]);
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define rALL(x) x.rbegin(), x.rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int pcnt(int x) {
  return __builtin_popcount(x);
}

int f(int x) {
  if (x == 0) return 0;
  return f(x%pcnt(x))+1;
}
int main(){
    ll n;   cin >> n;
    string s;   cin >> s;
    vector<ll> x(n);
    rep(i, n)   x[i] = s[i]-'0';
    ll pc=0;
    rep(i, n) pc += x[i];
    vector<ll> res(n);
    rep(b, 2){
        ll npc=pc;
        if(!b) npc++;
        else npc--;
        if(npc<=0) continue;
        ll r0=0;
        rep(i, n){
            r0 = (r0*2)%npc;
            r0 += x[i];
        }
        ll k=1;
        repd(i, n){
            if(x[i]==b){
                int r=r0;
                if(!b) r = (r+k)%npc;
                else r = (r-k+npc)%npc;
                res[i] = f(r)+1;
            }
            k = (k*2)%npc;
        }
    }
    rep(i, n) cout << res[i] << endl;
}


Measured memory_bytes: 6816
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static class Move {
		int fx, fy, gx, gy;
		
		public Move(int fx, int fy, int gx, int gy) {
			this.fx = fx;
			this.fy = fy;
			this.gx = gx;
			this.gy = gy;
		}
		
		public String toString() {
			return this.fy + " " + this.fx + " " + this.gy + " " + this.gx;
		}
	}
	
	public static int[][] move_dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
	public static boolean in_range(int x, int y, int W, int H) {
		return 0 <= x && x < W && 0 <= y && y < H;
	}
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int K = sc.nextInt();
			
			int[] array = new int[N];
			for(int i = 0; i < N; i++) { array[i] = sc.nextInt(); }
			
			Arrays.sort(array);
			
			int answer = Integer.MAX_VALUE;
			for(int i = 0; i <= (N - K); i++) {
				answer = Math.min(answer, array[i + (K - 1)] - array[i]);
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

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

#define F first
#define S second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;

typedef long long ll;

void solve(){
	int n;
	cin>>n;
	char c[n];
	vector<int>pref(n,0);
	for(int i=0;i<n;i++){
		cin>>c[i];
		pref[i]=(i?pref[i-1]:0)+(c[i]=='R');
	}
	int ans=pref[n-1];
	for(int i=0;i<n;++i){
		int x=i+1-pref[i];
		int y=(pref[n-1]-pref[i]);
		ans=min(abs(x-y)+min(x,y),ans);
	}
	cout<<ans;
}

int main(){
	Red;
	int T=1;
	//cin>>T;
	while(T--)solve();
}

Measured memory_bytes: 4216
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;cin>>s;
    int ans=0;
    int tmp=0;
    for(int i=0;i<3;++i){
        if(s[i]=='R'){
            ++ans;
        }else{
            ans=0;
        }
        tmp=max(ans,tmp);
    }
    cout<<tmp<<endl;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner (System.in);
		
		int x, y, tmp, rest;
		
		x = scan.nextInt();
		y = scan.nextInt();
		
		if(x < y){
			
			tmp = x;
			x = y;
			y = tmp;
			
		}
		
		for(;;){
			
			if(x == y){
				break;
			}
			
			rest = x % y;
			x = y;
			y = rest;
			
			if(x % y == 0) break;
		}
		if(x == y){
			System.out.println(x);
		}else{
			System.out.println(y);
		}
	}
}

Measured memory_bytes: 26204
#include <stdio.h>

int main()
{
	int n,k,x,y;
	long long ans;
	
	scanf("%d %d %d %d", &n, &k, &x, &y);
	if(n>=k)
	{
	
	ans=(k*x)+(n-k)*y;
	printf("%lld\n",ans);
	}
	else printf("%lld\n",n*x);
	return 0;
}

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

int main(){
	int n,k;cin>>n>>k;
	int v[n];
	for(int i=0;i<n;i++) cin>>v[i];
	int dp[n];
	dp[0]=0;
	for(int i=1;i<n;i++){
		int m=1e9;
		for(int j=1;j<=k;j++){
			if(i-j>=0)
				m=min(m,dp[i-j]+abs(v[i]-v[i-j]));
		}
		dp[i]=m;
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 4380
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;
 
 int main()
 { 
   int n;
   while(cin>>n)
   {
     string s;
     int kk[4]={0};
     while(n--)
     {
       cin>>s;
       if(s=="G") kk[0]++;
       else if(s=="W") kk[1]++;
       else if(s=="Y") kk[2]++;
       else if(s=="P") kk[3]++;
       else continue;          
     }             
     int ans=0;
     for(int i=0;i<4;i++) if(kk[i]) ans++;
     if(ans==3) cout<<"Three"<<endl;
     else if(ans==4) cout<<"Four"<<endl;
     else continue;
   }
   return 0;
 }
 

Measured memory_bytes: 256
#include <iostream>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string>

using namespace std;

int main() {
	int N,K;
	int l[60];
	cin >> N>>K;
	for (int i = 0; i < N; ++i)cin >> l[i];

	int sum = 0;
	sort(l, l + N, greater<int>());
	for (int i = 0; i < K; ++i) {
		sum += l[i];
	}

cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
          

int main() {
    string a , b = {};
    cin >> a;
    for ( int i = 0 ; i < a.length() ; i++ ) {
        if ( a[i] == '0' ) {
            b += '0';
        } else if ( a[i] == '1' ) {
            b += '1';
        } else if ( a[i] == 'B' ) {
            if ( b.length() > 0 ) {
                b.pop_back();
            }
        }
    }
    cout << b;
}


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

using namespace std;

typedef long long ll;
#define SWAP(x,y,z) {if ( y > z ) swap(y,z); if ( x > y ) swap(x,y); if (y > z) swap(y,z);}

int a[105];

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

    int m,d;
    int k = 0;
    cin >> m >> d;
    for ( int i = 1; i <= m; i++ )
    {
        for ( int j = 12; j <= d; j++ )
        {
            int a,b;
            a = j/10;
            b = j%10;
            if ( a >= 2 && b >= 2 )
                if ( a*b == i ) k++;
        }
    }
    cout << k;
    return 0;
    // 274751WM
}


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

int main()
{
    int X;
    int happiness = 0;

    cin >> X;
    
    happiness += X / 500 *1000;
    
    X = X % 500;

    happiness += X / 5 *5;

    cout << happiness;
    

    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int sum = 0;
    for(int i=1; i<=n; i++) {
        if(i%2 == 0) continue;
        int divisor = 0;
        for(int j=1; j<=i; j++) {
            if(i%j == 0) divisor++;
        }
        if(divisor == 8) sum++;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;
const int MAXN = 220000;

int n, k, l;
vector<int> eds1[MAXN];
vector<int> eds2[MAXN];

int was[MAXN];
int cl1[MAXN];
int cl2[MAXN];
map<pair<int, int>, int> mm;

void dfs1(int v, int c) {
	cl1[v] = c;
	was[v] = 1;
	for (int u: eds1[v])
		if (!was[u])
			dfs1(u, c);
}

void dfs2(int v, int c) {
	cl2[v] = c;
	was[v] = 1;
	for (int u: eds2[v])
		if (!was[u])
			dfs2(u, c);
}

int main() {
	scanf("%d%d%d", &n, &k, &l);
	for (int i = 0; i < k; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		--a, --b;
		eds1[a].push_back(b);
		eds1[b].push_back(a);
	}
	for (int i = 0; i < l; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		--a, --b;
		eds2[a].push_back(b);
		eds2[b].push_back(a);
	}
	int cc = 0;
	for (int i = 0; i < n; ++i)
		if (!was[i])
			dfs1(i, cc++);
	memset(was, 0, sizeof(was));
	cc = 0;
	for (int i = 0; i < n; ++i)
		if (!was[i])
			dfs2(i, cc++);
	for (int i = 0; i < n; ++i)
		++mm[make_pair(cl1[i], cl2[i])];
	for (int i = 0; i < n; ++i)
		printf("%d ", mm[make_pair(cl1[i], cl2[i])]);
	printf("\n");
	return 0;
}




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

#define testcase            int t; cin>>t; while (t--)
#define sc(a)               scanf("%lld",&a)
#define sc2(a,b)            scanf("%lld %lld",&a,&b)
#define pb                  push_back
#define reversed(s)         reverse(s.begin(), s.end())
#define asort(s)            sort(s.begin(), s.end())
#define dsort(s)            sort(s.begin(), s.end(),greater<ll>())
#define gtl(x)              getline(cin, (x))
#define PI                  acos(-1)
#define CLR(x, y)           memset(x, y, sizeof(x))
#define Precision(a)        cout << fixed << setprecision(a)
#define FasterIo            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                "\n"

template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}

int main()
{
    int a;
    cin >> a;
    int x = a+(a*a)+(a*a*a);
    cout << x << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	map<char,int> m;
	for(auto i : s){
		m[i]++;
	}

	size_t t = s.find('-');
	if(t == string::npos){
		cout << "No" << endl;
		return 0;
	}

	if(m['-'] == 1 && t == a && s.size() - t - 1 == b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int>v;
int main(){
	cin>>n;
	if(n==0){
		cout<<0<<endl;
		return 0;
	}
	while(n){
		int c=n%-2;
		n/=-2;
		if(c<0) c+=2,n++;
		v.push_back(c);
	}
	reverse(v.begin(),v.end());
	int i=0;
	while(v[i]==0) i++;
	for(int j=i;j<v.size();j++) cout<<v[j];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, K, A;
    map<int, int> m;
    cin >> N >> K;
    REP(i, N) {
        cin >> A;
        m[A]++;
    }

    priority_queue<int, vector<int>, greater<int>> q;
    for (auto p : m) q.push(p.second);

    int ans = 0;
    while (q.size() > K) {
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10748
import sys
sys.setrecursionlimit(10**9)
A, B, C, X, Y = map(int, input().split())

cost1 = A * X + B * Y
cost2 = max(X, Y) * 2 * C
if X <= Y:
    cost3 = X * 2 * C + (Y - X) * B
else:
    cost3 = Y * 2 * C + (X - Y) * A

print(min([cost1, cost2, cost3]))


Measured memory_bytes: 3060