akhauriyash/Code-Regression huggingface dataset:
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    if n % 2 == 1 {
        p(0);
        return;
    }
    let mut n =n/2;
    let mut count=0;
    while n>0{
        count+=n/5;
        n/=5;
    }    
    p(count);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define FOR0(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)

int abs(int n)
{
    if (n >= 0)
        return n;
    else
        return -n;
}

int main()
{
    int N;
    cin >> N;
    if (N % 2 == 0)
    {
        cout << (N - 2) * N / 2 << endl;
        FOR(i, 1, N)
        {
            FOR(j, i + 1, N)
            {
                if (i + j != N + 1)
                {
                    cout << i << " " << j << endl;
                }
            }
        }
    }
    else
    {
        cout << (N - 1) * (N - 1) / 2 << endl;
        int M = N - 1;
        FOR(i, 1, M)
        {
            FOR(j, i + 1, M)
            {
                if (i + j != M + 1)
                {
                    cout << i << " " << j << endl;
                }
            }
        }
        FOR(i, 1, M)
        {
            cout << i << " " << N << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a[10];
bool ok(int x)
{
 	while(x!=0)
   	{
      	if(a[x%10]) 
         	return false;
      	x/=10;
    }
    return true;
}
int main()
{
	int n,k,j;
	cin>>n>>k;
	for(int i=0;i<k;++i)
	{
 		cin>>j;
  		a[j]=1;
    }
    for( ; ; )
    {
    	if(ok(n)==true)
    	{
    		cout<<n;
    		system("pause");
    		return 0;
   		}
   		n++;
	}
	system("pause");
    return 0;
}

Measured memory_bytes: 504
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
// #define int ll
#define pb push_back
#define pob pop_back
#define __bp __builtin_popcount
using pii = pair<int,int>;
using pil = pair<int,ll>;
using pli = pair<ll,int>;
using pdd = pair<ld,ld>;
using vint = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpli = vector<pli>;
#define F first
#define S second
const int N = 3e5+5;//(1 << 18) + 5;
//const ll inf = 1e18+7;
const int Inf = 1e9+7;
const ll INF = 1e18+7;
const int Mod = 1e9+7;
const ld eps = 1e-9;
#ifndef M_PI
#define M_PI 3.1415926535
#endif

void io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr.tie(NULL);
//	freopen("sweets.in", "r", stdin);
//	freopen("sweets.out", "w", stdout);
//	cout << setprecision(7) << fixed;
}

int n, m;
int cntx[N], cnty[N];

vpii dots;

void solve()
{
	int k;
	cin >> n >> m >> k;
	int mxx = 0, mxy = 0;
	for (int i = 0; i < k; ++i)
	{
		int x, y;
		cin >> x >> y;
		--x; --y;
		++cntx[x];
		++cnty[y];
		mxx = max(mxx, cntx[x]);
		mxy = max(mxy, cnty[y]);
		dots.pb({x, y});
	}
	set<int> arrx, arry;
	for (int i = 0; i < n; ++i)
	{
		if (cntx[i] == mxx)
			arrx.insert(i);
	}
	for (int i = 0; i < m; ++i)
	{
		if (cnty[i] == mxy)
			arry.insert(i);
	}
	int cnt = 0;
	for (int i = 0; i < k; ++i)
	{
		if ((arrx.find(dots[i].F) != arrx.end()) && (arry.find(dots[i].S) != arry.end()))
		{
			++cnt;
		}
	}
	if (cnt == ll(arrx.size()) * ll(arry.size()))
	{
		cout << mxy + mxx - 1;
	}
	else
		cout << mxy + mxx;
}

signed main()
{
	io();
	int tt = 1;
//	cin >> tt;
	while (tt--)
		solve();
}
//overflows!!!

Measured memory_bytes: 36040
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    int q1, b, c1, c2, q2;
    while(cin >> q1, q1){
        cin >> b >> c1 >> c2 >> q2;
        int x, y;
        x = min(b / c1, q2);
        b -= c1*x;
        y = b / c2;
        while(x){
            if(x + y >= q1) break;
            x--;
            b += c1;
            y = b / c2;
        }
        if(x == 0) cout << "NA" << endl;
        else cout << x << ' ' << y << endl;
    }
}

Measured memory_bytes: 1156
#include <iostream>

using namespace std;

long long solve(long long b, long long n) {
    if (n < b)
        return n;
    else {
        return n%b + solve(b, n/b);
    }
}

int main() {
    long long n,s,b,i;
    cin >> n >> s;
    if(n == s){
        cout << n + 1 << endl;
        return 0;
    }
    else {
        for(i = 2;i*i <= n; i++) {
            if (solve(i,n) == s){
                cout << i << endl;
                return 0;
            }
        }
        for(long long p = i; p >= 1; p--) {
            if ((n-s)%p != 0)
                continue;
            b = (n-s)/p + 1;
            if (b < 2)
                break;
            if (solve(b,n) == s) {
                cout << b << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int direct[4][2] = {0,1,-1,0,1,0,0,-1};
int n,m;
ll ans;
char s[407][407];
int p[400007],cnt[400007],c_[400007];
int Hash(int x,int y){
    return x*400+y;
}
int Find(int x){
    return x == p[x]?x:p[x] = Find(p[x]);
}
void Merge(int x,int y){
    x = Find(x);
    y = Find(y);
    if(x!=y){
        p[x] = y;
        cnt[y] += cnt[x];
        c_[y] += c_[x];
    }
}
int main(){
    for(int i=0;i<400007;i++)
        p[i] = i,cnt[i] = 1;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(s[i][j] == '#')
                c_[Hash(i,j)] = 1;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            for(int k=0;k<4;k++){
                int x = i+direct[k][0];
                int y = j+direct[k][1];
                if(x>0&&x<=n&&y>0&&y<=m && s[i][j]!=s[x][y])
                    Merge(Hash(x,y),Hash(i,j));
            }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++){
            int h = Find(Hash(i,j));
            if(cnt[h]>1){
                ans += 1ll*c_[h]*(cnt[h]-c_[h]);
                cnt[h] = -1;
            }
        }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

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

    // input
    string str;
    cin >> str;
    
    cout << (int)str.rfind('Z') - (int)str.find('A') + 1 << "\n";
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 720
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
int main() {
    int n,m;cin >> n >> m;
    vi food(m);
    rep(i, n) {
        int k;cin >> k;
        rep(j, k) {
            int a;cin >> a;
            a--;
            food[a]++;
        }
    }
    int count = 0;
    rep(i, m) if(food[i]==n) count++;
    cout << count << endl;
    return 0;
}


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

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ii, null_type,less<ii>, rb_tree_tag,tree_order_statistics_node_update>
#define graph vector<vi>
#define Mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T int t;cin>>t;rep(i,t)


int binarysearch (int arr[], int n, int mid) {

    int ans = 0;

    rep(i, n) {
        
        ans += arr[i] / mid;
        if (arr[i] % mid == 0)
            ans--;
    }

    return ans;
}


void solve() {

    int n, k;
    cin >> n >> k;
    int arr[n];
    int front = 0, end = 0;
    rep(i, n) {

        cin >> arr[i];
        end = max(end, arr[i]);
    }

    while (front < end) {

        int mid = front + (end - front) / 2;

        if (mid == 0)
            break;

        int temp = binarysearch(arr, n, mid);

        if (temp <= k)
            end = mid;
        else
            front = mid + 1;
        
    }
    
    cout << end << "\n";
    
 }

int main()
{
    fastio;
    // T
    solve();
    //code
    return 0;
}


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

typedef long long ll;

const ll mod = 1000000007;
int N, M;
vector<ll> X, Y;
ll sumx, sumy;

ll solve(int mask) {
    if(mask & 1) reverse(X.begin(), X.end());
    if(mask & 2) reverse(Y.begin(), Y.end());

    ll ret = 0;
    ll sumx = 0;
    for(int i = 0; i < N; i++) {
        sumx += X[i] * i % mod;
        sumx = (sumx % mod + mod) % mod;
    }
    ll sumy = 0;
    for(int i = 0; i < M; i++) {
        sumy += Y[i] * i % mod;
        sumy = (sumy % mod + mod) % mod;
    }
    ret = sumx * sumy % mod;

    if(mask & 1) reverse(X.begin(), X.end());
    if(mask & 2) reverse(Y.begin(), Y.end());

    return (mask == 0 || mask == 3)? ret : -ret;
}

int main() {
    scanf("%d %d", &N, &M);
    X.resize(N);
    for(int i = 0; i < N; i++) {
        scanf("%lld", &X[i]);
    }
    Y.resize(M);
    for(int i = 0; i < M; i++) {
        scanf("%lld", &Y[i]);
    }
    ll ans = 0;
    for(int i = 0; i < 4; i++) {
        ans += solve(i);
        ans = (ans % mod + mod) % mod;
    }
    printf("%lld", ans);
}


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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

//---------------------------

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

    bool d[10];
    rep(i,10) d[i] = false;
    rep(i,k){
        int x;
        cin >> x;
        d[x] = true;
    }

    while(true){
        string s = to_string(n);
        int digits = s.size();
        bool allow = true;
        
        rep(i,digits){
            rep(j,10){
                if(s[i]-'0'==j && d[j]){
                    allow = false;
                }
            }
        }

        if(allow) break;
        n++;
    }

    cout << n << endl;
    return 0;
}

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

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.st <<","<<P.nd <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAXN = 1e6+6;
int values[MAXN];
int n;
int ans[MAXN];
int base = 1;
vector<int> G[MAXN];
int tree[MAXN * 4];

int query(int w) {
  w += base - 1;
  int ret = 0;
  while (w != 1) {
    if (w % 2) {
      ret = max(ret, tree[w - 1]);
    }
    w /= 2;
  }
  return ret;
}

void update(int w, int val) {
  w += base - 1;
  tree[w] = val;
  while (w) {
    w /= 2;
    tree[w] = max(tree[w * 2], tree[w * 2 + 1]);
  }
}

int getValue(int w) {
  w += base - 1;
  return tree[w];
}

void dfs(int w, int o) {
  int oldVal = getValue(values[w]);
  int neww = query(values[w]);
  // debug(w, values[w], neww);
  update(values[w], neww + 1);
  // for (int i = 1; i < 2 * base; ++i) {
  //   debug(i, tree[i]);
  // }
  ans[w] = tree[1];
  for (auto u : G[w]) {
    if (u != o) {
      dfs(u, w);
    }
  }
  update(values[w], oldVal);
}

int main() {
  scanf("%d", &n);
  vector<pair<int, int>> v;
  while (base < n) {
    base *= 2;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &values[i]);
    v.push_back({values[i], i});
  }
  sort(v.begin(), v.end());

  int act = 1;
  for (int i = 0; i < (int)v.size(); ++i) {
    if (i != 0 && v[i - 1].first != v[i].first) {
      ++act;
    }
    values[v[i].second] = act;
  }

  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dfs(1, -1);

  for (int i = 1; i <= n; ++i) {
    printf("%d\n", ans[i]);
  }
}


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

int main() {
 string s;
  cin>>s;
if(s=="Sunny"){
  cout<<"Cloudy"<<endl;
}
  if(s=="Cloudy"){
  cout<<"Rainy"<<endl;
}
  if(s=="Rainy"){
  cout<<"Sunny"<<endl;
}
}

Measured memory_bytes: 256
S = list(input())
T = input()
match = False
for x in range(len(S)):
    rotate = S.pop()
    # rotate = S.(-1:)
    S.insert(0, rotate)
    moji = "".join(S)
    if moji == T:
        match = True

if match == True:
    print("Yes")
else:
    print("No")


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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define fff ff
#define sss ss.ff
#define ttt ss.ss
#define INF (1 << 30)
#define LLF (1ll << 60)
#define PRIME (1000000007)
#define FASTIO                      \
  std::ios::sync_with_stdio(false); \
  cin.tie(0)
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define FILE_INPUT                  \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout)

#define all(x) x.begin(), x.end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<string> vs;

/*-----------------END TEMPLATE-----------------*/

int n, t;
vii dishes;

int dp[3050][3050];

int solve(int i, int time) {
  if (time >= t) return 0;
  if (i >= n) return 0;
  if (dp[i][time] != -1) return dp[i][time];

  int a1 = dishes[i].ss + solve(i + 1, time + dishes[i].ff);
  int a2 = solve(i + 1, time);

  dp[i][time] = max(a1, a2);
  return dp[i][time];
}

int main() {
  FASTIO;
  cin >> n >> t;
  memset(dp, -1, sizeof dp);
  rep(i, 0, n) {
    int x, y;
    cin >> x >> y;
    dishes.eb(x, y);
  }
  sort(dishes.begin(), dishes.end());
  cout << solve(0, 0) << endl;
}


Measured memory_bytes: 36864
import operator


class SegmentTree:
    def __init__(self, seq, op=operator.add):
        self.n = len(seq)
        self.op = op
        self.tree = [-1] * self.n + seq
        for i in reversed(range(1, self.n)):
            self.tree[i] = op(self.tree[2*i], self.tree[2*i+1])

    def modify(self, pos, val):
        assert pos < self.n
        pos += self.n
        self.tree[pos] = val
        while pos > 1:
            self.tree[pos//2] = self.op(self.tree[pos], self.tree[pos ^ 1])
            pos //= 2

    def query(self, L, R):
        assert L <= R and L >= 0 and R <= self.n
        res = 0
        L += self.n
        R += self.n
        while L < R:
            if L % 2 == 1:
                res = self.op(res, self.tree[L])
                L += 1
            if R % 2 == 1:
                R -= 1
                res = self.op(res, self.tree[R])

            L //= 2
            R //= 2

        return res


def solve(n, heights, beauty):
    st = SegmentTree([0] * (n+1), op = lambda x, y: max(x, y))

    for flower in range(n):
        st.modify(heights[flower], st.query(0, heights[flower] + 1) + beauty[flower])

    return st.tree[1]


def main():
    n = int(input())
    heights = [int(c) for c in input().split()]
    beauty = [int(c) for c in input().split()]
    ans = solve(n, heights, beauty)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 121936
//  RAKSHIT KADAM

 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the size of arrayss!!!
 
// NUMERIC DEFINITIONS :
    #define INF 100000000000000005
    #define inf 1000000004
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
// ll fact[1000005];
//void facto()
//{
//    ll lim =1000005;fact[0]=1;
//    for(ll i=1;i<lim;i++)
//    {
//        fact[i]=(fact[i-1]*i)%MOD;
//    }
//}
//ll ncr(ll a,ll b)
//{
//    ll ret = 0;
//    ret = fact[a]*(modInverse(fact[b],MOD));
//    ret%=MOD;
//    ret*=modInverse(fact[a-b],MOD);
//    ret%=MOD;
//    return ret;
//}
void solve(ll tt)
{
    
    cout<<"Case #"<<tt<<":"<<endl;
    
}

void s()
{
    ll x;cin>>x;
    if(x>=400 && x<600)
    {
        cout<<8<<endl;
    }
    else if(x>=600 && x<800)
    {
        cout<<7<<endl;
    }
    else if(x>=800 && x<1000)
    {
        cout<<6<<endl;
    }
    else if(x>=1000 && x<1200)
    {
        cout<<5<<endl;
    }
    else if(x>=1200 && x<1400)
    {
        cout<<4<<endl;
    }
    else if(x>=1400 && x<1600)
    {
        cout<<3<<endl;
    }
    else if(x>=1600 && x<1800)
    {
        cout<<2<<endl;
    }
    else cout<<1<<endl;
}

signed main()
{
   Need_for_speed(activated);
//    input;
//    ll ttt;cin>>ttt;
//    for(ll tt=1;tt<=ttt;tt++)
//    {
//  solve(tt);
//   }
    
//    solve();
    s();
//    satisfy{s();}
    return 0;
}
//Concentrate while implementing,,,!!!
 


Measured memory_bytes: 3644
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int K = sc.nextInt();
   
  if(K == 1 )
  {
    System.out.println(0); 
  }
   
  else
  {
    System.out.println(N-K); 
  }
 }
}

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

using namespace std;

constexpr int MAX_V = 1000;
constexpr int INF = (1 << 29);

struct edge {
    int to, cap, cost, rev;
    edge(int to, int cap, int cost, int rev) :
        to{to}, cap{cap}, cost{cost}, rev{rev} {}
};

int V;
vector<edge> G[MAX_V];
int dist[MAX_V], prevv[MAX_V], preve[MAX_V];

void add_edge(int from, int to, int cap, int cost)
{
    G[from].emplace_back(to, cap, cost, G[to].size());
    G[to].emplace_back(from, 0, -cost, G[from].size() - 1);
}

int min_cost_flow(int s, int t, int f)
{
    int res = 0;
    while (f > 0) {
        fill(dist, dist + V, INF);
        dist[s] = 0;
        bool update = true;
        while (update) {
            update = false;
            for (int v = 0; v < V; v++) {
                if (dist[v] == INF) continue;
                for (int i = 0; i < (int)G[v].size(); i++) {
                    edge& e = G[v][i];
                    if (e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
                        dist[e.to] = dist[v] + e.cost;
                        prevv[e.to] = v;
                        preve[e.to] = i;
                        update = true;
                    }
                }
            }
        }
        if (dist[t] == INF) return -1;
        int d = f;
        for (int v = t; v != s; v = prevv[v]) {
            d = min(d, G[prevv[v]][preve[v]].cap);
        }
        f -= d;
        res += d * dist[t];
        for (int v = t; v != s; v = prevv[v]) {
            edge& e = G[prevv[v]][preve[v]];
            e.cap -= d;
            G[v][e.rev].cap += d;
        }
    }
    return res;
}

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    
    int S = N + (M + 1) + 1, T = S + 1;
    V = T + 1;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        
        add_edge(S, i, 1, 0);
        add_edge(i, N, 1, -a);
    }
    

    for (int i = 0; i < M; i++) {
        for (int j = 0; j < N; j++) {
            int b;
            cin >> b;
            add_edge(j, N + i + 1, 1, -b);
        }
    }    
    
    for (int i = 0; i < M; i++) {
        int Ti;
        cin >> Ti;
        add_edge(N + i + 1, N + (M + 1), Ti, 0);
    }

    add_edge(N, T, INF, 0);
    add_edge(N + (M + 1), T, N - K, 0);

    cout << -min_cost_flow(S, T, N) << endl;    
    return 0;
}

