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

#define pb push_back
#define all(a) begin(a), end(a)
#define deb(x) cout << #x << " = " << x << endl
#define debu(x, y) cout << "( " << #x << ", " << #y << " ) = ( " << x << ", " << y << " )" << endl

typedef long long ll;
ll mod=1000000007;

template <typename T> vector<T> readVector(int n) { vector<T> res(n); for (int i = 0 ; i < n ; i++) cin >> res[i]; return res; }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    //cin >> tt;
    while(tt--) {
        string s, t;
        cin >> s >> t;

        int ans = 10000;
        for(int i=0; i+t.length()<=s.length(); i++) {
            /// suppose matching substring begins at here
            int cnt = 0;
            for(int j=0; j<t.length(); j++) {
                if(s[i+j] == t[j]) cnt++;
            }
            ans = min(ans, (int)t.length() - cnt);
        }

        cout << ans << endl;

    }
    return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 998244353
 
using namespace std;


void solve(){
	int n; cin>>n;
	ll s=0;
	for(int i=1; i<=n; i++){
		if(i%3 && i%5){
			s += i;
		}
	}
	cout<<s;


}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//cout<<fixed<<setprecision(12);
	//memset(dp,-1,sizeof(dp));
	
	int t =1; 
	//cin>>t;

	int x = t;


	while(t--){
		solve();
		//cout<<"\n";
	}




	return 0;

	}




Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
long long a [100010];
int main (){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%lld",&a[i]);
    int zero =0;
    for(int i=0;i<n;i++)if(a[i]==0) zero ++;

    if(zero >0){
        cout<<"0\n"<<endl;
        return 0;
    }
    long long prod =1;
    for(int i=0;i<n;i++){
        if(a[i ] <=1000000000000000000/ prod ){
            prod *=a[i];
        }else{
            cout<<"-1\n"<<endl;
            return 0;
        }
    }
    cout<<prod<<endl;
}


Measured memory_bytes: 4540
#include <cstdio>
int P[100000],T[100000];
int main() {
    int N,R,L,PT=0,n1=0,p1=0;
    scanf("%d %d %d",&N,&R,&L);
    for(int i=0;i<R;i++) {
        int d,t,x;
        scanf("%d %d %d",&d,&t,&x); d--;
        P[d]+=x;
        if(x>0) {
            if(P[d]>p1||(P[d]==p1&&n1>d)) {
                T[n1]+=t-PT+1;
                PT=t;
                n1=d;
                p1=P[d];
            }
        }
        if(x<0) {
            if(d!=n1) continue;
            int n2=n1,p2=P[d];
            for(int j=N-1;j>=0;j--) {
                if(p2<=P[j]) {n2=j,p2=P[j];}
            }
            if(n2!=n1) {
                T[n1]+=t-PT+1;
                PT=t;
                n1=n2;
                p1=p2;
            }
        }
    }
    T[n1]+=L-PT+1;
    int ans_n=0,ans_t=0;
    for(int i=0;i<N;i++) {
        if(ans_t<T[i]) {
            ans_t=T[i];
            ans_n=i;
        }
    }
    printf("%d\n",ans_n+1);
}

Measured memory_bytes: 1804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N;
    cin >> N;
    vector<ll> P(N);
    rep(i, N) cin >> P.at(i);
    map<ll, ll> pos;
    rep(i, N){
        pos[P.at(i)] = i;
    }
    ll c = 1;
    ll d = 1;
    rep(i, N-1){
        if(pos.at(i+2) > pos.at(i+1)){
            c++;
        }
        else{
            chmax(d, c);
            c = 1;
        }
    }
    chmax(d, c);
    cout << N-d << endl;
}

Measured memory_bytes: 17232
import sys
def solve(balls):
    if distribute(balls, [], []): print('YES')
    else: print("NO")
        
def distribute(balls, R, L):    
    if len(balls) != 0:
        next = balls[0]
        if isMutch(next, R):
            neoR = R
            neoR.append(next)
            if distribute(balls[1:], neoR, L): return True
        
        if isMutch(next, L):
            neoL = L
            neoL.append(next)
            if distribute(balls[1:], R, neoL): return True
    else:
        return isOrdered(R) and isOrdered(L)

def isMutch(next, lis):
    if len(lis) != 0:
        return next >= lis[len(lis)-1]
    return True
    
def isOrdered(lis):
    #check both R and L are ordered
    checker = sorted(lis)
    return checker == lis
  
limit = 2**11
sys.setrecursionlimit(limit)
  
