akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var a = cin.ReadIntArray(N);
            Array.Sort(a);
            var ans = a[N - 1] - a[0];
            WriteLine(ans);
        }
        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}

Measured memory_bytes: 13268
using System;
using System.Linq;

namespace ConsoleApp1111
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var n = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var a = n.Where(_ => _ % 2 == 0).All(_ => _ % 3 == 0 || _ % 5 == 0);
            if (a)
            {
                Console.WriteLine("APPROVED");
            }
            else
            {
                Console.WriteLine("DENIED");
            }
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        mp[a]++;
    }
    int ans = 0;
    for (auto p: mp) {
        if (p.second%2!=0) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int N, Q;
ll bin_search(ll l, ll r, ll x, vector<ll> &vec){
    ll mid=(l+r)/2;
    if(r-l<=1){
        return mid;
    }

    auto it1=lower_bound(vec.begin(),vec.end(),x-mid);
    auto it2=upper_bound(vec.begin(),vec.end(),x+mid);
    ll num=distance(it1,it2);
    if(num==0){
        return bin_search(mid,r,x,vec);
    }
    it2--;
    ll last;
    if(abs(x-*it1)>abs(*it2-x)){
        last=*it1;
    }else{
        last=*it2;
    }
    if(vec[N-num]>x+mid){
        return bin_search(mid,r,x,vec);
    }else if(vec[N-num]==last && last==*it2){
        return bin_search(mid,r,x,vec);
    }else if((x-*it1)==(*it2-x) && (*it2-x)==mid){
        it2--;
        num--;
        last=*it1;
        //cout << l << ' ' << r << ' ' << num << ' ' << last << endl;
        if(vec[N-num]>=x+mid){
            return bin_search(mid,r,x,vec);
        }else if(vec[N-num]==last && last==*it2){
            return bin_search(mid,r,x,vec);
        }
        return bin_search(l,mid,x,vec);
    }else{
        return bin_search(l,mid,x,vec);
    }
}

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    cin >> N >> Q;
    vector<ll> vec(N);
    vector<ll> odd(N/2+N%2+1,0);
    vector<ll> even(N/2+1,0);
    vector<ll> sum_(N+1,0);
    for(int i=1; i<=N; i++){
        cin >> vec[i-1];
        if(i%2==1){
            odd[i/2+1]=vec[i-1]+odd[i/2];
        }else{
            even[i/2]=vec[i-1]+even[i/2-1];
        }
        sum_[i]=vec[i-1]+sum_[i-1];
    }

    //cout_vec(odd);
    //cout_vec(even);
    //cout_vec(sum_);

    for(int i=0; i<Q; i++){
        ll x;
        cin >> x;
        ll h=bin_search(0,MOD,x,vec);
        auto it1=lower_bound(vec.begin(),vec.end(),x-h);
        auto it2=upper_bound(vec.begin(),vec.end(),x+h);
        ll num=distance(it1,it2);
        it2--;
        if(x-*it1==*it2-x&&x-*it1==h&&*it2>vec[N-num]){
            num--;
        }
        ll ans=sum_[N]-sum_[N-num];
        
        //cout << h << ' ' << num << endl;
        if(N-2*num>=0){
            if(N%2==1){
                ans+=odd[(N-2*num)/2+1];
            }else{
                ans+=even[(N-2*num)/2];
            }
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 5548
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

int a[0];
ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}
int n;
bool isOK(int index,int key) {
    if ( a[index]>key )return true;
    else return false;
}
int binary_search(vector<int> l ,int i,int j){
  ll ng =-1; //「index = 0」が条件を満たすこともあるので、初期値は -1
  ll ok = j;
  while(abs(ok - ng) > 1) {
    ll mid = (ok + ng) / 2;
    
    if (isOK(mid, abs(a[i]-a[j]))) ok = mid;
    else ng = mid;
  }
  return ok ;
}

int main(){
  int A,B;
  cin>>A>>B;
  cout<<(ll)(A/__gcd(A,B))*B<<endl;

}
  


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <map>
#include <bitset>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
constexpr const ll INF = 1e15;
constexpr const ll MOD = 1000000007;
constexpr const ll MAX = 15;
constexpr int nx[4] = {1,0,-1,0};
constexpr int ny[4] = {0,1,0,-1};
typedef pair<ll,ll> P;
struct Edge{
    ll from,to,cost;
};
vector<Edge> edges;
vector<ll> d(MAX);
ll V,E;
bool bellman_ford(ll s){
    rep(i,V) d[i] = INF;
    d[s] = 0;
    rep(i,V){
        rep(j,E){
            Edge e = edges[j];
            if(d[e.from] != INF && d[e.to] > d[e.from]+e.cost){
                d[e.to] = d[e.from]+e.cost;
                if (i == V-1) return true;
            }
        }
    }
    return false;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w,c;
    cin >> h >> w;
    V = 10;
    E = 100;
    rep(i,10){
        rep(j,10){
            cin >> c;
            Edge e1;
            e1.from = i;
            e1.to = j;
            e1.cost = c;
            edges.push_back(e1);
        }
    }
    vector<ll> ans(10);
    rep(i,10){
        bellman_ford(i);
        ans[i] = d[1];
    }
    ll an = 0;
    rep(i,h){
        rep(j,w){
            ll a;
            cin >> a;
            if (a != -1) an += ans[a];
        }
    }
    PRINT(an);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    ll n, x;
    ll a[110000] = {};
    ll ans = 0;

    cin >> n >> x;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        ll tmp = a[i] + (i > 0 ? a[i - 1] : 0);
        if (x < tmp)
        {
            if (tmp - x <= a[i])
            {
                a[i] -= (tmp - x);
            }
            else
            {
                a[i - 1] = (tmp - x) - a[i];
                a[i] = 0;
            }
            ans += tmp - x;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1152
#include <iostream>

using namespace std;

int main(){
    bool ans[3] = {false};

    int a,b;

    cin >> a >> b;
    ans[a-1] = true;
    ans[b-1] = true;

    for(int i = 0;i < 3;i++)
        if(!ans[i])
            cout << i+1 << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    let stdin = std::io::stdin();
    let mut sc = Scanner { reader: stdin.lock() };

    let n:usize = sc.read();
    let m:usize = sc.read();

    const INF: usize = 1 << 60;

    let max_v = 1 << n;
    let mut dp = vec![INF; max_v];
    dp[0] = 0;
    for _ in 0..m {
        let a: usize = sc.read();
        let b: usize = sc.read();
        let cc: Vec<usize> = sc.read_vec(b);

        let mut cur = 0;
        for &c in cc.iter() {
            cur |= 1 << (c-1);
        }
        // println!("{:?} {:b}", cc, cur);
        for bit in 0..max_v {
            let nb = bit | cur;
            dp[nb] = min(dp[nb], dp[bit] + a);
        }
    }
    if dp[max_v-1] == INF {
        puts!("{}\n", -1);
    } else {
        puts!("{}\n", dp[max_v-1]);
    }
}


pub struct Scanner<R> {
    reader: R,
}
impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf: String = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        buf.parse::<T>().ok().expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



Measured memory_bytes: 4352
#include "bits/stdc++.h"

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);

int main() {
    long n;
    map<long, long> a;
    vector<long> pairs;
    cin >> n;
    for(int i=0; i<n; i++) {
        long x;
        cin >> x;
        a[x]++;
        if(a[x] == 2) {
            pairs.push_back(x);
            a[x] = 0;
        }
    }
    sort(pairs.rbegin(), pairs.rend());
    long rtn = 0;
    if(pairs.size() > 1)
        rtn = pairs[0] * pairs[1];
    cout << rtn << endl;

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

int sum_digits(int num) {
    int rtn = 0;
    while(num != 0) {
        int tmp = num % 10; 
        rtn += tmp;
        num /= 10; 
    }   
    return rtn;
}
//int sum_digits(int num) {
//    int rtn = 0;
//    string num_str = to_string(num);
//    for(int i=0; i<num_str.size(); i++) {
//        rtn += num_str[i] - '0';
//    }   
//    return rtn;
//}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}



Measured memory_bytes: 6528
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;
#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<" "
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()						
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void minize(ll& a,ll b){a=(a>b?b:a);};
inline void maxize(ll& a,ll b){a=(a<b?b:a);};
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll arr[MAXN+5];


ll Solves(){
	
	ll n,k,cnt=0,ans=0,x,cnt4=0,cnt0=0,cnt2=0;			//1 2 3 4 5 6 7
	// PROCESSING IN HERE
	sc(n);
	assert(n!=1);
	while(n--){
		sc(x);
		assert(x>0);
		if(x%4==0)cnt4++;
		else if(x%2==0)cnt2++;
			else cnt0++;
	}
	
	
	if(cnt2!=0 and cnt2!=n)cnt0++;
	if(cnt0>cnt4+1)pr("No");
	else pr("Yes");
	
	
	
	re 0;
	// Hack it if you can :)
}

int main(){
//	INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	Solves();
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=long long;

int main() {
  string T; cin >>T;
  string ans="";
  rep(i,0,T.size()) {
    if (T[i]=='?') {
      ans.push_back('D');
    } else {
      ans.push_back(T[i]);
    }
  }
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  vector<string> s(n);
  map<string, int> r;
  for(int i = 0; i < n; ++i){
    cin >> s[i];
    r[s[i]]++;
  } 
  int m; cin >> m;
  vector<string> t(m);
  for(int i = 0; i < m; ++i){
    cin >> t[i];
    r[t[i]]--;
  }
  int max = 0;
  for(auto itr = r.begin(); itr != r.end(); itr++){
    if(max < itr->second){
      max = itr->second;
    }
  }
  cout << max << endl;
  
  
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int h, w;
	int i, j;
	while(1) {
		scanf("%d %d", &h, &w);
		if(h == 0 && w == 0) break;
		for(i = 1; i <= h; i++) {
			for(j = 1; j <= w; j++) {
				if(i % 2 != 0 && j % 2 != 0) printf("#");
				else if(i % 2 == 0 && j % 2 == 0) printf("#");
				else printf(".");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2044
import itertools
N,C = map(int,input().split())
D = [list(map(int,input().split())) for i in range(C)]
grid = [list(map(int,input().split())) for i in range(N)]
l1 = [0]*C
l2 = [0]*C
l3 = [0]*C
for i in range(1,N+1):
    for j in range(1,N+1):
        if (i+j) % 3 == 0:
            l1[grid[i-1][j-1]-1] += 1
        elif (i+j) % 3 == 1:
            l2[grid[i-1][j-1]-1] += 1
        elif (i+j) % 3 == 2:
            l3[grid[i-1][j-1]-1] += 1
color = list(range(1,C+1))
ans = float('inf')
for x,y,z in itertools.permutations(color,3):
    res = 0
    for i in range(C):
        res += D[i][x-1]*l1[i]
    for i in range(C):
        res += D[i][y-1]*l2[i]
    for i in range(C):
        res += D[i][z-1]*l3[i]
    if res < ans:
        ans = res
print(ans)

Measured memory_bytes: 5620
n = int(raw_input())
line = raw_input()

west = [0] * n

for i in range(n - 1):
    west[i + 1] = west[i]
    if line[i] == 'W':
        west[i + 1] += 1

east = [0] * n

for i in range(n - 1, 0, -1):
    east[i - 1] = east[i]
    if line[i] == 'E':
        east[i - 1] += 1

min_change = 1e10

for i in range(n):
    if west[i] + east[i] < min_change:
        min_change = west[i] + east[i]

print min_change

Measured memory_bytes: 26712
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

n, q = MAP()
s = STR()
t = [0 for _ in range(n)]
for i in range(1, n):
    t[i] = t[i - 1]
    if s[i - 1:i + 1] == 'AC':
        t[i] += 1
for _ in range(q):
    l, r = MAP()
    print(t[r - 1] - t[l - 1])

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}


signed main(){
    CIN(N);
    vi v(N),c(N),A(N);
    rep(i,N) cin>>v[i];
    rep(i,N) cin>>c[i];
    rep(i,N) A[i]=v[i]-c[i];
    int ans=0;
    rep(i,N){
        if(A[i]>=0)ans+=A[i];
    }
    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_set>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1ll << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll n, k;
vector<ll> s;

bool solve(ll index) { //条件判定
	ll now = 0; // k以下のペアの数
	//cout << index  << " ! "<< endl;
	REP(i, n - 1) {
	//	cout << s[i] << " ? ";
		if (s[i] > 0) {
			ll need;
			if (index >= 0)need = index / s[i];
			else need = (index * -1 + s[i] - 1) / s[i] * -1;
			ll it = upper_bound(s.begin() + i + 1, s.end(), need) - s.begin() - i - 1;
			now += it;
			//cout << it << endl;
		}
		else if (s[i] < 0) {
			ll need;
			if (index <= 0)need = (index + s[i] + 1) / s[i];
			else need = index / (-1 * s[i]) * -1;
			ll it = s.end() - lower_bound(s.begin() + i + 1, s.end(), need) - 1;
			//cout << need << "!!!!" << endl;
			now += it;
			//cout << it << endl;
		}
		else {
			if (index >= 0) now += n - i - 1;
			//cout << n - i - 1 << endl;
		}
	}
	if (now >= k)return true;
	else return false;
}

ll nibutan() { //めぐる式
	ll ng = MINF; //最大値ならs.size()
	ll ok = INF; // 最大値なら0

	while (abs(ok - ng) > 1) {
		ll mid = (ok + ng) / 2;

		if (solve(mid)) ok = mid;
		else ng = mid;
	}
	return ok; //満たさない最大ならng
}

int main() {
	cin >> n >> k;
	s.resize(n);
	REP(i, n)cin >> s[i];
	s.push_back(INF);
	sort(ALL(s));
	cout << nibutan() << endl;
}



Measured memory_bytes: 4608
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    res = 10 ** 20
    for i in range(n):
        a, b = read_int_list()
        if a + b < res:
            res = a + b
    print(res)


main()


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

using namespace std;

int N, M;
int dp[100000];
vector<int> G[100000];

void to(int *x, int y) {
    if (*x < y) *x = y;
}


int dfs(int u) {
    if (dp[u] >= 0) return dp[u];
    dp[u] = 0;
    for (int v : G[u]) {
        to(&dp[u], 1 + dfs(v));
    }
    return dp[u];
}

int main() {
    scanf("%d %d", &N, &M);
    for (int i = 0; i < M; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        u--;
        v--;
        G[u].push_back(v);
    }
    for (int i = 0; i < N; i++) {
        dp[i] = -1;
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        to(&ans, dfs(i));
    }
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 7424
// std::ifstream in ("input.txt");
// std::cin.rdbuf(in.rdbuf());

#include <bits/stdc++.h>
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define INF 1e9
using namespace std;
typedef long long ll;

signed main() {
  // std::ifstream in ("input.txt");
  // std::cin.rdbuf(in.rdbuf());

  int k, x;
  cin >> k >> x;
  FOR(i, x - k + 1 , x + k){
    cout << i << ' ';
  }
  cout << endl;
}


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

int main(){
   int N, M;
   std::cin >> N >> M;
   std::vector<std::pair<long long int, long long int>> A;
   for (int i=0; i<N; i++){
      long long int price, zaiko;
      std::cin >> price >> zaiko;
      A.push_back({price, zaiko});
   }
   std::sort(A.begin(), A.end());
   long long int sum = 0;
   for (int i=0; i<N; i++){
      std::cerr << A.at(i).first << " " << A.at(i).second << std::endl;
      if(A.at(i).second <= M){
         sum = sum + A.at(i).first * A.at(i).second;
         std::cerr << A.at(i).first * A.at(i).second << std::endl;
         M = M - A.at(i).second;
      } else{
         sum = sum + A.at(i).first * M;
         break;
      }
   }
   std::cout << sum << std::endl;

}



Measured memory_bytes: 2420
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	if n == 1 {
		fmt.Println(1)
		return
	}
	if n%2 == 0 {
		N := n / 2
		fmt.Println(float64(N) / float64(n))
	} else {
		N := (n + 1) / 2
		fmt.Println(float64(N) / float64(n))
	}
}


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

int func(int a, int b, int c) {
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1)
        return 0;

    if (a == b && b == c)
        return -1;

    return func((b + c) / 2, (a + c) / 2, (a + b) / 2) + 1;
}

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    cout << func(a, b, c) << endl;
}


Measured memory_bytes: 3592
n,m=map(int,input().split())

min=1
max=n


for i in range(m):
    l,r=map(int,input().split())
    if r<max:
        max=r
    if l>min:
        min=l
ans=max-min+1
if ans>0:
    print(ans)
else:
    print(0)


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

using namespace std;

const int N = 200005;

int n, a[N];

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	if (a[1]) {
		cout << -1; return 0;
	}
	int mx = a[n];
	long long res = a[n];
	for (int i = n - 1; i >= 1; --i) {
		mx--;
		if (mx > a[i]) {
			cout << -1; return 0;
		}
		if (mx == a[i]) continue;
		mx = a[i], res += a[i];
	}
	cout << res;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  long long m;
  cin >> m;
  vector<long long> a(n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    long long x = a[i];
    int c = 0;
    while (x % 2 == 0) x >>= 1, c++;
    if (i == 0 || cnt == c) cnt = c;
    else {
      cout << 0 << '\n';
      return 0;
    }
    a[i] >>= 1;
  }
  long long lcm = a[0];
  for (int i = 1; i < n; i++) {
    lcm = lcm / __gcd(lcm, a[i]) * a[i];
    if (lcm > m) {
      cout << 0 << '\n';
      return 0;
    }
  }
  long long dif = lcm * 2;
  m = max(0LL, m - lcm);
  cout << m / dif + 1 << '\n';
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------

signed main() {
	int a, b, c, sum = 0;
	cin >> a >> b >> c;
	for (int i = a; i <= b; i++) {
		if (c%i == 0) {
			sum++;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3104
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    struct AB {
        public long A { get; set; }
        public long B { get; set; }
    }
        

    public void Solve() {
        long N = sc.nextLong();
        long M = sc.nextLong();
        var ary = new AB[N];
        for (int i = 0; i < N; i++) {
            ary[i] = new AB {
                A = sc.nextLong(),
                B = sc.nextLong()
            };
        }
        ary = ary.OrderBy(ab => ab.A).ToArray();
        long ans = 0;
        foreach (var ab in ary) {
            if (M > ab.B) {
                ans += ab.A * ab.B;
                M -= ab.B;
            } else {
                ans += ab.A * M;
                break;
            }
        }
        WriteLine(ans);
    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 24780
#include<bits/stdc++.h>
#define mod 998244353
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
char A[10010],B[10010];
int dp[10010][5010],fact[10010],ifact[10010];
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod,y>>=1;
	}
	return ret;
}
int C(int n,int m){return 1ll*fact[n]*ifact[m]%mod*ifact[n-m]%mod;}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	scanf("%s",A+1);scanf("%s",B+1);
	int n=strlen(A+1),p=0,q=0;
	for(int i=1;i<=n;++i)p+=A[i]=='1'&&B[i]=='1',q+=A[i]=='1'&&B[i]=='0';
	fact[0]=1;for(int i=1;i<=n;++i)fact[i]=1ll*fact[i-1]*i%mod;
	ifact[n]=pow(fact[n],mod-2);for(int i=n;i;--i)ifact[i-1]=1ll*ifact[i]*i%mod;
	for(int i=0;i<=q;++i)dp[0][i]=1ll*fact[i]*fact[i]%mod;
	for(int i=1;i<=p;++i)
		for(int j=1;j<=q;++j)
			dp[i][j]=(1ll*dp[i][j-1]*j%mod*j+1ll*dp[i-1][j]*i%mod*j)%mod;
	int ans=0;
	for(int i=0;i<=p;++i)ans=(ans+1ll*dp[p-i][q]*fact[i]%mod*fact[i]%mod*C(p,i)%mod*C(p+q,i))%mod;
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 193536
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

using P = pair<int, int>; // (ティツキツ敕ゥツ崢「テッツシツ古」ツδ妥」ツつケテ、ツクツ甘」ツ?ョテヲツ慊?・ツーツ湘ゥツ?づァツつケid)
using PPI = pair<P, int>;

const int inf = 1 << 28;

int N, A, B, C;

P cost[3][20000];
vector<int> G[20000];
int old_id[20000]; // テ・ツ、ツ嘉ヲツ渉崚・ツセツ古」ツ?ョテ」ツつーテ」ツδゥテ」ツδ膝'テ」ツ?ョテゥツ?づァツつケv'テ」ツ?ォテ・ツッツセテ・ツソツ愿」ツ?凖」ツつ凝・ツ?ε」ツ?ョテゥツ?づァツつケv

void dijkstra(int s) {
    for (int v = 0; v < N; v++) {
        cost[s][v] = {inf, inf};
    }

    cost[s][s] = {0, old_id[s]};

    priority_queue<PPI, vector<PPI>, greater<PPI>> Q;
    Q.push({{0, old_id[s]}, s});
    while (!Q.empty()) {
        auto q = Q.top();
        Q.pop();
        P val = q.first;
        int v = q.second;

        if (cost[s][v] < val) {
            continue;
        }

        for (int to : G[v]) {
            P nval = make_pair(val.first + 1, min(val.second, old_id[to]));
            if (cost[s][to] > nval) {
                cost[s][to] = nval;
                Q.push({nval, to});
            }
        }
    }
}

int main() {
    static int num[3];
    cin >> N;
    for (int i = 0; i < 3; i++) {
        cin >> num[i];
    }
    static int min_id[3] = {inf, inf, inf};

    static int group[20000];
    memset(group, -1, sizeof(group));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < num[i]; j++) {
            int x;
            cin >> x;
            x--;
            group[x] = i;
            min_id[i] = min(min_id[i], x);
        }
    }
    map<int, int> mp;
    int id = 3;

    for (int i = 0; i < 3; i++) {
        old_id[i] = min_id[i];
    }

    for (int v = 0; v < N; v++) {
        if (0 <= group[v] and group[v] < 3)
            mp[v] = group[v];
        else {
            mp[v] = id++;
            old_id[mp[v]] = v;
        }
    }

    int M;
    cin >> M;
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;

        G[mp[x]].emplace_back(mp[y]);
        G[mp[y]].emplace_back(mp[x]);
    }

    // Dijkstra
    for (int s = 0; s < 3; s++) {
        dijkstra(s);
    }

    P ans = {inf, inf};
    for (int v = 0; v < id; v++) {
        ans = min(ans, {cost[0][v].first + cost[1][v].first + cost[2][v].first,
                        min({cost[0][v].second, cost[1][v].second,
                             cost[2][v].second})});
    }
    cout << ans.first << " " << ans.second + 1 << endl;

    return 0;
}

Measured memory_bytes: 9936
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var s = cin.Read;
            WriteLine(s.Count(x=>x=='1'));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


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

int main() {
  int n,w;
  cin>>n>>w;
  ll dp[n+1][w+1];
  int val[n], wt[n];
  for(int i=0;i<n;i++) cin>>wt[i]>>val[i];  
  for(int i=0;i<n+1;i++) dp[i][0]=0;
  for(int i=0;i<w+1;i++) dp[0][i]=0;
  for(int i=1;i<n+1;i++) {
  	for(int j=1;j<w+1;j++) {
    	if(j-wt[i-1]>=0) {
          dp[i][j] = max(dp[i-1][j], val[i-1]+dp[i-1][j-wt[i-1]]);
        } else {
          dp[i][j] = dp[i-1][j];
        }
    }
  }
  cout<<dp[n][w]<<endl;
}

Measured memory_bytes: 79104
n, m = gets.split.map(&:to_i)

parent = Array.new(n+1) {[0, []]}
child = Array.new(n+1) {[]}
(n-1+m).times do
    a, b = gets.split.map(&:to_i)
    child[a] << b
    parent[b][0] += 1
    parent[b][1] << a
end

que = parent.map.with_index{|v, i| v[0] == 0 ? i : nil}.compact
que.shift
topo = Array.new(n+1)
rtopo = []
i = 0
while now = que.shift
    topo[now] = i
    rtopo << now
    i += 1
    child[now].each do |x|
        parent[x][0] -= 1
        que << x if parent[x][0] == 0
    end
end

1.upto(n) do |i|
    parent[i] = parent[i][1].map{|e| topo[e]}.max
end

parent.shift
parent.each {|x| p x ? rtopo[x] : 0}

Measured memory_bytes: 48480
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  bool ans=true;
  if(n%2==1){
    rep(i,n){
      if(i==0){
        if(a[i]!=0)ans=false;
        continue;
      }
      if(i%2==1){
        if(a[i]!=a[i-1]+2)ans=false;
      }
      else{
        if(a[i]!=a[i-1])ans=false;
      }
    }
  }
  if(n%2==0){
    rep(i,n){
      if(i==0){
        if(a[0]!=1)ans=false;
        continue;
      }
      if(i%2==0){
        if(a[i]!=a[i-1]+2)ans=false;
      }
      else {
        if(a[i]!=a[i-1])ans=false;
      }
    }
  }
  if(ans==false){
    cout<<0<<endl;
    return 0;
  }
  ll k=(a[n-1]+1)/2;
  cout<<modpow(2,k,MOD)<<endl;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>h(n); for(auto&&i:h)cin>>i;
	h.emplace_back(2e9);
	int ans=0;
	for(int i=1,c=0;i<=n;++i){
		if(h.at(i-1)>=h.at(i))++c;
		else{
			ans=max(ans,c);
			c=0;
		}
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3988
#include<stdio.h>
#define N 200000


main(){

  int n,a[N],j,max,min;

  scanf("%d",&n);

for(j=0;j<n;j++){
  
 
      scanf("%d",&a[j]);
 }

 min = a[0];
 max = a[1] - a[0];
 for(j=1;j<n;j++){
      
      if(max<a[j]-min) max=a[j]-min;
      if(min > a[j])min = a[j];
 }

 printf("%d\n",max);
 return 0;
}
 

Measured memory_bytes: 1376
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5+5;
ll dp[105][maxn], v[maxn], w[maxn];

int main(){
	int n, k; cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> w[i] >> v[i];
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= k; j++){
			if(j >= w[i]) dp[i][j] = max(dp[i-1][j], dp[i-1][j - w[i]] + v[i]);
			else dp[i][j] = dp[i-1][j];
		}
	}
	cout << dp[n][k] << endl;
}

Measured memory_bytes: 80128
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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 (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M;
  cin >> N >> M;

  priority_queue<int> A;
  REP(i, N){
    int a;
    cin >> a;
    A.push(a);
  }

  vector<pair<int, int>> B(M);
  REP(i, M) cin >> B[i].first >> B[i].second;

  sort(ALL(B), [](pair<int, int> const & l, pair<int, int> const & r){
      return l.second > r.second;
      });

  int p = 0;
  REP(i, N){
    if(B[p].first == 0) p++;
    if(p == M) break;

    A.push(B[p].second);
    B[p].first--;
  }

  int ans = 0;
  REP(i, N){
    ans += A.top(); A.pop();
  }

  cout << ans << "\n";

  return 0;
}


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

using namespace std;

#define pos first
#define jumps second

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.in" , "r" , stdin);
#endif
    int n , m;
    string s;
    cin >> n >> m >> s;

    deque<pair<int , int> > dq;
    dq.push_back({n , 0});

    vector<int> par(n + 1);
    for (int i = n - 1 ;i >= 0 ;i--) {
        if (s[i] == '1') continue;

        while (dq.size() && dq.back().pos - i > m)
            dq.pop_back();

        while (dq.size() > 1 && dq[dq.size() - 2].jumps == dq.back().jumps)
            dq.pop_back();

        if (dq.empty()) {
            cout << -1;
            return 0;
        }

        par[i] = dq.back().pos;
        dq.push_front({i , dq.back().jumps + 1});
    }

    int cur = 0;
    while (cur != n) {
        cout << par[cur] - cur << ' ';
        cur = par[cur];
    }
}

Measured memory_bytes: 4180
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;
constexpr LL kInf = 1e18;

int state(int n) {
  int s = 0;
  for (int i = 0; i < n; ++i) {
    int x; cin >> x; --x;
    s |= (1 << x);
  }
  return s;
}

LL dp[1 << 12];

int main() {
  int N, M; cin >> N >> M;
  for (int i = 0; i < (1 << N); ++i) dp[i] = kInf;
  dp[0] = 0;
  for (int i = 0; i < M; ++i) {
    int a, b; cin >> a >> b;
    int s = state(b);
    dp[s] = min(dp[s], (LL)a);
  }

  for (int s1 = 0; s1 < (1 << N); ++s1) {
    if (dp[s1] == kInf) continue;
    for (int s2 = s1 + 1; s2 < (1 << N); ++s2) {
      if (dp[s2] == kInf) continue;
      int s = s1 | s2;
      dp[s] = min(dp[s], dp[s1] + dp[s2]);
    }
  }

  LL x =  dp[(1 << N) - 1];
  if (x == kInf) cout << -1 << endl;
  else           cout << x << endl;
}


Measured memory_bytes: 3652