akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

inline ll ceiling(ll a, ll m) { return (a + m - 1) / m; }

int main() {
  int k;
  cin >> k;
  vector<ll> a(k + 1);
  for (int i = 1; i <= k; i++) {
    cin >> a[i];
  }
  ll mn = 2;
  ll mx = 2;
  for (int i = k; i > 0; i--) {
    // [L, R]のaの倍数のminは、ceil(L/a)*a
    //                  maxは、floar(R/a)*a
    ll amn = ceiling(mn, a[i]) * a[i];
    ll amx = mx / a[i] * a[i];
    if (amn > mx || amx < mn) {
      cout << -1 << endl;
      return 0;
    }
    mn = amn;
    mx = amx + a[i] - 1;
  }
  cout << mn << " " << mx << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int N; cin>>N;
	string ans;
	switch(N%10){
		case 2: case 4: case 5: case 7: case 9: ans="hon"; break;
		case 0: case 1: case 6: case 8: ans="pon"; break;
		case 3: ans="bon";
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
// 1-indexed BIT
class BIT{
    public:
    vector<ll>bit;
    int N;
    void init(int n){
        N = n;
        bit = vector<ll>(N, 0);
    }
    // [1, n] = {}
    BIT(int n = 0){
        init(n);
    }
    // sum [1, i]
    ll sum(int i){
        ll s = 0;
        while(i > 0){
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    ll sum(ll l, ll r){
        if(l > r)return 0;
        if(l == 1)return sum(r);
        return sum(r) - sum(l - 1);
    }
    void add(int i, ll x){
        if(i == 0)return;
        while(i <= N){
            bit[i] += x;
            i += i & -i;
        }
    }
};

ll A[202020];

ll poped[202020];
priority_queue<ll>MAX_Q;
priority_queue<ll, vector<ll>, greater<ll> >MIN_Q;
void get_mn_mx(ll &mn, ll &mx){
    while(!MAX_Q.empty()){
        if(poped[MAX_Q.top()])MAX_Q.pop();
        else break;
    }
    while(!MIN_Q.empty()){
        if(poped[MIN_Q.top()])MIN_Q.pop();
        else break;
    }
    if(MAX_Q.empty()){
        mn = -INF;
        mx = INF;
        return;
    }
    mn = MIN_Q.top();
    mx = MAX_Q.top();
}
void push(ll x){
    MAX_Q.push(x);
    MIN_Q.push(x);
}

int main(){

    ll N, K;
    cin >> N >> K;
    BIT down(202020);
    rep1(i, N){
        cin >> A[i];
        A[i]++;
        if(A[i] < A[i - 1]){
            down.add(i, 1);
        }
    }
    A[0] = 200020;
    for(ll i = 0; i < K; i++)push(A[i]);
    ll ans = 0;
    ll def = 0;
    for(ll i = 1; i + K - 1 <= N; i++){
        ll l = i, r = l + K - 1;
        ll mn, mx;
        get_mn_mx(mn, mx);
        poped[A[l - 1]] = 1;
        push(A[r]);
        if(down.sum(l + 1, r) == 0){
            def = 1;
            continue;
        }
        if(mn == A[l - 1] && mx < A[r]){
            continue;
        }
        else{
            ans++;
        }
    }

    cout << ans + def << endl;

    return 0;
}

Measured memory_bytes: 8300
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
char s[200];
int main()
{
	cin>>s+1;
	int n = strlen(s+1);
	if(s[n] == 'L' && s[n-1] == 'A' && s[n-2] == 'V' && s[n-3] == 'I' && 
		s[n-4] == 'T' && s[n-5] == 'S' && s[n-6] == 'E' && s[n-7] == 'F')
		for(int i = 1; i <= n-8; i++) printf("%c",s[i]);
	
	
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	vector<int> a(n), occs(2e5 + 1);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		++occs[a[i]];
	} 

	int maximum = -1, second = -1;
	bool is_duplicated = false;
	for (int i = 2e5; i >= 1; --i) {
		if (occs[i]) {
			maximum = i;
			if (occs[i] > 1) {
				is_duplicated = true;
			} else {
				for (int j = i - 1; j >= 1; --j) {
					if (occs[j]) {
						second = j;
						break;
					}
				}
			}

			break;
		}
	}

	for (int i = 0; i < n; ++i) {
		if (a[i] != maximum) {
			cout << maximum << "\n";
		} else {
			if (is_duplicated) {
				cout << maximum << "\n";
			} else {
				cout << second << "\n";
			}
		}
	}


	return 0;

}

Measured memory_bytes: 3200
use std::ascii::AsciiExt;

fn main() {
    let v: Vec<usize> = read_vec();
    let (n, k) = (v[0], v[1]);
    let s: String = read();
    let mut s: Vec<char> = s.chars().collect();

    s[k - 1].make_ascii_lowercase();
    for i in s {
        print!("{}", i);
    }
    println!("\n");
}





//**********************************************************************************************************************************************//

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: u64) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

// 10進数での各桁の和
pub fn sum_dights(x: isize) -> isize {
    if x % 10 == 0 {
        return 0
    }
    let m = x % 10;
    m + sum_dights((x - m) / 10)
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define PI 3.141592653589793

const int mod = 2019;

int main() 
{	ios;
	int t = 1;
	//cin>>t;
	while (t--) {
		string s;
		cin>>s;
		int n = sz(s);
		int suf = 0;
		int power_of_ten = 1;
		vi cnt_suf(mod+1);
		ll answer = 0;
		cnt_suf[suf]++;
		for (int i = n - 1; i >= 0; --i) {
			int digit = s[i] - '0';
			suf = (suf + digit * power_of_ten)%mod;
			power_of_ten = (power_of_ten * 10)%mod;
			answer += cnt_suf[suf];
			cnt_suf[suf]++;
		}
		cout<<answer;
		cout<<"\n";
	}
    return 0; 
} 

Measured memory_bytes: 3756
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

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

fn xx(vs: &Vec<(i64, i64, i64)>, z0: i64, z1: i64) -> bool {
    for v in vs {
        if v.0 == z0 && v.1 == z1 {
            return true;
        }
    }
    false
}

fn main() {
    input! {
        n: usize,
        xys: [(i64, i64); n],
    }
    if n == 1 {
        println!("1");
        return;
    }
    let mut xys = xys;
    xys.sort_by_key(|c| c.0);
    let mut vs = Vec::new();

    for i in 0..xys.len() {
        for j in 0..xys.len() {
            if i == j {
            } else {
            let mut b0 = xys[i].0 - xys[j].0;
            let mut b1 = xys[i].1 - xys[j].1;
            if xx(&vs, b0, b1) {
                for m in &mut vs {
                    if m.0 == b0 && m.1 == b1 {
                        m.2 += 1;
                    }
                }
            } else {
                vs.push((b0, b1, 1));
            }
            }
        }
    }
    let max =
        vs.iter().fold(std::i64::MIN, |max, &item| if item.2 > max {item.2} else {max});
    println!("{:?}",n as i64 - max);
    //println!("{:?}",vs);
}

Measured memory_bytes: 4352
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);


//番号ズレ注意！！
int main() {
    int N;
    int number[100010];
    REP(i, 100010) {
        number[i] = 0;
    }
    cin >> N;
    REP(i, N) {
        int a;
        cin >> a;
        number[a] += 1;
    }
    int ans = 0;
    REP_1(i, 100000) {
        ans = max(ans, number[i - 1] + number[i] + number[i + 1]);
    }
    print(ans);
}


Measured memory_bytes: 640
from collections import Counter
S = input()
S = S[::-1]
# 1桁のmod2019, 2桁の2019, ...
# 0桁のmod2019=0と定めると都合が良い
l = [0]
num = 0
for i in range(len(S)):
    num += int(S[i]) * pow(10,i,2019)
    l.append(num % 2019)
# print(l)
ans = 0
c = Counter(l)
for v in c.values():
    ans += v*(v-1)//2
print(ans)


Measured memory_bytes: 86948
#include <stdio.h>
#include <math.h>
#define MAX 1000

int main(){
    int n;
    int i, j=0, sum;
    int score[MAX];
    double ave, tmp;
    double dev[MAX];

    while(1){
        scanf("%d", &n);
        if(n==0)break;
        sum=0;
        for(i=0;i<n;i++){
            scanf("%d", &score[i]);
            sum+=score[i];
        }
        ave=(double)sum/(double)n;
        tmp=0.0;
        for(i=0;i<n;i++){
            tmp+=pow(score[i]-ave, 2);
        }
        dev[j++]=sqrt(tmp/(double)n);
    }
    for(i=0;i<j;i++){
        printf("%f\n", dev[i]);
    }
    return 0;
}


Measured memory_bytes: 2108
#include<stdio.h>
int main(){
  int W, H, x, y, r;
  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
  
  if( x>=r && x<=W-r && y>=r && y<=H-r ){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

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

    string S;
    cin >> S ;

    for (ll i = 0; i < S.size(); i++) {
        cout << "x";
    }
    cout << "" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define int long long int
#define e 1000000007
using namespace std;

 
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
 int t=1;
    // cin>>t;
    
  while(t--){
      int ans = INT_MIN;
    string s;
    cin>>s;
    int n = s.length();
    for(int i=0;i<n;i++){
        
int cnt =0 ;
        if(s[i]=='R'){
            int j = i;
            while(j!=n && s[j]=='R'){
                
                cnt++;
                j++;
            }


        }

        ans = max(ans, cnt);
    }
    cout<<ans;
  }
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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

    if(a>=k){
        cout<<a-k<<" "<<b<<endl;
    }
    else if(a+b>=k){
        cout<<0<<" "<<b-(k-a)<<endl;
    }
    else cout<<0<<" "<<0<<endl;

}


Measured memory_bytes: 3596
import numpy as np
h,w = map(int, input().split())
a = []
for i in range(h):
    b = list(input())
    if b.count('.') == w:
        continue
    else:
        a.append(b)
c = np.array(a)
d = c.T
e = d.tolist()
f = []
for i in range(d.shape[0]):
    if e[i].count('.') == d.shape[1]:
        f.append(i)
f.sort(reverse = True)
for i in f:
    d = np.delete(d, i, 0)
ans = d.T.tolist()
for i in range(len(ans)):
    print(''.join(ans[i]))

Measured memory_bytes: 27148
import sys

def main():
    n,m = map(int, input().split())
    pn_list = [0]*n
    a = [0]*m
    b = [0]*m
    ans_ac = 0
    ans_pn = 0
    pn_list[0]== -1
    
    for i in range (m):
        a[i],b[i]=input().split()
        a[i] = (int(a[i]))
        # print(a[i])
        if pn_list[a[i]-1] != -1:
            if b[i]== "AC":
                ans_pn += pn_list[a[i]-1]
                ans_ac +=1
                pn_list[a[i]-1] = -1 #ペナルティリスト初期化
            else:
                pn_list[a[i]-1] += 1

    print(ans_ac,ans_pn)
    
   
if __name__ == "__main__":
    main()

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

int main() {
    long long n;
    std::cin >> n;
    std::vector<long long> a(n), b(n);
    auto sa = 0ll, sb = 0ll;
    // (val, A or B, index)
    // A -> true, B -> false
    std::set<std::tuple<long long, bool, long long>> ss;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i] >> b[i];
        ss.emplace(a[i], true, i);
        ss.emplace(b[i], false, i);
        sa += a[i];
        sb += b[i];
    }

    std::set<int> nums;
    std::deque<std::tuple<long long, bool, long long>> q;
    while (q.size() < n) {
        auto el = *ss.begin();
        q.push_back(el);
        nums.insert(std::get<2>(el));
        ss.erase(ss.begin());
    }

    auto q2(q);
    if (nums.size() == n)
    {
        auto le = q[n - 1];
        auto it = ss.begin();
        while (std::get<2>(*it) == std::get<2>(le)) it++;
        q.pop_back();
        q.push_back(*it);

        le = q2[n - 2];
        it = ss.begin();
        while (std::get<2>(*it) == std::get<2>(le)) it++;
        q2.erase(q2.begin() + n - 2);
        q2.push_back(*it);
    }

    auto s = std::accumulate(q.begin(), q.end(), 0ll, [](auto init, auto& el) { return init + std::get<0>(el); }),
        s2 = std::accumulate(q2.begin(), q2.end(), 0ll, [](auto init, auto& el) { return init + std::get<0>(el); });
    std::cout << std::min({ s, s2, sa, sb }) << std::endl;

    return 0;
}

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

using namespace std;

// Header files, namespaces,
// macros as defined above
#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>


#define f first
#define s second
#define db long double
#define pb push_back
#define sz(c) (c).size()
#define all(c) (c).begin(),(c).end()

typedef long long ll;
typedef pair <int , int> ii;
typedef pair <ii , int> iii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <iii> viii;
typedef vector <vi> vvi;
typedef vector <vii> vvii;

const ll mod = 1e9+7;
const int MAX = 1e5+5;
const db eps = 1e-13;

int memo[MAX][2];
int n;
vvi g;

int dp( int node, int color , int p = -1 ) {

    if( memo[node][color] != -1 )
        return memo[node][color];

    int &res = memo[node][color];
    res = 1;
    if( sz(g[node]) == 1 && p != -1 ) {

        return res = res + (!color);

    }

    ll res1 = 1;
    ll res2 = 1;

    for( int nw: g[node] ) {
        if( nw==p )
            continue;

        if( !color )
            res1 = ( 1ll * res1 * dp( nw , color , node ) ) % mod;
        res2 = ( 1ll * res2 * dp( nw , color^1 , node ) ) % mod;
    }
    return res = ((!color)*res1+res2)%mod;
}


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

    memset( memo , -1 , sizeof memo );
    cin>>n;
    if( n==1 ) {
        cout<<2<<"\n";
        return 0;
    }

    vi v;
    g = vvi(n+1,v);
    for( int i = 1; i < n ; i++ ) {
        int a, b;
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    cout<<dp( 1 , 0 )<<"\n";

}
/*
10
8 5
10 8
6 5
1 5
4 8
2 10
3 6
9 2
1 7
*/

Measured memory_bytes: 14848
#include <iostream>
using namespace std;
using ll = long long;

ll modperm(ll n, ll r, ll d) {
	return
		r == 0 ? 1 :
		n * modperm(n - 1, r - 1, d) % d;
}

ll modpow(ll a, ll p, ll d) {
	return
		p == 0 ? 1 :
		p == 1 ? a % d :
		p % 2 == 0 ? modpow(a, p / 2, d) * modpow(a, p / 2, d) % d :
		modpow(a, p - 1, d) * a % d;
}

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

	ll const DIV = 1000000007;
	int S;
	cin >> S;

	ll cnt = 0;
	for (int i = 1; i <= S / 3; i++) {
		ll a = S - 3 * i;
		cnt += modperm(a + i - 1, a + i - 1, DIV) * modpow(modperm(a, a, DIV), DIV - 2, DIV) % DIV * modpow(modperm(i - 1, i - 1, DIV), DIV - 2, DIV) % DIV;
		cnt %= DIV;
	}
	cout << cnt << "\n";
	return 0;
}


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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pd pair<double, int>
#define pii pair<int, pi>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 200001
#define mod 1000000000