Measured memory_bytes: 3372
def solve():
    n = int(input())
    c = []
    s = []
    f = []
    result = []
    for i in range(n - 1):
        tc, ts , tf = input().split()
        c.append(int(tc))
        s.append(int(ts))
        f.append(int(tf))
    for i in range(n):
        t = 0
        for j in range(i, n - 1):
            if t < s[j]:
                t = s[j]
            elif t % f[j] == 0:
                pass
            else:
                t = t + f[j] - (t % f[j])
            t = t + c[j]
        result.append(t)
    for i in range(n):
        print(result[i])
solve()    

Measured memory_bytes: 3188
bingo = [list(map(int,input().split())) for i in range(3)]
n = int(input())
num = [int(input()) for _ in range(n)]

for i in range(3):
  for j in range(3):
    if bingo[i][j] in num:
      bingo[i][j] = 0

for i in range(3):
  if bingo[i].count(0) == 3:
    print("Yes")
    exit()
  elif bingo[0][i] == 0 and bingo[1][i] == 0 and bingo[2][i] == 0:
    print("Yes")
    exit()
  else:
    pass

if bingo[0][0] == 0 and bingo[1][1] == 0 and bingo[2][2] ==0:
  print("Yes")
  exit()
elif bingo[0][2] == 0 and bingo[1][1] == 0 and bingo[2][0] == 0:
  print("Yes")
  exit()
