akhauriyash/Code-Regression huggingface dataset:
<?php

$input = explode(" ",trim(fgets(STDIN)));
$count = $input[0];//3
$g = $input[1]; //1000
$sum = 0;
$c = 0;
$n = 0;

for($i=0; $i<=$count-1; $i++){
    $total = trim(fgets(STDIN));
    $c += $total;
    $min[] = $total;
}
// echo $c;

$nokori = $g - $c;
// echo $nokori;//最低保障　残りのグラム

$min = min($min);//100 最小値

$v = floor($nokori / $min);
echo $v + $count;

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define ll long long
#define ss second
#define ff first
#define mod 1000000007
#define w(x) ll x; cin>>x; while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define re(i, j) fo(i, 0, j, 1)
#define pi acos(-1)
#define all(cont) cont.begin(), cont.end()
#define countbit(x) __builtin_popcount(x)
#define mod 1000000007
#define de(n) ll n;cin>>n;
#define def(a,n) ll n;cin>>n;ll a[n];re(i,n){cin>>a[i];}
#define defi(a,n,k) ll n;cin>>n; ll k;cin>>k;ll a[n];re(i,n){cin>>a[i];}
#define deb(x) cout<<#x<<"="<<x<<endl;
#define tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define nl cout<<endl;
using namespace std;
//18-1326D1 1208B 845C 912B 1009B 1350C 20C 1333C 1234D 1327C 1305B 1304B (or in matrix) 1216-C(26) 21
void cp()
{
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); 
    #ifndef ONLINE_JUDGE  
    freopen("input.txt", "r", stdin);  
    freopen("output.txt", "w", stdout);
#endif
}
int main()
{
  cp();
 //w(x)
  {
   de(d);
   de(t);
   de(s);
   if(s*t>=d)
   {
     cout<<"Yes\n";
   }
   else
   {
     cout<<"No\n";
   }
  }
}
// cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";


Measured memory_bytes: 3648
n = int(input())
v = tuple(tuple(map(int, input().split())) for _ in range(n))
e = tuple(zip(*v))
# e[j][i(0-indexed)]:=i日目に活動jして得る幸福度
# print(e)

dp = tuple([0] * 3 for _ in range(n + 1))
# dp[i(1-indexed)][j]:=i日目に活動jした最大幸福度

# もらう
for i in range(n):
    for j in range(3):
        dp[i + 1][j] = max(dp[i][(j + 1) % 3], dp[i][(j + 2) % 3]) + e[j][i]
print(max(dp[n]))


Measured memory_bytes: 82392
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
struct RollingHash{
	using ull=unsigned long long;
	const ull mask30=(1ll<<30)-1;
	const ull mask31=(1ll<<31)-1;
	const ull mod=(1ll<<61)-1;
	const ull positivizer=(mod<<2);

	ull calcmod(ull x){
		ull ret=(x>>61)+(x&mod);
		if(ret>=mod) ret-=mod;
		return ret;
	}
	ull mul(ull a, ull b){
		ull au=(a>>31), ad=(a&mask31), bu=(b>>31), bd=(b&mask31);
		ull mid=au*bd+ad*bu;
		ull midu=(mid>>30), midd=(mid&mask30);
		ull ret=((au*bu)<<1)+midu+(midd<<31)+ad*bd; //ret<2^63
		/*ret=(ret>>61)+(ret&mod);
		if(ret>=mod) ret-=mod;*/
		return ret;
	}

	vector<ull> hash, power;

	RollingHash(const string &s, ull base=1000000007){
		int sz=s.size();
		hash.resize(sz+1);
		power.resize(sz+1);
		power[0]=1;
		for(int i=0; i<sz; i++){
			power[i+1]=calcmod(mul(power[i], base));
			hash[i+1]=calcmod(mul(hash[i], base)+s[i]);
		}
	}

	ull get(int l, int r){ // [l, r)
		return calcmod(hash[r]+positivizer-mul(hash[l], power[r-l]));
	}

