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


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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,ans;
void judge(ll m,ll x)
{
    if(!m)return;
    if(n/m==x&&n%m==x)ans+=m;
}
int main()
{
    cin>>n;
    for(ll i=1;i*i<=n;i++)
    if(n%i==0)
    {
        judge(i-1,n/i);
        if(i*i<n)judge(n/i-1,i);
    }
    cout<<ans;
}

Measured memory_bytes: 3616
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N;
	
	cin >> N;

	int h[N];

	int count = 0;
	rep(i, N)
	{
		cin >> h[i];
		if (i == 0)
		{
			count = h[0];
		}
		else
		{
			if (h[i] - h[i-1] > 0)
			{
				count += h[i] - h[i-1];
			}
		}
	}
	
	cout << count << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define vi vector<int>

using ll = long long;
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
inline ll inv(ll x, ll div){return pow(x, div - 2, div);}
#define chmax(a,b) a=max(a,b)
int gcj_out_cnt = 1;
#define gcj_put cout<<"Case #"<<gcj_out_cnt++<<": ";

/*Coding Space*/

int main(){
  int n,x; cin >> n >> x;
  vector<ll> a(n); rep(i,n) cin >> a[i];
  sort(ALL(a));
  int ans = 0;
  rep(i,a.size()){
    ans++;
    x -= a[i];
    if(x == 0){
      cout << ans << endl;
      return 0;
    }else if(x < 0){
      cout << ans-1 << endl;
      return 0;
    }else{
      ;
    }
  }
  cout << n-1 << endl;
}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    // input A B C
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();

    if a + b >= c {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
import random

class dice:
    def __init__(self, nums=[0]*6):
        self.top = nums[0]
        self.front = nums[1]
        self.right = nums[2]
        self.left  = nums[3]
        self.back = nums[4]
        self.bottom = nums[5]
    
    def set_nums(self, nums):
        self.top = nums[0]
        self.front = nums[1]
        self.right = nums[2]
        self.left  = nums[3]
        self.back = nums[4]
        self.bottom = nums[5]
    
    def roll(self, dr):
        if dr==0:#North
            self.top, self.front, self.bottom, self.back = self.front, self.bottom, self.back, self.top
        elif dr==1:#South
            self.top, self.front, self.bottom, self.back = self.back, self.top, self.front, self.bottom
        elif dr==2:#West
            self.top, self.right, self.bottom, self.left = self.right, self.bottom, self.left, self.top
        elif dr==3:#East
            self.top, self.right, self.bottom, self.left = self.left, self.top, self.right, self.bottom
        
    def check_same(self, d2):
        if (self.top == d2.top and self.right == d2.right and self.bottom == d2.bottom and self.left == d2.left and self.front == d2.front and self.back == d2.back):
            return True
        else:
            return False
    
    def check(self, d2):
        trial = 0
        while trial<100:
            if self.check_same(d2):
                return True
            else:
                self.roll(random.randint(0,3))
                trial += 1
        return False

n = int(input())
ds = []
for i in range(n):
    nums = list(map(int, input().split()))
    ds.append(dice(nums))

flg = 0
for i in range(n):
    if flg:
        break
    for j in range(i+1,n):
        if ds[i].check(ds[j]):
            flg = 1

if flg:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 8216
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  vector<int> data ={0,1,0,2,0,2,0,0,2,0,2,0};
  int A,B;
  cin>>A>>B;
  A--;B--;
  if(data[A] == data[B])
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
  
  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)

void chmax(ll& a, ll b) { a = max(a, b); }
void chmin(ll& a, ll b) { a = min(a, b); }

using P = pair<int, int>;

const int MAX_N = 200005;
const int INF = 1001001001;

vector<int> a, ans;
vector<int> to[MAX_N];
int dp[MAX_N];

void dfs(int v, int p=-1) {
    int i = lower_bound(dp, dp+MAX_N, a[v]) - dp;
    int old = dp[i];
    dp[i] = a[v];
    ans[v] = i;
    if(p != -1) ans[v] = max(ans[v], ans[p]);
    for (int u : to[v]) {
        if(u == p) continue;
        dfs(u, v);
    }
    // 戻るときにここで更新したのを戻しておく
    dp[i] = old;
}

int main() {
    int n; cin >> n;
    a = ans = vector<int>(n);
    rep(i, n) cin >> a[i];
    rep(i, n-1) {
        int u, v;
        cin >> u >> v;
        --u; --v;
        to[v].push_back(u);
        to[u].push_back(v);
    }
    rep(i, MAX_N) dp[i] = INF;
    dp[0] = -INF;
    dfs(0);

    rep(i, n) cout << ans[i] << endl;

    return 0;
}