else:
  print("No")


Measured memory_bytes: 9264
// She is Pretty pretty!
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 1e6+100;
int n, a[N];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 0; i < n-1; i++){
        int x;
        cin >> x;
        a[x]++;

    }
    for(int i = 1; i <= n; i++){
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 4348
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int array[3];
	for(int i = 0; i < 3; i++) scanf("%d",&array[i]);
	for(int i = 2; i > 0; i--){
		for(int j = 0; j < i; j++){
			if(array[j] > array[j+1])swap(array[j],array[j+1]);
		}
	}
	printf("%d %d %d\n",array[0],array[1],array[2]);
}


Measured memory_bytes: 2720
//daddy's back in town, back to rolling the damn hash yoooo babeeeeees//
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
const ll mod = 998244353;
int a, b;
char ans[111][111];

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	cin>>a>>b;
	a--, b--;
	for(int i=1; i<=100; i++){
		for(int j=1; j<=100; j++){
			if(i<=50) ans[i][j]='.';
			else ans[i][j]='#';
		}
	}
	for(int i=1; i<=49 && b; i+=2){
		for(int j=1; j<=100 && b; j+=2){
			ans[i][j]='#';
			b--;
		}
	}
	for(int i=52; i<=100 && a; i+=2){
		for(int j=1; j<=100 && a; j+=2){
			ans[i][j]='.';
			a--;
		}
	}
	cout<<100<<" "<<100<<"\n";
	for(int i=1; i<=100; i++){
		for(int j=1; j<=100; j++){
			cout<<ans[i][j];
		}
		cout<<"\n";
	}
}

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