size = int(input());
for i in range(0,size):
    balls = []
    for a in input().split(' '):
        balls.append(int(a))   
    solve(balls)
    size -= 1
    if size == 0: break

Measured memory_bytes: 7732
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
xl = set(range(x))
yl = set(range(y))
zl = set(range(z))
t = []
for i in xl:
    for j in yl:
        for l in zl:
            if (i+1) * (j+1) * (l+1) <= k:
                t.append(a[i]+b[j]+c[l])
            else:
                break
t.sort(reverse=True)
for i in range(k):
    print(t[i])

Measured memory_bytes: 8864
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long num = 1;
		for (int i = 1; i <= N; i++) {
			num *= i;
			num %= (1000000000 + 7);
		}
		System.out.println(num);
	}
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    vll a(N);
    rep(i,N) cin>>a[i];
    ll Max = 0;
    ll ans=0;
    rep(i,N){
        chmax(Max,a[i]);
        ans+=Max-a[i];
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	for (int i = 0; i < 100; i++) {
		if (N > 0) {
			if (N % 4 == 0 || N % 7 == 0) {
				cout << "Yes" << endl;
				break;
			}
			else {
				N -= 4;
			}
		}
		else {
			cout << "No" << endl;
			break;
		}
	}
}


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
using namespace std;
int N;//配列Aの長さ
int M;//Mの最大数
int Q;//与えられる組数
vector<long long> a,b,c,d;
long long score(const vector<int> &A){
  long long sum=0;
  for(int i=0;i<Q;i++){
    if(A[b[i]]-A[a[i]]==c[i]){
      sum+=d[i];
    }
  }
  return sum;
}

long long dfs(vector<int> &A){
  if(A.size()==N){
    return score(A);
  }
  long long res=0;
  int prev_last = (A.empty() ? 0 : A.back());
  for(int i=prev_last;i<M;i++){
    A.push_back(i);
    res=max(res,dfs(A));
    A.pop_back();
  }
  return res;
}

int main(){
  cin>>N>>M>>Q;
  a.resize(Q);b.resize(Q);c.resize(Q);d.resize(Q);
  for(int i=0;i<Q;i++){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
    --a[i];--b[i];//これらは添字なので
  }
  vector<int> A;
  cout<<dfs(A)<<endl;
}


Measured memory_bytes: 3616
while 1:
    n = input()
    if n == 0:break
    D = range(1,7)
    ans = set(D)
    for i in range(n):
        c = raw_input()[0]
        if   c == "s": S = [1,5,2,3,0,4]
        elif c == "n": S = [4,0,2,3,5,1]
        elif c == "w": S = [3,1,0,5,4,2]
        elif c == "e": S = [2,1,5,0,4,3]
        D = [D[s] for s in S]
    print D[0]

Measured memory_bytes: 4260
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using ll = long long;
using namespace std;

const int MOD = 1e9+7;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B) cout << C << endl;
    else if (A == C) cout << B << endl;
    else cout << A << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  while(n > 0){
    ans++;
    n /= k;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N, K, R, S, P;
  std::string T;
  std::cin >> N >> K >> R >> S >> P >> T;

  std::vector<i64> scores(N);
  for (i64 i = 0; i < N; ++i) {
    if (i >= K && T[i] == T[i - K] && scores[i - K] > 0) {
      scores[i] = 0;
    } else {
      switch (T[i]) {
      case 'r':
        scores[i] = P;
        break;
      case 's':
        scores[i] = R;
        break;
      case 'p':
        scores[i] = S;
        break;
      }
    }
  }

  std::cout << std::accumulate(scores.begin(), scores.end(), static_cast<i64>(0)) << std::endl;
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double n;
  int a,b,c,x;
  cin >> n;
  a = n / 1000;
  b = ((n / 1000) - a) * 10;
  c = (((n / 1000) - a) * 10 - b) * 10;
  x = ((((n / 1000) - a) * 10 - b) * 10 - c) * 10;
  
  if ((a == b && b == c) || (b == c && c == x)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
  

Measured memory_bytes: 256
package main

import (
	"fmt"
		)

func main() {
	var N,m int
	fmt.Scan(&N)
	goalList := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&goalList[i])
	}
	flowerList := make([]int,N)
	//終端に0をつけたリストを作成
	tmpList := make([]int,N+1)

	for {
		for i:=0; i<N; i ++ {
			if flowerList[i] < goalList[i]{
				flowerList[i] = flowerList[i] + 1
				tmpList[i] = 1
			} else {
				tmpList[i] = 0
			}
		}
		for k:=0; k<N+1;k++  {
			if tmpList[k] == 1 && tmpList[k+1] == 0 {
				m++
			}
		}

		if !Contains(tmpList,1) {
			fmt.Println(m)
			break
		}
	}

}