signed main()
{
  lli n, m, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++)
  {
    lli a;
    cin >> a;
    sum += a;
  }
  (sum <= n) ? cout << n - sum << endl : cout << "-1\n";
  return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int main(){
  long long i,j,k,n,c=0,m,d[110];
  scanf("%lld",&n);
  for(i=0;i<n;i++)scanf("%lld",&d[i]);
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      for(k=j+1;k<n;k++){
	if(d[i]==d[j]||d[j]==d[k]||d[i]==d[k])continue;
	m=MAX(d[i],MAX(d[j],d[k]));
	if(m*2<d[i]+d[j]+d[k])c++;
      }
    }
  }
  printf("%lld\n",c);
  return 0;
}


Measured memory_bytes: 1732
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var n = IO.RLong;
            var a = IO.RSLong;
            var q = IO.RLong;
            var b = new long[q];
            var c = new long[q];
            for (int i = 0; i < q; i++)
            {
                var bc = IO.RSLong;
                b[i] = bc[0];
                c[i] = bc[1];
            }

            long sum = 0;
            var dis = new long[100100];
            for (int i = 0; i < a.Length; i++)
            {
                sum += a[i];
                dis[a[i]]++;
            }

            for (int i = 0; i < q; i++)
            {
                long preCount = dis[b[i]];
                long sub = c[i] - b[i];
                sum += preCount * sub;
                WriteLine(sum);

                // dis更新
                dis[b[i]] -= preCount;
                dis[c[i]] += preCount;
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 46372
H, W, K = map(int, input().split())
C = [list(input()) for _ in range(H)]

ans = 0
def check(h, w):
    global ans
    tmp = 0
    for i in range(H):
        for j in range(W):
            if h[i] and w[j] and C[i][j] == "#":
                tmp += 1
    ans += 1 if tmp == K else 0

def dfs(h, w):
    if len(h) < H:
        for i in range(2):
            dfs(h+[i],w)
    elif len(w) < W:
        for i in range(2):
            dfs(h,w+[i],)
    else:
        check(h, w)
    return


dfs([],[])
print(ans)


Measured memory_bytes: 76164
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <deque>

using namespace std;

long long l, r, minimum = 2018;

int main() {
	cin >> l >> r;
	r = min(l + 2019, r);
	for (long long i = l; i < r; ++i) {
		for (long long j = i + 1; j <= r; ++j)
			minimum = min(minimum, (i % 2019) * (j % 2019) % 2019);
	}
	cout << minimum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,dp[250002],a[250002],ans,b[250002];
#define re register
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
inline int pos(re int x,re int y){
	return (x-1)*n+y;
}
inline void dfs(re int x,re int y,re int z=0){
	if(y>=dp[x]&&z)return;
	dp[x]=y;if(!b[x])++y;
	if(x>n)dfs(x-n,y,1);
	if(x<=n*n-n)dfs(x+n,y,1);
	if(x%n!=1)dfs(x-1,y,1);
	if(x%n)dfs(x+1,y,1);
}
int main(){
	n=read();
	for(re int i=1;i<=n*n;++i)a[i]=read();
	for(re int i=1;i<=n;++i)for(re int j=1;j<=n;++j)dp[(i-1)*n+j]=min(i-1,min(j-1,min(n-i,n-j)));
	for(re int i=1;i<=n*n;++i){
		ans+=dp[a[i]];b[a[i]]=1;
		dfs(a[i],dp[a[i]]);
	}
	printf("%d",ans);
}


Measured memory_bytes: 25536
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<int> t(n+1),x(n+1),y(n+1);
    repi(i,1,n+1){
        cin>>t[i]>>x[i]>>y[i];
        int td=abs(t[i]-t[i-1]),xd=abs(x[i]-x[i-1]),yd=abs(y[i]-y[i-1]);
        if(td%2!=(xd+yd)%2||td<xd+yd){
            cout<<"No"; return 0;
        }
    }
    cout<<"Yes";
}

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

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

    int x,a,b; cin >> x>>a>>b;
    cout<<(abs(a-x)<abs(b-x)?"A":"B")<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
vector<string>v;
void dfs(string str,string t="",int cnt=0){
    if(cnt==2){
        v.push_back(t);
        return;
    }else{
        for(int i=0;i<str.size();i++){
            dfs(str,t+str[i],cnt+1);
        }
    }
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int a,b;
    while(cin>>a>>b){
        cout<<a+ (b/2)<<endl;
    }
    return 0;
}


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

int main() {
  int x,a,b;
  cin >> x >> a>> b;
  if(a - b >= 0){
    cout << "delicious" << endl;
  }else if(b - a < x + 1){
    cout << "safe" << endl;
  }else{
    cout << "dangerous" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define PI 3.141592653589793238
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
long long power(long long x, unsigned long long y, unsigned int m){
    if(y == 0) return 1;
    unsigned long long p = power(x, y/2, m) % m;
    p = (p * p) % m;
    
    if(y & 1)
        return  ((x % m)*p) % m;
    else 
        return p;
}
bool chk(int b, int x){
	for(int j = -x; j*j*j*j*j <= b; j++){
		if(j*j*j*j*j == b) return true;
	}
	return false;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in2.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		
		int n; cin >> n;
		int a[n+1]; 
		FOR1(i, n) cin >> a[i];
		map<int, int> m;
		int ans = 0;
		FOR1(i, n){
			ans += m[i-a[i]];
			m[i+a[i]]++;
		}
		cout << ans;
		cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 27928
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int n,a[105];
int fst,sum[2];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		sum[fst]+=a[i];
		fst^=1;
	}
	printf("%d",abs(sum[1]-sum[0]));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0): d(n,-1) {}

    int find(int x) {
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }

    bool unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }

    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -d[find(x)];}
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    vi a(m), b(m);
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    int ans = 0;

    rep(i, m) {
        UnionFind uf(n);
        rep(j, m) {
            if (i == j) continue;
            uf.unite(a[j], b[j]);
        }
        if (uf.size(0) != n) ans++;
    }
    cout << ans << endl;
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
  string s;cin>>s;
  string ss="keyence";
  int cnt=0;
  if(s=="keyence"){cout<<"YES"<<endl;return 0;}
  bool flag=false;
  for(int i=1;i<s.size();i++){
    for(int j=0;j<s.size()-i;j++){
      string sss=(s.substr(0,j)+s.substr(j+i,s.size()-j+i));
      // cout<<sss<<endl;
      if(sss.compare(ss)==0)flag=true;
    }
  }
  YES(flag);
  return 0;
}


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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

