akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define ll long long
#define MAXN 3010

using namespace std;

const int mod = 1e9 + 7;
int dp[MAXN], pre[MAXN];

int add(int x, int y) {

    x += y;
    return (x >= mod ? x - mod : x);
}

int sub(int x, int y) {

    x -= y;
    return (x < 0 ? x + mod : x);
}

int main() {

    int n;
    cin >> n;
    
    string s;
    cin >> s;
    s = "  " + s;

    dp[1] = 1;
    for(int i = 2; i <= n; i++) {
        for(int j = 1; j < i; j++)
            pre[j] = add(pre[j - 1], dp[j]);
        for(int j = 1; j <= i; j++) {
            if(s[i] == '<')
                dp[j] = pre[j - 1];
            else
                dp[j] = sub(pre[i - 1], pre[j - 1]);
        }
    }
    
    int sol = 0;
    for(int i = 1; i <= n; i++)
        sol = add(sol, dp[i]);
    
    cout << sol << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long 
 
int32_t main () {
    int p, k; cin >> p >> k;
    int m = INT_MIN;
    int a[k];
    for (int i = 0; i < k; i++) {
        cin >> a[i];
    }
    int count = 0;
    for (int i = 1; i < k; i++) {
        int x = abs(a[i] - a[i - 1]);
        count += x;
        if (x > m) {
            m = x;
        }
    }
    cout << min(count,p - m) << endl;
}

Measured memory_bytes: 1792
import numpy as np
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
N, M = map(int, input().split(' '))
if N > M:
    print('safe')
else:
    print('unsafe')


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    string w, s;
    cin >> w;
    transform(w.begin(), w.end(), w.begin(), ::tolower);
    int res = 0;
    while (cin >> s)
    {
        transform(s.begin(), s.end(), s.begin(), ::tolower);
        if (s == w)
            res++;
    }
    cout << res << endl;
}



Measured memory_bytes: 3196
import sys
input = sys.stdin.readline
 
class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
n,q = list(map(int,input().split()))
ball = list(map(int,input().split()))
 
h = Bit(n+1)

L = {}
jump = {}
on = set()

for i,b in enumerate(ball):
  if b not in L:
    h.add(i+1,1)
    on.add(i+1)
  if b in L:
    jump[L[b]]=i+1
  L[b] = i+1

Q = []
 
for _ in range(q):
  l,r = list(map(int,input().split()))
  Q.append((l,r))
  
LOO = list(Q)
Q.sort(key=lambda x:x[0])

c = 1
ans = {}

for l,r in Q:
  for i in range(c,l):
    if i in on:
      on.remove(i)
      h.add(i,-1)
      if i in jump:
        dest = jump[i]
        h.add(dest,1)
        on.add(dest)

  tmp = h.sum(r)- h.sum(l-1)
  ans[(l,r)] = tmp
  c = l

p = []
for q in LOO:
  p.append(ans[q])
  
print(*p, sep="\n")

Measured memory_bytes: 277868
#include <iostream>
#include <math.h>
using namespace std;

