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

using namespace std;

struct Item {
    int value;
    int weight;
};

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

    array<int, 10001> value_to_weight;
    value_to_weight.fill(numeric_limits<int>::max());
    value_to_weight[0] = 0;
    
    for (int i = 0; i < n; ++i) {
        int value, weight;
        cin >> value >> weight;
        for (int total_value = 10000; total_value >= value; --total_value) {
            if (value_to_weight[total_value - value] == numeric_limits<int>::max())
                continue;
            value_to_weight[total_value] =
                min(value_to_weight[total_value],
                    weight + value_to_weight[total_value - value]);
        }
    }
    int max_value = 0;

    for (int total_value = 0; total_value <= 10000; ++total_value) {
        if (value_to_weight[total_value] <= w &&
            total_value > max_value) max_value = total_value;
    }
    cout << max_value << endl;
}



Measured memory_bytes: 3120
S = input()

g = 0
p = 0
cnt = 0
for s in S:
    if s == 'g':
        if g > p:
            p += 1
            cnt += 1
        else:
            g += 1
    else:
        if g > p:
            p += 1
        else:
            g += 1
            cnt -= 1

print(cnt)


Measured memory_bytes: 39664
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
        new Main().run();
    }
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
			int y = scan.nextInt();
			int bank = 0;
			double max = 0;
			int a;
			int r;
			int t;
			double sum = 0;
			for(int i = 0;i < n;i++){
				a = scan.nextInt();
				r = scan.nextInt();
				t = scan.nextInt();
				if(t == 1){
					sum = 1.0 + 0.01 * (double)(y * r);
				}else if(t == 2){
					sum = Math.pow(1.0+(0.01*(double)r),y);
				}
				if(sum > max){
					max = sum;
					bank = a;
				}
			}
			System.out.println(bank);
		}
	}
}

Measured memory_bytes: 35664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#define int long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int mod = 1e9+7;
char a[7][7];
int32_t main(){
	#ifndef ONLINE_JUDGE
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif

	int n,m,k;
	cin>>n>>m>>k;
	int tot = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin>>a[i][j];
			tot += (a[i][j] == '#');
		}
	}

	vector<int> r(n, 0), c(m, 0);
	for(int i = 0; i < n; i++){
		// int cnt = 0;
		for(int j = 0; j < m; j++){
			r[i] += (a[i][j] == '#');
		}
		// cout<<r[i]<<" ";
	}
	// cout<<"\n";

	for(int i = 0; i < m; i++){
		for(int j = 0; j < n; j++){
			c[i]+= (a[j][i]=='#');
		}
		// cout<<c[i]<<" ";
	}
	// cout<<"\n";
	int cnt = 0;
	for(int x = 0; x < (1<<n); x++){
		for(int y = 0; y < (1<<m); y++){
			vector<int> R, C;
			for(int i = 0; i < n; i++){
				if(x&(1<<i))
					R.push_back(i);
			}
			for(int j = 0; j < m; j++){
				if(y&(1<<j))
					C.push_back(j);
			}

			int ans = 0;
			for(int i = 0; i < R.size(); i++)
				ans += r[R[i]];
			for(int i = 0; i < C.size(); i++)
				ans += c[C[i]];

			for(auto i: R){
				for(auto j: C)
					ans -= (a[i][j] == '#');
			}


			if(tot-ans == k){

				// cout<<"(x,y)"<<x<<" "<<y<<"\n";
				// cout<<"ans:"<<ans<<"\n";
				cnt++;
				// cout<<"Rows:";
				// for(auto i: R)
					// cout<<i+1<<" ";
				// cout<<"\n";
				// cout<<"Cols:";
				// for(auto i: C)
					// cout<<i+1<<" ";
				// cout<<"\n";
			}
		}
	}

	cout<<cnt<<"\n";
	return 0;
}

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