Measured memory_bytes: 30856
N = int( input())
H = list( map( int, input().split()))
ans = 0
for i in range(1, 101):
    c = 0
    for j in range(N):
        if H[j] >= i:
            c = 1
        else:
            ans += c
            c = 0
    else:
        if c == 1:
            ans += 1
print( ans)


Measured memory_bytes: 3060
#include<stdio.h>
#include<utility>
#include<algorithm>

using namespace std;

struct C{
    char mark;
    int value;
};

C c1[100000];
C c2[100000];
C L[50001];
C R[50001];

void merge(C c[], int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i = 0; i < n1; i++){
        L[i] = c[left+i];
    }
    for(int i = 0; i < n2; i++){
        R[i] = c[mid+i];
    }
    L[n1].value = 1000000001;
    R[n2].value = 1000000001;
    int i = 0;
    int j = 0;
    for(int k = left; k < right; k++){
        if(L[i].value <= R[j].value){
            c[k] = L[i];
            i++;
        }
        else{
            c[k] = R[j];
            j++;
        }
    }
}
 
void mergeSort(C c[], int left, int right){
    if(left + 1 < right){
        int mid = (left + right) / 2;
        mergeSort(c, left, mid);
        mergeSort(c, mid, right);
        merge(c, left, mid, right);
    }
}

int partition(C c[], int p, int r){
    C x = c[r];
    int i = p-1;
    for(int j = p; j < r; j++){
        if(c[j].value <= x.value){
            i++;
            swap(c[i], c[j]);
        }
    }
    swap(c[i+1], c[r]);
    return i + 1;
}

void quickSort(C c[], int p, int r){
    if(p < r){
        int q = partition(c, p, r);
        quickSort(c, p, q-1);
        quickSort(c, q+1, r);
    }
}

int main(){
    int n;
    scanf("%d", &n);
    getchar();
    for(int i = 0; i < n; i++){
        scanf("%c%d", &c1[i].mark, &c1[i].value);
        c2[i] = c1[i];
        getchar();
    }

    mergeSort(c1, 0, n);
    quickSort(c2, 0, n-1);

    bool flag = true;
    for(int i = 0; i < n; i++){
        if(c1[i].mark != c2[i].mark){
            flag = false;
            break;
        }
    }

    if(flag){
        printf("Stable\n");
    }
    else{
        printf("Not stable\n");
    }
    for(int i = 0; i < n; i++){
        printf("%c %d\n", c2[i].mark, c2[i].value);
    }
}


Measured memory_bytes: 4972
from collections import Counter

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

INF = 55
memo = [INF] * 26
for s in S:
    for i in range(26):
        memo[i] = min(memo[i], s[chr(ord('a') + i)])

print("".join(chr(ord('a') + i) * memo[i] for i in range(26)))

Measured memory_bytes: 3316
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S, W = list(map(int, sys.stdin.buffer.readline().split()))
if S <= W:
    print('unsafe')
else:
    print('safe')


Measured memory_bytes: 9240
/*---------------------------------------------
				Author:TanYz
---------------------------------------------*/
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <string>
#include <cmath>
#include <map>
#include <stack>
#include <ctime>
#include <set>
#include <vector>
#include <cstdlib>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define mpii(a,b) make_pair(a,b)
const int INF=1<<30;
const int maxn=2333333;
const int mod=1000000007;

string str;

int main()
{
	//freopen("tan_in.txt","r",stdin);
	//freopen("tan_out.txt","w",stdout);
	cin>>str;
	int ansA=0,ansZ=0;
	for(int i=0;i<str.size();i++){
		if(str[i]=='A')break;
		ansA++;
	}
	for(int i=str.size()-1;i>=0;i--){
		if(str[i]=='Z')break;
		ansZ++;
	}
	printf("%d\n",str.size()-ansA-ansZ);
	return 0;
}





Measured memory_bytes: 640
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int x[3];
  REP(i, 3) cin >> x[i];
  int sum = x[0] + x[1] + x[2];
  REP(i, 3) {
    if (x[i] * 2 == sum) {
      print("Yes");
      return 0;
    }
  }
  print("No");
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n, d;
	cin >> n >> d;

	int ans = (n + d * 2) / (d * 2 + 1);

	out(ans);

	return 0;
}

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

using namespace std;

#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 REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll n;

bool judge(ll x) {
    ll s = sqrt(x);
    FOR(i, 2, s + 1) if(x % i == 0) return false;
    return true;
}