int main() {
  long long n,d;
  cin>>n>>d;
  long long x,y;
  long long ans=0;
  for (int i=1;i<=n;i++){
    cin>>x>>y;
    double dis;
    dis=sqrt(abs(x*x)+abs(y*y));
    if (dis<=d) ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =998244353;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    


  int main(){
     lint n,k;
     cin>>n>>k;
     lint p[n];
     rep(i,n)cin>>p[i];
     sort(p,p+n);
     lint ans=0;
     rep(i,k)ans+=p[i];
     cout<<ans<<endl;
      
     }
     

  
 
  
      
      
    
 
  
          
  

Measured memory_bytes: 3660
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int func(vector<int> num){
  if(num.size()==1) return num[0];
  vector<int> temp;
  REP(i,num.size()-1){
    temp.push_back((num[i]+num[i+1])%10);
  }
  return func(temp);
}

int main(void){
  string line;
  while(cin>>line){
    vector<int> num;
    REP(i,10){
      num.push_back(line[i]-'0');
    }
    int ret = func(num);
    cout<<ret<<endl;
  }
  return 0;
}

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define REPRl(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < (int)n; i++)
#define FORl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define ALL(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}

int main() {
  int a,b,tt;cin>>a>>b>>tt;
  double t=tt+0.5;
  int c=(int)(t/a);
  cout << c*b << endl;
}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()
import fractions
gcd=fractions.gcd
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0
k,x=LI()
if k*500>=x:
    ans='Yes'
else:
    ans='No'

print(ans)



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

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }

        
         public static long gcd(long x, long y)
        {
            if (x < y) gcd(y, x);
            while (y != 0)
            {
                var z = x;
                x = y;
                y = z % y;
            }
            return x;
        }

        public static long lcm(long x, long y)
        {
            return x * y / gcd(x, y);
        } 

        public static long C(long n, long k)
        {
            long x = 1;
            for (long i = 1; i <= k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            long ans = 0;
            var a = new long[n];
            var b = new long[n];
            for (int i = 0; i <n ; i++)
            {
                var q = Reads();
                a[i] = q[0];
                b[i] = q[1];
            }
            for (long i = n-1; i > 0; i--)
            { 
                if (a[i] % b[i] != 0)
                    ans += b[i] - a[i] % b[i];
                a[i - 1] += ans;
            }
           
            if (a[0] % b[0] != 0)
                ans += b[0] - a[0] % b[0];
            WriteLine(ans);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 24164
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,e;
    cin>>a>>b>>c;
    e=a*b;
    if(e>c)
    {
        cout<<c;
    }
    else if(e<=c)
    {
        cout<<e;
    }
    return 0;
}


Measured memory_bytes: 256
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    x_s, y_s, x_t, y_t = map(int, readline().split())
    A = np.array([[x_s, y_s, 0],
                  [x_t, y_t, 0]], dtype=np.int)
    
    N = int(readline())
    B = np.array(read().split(), dtype=np.int).reshape(-1, 3)
    XY, R = np.hsplit(np.concatenate((A, B)), [2])
    
    d = np.expand_dims(XY, axis=1) - np.expand_dims(XY, axis=0)
    d = np.sqrt(np.sum(np.square(d), axis=-1))
    d -= R + R.reshape(1, -1)
    d = np.maximum(d, 0)
    np.fill_diagonal(d, -1)
    d = csgraph_from_dense(d, null_value=-1)
     
    ans = dijkstra(d, indices=0)[1]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 53204
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        string S;
        cin >> S;
        ll w;
        cin >> w;
        rep(i, 0, len(S)) {
                cout << S[i];
                i += w-1;
        }
        cout << endl;
}


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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

int main() {

    int N, M;
    cin >> N >> M;

    vector<bitset<10>> ss(M, bitset<10>(0));
    int ks[M];

    rep(lindex, M) {
        cin >> ks[lindex];
        rep(sindex, ks[lindex]) {
            int s;
            cin >> s;
            ss[lindex].set(s - 1);
        }
        // cout << ss[lindex] << "c" << endl;
    }

    int ps[N];
    rep(i, N) {
        cin >> ps[i];
    }

    int count = 0;
    rep(switchOn, 1<<N) {
        // cout << switchOn << endl;
        int onNum = 0;
        rep(lindex, M) {
            bitset<10> tmp = ss[lindex] & bitset<10>(switchOn);
            if (tmp.count() % 2 == ps[lindex]) {
                onNum++;
            }
        }

        if (onNum == M) {
            count++;
        }
    }
    cout << count << endl;
}

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

int main(){
    int n;
    while(cin>>n,n){
        map<int,long long>m;
        vector<int>vec;
        long long i,p,q,s=0;
        while(n--){
            cin>>i>>p>>q;
            if(!m[i])vec.push_back(i);
            m[i]+=p*q;
        }
        for (int i=0;i<vec.size();i++){
            if(m[vec[i]]>=1000000){
                s=1;
                cout<<vec[i]<<endl;
            }
        }
        if(!s)cout<<"NA"<<endl;
    }
}

Measured memory_bytes: 1288
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static System.Console;
class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		int K = int.Parse(Console.ReadLine());
		int[,] LL = new int[1000,11]; // ルンルン数[桁数][左端の数字]

		// 初期設定
		for(int i=0; i<=9; i++)
		{
			LL[1,i] = 1; //１桁のルンルン数は1つずつ
		}

		// ルンルン数の数え上げカウンタ
		int count = 9;

		if(K<=12)
		{
			Console.WriteLine(K);
			return;
		}

		int digit = 0, left = 0;

		for(int d = 2; d<1000; d++)
		{
			// d桁のルンルン数を数えていく
			for(int l = 0; l<=9; l++)
			{
				// 左端の数字がlのルンルン数の数は・・・
				if(l==0)
				{
					LL[d,l] = LL[d-1,l] + LL[d-1,l+1];
				}
				else if(l==9)
				{
					LL[d,l] = LL[d-1,l-1] + LL[d-1,l];
					count += LL[d,l];
				}
				else
				{
					LL[d,l] = LL[d-1,l-1] + LL[d-1,l] + LL[d-1,l+1];
					count += LL[d,l];
				}
				if(count >= K)
				{
					digit = d;
					left = l;
					break;
				}
			}
			if(digit > 0 && left > 0)
				break;
		}

		// K番目のルンルン数　digit桁で左端がleftの数字を復元する
		// digit桁のleftで始まるルンルン数のx番目
		int x = K - (count - LL[digit, left]);
		//Console.WriteLine("ll " + digit + " " + left + " " + x);
		string lunlun = LunLunNumber(LL, digit, left, x);

		Console.WriteLine(lunlun);
	}

	static string LunLunNumber(int[,] LL, int d, int l, int x)
	{
		if(d == 1)
		{
			return l.ToString();
		}

		string left = l.ToString();

		if(l == 0)
		{
			if(LL[d-1,l] >= x)
			{
				//x = x;
				// l = l;
			}
			else
			{
				x = x - (LL[d-1,l]);
				l = l + 1;
			}
		}
		else if(l==9)
		{
			if(LL[d-1,l-1] >= x)
			{
				// x = x;
				l = l - 1;
			}
			else
			{
			  x -= LL[d-1,l-1];
				// l = l;
			}
		}
		else
		{
			//Console.WriteLine("xx " + LL[d-1, l-1] + " " + LL[d-1, l] + " " + LL[d-1, l+1]);
			if(LL[d-1,l-1] >= x)
			{
				// x=x;
				l = l - 1;
			}
			else if(LL[d-1,l-1] + LL[d-1,l] >= x)
			{
				x -= LL[d-1,l-1];
				// l=l;
			}
			else
			{
				x -= LL[d-1,l-1] + LL[d-1,l];
				l = l + 1;
			}
		}
    //Console.WriteLine("next " + (d-1) + " " + l + " " + x );
		return left + LunLunNumber(LL, d-1, l, x);

	}
}


