akhauriyash/Code-Regression huggingface dataset:
// atcoder/tokiomarine2020/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

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

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int n, k;
  while (cin >> n >> k) {
    vec<int> a(n);
    cin >> a;
    // cout << a << endl;

    while (k-- && count(a.begin(), a.end(), n) != n) {
      vec<int> b(a.size()+1, 0);
      for (int i = 0; i < a.size(); ++i) {
        int begin = max(0, i - a[i]);
        int end = min(n-1, i + a[i]);
        ++b[begin];
        --b[end+1];
      }
      for (int i = 0; i + 1 < b.size(); ++i) {
        b[i + 1] += b[i];
      }
      a = b;
      a.pop_back();
    }
    for (int i = 0; i < a.size(); ++i) {
      if (i) cout << ' ';
      cout << a[i];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 5572
import java.util.Scanner;
import java.util.Stack;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.nextLine();
		int num = 0;
		Stack<Character> stack = new Stack<Character>();
		for(int i = S.length() - 1; i >=0; i--) {
			if(stack.isEmpty()) {
				stack.push(S.charAt(i));
			}else {
				char a = stack.peek();
				if(a != S.charAt(i)) {
					stack.pop();
					num += 2;
				}else {
					stack.push(S.charAt(i));
				}
			}
		}
		System.out.println(num);
    }
}

Measured memory_bytes: 26840
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	N := getInt()
	as := make([]int, N)
	bs := make([]int, N)
	cs := make([]int, N)
	for i := 0; i < N; i++ {
		as[i] = getInt()
		bs[i] = getInt()
		cs[i] = getInt()
	}

	values := make([][]int, 3)
	for i := 0; i < 3; i++ {
		values[i] = make([]int, N)
	}

	values[0][0] = as[0]
	values[1][0] = bs[0]
	values[2][0] = cs[0]

	for i := 1; i < N; i++ {
		values[0][i] = as[i] + max(values[1][i-1], values[2][i-1])
		values[1][i] = bs[i] + max(values[0][i-1], values[2][i-1])
		values[2][i] = cs[i] + max(values[0][i-1], values[1][i-1])
	}

	fmt.Println(max(values[0][N-1], values[1][N-1], values[2][N-1]))
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 7040
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define emp emplace
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n, K, A[56],ans;
int main()
{
	FAST
	cin>>n>>K;
	FOR(i,0,n)cin>>A[i];
	FOR(a,0,n+1){
		FOR(b,0,n+1){
			if(a+b>n||a+b>K)continue; ll k=K;
			priority_queue<ll,vector<ll>,greater<ll>>pq;
			FOR(i,0,a){
				pq.ph(A[i]);
			}
			FOR(i,0,b){
				pq.ph(A[n-i-1]);
			}
			k-=(a+b);
			while(pq.size()&&k&&pq.top()<0){ 
				pq.pop();k--;
			}
			ll sum=0;
			while(pq.size()){sum+=pq.top();pq.pop();}
			ans=max(ans,sum);
		}
	}
	cout<<ans;
}


Measured memory_bytes: 256
#include <cstdio>
int N;
int F[100][14]; int P[100][15];
int main (){
  scanf("%d",&N);
  for(int i=0;i<N;i++)  for(int j=0;j<10;j++) scanf("%d",&F[i][j]);
  for(int i=0;i<N;i++) for(int j=0;j<11;j++) scanf("%d",&P[i][j]);
  int res = -(1 <<30);
  for(int b=1;b<(1<<10);b++){
    int cc =0;
    for(int i=0;i<N;i++) {
      int c=0;
      for(int j=0;j<10;j++) if((b>>j&1)&&F[i][j]) c++;
      cc+=P[i][c];
    }
    if(res<cc)res=cc;
  }
  printf("%d\n",res);
}


Measured memory_bytes: 1744
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, X = map(int, readline().split())

    m = [int(input()) for _ in range(N)]
    s = sum(m)
    m.sort()

    ans = N + (X - s) // m[0]
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 62500
if __name__ == '__main__':
    input_list = list(map(int, input().split()))

    A = int(input_list[0])
    B = int(input_list[1])
    C = int(input_list[2])

    if A <= C <= B :
        print("Yes")
    elif B <= C <= A :
        print("Yes")
    else :
        print("No")


