akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

int is_possible(int A, int B, int C)
{
    return (A==5 && B==7 && C==5) ||
           (A==7 && B==5 && C==5) ||
           (A==5 && B==5 && C==7);
}

int main()
{
    int A, B, C;
    std::cin >> A >> B >> C;

    if(is_possible(A, B, C))
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;
    return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "0011" ].parse.expand.solve == 4 );
	assert( [ "11011010001011" ].parse.expand.solve == 12 );
	assert( [ "0" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	return tuple( s );
}

auto solve( string s )
{
	// Sを連続する同じ色のキューブの数の配列に変換
	auto p = '9';
	long[] ns;
	foreach( c; s )
	{
		if( p != c )
		{
			ns ~= 1L;
			p = c;
		}
		else
		{
			ns[ $ - 1 ]++;
		}
	}
	
	// 取り除けるキューブの数を計算
	auto ans = 0L;
	auto r1 = ns[ 0 ];
	auto r2 = 0L;
	foreach( n; ns[ 1 .. $ ] )
	{
		if( n < r1 )
		{
			ans += n * 2;
			r2 = r1 - n;
			r1 = 0L;
		}
		else
		{
			ans += r1 * 2;
			r1 = r2 + n - r1;
			r2 = 0L;
		}
	}
	
	return ans;
}


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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

int inp[55];

vector < int > posi, nega;
vector < pair < int , int > > Ans;

void print(){
    printf("%d\n", (int)Ans.size());
    for(int i = 0; i < (int)Ans.size(); i++){
        printf("%d %d\n", Ans[i].fs, Ans[i].se);
    }
}

void P1(int n){
    for(int i = 2; i <= n; i++){
        Ans.pb(mp(i - 1, i));
    }
    print();
}

void P2(int n){
    for(int i = n - 1; i >= 1; i--){
        Ans.pb(mp(i + 1, i));
    }
    print();
}

int main(){
    int n, n_mn = 1e7, p_mx = -1e7, a = 0, b = 0; fastScan(n);
    for(int i = 1; i <= n; i++){
        fastScan(inp[i]);
        if(inp[i] < 0){
            nega.pb(i);
            b += inp[i];
            n_mn = min(n_mn, inp[i]);
        } else {
            posi.pb(i);
            a += inp[i];
            p_mx = max(p_mx, inp[i]);
        }
    }
    if((int)posi.size() == 0) P2(n);
    else if(nega.size() == 0) P1(n);
    else if(a + n_mn >= 0){
        for(int i = 1; i < posi.size(); i++){
            Ans.pb(mp(posi[i], posi[0]));
        }
        for(int i = 0; i < nega.size(); i++){
            Ans.pb(mp(posi[0], nega[i]));
        }
        P1(n);
    } else {
        for(int i = 1; i < nega.size(); i++){
            Ans.pb(mp(nega[i], nega[0]));
        }
        for(int i = 0; i < posi.size(); i++){
            Ans.pb(mp(nega[0], posi[i]));
        }
        P2(n);
    }
    return 0;
}


Measured memory_bytes: 256
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

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

//LOVE NyantakoGG

using namespace std;


int main() {
	1, 1, 12, 21, 213, 312, 3124, 4213, 42135, 53124, 531246, 642135, 6421357, 7531246;
	int n;
	cin >> n;
	vector<int>data(n);
	for (int i = 0; i < n; i++) {
		cin >> data[i];
	}
	int i = n - 1;
	while (i >= 0) {
		cout << data[i] << " ";
		i -= 2;
	}
	if (n % 2 == 0) {
		i = 0;
		while (i < n) {
			cout << data[i] << " ";
			i += 2;
		}
	}
	else {
		i = 1;
		while (i < n) {
			cout << data[i] << " ";
			i += 2;
		}
	}
	cout << endl;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL read(){
	LL x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
LL n,A,B,C,D;
LL LLabs(LL x){
	return x<0?-x:x;
}
int main(){
	n=read()-1,A=read(),B=read(),C=read(),D=read();
	A=LLabs(B-A),D-=C;
	for (LL i=0;i<=n;i++){
		LL j=n-i;
		LL L=(i-j)*C-j*D;
		LL R=(i-j)*C+i*D;
		if (L<=A&&A<=R)
			return puts("YES"),0;
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

#define LEN(x) (int)x.size()
#define ALL(x) x.begin(), x.end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
using vpii = vector<pii>;

template<typename T, typename M = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, M, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

inline int fcmp(double x, double y)
{ return (x < y + EPS ? (x < y - EPS ? -1 : 0) : 1);}

const int N = 1e5 + 10;
int n, x[3];
int cnt[N][3];
pii q[N];
map<pair<pii, int>, bool> dp[N];

bool solve(int i, int a, int b, int c)
{
    if(x[0] < -a || x[1] < -b || x[2] < -c) return false;
    if(i == n) return true;

    if(dp[i].count({{a, b}, c}))
        return dp[i][{{a, b}, c}];

    bool& ans = dp[i][{{a, b}, c}];

    if(q[i].first == 0 && q[i].second == 1)
        ans = solve(i + 1, a - 1, b + 1, c) || solve(i + 1, a + 1, b - 1, c);
    else if(q[i].first == 0 && q[i].second == 2)
        ans = solve(i + 1, a - 1, b, c + 1) || solve(i + 1, a + 1, b, c - 1);
    else
        ans = solve(i + 1, a, b - 1, c + 1) || solve(i + 1, a, b + 1, c - 1);

    return ans;
}

void rec(int i, int a, int b, int c)
{
    if(i == n) return;

    if(q[i].first == 0 && q[i].second == 1)
    {
        if(solve(i + 1, a - 1, b + 1, c))
        {
            cout << "B\n";
            rec(i + 1, a - 1, b + 1, c);
        }
        else if(solve(i + 1, a + 1, b - 1, c))
        {
            cout << "A\n";
            rec(i + 1, a + 1, b - 1, c);
        }
    }
    else if(q[i].first == 0 && q[i].second == 2)
    {
        if(solve(i + 1, a - 1, b, c + 1))
        {
            cout << "C\n";
            rec(i + 1, a - 1, b, c + 1);
        }
        else if(solve(i + 1, a + 1, b, c - 1))
        {
            cout << "A\n";
            rec(i + 1, a + 1, b, c - 1);
        }
    }
    else
    {
        if(solve(i + 1, a, b - 1, c + 1))
        {
            cout << "C\n";
            rec(i + 1, a, b - 1, c + 1);
        }
        else if(solve(i + 1, a, b + 1, c - 1))
        {
            cout << "B\n";
            rec(i + 1, a, b + 1, c - 1);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
    
    cin >> n >> x[0] >> x[1] >> x[2];

    for(int i = 0; i < n; i++)
    {
        string s; cin >> s;

        cnt[i][int(s[0] - 'A')]++;
        cnt[i][int(s[1] - 'A')]++;
        q[i] = pii(s[0] - 'A', s[1] - 'A');
    }

    for(int i = n - 1; i >= 0; i--)
        for(int j = 0; j < 3; j++)
            cnt[i][j] += cnt[i + 1][j]; 
    
    if(solve(0, 0, 0, 0))
    {
        cout << "Yes" << endl;
        rec(0, 0, 0, 0);
    }
    else cout << "No" << endl;    

    return 0;
}

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

const char grade(int m, int f, int r)
{
    int s = m+f;
    if(m == -1 || f == -1)
    {
        return 'F';
    }
    else if(s >= 80)
    {
        return 'A';
    }
    else if(s >= 65 && s < 80)
    {
        return 'B';
    }
    else if(s >= 50 && s < 65)
    {
        return 'C';
    }
    else if(s >= 30 && s < 50)
    {
        if(r >= 50)
        {
            return 'C';
        }
        return 'D';
    }
    else if(s < 30)
    {
        return 'F';
    }

	return 'E';
}

int main()
{
    int m, f, r;

    while(true)
    {
        cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1)
            break;
        cout << grade(m, f, r) << endl;
    }

    return 0;
}

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

using namespace std;

#define LIMIT 100
typedef pair<int64_t, int64_t> ii;
typedef int64_t ll;
int gcd(ll a, ll b) { return (b==0)?a:gcd(b, a%b); }
int lcm(ll a, ll b) { ll i=(a/gcd(a,b))*b; assert(i>0); return i; }

//  ***** MAIN *****
int main(){
  //ios::sync_with_stdio(false);
  cin.tie(NULL);
  int x, y, z;
  cin >> x >> y >> z;

  int i = 0;
  for(i = 0; i <(x/y)+1; ++i){
    if(z*(i+1) + y*i > x) break;
  }
  i--;
  std::cout << i << std::endl;

  return 0;
}



Measured memory_bytes: 256
import collections

H, W, K = [int(x) for x in input().split()]
S = [input().strip() for _ in range(H)]

ans = float("inf")


for i in range(2 ** (H - 1)):
    bundan = {}
    bundan[0] = 0
    prev = 0
    tmp = 0
    for j in range(H - 1):
        if i >> j & 1 == 1:
            prev += 1
            bundan[j + 1] = prev
            tmp += 1
        else:
            bundan[j + 1] = prev

    c = collections.Counter()
    for kk in range(W):
        f = False
        for k in range(H):
            if f:
                break
            if S[k][kk] == '1':
                c[bundan[k]] += 1
                if c[bundan[k]] > K:
                    tmp += 1
                    f = True
                    c = collections.Counter()
                    for kkk in range(H):
                        if S[kkk][kk] == '1':
                            c[bundan[kkk]] += 1
                    break
    for k in c.keys():
        if c[k] > K:
            tmp = float("inf")
            break


    ans = min(ans, tmp)


print(ans)






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

int main() {
  string s,t;
  cin >> s;
  cin >> t;
  
  ll sum=0;
  for (ll i=0;i<s.size();i++) {
    if (s[i] != t[i]) sum++;
  }
  
  cout << sum;
}

Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

int n;
int c[101010];

int main(){
	cin>>n;
	ll ret=1;
	c[0]=3;
	rep(i,n){
		int x;
		cin>>x;
		ret=ret*c[x]%MOD;
		c[x]--;
		c[x+1]++;
	}
	cout<<ret<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii  pair<int,int>
#define vpii vector<pii>
#define vll  vector<ll>
#define vi  vector<int>
#define pb push_back
#define f  first
#define s  second

int main() {

    int n,m;
    cin>>n>>m;
    
    int arr[m+1];
    
    for(int i=0;i<=m;++i)
       arr[i] = 0;
    
    for(int i=0;i<n;++i){
        int k;
          cin>>k;
        for(int i=0;i<k;++i)
          {
              int x;
              cin>>x;
              arr[x]++;
          }
    }
    int ct=0;
    for(int i=0;i<=m;++i){
        if(arr[i]==n)
         ct++;
    }
    cout<<ct;
    
    
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

int a[200000];
signed main(){
	int n, ans = 0;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld",&a[i]);
	rep(i,n-1){
		if(a[i]%2 == 1 and a[i+1] > 0){ans++;a[i]--;a[i+1]--;}
	}
	rep(i,n)ans += a[i]/2;
	printf("%lld\n",ans);
	return 0;
}







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

using namespace std;
using ll = long long;
const int INF = 1e9 + 5;

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

    ll N, W, V = 0; cin >> N >> W;

    vector<ll> w(N), v(N);
    for (int i = 0; i < N; ++i) {
        cin >> w[i] >> v[i];
        V += v[i];
    }

    vector<ll> dp(V + 1, INF), temp;

    dp[0] = 0;
    for (int j = 1; j <= v[0]; ++j) dp[j] = w[0];

    for (int i = 1; i < N; ++i) {
        temp = dp;
        for (int j = 1; j <= V; ++j) {
            if (v[i] <= j)
                dp[j] = min(temp[j - v[i]] + w[i], temp[j]);
            else dp[j] = min(w[i], temp[j]);
        }
    }

    ll max_val = 0;
    for (int i = 1; i <= V; ++i)
        if (dp[i] <= W && i > max_val)
            max_val = i;
    cout << max_val << "\n";

    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s[100],tmp;
int main(){
	int n;
	cin>>n;
	cin>>tmp;
	for(int i=0;i<n;i++)
	cin>>s[i];
	sort(s,s+n);
	for(int i=0;i<n;++i)cout<<s[i];
	return 0;
}

Measured memory_bytes: 256
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

for i in [-1,1]:
    for j in [-1,1]:
        for k in [-1,1]:
            if a + i*b + j*c + k*d == 7:
                op1 = ['-','+'][i==1]
                op2 = ['-','+'][j==1]
                op3 = ['-','+'][k==1]
                print(f'{a}{op1}{b}{op2}{c}{op3}{d}=7')
                exit()

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

using namespace std;

int main()
{
	long long N, P, Q, C;

	scanf("%lld", &N);
	scanf("%lld", &P);
	scanf("%lld", &Q);

	vector<long long> A(N);

	long long zenbugaishoku = 0;

	for (int i = 0; i < N; i++)
	{
		scanf("%lld", &C);

		zenbugaishoku += C;

		A[i] = C - (Q - i) * P;
	}

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

	long long Answer = zenbugaishoku;

	long long sum = zenbugaishoku;

	for (int i = 0; i < N; i++)
	{
		sum -= A[i];

		sum += 2 * i * P;

		Answer = max(sum, Answer);
	}

	printf("%lld\n", Answer);

	return 0;
}

Measured memory_bytes: 6768
using System;

class Program
{
	static void Main(string[] args)
	{
		var A = int.Parse(Console.ReadLine());
		var B = int.Parse(Console.ReadLine());
		var C = int.Parse(Console.ReadLine());
		var D = int.Parse(Console.ReadLine());
		var E = int.Parse(Console.ReadLine());
		var K = int.Parse(Console.ReadLine());

		if(E - A <= K){
			Console.WriteLine("Yay!");
			return;
		}
		Console.WriteLine(":(");
		
    
	}
}

Measured memory_bytes: 11092
#include<stdio.h>
int main(){
int n,m,c;
  scanf("%d%d%d",&n,&m,&c);
  int b[m];
  for(int i=0;i<m;i++){
	scanf("%d",&b[i]);
  }
  
  int a[n][m];
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
	scanf("%d",&a[i][j]);
    }
  }
  
  int sum=0,count=0;
  for(int i=0;i<n;i++){
	sum=c;
    for(int j=0;j<m;j++){
	sum+=a[i][j]*b[j];
    }
    if(sum>0)count++;
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val list = readLine()!!.split(" ").map { it.toInt() }
    val dic = mutableListOf(list.first())
    for(i in (1 until list.size)) {
        dic.add(Math.min(dic.last(), list[i]))
    }
    val ans = list.indices.filter { dic[it] >= list[it] }.count()
    println(ans)
}


Measured memory_bytes: 82872
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

const ll INF = 1e14;

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

  int n, q, k;
  cin >> n;
  vector<vector<pii>> G(n);
  rep(i, n-1) {
    int a, b, c;
    cin >> a >> b >> c;
    G[a-1].push_back({b-1, c});
    G[b-1].push_back({a-1, c});
  }

  cin >> q >> k;

  using pil = pair<int, ll>;
  queue<pil> que;
  que.push({k-1, 0});
  vl dis(n, INF);

  while (que.size()) {
    pil p = que.front();
    que.pop();
    int i = p.first;
    ll d = p.second;
    dis[i] = d;

    for (auto&& j : G[i]) {
      if (dis[j.first] == INF) {
        que.push({j.first, d+j.second});
      }
    }
  }

  rep(i, q) {
    int x, y;
    cin >> x >> y;
    cout << dis[x-1] + dis[y-1] << endl;
  }
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int D[K];
  for (int i = 0 ; i < K ; i++) {
    cin >> D[i];
  }
  for ( ;  ; N++) {
      string str = to_string(N);
      bool ok = true;
      for (int i = 0 ; i < str.size() ; i++) {
        for (int j = 0 ; j < K ; j++) {
          if ((int)(str[i] - '0') == D[j]) ok = false;
        }
      }
      if (ok) break;
  }
  cout << N << endl;
}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

string s, t;
int n, m;
int memo[3005][3005];

int dp(int i, int j) {
	if (i == n or j == m) return 0;
	if (memo[i][j] != -1) return memo[i][j];
	if (s[i] == t[j]) return memo[i][j] = 1 + dp(i+1, j+1);
	return memo[i][j] = max(dp(i+1, j), dp(i, j+1));
}

int main() {
	memset(memo, -1, sizeof memo);
	cin >>s>>t;
	n = s.size();
	m = t.size();
	string sol;
	int i = 0;
	int j = 0;
	while (i<n and j<m) {
		if (s[i] == t[j]) sol += s[i], i++, j++;
		else {
			if (dp(i+1, j) > dp(i, j+1)) i++;
			else j++;
		}
	}
	printf("%s\n", sol.c_str());
	return 0;
}

Measured memory_bytes: 39172
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    int n; std::cin >> n;
    std::vector<int>a(n+1);
    int ans=0;
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j+=i){
            a.at(j)++;
        }
        if(i&1&&a.at(i)==8)ans++;
    }
    std::cout << ans << std::endl;
}

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

const int N = 510;
int grid[N][N];
const int I[] = {+0, +0, -1, +1};
const int J[] = {-1, +1, +0, +0};
vector<pair<pair<int, int>, pair<int, int>>> output;

int main() {
    int h, w;

    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> grid[i][j];
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w/2; j++) {
            if (grid[i][j] % 2) {
                output.push_back({{i, j}, {i, j+1}});
                grid[i][j+1]++;
                grid[i][j]--;
            }
            if (w % 2 == 0 && j == w/2-1)
                break;
            if (grid[i][w-j-1] % 2) {
                output.push_back({{i, w-j-1}, {i, w-j-2}});
                grid[i][w-j-2]++;
                grid[i][w-j-1]--;
            }
        }
    }

    for (int i = 0; i < h/2; i++) {
        if (grid[i][w/2] % 2) {
            output.push_back({{i, w/2}, {i+1, w/2}});
            grid[i+1][w/2]++;
            grid[i][w/2]--;
        }
        if (h % 2 == 0 && i == h/2-1)
            break;
        if (grid[h-i-1][w/2] % 2) {
            output.push_back({{h-i-1, w/2}, {h-i-2, w/2}});
            grid[h-i-2][w/2]++;
            grid[h-i-1][w/2]--;
        }
    }

    cout << output.size() << "\n";
    for (const auto &p : output) {
        cout << 1 + p.first.first << " "
            << 1 + p.first.second << " "
            << 1 + p.second.first << " "
            << 1 + p.second.second << "\n";
    }
    return 0;
}


Measured memory_bytes: 5232
fun main(args: Array<String>) {
    val N = nextInt()
    val A = next().map { it - '1' }
    if (A.min() == A.max()) return println(0)
    fun solve(a: List<Int>): Int {
        var two = 0
        var ans = 0
        val n = a.size - 1
        a.forEachIndexed { i, v ->
            if (two == 0) ans = ans xor v
            two += Integer.numberOfTrailingZeros(n - i) - Integer.numberOfTrailingZeros(i + 1)
        }
        return ans
    }
    if (!A.contains(1)) return println(solve(A.map { it / 2 }) * 2)
    println(solve(A.map { it % 2 }))
}

fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun nextLong() = java.lang.Long.parseLong(next())
fun nextLong(offset: Long = 0L) = nextLong() + offset
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }
fun listOfLong(offset: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + offset }
fun listOfDouble() = listOfString().map { it.toDouble() }