const int N=1e5+100,MOD=1e9+7;

int cnt[N];

int ppow(int x,int y)
{
    int res=1;
    while(y)
    {
        if(y&1)
            res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}

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

    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++)
        cnt[i]=ppow(k/i,n);
//    for(int i=1;i<=k;i++)
//        cout<<cnt[i]<<" ";
//    cout<<"\n";
    for(int i=k;i>=1;i--)
        for(int j=i+i;j<=k;j+=i)
            cnt[i]=(cnt[i]-cnt[j]+MOD)%MOD;
//    for(int i=1;i<=k;i++)
//        cout<<cnt[i]<<" ";
//    cout<<"\n";
    int ans=0;
    for(int i=1;i<=k;i++)
        ans=(ans+cnt[i]*i)%MOD;
    cout<<ans;
}


Measured memory_bytes: 4416
import java.util.*;

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

    boolean approved = true;
    for (int i = 0; i < N; i++) {
      int n = sc.nextInt();
      if (n % 2 == 1) {
        continue;
      }

      if (n % 3 == 0 || n % 5 == 0) {
        continue;
      }

      approved = false;
    }
    if (approved) {
      System.out.println("APPROVED");
    } else {
      System.out.println("DENIED");
    }
    sc.close();
  }
}

Measured memory_bytes: 23636
// 問題文
// 正整数
// A
// ,
// B
//  が与えられます。
//
// A
//  が
// B
//  の約数なら
// A
// +
// B
//  を、そうでなければ
// B
// −
// A
//  を出力してください。