Measured memory_bytes: 2940
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

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

fn dfs(cur_pos: usize, visited: Vec<usize>, link: &Vec<Vec<usize>>) -> i32 {
    let mut count = 0;
    let mut new_visited = visited.clone();
    new_visited.push(cur_pos);

    if new_visited.len() == link.len() {
        return 1;
    }

    for &next in link[cur_pos].iter().filter(|&x| !new_visited.contains(x)) {
        count += dfs(next, new_visited.clone(), link);
    }

    count
}

fn main() {
    let (n, m) = read!(usize, usize);
    let ab: Vec<(usize, usize)> = read!(usize, usize; m);

    let mut nodes = vec![vec![]; n];
    for i in 0..m {
        let from = ab[i].0;
        let to = ab[i].1;
        nodes[from - 1].push(to - 1);
        nodes[to - 1].push(from - 1);
    }

    println!("{}", dfs(0, vec![], &nodes));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string week[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    
    string s;
    cin >> s;
    rep(i, 7) {
        if (s == week[i]) cout << 7 - i << endl;
    }
    
    
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define int long long
using namespace std;
const int maxN=1e6 + 100;
struct Node
{
	int to,value,next;
}edge[maxN*2+1];
int n,m,head[maxN+1],tot,dis[maxN+1];
bool col[maxN+1];
int maxT=-1e15,minT=1e15,ans=-1e15;
void add(int x,int y,int t)
{
	tot++;
	edge[tot].to=y;
	edge[tot].value=t;
	edge[tot].next=head[x];
	head[x]=tot;
}
bool dfs(int x)
{
	maxT=max(maxT,dis[x]);
	minT=min(minT,dis[x]);
	bool flag=true;
	col[x]=true;
	for(int i=head[x];i;i=edge[i].next)
		if(!col[edge[i].to]) dis[edge[i].to]=dis[x]+edge[i].value,flag=(flag&&dfs(edge[i].to));
		else if(dis[x]+edge[i].value!=dis[edge[i].to]) flag=false;
	return flag;
}
#undef int
int main()
#define int long long
{
//	freopen("line.in","r",stdin);
//	freopen("line.out","w",stdout);
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int x,y,t;
		scanf("%lld%lld%lld",&x,&y,&t);
		add(x,y,t); add(y,x,-t);
	}
	for(int i=1;i<=n;i++)
		if(!col[i])
		{
			maxT=-1e18,minT=1e18;
			if(!dfs(i))
			{
				printf("No");
				return 0;
			}
			ans=max(ans,maxT-minT);
		}
	printf("Yes");
	fclose(stdin);
	fclose(stdout);
	return 0;
}

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


using namespace std;


// Powered by caide (code generator, tester, and library code inliner)


class Solution {
  int n, m;
  vector<int> edge[8];
public:
  int dfs(int now, int bits)
  {
    if (bits & 1 << now) return 0;
    bits |= 1 << now;
    if (bits + 1 == (1 << n)) return 1;
    int res = 0;
    for(auto&& i : edge[now]) {
      if (bits & 1 << i) { continue; }
      res += dfs(i, bits);
    }
    return res;
  }

  void solve(std::istream& in, std::ostream& out)
  {
    in >> n >> m;
    for(int i = 0; i < m; i++) {
      int a, b;
      in >> a >> b;
      edge[--a].push_back(--b);
      edge[b].push_back(a);
    }
    out << dfs(0, 0) << "\n";
    for(int i = 0; i < n; i++) {
      edge[i].clear();
    }
  }
};

void solve(std::istream& in, std::ostream& out)
{
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}


#include <fstream>
#include <iostream>


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


  istream& in = cin;


  ostream& out = cout;

  solve(in, out);
  return 0;
}




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

int main() {
        int H, W;
        cin >> H >> W;
        string str[H];

        for (int i = 0; i < H; i++) {
                cin >> str[i];
        }
        string ig(W+2,'#');
        cout <<ig << endl;
        for (int i = 0; i < H; i++) {
                cout << '#' << str[i] << '#' << endl;
        }
        cout <<ig << endl;

}

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

int n, ma, mb, inf = 1e9 + 7, dp[50][410][410];