Measured memory_bytes: 13216
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
	ll n;
	cin>>n;
	vector<ll> a(n);
	for(ll i=0;i<n;i++)cin>>a[i];
	ll res = 0;
	ll cnt = 0;
	for(ll i=0;i<n;i++){
		if(a[i]<0){
			cnt++;	
			a[i] = -a[i];
		}
	}
	sort(a.begin(),a.end());
	ll s =0;
	if(cnt%2==1)a[0] = -a[0];
	for(ll i=0;i<n;i++)res+=a[i];
	cout<<res<<endl;


	return 0;
}


Measured memory_bytes: 1024
import java.util.*
import Stone.*
import com.sun.org.apache.xpath.internal.WhitespaceStrippingElementMatcher

fun main(args:Array<String>):Unit {
    var n = readLine()!!.toInt()
    while (n != 0) {
        val line = Line()
        repeat(n){
            when(readLine()!!.toInt()){
                0 -> when(it % 2){
                    0 -> line.addOdd(White())
                    else -> line.addEven(White())
                }
                else -> when(it % 2){
                    0 -> line.addOdd(Black())
                    else -> line.addEven(Black())
                }
            }
        }
        println(line.stones().sumBy{when(it){
            is White -> it.length
            else -> 0
        }})
        n = readLine()!!.toInt()
    }
}
sealed class Stone(open var length:Int){
    data class White(override var length:Int = 1):Stone(length){
        operator fun plus(other:White):White = White(length + other.length)
    }
    data class Black(override var length:Int = 1):Stone(length){
        operator fun plus(other:Black):Black = Black(length + other.length)
    }
}
class Line{
    private val mDeque:Deque<Stone> = LinkedList<Stone>()
    private fun addFirst(black:Black):Unit{
        when(mDeque.size){
            0 -> mDeque.addFirst(black)
            else -> when(mDeque.first){
                is Black -> mDeque.first.length += black.length
                else -> mDeque.addFirst(black)
            }
        }
    }
    private fun addFirst(white:White):Unit{
        when(mDeque.size){
            0 -> mDeque.addFirst(white)
            else -> when(mDeque.first){
                is White -> mDeque.first.length += white.length
                else -> mDeque.addFirst(white)
            }
        }
    }
    fun addOdd(black:Black):Unit {
        addFirst(black)
    }
    fun addOdd(white:White):Unit {
        addFirst(white)
    }
    fun addEven(black:Black):Unit {
        when(mDeque.size){
            0 -> mDeque.addFirst(black)
            else ->
                when(mDeque.first){
                    is Black -> addFirst(black)
                    else -> {
                        val first = mDeque.removeFirst()
                        addFirst(Black(first.length + black.length))
                    }
                }
        }
    }
    fun addEven(white:White):Unit {
        when(mDeque.size){
            0 -> mDeque.addFirst(white)
            else ->
                when(mDeque.first){
                    is White -> addFirst(white)
                    else -> {
                        val first = mDeque.removeFirst()
                        addFirst(White(first.length + white.length))
                    }
                }
        }
    }
    fun stones():Iterable<Stone> = mDeque
}


Measured memory_bytes: 40056
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<complex>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N 500010
ll n,k,q,d[N],v[N],u[N];
int main(){
    cin>>n>>k;
    lol(i,n){
	v[i]=k;
	cin>>d[i];
	k=min(k,abs(k-d[i]));
    }
    if(k){
	cin>>q;
	while(q--){
	    cin>>n;
	    cout<<"YES"<<endl;
	}
	return 0;
    }
    k=1;
    for(int i=n-1;i>=0;i--){
	u[i]=k;
	if(k*2>d[i])k+=d[i];
    }
    //cout<<endl;
    //lol(i,n)cout<<v[i]<<" ";cout<<endl;
    //lol(i,n)cout<<u[i]<<" ";cout<<endl;
    cin>>q;
    while(q--){
	ll i;cin>>i;i--;
	cout<<(v[i]>=u[i]?"YES":"NO")<<endl;
    }
    return 0;
}