package main

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

var sc = bufio.NewScanner(os.Stdin)

// 任意の要素数の文字列を読み込んでスライスで返す
func scanStrings(len int) (strings []string) {
	var str string
	for i := 0; i < len; i++ {
		fmt.Scanf("%s", &str)
		strings = append(strings, str)
	}
	return
}

// 任意の要素数の配列を読み込んでスライスで返す
func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func main() {
	aa := scanNums(2)
	bb := scanNums(2)

	res := aa[0]*aa[1] - (bb[0]*aa[1] + bb[1]*aa[0] - bb[0]*bb[1])
	fmt.Println(res)
}


Measured memory_bytes: 640
<?php namespace Track;

function main($lines) {
  foreach ($lines as $index=>$value) {
    // printf("line[%s]: %s\n", $index, $value);
    if($value[1] == '?'){
        break;
    }
    // var_dump($value);
    if($value[1] == "+"){
        echo $value[0] + $value[2],PHP_EOL;
    }elseif($value[1] == "-"){
        echo $value[0] - $value[2],PHP_EOL;
    }elseif($value[1] == "/"){
        echo intval($value[0] / $value[2]),PHP_EOL;
    }else{
        echo $value[0] * $value[2],PHP_EOL;
    }
  }
}

$array = array();
while (true) {
  $stdin = fgets(STDIN);
  if ($stdin == "") {
    break;
  }
  $array[] = explode(" ",rtrim($stdin));
}
main($array);