int main(){
    cin >> n >> ma >> mb;
    int a[n], b[n], c[n];
    for (int i = 0; i < n; i++) scanf("%d%d%d", &a[i], &b[i], &c[i]);
    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= 400; j++){
            for (int k = 0; k <= 400; k++){
                dp[i][j][k] = inf;
            }
        }
    }
    dp[0][0][0] = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= 400; j++){
            for (int k = 0; k <= 400; k++){
                if (dp[i][j][k] == inf) continue;
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
                dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
            }
        }
    }
    int ans = inf;
    for (int i = 1; i <= 400; i++){
        for (int j = 1; j <= 400; j++){
            if (i * mb == j * ma) ans = min(ans, dp[n][i][j]);
        }
    }
    if (ans == inf) ans = -1;
    printf("%d\n", ans);
}


Measured memory_bytes: 28928
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main() {
  int n,a,b;cin>>n>>a>>b;
  cout << min(n*a,b) << endl;
}

Measured memory_bytes: 764
N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

tmp = A[-1]
cum = [tmp]
for i in range(1, N-1)[::-1]:
    tmp += A[i]
    cum.append(tmp)
    
cum = cum[::-1]
ans = 0
for i in range(N-1):
    ans += cum[i]*A[i]
    ans %= mod

print(ans)

Measured memory_bytes: 31500
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = in.nextInt();
        Arrays.sort(a);
        double ans = a[0];
        for (int i = 1; i < n; ++i) {
            ans = (ans + a[i]) / 2;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
#include <iostream>

inline bool is_odd (const int& number)
{
  return number & 1 == 1;
}

int main()
{
  int a, b;
  std::cin >> a >> b;
  if (is_odd(a * b)) { 
    std::cout << "Odd";
  }
  else {
    std::cout << "Even";
  }
  std::cout << std::endl;

  return 0;
}

Measured memory_bytes: 256
#[allow(dead_code)]
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()
}

#[allow(dead_code)]
fn readv<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn readvv<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| readv()).collect()
}

