akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  string s;
  int count = 0;
  cin >> s;
  // cout << s.at(0) << endl;
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == '1'){
        count++;
    }
  }
  cout << count << endl;

}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

double ans,w,h,x,y;
int z;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>w>>h>>x>>y;
    ans = w*h/2;
    if(w==2*x && h==2*y)z=1;
    printf("%.10lf %d\n",ans,z);
}


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

int DP[128][16384] = {};

int main(){
    // ???????????????????????????
    for(int i=0; i<=127; ++i) DP[i][0] = 0;
    for(int i=0; i<=16383; ++i) DP[0][i] = 0;

    int N,W;
    cin >> N >> W;
    int v[128],w[128];
    for(int i=1; i<=N; ++i){
        cin >> v[i] >> w[i];
    }

    for(int i=1; i<=N; ++i){
        for(int c=1; c<=W; ++c){
            if(c-w[i]<0){
              DP[i][c] = DP[i-1][c];
            } else {
              DP[i][c] = max(DP[i][c-w[i]]+v[i], DP[i-1][c]);
            }
        }
    }

    cout << DP[N][W] << endl;
}

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

int main() {
    int n; cin >> n;
    vector<ll> lucas(n+1);
    lucas[0] = 2; lucas[1] = 1;
    for (int i = 2; i <= n; i++)
    {
        lucas[i] = lucas[i-1] + lucas[i-2];
    }
    cout << lucas[n] << endl;
    return 0;
}

Measured memory_bytes: 256
a_to_z = ("a".."z").to_a
alphabets = {}
a_to_z.each do |char|
  alphabets[char] = 0
end

n = gets.to_i
words = n.times.map { gets.chomp }
alphabets.each do |key, value|
  count = []
  words.each do |word|
    count <<  word.count(key)
  end # of words.each
  alphabets[key] += count.min
end # of alphabets.map!
# p alphabets

answer = ""
alphabets.each do |key, value|
  unless value == 0
    answer += key * value
  end
end
puts answer


Measured memory_bytes: 3836
#include<cstdio>
#include<iostream>

const int MAX_ITEMS = 1001;

using namespace std;

class CItem{
public:
	CItem(){
		val = 0;
		wgh = 0;
	}
	int val;
	int wgh;
	bool operator<(const CItem &a) const {
		if( val < a.val ){
			return true;
		}else if( val == a.val ){
			if( wgh > a.wgh ){
				return true;
			}
		}
		return false;
	}
	CItem operator+(const CItem &a){
		CItem ret;
		ret.val = val + a.val;
		ret.wgh = wgh + a.wgh;
		return ret;
	}
};

void compute( CItem *Items, CItem **D, int H, int W ){
	for(int i = 1; i < H; i++){
		for(int j = 1; j < W; j++){
			CItem zeroItem;
			CItem m1 = D[i - 1][j];
			CItem m2 = j - Items[i].wgh < 0 ? zeroItem : D[i - 1][j - Items[i].wgh] + Items[i];
			D[i][j] = max( m1, m2 );
		}
	}
}

int main(void){
	int datasetIndex = 0;
	while( true ){
		CItem **D;
		CItem Items[MAX_ITEMS];
		int W, N;

		datasetIndex++;

		scanf("%d",&W);if( W == 0 )break;
		scanf("%d",&N);N++;W++;

		for(int i = 1; i < N; i++){
			scanf("%d,%d", &Items[i].val, &Items[i].wgh);
		}

		D = new CItem*[N];
		for(int i = 0; i < N; i++){
			D[i] = new CItem[W];
		}

		compute( Items, D, N, W );

		printf("Case %d:\n%d\n%d\n", datasetIndex, D[N-1][W-1].val, D[N-1][W-1].wgh);

		for(int i = 0; i < N; i++){
			delete[] D[i];
		}
		delete[] D;
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a <= 0 && b >= 0) {
            System.out.println("Zero");
            return;
        } else if (a > 0 && b > 0) {
            System.out.println("Positive");
            return;
        }

        int n = Math.abs(b - a) + 1;
        if (n % 2 == 0) System.out.println("Positive");
        else System.out.println("Negative");

        return;
    }

}