int main() {
    int N;cin>>N;
    string S;cin>>S;
    int ans=0;
    for (int i = 0; i < N-2; i++){
        if(S.substr(i,3)=="ABC")ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
s = input() + '*'

ans = 0
before_s = s[0]
i = 1

while i < len(s):
    if s[i] == before_s:
        # print('hi',before_s, s[i:i+2])
        before_s = s[i:i+2]
        ans += 1
        i += 2
    else:
        # print(i, before_s, s[i])
        before_s = s[i]
        ans += 1
        i += 1

print(ans)

Measured memory_bytes: 3500
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <math.h>
#include <functional>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
int main(){
    int n, k;
    cin >> n >> k;
    str s;
    cin >> s;
    s[k - 1] += 32;
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3612
using System;
using System.Collections.Generic;

namespace AtCoder_CSharp
{
    class AtCoder
    {
        static void Main(string[] args)
        {
            int N, L;
            string[] input = Console.ReadLine().Split(' ');
            int taste = 0;           

            N = int.Parse(input[0]);
            L = int.Parse(input[1]);

            int zeronear = L;

            for (int i = 0; i < N; i++)
            {
                taste += L + i;

                if (Math.Abs(zeronear) > Math.Abs(L + i))
                {
                    zeronear = L + i;
                }

            }
            
            taste -= zeronear;

            Console.WriteLine(taste);

        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
int main() {
    int N, M;
    cin >> N >> M;
    int a[51], b[51];
    int c[51], d[51];
    int min_point[51];
    for(int i = 0; i < N; i++) cin >> a[i] >> b[i];
    for(int i = 0; i < M; i++) cin >> c[i] >> d[i];

    for(int i = 0; i < N; i++){
        int min = 400000000;
        for(int j = 0; j < M; j++){
            if(min > abs(a[i]-c[j])+abs(b[i]-d[j])){
                min_point[i] = j;
                min = abs(a[i]-c[j])+abs(b[i]-d[j]);
            }
        }
    }
    for(int i = 0; i < N; i++) cout << min_point[i]+1 << endl;
    return 0;
}

Measured memory_bytes: 3584
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

bool IsPalindromicNumber(int num)
{
    string s = to_string(num);
    for (int i = 0; i < SZ(s)/2; ++i)
    {
        if (s[i] != s[(SZ(s)-1) - i])
        {
            return false;
        }
    }
    return true;
}

int main()
{
    optimize_cin();

    int A, B;
    cin >> A >> B;

    int count = 0;
    for (int i = A; i <= B; ++i)
    {
        count += (int)IsPalindromicNumber(i);
    }

    cout << count << "\n";

    return 0;
}


Measured memory_bytes: 256
import sys
from itertools import combinations

input = sys.stdin.readline


def main():
    N = int(input())
    S = [""] * N
    for i in range(N):
        S[i] = input().rstrip()

    count = dict(M=0, A=0, R=0, C=0, H=0)
    for s in S:
        if s[0] in "MARCH":
            count[s[0]] += 1

    ans = 0
    for c in combinations("MARCH", 3):
        ans += count[c[0]] * count[c[1]] * count[c[2]]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9716
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
int N, K, Q;
vector<int>A;





//サブ関数
//入力
void input()
{
	cin >> N >> K >> Q;
	A.resize(N);
	REP(i, N)cin >> A[i];
}

vector<vector<int>> slash(vector<int> A, int base)
{
	vector<vector<int>> res;
	vector<int> mid;
	REP(i, N) {
		if (A[i] >= base)mid.push_back(A[i]);
		else {
			res.push_back(mid);
			mid.clear();
		}
	}
	if (!mid.empty())res.push_back(mid);

	return res;
}

int X_Y(const vector<vector<int>> vv, int K,int Q) {
	vector<int> minimum;
	for (auto v : vv) {
		sort(v.begin(), v.end(),greater<int>());
		while (v.size() >= K) {
			minimum.push_back(v.back());
			v.pop_back();
		}
	}
	if (minimum.size() < Q)return INF;

	sort(minimum.begin(), minimum.end());
	return minimum[Q - 1] - minimum[0];
}

//計算
void calc()
{
	priority_queue<int,vector<int>,greater<int>> pq;
	for (auto num : A)pq.push(num);

	int ans = INF;
	while (!pq.empty()) {
		int base = pq.top(); pq.pop();
		auto vv = slash(A, base);
		int tmp = X_Y(vv, K, Q);
		if (tmp == INF)break;
		ans = min(ans,tmp);
	}
	cout << ans << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 384
#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() {
    ll n;
    cin >> n;
    
    vector<pair<ll, int>> fs;
    for(ll i = 2; i*i <= n; ++i) {
        int x = 0;
        while (n%i == 0) {
            n /= i;
            ++x;
        }
        fs.emplace_back(i, x);
    }
    if(n != 1) fs.emplace_back(n, 1);

    int ans = 0;
    for(auto f : fs) {
        int b = 1;
        while(f.second - b >= 0) {
            f.second -= b;
            b++;
            ans++;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 19780
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main(){

    int x,y;
    cin>>x>>y;
    for(int i=0; i<=x; i++){
        if((i*4)+((x-i)*2)==y){
            cout<<"Yes";
            return 0;
        }
    }   cout<<"No";

    
}


Measured memory_bytes: 3560
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        if (s.equals("A")) System.out.println("T");
        if (s.equals("T")) System.out.println("A");
        if (s.equals("C")) System.out.println("G");
        if (s.equals("G")) System.out.println("C");
        sc.close();
    }
}

Measured memory_bytes: 22996
N,S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [ [0]*(S+1) for i in range(N+1)]
dp[0][0] = 1

for i in range(N):
  for j in range(S+1):
    dp[i+1][j] += 2 * dp[i][j]
    dp[i+1][j] %= mod
    if j+A[i] <= S:
      dp[i+1][j+A[i]] += dp[i][j]
      dp[i+1][j+A[i]] %= mod

print(dp[N][S])

Measured memory_bytes: 139260
n=int(input())
build,story,room,people=[],[],[],[]
for i in range(n):
    date=list(map(int,input().split(' ')))
    build.append(date[0])
    story.append(date[1])
    room.append(date[2])
    people.append(date[3])
build1=[[0 for i in range(10)] for j in range(3)]
build2=[[0 for i in range(10)] for j in range(3)]
build3=[[0 for i in range(10)] for j in range(3)]
build4=[[0 for i in range(10)] for j in range(3)]
for i in range(n):
    m=int(i)
    if(build[m]==1):
        build1[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    elif(build[m]==2):
        build2[story[m]-1][room[m]-1]=build2[story[m]-1][room[m]-1]+people[m]
    elif(build[m]==3):
        build3[story[m]-1][room[m]-1]=build3[story[m]-1][room[m]-1]+people[m]
    else:
        build4[story[m]-1][room[m]-1]=build4[story[m]-1][room[m]-1]+people[m]

for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build1[i]))))
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build2[i]))) )
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build3[i]))) )
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build4[i]))) )