using namespace std;
using ll = long long;

int main(void) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while (1) {
    c -= b;
    if (c <= 0) {
    cout << "Yes" << endl;
    return 0;
    }
    a -= d;
    if (a <= 0) {
    cout << "No" << endl;
    return 0;
  }
  }
  if (b <= 0) {
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string.h>
using namespace std;

int main(void){
  int i,a,b,flg,s[104];

  while(1){
    memset(s,0,sizeof(s));
    while(1){
      if(!(cin>>a>>b)) return 0;
      if(!a && !b) break;
      s[a]++;
      s[b]++;
    }

    flg = 0;
    if(s[1] % 2 == 1 && s[2] % 2 == 1){
      flg = 1;
    }

    for(i=3;i<104 && flg==1;i++){
      if(s[i] != 0 && s[i] % 2 == 1){
        flg = 0;
      }
    }

    if(flg){
      cout<<"OK\n";
    }
    else{
      cout<<"NG\n";
    }
  }
}

Measured memory_bytes: 0
#include <iostream>

int main(int argc, char const *argv[]) {
    long long X;std::cin >> X;
    long long i=1;
    long long sum=0;
    while (true) {
        if (sum+i>=X) {
            std::cout << i << '\n';
            break;
        }
        sum+=i;
        i++;
    }
    return 0;
}


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

int main() {
	int h, w;
	string r[100],r2[200];
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> r[i];
	}
	for (int i = 0; i < h; i++) {
		r2[2*i] = r[i];
		r2[2*i + 1] = r[i];
	}
	for (int i = 0; i < 2 * h; i++) {
		cout << r2[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

void yes() {
  cout << "Yes\n";
  exit(0);
}

void no() {
  cout << "No\n";
  exit(0);
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  if (a[0] == 0 && a.back() == 0) yes();
  if (n % 3) no();
  int t = n / 3;
  if (a[0] == a[t-1] && a[t] == a[2*t-1] && a[2*t] == a[3*t-1] && (a[0]^a[t]^a[2*t]) == 0) yes();
  else no();
  return 0;
}


Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
    sc.Scan()
    return sc.Text()
}

func nextInt() int {
   sc.Scan()
   i, _ := strconv.Atoi(sc.Text())
   return i
}

func digit(n int, list []int) []int {
   if n > 0 {
       return digit(n/10, append(list, n%10))
   }
   return list
}

func sumList(list []int) int {
    x := 0
    for _, n := range list {
        x += n
    }
    return x
}

func storeIntArr(n int) []int {
    var a []int
    for i := 0; i < n; i++ {
        a = append(a, nextInt())
    }
    return a
}

func main() {
    sc.Split(bufio.ScanWords)

    n, a, b := nextInt(), nextInt(), nextInt()
    total := 0
    for i := 1; i <= n; i++ {
        var list []int
        list = digit(i, list)
        x := sumList(list)
        if a <= x && x <= b {
            total += i
        }
    }


    fmt.Println(total)
}


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

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

  ll N; cin >> N;
  ll K; cin >> K;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];
  vector<ll> dp(K + 100, -1);
  dp[0] = 0;
  for (ll i = 0; i < K + 1; i++) {
    bool ok = false;
    for (ll j = 0; j < N; j++) {
      if (i - A[j] < 0) continue;
      if (dp[i - A[j]] == 0) ok = true;
    }
    if (ok) dp[i] = 1;
    else dp[i] = 0;
  }

  if (dp[K] == 1) cout << "First\n";
  else cout << "Second\n";
  
  return 0;
}