int main() {
    cin >> n;
    ll ans = 0;
    REP(i, n) {
        if(judge(IN())) ans++;
    }
    cout << ans << "\n";
}



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

int main(){
  int N,N1,N10,N100,N1000;
  cin >> N;
  N1=N%10,N10=(N%100-N1)/10;
  N100=(N%1000-10*N10-N1)/100;
  N1000=(N%10000-100*N100-10*N10-N1)/1000;
  if(N1==N10 && N10==N100){
    cout << "Yes" <<endl;
  }
  else if(N10==N100 && N100==N1000){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" <<endl;
  }
    
}
    
    

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


//////////////////////////////////////
ll gcd(ll a,ll b){
    while(a!=0&&b!=0){
        if(a<b)swap(a,b);
        a=a%b;
    }
    if(a<b)swap(a,b);
    return a;
}
void yes(){
    cout<<"Yes"<<endl;
}
void no(){
    cout<<"No"<<endl;
}

int main(){
    ll t;cin>>t;
    while(t--){
        ll a,b,c,d;cin>>a>>b>>c>>d;
        if(a<b)no();
        else if(b>d)no();
        else if(b<=c+1)yes();
        else{
            ll g=gcd(b,d);
            a=a%b+b;
            ll k=(a-(c+1))/g;
            a=a-k*g;
            if(a<b)no();
            else yes();
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#! /usr/bin/env python3

a, b, c, x, y = map(int, input().split())

ab_max_pairs = max(x, y)

price_min = 1000000000

for i in range(ab_max_pairs + 1):
    price = c * i * 2 + max(0, (x-i)) * a + max(0, (y-i)) * b
    if price < price_min:
        price_min = price

print(price_min)


Measured memory_bytes: 3060
use proconio::*;

fn run() {
    input! {
        n: usize,
        a: [u32; n],
    }
    let xor = a.iter().fold(0, |s, a| s ^ *a);
    let mut s = String::new();
    for a in a {
        s.push_str(&format!("{} ", a ^ xor));
    }
    s.pop();
    println!("{}", s);
}

fn main() {
    run();
}

Measured memory_bytes: 7016
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,
        mut a: [usize;n],
    }
    a.sort();
    a.push(0);
    let mut b: Vec<(usize,usize)> = Vec::new();
    let mut cnt = 0;
    for i in 0..n {
        let tmp = a[i];
        cnt += 1;
        if a[i+1]==tmp {
            continue;
        } else {
            if cnt>=2 {
                b.push((tmp, cnt));
            }
            cnt = 0;
        }
    }
    if b.len()==0 {
        println!("0");
    } else if b.len()==1 {
        if b[0].1<4 {
            println!("0");
        } else {
            println!("{}", b[0].0*b[0].0);
        }
    } else {
        if b[b.len()-1].1<4 {
            println!("{}", b[b.len()-1].0*b[b.len()-2].0);
        } else {
            println!("{}", b[b.len()-1].0*b[b.len()-1].0);
        }
    }

}


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

using namespace std;


int main() {
  int N, K;
  cin >> N >> K;
  vector< int > A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  sort(begin(A), end(A));
  int ret = INT_MAX;
  for(int i = 0; i <= N - K; i++) ret = min(ret, A[i + K - 1] - A[i]);
  cout << ret << endl;
}

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

//inline int read(){int t = 0;int neg=1;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1;continue;}t=t*10+c-48;}return neg*t;}
//inline int readl(){long long t = 0;long long neg=1ll;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1ll;continue;}t=t*10+c-48;}return neg*t;}

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<pi> vpi;
typedef vector<plli> vplli;
const lli M=1000000007ll;

int main(){
	fast_io 
	int n,k; cin>>n;
	k=n%10;
	
	if(k==2 or k==5 or k==7 or k==9 or k==4) cout<<"hon";
	else if(k==0 or k==1 or k==6 or k==8) cout<<"pon";
	else cout<<"bon";
	return 0;
}

Measured memory_bytes: 3564
true_cards = [(f'{shcd} {n}') for n in range(1,14) for shcd in ['S', 'H', 'C', 'D']]
n = int(input())
cards=[input() for _ in range(n)]
missed_cards = set(true_cards) - set(cards)
[print(f'{shcd} {n}')  for shcd in ['S', 'H', 'C', 'D'] for n in range(1,14) if f'{shcd} {n}'in missed_cards]


Measured memory_bytes: 5616
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    ll n;
    cin >> n;
    vl a(n);
    rep(i, n) cin >> a[i];
    if(n == 1) {
        if(a[0]&1) cout << "first" << endl;
        else cout << "second" << endl;
        return 0;
    }
    sort(all(a));
    ll x = 0, y = n;
    REP(i, 0, n) {
        ll d = i == 0 ? a[i] : a[i] - a[i-1];
        if(d&1) {
            x ^= y;
        }
        --y;
    }
    if(x == 0) cout << "second" << endl;
    else cout << "first" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
    int N, a;
    cin >> N;
    if (N % 1000 == 0) cout << 0 << endl;
    else{
        a = (N / 1000) + 1;
        cout << - (N - a * 1000) << endl;
    } 
}


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