Measured memory_bytes: 13696
#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::vector;



int main(int argc, char* argv[])
{
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N;
  cin >> N;

  vector<int> a(N);
  int sum = 0;
  for (auto& ai : a)
  {
    cin >> ai;
    sum += ai;
    ai *= N;
  }

  int res = 0;
  for (int t = 0; t < N; ++t)
  {
    if (std::abs(a[t] - sum) < std::abs(a[res] - sum)) res = t;
  }
  cout << res << "\n";

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		String S = stdIn.next();
	    if(A >= 3200){
	    	System.out.println(S);
	    }
	    else{
	    	System.out.println("red");
	    }
		stdIn.close();
	}
}


Measured memory_bytes: 35700
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        String W, T;
        int count=0;
        
        W = sc.next();
        while(true)
        {
            T = sc.next();
            if(T.equals("END_OF_TEXT")) break;
            
            T = T.toLowerCase();

            String[] sT = T.split(" ");

            for(int i=0; i<sT.length; i++)
            {
                if(sT[i].equals(W)) count++;
            }
        }

        System.out.println(count);
        sc.close();
    }
}


Measured memory_bytes: 26128
x=int(input())

if 400<=x and x<=599:
    ans=8
elif 600<= x and x<=799:
    ans=7
elif 800<= x and x<=999:
    ans=6
elif 1000<= x and x<=1199:
    ans=5
elif 1200<= x and x<=1399:
    ans=4
elif 1400<= x and x<=1599:
    ans=3
elif 1600<= x and x<=1799:
    ans=2
else:
    ans=1

print(ans)

Measured memory_bytes: 9188
#include<bits/stdc++.h>
int main()
{
	std::string s;
	std::cin>>s;
	bool check=true;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='U' or s[i]=='D')
		continue;
		else
		{
		if(i%2==0)
		{
			if(s[i]!='R')
			check=false;
		}
		else
		{
			if(s[i]!='L')
			check=false;
		}
		}
	}
	if(check==true)
	std::cout<<"Yes\n";
	else
	std::cout<<"No\n";
}

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

using namespace std;