Measured memory_bytes: 47632
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long a[n+1];
    int i;
    vector<long long>v;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(i=1;i<=n-1;i++)
    {
        v.push_back(a[i]);
    }
    int pos=lower_bound(v.begin(),v.end(),a[n]/2)-v.begin();
    //cout<<pos<<endl;
    if(pos==0)
    {
        cout<<a[n]<<" "<<v[pos]<<endl;
    }
    else
    {
        int flag=0;
        if(pos==v.size())
        {
            flag=1;
        }
        long long g=abs(a[n]/2-v[pos-flag]);
        long long h=abs(a[n]/2-v[pos-1]);
        if(g>h)
        {
            g=v[pos-1];
        }
        else
        {
            g=v[pos];
        }
        cout<<a[n]<<" "<<g<<endl;
    }
}


Measured memory_bytes: 2168
M, K = (int(i) for i in input().split())

if M == 1:
    if K == 0:
        print("0 0 1 1")
    else:
        print("-1")
else:
    N = 2**M
    if K >= N:
        print("-1")
    elif K == 0:
        l = list(range(N))
        ll = l + l[::-1]
        ll = [str(a) for a in ll]
        print(" ".join(ll))
    else:
        l = list(range(N))
        l = l[:K] + l[K+1:]
        ll = [0, K] + l + [K] + l[::-1][:-1]
        ll = [str(a) for a in ll]
        print(" ".join(ll))   

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