using namespace std;

typedef long long ll;

const int N=111;
const int M=2e6+11;

int a[N];

int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  int ans=0;
  while(1){
    int x=101;
    for(int i=1;i<=n;i++){
      if(a[i]==0)continue;
      x=min(x,a[i]);
    }
    if(x==101)break;
    for(int i=1;i<=n;i++){
      if(a[i]==0||a[i]!=x)continue;
      int l,r;
      l=r=i;
      for(;r<=n;r++){
        if(a[r]<a[i])break;
      }
      r--;
      for(;l>=1;l--){
        if(a[l]<a[i])break;
      }
      l++;
      ans+=x;
      for(int j=l;j<=r;j++){
        a[j]-=x;
      }
      i=r;
    }
  }
  cout<<ans;
}


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

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

    int cnt[4] = {0};
    std::string s;
    for (int i = 0; i < N; ++i) {
        std::cin >> s;

        if (s == "AC") {
            ++cnt[0];
        } else if (s == "WA") {
            ++cnt[1];
        } else if (s == "TLE") {
            ++cnt[2];
        } else {
            ++cnt[3];
        }
    }

    std::printf("AC x %d\n", cnt[0]);
    std::printf("WA x %d\n", cnt[1]);
    std::printf("TLE x %d\n", cnt[2]);
    std::printf("RE x %d\n", cnt[3]);

    return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
    size_t N, M;
    cin >> N >> M;
    int ai, bi;
    vector<pair<int, int>> ab;
    for(size_t i=0;i<M;i++){
        cin >> ai >> bi;
        ab.push_back(pair<int, int>{ai, bi});
    }
    sort(ab.begin(), ab.end(),
         [](pair<int, int> r, pair<int, int> l){
            return r.second < l.second;
         }
         );
    int count = 0;
    bi=-1;
    for(auto it = ab.begin(); it != ab.end(); it++){
        if(bi==-1 || bi <= it->first){
            bi = it->second;
            count++;
        }
    }
    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 1400
from __future__ import annotations

from dataclasses import dataclass
from dataclasses import field
from typing import List, Tuple


@dataclass
class Tour:
    height: int
    routes: List[Tour] = field(default_factory=list)

    def add_tour(self, tour: Tour) -> None:
        self.routes.append(tour)

    def is_good(self) -> bool:
        for other_tour in self.routes:
            if self.height <= other_tour.height:
                return False

        return True


@dataclass
class Actual:
    h_list: List[int]
    ab_list: List[Tuple[int, int]]
    tours: List[Tour] = field(default_factory=list)

    def answer(self) -> int:
        self.create_tours()

        self.register_routes()

        return self.count_good_tours()

    def count_good_tours(self) -> int:
        is_good_list = [tour.is_good() for tour in self.tours]

        return sum(is_good_list)

    def register_routes(self) -> None:
        for a, b in self.ab_list:
            tour_a = self.tours[a - 1]
            tour_b = self.tours[b - 1]

            tour_a.add_tour(tour_b)
            tour_b.add_tour(tour_a)

    def create_tours(self) -> None:
        for h in self.h_list:
            tour = Tour(height=h)
            self.tours.append(tour)


N, M = map(int, input().split())
h_list = list(map(int, input().split()))

ab_list = []
for _ in range(M):
  a, b = list(map(int, input().split()))
  ab_list.append((a, b))

# print(N, M)
# print(h_list)
# print(ab_list)

print(Actual(h_list, ab_list).answer())

Measured memory_bytes: 55516
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
using R = double;

const int limit = 100010;

using edge = struct { int to; ll cost; };

vector<edge> tree[limit];
ll depth[limit];