Measured memory_bytes: 5632
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 100000007)
	sc.Split(bufio.ScanWords)
	var s string
	var n int
	var k int
	var c int
	fmt.Scan(&n)
	fmt.Scan(&k)
	fmt.Scan(&c)
	fmt.Scan(&s)
	l := make([]int, k)
	r := make([]int, k)

	for i, j := 0, 0; i < n && j < k; i++ {
		if string(s[i]) == "o" {
			l[j] = i
			i += c
			j++
		}
	}

	for i, j := n-1, k-1; i >= 0 && j >= 0; i-- {
		if string(s[i]) == "o" {
			r[j] = i
			i -= c
			j--
		}
	}

	for i := 0; i < k; i++ {
		if l[i] == r[i] {
			fmt.Println(l[i] + 1)
		}
	}
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector <int> hako(N);
  for(int i=0;i<N;i++){
    cin >> hako[i];
  }
  sort(hako.begin(),hako.end());
  int A = hako[N/2-1];
  int B = hako[N/2];
  cout << B-A << endl;
}

Measured memory_bytes: 3788
///Thu Thaoo
/// Problem A ><

#include <bits/stdc++.h>

#define ll long long
#define I freopen(Task".inp", "r", stdin)
#define O freopen(Task".out", "w", stdout)
#define vt vector <int>
#define rt(O) return O
#define pii pair <int, int>
#define st first
#define nd second
#define rd third
#define th fourth
#define pusf push_front
#define popf pop_front
#define popb pop_back
#define pusb push_back
#define Task "A"
#define MOD 1000000007
#define uns unsigned
#define int ll
#define read_fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define FORU(i, l, n) for (int i=l; i<=n; i++)
#define FORD(i, n, l) for (int i=n; i>=l; i--)
#define reset(x) memset (x, 0, sizeof(x)
#define ignLine cout<<endl

using namespace std;

const int N = 5e5 + 3;

int nn[N], dem = 0;
vector <int> ke[N];
int bac[N];
string S;
int res = 0;

void DFS(int u)
{
    for (int v : ke[u])
    {
        bac[v] = max(bac[v], bac[u]+1);
        DFS(v);
    }
}
main()
{
    read_fast;
//    I;
//    O;
    cin>>S;
//    a[0] = 0;
    for (int i = 0; i<=S.size(); i++)
    {
        if (S[i] == '<' && i == 0)
        {
            bac[i] = 0;
            nn[++dem] = i;
        }
        else if (S[i] == '>' && S[i+1] == '<')
        {
            bac[i] = 0;
            nn[++dem] = i+1;
        }
        else if (S[i-1] == '>' && i == S.size())
        {
            bac[i] = 0;
            nn[++dem] = i;
        }
    }
    for (int i=0; i<S.size(); i++)
    {
        if (S[i] == '>') ke[i+1].pusb(i);
        else ke[i].pusb(i+1);
    }
    for (int i=1; i<=dem; i++) DFS(nn[i]);
    for (int i=0; i<=S.size(); i++) res += bac[i];
    cout<<res;
    rt(0);
}


Measured memory_bytes: 48412
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i=0; i<N; i++) cin >> S[i];
  map<string, int> result;
  for (string s : S) {
    if (result.count(s)) result[s]++;
    else result[s] = 1;
  }
  vector<string> list = {"AC", "WA", "TLE", "RE"};
  for (string l : list) {
    cout << l << " x " << result[l] << endl;
  }
}

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