int main(){
  int n;
  cin>>n;
  char s[n];
  scanf("%s",s);
  int count=0;
  for(int i=0;i<n;i++){
    if(s[i]!=s[i+1])  count++;
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;
//abc165a

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int k,a,b;
    cin>>k>>a>>b;
    bool ok=0;
    for(int i=a;i<=b;i++){
        if(i%k==0) ok=1;
    }
    if(ok) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え(=でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

Measured memory_bytes: 3652
#include <iostream>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <unordered_map>
#include <random>
#include <queue>
#include <iomanip>

#define BIG 1000000007
#define LLMAX 9223372036854775807
#define LLMIN (-9223372036854775808)
#define long long long

using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    vector<long> dp(n + 1,0);
    vector<bool> bpos(n + 1,false);
    for(int i = 0;i < m;++i){
        int c;
        cin >> c;
        bpos[c] = true;
    }
    dp[0] = 1;
    for(int i = 0;i < n - 1;++i){
        if(!bpos[i + 1]){
            dp[i + 1] += dp[i];
            dp[i + 1] %= BIG;
        }
        if(!bpos[i + 2]){
            dp[i + 2] += dp[i];
            dp[i + 2] %= BIG;
        }
    }

    dp[n] += dp[n - 1];
    dp[n] %= BIG;

    cout << dp[n] << endl;
}




Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int W, H, N;

int main() {
    cin >> W >> H >> N;
    int x0 = 0, x1 = W, y0 = 0, y1 = H;
    for (int i = 0; i < N; i++) {
        int x, y, a;
        cin >> x >> y >> a;
        if(a==1)
            x0 = max(x, x0);
        else if(a==2)
            x1 = min(x, x1);
        else if(a==3)
            y0 = max(y, y0);
        else
            y1 = min(y, y1);
    }
    cout << max(x1 - x0, 0) * max(y1 - y0, 0) << endl;   
    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
long long s[100009],t[100009];

int main(){
  long long N,K;
  cin >> N >> K;
  vector<long long> a(N);
  for(int i=0;i<N;i++)cin >> a[i];
  long long sum=0,q=100000000000000000,r=0,z=0;
  for(int i=0;i<N;i++){if(a[i]>0)sum+=a[i];}
  for(int i=0;i<N;i++){s[i+1]+=s[i]+a[i]; t[i+1]+=t[i]+max(a[i],z);}
  for(int i=0;i+K<=N;i++){
    long long x=t[i+K]-t[i],c=s[i+K]-s[i];
    if(x-max(c,z)<q){q=x-max(c,z);}
  }
  cout << sum-q << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(void){
  long long I, O, T, J, L, S, Z;
  cin >> I >> O >> T >> J >> L >> S >> Z;
  long long ans = 0;
  if(I > 0 && J > 0 && L > 0 && I % 2 + J % 2 + L % 2 >= 2){
    ans += 3;
    I--;
    L--;
    J--;
  }
  ans += 2 * (I / 2);
  ans += 2 * (J / 2);
  ans += 2 * (L / 2);
  ans += O;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long int ll ;
long long int power(long long int a,long long int n,long long int m) ;
 long long int power(long long int a,long long int n,long long int m)
{  if(n==0)
   return 1 ;
   long long int x=power(a,n/2,m) ;
   if(n%2!=0)
    return (((a*x)%m)*(x)%m)%m ;
    else return (x*x)%m ;
}



int main()
{ long long int n,i,j,x,y,m,k,t,sum,count,cnt,b,c,d,j1,z,a,o;
   cin>>a>>b>>c>>d ;
    for(i=0;i<10000;i++)
    {
        if(a<=0||c<=0)
            break ;
        if(i%2==0)
            c=c-b ;
        else a=a-d ;
    }
     if(a<=0)
        cout<<"No\n" ;
     else cout<<"Yes\n" ;
     return 0; }


Measured memory_bytes: 3600
def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
l=[0]
ii=0
for i in range(1,11):
    ii+=i
    l.append(ii)

n=int(input())
import collections
c=collections.Counter(prime_factorize(n))
count=0
for i in c.values():
    for j in range(10):
        if i>=l[j] and i<l[j+1]:
            count+=j
print(count)

Measured memory_bytes: 9468
fn echo() -> Result<&'static str, &'static str> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input)
        .map_err(|_| "read error")?;
    let n = input.trim_right().parse::<usize>()
        .map_err(|_| "parse error")?;
    let mut input = String::new();
    std::io::stdin().read_line(&mut input)
        .map_err(|_| "read error")?;

    if n % 2 != 0 {
        return Ok("No");
    }

    let mut head = input.chars().take(n / 2);
    let mut tail = input.chars().skip(n / 2);

    for (h, t) in head.zip(tail) {
        if h != t {
            return Ok("No");
        }
    }
    Ok("Yes")
}

fn main() {
    println!("{}", echo().unwrap());
}

Measured memory_bytes: 4352
n = int(input())
x = list(map(int,input().split()))
ave = sum(x) // len(x)
ans_list = []
ans_list2 = []
for i in x:
    ans = (i - ave)**2
    ans_list.append(ans)
ans1 = sum(ans_list)

ave2 = ave + 1
for i in x:
    ans = (i - ave2)**2
    ans_list2.append(ans)
ans2 = sum(ans_list2)
if ans1 < ans2:
    print(ans1)
else:
    print(ans2)

Measured memory_bytes: 9068
n, k = gets.split.map(&:to_i)
ans = 0
(1..n).each do |i|
  st = 1.to_f / n
  now = i
  loop do
    if now >= k
      break
    else
      now *= 2
      st /= 2
    end
  end
  ans += st
end

puts ans

Measured memory_bytes: 1788
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


struct Point{
    int x, y;
    Point(): x(0), y(0){}
    Point(int x, int y) : x(x), y(y){}
    
    bool operator == (const Point &p) const{
        return (x==p.x) && (y==p.y);
    }
};


int main(){
    int N; std::cin >> N;
    // info[i][j]: i人目が正直の時 j人目は (-1:不明 1:正直 0:不親切)
    std::vector<std::vector<int>> info(N, std::vector<int>(N, -1));
    {
        int a, x, y;
        for(int i(0); i < N; ++i){
            info[i][i] = 1;
            std::cin >> a;
            for(int j(0); j < a; ++j){
                std::cin >> x >> y;
                info[i][x-1] = y;
            }
        }
    }

    int ans(0);
    {
        int honest;
        for(int i(0), i_len(1<<N); i < i_len; ++i){
            std::vector<int> fact(N);
            honest = 0;
            for(int j(0); j < N; ++j){
                fact[j] = ((i >> j) & 1);
                if(fact[j]) ++honest;
            }

            bool okay(true);
            for(int j(0); j < N; ++j){
                if(!fact[j]) continue;
                for(int k(0); k < N; ++k){
                    if(info[j][k] != -1 && info[j][k] != fact[k]){
                        okay = false;
                    }
                }
            }
            if(okay) chmax(ans, honest);
        }
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
import qualified Control.Monad as Monad
import qualified Data.ByteString.Char8 as BS
import qualified Data.Maybe as Maybe
import qualified Debug.Trace as Trace

solve :: String -> Int
solve s =
    case s of
    "SUN" -> 7
    "MON" -> 6
    "TUE" -> 5
    "WED" -> 4
    "THU" -> 3
    "FRI" -> 2
    _ -> 1

main = do
    s <- getLine
    let ans = solve s
    print ans

Measured memory_bytes: 3672
using System;
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int a, b;
            a = int.Parse(s[0]);
            b = int.Parse(s[1]);
            if (a == b)
                Console.WriteLine("a == b");
            if (a > b)
                Console.WriteLine("a > b");
            if (b > a)
                Console.WriteLine("a < b");
        }
    }

Measured memory_bytes: 19632
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <atcoder/dsu.hpp>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const LLONG MOD = 998244353;

int main()
{
	int N, M; cin >> N >> M;
	atcoder::dsu d(N);
	REP(i, M)
	{
		int a, b; cin >> a >> b; --a; --b;
		d.merge(a, b);
	}
	cout << d.groups().size() - 1 << endl;
}


Measured memory_bytes: 9004
fun main(args:Array<String>){
    val N = readLine()!!.split(" ").map { it.toInt() }
    if(N[0] == N[1]){
        println("${N[0]}".repeat(N[0]))
    }else if(N[0] > N[1]){
        println("${N[1]}".repeat(N[0]))
    }else{
        println("${N[0]}".repeat(N[1]))
    }
}

Measured memory_bytes: 36020
#include<iostream>

using namespace std;

int main(){
	int N, a;
	bool aflag[100000];
	int num = 0;
	int extra = 0;
	cin >> N;
	for(int i = 0; i < 100000; i++){
		aflag[i] = false;
	}
	for(int i = 0; i < N; i++){
		cin >> a;
		if(aflag[a] == false){
			num++;
			aflag[a] = true;
		}else{
			extra++;
		}
	}
	cout << num - (extra % 2) << endl;
	return 0;
}

Measured memory_bytes: 512
function splitMap(input: string) {
  return input.split(' ').map(s => parseInt(s, 10))
}

function main(input: string) {
  const [o, t, ...ql] = input.split('\n')
  const [length, ac] = splitMap(o)
  const qs = ql.map(q => splitMap(q))
  
  let map = []
  let count = 0
  for (let i = 0; i < length; i++) {
	map[i] = t[i] + t[i + 1] === 'AC' ? count++ : count
  }
  
  for (i = 0; i < qs.length; i++) {
	const [s, e] = qs[i]
	console.log(map[e -1] - map[s - 1])
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8").trim())

Measured memory_bytes: 59404
package main

import (
	"fmt"
	"sort"
)

func main() {
	var (
		h, n, a int
		hissatu []int
		ok bool
	)
	fmt.Scan(&h, &n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		hissatu = append(hissatu, a)
	}

	sort.Sort(sort.Reverse(sort.IntSlice(hissatu)))

	for _, j := range hissatu {
		h -= j
		if h <= 0 {
			ok = true
		}
	}
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main() {
  int n;
  cin>>n;
  
  int d[60];
  rep(i,n){
    cin>>d[i];
  }
  
  ll umee;

  
  rep(j,n){
    for(int k=j+1;k<n;k++)
    umee+=d[j]*d[k];
  }
  
  cout<<umee<<endl;
	
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef pair<ld, ld> pdd;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = (int)2e5 + 9;
const int MOD = (int)1e9 + 7;

vector<int> T[N];

int powr(int n, int k){ 
  if(k == 0) return 1;
  int p = powr(n,k/2);
  p = (p * 1ll * p) % MOD;
  if(k % 2 == 1) p = (p * 1ll * n) % MOD;
  return p;
}

int subt[N];
int pwr[N];

int n;
int ans = 0;

int add(int a, int b){
  a += b;
  a %= MOD;
  if(a < 0) a += MOD;
  return a;
}

int dp[N][3];

void dfs(int u, int par){
  subt[u]=1;
  vector<int> ss;
  for(auto x : T[u]){
    if(x == par) continue;
    dfs(x, u);
    ss.push_back(subt[x]);
    subt[u] += subt[x];
  }
  if(par != -1)ss.push_back(n - subt[u]);
  int m = ss.size();
  for(int i = 0 ; i <= m ; i ++ ){
    for(int j = 0 ; j < 3; j ++ ){
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;
  int nx;
  for(int i = 0; i < m ; i ++ ){
    for(int j = 0 ; j < 3; j ++ ){
      nx = dp[i][j];
      if(j == 2){
        nx = (nx * 1ll * pwr[ss[i]]) % MOD;
      }
      dp[i + 1][j] = add(dp[i + 1][j], nx);
      if(j < 2){
        nx = (dp[i][j] * 1ll * (pwr[ss[i]] - 1)) % MOD;
        dp[i + 1][j + 1] = add(dp[i + 1][j + 1], nx);
      }
    }
  }
  ans = add(ans, (dp[m][2] * 1ll * powr(pwr[n], MOD-2)) % MOD);
}

int main(){
  fastIO;
  pwr[0] = 1;
  for(int i = 1; i < N ; i ++ ){
    pwr[i] = (pwr[i-1] * 2ll) % MOD;
  }
  cin >> n;
  int u, v;
  for(int i = 1; i < n; i ++ ){
    cin >> u >> v;
    T[u].push_back(v);
    T[v].push_back(u);
  }
  dfs(1,-1);
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 28928
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  int cnt = 0;
  for(int i = 0;i<n-2;i++){
    if(s[i]=='A'){
      if(s[i+1]=='B'){
        if(s[i+2]=='C')cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;
const long long INFL = 1000000000000000018ll;

int N, K, a[110];
bool dp[200100];

signed main()
{
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= K; i++){
        for(int j = 0; j < N; j++){
            if(i >= a[j]){
                dp[i] |= !dp[i - a[j]];
            }
        }
    }
    if(dp[K])printf("First\n");
    else printf("Second\n");

    return 0;
}
/*



*/



Measured memory_bytes: 384
import java.io.*;
import java.util.*;
import java.awt.Point;
public class Main {
	static Scanner sc;
	static PrintWriter out;
	static long[][]memo;
	static int s,n;
	static Point[]a;
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		sc = new Scanner(System.in); 
		out = new PrintWriter(System.out);
		n = sc.nextInt();
		s = sc.nextInt();
		a = new Point[n];
		for(int i=0;i<n;i++)
			a[i] = new Point(sc.nextInt(),sc.nextInt());
		
		memo = new long[n][s+1];
		clear();
		out.println(dp(0, 0));
		out.flush();
		out.close();
	}
	static final int uncal = -1;
	static void clear() {
		for(long[]b:memo)
			Arrays.fill(b, uncal);		
	}
	static final long inf = Long.MIN_VALUE;
	static long dp(int i,int weight) {
		if(weight>s)
			return inf;
		if(i == n) return 0;
		if(memo[i][weight] != uncal)
			return memo[i][weight];
		Point item = a[i];
		int w = item.x;
		int v = item.y;
		long take = v+dp(i+1, weight+w);
		long leave = dp(i+1, weight);
		return memo[i][weight] = Math.max(take, leave);
	}
	static boolean isPalindrome(String s) {
		int l = s.length();
		char[] sa = s.toCharArray();
		for(int i=0;i<l/2;i++) {
			if(sa[i] != sa[l-i-1])
				return false;
		}
		return true;
	}

	static String reverse(String s) {
		int i = s.length();
		StringBuilder sb = new StringBuilder();
		while(i-->0) {
			sb.append(s.charAt(i));
		}
		return sb.toString();
	}
	static void merge(StringBuilder sb,Stack<Character> stack) {
		while(!stack.isEmpty())
			sb.append(stack.pop());		
	}
	static String max(String s,String s2) {
		if(s2.length() > s.length())
			return s2;
		return s;
	}

	static class Point extends java.awt.Point implements Comparable<Point>{
		public Point(int x,int y) {
			// TODO Auto-generated constructor stub
			super(x,y);
		}
		public String toString() {
			return x+" "+y;
		}
		@Override
		public int compareTo(Point p) {
			// TODO Auto-generated method stub
			if(x == p.x)
				return y - p.y;
			return x - p.x;
		}
		
	}
	static class Scanner{
		private BufferedReader br;
		private StringTokenizer st;
		public Scanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		public String next() throws IOException{
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException{
			return Long.parseLong(next());
		}
		public double nextDouble() throws IOException{
			return Double.parseDouble(next());
		}
		public int[] inArr(int n) throws Exception{
			int a [] = new int[n];
			st = new StringTokenizer(br.readLine());
			for(int i=0;i<n;i++) {
				a[i] = Integer.parseInt(st.nextToken());
			}
			return a;
		}
	}

}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int h[n];
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    int res = 0;
    int max = 0;
    for(int i=0; i<n; i++){
        if(h[i] >= max){
            max = h[i];
            res ++;
        }
    }

    cout << res <<endl;

    return 0;
}

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

using namespace std;


int main()
{
    string a;


    cin>>a;

    for(int i=0;i<sizeof(a);i++)
    {
        if(a[i]=='7')
        {
            cout<<"Yes"<<endl;return 0;
        }
    }

    cout<<"No"<<endl;


    return 0;

}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 500005;
const int mod = 998244353;

int n, m, ans, fac[N], inv[N];

inline int C(int x, int y) {
  if (x < 0 || y < 0 || x < y) {
    return 0;
  }
  return 1LL * fac[x] * inv[y] % mod * inv[x - y] % mod;
}

int main() {
  scanf("%d%d",&n,&m);
  fac[0] = fac[1] = inv[0] = inv[1] = 1;
  for (int i = 2; i <= m; ++i) {
    fac[i] = 1LL * fac[i - 1] * i % mod;
    inv[i] = 1LL * (mod - mod / i) * inv[mod % i] % mod;
  }
  for (int i = 2; i <= m; ++i) {
    inv[i] = 1LL * inv[i - 1] * inv[i] % mod;
  }
  for (int i = n; i <= m; ++i) {
    ans = (ans + C(m, i)) % mod;
    ans = (ans - C(m, i * 2 - n + 1) + mod) % mod;
  }
  printf("%d\n", ans);
  return 0;
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true; } return false; }

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int A, B;
    cin >> A >> B;

    int sum = A + B;
    int dif = A - B;
    int mul = A * B;
    int ans = max(sum, max(dif, mul));
    cout << ans << endl;

    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)
#define Rep(i, n) for(i = 1; i < n; i++)
#define Ans(s) cout << s << endl;

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

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

	int ans = 1;
	int max_ = 0;

	for (int i = 1; i <= n; i++)
	{
		int cnt = 0;
		int tmp = i;

		while (tmp > 0)
		{
			if (tmp % 2 == 0)
			{
				cnt++;
				tmp /= 2;
			}
			else break;
		}

		if (max_ < cnt)
		{
			max_ = cnt;
			ans = i;
		}
	}
	cout << ans << endl;
}


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

int a,b,c;
int x;

int main(){

    int cnt = 0;
    scanf("%d %d %d %d",&a,&b,&c,&x);
    for(int i = 0;i<=a;i++){
        for(int j = 0;j<=b;j++){
            for(int k = 0;k<=c;k++){
                if(i*500 + j*100 + k*50 == x){
                    cnt ++;
                }
            }
        }
    }

    printf("%d\n", cnt);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <bitset>
using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

const double PI=3.14159265358979323846;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REP1(i, n) for(int i = 1; i <= (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define ZERO(a) memset(a, 0, sizeof(a))

#define RAD(d) (PI * (d) / 180)
#define DEG(r) (180.0 * (r) / PI)

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<class T> void dump(const vector<T> &v)
{
	REP(i, SZ(v)-1){ cout << v[i] << " "; }
	cout << v[SZ(v)-1] << endl;
}

template<class T> void dump(int w, int h, const vector<T> &v)
{
	REP(j, h){
		REP(i, w-1){ cout << v[j * w + i] << " "; }
		cout << v[j * w + w-1] << endl;
	}
}

template<class T> T accumulate(const vector<T> &v)
{
	T sum = 0;
	REP(i, SZ(v)){ sum += v[i]; }
	return sum;
}

template<class T> struct Matrix
{
	T w, h;
	vector<T> A;
	Matrix(T w_, T h_) : w(w_), h(h_), A(w * h) {}
	T get(T x, T y) const { return A[y * w + x]; }
};

template<class T> void input(Matrix<T> &m)
{
	REP(j, m.h){
		REP(i, m.w){
			cin >> m.A[j * m.w + i];
		}
	}
}

template<class T> Matrix<T> prod(const Matrix<T> &a, const Matrix<T> &b)
{
	Matrix<T> m(b.w, a.h);

	REP(j, m.h){
		REP(i, m.w){
			ll c = 0;
			REP(k, a.w){
				c += a.A[j * a.w + k] * b.A[k * b.w + i];
			}
			m.A[j * m.w + i] = c;
		}
	}

	return m;
}

void dump(const Matrix<ll> &m)
{
	REP(j, m.h){
		REP(i, m.w-1){ printf("%lld ", m.A[j * m.w + i]); }
		printf("%lld\n", m.A[j * m.w + m.w-1]);
	}
}

void dump(const Matrix<double> &m)
{
	REP(j, m.h){
		REP(i, m.w-1){ printf("%f ", m.A[j * m.w + i]); }
		printf("%f\n", m.A[j * m.w + m.w-1]);
	}
}

string &to_upper(string &s)
{
	REP(i, s.length()){
		if('a' <= s[i] && s[i] <= 'z'){
			s[i] -= 32;
		}
	}

	return s;
}

string &to_lower(string &s)
{
	REP(i, s.length()){
		if('A' <= s[i] && s[i] <= 'Z'){
			s[i] += 32;
		}
	}

	return s;
}

// すべての約数を列挙する
template <class T> vector<T> get_divisors(T n)
{
	vector<T> ret;
	for(T i = 1; i * i <= n; i++){
		if(n % i == 0){
			ret.push_back(i);
			if(i * i != n)
				ret.push_back(n / i);
		}
	}
	sort(ALL(ret));
	return ret;
}

// 1-sqrt(N)までの約数を列挙する
template <class T> vector<T> get_divisors2(T n)
{
	vector<T> ret;
	for(T i = 1; i * i <= n; i++){
		if(n % i == 0){
			ret.push_back(i);
		}
	}
	return ret;
}

int main()
{
	int HP[2];
	int AT[2];
	cin >> HP[0] >> AT[0] >> HP[1] >> AT[1];

	int i = 0;
	for(;;){
		// 0->1
		if(i % 2 == 0){
			HP[1] -= AT[0];
			if(HP[1] <= 0){
				cout << "Yes" << endl;
				break;
			}
		}
		// 1->0
		else{
			HP[0] -= AT[1];
			if(HP[0] <= 0){
				cout << "No" << endl;
				break;
			}
		}
		i++;
	}


	return 0;
}


Measured memory_bytes: 3600