//親を記録して置くことで戻るのを防ぐ。
void dfs(int v, int p, ll d) {
	depth[v] = d;
	for (auto &e : tree[v]) {
		if (e.to == p)continue;
		dfs(e.to, v, d + e.cost);
	}
}	

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

	for (int i = 0; i < n - 1; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		tree[a].push_back({ b,c });
		tree[b].push_back({ a,c });
	}

	int q, k;
	cin >> q >> k;
	k--;

	dfs(k, -1, 0);
	for (int i = 0; i < q; i++) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		cout << depth[x] + depth[y] << endl;
	}


}

Measured memory_bytes: 14336
d=int(input())
c0=input().split()
cl=[]
csum=0
for i in range(26):
  c1=int(c0[i])
  cl.append(c1)
  csum+=c1
  
cd=[0 for i in range(26)]
for i in range(d):
  a0=input().split()
  addmax=0
  max26=0
  for j in range(26):
    a1=int(a0[j])
    add1=a1+(cd[j]+1)*cl[j]
    if addmax<add1:
      addmax=add1
      max26=j
  print(max26+1)
  for j in range(26):
    if j!=max26:
      cd[j]+=1

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

int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i ++) cin >> t[i] >> d[i];

  int l , r;
  int left, right, mid, tmp;
  bool flag;
  //左から落ちるゴーレムのうち、最も右端にいるものを探す
  left = 0, right = N;
  while (left < right) {
    mid = tmp = (left + right) / 2;
    flag = false;
    for (int i = 0; i < Q; i ++) {
      if (t[i] != s[tmp]) continue;

      if (d[i] == 'R') tmp ++;
      else tmp --;

      if (tmp == -1) flag = true;
    }
    if (flag) left = mid + 1;
    else right = mid;
  }
  if (flag) l = mid;
  else l = mid - 1;

  //右から落ちるゴーレムのうち、最も左端にいるものを探す
  left = 0, right = N;
  while (left < right) {
    mid = tmp = (left + right) / 2;
    flag = false;
    for (int i = 0; i < Q; i ++) {
      if (t[i] != s[tmp]) continue;

      if (d[i] == 'R') tmp ++;
      else tmp --;

      if (tmp == N) flag = true;
    }
    if (flag) right = mid;
    else left = mid + 1;
  }
  if (flag) r = mid;
  else r = mid + 1;

  int ans;
  if (r > l) ans = r - l - 1;
  else ans = 0;

  cout << ans << endl;
}

Measured memory_bytes: 900
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC066A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, s;

            string[] word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);
            
            if ((a > b) && (a > c))
                s = b + c;
            else if ((b > a) && (b > c))
                s = a + c;
            else
                s = a + b;

            Console.WriteLine(s);
        }
    }
}


Measured memory_bytes: 27304
import math

n, k = map(int, input().split())
pn = []
bp = []

for i in range(n):
    p, b = map(int, input().split())
    pn.append(p)
    bp.append(b)

res = 10**9