int main() {
	int n, r;
	while(cin >> n >> r) {
		if(n == 0 && r == 0)
			break;
		vector<int> a(n);
		
		for(int i = 0; i < n; i++) {
			a[i] = n-i;
		}
		for(int i = 0; i < r; i++) {
			int p, c;
			cin >> p >> c;
			rotate(a.begin(), a.begin()+p-1, a.begin()+p+c-1);
			//for(int j = 0; j < n; j++) {
			//	cout << a[j] << ",";
			//}
			//cout << endl;
		}
		cout << a[0] << endl;
	} 
	return 0;
}

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

struct edge {
    int to, cost;
};

using edges = vector<edge>;
using graph = vector<edges>;

using pii = pair<int, int>;

void dfs1(int v, int prev, graph const& g, vector<int>& d) {
    for(auto& e : g[v]) {
        if(e.to == prev) {
            continue;
        }
        dfs1(e.to, v, g, d);
        d[v] = max(d[v], d[e.to] + e.cost);
    }
}

int dfs2(int v, int d_par, int par, graph const& g, vector<int> const& d) {
    vector<pii> d_child;
    d_child.emplace_back(0, -1);
    for(auto& e : g[v]) {
        if(e.to == par) {
            d_child.emplace_back(d_par + e.cost, e.to);
        } else {
            d_child.emplace_back(e.cost + d[e.to], e.to);
        }
    }
    sort(d_child.rbegin(), d_child.rend());

    int res = d_child[0].first + d_child[1].first;
    for(auto& e : g[v]) {
        if(e.to == par) {
            continue;
        }
        if(d_child[0].second == e.to) {
            res = max(res, dfs2(e.to, d_child[1].first, v, g, d));
        } else {
            res = max(res, dfs2(e.to, d_child[0].first, v, g, d));
        }
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    graph g(N);
    for(int i = 0; i < N - 1; ++i) {
        int s, t, w;
        cin >> s >> t >> w;
        g[s].push_back(edge{t, w});
        g[t].push_back(edge{s, w});
    }
    vector<int> d(N);
    dfs1(N / 2, -1, g, d);
    cout << dfs2(N / 2, 0, -1, g, d) << endl;
}


Measured memory_bytes: 18988
#include<cstdio>

#define ran 202202

int n;
int a[ran], b[ran];
int v[ran], lv;

int main() {
	scanf("%d", &n);
	for(int i=1;i<=n;i++) scanf("%d", &a[i]);
	lv = 0;
	for(int i=n;i>0;i--) {
		b[i] = a[i];
		for(int j=i+i;j<=n;j+=i)
			b[i] ^= b[j];
		if (b[i]>0) v[lv++] = i;
	}
	printf("%d\n", lv);
	for(int i=lv-1;i>=0;i--)
		printf("%d%c", v[i], i>0 ? ' ' : '\n');
	
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  string s,t; cin >> s >> t;
  cout << t+s << endl;
  return 0;
}

Measured memory_bytes: 256
k, s = gets.to_s.chomp.split(' ').map(&:to_i)

x = 0
y = 0
z = 0
result = 0

while x <= k
    y = 0
    while y <= k
       z = s - x - y 
       if z >= 0 && z <= k && x + y + z == s
           result += 1
       end
        y += 1
    end
    x += 1
end

puts result

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main()
{
vector<int> hoge;
ll n,a=2;
cin >> n;
while(true){
if(n%abs(a)!=0){
    n=n-a/2;
    hoge.push_back(1);;a=a*(-2);
    }
else {hoge.push_back(0);a=a*(-2);}
if(n==0)break;
}
rep(i,hoge.size()){
    cout<<hoge[hoge.size()-1-i];
}
return 0;
}





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

using namespace std;

typedef long long ll;

const int N = 100100;

int b[N], w[N];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    w[1] = 1;
    for (int i = 2; i <= n; ++i) {
        b[i] = 1;
    }
    while (m--) {
        int x, y;
        cin >> x >> y;
        if (!b[x]) {
            --w[x];
            ++w[y];
        } else {
            --b[x];
            if (!w[x]) {
                ++b[y];
            } else {
                ++w[y];
            }
        }
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (w[i]) {
            ++ans;
        }
    }
    cout << ans;
    return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

class Prime {
public:
    Prime(ll n) {
        mPrimeTbl.clear();
        vector<bool> u(n, false);
        for (ll i = 2; i <= n; ++i) {
            if (u[i])
                continue;
            mPrimeTbl.push_back(i);
            for (ll p = i; p <= n; p += i)
                u[p] = true;
        }
    }

    ~Prime() {}

    ll num() {
        return static_cast<ll>(mPrimeTbl.size());
    }

    ll get(ll index) {
        return mPrimeTbl[index];
    }

private:
    vector<ll> mPrimeTbl;
};

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

    Prime prime(100000);
    cout << N << ":";
    REP(i, prime.num()) {
        ll p = prime.get(i);
        while (N % p == 0) {
            cout << " " << p;
            N /= p;
        }
    }

    if (N > 1)
        cout << " " << N;
    cout << endl;

    return 0;
}


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

char n1[100], n2[100], ans[100];