func Contains(a []int, x int) bool {
	for _, n := range a {
		if x == n {
			return true
		}
	}
	return false
}

Measured memory_bytes: 512
Q = int(input())
LR = [tuple(map(int,input().split())) for i in range(Q)]

MAXN = 10**5+10
sieve = [0,0] + [1]*MAXN
p = 2
while p*p <= MAXN:
    if sieve[p]:
        for q in range(2*p,MAXN+1,p):
            sieve[q] = 0
    p += 1

likes = [0] * MAXN
for i in range(3,MAXN,2):
    if sieve[i] and sieve[(i+1)//2]:
        likes[i] += 1
cl = [0]
for l in likes:
    cl.append(l + cl[-1])

ans = []
for l,r in LR:
    ans.append(cl[r+1] - cl[l])
print(*ans, sep='\n')

Measured memory_bytes: 25840
#include <bits/stdc++.h>
#define int long long //check
#define ff first
#define dd second
#define mp make_pair
#define pb push_back
#define pp pair<int,int>
#define N 5000005 // check
#define M 101
using namespace std;

int inf = 1e9;

int n,m;
int tab[N];

int ile(int x) {
    int res=  0;
    while(x) {
        res += x%10;
        x/=10;
    }
    return res;
}

main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    int maxi = 1e9;
    for(int i = 1; i < n; ++i) {
        int x = i;
        int y = n-i;
        maxi = min(maxi, ile(x)+ile(y));
    }
    cout << maxi << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdlib.h> //for exit
#include <algorithm> //for sort...etc
#include <numeric> //for accumulate
using namespace std;

int main()
{
    int m,nmin,nmax;
    while(1){
        int score_max=-10000, n_max=-1;
        
        vector<int> scores;
        cin >> m >> nmin >> nmax;
        if(m==0 && nmin==0 && nmax==0) exit(0);
        for(int i = 0 ; i < m; ++i)
        {
            int tpscore;
            cin >> tpscore;
            scores.push_back(tpscore);
        }

        sort(scores.rbegin(),scores.rend());

        for(int i = nmin-1; i < nmax; ++i)
        {
            //cout << "score is " << scores[i]-scores[i+1] << endl;
            if(scores[i]-scores[i+1] >= score_max) 
            {
                score_max = scores[i]-scores[i+1];
                n_max = i+1;
            }
            //cout << "I was compared " << scores[i] << " and " << scores[i+1] << endl;
            //cout << "i is " << i << ". nmax is " << n_max << ". scoremax is "<< score_max << endl;
        }
        if(n_max!=-10000) cout << n_max << endl;
    }

}


Measured memory_bytes: 3120
#include<stdio.h>

int main(void){
  int r;
  int d;
  int x;
  int i=0;
  scanf("%d", &r);
  scanf("%d", &d);
  scanf("%d", &x);
  int ans = 0;
  ans = x;
  for(i=0;i<10;i++){
    ans = ans*r-d;
    printf("%d\n", ans);
  }
}

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


int main()
{
     int n,m;
  cin>>n;
  int p[n];
  for(int i=0;i<n;i++)
    cin>>p[i];
  int min=p[0];
  int count_it=0;
  for(int i=0;i<n;i++)
  {
    if(p[i]<=min)
    {
        min=p[i];
        count_it++;
    }
  }
  cout<<count_it<<endl;
    return 0;
}


Measured memory_bytes: 1024
//
//  main.cpp

#include <iostream>
using namespace std;
using ll = long long;

ll max(ll x,ll y){
	if(x > y){
		return x;
	}else{
		return y;
	}
}

int main(){	
	ll n;
	cin >> n;
	int k;
	cin >> k;
	ll input[1001];
	for(int i=0;i<k;i++){
		ll inputA,inputB;
		cin >> inputA >> inputB;
		if(inputA > n/2){
			inputA = n - inputA + 1;

		}
		if(inputB > n/2){
			inputB = n - inputB + 1;
		}
		input[i] = min(inputA,inputB);
	}
	
	for(int i = 0;i<k;i++){
		switch(input[i]%3){
			case 0:
				cout << "3" << endl;
				break;
			case 1:
				cout << "1" << endl;
				break;
			case 2:
				cout << "2" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3096
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

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

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
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

def main():
  k, a, b = input_list()
  ans = 1
  lf = max(0, k - a+1)
  lf1 = lf//2
  if lf:
    ans = a + lf1 * (b - a) + lf%2
  else:
    ans +k
  print(max(ans, k+1))
  
  
import math
import fractions
import collections
from functools import reduce
main()

Measured memory_bytes: 5048
import math

def heikatu(A,B):

    
    c = math.gcd(A,B)

    return (A//c,B//c)
 
 
def pow_r(x, n,mod=10**9+7):
    """
    O(log n)
    """
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r((x ** 2)%1000000007 , n // 2) % mod
    else:  # standard case ② n is odd
        return (x * pow_r((x ** 2)%1000000007, (n - 1) // 2) % mod) % mod
 
 
 
def resolve():
    N = int(input())
 
    
    km = dict()
    kp = dict()
    zero = [0,0]
    zerozero = 0
    for i in range(N):
        A,B = map(int,input().split())
 
        if A == 0 and B == 0:
            zerozero+=1

            continue
        
        if A == 0:
            B = -abs(B)
        if B == 0:
            A = abs(A)

 
        if A <0:
            A *= -1
            B *= -1
        xx = heikatu(A,B)
 
 
 
        if B < 0:
            if not xx in km:
                km[xx]=0
            km[xx]+=1
        else:
            if not xx in kp:
                kp[xx]=0
            kp[xx]+=1

    ans = 1

    groups = []
    for (x,y),v in km.items():
        if (-y,x) in kp:
            groups.append((v,kp[(-y,x)]))
            del kp[(-y,x)]
        else:
            groups.append((v,0))

    for v in kp.values():
        groups.append((v,0))


    for i,j in groups:
        ans *= (pow_r(2,i)+pow_r(2,j)-1)%1000000007
        ans %= 1000000007



    print((ans+zerozero-1)%(10**9+7))       

resolve()

Measured memory_bytes: 138740
def main():
    N, M = map(int, input().split())
    X = []
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        X.append([a,b])
    
    X.sort(key=lambda x: x[1])
    cnt = 1
    now = X[0][1]
    for a, b in X:
        if now <= a:
            cnt += 1
            now = b

    print(cnt)



if __name__ == "__main__":
    main()

Measured memory_bytes: 92008
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <map>
#include <algorithm>
#include <math.h>
#include <iostream>     // std::cout, std::fixed
#include <iomanip>
#include<queue>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <iostream>
#include <sstream>
using namespace std;
typedef long long ll;



int main () {
    ios_base::sync_with_stdio(false);
    string s;
    cin>>s;
   if(s=="KIHBR" || s=="AKIHBR" || s=="KIHABR"||s=="AKIHABR"||s=="KIHBAR"||s=="AKIHBAR"||s=="KIHABAR"||s=="AKIHABAR"||s=="KIHBRA"||s=="AKIHBRA" || s=="KIHABRA"||s=="AKIHABRA"||s=="KIHBARA"||s=="AKIHBARA"||s=="KIHABARA"||s=="AKIHABARA")
        cout<<"YES";
    else
        cout<<"NO";
   
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define pri_que priority_queue
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

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

Measured memory_bytes: 3620
#include<stdio.h>

int ds(int i);

int main() {
	int i;
	if(scanf("%d", &i) == 0) return 1;
	printf((i % ds(i) == 0) ? "Yes" : "No");
	return 0;
}

int ds(int i) {
	if (i > 9) return i % 10 + ds(i / 10);
	else return i;
}

Measured memory_bytes: 128
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
ll INFL = 1000000000000000010;//10^18
int INF = 1 << 30;



int main(void){
    int N,K;
    cin >> N >> K;
    vector<int> h(N+1);
    h.at(0) = INF;
    for(int i = 1; i <= N; i++) cin >> h.at(i);
    vector<int> cost(N+1, INF);
    cost.at(0) = INF;
    cost.at(1) = 0;
    for(int i = 2; i <= N; i++){
        for(int j = 1; j <= K; j++){
            if(i-j >= 0){
                cost.at(i) = min( cost.at(i), cost.at(i-j) + abs(h.at(i) - h.at(i-j)) );
            }
        }
    }
    
    cout << cost.at(N) << endl;
}


Measured memory_bytes: 1024
import sys
from io import StringIO
import unittest
import heapq
class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3 3
2 13 8"""
        output = """9"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """4 4
1 9 3 5"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1 100000
1000000000"""
        output = """0"""
        self.assertIO(input, output)
    def test_入力例_4(self):
        input = """10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"""
        output = """9500000000"""
        self.assertIO(input, output)
def resolve():
    (n,m)=(int(i) for i in input().split())
    A=[int(i) for i in input().split()]
    q=[]
    for i in A:
        heapq.heappush(q,-i)
    for i in range(m):
        x=q[0]
        heapq.heappushpop(q,int(x/2))
    print(-sum(q))
if __name__ == "__main__":
    resolve()

Measured memory_bytes: 75872
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n;
vi x;

int main()
{
    cin >> n;
    x.resize(n); rep(i, n) cin >> x[i];

    vi x2 = x;
    sort(all(x2));
    int high = x2[n / 2];
    int low = x2[n / 2 - 1];

    rep(i, n){
        if(x[i] <= low) cout << high << endl;
        else cout << low << endl;
    }
    return 0;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef vector<bool> vb;
 
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()
 
ll n;
vll a(n);

void solve(){
 cin >> n;
 a.resize(n);
 rep(i,0,n) cin >> a[i];
 ll k=n%2+1;
 vvll dp(n+1,vll(k+5,-1e18)); 
 dp[0][0]=0;
  
  rep(i,0,n){
   rep(j,0,k+1){ 
     dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]);
     ll now=dp[i][j];
     if((i+j)%2==0) now+=a[i];
     dp[i+1][j]=max(dp[i+1][j],now);
   }
  }
  
 
  cout << dp[n][k] << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

Measured memory_bytes: 21944
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

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


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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  vector<int> p(100);
  p[a-1]++;
  p[b-1]++;
  p[c-1]++;
  int var=0;
  for(int i=0;i<100;i++){
    if(p[i]>0) var++;
  }
  cout<<var<<endl;
}


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

using namespace std;


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

  int y = s[1] - '0';
  int m = s[3] - '0';

  bool yymm = false;

  if(s[2] == '0' && m != 0)
    {
      yymm = true;
    }
  else if(s[2] == '1')
    {
      if(0 <= m && m <= 2)
        {
          yymm = true;
        }
    }

  bool mmyy = false;

  if(s[0] == '0' && y != 0)
    {
      mmyy = true;
    }
  else if(s[0] == '1')
    {
      if(0 <= y && y <= 2)
        {
          mmyy = true;
        }
    }

  if(yymm)
    {
      if(mmyy)
        {
          cout << "AMBIGUOUS" << endl;
        }
      else
        {
          cout << "YYMM" << endl;
        }
    }
  else
    {
      if(mmyy)
        {
          cout << "MMYY" << endl;
        }
      else
        {
          cout << "NA" << endl;
        }
    }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
   int A,B,C;
   cin>>A>>B>>C;
   if(A==5){
       if((B==5&&C==7)||(B==7&&C==5)){
           cout<<"YES"<<endl;
       }
       else{
           cout<<"NO"<<endl;
       }
   }
   else if(A==7){
       if(B==5&&C==5){
           cout<<"YES"<<endl;
       }
       else{
           cout<<"NO"<<endl;
       }
   }
   else{
       cout<<"NO"<<endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,a[10010];
  cin>>n>>m;
  for(int i=1;i<=m;i++)
  {
    cin>>a[i];
    n-=a[i];
  }
  if(n>=0)
  {
    cout<<n;
  }
  else
  {
    cout<<"-1";
  }
  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int box[10000];
int main()
{
    int N, K, num, D[10]={}, array[10]={}, k=0;
    cin >> N >> K;
    for(int i = 0; i < K; i++) { cin >> num; D[num] = -1; }
    for(int i = 0; i < 10; i++) if(D[i] != -1) array[k++] = i;
    int price = N;
   
    for(int i = 0; ; i++)
    {
        int n = price, count=0, digit = 0;
        for(int j = 0; ; j++)
        {
            box[j] = n % 10;
            n /= 10;
            digit++;
            if(n == 0) break;
        }
        for(int j = 0; j < digit; j++)
        {
            for(int k = 0; k < 10-K; k++)
                if(box[j] == array[k]) { count++; continue; }
        }
        if(count == digit) break;
        price++;
    }
    cout << price << endl;
}



Measured memory_bytes: 256
#include <iostream>
#define MAX 500000
#define SENTINEL 2000000000
using namespace std;

int L[MAX / 2 + 2];
int R[MAX / 2 + 2];
int cnt = 0;

void merge(int A[], int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i = 0; i < n1; i++)
        L[i] = A[left + i];
    for(int i = 0; i < n2; i++)
        R[i] = A[mid + i];
    L[n1] = SENTINEL;
    R[n2] = SENTINEL;
    int i = 0;
    int j = 0;
    for(int k = left; k < right; k++)
    {
        cnt++;
        if(L[i] <= R[j])
            A[k] = L[i++];
        else
            A[k] = R[j++];
    }
}

void mergesort(int A[], int left, int right)
{
    int mid = (left + right) / 2;
    if(left + 1 < right)
    {
        mergesort(A, left, mid);
        mergesort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main()
{
    int size;
    int A[MAX];
    cin >> size;
    for(int i = 0; i < size; i++)
        cin >> A[i];
    mergesort(A, 0, size);
    for(int i = 0; i < size; i++)
    {
        if(i)
            cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 6908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N;
    cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }
    int c = 100005;
    vector<int> odd(c,0), even(c,0);
    for (int i = 0; i < N; i++) {
        if(i % 2 == 0){
            even[v[i]]++;
        }
        else{
            odd[v[i]]++;
        }
    }

    int ea, eb, oa, ob;
    ea = 0; eb = 0; oa = 0; ob = 0;
    int eai, ebi, oai, obi;
    for (int i = 0; i < c; i++) {
        if(even[i] > ea){
            eb = ea;
            ebi = eai;
            ea = even[i];
            eai = i;
        }
        else if(even[i] > eb){
            eb = even[i];
            ebi = i;
        }
        if(odd[i] > oa){
            ob = oa;
            obi = oai;
            oa = odd[i];
            oai = i;
        }
        else if(odd[i] > ob){
            ob = odd[i];
            obi = i;
        }
    }

    if(eai != oai){
        printf("%d\n", N - ea - oa);
    }
    else{
        printf("%d\n", min(N - ea - ob, N - eb - oa));
    }




}

Measured memory_bytes: 4604
#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
set<pair<int,int> > s1,s2;
int dx[8]={-1,-1,-1,0,0,1,1,1},dy[8]={-1,0,1,-1,1,-1,0,1};
int n,m,a,i,j;
long long ans[10];
bool in(int x,int y)
{
	return x<=n&&x>=1&&y<=m&&y>=1;
}
int main()
{
	cin>>n>>m>>a;
	for(i=1;i<=a;i++){
		int x,y;
		cin>>x>>y;
		s1.insert(make_pair(x,y));
		s2.insert(make_pair(x,y));
		for(j=0;j<8;j++){
			if(in(x+dx[j],y+dy[j])) s2.insert(make_pair(x+dx[j],y+dy[j]));
		}
	}
	set<pair<int,int> >::iterator it;
	for(it=s2.begin();it!=s2.end();it++){
		int x=(*it).first,y=(*it).second,cnt=0;
		if(s1.count(make_pair(x,y))) cnt++;
		for(j=0;j<8;j++){
			if(!in(x+dx[j],y+dy[j])){
				cnt=0;
				break;
			}
			if(s1.count(make_pair(x+dx[j],y+dy[j]))) cnt++;
		}
		ans[cnt]++;
	}
	long long tmp=0;
	for(i=1;i<=9;i++) tmp+=ans[i];
	cout<<1LL*(n-2)*(m-2)-tmp<<endl;
	for(i=1;i<=9;i++) cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 47104
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
ll dp[11][11][11];
map <ll,ll> ans,vis;
void solve()
{
  ll n,m,tt;
  cin>>n>>m>>tt;
  rep(i,0,tt)
  {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    dp[a-1][b-1][c]+=d;
  }
  ans[0]=0;
  priority_queue <ll> q;
  q.push(0);
  vi v;
  ll x,x1,st,sum=0;
  ll tmp=0;
  vis[0]=1;
  while(!q.empty())
  {
    v.clear();
    x=q.top();
    x=-x;
    q.pop();
    x1=x;
    while(x1)
    {
      v.pb(x1%11);
      x1/=11;
    }
    if(sz(v)==n) break;
    reverse(all(v));
    st=1;
    if(sz(v)) st=v.back();
    rep(i,st,m+1)
    {
      sum=ans[x];
      rep(j,0,sz(v))
      {
        sum+=dp[j][sz(v)][i-v[j]];
      }
      ans[x*11+i]=max(ans[x*11+i],sum);
      tmp=max(tmp,sum);
      if(vis[-(x*11+i)]==0)
      {
        q.push(-(x*11+i));
        vis[-(x*11+i)]=1;
      }
    }
  }
  cout<<tmp;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

Measured memory_bytes: 27096
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long

ll gcd(ll a, ll b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
 } 
  
   
// Function to return LCM of two numbers  
  ll lcm(ll a, ll b)  
 {  
    return (a*b)/gcd(a, b);  
 }  
int main(){
	ll n;
	cin>>n;
	ll a[n+4],b[n+3];ll sum=0;
	for(int i=1;i<=n+1;i++){cin>>a[i];sum+=a[i];}
	for(int i=1;i<=n;i++)cin>>b[i];
	
	for(int i=1;i<=n;i++)
	{
		
		ll left=b[i];
	    if(left-a[i]>=0){

	    left-=a[i];	    a[i]=0;}
	    else 
	    {
	    	
	    	a[i]=a[i]-left;
	    	left=0;
	    }
	    

	    if(left==0)continue;
	    if(left-a[i+1]>=0){
	    
	    left-=a[i+1]; a[i+1]=0;}
	    else 
	    {
	    	a[i+1]=a[i+1]-left;
	    	left=0;
	    }
	    
	    
	    
	    
	}
	ll s=0;
	
	for(int i=1;i<=n+1;i++)
	s+=a[i];
	
	cout<<sum-s<<endl;
	
	
	
	
	
	}

Measured memory_bytes: 1792
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
#define INFL (ll)1e11
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

	int N;
	cin >> N;
	if (N == 1) {
		cout << "Hello World\n";
		return 0;
	}
	int A, B;
	cin >> A >> B;
	cout << A + B << "\n";
	
	return 0;
}



Measured memory_bytes: 256
n, m = map(int, input().split())
e = [[False]*n for _ in range(n)]
for m in range(m):
  a, b = map(int, input().split())
  e[a-1][b-1] = True
  e[b-1][a-1] = True
visited = [False for _ in range(n)]

ans = 0

def dfs(v):
  global ans

  if all(visited):
    ans += 1
    return
  
  for i in range(n):
    if e[v][i] == False:
      continue
    if visited[i] == True:
      continue

    visited[i] = True
    dfs(i)
    visited[i] = False

visited[0] = True
dfs(0)
print(ans)

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b;

int main()
{
    _FastIO;
    cin >> a >> b;
    for(int i = 0; i < 1010; i++){
        int x = int((i * 8) / 100);
        int y = int((i * 10) / 100);
        if(x == a && y == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}


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

int main () {
  int A,B;
  cin >> A >> B;
  if(A==1){
    A=14;
  }
  if(B==1){
    B=14;
  }
  if(A>B){
    cout << "Alice" << endl;
  }
  else if(A<B){
    cout << "Bob" << endl;
  }
  else{
    cout << "Draw" << endl;
  }
}


Measured memory_bytes: 256
// AUTHOR:: MOHAMMAD FAISAL
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,p;
  cin >> n >> p;
  int res = (n*3)+p;
  cout<<res/2<<endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fore(i,a,b) for(int i = (int)a; i < (int)b; i++)
#define fr(i,a,b) for(int i = (int)a - 1; i >= (int)b; i--)
#define inf INT32_MAX
#define N 200005
#define mod 1000000000 + 7

using namespace std;

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

int main()
{
    fast;
    string s1,s2;
    cin >> s1 >> s2;
    int otv = 0;
    fore(i,0,3)
    {
        if (s1[i] == s2[i])
        otv++;
    }
    cout << otv;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <string>
#define mod 1000000007
using namespace std; 

int main(){
	long long x; cin >> x;
	for (long long i=-1000;i<1000;i++){
		for (long long j=-1000;j<1000;j++){
			if(pow(i,5)-pow(j,5)==x){
				cout << i << " " << j << "\n";
				return 0;
			}
		}
	}
}


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int a[2];
  cin>>a[0]>>a[1];
  sort(a,a+2);

  if(a[0]==1&&a[1]==2)puts("3");
  else if(a[0]==2&&a[1]==3)puts("1");
  else if(a[0]==1&&a[1]==3)puts("2");

}

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

using namespace std;

int dp[100005][3];
int a[100005][3];

int M(int x, int y, int z) {
	int maxn = max(x, y);
	maxn = max(maxn, z);
	return maxn;
}


int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	dp[1][0] = a[1][0];
	dp[1][1] = a[1][1];
	dp[1][2] = a[1][2];
	for (int i = 2; i <= n; ++i) {
		dp[i][0] = a[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = a[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = a[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout << M(dp[n][0], dp[n][1], dp[n][2]);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int h[25];
int ans,n;
bool f=true;
int main() {
	cin>>n;
	for(int i=1; i<=n; i++) cin>>h[i];
	for(int i=1; i<=n; i++) {
		f=true;
		for(int j=i-1; j>0; j--) {

			if(h[i]<h[j]) {
				f=false;
				break;

			}
		}
		if(f==true)
			ans++;
	}

	cout<<ans<<endl;

	return 0;
}


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

using namespace std;

int main()
{
    ll h,w;  cin >> h >> w;
    if(h == 1 || w == 1)  cout << 1;
    else cout << (((h + 1)/2) * ((w + 1)/2)) + ((h/2) * (w/2));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second 
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout); 
	ll n;
	cin>>n;
	string s="";
	while(n>0){
		n--;
		s+=('a'+n%26);
		n/=26;
	}
	reverse(all(s));
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 3616
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	vector<int> ans(5);
	for (int i = 0; i < 6; i++) {
		int a;
		cin >> a;
		ans[a]++;
	}

	if (*max_element(ans.begin(), ans.end()) <= 2) cout << "YES" << "\n";
	else cout << "NO" << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <cmath>
 
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
 
int main()
{
    long long N;
    cin >> N;
    int res[1000];
    int i = 0;
    if (N == 0)
    {
        res[0] = 0;
        i++;
    }
    while (N != 0)
    {
        int amari = N % 2;
        if (amari < 0)
        {
            amari += 2;
        }
        res[i] = amari;
        i++;
        N = (N - amari) / (-2);
    }
    rep(r, 0, i)
    {
        cout << res[i - 1 - r];
    }
    cout << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

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

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

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

        ll sum = 0;
        // a[j] >= mid - a[i]
        for(int i=0; i<n; i++){
            int dist = lower_bound(a.begin(), a.end(), mid - a[i]) - a.begin();
            sum += (n - dist);
        }

        if(sum >= m) ok = mid;
        else ng = mid;
    }

    vector<ll> sum(n+1, 0);
    for(int i=0; i<n; i++){
        sum[i+1] = sum[i] + a[i];
    }

    ll num = 0, ans = 0;
    for(int i=0; i<n; i++){
        int dist = lower_bound(a.begin(), a.end(), ok - a[i]) - a.begin();
        num += (n - dist);
        ans += (sum[n] - sum[dist]) * 2;
    }

    ans -= (num - m) * ok;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    int X,Y,a[100][100],cnt;
    char w[100][100];
    cin>>Y>>X;
    for(int i=0;i<Y;i++)for(int i2=0;i2<X;i2++)a[i2][i]=-1;
    for(int i=0;i<Y;i++){
        for(int i2=0;i2<X;i2++){
            cin>>w[i2][i];
            if(w[i2][i]=='c'){
                cnt=0;
                for(int i3=i2;i3<X;i3++){
                    a[i3][i]=cnt;
                    cnt++;
                }
            }
        }
    }
    for(int i=0;i<Y;i++){
        for(int i2=0;i2<X;i2++){
            cout<<a[i2][i];
            if(i2!=X-1)cout<<' ';
        }
        cout<<endl;
    }
}

Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	string s;
	cin >> s;
	cout << s.substr(0, 4) << ' ' << s.substr(4, 8) << endl;
}

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

int H, W, K;
vector<char> c{};
long result = 0;

void paint(int i, vector<char> map){
  if(i == (H + W)){
    if(std::count(map.begin(), map.end(), '#') == K){
      result++;
    }
    return;
  }
  
  vector<char> c1(H * W);
  c1 = map;
  vector<char> c2(H * W);
  c2 = map;
  
  paint(i + 1, c1);
  
  if(i < H){
    for(int l = 0; l < W; l++){
      c2[l + (i * W)] = '*';
    }
  }else{
    for(int l = 0; l < H; l++){
      c2[(i - H) + (l * W)] = '*';
    }
  }

  if(std::count(c2.begin(), c2.end(), '#') < K){
    return;
  }
  paint(i + 1, c2);
  
  return;
}

int main(){
  cin >> H >> W >> K;
  int black_sum = 0;
  c.resize(H * W);
  for(int i = 0; i < H * W; i++){
    cin >> c[i];
  }
  paint(0, c);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3620