	ull concat(ll h1, ll h2, int len2){ //h1+h2
		return calcmod(mul(h1, power[len2])+h2);
	}
};
int main()
{
	int n; cin>>n;
	string s; cin>>s;
	RollingHash rh(s);
	int ans=0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			while(i+ans<j && j+ans<n){
				if(rh.get(i, i+ans+1)!=rh.get(j, j+ans+1)) break;
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int n;
    cin >> n;
  
  	int ans = 0;
  	for(int i=0; i<3; i++){
		if(n & 1) ans++;
		n >>= 1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
using System;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var r = double.Parse(input);

            var area = r * r * Math.PI;
            var circumference = 2 * r * Math.PI;

            Console.WriteLine("{0:f6} {1:f6}",area,circumference);
        }
    }
}

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

template<int MAX_V>
class dinic{
    struct edge{
        int to;
        uint64_t cap;
        int rev;
    };
    vector<edge> edges[MAX_V];
    int level[MAX_V];
    int next[MAX_V];

    void set_level(int s){
        memset(level, -1, sizeof(level));
        queue<int> Q;
        level[s] = 0;
        Q.push(s);
        while(!Q.empty()){
            int v = Q.front();
            Q.pop();
            for(edge e:edges[v]){
                if(e.cap > 0 && level[e.to] < 0){
                    level[e.to] = level[v] + 1;
                    Q.push(e.to);
                }
            }
        }
    }