void reverse(char n[100], int l, int r){
  if(l>=r)return;
  swap(n[l], n[r]);
  reverse(n, l+1, r-1);
}

void sum(int n, int m){
  int x1=(n>=strlen(n1) ? 0 : n1[n]-'0');
  int x2=(n>=strlen(n2) ? 0 : n2[n]-'0');
  int tmp=x1+x2+m;
  if(n==100 || (n>=strlen(n1) && n>=strlen(n2) && m==0))return;
  ans[n]=tmp%10+'0';
  sum(n+1, tmp/10);
}

int main(){
  int n;
  scanf("%d", &n);
  for(int i=0; i<n; i++){
    fill(ans, ans+99, '\0');
    scanf("%s", n1); scanf("%s", n2);
    reverse(n1, 0, strlen(n1)-1);
    reverse(n2, 0, strlen(n2)-1);
    sum(0, 0);
    if(strlen(ans)>80) printf("overflow\n");
    else{
      reverse(ans, 0, strlen(ans)-1);
      printf("%s\n", ans);
    }
  }

  return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=100005;
int head[maxn],t[maxn<<1],ne[maxn<<1],num,n;
bool godie=0;
inline void addedge(int x,int y){
	ne[++num]=head[x];head[x]=num;t[num]=y;
	ne[++num]=head[y];head[y]=num;t[num]=x;
}
inline bool dfs(int x,int f){
	bool res=1;
	forE(i,x)if(t[i]!=f){
		if(dfs(t[i],x)){
			if(res==0)godie=1;
			res^=1;
		}
	}return res;
}
int main(){
	read(n);rep(i,1,n)head[i]=-1;
	rep(i,1,n-1){
		int x,y;read(x);read(y);
		addedge(x,y);
	}
	if(dfs(1,-1)||godie)puts("First");
	else puts("Second");
	return 0;
}


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

#define ll long long

ll N, K;

int main()
{
	//ios::sync_with_stdio(0); cin.tie(0);
	scanf("%lld %lld", &N, &K);
	N %= K;
	printf("%lld", min(N, abs(N-K)));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    if (n==1&&k==1) {
        cout<<"YES"<<endl;
    } else if (n<=k) {
        cout<<"NO"<<endl;
    } else {
        int count=0;
        for (int i=1;i<=n;i+=2) {
            count++;
        }
        if (count>=k) {
            cout<<"YES"<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
}

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

using namespace std;

int main ()
{
    string S,T;
    cin >> S >> T;

    int i,cnt=0;

    for(i=0;i<3;i++){
    if(S[i] == T[i])
    cnt++;
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3600
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()
	{
		int N = Int32.Parse(Console.ReadLine());
		
		int[] H = new int[N];
		string[] args = Console.ReadLine().Split(' ');
		for(int i = 0; i < N; i++)
			H[i] = Int32.Parse(args[i]);
		
		int result = 1;
		int max = H[0];
		for(int i = 1; i < N; i++)
		{
			if(H[i] >= max)
			{
				result++;
				max = Math.Max(max,H[i]);
			}			
		}
			
		Console.WriteLine(result);
	}	
}





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

const int NIL = -1;

struct Node
{
        int parent, left, right;
        Node() : parent(NIL) {}
};

template < typename T > inline void chmax(T &a, T b) { a = max(a, b); }

int main()
{
        int n;
        Node node[33];

        cin >> n;
        for ( int i = 0; i < n; i++ ) {
                int u, l, r;
                cin >> u >> l >> r;

                node[u].left = l;
                node[u].right = r;
                if ( l != NIL ) node[l].parent = u;
                if ( r != NIL ) node[r].parent = u;
        }
        
        function < void(int) > pre = [&](int v)
        {
                cout << " " << v;
                if ( node[v].left != NIL )  pre(node[v].left);
                if ( node[v].right != NIL ) pre(node[v].right);
        };
        function < void(int) > in = [&](int v)
        {
                if ( node[v].left != NIL )  in(node[v].left);
                cout << " " << v;
                if ( node[v].right != NIL ) in(node[v].right);
        };
        function < void(int) > post = [&](int v)
        {
                if ( node[v].left != NIL )  post(node[v].left);
                if ( node[v].right != NIL ) post(node[v].right);
                cout << " " << v;
        };
        
        for ( int i = 0; i < n; i++ ) {
                if ( node[i].parent == NIL ) {
                        cout << "Preorder" << endl;
                        pre(i); cout << endl;
                        cout << "Inorder" << endl;
                        in(i); cout << endl;
                        cout << "Postorder" << endl;
                        post(i); cout << endl;
                        break;
                }
        }

        return ( 0 );
}



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

int main(){
    ll N,K;
    cin >> N;
    string S;
    cin >> S >> K;
    K--;
    for(ll i = 0; i < N; i++){
        if(S[K] != S[i]) S[i] = '*';
    }
    
    cout << S << "\n";
    return 0;
} 


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define FOR(i,a) for (int i=0;i<(a);++i)
#define FORD(i,a) for (int i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (int i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (int i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define all(v) v.begin(),v.end()
#define make_unique(v) v.erase(unique(all(v)),v.end())
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define srng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define y1 EsiHancagorcRepa

const int N=4e5+10;
const ll MOD2=998244353;
const ll MOD=1e9+7;


int main(){
    fastio;
    srng;
    string s;
    cin>>s;
    int n=s.length();
    int nax=2;
    int ans=0;
    FOR(i,n){
        if (nax==2){
            ans++;
            nax=1;
        }
        else if (s[i]==s[i-1]){
            if (i==n-1)break;
            nax=2;
            ans++;
            i++;
        }
        else{
            ans++;
        }
    }
    reverse(all(s));
    int mx=ans;
    ans=0;
    FOR(i,n){
        if (nax==2){
            ans++;
            nax=1;
        }
        else if (s[i]==s[i-1]){
            if (i==n-1)break;
            nax=2;
            ans++;
            i++;
        }
        else{
            ans++;
        }
    }
    cout<<max(mx,ans)<<endl;
    return 0;
}


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

int main()
{
	while (true){
		int n;
		cin >> n;
		if (!n) break;
		int h[101];
		for (int i = 0; i < n + 1; i++) cin >> h[i];
		for (int i = 0; i < n + 1; i++){
			int dif;
			if (i == 0) dif = h[2] - h[1];
			else if (i == 1) dif = h[2] - h[0];
			else dif = h[1] - h[0];
			for (int j = 2; j < n + 1; j++){
				if (i == j) continue;
				if (i < 2 && j < 3) j++;
				if (j - 1 == i){
					if (h[j] - h[j - 2] != dif) goto wrong;
				}
				else{
					if (h[j] - h[j - 1] != dif) goto wrong;
				}
			}
			cout << h[i] << endl;
			break;
		wrong:;
		}

	}
	return 0;
}

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

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

	int N;
	cin >> N;

	vector<double> A( N );
	for( auto& v: A ) { cin >> v; }

	double sum = 0;
	for( int i = 0; i < N; ++i ) {
		sum += 1.0 / A.at( i );
	}

	cout << fixed << setprecision( 10 );
	cout << (1.0 / sum) << endl;
}


Measured memory_bytes: 256
#include <iostream>
# include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int d;
    cin >> d;
    if(d == 25){
        cout << "Christmas" << endl;
    }else if(d == 24){
        cout << "Christmas Eve" << endl;
    }else if(d == 23){
        cout << "Christmas Eve Eve" << endl;
    }else{
        cout << "Christmas Eve Eve Eve" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

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

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<ll> a(N); rep(i, N) cin >> a[i];
  int n_minus = 0;
  rep(i, N) if (a[i] < 0) n_minus++;
  ll sum = 0;
  rep(i, N) {
    a[i] = abs(a[i]);
    sum += a[i];
  }
  if (n_minus % 2 == 0) cout << sum << endl;
  else {
    ll min_num = INF;
    rep(i, N){
      min_num = min(min_num, a[i]);
    }
    sum -= 2 * min_num;
    cout << sum << endl;
  }
}


Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){

string a;
int b;


int c=0;
while(1){

cin>>a;

if(a=="-")break;


cin>>b;
for(int i=0;i<b;i++){
cin>>c;
a=a+a.substr(0,c);
a.erase(0,c);
}
cout<<a<<endl;
}



}



Measured memory_bytes: 3180
N=int(input())
M=10**9+7
dp={b:1 for b in 'ACGT'}
for i in range(N-1):
    dp_next={}
    for j in dp:
        for k in 'AGCT':
            elem=j[-3:]+k
            if elem[-3:] in ('AGC','GAC','ACG') or elem in ('AGGC','ATGC','ACGC','AGTC','AGGC'):
                continue
            else:
                dp_next.setdefault(elem,0)
                dp_next[elem]+=dp[j]
    dp=dp_next
print(sum(dp.values())%M)

Measured memory_bytes: 3064
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n=ii()
    a=lmis()
    cnt4,cnt2,cntodd=0,0,0
    flag=False
    for val in a:
        if val%4==0:
            cnt4+=1
            continue
        if val%2==0:
            cnt2+=1
            continue
        cntodd+=1
    if cnt4-cntodd>=0:flag=True
    elif cnt4-cntodd==-1 and cnt2==0:flag=True
    print('Yes' if flag else 'No')
    

if __name__ == "__main__":
    main()

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

const int INF = 1000000000;

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

		if(n==0)
			break;

		int T[10][10];
		for(int i=0; i<10; i++){
			for(int j=0; j<10; j++){
				if(i==j){
					T[i][j] = 0;
				}
				else{
					T[i][j] = INF;
				}
			}
		}

		int m = 0;		//町の総数

		for(int i=0; i<n; i++){
			int a, b, c;
			cin >> a >> b >> c;

			T[a][b] = T[b][a] = c;

			if(a+1>m){
				m = a+1;
			}
			if(b+1>m){
				m = b+1;
			}
		}

        for(int l=0;l<m;l++){
            for(int i=0;i<m;i++){
                for(int j=0;j<m;j++){
                    if(T[i][j]>T[i][l]+T[l][j]){
                        T[i][j]=T[i][l]+T[l][j];
                    }
                }
            }
        }
        int sum[10];
        for(int i=0;i<m;i++){
            sum[i]=0;
            for(int j=0;j<m;j++){
                if(T[i][j]!=INF){
                    sum[i]+=T[i][j];
                }
            }
        }
        int min=sum[0];
        int k=0;
        for(int i=1;i<m;i++){
            if(min>sum[i]){
                min=sum[i];
                k=i;
            }
        }
        cout<<k<<' '<<min<<endl;




	}

	return 0;
}