Measured memory_bytes: 9372
use scanner::Scanner;

fn main() {
    let mut sc = Scanner::new();
    let a: i32 = sc.read();
    let op: String = sc.read();
    let b: i32 = sc.read();
    println!("{}", if op == "+" { a + b } else { a - b });
}

mod scanner {
    pub struct Scanner<'a> {
        s: String,
        words: ::std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new() -> Scanner<'a> {
            let s = String::new();
            let words = unsafe { ::std::mem::transmute(s.split_whitespace()) };
            Scanner { s: s, words: words }
        }

        pub fn read<T: ::std::str::FromStr>(&mut self) -> T {
            match self.words.next() {
                Some(x) => x.parse().ok().unwrap(),
                None => {
                    self.load();
                    self.read()
                }
            }
        }

        fn load(&mut self) {
            self.s.clear();
            ::std::io::stdin().read_line(&mut self.s).unwrap();
            self.words = unsafe { ::std::mem::transmute(self.s.split_whitespace()) };
        }
    }
}


Measured memory_bytes: 4352
let n = Int(readLine()!)!
let a = readLine()!.characters.split(" ").map{Int(String($0))!}
var odd: [Int] = []
var even: [Int] = []
a.enumerate().forEach{$0.0 % 2 > 0 ? (odd += [$0.1]) : (even += [$0.1])}
let b = odd.reverse() + even
(n % 2 > 0 ? b.reverse() : b).forEach{print($0, terminator: " ")}