Measured memory_bytes: 1024
/*
	*	Created By: 'Present_Sir'
	*	Created On: Friday 04 September 2020 11:13:31 AM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sz(v) ((int)v.size())
#define lgt(s) ((int)s.length())
#define int long long
using namespace std;

class Solver{
    public:
        void test(){
            //int t; cin>>t; for(int i=1; i<=t; ++i)
            {
                //cout<<"Case #"<<i<<": ";
                this->solve();
            }
        }
        void solve(){
            int a,b;
            cin>>a>>b;
            if(a == 1 or b == 1){
                cout<<"1"<<endl;
                return;
            }
            cout << (a*b+1)/2 <<endl;
        }
};


int32_t main(){
    IOS;
    Solver S;
    S.test();
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
    if(s == "SAT") cout << 1;
    else if(s == "FRI") cout << 2;
    else if(s == "THU") cout << 3;
    else if(s == "WED") cout << 4;
    else if(s == "TUE") cout << 5;
    else if(s == "MON") cout << 6;
    else if(s == "SUN") cout << 7;
}

Measured memory_bytes: 256
S=list(input())
l=len(S)
if S[0]!='A':
  print('WA')
  exit()
if S.count('C')!=1:
  print('WA')
  exit()
if S.index('C')<2 or l-2<S.index('C'):
  print('WA')
  exit()
  
S.remove('A')
S.remove('C')
s=''.join(S)
if s.islower()==True:
  print('AC')
else:
  print('WA')

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100000
int n,L[MAXN+5],S;
int main()
{
	scanf("%d%d",&n,&S);
	for(int i=1;i<=n;i++)
		scanf("%d",&L[i]);
	for(int i=1;i<=n-1;i++)
	if(L[i]+L[i+1]>=S)
	{
		printf("Possible\n");
		for(int j=1;j<=i-1;j++)printf("%d\n",j);
		for(int j=n-1;j>=i+1;j--)printf("%d\n",j);
		printf("%d\n",i);
		return 0;
	}
	printf("Impossible\n");//
}

Measured memory_bytes: 1152
#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>;

const ll mod = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;
  rep(i, 60) {
    ll x = 0;
    rep(j, n) if (a[j] >> i & 1) x++;
    ll now = x * (n - x) % mod;
    rep(j, i) now = now * 2 % mod;
    ans += now;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}

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

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

  if(n==0){
    cout<<"1"<<endl;
  }else if(n==1){
    cout<<"2"<<endl;
  }else if(n==2){
    cout<<"1"<<endl;
  }else{
    cout<<"0"<<endl;
  }

  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    vector<pair<ll, ll>> A(N);
    rep(i, N) cin >> A[i].first >> A[i].second;
    sort(A.begin(), A.end());
    cout << A.back().first + A.back().second << endl;
    return 0;
}


Measured memory_bytes: 4800
#include<bits/stdc++.h>
using namespace std;
int a[15][15],c[15],ans=1e9+7,n,m,q,s[15];
int main()
{
	cin>>n>>m>>q;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	}
	for(int i=0;i<(1<<n);i++)
	{
		memset(s,0,sizeof(s));
		int sum=0;
		for(int j=n-1;j>=0;j--)
		{
			if((i>>j)%2)
			{
				for(int k=1;k<=m;k++)
					s[k]+=a[n-j][k];
				sum+=c[n-j];
			}
		}
		int flag=0;
		for(int i=1;i<=m;i++)
			if(s[i]<q)
				flag=1;
		if(!flag)
			ans=min(ans,sum);
	}
	if(ans==1000000007)
		cout<<-1;
	else
		cout<<ans;
}

Measured memory_bytes: 3636
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    #l,r,d=map(int,input().split())
    n=int(input())
    a=list(map(int,input().split()))

    count=0
    for i in range(n):
        if a[i]%2!=0 and (i+1)%2!=0:
            count+=1
    print(count)





if __name__ == "__main__":

    main()


Measured memory_bytes: 72556
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;

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


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

    if(N%2==1){
        cout<<N/2<<endl;
    }else{
        cout<<N/2-1<<endl;
    }
    return 0;
}

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

# Mの約数列挙
divs = []
for i in range(1, int(M ** 0.5) + 1):
    if M % i == 0:
        divs.append(i)
        divs.append(M // i)

ans = 0
divs.sort(reverse=True)
for d in divs:
    if N * d <= M:
        print(d)
        exit()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>

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

using namespace std;

int main() {
    
    int N;
    
    cin >> N;
    
    int digit  = log10(N)+1;
    
    int a = pow(10,digit-1);
    
    if(a != N){
        int b = N-a;
        int dig,sum=0;
        while(b){
            dig = b % 10;
            sum = sum + dig;
            b = b / 10;
        }
        cout << sum + 1 <<endl;
    }else{
        cout << "10" <<endl;
    }

    
    
    return 0;
}


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

int main()
{
	int n;
	cin >> n;
	auto a = vector<int>(n);
	auto b = a, c = a;
	for(auto&& ai : a) cin >> ai;
	for(auto&& bi : b) cin >> bi;
	for(auto&& ci : c) cin >> ci;
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	auto d = vector<long long int>(n + 1);
	int p = n - 1, cnt = 0;
	for(auto i = n - 1; i >= 0; --i){
		while(p >= 0 && b[i] < c[p]){
			--p;
			++cnt;
		}
		d[i] = cnt + d[i + 1];
	}
	long long int ans = 0;
	p = 0;
	for(auto i = 0; i < n; ++i){
		while(p < n && b[p] <= a[i]) ++p;
		if(p < n) ans += d[p];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2176
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

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

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  string S;
  cin >> S;
  if (S[S.size() - 1] == 's') {
    cout << S << "es" << endl;
  } else {
    cout << S << "s" << endl;
  }

  return 0;
}

Measured memory_bytes: 3624