for i in range(1 << n):
    pnt = 0
    num = 0
    x = i ^ (2 ** n - 1)
    for j in range(n):
        if (i >> j) & 1 == 1:
            pnt += (j+1) * 100 * pn[j] + bp[j]
            num += pn[j]
    if pnt >= k:
        res = min(res, num)
    else:
        for l in range(n - 1, -1, -1):
            if (x >> l) & 1 == 1:
                d = min(pn[l], math.ceil((k - pnt)//100/(l + 1)))
                #print(num, pnt, d, d*100*(l+1), num+d, pnt+d*100*(l+1))
                pnt += (l+1) * 100 * d
                num += d
                break
        if pnt >= k:
            res = min(res, num)
print(res)


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

long Compare(const void *a, const void *b) {
	return *(long*)b - *(long*)a;
}

int main(void)
{
	long int members[300000] = { 0 }, ans = 0;
	int num;
	scanf("%d", &num);
	for (int i = 0; i < 3 * num; i++) {
		scanf("%d", &members[i]);
	}

	qsort(members, num * 3, sizeof(long int), Compare);

	for (int i = 0; i < 2 * num; i++) {
		if (i % 2 == 1) {
			ans += members[i];
		}
	}
	printf("%ld", ans);
	return 0;
}


Measured memory_bytes: 4860
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
vector<LL> make_divisors(LL n){vector<LL> divisors;for(int i = 1; i <= sqrt(n); i++) {if(n%i == 0){divisors.push_back(i);if(i != n/i){divisors.push_back(n / i);}}}return divisors;}
const LL MOD = 1e9 + 7;
const int INF = 1 << 30;
const LL LLINF = 1LL << 60;
using namespace std;

const int MAX = 310;


//引数:n = 頂点の数
void warshall_floyd(int n, vector<vector<int>>& dp){
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            if(dp[i][k] == INF) continue;
            for (int j = 0; j < n; j++){
                if(dp[k][j] == INF) continue;
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
        }
    }
}


int main(void){
    int N, M, L;
    cin >> N >> M >> L;

    vector<int> A(M), B(M), C(M);
    rep(i, M){
        cin >> A[i] >> B[i] >> C[i];
        A[i]--;B[i]--;
    }

    int Q;
    cin >> Q;
    vector<int> s(Q), t(Q);
    rep(i, Q){
        cin >> s[i] >> t[i];
        s[i]--;t[i]--;
    }

    vector<vector<int>> dp(MAX,vector<int>(MAX,INF));
    vector<vector<int>> dp2(MAX,vector<int>(MAX,INF));

    //dpを初期化
    rep(i,N){
        dp[i][i] = 0;
        dp2[i][i] = 0;
    }

    //まずは一つ目
    rep(i, M) {
        dp[A[i]][B[i]] = C[i];
        dp[B[i]][A[i]] = C[i];
    }
    warshall_floyd(N, dp);
    
    //続いて二つ目
    rep(i,N){
        rep(j,N){
            if(i == j) continue;
            if(dp[i][j] <= L){
                dp2[i][j] = 1;
            }
        }
    }
    warshall_floyd(N, dp2);
    
    rep(i,Q){
        if(dp2[s[i]][t[i]] == INF){
            cout << -1 << endl;
        }else{
            cout << dp2[s[i]][t[i]] - 1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2432
s = input()
n1 = int(s[0:2])
n2 = int(s[2:4])

if 1 <= n1 <= 12:
  if 1 <= n2 <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif 1 <= n2 <= 12:
  print('YYMM')
else:
  print('NA')


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll N;
vector<ll> A, B;

enum Player { Alice = 0, Bob = 1 };

signed main()
{
    cin >> N;
    A.resize(N);
    B.resize(N);
    REP(i, N) { cin >> A[i] >> B[i]; }

    vector< tuple<ll, ll, ll> > AB; // max, A, B
    REP(i, N) {
        AB.push_back(make_tuple(A[i] + B[i], A[i], B[i]));
    }
    sort(AB.begin(), AB.end(), greater< tuple<ll, ll, ll> >() );

    ll alice = 0;   // takahashi
    ll bob = 0;
    ll player = Alice;
    REP(i, N) {
        //DBG("%lld %lld %lld\n", get<0>(AB[i]), get<1>(AB[i]), get<2>(AB[i]));
        if(player == Alice) {
            alice += get<1>(AB[i]);
            //DBG("alice += %lld\n", get<1>(AB[i]));
            player = Bob;
        }
        else {
            bob += get<2>(AB[i]);
            //DBG("bob += %lld\n", get<2>(AB[i]));
            player = Alice;
        }
    }
    printf("%lld\n", alice - bob);

    return 0;
}


Measured memory_bytes: 6004
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
#define ll long long

const int maxn=1e6+10;

struct node
{
    int d;
    node *to;
}*e[maxn];

int qx[maxn*3],qy[maxn*3],qz[maxn*3];

int f[maxn][3];

int main()
{
    node *p;
    int n,m,x,y,z,xx,yy,zz,head,tail,s,t;
    scanf("%d%d",&n,&m);
    while (m--)
    {
        scanf("%d%d",&x,&y);
        p=new node();
        p->d=y;
        p->to=e[x];
        e[x]=p;
    }

    scanf("%d%d",&s,&t);
    qx[1]=s,qy[1]=0,qz[1]=3;
    head=0,tail=1;
    while (head<tail)
    {
        head++;
        x=qx[head];
        y=qy[head];
        z=qz[head];

        p=e[x];
        while (p)
        {
            xx=p->d;
            yy=(y+1)%3;
            zz=z+1;
            if (!f[xx][yy])
            {
                if (xx==t && yy==0)
                {
                    printf("%d",(zz-3)/3);
                    return 0;
                }
                tail++;
                qx[tail]=xx;
                qy[tail]=yy;
                qz[tail]=zz;
                f[xx][yy]=zz;
            }
            p=p->to;
        }
    }
    printf("-1");
    return 0;
}


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

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

    if ( N % 10 == 9) cout << "Yes" << endl;
    else{
        N = (N - N % 10) / 10;
        if ( N % 10 == 9) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
a,b,x = map(int,input().split())
ans = 0
def get_mul(n,x):
  if n == -1:
    return 0
  else:
    return n // x + 1
if b == 0:
  print(1)
else:
  print(get_mul(b,x) - get_mul(a - 1,x))

Measured memory_bytes: 2940
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => { content += buf; })
process.stdin.on('end', () => {
  const [w, h, x, y, r] = content.split(' ').map(n => parseInt(n, 10));
  const outerReact = createRect(0, 0, w, h);
  const circleReact = createRectFromCircle(x, y, r);
  console.log(containsReact(outerReact, circleReact) ? 'Yes' : 'No');
});

const createRect = (x, y, w, h) => ({
  x, y, w, h
});

const createRectFromCircle = (x, y, r) =>
  createRect(x - r, y - r, r * 2, r * 2);

const containsReact = (r1, r2) => {
  const horizontal = r2.x >= r1.x && r2.x + r2.w <= r1.x + r1.w;
  const vertical = r2.y >= r1.y && r2.y + r2.h <= r1.y + r1.h;
  return horizontal && vertical;
};


Measured memory_bytes: 15552
S = input()
place = [0,4,6,8]
cands = []
for b1 in [True,False]:
    for b2 in [True, False]:
        for b3 in [True, False]:
            for b4 in [True, False]:
                akb = list("AKIHABARA")
                if b1:
                    akb[0] = ""
                if b2:
                    akb[4] = ""
                if b3:
                    akb[6] = ""
                if b4:
                    akb[8] = ""
                cands.append("".join(akb))
if S in cands:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 38256
from copy import*
from numpy import*
a,b=map(int,input().split())
*c,=map(int,input().split())
c1=deepcopy(c)
c2=deepcopy(c)

for i in range(1,a):
    c1[i]=min(c1[i-1],c1[i])
for i in range(a-1,0,-1):
    c2[i-1]=max(c2[i],c2[i-1])

#print(c1,c2)
d=array(c2)-array(c1)
d2=array(c)-array(c1)
print(list(d2).count(max(d)))

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

using namespace std;
using ll = long long;

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS(N) resize(N)
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);

#define MOD 1000000007

void init();
void solve();

signed main()
{
	init();
	solve();
}

void init()
{
	int a, b;
	cin >> a >> b;
	cout << a + b / 2 << endl;
}

void solve()
{
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((int)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;


////////////////////////////////////////////////////////




int main() {
    ll x, y; cin >> x >> y;
    ll length = 1;
    ll now = x;
    while(1){
        now *= 2;
        if(now > y) break;
        length++;
    }
    co(length);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include <string>
#include <map>
#include <deque>
#include <vector>
#include <assert.h>
#include <cstdio>
#include <iomanip>
#include <stack>
#include <bitset>
#include <queue>
#include <stdio.h>


using namespace std;



#define mp make_pair
#define pb push_back
#define ll long long
#define fi first
#define sc second
#define y1 stupid_cmath



ll  n,k,d,x,y,r, cnt, a[1001001], p[1001001], F[1001000];
ll const INF = 100000001;
vector<ll> v1,v2;
string s;

int main(){
    //ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    cin>>n;
    for(int i = 1;i <= n;i++){
        cin>>a[i];
    }
    if(a[1] == 1){
        swap(a[1],a[2]);
        cnt++;
    }
    if(a[n] == n){
        swap(a[n], a[n - 1]);
        cnt++;
    }
    if(n >= 3)
    for(int i = 3;i <= n;i++){
        if(i == a[i]){
            swap(a[i + 1],a[i]);
            cnt++;
        }
    }
    cout<<cnt;
    return 0;
}
/*
5
1 3 7 12 32
40
*/


Measured memory_bytes: 4480
#include<iostream>
#include<string>
#include<string.h>
using namespace std;
int main() {
	char s[110];
	long long int k;
	cin >> s;
	cin >> k;
	int i;
	if (strlen(s) >= k) {
		for (i = 0; i < k; i++) {
			if (s[i] != '1') {
				cout << s[i] << endl;
				break;
			}
			if (i == k - 1) cout << s[k - 1] << endl;
		}
	}
	else {
		for (i = 0; i < strlen(s); i++) {
			if (s[i] != '1') {
				cout << s[i] << endl;
				break;
			}
			if (i == strlen(s) - 1) cout << s[strlen(s)-1] << endl;
		}	
	}
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<b*(c/a)<<endl;
    return 0;
}

Measured memory_bytes: 256
N=input()
A=list(map(int, input().split()))

small= min(A)
large=max(A)
ans= 100*(100**2)

for j in range(small, large+1):
  diffA=[i-j for i in A]
  ans=min(ans, sum([i**2 for i in diffA]))
  
print(ans)

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

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;
	int a,b;
	while(cin>>a>>b){
		int j,k,l;
		j= a+b;
		k = a-b;
		l = a*b;
		int ans;
		ans = max(j,k);
		ans = max(ans,l);
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

a, b = na()
a = int(a)
b = round(b*100)
print(a*b//100)


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

int main() {
  ll A, B, N;
  cin >> A >> B >> N;
  int ans;

  if(B-1 <= N){
    ans = floor(A * (B-1) / B);
  }
  else{
    ans = floor(A * N / B);
  }

  cout << ans << endl;

}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
#define pii pair<int,int>
#define pll pair<long long,long long>
#define usi unordered_set<int>
#define usl unordered_set<long long>
#define umii unordered_map<int,int>
#define umsi unordered_map<string,int>
#define umll unordered_map<long long,long long>
#define fi first
#define sec second
#define pub push_back
#define pob pop_back
#define B begin
#define E end
#define mp make_pair
#define vi vector<int>
#define vl vector<long long>
#define vii vector<pii>
#define vll vector<pll>
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define endl '\n'
#define PIE 3.141592653
#define MOD 1000000007
#define f(i,a,b,c) for(ll i=a;i<=b;i+=c)
#define frev(i,n,b,c)  for(ll i=n;i>=b;i-=c)
const ll inf = 1000000000000000000;
using namespace std;
 
//            < = = = = =    GCD     = = = = = >
 
ll gcd(ll a,ll b)
{
    if(a<b) gcd(b,a);
    if(b==0)    return a;
    return gcd(b,a%b);
}
 
//            < = = = = =    LCM     = = = = = >
 
ll lcm(ll a,ll b) 
{ 
    ll x=(a/gcd(a,b))*b; 
    return x;
}
 
//            < = = = = =    power  x^n     = = = = = >
 
ll power(ll x , ll n , ll m=inf){
    if(x==0){
        return 0;
    }
    if(n==0){
        return 1;
    }
    ll ans;
    if(n%2==0){
        ll smallAns = power(x,n/2,m);
        ans = (smallAns*smallAns)%m;        
    } else {
        ll smallAns = power(x,n-1,m);
        ans = x;
        ans = (ans*smallAns)%m;
    }
    // for negative values also
    return (ans+m)%m;
    
}
 
//            < = = = = =    CHECK FOR PRIME     = = = = = >
 
bool isprime(int n){
   if(n==2){
        return true;
    }
    else if(n%2==0){
        return false;
    }
    else{
        for(int i=3;i*i<=n;i+=2){
            if(n%i==0){
                return false;
            }
        }
        return true;
    }
}
 
//            < = = = = =    SOLVE    = = = = = >
 
 //  void generate() {
//     memset(div, 0, sizeof div);
//     for (int i = 1; i <= N; i++) {
//         for (int j = i; j <= N; j += i) {
//             divisors[j] += 1;
//         }
//     }
// }

// bool cmp(pll x, pll y){
//     ll dx = min(2*(x.first),x.second)-min(x.first,x.second);
//     ll dy = min(2*(y.first),y.second)-min(y.first,y.second);
//     return dx>dy;
// }
 
// void rec(int ){
//     if(){

//         return 0;
//     }

//     return ;
// }
 
int solve() {fastio
       int n,m;
       cin>>n>>m;
       int an = 0,am=0;
       if(n>=2){
        an = n*(n-1);
        an = an/2;
       }
       if(m>=2){
        am = m*(m-1);
        am = am/2;
       }
       cout<<an+am;
    return 0;
}
    
//            < = = = = =    MAIN     = = = = = >
 
int main() {fastio

    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

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

    return 0;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc065.contest.atcoder.jp/tasks/arc065_a?lang=en>
問題文============================================================
 英小文字からなる文字列 S が与えられます。
 Tが空文字列である状態から始め、以下の操作を好きな回数繰り返すことで S=T とすることができるか判定してください。
 
 T の末尾に dream dreamer erase eraser のいずれかを追加する。

=================================================================

解説=============================================================

 追加するにて、後ろ側から見た時、同じ部分文字となる部分が存在しないので、
 Sを後ろから見て行った時に追加する文字を一意に決められる
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    string S; cin >> S;
    string s[4] = {"dream" , "dreamer", "erase" ,"eraser"};
    int at = (int)S.length();
    while(at > 0){
        bool f = false;
        for(int i = 0; i < 4;i++){
            if(at < s[i].length()) continue;
            string tmp = S.substr(at-s[i].length(),s[i].length());
            if(tmp == s[i]){
                f = true;
                at -= s[i].length();
                break;
            }
        }
        if(!f){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 512