Measured memory_bytes: 14692
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

X = Int()
import sys

for A in range(-1000,1001):
    tmp = A**5
    #print(A)
    for B in range(-1000,1001):
        if tmp - B**5==X:
            print(A,B)
            sys.exit()

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

int main(){
    int n;
    long long maxValue = -1000000;
    long long minValue = 1000000;
    long long sum = 0;
    long long a;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        if(maxValue <= a) maxValue = a;
        if(minValue >= a) minValue = a;
        sum += a;
    }
    cout << minValue << " " << maxValue << " " << sum << endl;

    return 0;
}


Measured memory_bytes: 3112
/*
  Esteban Arango Medina
*/
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <tuple>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;

using ll=long long;
#define int ll

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <char,int> mci;
typedef map <int,int> mii;
typedef map <string,string> mss;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define endl '\n' // Normal `cout << endl` flushes the output every time wich hit performance badly
#define INF 1000000000
#define deb(x) cout<<#x<<": "<<x<<endl;
#define printArray(arr) for(auto x: arr) { cout<<x<<", "; }
#define printMatrix(mat) for(auto x: mat) { cout<<" "; printArray(x); cout<<endl; }
#define printMap(mmap) for(auto p: mmap) { cout<< p.first<<": "<<p.second<<endl; }