int main(){
	int N;
	cin >> N;
	vector<int> d(N);
	rep(i, N) cin >> d.at(i);
	int ans = 0;
	for (int i = 0;i < N - 1;++i) {
		for (int j = i + 1;j < N;++j) ans += d.at(i) * d.at(j);
	}
	cout << ans << endl;
	return 0;
}

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  int p[n];
  int sum = 0;
  for(int i=0;i<n;i++){
    cin >> p[i];
    sum += p[i];
  }
  sort(p,p+n);
  sum -= p[n-1]/2;
  cout << sum << endl;
  return 0;
}


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

void Check(int a, int b);

int main(){
    int a, b;
    
    cin >> a;
    cin >> b;
    
    Check(a, b);
    return 0;
}

void Check(int a, int b){
    if(a > b) cout << "a > b" << endl;
    else if(a < b) cout << "a < b" << endl;
    else if(a == b) cout << "a == b" << endl;
}


Measured memory_bytes: 3104
#include <stdio.h>
#define MOD 1000000007
char s[100010];
long long dp[100010][15];
long long go(int p,int r){
    if(s[p]=='\0'){
        if(r==5) return 1;
        return 0;
    }
    if(dp[p][r]!=-1) return dp[p][r];
    long long ret = 0;
    if(s[p]=='?'){
        for(int i= 0;i<10;i++){
            int rt = r*10+i;
            rt%=13;
            ret += go(p+1,rt);
            ret%=MOD;    
        }
    }
    else {
        int rt = r*10+s[p]-'0';
        rt%=13;
        ret += go(p+1,rt);
        ret%=MOD;
    }
    return dp[p][r]=ret;

}
void MRoy(){
    for(int i = 0;i<100010;i++){
        for(int j = 0;j<15;j++) dp[i][j] = -1;
    }
    scanf("%s",s);
    long long Ans = go(0,0);
    printf("%lld\n",Ans);
    return ;
}
int main(){
    MRoy();
    return 0;
}