Measured memory_bytes: 3004
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;

const int INF = 200000000;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int N, A, B, C;
vector<int> l(10), id(10);
int dfs(int cur, int a, int b, int c) {
    if (cur == N) {
        if (min(a, min(b, c)) > 0) {
            return abs(a - A) + abs(b - B) + abs(c - C) - 30;
        } else {
            return INF;
        }
    } else {
        int ret = INF;
        ret = min(ret, dfs(cur + 1, a, b, c));
        ret = min(ret, dfs(cur + 1, a + l[cur], b, c) + 10);
        ret = min(ret, dfs(cur + 1, a, b + l[cur], c) + 10);
        ret = min(ret, dfs(cur + 1, a, b, c + l[cur]) + 10);
        return ret;
    }
}

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

    cin >> N >> A >> B >> C;

    l.resize(N, 0);
    id.resize(N, 0);
    REP(i, N) { cin >> l.at(i); }

    cout << dfs(0, 0, 0, 0) << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INF 100000000
typedef long long ll;

using namespace std;


int main() {
    int a[3][3];
    bool flag = false;
    REP(i, 3) {
        REP(j, 3) {
            cin >> a[i][j];
        }
    }
    REP(i, 101) {
        REP(j, 101) {
            REP(k, 101) {
                REP(s, 3) {
                    if (a[0][s] - i == a[1][s] - j && a[1][s] - j == a[2][s] - k && 0 <= a[0][s] - i && a[0][s] - i <= 100) {
                        if (s == 2) {
                            flag = true;
                            goto NEX;
                        }
                    }
                    else {
                        break;
                    }

                }
            }
        }
    }
NEX:
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}

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


struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main(){
    int r;
    int D;
    int x;
    cin>>r>>D>>x;
    reps(i,1,11){
        x = x*r - D;
        cout<<x<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
#include <cstring>
#include <cmath>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define rrep(i, n) for (int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for (int i=(int)(n);i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=(int)(r)-1;i>=l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

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

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

signed main()
{
	int n; cin >> n;
		int cnt = 0;

		while (n > 1) {
			n = (n + 2) / 3;
			cnt++;
		}

		cout << cnt << endl;
}





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

using namespace std;
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
template<typename T> using vv = vector<vector<T>>;
template<typename T> using vvv = vector<vector<vector<T>>>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

#define _sel(_1, _2, x, ...) x
#define repn(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, ...) _sel(__VA_ARGS__, reps, repn)(i, __VA_ARGS__)
#define reppn(i, n) for (ll i = 1; i <= (n); i++)
#define repps(i, a, b) for (ll i = (a); i <= (b); i++)
#define repp(i, ...) _sel(__VA_ARGS__, repps, reppn)(i, __VA_ARGS__)
#define rrepn(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define rrep(i, ...) _sel(__VA_ARGS__, rreps, rrepn)(i, __VA_ARGS__)
#define rreppn(i, n) for (ll i = (n); i >= 1; i--)
#define rrepps(i, a, b) for (ll i = (b); i >= (a); i--)
#define rrepp(i, ...) _sel(__VA_ARGS__, rrepps, rreppn)(i, __VA_ARGS__)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define rng(v) (v).begin(), (v).end()
#define rrng(v) (v).rbegin(), (v).rend()
#define siz(x) int((x).size())
#define pow2(x) (1ll << (x))
#define bit(x, n) ((x) >> (n) & 1)
#define prt(x) cout << (x) << endl
#define dbg(x) dbgn(#x, x)

template<typename T, typename U> inline bool umax(T& m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U> inline bool umin(T& m, U x) { if (m > x) { m = x; return true; } return false; }
template<typename T> inline void errv(T& v) { for (auto x: v) cerr << x << " "; cerr << endl; }
inline void errv(vb& v) { for (auto x: v) cerr << (x ? 1 : 0) << " "; cerr << endl; }
template<typename T> inline void dbgn(string n, T x) { cerr << n << ": " << x << endl; }
template<typename T> inline void dbgn(string n, vector<T>& v) { cerr << n << ": "; errv(v); }
template<typename T> inline void dbgn(string n, vv<T>& m) { cerr << n << ":" << endl; for (auto& v: m) errv(v); }


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

    vl x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];

    int cnt = 0;
    rep(i, n) {
        if (x[i] * x[i] + y[i] * y[i] <= d * d) cnt++;
    }

    prt(cnt);

    return 0;
}


Measured memory_bytes: 6424
import sys
input = sys.stdin.readline

n=int(input())
h=list(map(int,input().split()))
l=h
s=[]
t=max(h)

for i in range(n-1):
        if l[i]-1==l[i+1]:
                l[i]=l[i]-1
                s.append(l[i])
        elif l[i]==l[i+1] and l[i]==t:
                l[i]=l[i]-1
                s.append(l[i])
        elif l[i]-1>l[i+1]:
                break
        elif l[i]-1<l[i+1]:
                s.append(l[i])
                continue

s.append(h[n-1])
s.sort()
if len(s)==n:
        if l==s:
                print('Yes')
        else:
                print('No')

else:
        print('No')




Measured memory_bytes: 15020
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <bitset>
#include <functional>
#include <tuple>
#include <complex>
#include <chrono>
#include <climits>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef unsigned int uint;
typedef unsigned long long ull;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
// default_random_engine generator;
// mt19937 rnd(1);

const ll INF = 1e9;

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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ll s;
    cin >> s;

    cout << 0 << " " << 0 << endl;

    ll lf = 0, rg = INF;
    while (rg - lf > 1) {
        ll mid = (lf + rg) / 2;
        if (mid * mid < s) {
            lf = mid;
        } else {
            rg = mid;
        }
    }

    ll x1 = rg, y1 = 0;
    ll x2 = 0, y2 = rg;

    if (x1 * (y2 - 1) >= s) {
        --y2;
    }

    y1 = 1;
    x2 = x1 * y2 - s;
    cout << x1 << " " << y1 << endl;
    cout << x2 << " " << y2 << endl;
    assert(x1 <= INF && y1 <= INF);
    assert(x2 <= INF && y2 <= INF);
    assert(abs(x1 * y2 - x2 * y1) == s);
}

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