fn main() {
    let n: usize = read();
    let mut p: Vec<usize> = Vec::new();
    for _ in 0..n {
        p.push(read());
    }
    p.sort();
    println!("{}", p.iter().fold(0, |sum, i| sum + i) - p[n - 1] / 2);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
#define sort(x) sort(x.begin(), x.end())
using namespace std;
vector <ll> adj[100];
ll p[100];
set <ll> st[50];
ll dp[1<<20][50+2];
void dfs(ll i = 1,ll par = 0)
{
    p[i] = par;
    for(auto j : adj[i])
        if(j != par)
            dfs(j,i);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,a,b,m,j,l;
    cin>>n;
    for(i=1;i<n;i++)
    {
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    p[1] = 0;
    dfs();
    cin>>m;
    for(i=0;i<m;i++)
    {
        cin>>a>>b;
        while(a!=1)
        {
            st[i].insert(a);
            a = p[a];
        }
        while(b!=1)
        {
            if(st[i].find(b) != st[i].end())
                st[i].erase(b);
            else
                st[i].insert(b);
            b = p[b];
        }
    }
    for(i=0;i<(1<<m);i++)
        for(j=0;j<n+2;j++)
            dp[i][j] = 0;
    dp[0][1] = 1;
    ll num[100];
    for(i=0;i<=n;i++)
    {
        num[i] = 0;
        for(l=0;l<m;l++)
            if(st[l].find(i) != st[l].end())
                num[i] = (num[i]|(1<<l));
    }
    for(i=0;i<(1<<m);i++)
    {
        for(j=2;j<=n;j++)
        {
            dp[i][j] += dp[i][j-1];
            ll k = i|num[j];
            dp[k][j] += dp[i][j-1];
        }
    }
    cout<<dp[(1<<m)-1][n];
    return 0;
}


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

int n;
vector<int> memo;
vector<vector<int>> g;
int f(int x){
  if(memo[x] != -1) return memo[x];
  int p = 0;
  for(int nx : g[x]){
    p = max(f(nx)+1,p);
  }
  return memo[x] = p;
}
 
int main(){
  int m;
  cin>>n>>m;
  g.assign(n,vector<int>());
  memo.assign(n,-1);
  rep(i,m){
    int x,y;
    cin>>x>>y;
    x--; y--;
    g[x].push_back(y);
  }
  
  int ans = 0;
  rep(i,n){
    ans = max(ans,f(i));
  }
  cout << ans << endl;
}

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int n = ri();
	int a[n];
	INPUT(a);
	int b[9] = { 0 };
	FOR(i,n) {
		b[min(8,a[i]/400)]++;
	}
	int ma = 0;
	int mi = 0;
	FOR(i,8) {
		if (b[i]) ma++, mi++;
	}
	if (b[8]) {
		if (!mi) mi = 1;
		ma += b[8];
	}
	cout << mi << " " << ma << endl;
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int ans = 0, cnt = -1;
    for (int i = 1; i <= n; i++) {
        int w = i;
        int count = 0;
        while (w % 2 == 0) {
            count++;
            w /= 2;
        }
        if (cnt < count) {
            ans = i;
            cnt = count;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define mx  100005
#define mod 1000000009
#define lim 10000000

using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
     ll n;
     cin>>n;
     ll b,a[n+5];
     for(int i=1;i<=n;i++)
	{
		cin>>a[i];a[i]-=i;
	}
	sort(a+1,a+1+n);

	if(n & 1)b=a[n/2+1];
	else b=(a[n/2]+a[n/2+1])/2;

	ll ans=0;
	for(int i=1;i<=n;i++)
		ans+=abs(a[i]-b);

	cout<<ans<<"\n";

     return 0;
}


Measured memory_bytes: 1792
n = gets.to_i
a = Array.new(4).map!{[1..13]}

n.times do
  b, c = gets.split(" ")
  case b
  when "S"; a[0][c.to_i-1] = -1
  when "H"; a[1][c.to_i-1] = -1
  when "C"; a[2][c.to_i-1] = -1
  when "D"; a[3][c.to_i-1] = -1
  end
end

4.times do |i| 
  13.times do |j| 
    if a[i][j] != -1
      print case i
            when 0; "S "
            when 1; "H "
            when 2; "C "
            when 3; "D "
            end
      puts j+1
    end
  end
end

Measured memory_bytes: 8708
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, m, s, g, a, b; string t;
int main() {
	while (cin >> n >> m >> s >> g, n) {
		vector<vector<pair<int, string> > > G(n);
		for (int i = 0; i < m; i++) {
			cin >> a >> b >> t;
			G[a].push_back(make_pair(b, t));
		}
		vector<vector<string> > dp(n * 12 + 1, vector<string>(n, "~"));
		dp[0][s] = "";
		for (int i = 0; i < n * 12; i++) {
			for (int j = 0; j < n; j++) {
				if (dp[i][j] == "~") continue;
				for (pair<int, string> k : G[j]) {
					int l = i + k.second.size();
					if (l <= n * 12) dp[l][k.first] = min(dp[l][k.first], dp[i][j] + k.second);
				}
			}
		}
		int p = -1; string ret = "~";
		for (int i = 0; i <= n * 12; i++) {
			if (ret > dp[i][g]) ret = dp[i][g], p = i;
		}
		if (p > n * 6 || p == -1) cout << "NO" << endl;
		else cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 11636
#include <iostream>
#include <cstring>
int main(){
	char map[8][8],t_m[8][8];
	for(int i=0;i<8;i++){
		std::cin >> map[i];
	}

	for(int i=1;i<4;i++){
		//ツ角ツ度ツ閉ェ(ツ９ツ０ツ，ツ１ツ８ツ０ツ，ツ２ツ７ツ０)ツ嘉アツ転ツつオツつスツ配ツ療アツづーツ催ャツづゥ
		for(int y=0;y<8;y++){
			for(int x=0;x<8;x++){
				t_m[x][7-y] = map[y][x];
			}
		}

		memcpy(map,t_m,sizeof(t_m));

		std::cout << 90 * i << std::endl;
		for(int y=0;y<8;y++){
			for(int x=0;x<8;x++){
				std::cout << map[y][x];
			}
			std::cout << "\n";
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}

signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int d,t,s;
    cin>>d>>t>>s;

    int tt = ceil(d/(ld)s);

    cout<<(t>=tt ? "Yes" :  "No");


    printclock;
    return 0;
}


Measured memory_bytes: 3796
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Split(' ');
        var v = new int[n];
        var even = new int[100001];
        var odd = new int[100001];

        for(var i = 0; i < n; i++)
        {
            if (i % 2 == 0)
            {
                v[i] = int.Parse(s[i]);
                even[v[i]]++;
            } else
            {
                v[i] = int.Parse(s[i]);
                odd[v[i]]++;
            }
        }

        int e1 = 0, e2 = 0, o1 = 0, o2 = 0;
        for (var i = 1; i < 100000; i++)
        {
            if (odd[i] > odd[o1])
            {
                o2 = o1;
                o1 = i;
            } else if (odd[i] > odd[o2])
            {
                o2 = i;
            }

            if (even[i] > even[e1])
            {
                e2 = e1;
                e1 = i;
            } else if (even[i] > even[e2])
            {
                e2 = i;
            }
        }

        if (o1 == e1) { Console.WriteLine(Math.Min(n - even[e2] - odd[o1], n - even[e1] - odd[o2])); }
        else { Console.WriteLine(n - even[e1] - odd[o1]); }
    }
}

Measured memory_bytes: 19680
#include<cstdio>
using namespace std;
typedef long long ll;
int N,Q;
ll a[100000];

ll solve(ll S){
  ll sum=0,ans=0,k=0;
  for(int i=0;i<N;i++){
    sum+=a[i];
    while(sum>S){
      sum-=a[k];
      k++;
    }
    ans+=(i-k+1);
  }
  return ans;
}

int main(){

  scanf("%d %d",&N,&Q);
  for(int i=0;i<N;i++)scanf("%lld",&a[i]);
  for(int i=0;i<Q;i++){
    ll x;
    scanf("%lld",&x);
    printf("%lld\n",solve(x));    
  }

  return 0;
}


Measured memory_bytes: 3532
#include <iostream>
using namespace std;
int main(){
  int h,n;
  int a;
  
    cin>>h;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    h-=a;
  }
  if(h<=0){
    cout<<"Yes"<<endl;
  }else
    cout<<"No"<<endl;
  
  return 0;
}

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
int main(){
  int n;
  cin>>n;
  vector<int> x;
  vector<int> y;
  int sum=0;
  REP(i,n){
    int tmp;
    cin>>tmp;
    sum+=tmp;
    x.push_back(tmp);
    y.push_back(tmp);
  }
  sort(ALL(y));
  int mid=y[n/2];
  REP(i,n){
    if(x[i]<mid){
      cout<<mid<<endl;
    }else{
      cout<<y[n/2-1]<<endl;
    }
  }
}

Measured memory_bytes: 3948
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,ans{};
    cin>>n;
    vector<int> l(n);
    for(auto&i:l) cin>>i;
    sort(l.begin(),l.end());
    fr(k,n) fr(j,k) fr(i,j) if(l[i]<l[j] and l[j]<l[k] and l[k]<l[i]+l[j]) ++ans;
    cout<<ans<<'\n';
}

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

using namespace std;
typedef long long ll;

struct Point {
	ll x, y;

	bool operator<(const Point &other) const {
		return x == other.x ? y < other.y : x < other.x;
	}

	Point operator-(const Point &other) const {
		return Point { x - other.x, y - other.y };
	}
};

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

	int n;
	cin >> n;
	vector<Point> pts(n);
	for (Point &p : pts)
		cin >> p.x >> p.y;

	sort(pts.begin(), pts.end());
	map<Point, int> occ;
	for (int i = 0; i < n; ++i)
		for (int j = i + 1; j < n; ++j)
			++occ[pts[j] - pts[i]];

	int ans = n;
	for (auto e : occ)
		ans = min(ans, n - e.second);
	cout << ans;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int h,w;
  cin>>h>>w;
  vector<vector<char>> hoge(h,vector<char> (w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cin>>hoge.at(i).at(j);
    }
  }

  vector<vector<char>> ans(h*2,vector<char> (w));
  for(int i=0; i<h*2; i++){
    for(int j=0; j<w; j++){
      ans.at(i).at(j)=hoge.at(i/2).at(j);
      cout<<ans.at(i).at(j);
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

waru=10**9+7

kakunin=[0]*n
kigu=n%2
for i in range(n):
    kakunin[a[i]]+=1
    
# print(kakunin)
for i in range(n):
    if kigu==0:
        if i%2==1 and kakunin[i]!=2:
            print(0)
            quit()
        elif i%2==0 and kakunin[i]!=0:
            print(0)
            quit()

    if kigu==1:
        if i==0:
            if kakunin[i]!=1:
                print(0)
                quit()
        elif i%2==0 and kakunin[i]!=2:
            print(0)
            quit()
        elif i%2==1 and kakunin[i]!=0:
            print(0)
            quit()

print((2**(n//2))%waru)

Measured memory_bytes: 52844
#include <iostream>

using namespace std;

bool isprime(int x);

int main()
{
	int n, a[200000];
	int i, j;
	int min, max;
	
	cin >> n;
	
	for (i = 0; i < n; i++){
		cin >> a[i];
	}
	
	max = a[1] - a[0];
	min = a[0];
	
	for (i = 1; i < n; i++){
		if (max < a[i] - min) max = a[i] - min;
		if (min > a[i]) min = a[i];
	}
	
	cout << max << "\n";
	
	return (0);
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 167, task C, 2020/05/10
//ms,
/*
*/

int main(void){
  int N, M, X;
  vector<int> C(12);
  vector<vector<int>> A(12, vector<int> (12));
  int ans=10000000;//10^7

  cin >>N >>M >>X;
  for(int i=0;i<N;i++){
    cin >>C.at(i);
    for(int j=0;j<M;j++){
      cin >>A.at(i).at(j);
    }
  }

  int tmp_understand;
  int tmp_money;
  for(int bin=0;bin<(1<<N);bin++){
    //check if realize
    for(int j=0;j<M;j++){
      tmp_understand=0;
      for(int i=0;i<N;i++){
        if(bin&(1<<i)) tmp_understand += A.at(i).at(j);
      }
      //cout << tmp_understand <<X <<j <<endl;
      if(tmp_understand<X) goto NEXT_LOOP;
    }

    //realize! Then how muxh?
    //cout <<"howmuch!"<<endl;
    tmp_money=0;
    for(int i=0;i<N;i++){
      if(bin&(1<<i)) tmp_money+= C.at(i);
    }
    //renew answer
    ans = min(ans, tmp_money);
    NEXT_LOOP:continue;
  }

  if(ans == 10000000) cout <<"-1" <<endl;
  else cout <<ans <<endl;

  return 0;
}
/*
頭のいいコード書くんかと思ったら全探索通りそうやんわら
*/


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main(void)
{
	ios_base::sync_with_stdio(false);
	int n;
	string o,s;
	set<string> set;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> o >> s;
		if(o=="insert"){
			set.insert(s);
		}
		else{
			if(set.find(s)!=set.end()){
				cout << "yes" << endl;
			}
			else cout << "no" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 27812
r, c = map(int, input().split())
matrix = []
for _ in range(r):
    data_row = list(map(int, input().split()))
    sum_row = 0
    for num_row in data_row:
        sum_row += num_row
    data_row.append(sum_row)
    matrix.append(data_row)

data_col = []
for i in range(c + 1):
    sum_col = 0
    for j in range(r):
        sum_col += matrix[j][i]
    data_col.append(sum_col)
matrix.append(data_col)
    
for row in matrix:
    for i, num in enumerate(row):
        if i > 0:
            print(" ", end="")
        print(num, end="")    
    print()



Measured memory_bytes: 6748
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif


const ll mod = 1e9 + 7;;

ll mod_pow(ll n, ll k) {
    if (n == 0) return 1;
    ll ret = 1, cur = n;
    while (k) {
        if (k & 1) (ret *= cur) %= mod;
        k /= 2;
        cur = cur * cur % mod;
    }
    return ret;
}

ll mod_inv(ll n) { return mod_pow(n, mod - 2); }

int main() {
    ll N;
    cin >> N;
    V<ll> C(N);
    for (ll &e : C) cin >> e;
    ll inv2 = mod_inv(2);
    ll inv4 = inv2 * inv2 % mod;
    ll pow4 = 1;
    ll ans = 0;
    for (ll i = 0; i < N; i++) (pow4 *= 4) %= mod;
    ll val = pow4 * inv4 % mod;
    ll len = N - 1;
    sort(ALL(C));
    for (ll e : C) {
        ans += e * (len * val % mod) % mod;
        ans += (e * val % mod * 2 % mod); 
        len--;
    }
    cout << ans % mod << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    Fast;
    long long t,n,m,i,j,k,x=0,y=0,z;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++){
        cout<<"x";
    }
    cout<<endl;
}


Measured memory_bytes: 256
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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)*}
    };
}

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

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 run() {
    input! {
        n: usize,
        w: usize,
        p: [(usize, u32); n],
    }
    let mut dp = vec![vec![0; 3 * n + 1]; n + 1];
    let p0 = p[0].0;
    for (w, v) in p {
        let w = w - p0;
        for i in (1..(n + 1)).rev() {
            for j in (w..(3 * n + 1)).rev() {
                dp[i][j] = std::cmp::max(dp[i][j], dp[i - 1][j - w] + v);
            }
        }
    }
    let mut ans = 0;
    for i in 0..(n + 1) {
        for j in 0..(3 * n + 1) {
            if p0 * i + j <= w {
                ans = std::cmp::max(ans, dp[i][j]);
            }
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b, __ = c; a < __; ++a)
#define dbg(x) cerr << ">>>> " << x << endl;
#define _ << " , " << 

using namespace std;

int main(){
	ios::sync_with_stdio(0);
	long long int a, b, x;
	cin >> a >> b >> x;
	cout << b/x - a/x + (a%x == 0) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;

int n, m, top, x;

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d %d",&m ,&n);
	for(int i = 1; i <= n; i++){
		scanf("%d",&x);
		top += x;
	}
	// cout << top << endk;
	if(top >= m)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;

#define INF 0x33433433
#define B 5001

int n;
int ans;
int dp/*[10001]*/[10001];
int t[10001];
int mdp[30001];

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

    for (int i=0; i<=n; i++) {
        dp[i] = INF;
        mdp[i] = INF;
    }

    dp[0] = 0;
    mdp[0] = 0;
    ans = INF;
    for (int i=1; i<=n-1; i++) {
        for (int j=0; j<=i; j++) {
            dp[j] = mdp[i-j] + t[i-1];
            mdp[i-j] = min(mdp[i-j], dp[j]);
        }

        dp[0] = t[i-1];
        mdp[i] = t[i-1];
        for (int j=0; j<=i; j++) {
            dp[j] = min(dp[j], dp[i-j]);
            dp[i-j] = dp[j];
            mdp[i-j] = min(mdp[i-j], dp[j]);
            mdp[j] = min(mdp[j], dp[i-j]);
        }
/*
        for (int j=0; j<=n; j++) {
            printf("%d ", dp[j]);
        }puts("");*/
        ans = min(ans, dp[n/2]);
    }

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

Measured memory_bytes: 1140
#include<iostream>
using namespace std;
int main()
{
    int n,s=0,i;
    cin>>n;
    int a[n];
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]%2!=0&&i%2!=0)
        {
            s++;
        }
    }

    cout<<s<<endl;
    return 0;

}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
void dfs(vector<vector<int>> &c, vector<string> &s, vector<int> &d, int v = 0){
  int deg = c[v].size();
  if (!c[v].empty()){
    for (int j = c[v][0]; j <= c[v][deg - 1]; j++){
      s[j][d[v]] = '|';
    }
  }
  for (int w : c[v]){
    dfs(c, s, d, w);
    s[w][d[v]] = '+';
  }
}
int main(){
  while (1){
    int n;
    cin >> n;
    if (n == 0){
      break;
    }
    vector<string> s(n);
    for (int i = 0; i < n; i++){
      cin >> s[i];
    }
    vector<int> d(n, 0);
    for (int i = 0; i < n; i++){
      while (s[i][d[i]] == '.'){
        s[i][d[i]] = ' ';
        d[i]++;
      }
    }
    vector<int> p(n);
    p[0] = -1;
    for (int i = 1; i < n; i++){
      p[i] = i - 1;
      while (d[p[i]] >= d[i]){
        p[i]--;
      }
    }
    vector<vector<int>> c(n);
    for (int i = 1; i < n; i++){
      c[p[i]].push_back(i);
    }
    dfs(c, s, d);
    for (int i = 0; i < n; i++){
      cout << s[i] << endl;
    }
  }
}


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

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define rall(n) std::rbegin(n), std::rend(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;


void init() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
}

void calc() {

	std::string S, T; std::cin >> S >> T;
	if (T.substr(0, T.size() - 1) == S)std::cout << "Yes";
	else std::cout << "No";

}


int main() {

	init();
	calc();

	return 0;
}

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

using namespace std;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}init;

typedef long long LL;

template<typename T>void chmin(T &a,T b){a=min(a,b);}
template<typename T>void chmax(T &a,T b){a=max(a,b);}
template<typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
typedef pair<int,int> P;
typedef priority_queue<P> Queue;
int main(){
    int N,M,Q;
    cin>>N>>M>>Q;
    vector<int> last_used_id(N,Q);
    vector<int> a(Q);
    cin>>a;
    vector<vector<int>> v(M);
    for(int i=0;i<Q;i++){
        v[a[i]-1].push_back(i);
    }
    Queue que;
    set<int> s;
    for(int i=0;i<M;i++){
        if(v[i].size()!=0)
            que.push(P(v[i].back(),i));
        s.insert(i);
    }
    int f=[&](){
    while(que.size()){
        int id=que.top().second;
        if(v[id].size()>=N){
            for(int i=0;i<N;i++){
                while(v[id].size()>0&&v[id].back()>last_used_id[i])
                    v[id].pop_back();
                if(v[id].size()==0){
                    if(id==*(s.begin())&&i>0){
                        que.pop();
                        s.erase(id);
                        return 1;
                    }
                    cout<<"No"<<endl;
                    return 0;
                }
                int t=v[id].back();
                v[id].pop_back();
                last_used_id[i]=t;
            }
            s.erase(id);
        }
        else break;
        que.pop();
        
    }
    return 1;
    }();
    if(f==0)return 0;
    while(que.size()){
        int id=que.top().second;que.pop();
        int lb=*(s. begin());
        if(id!=lb){
            cout<<"No"<<endl;
            return 0;
        }
        int t=v[id].back();
        if(t>last_used_id[0]){
            cout<<"No"<<endl;
            return 0;
        }
        last_used_id[0]=t;
        s.erase(id);
    }
    cout<<"Yes"<<endl;
    
    return(0);
}


Measured memory_bytes: 12024
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    ll smallest = 1e9;
    ll ans = 0;
    REP(i, n){
        ll p; cin >> p;
        if (smallest > p){
            ans++;
            smallest = p;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  vector<long long> num(N + 1, 0);
  for(int i = 0; i < N; i++){
    cin >> A[i];
    num[A[i]]++;
  }
  
  long long sum = 0;
  
  for(int i = 1; i <= N; i++){
    sum += num[i] * (num[i] - 1) / 2;
  }
  
  for(int i = 0; i < N; i++){
    cout << sum - num[A[i]] * (num[A[i]] - 1) / 2 + (num[A[i]] - 1) * (num[A[i]] - 2) / 2 << endl;
  }
  
  return 0;
}



Measured memory_bytes: 4992
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n=int(input())
nn=n%10
#print(nn)
hon=[2,4,5,7,9]
pon=[0,1,6,8]
bon=[3]
if nn in hon:
    print("hon")
elif nn in pon:
        print("pon")
elif nn in bon:
        print("bon")

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#include <cstring>
#include <limits>
using namespace std;
#define ll long long int
#define lli long long int
#define fw(i, s, e) for (ll i = s; i < e; ++i)
#define fe(i, s, e) for (ll i = s; i <= e; ++i)
#define fb(i, e, s) for (ll i = e; i >= s; --i)
#define L(T)  \
    ll T;     \
    cin >> T; \
    while (T--)
#define FASTIO                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr);
#define mem(a, i) memset(a, i, sizeof(a))
#define ld long double
#define endl "\n"
#define in(P) \
    ll P;     \
    cin >> P;

void solve()
{
}

int main()
{
    FASTIO
    // L(T)
    // {
    // }
    ll a[20000];
    mem(a, 0);
    in(n);
    fe(i, 1, 100)
    {
        fe(j, 1, 100)
        {
            fe(k, 1, 100)
            {
                ll t = (i * i + j * j + k * k+i*j+j*k+k*i);
                if ( t<=10000)
                    a[t]++;
            }
        }
    }
    fe(i, 1, n)
    {
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3756