Measured memory_bytes: 22996
N , M  , C = (map(int , input().split()))
B = list(map(int , input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ans = 0
for i in A:
    t = 0
    for j in range(len(B)):
        t += i[j]*B[j]
    if (t+C) > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3064
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
 
readIntsLines :: IO [[Int]]
readIntsLines = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

calc :: [Int] -> [Int] -> [Int]
calc [pa, pb, pc] [ca, cb, cc] = [na, nb, nc]
  where na = max (pb + ca) (pc + ca)
        nb = max (pa + cb) (pc + cb)
        nc = max (pa + cc) (pb + cc)

solve :: [Int] -> [[Int]] -> [[Int]]
solve _ [] = []
solve pabc (cabc:abcs) = nabc : solve nabc abcs
  where nabc = calc pabc cabc

main :: IO ()
main = do
  getLine
  abcs <- readIntsLines
  print . maximum . last $ solve [0,0,0] abcs

Measured memory_bytes: 61820
N = int(input())
a = list(map(int, input().split()))

sm=0
s_rui=[]
for tmp in a:
    sm+=tmp
    s_rui.append(sm)

a.reverse()
sm=0
a_rui=[]

for tmp in a:
    sm+=tmp
    a_rui.append(sm)
a_rui.reverse()

mn=10**10

for i in range(N-1):
    diff = abs(s_rui[i] - a_rui[i+1])
    if mn > diff:
        mn=diff

print(mn)

Measured memory_bytes: 28528
K = int(input())

def gcd(x,y):
    while y:
        x, y = y, x % y
    return x

ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += gcd(gcd(i+1,j+1), k+1)

print(ans)

Measured memory_bytes: 79524
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String args[]) {
        FastReader sc = new FastReader();
        String s = sc.next();
        boolean a = false;
        boolean b = false;
        boolean c = false;
        for (int i = 0; i < 3; i++) {
            char ch = s.charAt(i);
            if (ch == 'a') a = true;
            if (ch == 'b') b = true;
            if (ch == 'c') c = true;
        }
        if (a && b && c) System.out.println("Yes");
        else System.out.println("No");
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_066_A_ringring
{
	class Program
	{
		static void Main(string[] args)
		{
			string[] word = Console.ReadLine().Split(' ');
			int a = int.Parse(word[0]);
			int b = int.Parse(word[1]);
			int c = int.Parse(word[2]);


			int d = a + b;
			int e = a + c;
			int f = b + c;
			int x = 0;

			if (d <= e && d <= f)
				x = d;
			else if (e <= d && e <= f)
				x = e;
			else
				x = f;

			Console.WriteLine(x);
        }
	}
}

Measured memory_bytes: 27312
//AtCoder Beginner Contest 049
//C - 白昼夢 / Daydream

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;


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

    while(s!=""){
        int sl = s.size();
        if(sl >=7 && s.substr(sl-7, 7)=="dreamer"){
            s = s.substr(0, sl-7);
        }else if(sl >=6 && s.substr(sl-6, 6)=="eraser"){
            s = s.substr(0, sl-6);
        }else if(s.size() >=5 && s.substr(sl-5, 5)=="dream"){
            s = s.substr(0, sl-5);
        }else if(s.size() >=5 && s.substr(sl-5, 5)=="erase"){
            s = s.substr(0, sl-5);
        }else{
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 1LL << 60; ll ans = 0;
vl flag, color; vll path;
//***********//
ll Npow(ll x, ll n) {
	if (n == 0) return 1;
	if (n % 2 == 0) return Npow(x * x % MOD, n / 2);
	else return x * Npow(x, n - 1) % MOD;
}
vl divisor(ll n) {
	vl ret;
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i != 1 && i * i != n) ret.push_back(n / i);
		}
	}
	//ret.push_back(n);
	return ret;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
int main() {
	cin >> N >> K;
	vl V(K + 1);
	for (ll x = K; x >= 1; x--) {
		ll z = (((Npow(K/x, N)- V[x]) % MOD)+MOD)%MOD;
		ans = (ans + z*x + MOD) % MOD;
		vl D = divisor(x);
		for (i = 0; i < D.size(); i++) V[D[i]] += z;
	}
	cout << ans;
}


Measured memory_bytes: 4024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
int rui(int n) {
	if (n == 0) {
		return 1;
	}
	return 2 * rui(n - 1);
}
int ord(int a) {
	if (a % 2 == 1) {
		return 0;
	}
	return 1+ord(a / 2);
}
using namespace std;
int main() {
	int ans = rui(31) - 2;
	for (int i = 0; i < 28; i++) {
		int x; cin >> x;
		ans -= rui(x);
	}
	int k = ord(ans);
	cout << k << endl << ord(ans-rui(k))<<endl;
}


Measured memory_bytes: 3104
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    cout << N * N * N << endl;
}


Measured memory_bytes: 256
a = input()
t1 = ""
t2 = ""

for i in range(len(a)):
  if (i % 2 == 0):
    t1 = t1 + "1"
    t2 = t2 + "0"
  else :
    t1 = t1 + "0"
    t2 = t2 + "1"
    
b1 = int(t1, 2) ^ int(a, 2)
b2 = int(t2, 2) ^ int(a, 2)
c1 = bin(b1).count("1")
c2 = bin(b2).count("1")

if(c1 < c2):
  print(c1)
else :
  print(c2)

Measured memory_bytes: 3444
import sys
from collections import deque

H,W=map(int,input().split())
S=list(sys.stdin)

ans=0
for i in range(H):
    for j in range(W):
        if S[i][j]=='#':
            continue
        dist=[[-1]*W for _ in range(H)]
        dist[i][j]=0
        que=deque()
        que.append((i,j))
        while que:
            i,j=que.popleft()
            ans=max(ans,dist[i][j])
            for ni,nj in (i-1,j),(i,j+1),(i+1,j),(i,j-1):
                if not (0<=ni<H and 0<=nj<W):
                    continue
                if S[ni][nj]=='#' or dist[ni][nj]!=-1:
                    continue
                dist[ni][nj]=dist[i][j]+1
                que.append((ni,nj))

print(ans)


Measured memory_bytes: 9416
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int C500 = Cin();
        int C100 = Cin();
        int C50 = Cin();
        int X = Cin();
        int count = 0;
        for (int i = 0; i <= C500; i++)
        {
            for (int j = 0; j <= C100; j++)
            {
                for (int k = 0; k <= C50; k++)
                {
                    if (500 * i + 100 * j + 50 * k == X) count++;
                    else if (500 * i + 100 * j + 50 * k > X) break;
                }
            }
        }
        Console.WriteLine(count);
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


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

#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define mid(a,b) (a+b)/2
#define pii pair<int,int>

using namespace std;

ll a,b,g,ans;

int main()
{
	cin >> a >> b;	
	g = __gcd(a,b);
	ans = 1;
	for(int i = 2;i <= sqrt(g);i++){
		if(g % i == 0){
			ans++;
			while(g % i == 0)
				g /= i;
		}
	}
	if(g > 1) ans++;
	
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define make make_pair
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
        string s;cin>>s;
	if( (s[0]==s[1])||(s[1]==s[2])||(s[2]==s[3]) )
	cout<<"Bad"<<endl;
	else
	cout<<"Good"<<endl;
}

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

using namespace std;

vector<int> a;
bool visited[100000];

int dfs(int v, int d) {
	if (visited[v]) return -1;
	if (v == 1) return d;
	visited[v] = true;
	return dfs(a[v], d + 1);
}

int main(int argc, char *argv[]) {
	int N;
	cin >> N;

	a = vector<int>(N);
	for (int i = 0; i < N; i++) {
		int ai;
		cin >> ai;
		a[i] = ai - 1;
	}


	int ans = dfs(0, 0);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstring>
#include <map>
using namespace std;
typedef pair<int,int>PAIR;//cost/pos
int main(){
	int N,M;
	while(cin>>N,N){
		cin>>M;
		int ans=0,cnt=0;
		bool flag[100]={0};
		int load[100][100];
		memset(load,-1,sizeof(load));
		for(int i=0,A,B,C;i<M;i++){
			scanf("%d,%d,%d",&A,&B,&C);
			C=C/100-1;
			load[A][B]=load[B][A]=C;
		}
		priority_queue<PAIR,vector<PAIR>,greater<PAIR> > Q;
		Q.push(make_pair(0,0));
		for(int now,cost;!Q.empty();){
			cost=Q.top().first;
			now=Q.top().second;
			Q.pop();
			if(flag[now]==0){
				flag[now]=1;
				ans+=cost;
				cnt++;
				for(int i=0;i<N;i++)if(load[now][i]>0&&flag[i]==0)Q.push(make_pair(load[now][i],i));
			}
			if(cnt==N)break;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1396
#include <stdio.h>

int main(void)
{
	int values[10],i;
	for(i=0 ; i < 10 ; i++)
	{
		scanf("%d",&values[i]);
	}
	sort_0001(values);
	for(i=9;i>6;i--)
	{
		printf("%d\n",values[i]);
	}
	return 0;
}

void sort_0001(int values[])
{
	int i,count=10;
	while(count > 1)
	{
		for(i=1;i<count;i++)
		{
			if(values[i] < values[i-1])
			{
				int value_2 = values[i-1];
				values[i-1] = values[i];
				values[i] = value_2;
			}
		}
		count--;
	}
	return;
}

Measured memory_bytes: 600
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func main() {
	io := NewIo()
	defer io.Flush()

	N := io.NextInt()
	H := make([]int, N)
	for i := 0; i < N; i++ {
		H[i] = io.NextInt()
	}

	total := 0
	big := 0
	for i := range H {
		if H[i] >= big {
			total++
			big = H[i]
		}
	}

	io.PrintLn(total)
}


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

//#define FILE_INPUT
//#define DEBUG_MODE

int dp[100000];
int h[100000];

int main()
{
#ifdef FILE_INPUT
	ifstream in("test3.txt");
	cin.rdbuf(in.rdbuf());
#endif	/* FILE_INPUT */  
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> h[i];
	}

	dp[0] = 0;
	for (int i = 1; i < n; ++i) {
		int cost = dp[i - 1] + abs(h[i - 1] - h[i]);
		if (i >= 2) {
			int cost2 = dp[i - 2] + abs(h[i - 2] - h[i]);
			if (cost2 < cost) {
				cost = cost2;
			}
		}
		dp[i] = cost;
	}
	cout << dp[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 1024
a, b, c, k=input().split()
a=int(a)
b=int(b)
c=int(c)
k=int(k)
ans=0

if a>0 and k>0 and a<=k:
  k=k-a
  ans=ans+a
elif a>0 and k>0 and a>k:
  ans=ans+k
  k=0

if b>0 and k>0 and b<=k:
  k=k-b
elif b>0 and k>0 and b>k:
  k=0
  
if c>0 and k>0 and c<=k:
  k=k-c
  ans=ans-c
elif c>0 and c>0 and c>k:
  ans=ans-k
  k=0

  
print(ans)

Measured memory_bytes: 9256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        if (a > b){
            System.out.println("a > b");
        }
        else if (a < b){
            System.out.println("a < b");
        }
        else{
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26208
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T
import Data.List (group)

main :: IO ()
main = do
  let
    f :: Int -> Int -> Int
    f k m = (2 * k) `min` (m - 1)
  [n, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  ds <- map ('R' ==) . takeWhile (`elem` "LR") <$> getContents :: IO [Bool]
  let
    (m, s) = ((,) <$> length <*> sum . map (pred . length)) . group $ ds :: (Int, Int)
  print $ s + f k m

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n*n,sizeof(int));
  int i;
  for(i=0;i<n*n;i++) scanf("%d",a+i);
  int64 *dp=(int64 *)calloc(1<<n,sizeof(int64));
  for(i=1;i<(1<<n);i++){
    int64 local=0;
    for(int j=0;j<n;j++){
      if(((i>>j)&1)==0) continue;
      for(int k=j+1;k<n;k++){
	if(((i>>k)&1)==0) continue;
	local+=a[j*n+k];
      }
    }
    for(int j=(i-1)&i;j>0;j=(j-1)&i){
      local=MAX(local,dp[j]+dp[j^i]);
    }
    dp[i]=local;
  }
  printf("%lld\n",dp[(1<<n)-1]);
}

int main(void){
  run();
  return 0;
}


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

int main() {
	string x;
	int counter=0;
	cin >> x;
	for (size_t i = 0; i < x.size(); i++)
	{
		if (x[i]!=x[x.size()-1-i])
		{
			counter++;
		}
	}
	cout << counter / 2;
}

Measured memory_bytes: 256
n, x = list(map(int, input().split()))
lista = list(map(int, input().split()))

lista.sort()

snack = 0

for i in range(n):
  if lista[i] + snack <= x:
    snack += lista[i]
  else:
    print(i)
    break
else:
  if snack == x:
    print(n)
  else:
    print(n - 1)

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

int main() {
    int n;
    
    cin >> n;
    vector<int> p(n+1);
    for(int i = 1; i <= n; i++) {
        cin >> p[i];
    }

    vector<long long> a(n+1);
    vector<long long> b(n+1);
    vector<long long> r(n+1);

    for(int i = 1; i <= n; i++) {
        r[p[i]] = i;
    }

    for(int i = 1; i <= n; i++) {
        a[i] = 30000 * i;
    }

    for(int i = 1; i <= n; i++) {
        b[i] = 30000 * (n - i) + r[i];
    }

    for(int i = 1; i <= n; i++) {
        if(i != 1) {
            cout << " ";
        }
        cout << a[i];
    }
    cout << endl;

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

    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
int main()
{
    int n;
    cin>>n;
    int tot=0;
    int zero=105;
    for(int i=0,tmp;i<n;i++)
    {
        cin>>tmp;
        tot+=tmp;
        if(tmp%10!=0)
            zero=min(tmp,zero);
    }
    if(tot%10==0)
    {
        if(zero==105)
            tot=0;
        else tot-=zero;
    }
    cout<<tot<<'\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int N, C, K, T[100001], b_cnt=1, p_cnt=1, tmp=0;
  cin >> N >> C >> K;
  for(int i=0; i<N; i++){
    cin >> T[i];
  }

  sort(T, T+N);
  tmp = T[0];
  for(int i=1; i<N; i++){
    if(tmp+K < T[i] || p_cnt >= C){
      b_cnt++;
      p_cnt=1;
      tmp=T[i];
    }else p_cnt++;
  }

  cout << b_cnt << endl;
  return 0;
}

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

int main() {
	// your code goes here
	
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	string s,t;
	
	cin>>s>>t;
	
	string ans,c;
	ans="";
	
	char dp[s.length()+1][t.length()+1];
	vector<vector<int>>l(s.length()+1,vector<int>(t.length()+1,0));
	
	int i,j;
	for(i=0;i<s.length();i++)
	{
	    for(j=0;j<t.length();j++)
	    {
	        if(s[i]==t[j])
	        {
	           dp[i+1][j+1]='d'; 
	           l[i+1][j+1]=l[i][j]+1;
	        }
	        
	        else if(l[i][j+1]>l[i+1][j])
	        {
	            dp[i+1][j+1]='l';
	            l[i+1][j+1]=l[i][j+1];
	        }
	        else 
	        {
	            l[i+1][j+1]=l[i+1][j];
	            dp[i+1][j+1]='u';
	        } 
	       
	    }
	}
	
	
	i=s.length();j=t.length();
//	cout<<l[i][j]<<endl;
	while(i>0&&j>0)
	{
	    if(dp[i][j]=='u')
	         j--;
	      else if(dp[i][j]=='d')
	    {
	        c=ans;
	        ans=s[i-1]+c;
	        i--;j--;
	    }
	    else i--;
	}
	
	      
	
	
	
	cout<<ans;
	return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	ll a, b, c;
	cin >> a >> b >> c;
	ll d1 = min(a, c);
	ll ans = d1;
	c -= d1;
	d1 = min(c, b);
	ans += d1 * 2;
	c -= d1;
	b -= d1;
	if (c) {
		ans++;
	}
	ans += b;
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/
ll dp[110][100010]; //i番目までで最大の価値を取る
ll v[110], w[110];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, W;
    cin >> N >> W;
    int sum = 0;
    for (int i = 0; i < N; ++i)
    {
        cin >> w[i] >> v[i];
        sum += v[i];
    }
    for (int i = 0; i < 110; ++i)
    {
        for (int j = 0; j < 100010; ++j)
        {
            dp[i][j] = 1e12;
        }
        dp[i][0] = 0;
    }

    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j <= sum; ++j)
        {
            if (j - v[i] >= 0)
                dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
            else
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        }
    }
    int ans = 0;
    for (int i = 0; i <= sum; ++i)
    {
        if (dp[N][i] <= W)
            ans = max(ans, i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 86272
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int dp[100010];
int main(){
    int n;
    cin >> n;
    vector<int>h(n);
    rep(i,n)cin >> h[i];
    rep(i,n){
        if(i==0)continue;
        if(i==1){
            dp[i] = abs(h[0]-h[1]);
        }else{
            dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

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

int main(){
    int K, S;
    cin >> K >> S;

    int ans = 0;
    for (int X = 0; X <= K; X++)
    {
        for (int Y = 0; Y <= K; Y++)
        {
            int Z = S - X - Y;
            if (Z >= 0 && Z <= K)
            {
                ans++;
            }
            
        }
        
    }
    cout << ans << endl;
    return 0;
}

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

soots = ["S", "H", "C", "D"]

sootlist = []
numlist = []

for i in range(n):
    soot, num = map(str, input().split())
    sootlist.append(soot)
    numlist.append(int(num))

ans_sootlist = []
ans_numlist = []

for soot in soots:
    for num in range(1, 14):
        flag = 0
        for s, n in zip(sootlist, numlist):
            if soot == s and num == n:
                flag = 1
                break
        if flag == 1:
            continue
        else:
            ans_sootlist.append(soot)
            ans_numlist.append(num)

for soot, num in zip(ans_sootlist, ans_numlist):
    print(soot, num)



Measured memory_bytes: 5604
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def cnt(x,A,An,Ap,N,Nz):
    res = 0
    if x >= 0:
        res += N * Nz
    res += np.searchsorted(A,x//Ap,side='right').sum()
    res += N * len(An) - np.searchsorted(A,-(-x//An),side='left').sum()
    res -= np.count_nonzero(A*A<=x)
    return res//2


def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))

    A = np.array(A)
    A.sort()

    An = A[A<0]
    Az = A[A==0]
    Ap = A[A>0]

    Nz = np.count_nonzero(A==0)

    INF = 10 ** 18

    l = - INF - 1
    r = INF

    while r-l > 1:
        m = (l+r)//2
        if cnt(m,A,An,Ap,N,Nz) >= K:
            r = m
        else:
            l = m

    print(r)





main()


Measured memory_bytes: 32288
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

template <typename T>
struct edge
{
    int src, to;
    T cost;
    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};

template <typename T>
using Edges = vector<edge<T>>;

template <typename T>
using WeightedGraph = vector<Edges<T>>;

template <typename T>
using UnweightedGraph = vector<vector<T>>;

template <typename T>
using Matrix = vector<vector<T>>;

// Tarjan's algorithm
// G is a DAG.

void visit(const UnweightedGraph<int> &G, int u, vector<bool> &used, vector<int> &ans)
{
    if (used[u] == false)
    {
        used[u] = true;
        for (auto &v : G[u])
        {
            visit(G, v, used, ans);
        }
        ans.emplace_back(u);
    }
}

vector<int> topological_sort(const UnweightedGraph<int> &G)
{
    const int N = G.size();

    vector<bool> used(N, false);
    vector<int> ans;
    for (int u = 0; u < N; u++)
    {
        visit(G, u, used, ans);
    }

    reverse(ans.begin(), ans.end());

    return ans;
}

int main()
{
    int V, E;
    cin >> V >> E;
    UnweightedGraph<int> G(V);

    for (int i = 0; i < E; i++)
    {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
    }

    auto d = topological_sort(G);

    for (int i = 0; i < V; i++)
    {
        cout << d[i] << endl;
    }
}


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

using namespace std; 
 
#define int long long
#define M 1000000007
 
signed main(){
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	
	int k;
	cin >> k;
	int a,b;
	cin >> a >> b;
	if(a%k==0||b%k==0){
		cout << "OK" << endl;
		
	}
	else if(a/k<b/k){
		cout << "OK" << endl;
	}
	else{
		cout << "NG" << endl;
	}
}


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

typedef long long ll;

const ll maxn = 2e5 + 1e2;
ll val[maxn];

int main(){
	std::ios::sync_with_stdio(false);
	
	ll n;
	std::cin >> n;
	
	ll whole_sum = 0;
	for(ll i = 0; i < n; i++){
		std::cin >> val[i];
		whole_sum += val[i];
	}
	
	ll sum = 0;
	ll best = 1e18;
	
	for(ll i = 0; i < n - 1; i++){
		sum += val[i];
		whole_sum -= val[i];
		best = std::min(best, std::abs(sum - whole_sum));
	}
	
	std::cout << best;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i++)

#define all(v) (v).begin(), (v).end();
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

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

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

    vector<int> dp(n, -1);
    dp[0] = 0;

    rep(i, n) {
        repr(j, i + 1, i + k + 1) {
            if (j >= n) break;
            if (dp[j] == -1)
                dp[j] = dp[i] + abs(h[i] - h[j]);
            else
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }

    cout << dp[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1024
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \   | |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\
 
*/
#include <bits/stdc++.h>
 
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
 
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek
 
const ll ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const ld eps = 1e-7;
const int N = 1e6 + 6, C = 19;
 
int n, a[N], ind[N], mn[2][C + 3][N], cnt, deg[N], lg[N], p[N];
PII val[N];
vector < int > ans, g[N];
set < pair < PII, int > > st;
 
int get(int k, int l, int r) {
    int dd = lg[r - l + 1];
    return min(mn[k][dd][l], mn[k][dd][r - (1 << dd) + 1]);
}
 
void calc(int l, int r, int par) {
    if (l > r) return;
    int posl = ind[get(l & 1, l, r)];
    int posr = ind[get((l & 1) ^ 1, posl + 1, r)];
    //cerr << l << " " << r << " " << posl << " " << posr << " " << par << "\n";
    p[++cnt] = par;
    int cur = cnt;
    g[par].eb(cnt);
 
    val[cnt] = PII(a[posl], a[posr]);
    deg[par]++;
    if (par == 0) {
        st.insert(mkp(PII(a[posl], a[posr]), cnt));
 
    }
    calc(l, posl - 1, cur);
    calc(posl + 1, posr - 1, cur);
    calc(posr + 1, r, cur);
}
 
int main() {
	ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
 
    cin >> n;
    forn(i, 1, n) {
        cin >> a[i];
        ind[a[i]] = i;
    }
 
    forn(i, 1, n) mn[0][0][i] = ((i & 1) ? oo : a[i]);
    forn(i, 1, n) mn[1][0][i] = ((i % 2 == 0) ? oo : a[i]);
 
    forn(i, 2, n + 1) lg[i] = lg[i >> 1] + 1;
    forn(i, 1, C)
        forn(j, 1, n - (1 << i) + 1)
            forn(k, 0, 1) mn[k][i][j] = min(mn[k][i - 1][j], mn[k][i - 1][j + (1 << (i - 1))]);
 
    deg[0] = oo;
    calc(1, n, 0);
 
    while (sz(st)) {
        pair < PII, int > v = *st.begin();
        st.erase(st.begin());
        cerr << v.F.F <<" "  << v.F.S << " " << sz(g[v.S]) << "\n";
        ans.eb(v.F.F);
        ans.eb(v.F.S);
        for (auto it : g[v.S]) {
            st.insert(mkp(val[it], it));
        }
    }
 
    for (auto it : ans) cout << it << " ";
    cout << "\n";
 
	return 0;
}

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

using namespace std;

int main()
{
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (auto &x : a)
    {
        cin >> x;
    }
    long long ans = 0;
    for (long long i = 0; i < n; i++)
    {
        if (a[i] == i + 1)
        {
            if (i == n - 1)
            {
                swap(a[i], a[i - 1]);
                ans++;
                break;
            }
            swap(a[i], a[i + 1]);
            ans++;
            if (a[i + 1] == i + 2)
            {
                i++;
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
  cout << fixed << setprecision(12);
  
  double r; //rは実数
  cin>>r;

  double PI = acos(-1); //cos(π) ＝ -1 -> acos (-1) = π
  double area = r * r * PI;
  double cir = (r + r ) * PI;
  cout<<area<<" "<<cir<<endl;

  return 0;
}

 



Measured memory_bytes: 3276
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    }
}

Measured memory_bytes: 26196
n=int(input())
h=list(map(int,input().split()))
ans=0
now=0
for i in range(1,n):
  if h[i]<=h[i-1]:
    now+=1
  else:
    if now>ans:
      ans=now
    now=0
if now>ans:
  ans=now
print(ans)

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

#define DEBUG

#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

//#define int long long
typedef long long ll;
//constexpr int INF = 1e9;
//constexpr int MOD = 1000000007;

int note[201][201];

int mygcd(int a, int b, int c) {
    const int tmp = gcd(b, c);
    if (note[a][tmp] == 0) {
        note[tmp][a] = note[a][tmp] = gcd(a, tmp);
    }
    return note[a][tmp];
}

decltype(1) main() {
    //cin.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    int k;
    cin >> k;
    ll ans = 0;
    for (int a = 1; a <= k; ++a) {
        for (int b = 1; b <= k; ++b) {
            for (int c = 1; c <= k; ++c) {
                ans += mygcd(a, b, c);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3792
#include<bits/stdc++.h>
#define mp make_pair
// #define pb push_back
#define ll long long
#define endl "\n"
using namespace std;



void solve(){
	ll a,b,c;
	cin>>a>>b>>c;
	if(b*c>=a){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

int main() {
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}




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


int main()
{
    int n, m, tmp, acs = 0, pns = 0;
    string stmp;
    cin >> n >> m;
    vector<int> ac(n), pn(n);

    for(int i = 0; i < m; ++i)
    {
        cin >> tmp >> stmp;
        tmp--;
        if(ac[tmp])
            continue;
        if(stmp == "AC")
            ac[tmp] = 1;
        else if(stmp == "WA")
            pn[tmp]++; 
    }

    for(int i = 0; i < n; ++i)
    {
        acs += ac[i];
        if(ac[i]) pns += pn[i];
    }

    cout << acs << " " << pns << "\n";
    return 0;
}

Measured memory_bytes: 4000
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define mian main
#define Max(x,y) (x>y ? x : y)
#define Min(x,y) (x<y ? x : y)
typedef long long ll;

int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int cnt;
	while(n)
	{
		n/=k;
		cnt++;
	}
	printf("%d",cnt);
	return 0;
}











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

int main()
{
    
    int N, K;
    int H[200010];
    cin >> N >> K;
    for(int i=0;i<N;i++)
        cin >> H[i];
    if(N <= K)
        cout << 0 << endl;
    else
    {
        sort(H, H+N);
        long ans = 0;
        for(int i=0;i<(N-K);i++)
            ans += H[i];
        cout << ans <<  endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
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;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  long X;
  cin >> X;
  long res = 0;

  res += X / 500 * 1000;
  X %= 500;
  res += X / 5 * 5;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
        int n = sc.nextInt();
        int t[] = new int[n];
        int count = 0;
        for(int i = 0;i < n;i++){
          t[i] = sc.nextInt();
          count += t[i];
        }
      
     	int m = sc.nextInt();
        int p[] = new int[m];
        int x[] = new int[m];
        int ans[] = new int[m];
        for(int i = 0;i < m;i++){
          p[i] = sc.nextInt();
          x[i] = sc.nextInt();
          ans[i] = t[p[i] - 1] - x[i];
        }

        
        for(int i = 0;i < m;i++){
          System.out.println(count - ans[i]);
        }
    }
}

Measured memory_bytes: 36208
//====== begin of bisma c++ template===========
#include<bits/stdc++.h>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define ll long long 
#define sum(a,b) a=a+b
#define mem(a, b) memset(a, (b), sizeof(a))


//=======binarysearch===========
int bs(vector<long long>&a,int que){
 auto it=lower_bound(a.begin(),a.end(),que);
 if(*it==que){
    return it-a.begin();
 }
 return -1;
}
//========binarysearch=========



//=======SUBSET WITH BRUTEFORCE=============
void subsets(int S[], int n) {
     int nSub = 1<<n; 
     for(int i=0; i<nSub; i++){
     	  cout<<"{ ";//optional
          for(int k=0; k<n; k++){
               //if the k-th bit is set
               if( (1<<k) & i){
                    cout<<S[k]<<" ";
               } 
          }
          cout<<"}\n"; //optional
     }
}
//======SUBSET WITH BRUTE FORCE================


//======permuatate all ==================
void permutate(){
int n,x;
cin>>n;

vector<int> permutation;
for (int i = 0; i < n; i++) {
	cin>>x;
permutation.push_back(x);
}
do {
 rep(i,0,n-1) cout<<permutation[i];
 cout<<endl;
} while (next_permutation(permutation.begin(),permutation.end()));

}
//====permuatate all======================


//====check prime =========================

bool prime(ll x){
	ll ans=0;

	if(x==1){
		return false;
	}

	for(ll i=2;i<=sqrt(x);i++){
		if(x % i == 0){
			return false;
		}
	}

	return true;
}
//===check prime ========================


//======= the end of bisma c++ template ============

ll arr[100];


int main(){

ll a,b;
cin>>a>>b;


cout<<(b-a)*(b-a+1)/2 -b;


return 0;
}


Measured memory_bytes: 256