signed main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); // Fast input
  #ifdef LOCAL_PROJECT
    freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
  #endif

  int T = 1; //cin>>T;
  while(T--) {
    int n; cin>>n;
    vector<vi> plan(n, vi(3, 0));
    vector<vi> DP(n, vi(3, 0));
    int a, b, c;
    rep(i, 0, n) {
      cin>>plan[i][0]>>plan[i][1]>>plan[i][2];
    }
    DP[0][0] = plan[0][0];
    DP[0][1] = plan[0][1];
    DP[0][2] = plan[0][2];
    rep(i, 1, n) {
      DP[i][0] = plan[i][0] + max(DP[i-1][1],DP[i-1][2]);
      DP[i][1] = plan[i][1] + max(DP[i-1][2],DP[i-1][0]);
      DP[i][2] = plan[i][2] + max(DP[i-1][1],DP[i-1][0]);
    }
    cout<<max(DP[n-1][0], max(DP[n-1][1], DP[n-1][2]));
  }
  return 0;
}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
#define mod 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
ll power(ll a,ll b) {
    if (b==0) return 1;
    ll c = power(a,b>>1);
    c = (c*c)%mod;
    if (b&1) return (c*a)%mod;
    return c;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)1e5+5;
const int Q = 301;

void solve() {
	char ch;
  cin>>ch;
  cout<<(++ch);
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


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

using namespace std;

int main(){

int N;
cin>>N;
long long  h[N+1];
h[0]=0;
bool ans=true;
for(int i=1;i<=N;i++){
cin>>h[i];
}
for(int i=N;i>=1;i--)
if(h[i]<h[i-1]-1){
    ans=false;
}
else if(h[i]==h[i-1]-1 ){
    h[i-1]-=1;
}


if(ans){
    cout<<"Yes"<<endl;
}
else{
    cout<<"No"<<endl;
}

 return 0;
}

Measured memory_bytes: 1024
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	int n, p, q;
	
	while(cin >> n >> p >> q, n) {
		vi time(24*60);
		int pp = (p/100)*60+p%100;
		int qq = (q/100)*60+q%100-1;

		int m;
		REP(i, n) {
			cin >> m;
			int s, e;
			REP(j, m) {
				cin >> s >> e;
				int se = (s/100)*60+s%100;
				int en = (e/100)*60+e%100-1;

				FOR(k, se, en) {
					time[k]++;
				}
			}
		}

		int ans = 0;
		int tmp = 0;
		FOR(j, pp, qq) {
			if(time[j] != n) {
				tmp++;
				ans = max(ans, tmp);
			} else {
				tmp = 0;
			}
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1200
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 4e5 + 111;
     
using namespace std;
 
int n, q, m, a[maxn], x[20][20], y[20][20], cnt, ans;
 
void solve(){
	cin >> n;
	
	for (int i = 1; i <= n; i++){
		cin >> a[i];
		for (int j = 1; j <= a[i]; j++)
			cin >> x[i][j] >> y[i][j];
	}
    
    for (int mask = 0; mask < (1 << n); mask++){
        cnt = __builtin_popcount(mask);
        for (int j = 0; j < n; j++){
            if (mask & (1 << j)){
                for (int k = 1; k <= a[j + 1]; k++){
                	int b = x[j + 1][k] - 1;
                	int yy = y[j + 1][k];
                	int h = (mask & (1 << b));
                	if (h > 0)
                		h = 1;
                	if (h == yy)
                		continue;
                	cnt = 0;
                	break;
                }
            }
        }
        ans = max(ans, cnt);
    }

    cout << ans;
}
 
main(){
    boost;
	    
	q = 1;
 
	while (q--){
		solve();
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<set>
#include<map>
//#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
int ans;
signed main() {
	int n, h, w; cin >> n >> h >> w;
	while (n--) {
		int a, b; cin >> a >> b;
		if (h <= a && w <= b)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    ll n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    ll mi = min({a,b,c,d,e});
    cout << (n+mi-1)/mi + 4 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
long long sum(int n){
    return (long long)n*(n+1)/2;
}
int main(){
    int n; cin >> n;
    vector<int> vec(n+1);
    long long ans = 0;
    for(int i = 1; i < n+1; ++i){
        ans += i*sum(n/i);
    }
    cout << ans << endl;
    return 0;
}
//Saw the solution video

Measured memory_bytes: 42268
n = int(input())
L = [list(input().split()) for _ in range(n)]
L2 = sorted(L)
L3 = [i[0] for i in L2]
L4 = list(set(L3))
L4.sort()
L5 = []
L6 = []
for k in L4:
  s = []
  for v in L2:
    if v[0]==k:
      s.append(int(v[1]))
  s = sorted(s, key=int, reverse=True)
  for t in s:
    L5.append(str(t))
for i in range(n):
  L6.append([L3[i],L5[i]])
for u in L6:
  print(L.index(u)+1)

Measured memory_bytes: 3064