Measured memory_bytes: 19840
n=int(input())
s=input()

ans=float("inf")
#まずいちばん西の人がリーダーの時、何人が向く方向を変えなきゃいけないか求める
defa=0
for i in range(1,n):
  if s[i]=="E":
    defa+=1
ans=min(ans,defa)

for i in range(1,n):
  if s[i-1]=="W":
    defa+=1
  if s[i]=="E":
    defa-=1
  ans=min(ans,defa)
print(ans)

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
const int N = 15, M = 50, p = 1e9 + 7;
int n, q, idcnt, con[1 << N | 10], f[10][1 << N | 10];
int limcnt, px[M], py[M], pz[M];
map<int, int> fa, id;
inline int Qmi(int x, int y = p - 2) {
    int ans = 1;
    for (; y; y >>= 1, x = 1ll * x * x % p) if (y & 1) ans = 1ll * ans * x % p;
    return ans;
}
inline int Ask(int x) {
    return fa.count(x) ? fa[x] = Ask(fa[x]) : x;
}
vector<int> g;
int main() {
    scanf("%d%d", &n, &q);
    for (int i = 1, x, y; i <= q; ++i) {
        scanf("%d%d", &x, &y); ++y;
        g.push_back(x); g.push_back(y);
        x = Ask(x); y = Ask(y);
        if (x != y) fa[max(x, y)] = min(x, y);
    }
    sort(g.begin(), g.end());
    g.erase(unique(g.begin(), g.end()), g.end());
    const int inv9 = Qmi(9);
    int ans = 1, la = 0;
    for (auto i: g) {
        int val = 1ll * (Qmi(10, i - la) - 1) * inv9 % p;
        ans = 1ll * ans * val % p;
        if (!fa.count(i)) id[i] = idcnt++; else id[i] = id[Ask(i)];
        px[++limcnt] = id[i]; py[limcnt] = id[la]; pz[limcnt] = 1ll * (val + 1) * Qmi(val) % p;
        la = i;
    }
    ans = 1ll * ans * Qmi(10, n + 1 - la) % p * Qmi(10) % p;
    int s = 1 << idcnt;
    for (int i = 0; i < s; ++i) {
        con[i] = 1;
        for (int j = 2; j <= limcnt; ++j)
            if ((i >> px[j] & 1) && (i >> py[j] & 1))
                con[i] = 1ll * con[i] * pz[j] % p;
        f[0][i] = con[i];
        if ((i >> px[1] & 1)) f[0][i] = 1ll * f[0][i] * pz[1] % p;
    }
    for (int cl = 0; cl < 8; ++cl)
        for (int i = 0; i < s; ++i) if (f[cl][i])
            for (int j = i; j < s; j = (j + 1) | i)
                f[cl + 1][j] = (f[cl + 1][j] + 1ll * f[cl][i] * con[i ^ j]) % p;
    ans = (1ll * f[8][s - 1] * ans % p + p) % p;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
using namespace std;
int main()
{
    while(1)
    {
        int tm;
        cin>>tm;if(!tm)return 0;
        for(int i=0;i<9;++i){
            int buf;
            cin>>buf;
            tm-=buf;
        }
        cout<<tm<<endl;
    }
}

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

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

  unsigned long long int vote_T,vote_A;
  vote_T=vote_A=1;

  int T,A;
  cin>>T>>A;
  vote_T=T;
  vote_A=A;

  for(int i=0;i<N-1;i++){
    cin>>T>>A;
    unsigned long long int natural_number;
    unsigned long long int quotient_T,quotient_A;

    quotient_T=vote_T/T;
    quotient_A=vote_A/A;
    if(vote_T%T!=0) quotient_T++;
    if(vote_A%A!=0) quotient_A++;

    natural_number=max(quotient_T,quotient_A);
    vote_T=natural_number*T;
    vote_A=natural_number*A;
  }

  cout<<vote_T+vote_A<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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 main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<pair<int,int>> a(n,pair<int,int>(0,0));
    rep(i,n){cin>>a[i].first;a[i].second = i;}
    sort(begin(a),end(a));
    int cnt[2] = {};
    rep(i,n){
        if(a[i].second%2 != i%2) {
            cnt[i%2]++;
        }
    }
    cout << max(cnt[0], cnt[1]) << endl;

    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
// Macros for easier access
#define ll long long
#define endl '\n'
#define F first
#define S second
#define umap unordered_map
#define uset unordered_set
#define test ll cases; cin>>cases; for(ll testCase = 1; testCase <= cases; testCase++)   //test cases
#define fill(name, val) memset(name, val, sizeof(name));
#define mop(a, op, b)    (a%mod op b%mod)%mod
#define error(x) fixed<<setprecision(x) //cout<<error(5)<<someDouble    -> example - 3.14159
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define get(a, n)    for(ll i = 0; i < n; i++)    cin>>a[i];
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug(x) cerr << #x << " : " << (x) << endl
// Constants
#define MX 100001
#define mod 1000000007LL
#define inf 1000000000000000000LL
void init(){
	boost;
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

int main(){
	init();
	ll n;	cin>>n;
	ll a[n];	get(a, n);
	ll ans = 0;
	for(ll i = 0; i < n; i++){
		for(ll j = i+1; j < n; j++){
			for(ll k = j+1; k < n; k++){
				set<ll> s = {a[i], a[j], a[k]};
				if(s.size() != 3)	continue;
				vll v = {a[i], a[j], a[k]};
				sort(v.begin(), v.end());
				if(v[0] + v[1] > v[2])	ans++;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3656
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.List
import           Data.Maybe

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main = do
  nums <- readInts
  putStrLn $ solve (head nums) (nums !! 1)

solve :: Int -> Int -> String
solve a b
  | null k = "IMPOSSIBLE"
  | otherwise = show $ head k
  where
    f a b k = a * a - 2 * a * k == b * b - 2 * b * k
    k
      | a <= b = [k | k <- [a .. b], f a b k]
      | otherwise = [k | k <- [b .. a], f a b k]


Measured memory_bytes: 380
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int S = Integer.parseInt(line);
		int h = S / 3600;
		int m = (S - h*3600) / 60;
		int s = S - h * 3600 - m * 60;
		System.out.println(h + ":" + m + ":" + s);
	}

}

Measured memory_bytes: 26268
#include <bits/stdc++.h>
using namespace std;
signed main()
{
    int x , y;
    cin >> x >> y;
    
    if(y%2 == 1){
        cout << "No\n";
    } else if(2*x <= y && 4*x >= y){
        cout << "Yes\n";        
    } else {
        cout << "No\n";
    }
    return (0);
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <unordered_set>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n;
    cin >> n;
    int x = n/500;
    int y = n % 500;
    cout << 1000*x + 5*(y/5);
    
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-5;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int n,q;cin>>n>>q;n*=2;
    vector<ll> a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    multiset<ll> st;
    int c=0;
    ll ans=0;
    for(int i=0;i<n;i++){
        cin>>b[i];
        if(i==0||i==n-1){
            ans+=a[i];
        }else{
            st.insert(abs(a[i]-b[i]));
            ans+=max(a[i],b[i]);
            if(a[i]>b[i])c^=1;
        }
    }
    while(q--){
        ll p,x,y;cin>>p>>x>>y;--p;
        if(p==0||p==n-1){
            ans+=x-a[p];
            a[p]=x;
        }else{
            if(a[p]>b[p])c^=1;
            if(x>y)c^=1;
            ans+=max(x,y)-max(a[p],b[p]);
            st.erase(st.lower_bound(abs(a[p]-b[p])));
            st.insert(abs(x-y));
            a[p]=x,b[p]=y;
        }
        if(c){
            cout<<ans-(*st.begin())<<endl;
        }else{
            cout<<ans<<endl;
        }
    }
}


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

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

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

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  int n;
  cin >> n;

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

  int ans = 0;
  rep(i,n) {
    ans += (i%2==0&&a[i]%2==1);
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  string x;
  cin >> x;
  
  if( x[0]==x[1] && x[1]==x[2] ){
    cout << "Yes" << endl;
  }
  else if( x[1]==x[2] && x[2]==x[3] ){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

int main(){
    int n, d[1000];
    int count,ans;

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

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans += d[i]*d[j];          
        }
    } 
    printf("%d\n",ans);
}

Measured memory_bytes: 128
// Deque.cpp
// https://atcoder.jp/contests/dp/tasks/dp_l

#include <iostream>
#include <cstring>
using namespace std;
typedef  long long int llu;

llu N;
llu arr[3000];

pair<llu, llu> memoTable[3000][3000][2];
bool isComputed[3000][3000][2];

pair<llu, llu> score(llu i, llu j, bool isTaroTurn = 1){


    if(i > j){
        return make_pair(0, 0);
    }

    if(i == j){
        if(isTaroTurn)
            return make_pair(arr[i], 0);
        return make_pair(0, arr[i]);
    }

    if(isComputed[i][j][isTaroTurn]){
        return memoTable[i][j][isTaroTurn];
    }

    isComputed[i][j][isTaroTurn] = 1;

    if(isTaroTurn){

        pair<llu, llu> p1 = score(i+1, j, !isTaroTurn);
        p1.first += arr[i];

        pair<llu, llu> p2 = score(i, j-1, !isTaroTurn);
        p2.first += arr[j];

        if(p1.first - p1.second > p2.first - p2.second){
            memoTable[i][j][isTaroTurn] = p1;
            return p1;
        }
        memoTable[i][j][isTaroTurn] = p2;
        return p2;

    }
    else{

        pair<llu, llu> p1 = score(i+1, j, !isTaroTurn);
        p1.second += arr[i];

        pair<llu, llu> p2 = score(i, j-1, !isTaroTurn);
        p2.second += arr[j];

        if(p1.first - p1.second < p2.first - p2.second){
            memoTable[i][j][isTaroTurn] = p1;
            return p1;
        }
        memoTable[i][j][isTaroTurn] = p2;
        return p2;
    }

}

int main(){

    // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); cout<<"Deque.cpp\n";
    
    memset(isComputed, 0, sizeof(isComputed));

    cin >> N;
    for(llu i=0; i<N; ++i){
        cin >> arr[i];
    }

    pair<llu, llu> p = score(0, N-1);
    cout<<(p.first - p.second);

    return 0;
}



Measured memory_bytes: 297472
while True:
    a, b, c = map(str, input().split())
    if b == "?":
        break
    if b == "+":
        print(int(a) + int(c))
    elif b == "-":
        print(int(a) - int(c))
    elif b == "*":
        print(int(a) * int(c))
    elif b == "/":
        print(int(a) // int(c))



Measured memory_bytes: 5596
def II(): return int(input())
ans=''
N=II()
N-=1
i=1
while N-26**i>=0:  
  N-=26**i
  i+=1#26のべき乗倍を引いてからインクリメント
for j in range(i):
  mod=N%26
  ans+=chr(mod+ord('a'))
  N//=26
ans=ans[::-1]
print(ans)

Measured memory_bytes: 9064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

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

  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];

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

  ll ans = pow(10, 10);
  rep(i, n-k+1) {
    ans = min(ans, (ll)h[i+k-1] - h[i]);
  }

  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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 (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  int h = -100;
  int res = 0;
  rep(i, n) {
    int temp;
    cin >> temp;
    if (h <= temp) res++;
    chmax(h, temp);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#define MOD 1000000007
typedef long long ll;
using namespace std;
const int N=2e5+1;

int n,m;
int a[N],b[N];
string s;
vector<int> G[N];
bool no_ab[N];

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

  for(int i=0;i<m;i++){
    int c,d;
    cin>>c>>d;
    c--;
    d--;
    G[c].push_back(d);
    G[d].push_back(c);
    if(s[c]=='A') a[d]++;
    else b[d]++;
    if(s[d]=='A') a[c]++;
    else b[c]++;
  }

  queue<int> Q;
  for(int i=0;i<n;i++){
    if(a[i]==0||b[i]==0){
      no_ab[i]=1;
      Q.push(i);
    }
  }

  while(!Q.empty()){
    int u=Q.front();
    Q.pop();
    for(int v:G[u]){
      if(!no_ab[v]){
        if(s[u]=='A') a[v]--;
        else b[v]--;
        if(a[v]==0||b[v]==0){
          no_ab[v]=1;
          Q.push(v);
        }
      }
    }
  }

  bool flag=0;
  for(int i=0;i<n;i++){
    if(!no_ab[i]) flag=1;
  }

  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 12548
#include <bits/stdc++.h>
        using namespace std;
        #define tani_nachi_ke  ios_base::sync_with_stdio(false); cin.tie(NULL);
        #define M_PI 3.14159265358979323846
        #define data data_
        #define ff first
        #define ss second
        #define pb push_back
        #define ll long long
        #define ld long double

        int main()
        {
            tani_nachi_ke  

            long long h,a;
            cin >> h >> a;
            cout << (h + a -1)/a << endl;






           return 0;
        }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using sl = stack<ll>;
using ql = queue<ll>;

const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};


void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

int binary_search(ll x, vl a){
    auto ite = lower_bound(ALL(a), x);
    if(ite != a.end() && *ite == x) {
        return ite - a.begin() ;
    } else {
        return -1;
    }

}

ll modpow(ll a, ll n, ll mod) {
    if(n == 0)
        return 1;
    if(n == 1)
        return a % mod;
    if(n % 2 == 1)
        return (a * modpow(a, n - 1, mod)) % mod;
    ll t = modpow(a, n / 2, mod);
    return (t * t) % mod;
}

int main() {
    string S, T;
    ll s, t,ans = INF, num, count;
    cin >> S >> T;
    s = S.size();
    t = T.size();
    num = s - t + 1;
    REP(i, num){
        count = 0;
        REP(j, t){
            if(S[i + j] != T[j]) count ++;
        }
        ans = min(ans, count);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#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 <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int N;
   cin >> N;
   int A[N];
   for(int i=0;i<N;i++) cin >> A[i];
   sort(A,A+N);
   for(int i=0;i+1<N;i++){
      if( A[i]==A[i+1] ){
         cout << "NO" << endl;
         return 0;
      }
      
   }
   cout << "YES" << endl;
   return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {

		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		
		int intCount = 3;
		int intResult = 1;
		
		try {
			String strX = br.readLine();		
			try{
				//intに変換
				int intX = Integer.parseInt(strX);
				//int intX = 2;
				
				for(int i = 0; i<intCount; i++) {
					intResult = intResult*intX;
				}
				
				System.out.println(intResult);
				
			}catch (NumberFormatException e) {
				e.printStackTrace();
			}
			
			br.close();
			
		}catch(IOException e){
			e.printStackTrace();
		}	
	}
}


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

using namespace std;

int main(){
  int n ,m , x, c[13], a[13][13];
  cin >> n >> m >> x;
  for(int i=0;i<n;i++){
    cin >> c[i];
    for(int j=0;j<m;j++){
      cin >> a[i][j];
    }
  }
  int mn=1e9;
  for(int i=0;i<1<<n;i++){
    int cnt[13], sm=0;
    fill(cnt, cnt+m, 0);
    for(int j=0;j<n;j++){
      if((i>>j)&1){
        sm += c[j];
        for(int k=0;k<m;k++){
          cnt[k] += a[j][k];
        }
      }
    }
    bool ok=true;
    for(int j=0;j<m;j++){
      if(cnt[j]<x){
        ok=false;
        break;
      }
    }
    if(ok)mn = min(mn, sm);
  }
  cout << (mn==1e9?-1:mn) << endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;



int main(){
  ios_base::sync_with_stdio(false);

  int a,b,c,d;

  cin >> a >> b >> c >> d;

  int ans = min(b,d) - max(a,c);

  if(ans < 0){
    cout << 0 << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;

int main() {
  int n;
  cin >> n;
  if (n == 1) puts("Hello World");
  if (n == 2) {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}

Measured memory_bytes: 256
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

x = sum(a)/(4*m)
a = sorted(a, reverse=True)
b = 0

for i in range(m):
  if a[i] < x:
    b += 1
    print('No')
    break

if b == 0:
  print('Yes')

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

#define ll long long int
#define mod 1000000007

/*
cout<<"\ndebugging\n";
*/

int main()
{
	ios_base::sync_with_stdio(false); 	//Fast I/O
    cin.tie(NULL);
    
	double t,n,i,j,d,s;
	cin>>d>>t>>s;
	
	if(d<=s*t)
		cout<<"Yes";
	else
		cout<<"No";
	

	return 0;
}


Measured memory_bytes: 3704