    uint64_t blockingflow(int v, int t, uint64_t f){
        if(v == t) return f;
        for(int &i = next[v];i<edges[v].size();i++){
            edge &e = edges[v][i];
            if(e.cap > 0 && level[v] < level[e.to]){
                uint64_t d = blockingflow(e.to, t, min(f, e.cap));
                if(d > 0){
                    e.cap -= d;
                    edges[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
public:
    void add_edge(int from, int to, uint64_t cap){
        edges[from].push_back({to, cap, (int)edges[to].size()});
        edges[to].push_back({from, 0, (int)edges[from].size()-1});
    }

    uint64_t max_flow(int s, int t){
        uint64_t flow = 0;
        while(true){
            set_level(s);
            if(level[t] < 0) return flow;
            memset(next, 0, sizeof(next));
            int f;
            while((f = blockingflow(s, t, -1)) > 0) flow += f;
        }
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int N;
    pair<int,int> red[100], blue[100];
    dinic<202> d;

    cin >> N;
    for(int i=0;i<N;i++){
        int a, b;
        cin >> a >> b;
        red[i] = {a, b};
        d.add_edge(0, i+1, 1);
    }
    for(int i=0;i<N;i++){
        int a, b;
        cin >> a >> b;
        blue[i] = {a, b};
        d.add_edge(100+i+1, 201, 1);
    }

    for(int r=0;r<N;r++){
        for(int b=0;b<N;b++){
            if(red[r].first < blue[b].first && red[r].second < blue[b].second){
                d.add_edge(r+1, 100+b+1, 1);
            }
        }
    }

    cout << d.max_flow(0, 201) << endl;
    
    return 0;
}

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

int main() {
    int n,m;
    cin >> n >> m;
    vector<pair<long long, long long>> s(n);
    int a,b;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        s.at(i) = make_pair(a,b);
    }
    sort(s.begin(),s.end());
    int cnt = 0;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        if (cnt + s.at(i).second < m) {
            cnt += s.at(i).second;
            sum += s.at(i).first * s.at(i).second;
            continue;
        }
       
        sum += (m - cnt) * s.at(i).first;
        break;
    }
    cout << sum << endl;
    
}

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
    //a^tを求める
    //例：d[i] = mint(k/i).pow(n);
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  ll n;
  cin>>n;
  map<P,ll> mp;
  //vector<P> A;
  rep(i,n){
    ll a1,b1;
    cin>>a1>>b1;

    if (a1==0 and b1==0){
      mp[make_pair(0,0)]+=1;
    //  A.push_back(make_pair(0,0));
    }
    else if (a1!=0 and b1==0){
      mp[make_pair(1,0)]+=1;
    //  A.push_back(make_pair(1,0));
    }

    else if (a1==0 and b1!=0){
      mp[make_pair(0,1)]+=1;
  //    A.push_back(make_pair(0,1));
    }

    else{
      ll g1=gcd(a1,b1);
      ll g2=a1/g1;
      ll g3=b1/g1;
    //  cout<<a1/g1<<' '<<b1/g1<<"gcd"<<endl;
  //    A.push_back(make_pair(a1/g1,b1/g1));
            if(g2<0){
              g2=-g2;
              g3=-g3;
            }
            mp[make_pair(g2,g3)]+=1;

    }
  }
mint ans=1;
ll temp=mp[make_pair(0,0)];//0,0を覗く
//cout<<temp<<endl;
ll nnew=n-temp;
mp[make_pair(0,0)]=0;
//cout<<nnew<<endl;

for(auto i=mp.begin();i!=mp.end();i++){
  P now=i->first;
  ll now1=now.first;
  ll now2=now.second;
  ll new1,new2;
  ll count=i->second;//自分
  if (now2<0) {
    new1=-now2;new2=now1;
  }
  if (now2>=0) {
    new1=now2;new2=-now1;
  }
  ll cntnew=mp[make_pair(new1,new2)];//ペアの数
  //cout<<cntnew<<' '<<now1<<' '<<now2<<' '<<count<<' '<<"cnew"<<endl;
  if (cntnew==0)continue;
  mint a1 = mint(2).pow(count);
  mint a2 = mint(2).pow(cntnew);
  a1+=a2;
  a1-=1;
  ans*=a1;
  nnew-=(count+cntnew);
  mp[make_pair(new1,new2)]=0;
  mp[make_pair(now1,now2)]=0;

}

//cout<<nnew;

mint a3=mint(2).pow(nnew);
ans*=a3;
ans-=1;
ans+=temp;
cout<<ans;



}


Measured memory_bytes: 28496
from math import factorial
from itertools import accumulate


def combination(n, r):  # n個からr個選ぶ場合の数
    if n < r:
        return 0
    else:
        return factorial(n)//(factorial(r) * factorial(n-r))


N = int(input())
A = [int(i) for i in input().split()]
ans = 0
cumsum = sorted(list(accumulate(A)))
now = None
cnt = 1
for a in cumsum:
    if now is None:
        now = a
    elif now == a:
        cnt += 1
    else:
        ans += combination(cnt, 2)
        cnt = 1
        now = a
ans += combination(cnt, 2)
ans += cumsum.count(0)
print(ans)


Measured memory_bytes: 102480
function Main (input) {
  input = input.split("\n");
  input[0] = input[0].split(" ");
  var A = input[0][0];
  var B = input[0][1];
  var S = input[1];
  var ans = "No";
  if (S.split("")[A] == "-" && S.split("-")[0].length == A && S.split("-")[1].length == B) {
    ans = "Yes";
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;

ll fact(ll x){ll a=1;while(x>0){a*=x;a=a%1000000007;x--;}return a;}

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

	int n, a[200000];
	vector<int> b;

	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];

	int pos = n;
	while(pos > 0){
		b.push_back(a[pos-1]);
		pos -= 2;
	}
	if(n % 2 == 0) pos = 1;
	else pos = 2;

	while(pos <= n){
		b.push_back(a[pos-1]);
		pos += 2;
	}

	for(int i = 0;i < n;i++){
		cout << b[i];
		if(i != n-1) cout << ' ';
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
template <typename node> void chkmax(node &x, node y) {x = max(x, y);}
template <typename node> void chkmin(node &x, node y) {x = min(x, y);}
template <typename node> void read(node &x) {
	x = 0; int f = 1; char c = getchar();
	while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar(); x *= f;
}
int main() {
	int n, k; read(n), read(k);
	long long ans = 0;
	for (int i = 0; i < k; i++) {
		if (2 * i % k != 0) continue;
		long long x = n / k;
		if (n % k >= i && i) x++;
		ans += x * x * x;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 1000000000000000;
#define MOD 1000000007LL;
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
typedef int64_t i64;

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

string s;
int K;
cin >> s >> K;

VS subs;
rep(i, 1, K+1)
    rep(j, 0, s.size() - i + 1)
        subs.push_back(s.substr(j, i));

sort(ALL(subs));
unique(ALL(subs));

cout << subs[K-1] << endl;

}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 1788
#include<iostream>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
using namespace std;
using ll=long long;

int main(){
    int n; cin>>n;
    int res=0;
    for(int i=1;i<=n;i++){
        int k=log10(i);
        if(k%2==0){
            res++;
        }
    }
    cout<<res<<endl;
    
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>           // sorted map so O(logn)
#include <unordered_map> // O(1)
typedef long long ll;
using namespace std;

int main()
{
    string x;
    string r;
    cin >> x;
    for (int i = 0; i < x.length(); ++i)
    {
        r += 'x';
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 3612
n,m = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
tenbou = [true]*n
m.times do
  a,b = gets.split.map{|i| i.to_i-1}
  if h[a] > h[b]
    tenbou[b] = false
  elsif h[a] < h[b]
    tenbou[a] = false
  elsif h[a] == h[b]
    tenbou[a] = false
    tenbou[b] = false
  end
end

puts tenbou.count(true)

Measured memory_bytes: 22360
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n';

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	int n;
	cin >> n;
	vector<int> dp_a(n + 1, -MOD), dp_b(n + 1, -MOD), dp_c(n + 1, -MOD);
	cin >> dp_a[0] >> dp_b[0] >> dp_c[0];
	rep2(i, 1, n) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		dp_a[i] = max(dp_b[i-1], dp_c[i-1]) + a;
		dp_b[i] = max(dp_a[i-1], dp_c[i-1]) + b;
		dp_c[i] = max(dp_a[i - 1], dp_b[i - 1]) + c;
	}
	cout << max(max(dp_a[n - 1], dp_b[n - 1]), dp_c[n - 1]);
}



Measured memory_bytes: 1408
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

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

  std::vector<std::string> w(n);
  for (int i = 0; i < n; i++) {
    std::cin >> w.at(i);
  }

  for (int i = 1; i < n; i++) {
    std::string last = w.at(i - 1);
    std::string now = w.at(i);

    if (now.front() != last.back() || std::count(w.begin(), w.end(), now) > 1) {
      std::cout << "No" << std::endl;
      return 0;
    }
  }

  std::cout << "Yes" << std::endl;
  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var A = sc.ReadInt();
        var B = sc.ReadInt();
        if (A > 9 || B > 9)
        {
            Console.WriteLine(-1);
        }
        else
        {
            Console.WriteLine(A * B);
        }
    }

    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

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

    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    sort(a.begin(), a.end());

    int res = INF;
    rep(i, n) {
        if (i == 0) {
            chmin(res, k - max(a[i] + k - a[n-1], a[i + 1] - a[i]));
        }
        else {
            chmin(res, k - max(a[i] - a[i-1], a[i + 1] - a[i]));
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
    string s;
    cin >> s;
    string hi = "";
    for(int i=0;i<=5;i++){
        hi += "hi";
        if(hi == s){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

/*
while(!frag && cin >> a >>b, a|b)
*/

int main(void){
   int a,b,c,d,e;cin >> a >> b >> c >> d >> e;
   if(b <= d){
       cout << max((c-a)*60 + d-b-e,0) << "\n";
   }else{
       cout << max((c-a-1)*60 + 60+d-b -e, 0) << "\n";
   }
}

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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

void solve() {
    ll n, m;
    cin >> n >> m;
    ll res = n * (n - 1) / 2 + m * (m - 1) / 2;
    cout << res << endl;
}

int main() {
	header();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    string s; cin >> s;
    if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]) cout << "Bad" << endl;
    else cout << "Good" << endl;
}

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

using namespace std;
typedef pair<int,int> P;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
int h,w;
char grid[55][55];
int dist[55][55];
int ans = 0;
const int INF = 1e9;
int main() {
  cin >> h >> w;
  for(int i = 0; i < h; i++) {
    string s;
    cin >> s;
    for(int j = 0; j < w; j++) {
      grid[i][j] = s[j];
      if(s[j] == '#') ans++;
    }
  }

  for(int i = 0; i < h; i++) {
    fill(dist[i],dist[i]+w,INF);
  }

  queue<P> q;
  q.push(P(0,0));
  dist[0][0] = 0;

  while(!q.empty()) {
    int tx = q.front().first;
    int ty = q.front().second;
    q.pop();
    for(int i = 0; i < 4; i++) {
      int nx = tx + dx[i];
      int ny = ty + dy[i];

      if(nx >= 0 && nx < h && ny >= 0 && ny < w && grid[nx][ny] != '#') {
     
	if(dist[nx][ny] > dist[tx][ty] + 1) {
	  dist[nx][ny] = dist[tx][ty] + 1;
	  q.push(P(nx,ny));
	}
      }
    }
  }
 
  if(dist[h-1][w-1] == INF) {
    cout << "-1" << endl;
    return 0;
  }
  cout << (h * w) - ans - (dist[h-1][w-1] + 1) << endl;
}
    
  
  


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>


int main(void) {
	long long int n, i = 2;
	
	scanf("%lld", &n);
	printf("%lld:", n);
	while(i*i <= n){
		if(n % i == 0){
			n /= i;
			printf(" %lld", i);
		}
		else i++;
	}
	if(n != 1) printf(" %lld", n);
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<stdlib.h>

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

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

int main(void)
{
    int ans = 0;

    int K;
    int X;

    scanf("%d",&K);
    scanf("%d",&X);


    if(500*K>=X){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int (i)=0;(i)<(N);(i)++)
#define REPR(i,N) for(int (i)=(N);i>=0;i--)
#define FOR (i,m,n) for(int (i)=m;(i)<(n);(i)++)

int main(){
  char c;
  cin >> c;
  if(c=='a'|| c=='i' || c=='u' || c=='e' || c=='o') cout << "vowel" << endl;
  else cout << "consonant" << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        long n=fsc.nextLong();
        fsc.close();
        long max=1;
        for(long i=2;i<=(long) Math.sqrt(n);i++){
            if(n%i==0) max=i;
        }
        long x=max, y=n/max;
        System.out.println(x+y-2);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}

Measured memory_bytes: 22484
#include<iostream>

using namespace std;

int main(){
	int n;
	int a[108000];
	
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	
	for(int i = 0;i < n;i++){
		int j = i;
		while(j > 0 && a[j-1] > a[j]){
			int k = a[j];
			a[j] = a[j-1];
			a[j-1] = k;
			j--;
		}
		
		for(int j = 0;j < n;j++){
			if(j > 0)cout << " ";
			cout << a[j];
		}cout << endl;
	}	
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define Would
#define you
#define please

int main() {
	//おまじない
	cin.tie(0);
	ios::sync_with_stdio(false);
	

	int N, a[10000];
	cin >> N;
	int kaisuu = 0;
	rep(i, N) {
		int a;
		cin >> a;
		while (a % 2 == 0) {
			a /= 2;
			kaisuu++;
		}
	}
	
	cout << kaisuu << "\n";

	Would you please return 0;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a,b,c,d=0;
  cin >> a >> b >> c;
  for(int i=0; i<=b-a; i++){
    if(c%(a+i) == 0) d++;
  }
  cout << d << "\n";
  return 0;
}


Measured memory_bytes: 3104
//Author: Rahul Purohit

#include<bits/stdc++.h>
#define vi vector<int>
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define ll  long long int
#define pi pair<ll,ll>
#define f first
#define mp make_pair
#define mod 1000000007
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
int gcd(int a, int b)
{
	if(b==0)
		return a;
	else
		return (b,a%b);
}
/*ll isp[N]={1};
void sieve(int n)
{
	isp[0]=isp[1]=0;
	for(int i=2;i<=n;i++)
	{
		if(isp[i]==1)
		{
			for(int j=i*i;j<=n;j+=i)
			{
				isp[j]==0;
			}
		}
	}
}*/
ll pow(int x,int  y,int m)
{
	ll ans=1;
	while(y!=0)
	{
		if(y%2==1)
		{
			ans=(ans*x)%m;
		}
		x=(x*x)%m;
		y/=2;
	}
	return ans;
}
template <class x>
void swap(x &a,x &b)
{
	x tp;
	tp=a;
	a=b;
	b=tp;
}
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll x,a;
	cin>>x>>a;
	if(x<a)
	{
	    cout<<"0\n";
	}
	else
	{
	    cout<<"10\n";
	}
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

using namespace std;

int N, D, X, ans;
int A[105];

int main(void) {
    scanf("%d", &N);
    scanf("%d %d", &D, &X);
    REP(i, 0, N) scanf("%d", &A[i]);
    
    REP (i, 0, N) {
      int j = 1;
      while(j <= D) {ans++; j += A[i];}
    }
    
    printf("%d\n", X+ans);
   
    
    

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll DP[105][105][500];

int main() {
  ll N, W;
  cin>>N>>W;
  ll w[N], v[N];
  vector<ll> varr(N);
  for(int i=0;i<N;++i) {
    cin>>w[i]>>v[i];
    varr[i] = v[i];
  }
  sort(varr.begin(), varr.end(), greater<ll>());
  ll tmpW;
  ll ans = 0;
  ll tmpans;
  for(ll i=1;i<=N;++i){
    tmpW = W - w[0]*i;
    if(tmpW<0) continue;
    if(tmpW>=3*i){
      tmpans = 0;
      for(int j=0;j<i;++j){
        tmpans += varr[j];
      }
      ans = max(ans, tmpans);
      continue;
    }
    for(int j=0;j<N;++j){
      for(int k=0;k<=i;++k){
        for(int l=0;l<=tmpW;++l){
          DP[j][k][l] = 0;
        }
      }
    }
    for(int k=1;k<=i;++k){
      for(int l=0;l<=tmpW;++l){
        DP[0][k][l] = v[0];
      }
    }
    for(int j=1;j<N;++j){
      for(int k=1;k<=i;++k){
        for(int l=0;l<=tmpW;++l){
          if(w[j]-w[0]>l) {
            DP[j][k][l] = DP[j-1][k][l];
          }
          else{
            DP[j][k][l] = max(DP[j-1][k][l], DP[j-1][k-1][l-w[j]+w[0]] + v[j]);
          }
        }
      }
    }
    /**
    for(int j=0;j<N;++j){
      for(int k=0;k<=i;++k){
        for(int l=0;l<=tmpW;++l){
          cout<<DP[j][k][l]<<" ";
        }
        cout<<endl;
      }
      cout<<endl;
    }
    **/
    ans = max(ans, DP[N-1][i][tmpW]);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 42576
n,y=map(int,input().split())
a=0
for i in range(n+1):
    for j in range(n-i+1):
        k=n-(i+j)
        if 10000*i + 5000*j + 1000*k == y:
            a+=1
        else:
            pass
        if a == 1:
            print(i,j,k)
            break
        else:
            pass
    if a >= 1:
        break
if a ==0:
    print(-1, -1, -1)
else:
    pass


Measured memory_bytes: 3060
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
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
from bisect import bisect, bisect_left
import heapq
import numpy as np

def input(): return sys.stdin.readline().strip()
def INt(): return int(input())
def MAP(): return map(int, input().split())
def LISt(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	s = input()
	t = input()
	if len(set(s)&set(t)) != len(set(t)):
		print(-1)
		exit()

	dic = defaultdict(list)
	for i, char in enumerate(s):  # 文字列が出現する位置のリスト
		dic[char].append(i)
	
	loop = 0
	index = -1
	for i in range(len(t)):
		if len(dic[t[i]]) == 0:
			print(-1)
			exit()
		idx = bisect_left(dic[t[i]], index)  # リストの何個目とヒットするか
		if idx != len(dic[t[i]]):
			index = dic[t[i]][idx] + 1
		else:  # idx = |dic[t[i]]| -> もうヒットする箇所がないので次のループ
			loop += 1
			index = -1
			idx = bisect_left(dic[t[i]], index)
			index = dic[t[i]][idx] + 1

	print(len(s)*loop+index)

if __name__ == '__main__':
	main()


Measured memory_bytes: 23824
#![allow(non_snake_case)]

#[allow(unused_macros)]
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input!{
        x1: isize,
        y1: isize,
        x2: isize,
        y2: isize,

    }
    let x3 = x2 + y1 - y2;
    let y3 = y2 + x2 - x1;
    let x4 = x3 + y2 - y3;
    let y4 = y3 + x3 - x2;

    println!("{} {} {} {}", x3, y3, x4, y4);
}


Measured memory_bytes: 4352
s = int(input())
lst = [0,0,1]
num = 10**9 + 7
if s>= 4:
  for i in range(4,s+1):
    ans = (lst[i-2] + lst[i-4])%num
    lst.append(ans)
  print(lst[-1]%num)
if s == 3:
  print(1)
if (s == 1) or (s == 2):
  print(0)

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

int main(int argc, char *argv[])
{
  int a, b, c;
  cin >> a >> b >> c;
  if(a < b && b < c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll N;
    cin >> N;
    using t = tuple<int,int,int>;
    vector<t> V;
    rep(i,N) {
        int a, b, c;
        cin >> a >> b >> c;
        V.push_back(make_tuple(a,b,c));
    }
    sort(V.begin(), V.end(), [](const t &left, const t &right){return get<2>(left) > get<2>(right);});
    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            t D = V[0]; 
            int H = get<2>(D) + abs(cx - get<0>(D)) + abs(cy - get<1>(D));
            bool found = true;
            for (int i = 1; i < N; i++) {
                t D = V[i];
                int x = get<0>(D), y = get<1>(D), h = get<2>(D);
                if (h != max(H - abs(cx - x) - abs(cy - y), 0)) {
                    found = false;
                    break;
                }
            }
            if (found) {
                printf("%d %d %d\n", cx, cy, H);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
n = int(input())

A = [[0] * n for i in range(n)]
c = 1

def d(L, c):
    ln = len(L)
    if ln >= 2:
        for i in L[:ln//2]:
            for j in L[ln//2:]:
                A[i][j] = c
                A[j][i] = c
        d(L[:ln//2], c+1)
        d(L[ln//2:], c+1)

d(range(n), c)

for i in range(n):
    print(*A[i][i+1:])

Measured memory_bytes: 48220
#include <iostream>

using namespace std;

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

	int s = 0;
	bool f = false;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;

		if (a == b) {
			s++;
		}
		else {
			s = 0;
		}
		if (s >= 3) {
			f = true;
		}
	}
	cout << (f ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 3628
// in the name of Allah

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define pb push_back
#define ll long long
#define double long double
#define sz(x) ((int) (x.size()))

#define fr first
#define se second

const ll mod = 1000000007;

inline ll add(ll a, ll b) {
	a += b;
	if(a >= mod) return a - mod;
	return a;
}

inline ll mul(ll a, ll b) {
	a *= b;
	if(a >= mod) return a % mod;
	return a;
}

inline ll power(ll a, ll b) {
	ll p = 1;
	while(b) {
		if(b&1) p = mul(p, a);
		a = mul(a, a);
		b /= 2;
	}
	return p;
}

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

	ll l, r;
	cin >> l >> r;
	ll res = 1e18;
	for(ll i=l; i<=min(r, l+2020); i++) {
		for(ll j=i+1; j<=min(r, l+2020); j++) {
			res = min(res, (i*j)%2019);
		}
	}
	cout << res << endl;

	return 0;
}

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

int main(void){
    int N,K;
    string S;
    cin>>N>>S>>K;
    for(int i=0;i<N;i++){
        if(S.at(i)==S.at(K-1)) cout<<S.at(i);
        else cout<<"*";
        if(i==N-1) cout<<endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    int N, W;
    long long w, v;
    scanf("%d%d", &N, &W);
    vector<long long> wt(N), vl(N);
    for (int i = 0; i < N; ++i) {
        scanf("%lld%lld", &w, &v);
        wt[i] = w;
        vl[i] = v;
    }
    vector<long long> dp(W+1, 0);
    for (int i = 0; i < N; ++i) {
        for (int j = W; j >= wt[i]; --j) {
                dp[j] = max(dp[j], dp[j - wt[i]] + vl[i]); 
        }
    }
    cout << dp[W];
}

Measured memory_bytes: 1024
list = [int(i) for i in input().split(" ")]
sum = 0
if list[0] < list[3]:
    sum = list[0]
    if list[0] + list[1] < list[3]:
        minus = list[3] - list[1] - list[0]
        sum = sum - minus
else:
    sum = list[3]
print(sum)

Measured memory_bytes: 9188
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n; cin >> n;
	vector<int> h(n);

	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		bool f = true;
		for (int j = 0; j < i; j++) {
			if (h[i] < h[j])f = false;
		}
		if (f)ans++;
	}

	cout << ans << endl;


}

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

int main(){
    int n,k,x,y,sum;
    cin >> n >> k >> x >> y;
    for(int i=0;i<n;i++){
        if(i<k){
            sum += x;
        }else{
            sum += y;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  string s,t; cin >> s >> t;
  int ans = INF;
  rep(i,s.size()-t.size()+1){
    int res = 0;
    rep(j,t.size()){
      if(s[i+j] != t[j]) res++;
    }
    chmin(ans,res);
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			long[,,] dp = new long[2, n, n];
			for (int j = 0; j < n; j++) {
				for (int i = 0; i < n - j; i++) {
					if (j == 0) {
						dp[0, i, i] = a[i];
					} else if (j == 1) {
						dp[0, i, i + j] = dp[0, i, i] + dp[0, i + j, i + j]; // size
						dp[1, i, i + j] = dp[0, i, i] + dp[0, i + j, i + j]; // cost
					} else {
						int l = i, r = i + j;
						long size = 0, cost = long.MaxValue;
						//System.Diagnostics.Debug.WriteLine($"{i}-{i + j}");
						for (int m = l; m < r; m++) {
							long tmp = dp[0, l, m] + dp[0, m + 1, r] + dp[1, l, m] + dp[1, m + 1, r];
							if (cost > tmp) {
								size = dp[0, l, m] + dp[0, m + 1, r];
								cost = tmp;
							}
							//System.Diagnostics.Debug.WriteLine($"  dp[x,{l},{m}]=({dp[0, l, m]},{dp[1, l, m]}) + dp[x,{m + 1},{r}]=({dp[0, m + 1, r]},{dp[1, m + 1, r]}) = ({dp[0, l, m] + dp[0, m + 1, r]},{dp[1, l, m] + dp[1, m + 1, r]})");
						}
						dp[0, i, i + j] = size;
						dp[1, i, i + j] = cost;
						//System.Diagnostics.Debug.WriteLine($"{size} {cost}");
					}
				}
			}
			//for (int j = 0; j < n; j++) {
			//	for (int i = 0; i < n; i++) {
			//		System.Diagnostics.Debug.Write($"({dp[0, i, j],2},{dp[1, i, j],2}) ");
			//	}
			//	System.Diagnostics.Debug.WriteLine($"");
			//}
			Console.WriteLine(dp[1, 0, n - 1]);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 15584
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

map<string, int> id;
int n, m, l[100], r[100];

int main(){
	string s;
	cin >> n;
	rep(i, n){
		cin >> s >> l[i] >> r[i];
		id[s] = i;
	}
	cin >> m;
	vector<vector<bool> >st;
	while(m--){
		cin >> s;
		if(id.count(s)){
			vector<bool> v(256);
			for(int i = l[id[s]]; i <= r[id[s]]; i++) v[i] = 1;
			st.pb(v);
		}
		else if(s == "+" || s == "-" || s == "*" || s == "/"){
			vector<bool> a, b, v(256);
			b = st.back(); st.pop_back();
			a = st.back(); st.pop_back();
			rep(i, 256) if(a[i]) rep(j, 256) if(b[j]){
				if(s == "+") v[(i + j) % 256] = 1;
				else if(s == "-") v[(i - j + 256) % 256] = 1;
				else if(s == "*") v[i * j % 256] = 1;
				else{
					if(j == 0){
						cout << "error" << endl;
						return 0;
					}
					v[i / j] = 1;
				}
			}
			st.pb(v);
		}
		else{
			vector<bool> v(256);
			int i;
			sscanf(s.c_str(), "%d", &i);
			v[i] = 1;
			st.pb(v);
		}
	}
	cout << "correct" << endl;
	return 0;
}

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

int main() {
int N,A,B,S;
  S=0;
  cin>>N;
  rep(i,N){
  cin>>A>>B;
  S+=B-A+1;
  }
  cout<<S<<endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n),b(n),c(n-1);
  for (int i=0;i<n;i++) {
    cin>>a.at(i);
  }
  for (int i=0;i<n;i++) {
    cin>>b.at(i);
  }
  for (int i=0;i<n-1;i++) {
    cin>>c.at(i);
  }
  int p=0;
  for (int x:b) {
    p+=x;
  }
  for (int i=0;i<n-1;i++) {
    if (a.at(i)+1==a.at(i+1)) {
      p+=c.at(a.at(i)-1);
    }
  }
  cout<<p<<endl;
}

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

int main(){
    ll a, b; cin >> a >> b;
    for(int i = 1; i < 10000; i++){
        if((i * 8 / 100 )== a && (i / 10) == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

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

int main()
{
    string s;
    cin >> s;

    auto sgn = [](int i) {
        if (i == 0)
            return '+';
        else
            return '-';
    };

    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                int sum = (s[0] - '0') + (-2 * i + 1) * (s[1] - '0') +
                          (-2 * j + 1) * (s[2] - '0') +
                          (-2 * k + 1) * (s[3] - '0');
                if (sum == 7) {
                    cout << s[0] << sgn(i) << s[1] << sgn(j) << s[2] << sgn(k)
                         << s[3] << "=7" << endl;
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 256