using IV = std::vector<int>;
IV ToFixedIntArray(std::istream& is, int n) {
	IV ret(n);
	auto* dst = ret.data();
	while(n > 0) {
		--n;
		is >> *dst++;
	}
	return ret;
}

#include <iostream>

void DisableIOSync() {
	std::cin.tie(0);
	std::cout.tie(0);
	std::ios::sync_with_stdio(false);
}
constexpr int MaxLen = 100000;
int Count[MaxLen+1];
int main() {
	DisableIOSync();
	const int N = ToFixedIntArray(std::cin, 1)[0];
	const auto input = ToFixedIntArray(std::cin, N);
	int max = 0,
		maxId = -1;
	for(auto num : input) {
		auto& cc = Count[num];
		if(++cc > max) {
			maxId = num;
			max = cc;
		}
		auto& c0 = Count[num-1];
		if(++c0 > max) {
			maxId = num;
			max = c0;
		}
		auto& c1 = Count[num+1];
		if(++c1 > max) {
			maxId = num;
			max = c1;
		}
	}
	std::cout << max << std::endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{


    ll k,b,m,q;
    ll c,d,t,i,j,a,n;
   ll ok,ko;
    vector<ll> v,s;
    map< pair<ll,ll> ,pair<ll,ll> > ma,sa;
    map< pair<ll,ll> ,pair<ll,ll> > :: iterator it,ki;
    string st,et;
    cin>>n;
    n = n-1;
    for(i=1;i<=n;i++){
        cin>>a;
        v.push_back(a);
    }
    a= v[0];
    for(i=1;i<n;i++){
        if(v[i-1]>v[i]){
            v[i-1]=v[i];
        }
    }
    for(i=0;i<n;i++){
        a = a+v[i];
    }
    cout<<a<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n;
    in(n);
    vector<int> vec(n);
    bitset<32> bit;
    rep(i,n){
        cin>>vec[i];
        bitset<32> a(vec[i]);
        bit=(bit^a);
    }
    bitset<32> bit2;
    vector<int> vec2(n);
    rep(i,n){
        bitset<32> a(vec[i]);
        bit2=(bit^a);
        vec2[i]=bit2.to_ullong();
    }
    out(vec2);
}

Measured memory_bytes: 4896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    string S;
    int K;
    cin >> K >> S;
    if(S.size() <= K){
        cout << S << "\n";
    }else{
        cout <<S.substr(0,K) << "..."<< "\n";
    }
}

Measured memory_bytes: 3644