akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int, int> P1;
typedef pair<P1, int> PP;

int main()
{
    while(true){
        int M, T, P, R;
        cin >> M >> T >> P >> R;
        if(M == 0 && T == 0 && P == 0 && R == 0) break;
        int m[2003], t[2003], p[2003], j[2003];
        int last[52] {0};
        int sol[52][12];
        int miss[52][12];
        for(int it = 0; it < T; it++){
            for(int ip = 0; ip < P; ip++){
                sol[it][ip] = false;
                miss[it][ip] = 0;
            }
        }
        for(int i = 0; i < R; i++){
            cin >> m[i] >> t[i] >> p[i] >> j[i];
            t[i]--;
            p[i]--;
            if(j[i] == 0){
                sol[t[i]][p[i]] = true;
                last[t[i]] += m[i];
            }
            if(j[i] != 0){
                miss[t[i]][p[i]]++;
            }
        }
        int count[52] {0};
        PP num[52];
        for(int i = 0; i < T; i++){
            for(int k = 0; k < P; k++){
                if(sol[i][k]){
                    count[i]++;
                    last[i] += miss[i][k] * 20;
                }
            }
            last[i] = -last[i];
            num[i] = PP(P1(count[i], last[i]), i);
        }
        sort(num, num + T, greater<PP>());
        cout << num[0].second + 1;
        for(int i = 1; i < T; i++){
            if(num[i].first.first == num[i - 1].first.first && num[i].first.second == num[i - 1].first.second){
                cout << '=';
            }
            else cout << ',';
            cout << num[i].second + 1;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
#define maxi(a,b,c) max(max(a,b),c)
#define mini(a,b,c) min(min(a,b),c)
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++)
    cin>>a[i]>>b[i]>>c[i];
    int dp[n][3];
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    
    for(int i=1;i<n;i++)
    {
    	dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
    	dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
    	dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
	}
    int ans=maxi(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
    cout<<ans;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REP(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define REP1(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Int = long long;
 
//INT_MAX = 2147483647;
//LLONG_MAX = 9223372036854775807;
//ULLONG_MAX = 18446744073709551615;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;
 
//少数点表示
//cout << std::fixed << std::setprecision(14) << 値
 
int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    
    string s;
    cin >> s;
    int cnt;
    if(s[0]=='R' && s[1]=='R' && s[2]=='R') cnt = 3;
    else if((s[0]=='R' && s[1]=='R' ) || (s[1]=='R' && s[2]=='R')) cnt = 2;
    else if(s[0]=='R' || s[1]=='R' || s[2]=='R') cnt = 1;
    else cnt = 0;
    
    cout << cnt <<endl;
    
    
    return 0;
    
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)
const int MOD = 1000000007;

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

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;

int main() {
   int n, a, b;
   cin >> n >> a >> b;
   cout << min(n * a, b) << endl;
   return 0;
}

Measured memory_bytes: 256
/**
 * Author: Martin Leshko (leshko.martin@gmail.com)
 */

#include <bits/stdc++.h>
#define F0R(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, n) for (int i = 1; i <= (int)(n); i++)
#define trav(i, a) for (auto& i: a)
#define sz(x) (int)x.size()
#define psb push_back
template<class T> void re(T& x) { std::cin >> x; }
template<class T, class... Ts> void re(T& t, Ts&... ts) { re(t); re(ts...); }
template<class T> void pr(std::string& x) { std::cout << x; }
template<class T> void pr(char* x) { std::cout << x; }
template<class T> void pr(T x) { std::cout << x; }
template<class T, class... Ts> void pr(T& t, Ts&... ts) { pr(t); pr(ts...); }
void ps() { std::cout << "\n"; }

using namespace std;
using ll = long long;
using vi = vector<int>;

const int mod = 1000000007;

map<string,int> m;

int main() { 
  m["SUN"] = 7;
  m["MON"] = 6;
  m["TUE"] = 5;
  m["WED"] = 4;
  m["THU"] = 3;
  m["FRI"] = 2;
  m["SAT"] = 1;
  string x; re(x); pr(m[x]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (int) 1e9 + 7;

int main(){
    char c;
    cin >> c;
    cout << (char)(c + 1) << "\n";
}

Measured memory_bytes: 764
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			int k = sc.nextInt();
			if(n==0 && k==0)break;
			
			int[][] map = new int[n+1][k];
			
			for(int i=0;i<n+1;i++) for(int j=0;j<k;j++) map[i][j] = sc.nextInt();
			
			int sum = 0;
			boolean flag = true;
			
			for(int i=0;i<k;i++){
				sum = 0;
				for(int j=1;j<n+1;j++) sum += map[j][i];
				if(sum>map[0][i]){
					flag = false;
					break;
				}
			}
			
			if(flag==true) System.out.println("Yes");
			else System.out.println("No");
			
		}
	
	}	
}

Measured memory_bytes: 94848
import heapq
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

def main():
    n = getN()
    ans = 0
    for i in range(1, n//2+1):
        if (n-i) != i and (n-1) > 0:
            ans += 1

    print(ans)

    return

if __name__ == "__main__":
    main()

"""
10
203941992 742164984
670850202 743524472
687298546 744891559
676493045 744182895
385467254 742631752
740505911 744926772
425723256 743348462
225362543 742332848
399450535 742706299
563528474 743419738
"""

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

signed main(void){
    
    long long N,a,maxA=0;
    vector<long long> A,B;
    vector<long long> As(200020,0),Bs(200020,0);
    
    cin >> N;
    for(long long i=0;i<N;i++){
        cin >> a;
        maxA = max(maxA,a);
        A.push_back(a);
        As[a]++;
    }
    for(long long i=0;i<N;i++){
        cin >> a;
        maxA = max(maxA,a);
        B.push_back(a);
        Bs[a]++;
    }
    
    
    //AとBに合わせてN+1個以上ある要素がある場合、鳩の巣原理よりNG
    for(long long i=0;i<=maxA;i++){
        if(As[i]+Bs[i]>N){
            cout << "No" << endl;
            return 0;
        }
    }
    //そうでなければ必ず構成できる
    cout << "Yes" << endl;
    
    //Bを降順にしておく
    reverse(B.begin(),B.end());
    
    //この時点でかぶってるのは高々区間１つ
    long long T = -1;
    for(long long i=0;i<N;i++){
        if(A[i]==B[i]){
            T=A[i];
            break;
        }
    }
    
    //かぶりがなければそこで終了してよい
    if(T==-1){
        for(long long i=0;i<N;i++){
            cout << B[i] << " ";
        }
        cout << endl;
        return 0;
    }
    
    //かぶりがある
    //まずBでかぶってる部分を限界までBの先頭に写す
    long long ib=0;
    for(long long i=0;i<N;i++){
        if(A[i]==B[i]){
            swap(B[ib],B[i]);
            ib++;
        }
    }
    
    //この時点でもまだ被りがある場合、Aでかぶってる部分を限界までAの最後尾に移す
    long long ia=N-1;
    for(long long i=0;i<N;i++){
        if(A[i]==B[i]){
            swap(A[ia],A[i]);
            ia--;
        }
    }
    //ここまでで全てさばけているはず(同じ数は高々N個しかないので)
    
    //答えはAでソートしておく
    vector<pair<long long,long long>> Ans;
    for(long long i=0;i<N;i++){
        Ans.push_back({A[i],B[i]});
        if(A[i]==B[i]){
            //もし違法があったらREを吐く
            assert(false);
        }
    }
    sort(Ans.begin(),Ans.end());
    
    for(long long i=0;i<N;i++){
        cout << Ans[i].second << " ";
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 13708
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, Hs):
    ans = 0
    tmp = 0
    for i in range(N - 1):
        if Hs[i] >= Hs[i + 1]:
            tmp += 1
        else:
            ans = max(ans, tmp)
            tmp = 0
    ans = max(ans, tmp)
    print(ans)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    Hs = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, Hs)


Measured memory_bytes: 20140
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    scanf("%d",&x);
    if(x>0  || x==0 && x<1 || x==1)
    {
        if(x==0)
        {
           printf("1\n");
        }
        else if(x==1)
        {
             printf("0\n");
        }

    }


}


Measured memory_bytes: 3648
#include<cstdio>
#include<algorithm>
using namespace std;
int n,t=2,f=1;
long long ans[100005];
struct N{int data,num;}a[100005];
bool comp(N x,N y){if(x.data==y.data) return x.num<y.num;else return x.data>y.data;}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i].data),a[i].num=i;
	sort(a+1,a+n+1,comp);
	while(t<=n){
		while(a[t].data==a[t-1].data) t++;
		ans[a[f].num]+=1ll*(a[f].data-a[t].data)*(t-1);
		if(a[t].num>a[f].num) a[f].data=a[t].data;
		else f=t;
		t++;
	}
	ans[a[f].num]+=1ll*a[f].data*n;
	for(int i=1;i<=n;++i) printf("%lld\n",ans[i]);
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <sstream>
using namespace std;
#define N(X) ((X)-'0')

string update(string &s) {
	int count = 0;
	while(1 < s.size()) {
		stringstream ss;
		ss << N(s[0]) + N(s[1]);
		s.erase(0, 2);
		s.insert(0, ss.str());
		count++;
	}
	cout << ((count % 2) ? "Fabre" : "Audrey") << " wins." << endl;
	return s;
}

int main() {
	int n; cin >> n;
	string str;
	while(n--) {
		cin >> str;
		update(str);
	}
}

Measured memory_bytes: 1248
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	double d;
	cin >> d;
	double ans = d;
	for (double y = 0; y <= d; y++) {
		double x = sqrt(d*d-y*y);
		ans = max(ans, y+max(1.0, x));
	}
	ans = max(ans, sqrt(2)*d);
	printf("%.20lf\n", ans);
	return 0;
}

Measured memory_bytes: 3272
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 2e5 + 5;
typedef long long ll;
const ll INF = 1e15; 
using namespace std;

int n, m;
ll ans = INF; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

ll mabs(ll x) { return x > 0 ? x : -x; }

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin); 
#endif
	n = read <int> (), m = read <int> ();
	if(n % 3 == 0 || m % 3 == 0) { puts("0"); return 0; }
	for(int l = (n + 1) / 2, r = n / 2, i = 1; i <= m; i++)
		ans = min(ans, max(max(mabs(1ll * l * i - 1ll * n * (m - i)), mabs(1ll * r * i - 1ll * n * (m - i))), mabs(1ll * l * i - 1ll * r * i))); 
	for(int l = (m + 1) / 2, r = m / 2, i = 1; i <= n; i++)
		ans = min(ans, max(max(mabs(1ll * l * i - 1ll * m * (n - i)), mabs(1ll * r * i - 1ll * m * (n - i))), mabs(1ll * l * i - 1ll * r * i)));
	ans = min(ans, 1ll * min(n, m)); 
	printf("%lld\n", ans); 
	return 0; 
}


Measured memory_bytes: 3156
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
#define F first
#define S second

int n, m, q, a[55], b[55], c[55], d[55], ans;
vector<int> A;

void rec(int loc){
    int s = A.size();
    if(s == n){
        int score = 0;
        for(int i = 0; i < q; ++i){
            if(A[b[i]] - A[a[i]] == c[i]){
                score += d[i];
            }
        }
        ans = max(ans, score);
    }
    else{
        for(int i = loc; i < m; ++i){
            A.push_back(i);
            rec(i);
            A.pop_back();
        }
    }
}

void solve(){
    cin >> n >> m >> q;
    for(int i = 0; i < q; ++i){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        --a[i], --b[i];
    }

    rec(0);
    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<stdio.h>
#include<string>

using namespace std;

int main(){
  int a, b;
  std::string sep;
  cin >> a >> b;
  if(a == b) {
      sep = "==";
  } else if(a > b) {
      sep = ">";
  } else {
      sep = "<";
  }
  cout << "a " << sep << " b" << endl;
  return 0;
}



Measured memory_bytes: 3176
//
//  main.c
//  An Odd Problem
//
//  Created by k19031kk on 2020/07/11.
//  Copyright © 2020 AIT. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int masu,count = 0;
    scanf("%d",&masu);
    
    int num[masu];
    
    for(int i=1;i<=masu;i++){
        scanf("%d",&num[i-1]);
        
        if((i % 2 == 1) && (num[i-1] % 2 == 1)){
            count += 1;
        }
    }
    
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 1736
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]

kukan=[[s[i][0]-s[i][1], s[i][0]+s[i][1]] for i in range(n)]
kukan.sort(key=lambda x:x[1])

count=1
mae=kukan[0][1]
for i in range(1,n):
    if kukan[i][0]>=mae:
        count+=1
        mae=kukan[i][1]

print(count)

Measured memory_bytes: 42792
while True:
    try:
        words=input()
        
    except:
        break
    for j in range(26):
        word=""
        for i in range(len(words)):
            if 65<=ord(words[i])<=90:
                if ord(words[i])+j>90:
                    word+=chr(ord(word[i])+j-26)
                else:
                    word+=chr(ord(word[i])+j)
            elif 97<=ord(words[i])<=122:
                if ord(words[i])+j>122:
                    word+=chr(ord(words[i])+j-26)
                else:
                    word+=chr(ord(words[i])+j)    
            else:
                word+=words[i]
        if "the" in word or "this" in word or "that" in word:
            print(word)

Measured memory_bytes: 7392
#include <cstdio>
using namespace std;
int main() {
    int N, A[100000];
    scanf("%d%*c", &N);
    for (int i = 1, t; i <= N; i++) {
        scanf("%d%*c", &t);
        A[t - 1] = i;
    }
    for (int i = 0; i < N; i++) printf("%d ", A[i]);
    printf("\n");
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll MAX = 100000;
int x, y, a, b, c;
int p[100000];
int q[100000];
int r[300005];
ll sum = 0;
bool cmp(int a, int b) {
	return a > b;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> x >> y >> a >> b >> c;
	for(int i = 0; i < a; ++i)
		cin >> p[i];
	for(int j = 0; j < b; ++j)
		cin >> q[j];
	for(int k = 0; k < c; ++k)
		cin >> r[k];
	sort(p, p + a, cmp);
	sort(q, q + b, cmp);
	for(int i = 0; i < x; ++i)
		r[c++] = p[i];
	for(int j = 0; j < y; ++j)
		r[c++] = q[j];
	sort(r, r + c, cmp);
	for(int i = 0; i < x + y; ++i)
		sum += r[i];
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 2176
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 2000


int main(){
	int a[N];
	int b[N];
	int c[N];
	f(i, N)a[i] = 0;
	int n;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	f(i, n){
		scanf("%d %d %d", &a[i],&b[i],&c[i]);
	}
	f(xx, 101){
		f(yy, 101){
				ans = 0;
				z = 0;
				f(i, n){
					if (c[i] > 0){
						x = xx - a[i];
						y = yy - b[i];
						s = c[i] + abs(x) + abs(y);
						if (z == 0)z = s;
						if (s == z)ans++;
					}
				}
				f(i, n){
					if (c[i] == 0){
						x = xx - a[i];
						y = yy - b[i];
						s = abs(x) + abs(y);
						if (z <= s)ans++;
					}
				}
				if (ans == n&&z>0){
					printf("%d %d %d\n", xx, yy, z);
					return 0;
				}
		}
	}


	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#include <set>
#include <unordered_set>
#define rep(i, x) for(ll i = 0; i < x; i++)
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 5e18+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  ll n, k; cin >> n >> k;
  vector<int> p(n); rep (i, n) { cin >> p[i]; p[i]--; }
  vector<int> c(n); rep (i, n) cin >> c[i];

  vector<vector<int>> cycles(n, vector<int>());
  vector<ll> scores(n);
  for (int i = 0; i < n; i++) {
    unordered_set<int> seen;
    int curr = i;
    while (true) {
      if (seen.find(curr) != seen.end()) break;
      seen.insert(curr);
      cycles[i].push_back(curr);
      scores[i] += c[curr];
      curr = p[curr];
    }
  }

  ll ans = -inf;
  for (int i = 0; i < n; i++) {

    int next = p[i];
    for (auto cyc_count : {0LL, k / (ll)cycles[next].size() - 1, k / (ll)cycles[next].size()}) {
      if (cyc_count < 0) continue;
      ll curr_score = 0;
      curr_score += cyc_count * scores[next];
      if (cyc_count != 0) ans = max(ans, curr_score);
      int curr = next;
      if (cyc_count != 0) ans = max(ans, curr_score);
      int last_block = cyc_count == k / (ll)cycles[next].size() ? k % cycles[next].size() : cycles[next].size();
      for (int j = 0; j < last_block && j < k; j++) {
        curr_score += c[curr];
        curr = p[curr];
        ans = max(ans, curr_score);
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 121220
import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		//変数
		long answer=0;
		int hi=0;
		//入力
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int[] h=new int[N];
		int[] cost=new int[N];
		for(int i=0;i<N;i++)
		{
			hi=sc.nextInt();
			h[i]=hi;
		}
		//処理
		cost[0]=0;
		cost[1]=Math.abs(h[0]-h[1]);
		for(int i=2;i<N;i++)
		{
			cost[i]=Math.min(Math.abs(h[i-2]-h[i])+cost[i-2],Math.abs(h[i-1]-h[i])+cost[i-1]);
		}
		answer=cost[N-1];
		// 出力
		System.out.println(answer);
	}
}

Measured memory_bytes: 62796
#include<iostream>
using namespace std;
#define inRange(x,a,b) (a <= x && x < b)

char mat[100][100];
bool bad[100][100] = {};

int di[8] = {0,0,1,1,1,-1,-1,-1};
int dj[8] = {1,-1,-1,0,1,-1,0,1};

int main(){
    int h, w;
    cin >> h >> w;
    char mat[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> mat[i][j];
            bad[i][j] |= mat[i][j]!='-';
            int k = 0;
            if(mat[i][j]=='o')  k = 2;
            if(mat[i][j]=='x')  k = 8;
            for(int l = 0; l < k; l++){
                int ni = i + di[l], nj = j + dj[l];
                if(inRange(ni,0,h)&&inRange(nj,0,w))    bad[ni][nj] = true;
            }
        }
    }
    int ans = 0;
    for(int i = 1; i < h; i++)  for(int j = 0; j < w; j++)  ans += !bad[i][j];
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;
typedef vector<unordered_map<lli,lli>> graph;

lli n;
vll l;

int main(){
  cin >> n;
  l = vll(n+1);
  l[0] = 2;l[1] = 1;
  for(lli i = 2;i <= n;i++){
    l[i] = l[i-1]+l[i-2];
  }
  cout << l[n] << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int N;
	cin >> N;
	int H[100000];
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	int ans = 0;
	int max = 0;
	for (int i = 0; i < N - 1; i++) {
		if (H[i] >= H[i + 1]) {
			ans++;
//			cout << i << '-' << ans << '\n';
			if (max < ans) { max = ans; }
		}
		else {
			ans = 0;
		}
	}
	cout << max;
	return 0;
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

from math import sqrt

N = int(input())

if N == 1:
    print (1)
    exit()


def calc(tmp):
    return len(str(tmp))

ans = MOD
for i in range(1, int(sqrt(N)) + 10):
    if N % i == 0:
        ans = min(ans, max(calc(i), calc(N // i)))

print (ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int K = Integer.parseInt(sc.next());
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());


        int count=0;
        for(int i=A; i<=B; i++){
            if(i % K == 0){
                count++;
            }
        }

        if(count != 0){
            System.out.println("OK");
        }else{
            System.out.println("NG");
        }
        sc.close();
    }
    
}

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

int main()
{
	long long n;
	cin >> n;
	long long ans = n - 1;
	for (long long i=2; i*i<=n; i++) {
		if (n % i == 0) ans = min(ans, i + n / i - 2);
	}	
	cout << ans << endl;
}

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

int ans[51];

int main(){

  int N,M;

  cin>>N>>M;

  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    ans[a]++;
    ans[b]++;
  }

  for(int i=1;i<=N;i++){
    cout<<ans[i]<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int n,d;

  scanf("%d%d",&n,&d);

  if(n%(2*d+1)==0){
    printf("%d\n",n/(2*d+1));
  }else{
    printf("%d\n",n/(2*d+1)+1);
  }

  return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
"""
E - Roadwork
https://atcoder.jp/contests/abc128/tasks/abc128_e

"""
import sys

from heapq import heappop, heappush

def solve(N, Q):
    events = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        events.append((s-x, 1, x))
        events.append((t-x, -1, x))
    events.sort(reverse=True)
    D = [int(input()) for _ in range(Q)]

    blocked = set()
    ans = []
    hq = []
    for d in D:
        while events and events[-1][0] <= d:
            t, e, x = events.pop()
            if e == -1:
                blocked.discard(x)
            else:
                blocked.add(x)
                heappush(hq, x)
        if blocked:
            while hq and hq[0] not in blocked:
                heappop(hq)
            ans.append(hq[0] if hq else -1)
        else:
            ans.append(-1)
    return ans


def main(args):
    N, Q = map(int, input().split())
    ans = solve(N, Q)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 75460
import java.util.*;
import java.io.*;
import java.math.*;

public class Main{



  public static OutputStream out=new BufferedOutputStream(System.out);
  static Scanner sc=new Scanner(System.in);
  static long MOD=1000000007l;
  static int INF=10000000;
  static int[] rr=new int[]{1, 0, -1, 0};                                 //rook row move
  static int[] rc=new int[]{0, 1, 0, -1};                                 //rook col move
  static long[][] pascal_trgl=new long[2005][2005];

  //nl-->neew line; //l-->line;  //arp-->array print;  //arpnl-->array print new line
  public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes()); }
  public static void l(Object o) throws IOException{out.write((o+"").getBytes());}
  public static void arp(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+" ").getBytes()); out.write(("\n").getBytes());}
  public static void arpnl(int[] o) throws IOException{for(int i=0;i<o.length;i++) out.write((o[i]+"\n").getBytes());}
  public static void scanl(long[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextLong();}
  public static void scani(int[] a,int n) {for(int i=0;i<n;i++) a[i]=sc.nextInt();}
  public static void scan2D(int[][] a,int n,int m) {for(int i=0;i<n;i++) for(int j=0;j<m;j++) a[i][j]=sc.nextInt();}
  //static variables

  //


  public static void main(String[] args) throws IOException{
    long sttm=System.currentTimeMillis();
    long mod=1000000007l;

    int s=sc.nextInt();
    intiTriangle();
    long ans=0;
    int n=s%3;
    while(s>=3){
        int r=s/3;
        // System.out.println(n+" "+r);
        ans=(ans+nCr(n+r-1, r-1))%mod;
        n+=3;
        s-=3;
        // nl(ans);
    }
    nl(ans);

    out.flush();
  }


  public static long nCr(int n,int r){
      return pascal_trgl[n][r]%MOD;
  }


  public static void intiTriangle(){
    for (int i = 0; i <= 2004; i++) {
      Arrays.fill(pascal_trgl[i], 0);
    }

  	pascal_trgl[0][0] = 1;

  	for (int i = 1; i <= 2004; i++) {
  		pascal_trgl[i][0] = 1;
  		for (int j = 1; j <= i; j++) {
  			pascal_trgl[i][j] = (pascal_trgl[i - 1][j - 1] + pascal_trgl[i - 1][j]) % MOD;
  		}
  	}
  }

}

class Pair{
  int x; int y;
  Pair(int x,int y){
    this.x=x;
    this.y=y;
  }
}


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

int calcDistribution( char m[100][100], int i, int j, int h, int w, char c )
{
    if( i < 0 || j < 0 || i >= h || j >= w || m[i][j] != c )
        return 0;
    
    m[i][j] = '0';

    calcDistribution( m, i - 1, j, h, w, c );
    calcDistribution( m, i + 1, j, h, w, c );
    calcDistribution( m, i, j + 1, h, w, c );
    calcDistribution( m, i, j - 1, h, w, c );

    return 1;
}

int main()
{
    int h, w;
    char m[100][100];

    for( int i = 0; i < 100; i++ )
        for( int j = 0; j < 100; j++ )
            m[i][j] = '0';

    while( cin >> h >> w )
    {
        if( h == 0 && w == 0 )
            break;

        for( int i = 0; i < h; i++ )
            for( int j = 0; j < w; j++ )
                cin >> m[i][j];
        
        int sum = 0;
        for( int i = 0; i < h; i++ )
            for( int j = 0; j < w; j++ )
            {
                sum += calcDistribution( m, i, j, h, w, '@' );
                sum += calcDistribution( m, i, j, h, w, '#' );
                sum += calcDistribution( m, i, j, h, w, '*' );
            }
        
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3704
li=[0]*5
for i in range(5):
  li[i]=int(input())
  
ans=0
cnt=10
for i in range(5):
  if li[i]%10<cnt:
    if li[i]%10==0:
      ans+=li[i]//10
    else:
      cnt=li[i]%10
      ans+=li[i]//10
      ans+=1
  else:
    if li[i]%10==0:
      ans+=li[i]//10
    else:
      ans+=li[i]//10
      ans+=1
  #print(ans)
  
print(ans*10-10+cnt)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    int temp=0;
    int ans=0;
    std::cin >> s;
    for (auto c:s){
        if ( c=='A' || c=='T' || c=='G' || c=='C' ) {
            temp+=1;
            ans=max(ans,temp);
        }
        else {
            temp=0;
        }
        
    }
    std::cout << ans << std::endl;
}



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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n;
    cin>>n;
    vector<pair<string,ll>> temp;
    string fk="a";
    temp.pb({fk,0});
    ll cc=1;
    vector<pair<string,ll>> fin;
    while(cc!=n){
        for(auto i:temp){
            rep(j,0,cc){
                if((j-1)<=i.S)fin.pb({i.F+(char)(j+'a'),max(i.S,j)});
            }
        }
        cc++;
        temp=fin;
        fin.clear();
    }
    for(auto i:temp) cout<<i.F<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 11940
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>

long long res[2001][2001];

const int mod = 1000000007;
bool q() {
	int N, a, b, c, d;
	scanf("%d %d %d %d %d", &N, &a, &b, &c, &d);
	char *S = new char[N + 1];
	scanf("%s", S);
	for (int i = a; i < c; i++) {
		if (S[i] == '#'&&S[i + 1] == '#') {
			return false;
		}
	}
	for (int i = b; i < d; i++) {
		if (S[i] == '#'&&S[i + 1] == '#') {
			return false;
		}
	}
	if (c < d) {
		return true;
	}
	for (int i = b - 1; i < d; i++) {
		if (S[i - 1] == '.'&&S[i] == '.'&&S[i + 1] == '.') {
			return true;
		}
	}
	return false;

}
int main() {
	bool r = q();

	printf("%s", r ? "Yes" : "No");
}





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

int main(){
    ll N;
    cin >> N;
    ll ans = 0;
    rep(i, 0, N){
        ll a;
        cin >> a;
        while(a % 2 == 0){
            ans++;
            a /= 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

bool prime[200000];

int main() {
	int i,j;
	for(i=0;i<200000;i++)prime[i]=true;
	prime[0]=prime[1]=false;
	for(i=0;i*i<200000;i++){
		if(!prime[i])continue;
		for(j=i*i;j<200000;j+=i){
			prime[j]=false;
		}
	}
	int n,p;
	while(1){
		cin>>n>>p;
		if(n==-1&&p==-1)break;
		vector<int> m;
		for(i=n+1;;i++){
			if(!prime[i])continue;
			for(j=i;;j++){
				if(!prime[j])continue;
				m.push_back(i+j);
				if(m.size()%p==0)break;
			}
			if(m.size()==p*p)break;
		}
		sort(m.begin(),m.end());
		cout<<m[p-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include<iostream>

using namespace std;

int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx = x2 - x1, dy = y2 - y1;
    int x3 = x2 - dy, y3 = y2 + dx;
    int x4 = x3 - dx, y4 = y3 - dy;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>

using namespace std;

int main(void){
    int a,b,answer;
    string op;
    while(1){
        cin >> a >> op >> b;
        if(op == "/"){
            answer = a / b;
        }
        else if(op == "*"){
            answer = a * b;
        }
        else if(op == "+"){
            answer = a + b;
        }
        else if(op == "-"){
            answer = a - b;
        }
        else{
            break;
        }
        cout << answer << endl;
    }
    return 0;
}



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

const int mod = 1000*1000*1000+7;

int N, M, K;

vector<vector<int> > cc;
int dp(int t, int m) {
    if(t == -1) return 0;
    int &ret = cc[t][m];
    if(ret != -1) return ret;

    ret = m != M && m % (K - 1) == 0 && m / (K - 1) == t;
    for(int i = 0; i < K; i++) {
        if(i <= m) {
            ret += dp(t - 1, m - i);
            ret %= mod;
        }
    }

    //cout << t << ' ' << m << ' ' << ret << endl;

    return ret;
}

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

    cc = vector<vector<int> >((N + M - 1) / (K - 1) + 1, vector<int>(M + 1, -1));
    cout << dp((N + M - 1) / (K - 1), M);
}


Measured memory_bytes: 31872
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

void dout() { cerr << '\n'; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << " " << H;
    dout(T...);
}

#ifdef LOCAL
    #define dbg(...) cerr << #__VA_ARGS__, dout(__VA_ARGS__)
#else
    #define dbg(...) ;
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 3e5 + 123;
int p[N];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif

    int n;
    string s;
    cin >> n >> s;
    int e = 0, w = 0;
    for (int i = 1; i <= n; i++) {
        if (s[i - 1] == 'E') {
            p[i] += w;
            e++;
        }   else {
            p[i] += e;
            w++;
        }
    }
    e = 0, w = 0;
    for (int i = n; i >= 1; i--) {
        if (s[i - 1] == 'E') {
            p[i] += e;
            e++;
        }   else {
            p[i] += e;
            w++;
        }
    }
    int res = n;
    for (int i = 1; i <= n; i++) {
        res = min(res, p[i]);
    }
    cout << res;
}


Measured memory_bytes: 1812
X = int(input())
A = [0] * 400
m = 0
n = 0
for i in range(400):
  A[i] = i ** 5
for i in range(400):
  x = A[i]
  for j in range(400):
    y = A[j]
    if ((x + y) == X):
      m = i
      n = (-1) * j
    elif ((x - y) == X):
      m = i
      n = j
print(m, n)

Measured memory_bytes: 9212
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,x;
    cin>>a>>b>>c;
    x=a+b+2*sqrtl(a*b);
    if(x<c)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
N=int(input())
h=[int(x) for x in input().split()]
dp=[-1 for i in range(N)]
for i in range(N):
  if i==0:
    dp[N-1]=0
  elif i==1:
    dp[N-2]=abs(h[N-1]-h[N-2])
  else:
    dp[N-i-1]=min(dp[N-i]+abs(h[N-i]-h[N-i-1]),dp[N-i+1]+abs(h[N-i+1]-h[N-i-1]))
print(dp[0])

Measured memory_bytes: 20376
Y,X=map(int,input().split())
info=[]
ans="Yes"
def search(y,x):
    c=0
    if not(0<=y<Y and 0<=x<X):
        return c
    if info[y][x]=="#":
        c=1
    return c
for i in range(Y):
    info.append(list(input()))
for i in range(Y):
    for j in range(X):
        if info[i][j]==".":
            continue
        if (search(i+1,j)+search(i-1,j)+search(i,j+1)+search(i,j-1))==0: #　#の上下左右に#がなかった。
            ans="No"
            break
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int isprime(int n){
	for(int i = 2;i * i <= n;i++){
		if(n % i == 0) return 0;
	}
	return 1;
}

int main(){
	int n, q1;
	while(scanf("%d", &n) != EOF){
		if(n == 0) break;
		for(int i = n;i >= 2;i--){
			if(isprime(i) == 1 && isprime(i-2) == 1){
				q1 = i;
				break;
			}
		}
		printf("%d %d\n", q1 - 2, q1);
	}
	return 0;
}

Measured memory_bytes: 1712
S=input()
S=S[::-1]
L=["dream","dreamer","erase","eraser"]
L=[i[::-1] for i in L]
i=0
while i<len(S):
    flg=0
    for j in range(4):
        if S[i]==L[j][0] and S[i:min(i+len(L[j]),len(S))]==L[j]:
            flg=1
            i+=len(L[j])
            break
    if flg==0:
        break

if flg==1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
import java.util.*;
import java.io.*;
 
public class Main {
    static boolean[][] used;
    static int[] ans;
    public static void main(String[] args) throws Exception {
        long max = 100000 * 20000000000L;
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        long m = sc.nextLong();
        long[] a = sc.nextLongArray(n);
        long[] cumA = new long[n+1];
        int[] cumN = new int[200001];
        Arrays.sort(a);
        for(int i = 0; i < n; i++){
            cumA[i+1] = a[i] + cumA[i];
            cumN[(int)a[i]]++;
        }
        for(int i = cumN.length-1; i > 0; i--){
            cumN[i-1] += cumN[i];
        }
        int left = -1;
        int right = 200000+1;
        while(right - left > 1){
            int mid = (left+right)/2;
            long cnt = 0;
            for(long v : a){
                cnt += cumN[Math.max(0,mid-(int)v)];
            }
            if(cnt >= m){
                left = mid;
            }else{
                right = mid;
            }
        }
        long ans = 0;
        long total = 0;
        for(long v : a){
            long cnt = cumN[Math.max(0,left-(int)v)];
            total += cnt;
            ans += (long)v*(long)cnt+(cumA[n]-cumA[n-(int)cnt]);
        }
        System.out.println(ans-(long)((total-m)*left));
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}




Measured memory_bytes: 36548
#include<bits/stdc++.h>
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define ll long long
using namespace std;
const int N=505;
int a[N][N],n;
ll S[N][N];
ll SSS[N][N],f[N][N];
int main(){
	scanf("%d",&n);
	For(i,1,n) For(j,1,n) if (i!=j) scanf("%d",&a[i][j]);
	For(i,1,n) For(j,1,n) S[i][j]=S[i][j-1]+a[i][j];
	For(i,1,n) For(j,1,n) SSS[i][j]=SSS[i-1][j]+a[i][j];
	For(i,1,n) f[0][i]=f[0][i-1]+S[i][i];
	For(i,0,n) For(j,i+1,n){
		ll SSSS=0;
		For(k,j+1,n){
			SSSS+=S[k][k]-S[k][i]+SSS[j][k];
			f[j][k]=max(f[j][k],f[i][j]+SSSS);
		}
	}
	ll ans=0;
	For(i,0,n-1) ans=max(ans,f[i][n]);
	For(i,1,n) For(j,1,n) ans-=a[i][j];
	printf("%lld\n",-ans);
}


Measured memory_bytes: 10736
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int LL;
typedef vector<int> VI;

int main(){
  int c[4] = {};
  REP(_, 6) {
    int a;
    cin >> a;
    c[a-1]++;
  }
  int d = 1;
  REP(i, 4) { d *= c[i]; }
  cout << (d == 4 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    if(N == 7 || N == 5 || N == 3){
        cout <<"YES"<< "\n";
    }else{
        cout <<"NO"<< "\n";
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	int H,prev = 0;
	bool enable = true;
	for (int i = 0; i < N; ++i) {
		cin >> H;
		if (prev > H) {
			enable = false;
		}
		else if (prev < H) {
			prev = H-1;
		}
	}
	if (enable) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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




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

    
    ll mod = 1e9+7;
    ll t;
    string s;
    cin>>t>>s;
    ll n = s.size();
    ll m=0;
    if(n==1 && t<=9){
        cout << t << endl;
        return 0;
    }
    for(ll i=0;i<n;i++){
        m*=10;
        m%=mod;
        m += s[i]-'0';
        m%=mod;
    }
    if(s[0]!='0' && m==t){
        cout << s << endl;
        return 0;
    }
    ll ch[10][10]={};
    for(ll i=0;i<10;i++){
        for(ll j=0;j<10;j++){
            for(ll k=0;k<n;k++){
                ch[i][j]*=10;
                ch[i][j]%=mod;
                if(s[k]==(char)('0'+i)) ch[i][j] += j;
                else ch[i][j] += s[k]-'0';
                ch[i][j] %= mod;
            }
        }
    }
    
    vector<ll> v(10);
    for(ll i=0;i<10;i++){
        v[i]=i;
    }
    do{
        if(v[s[0]-'0']==0) continue;
        ll ret = m;
        for(ll i=0;i<10;i++){
            ret += ch[i][v[i]];
            ret %= mod;
            ret += mod - m;
            ret %= mod;
        }
        if(ret == t){
            for(ll i=0;i<n;i++){
                cout << v[s[i]-'0'];
            }
            cout<<endl;
            return 0;
        }
    }while(next_permutation(v.begin(),v.end()));
    cout << -1 << endl;
    

}


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

namespace ABC139_A
{
    class Program
    {
        static void Main(string[] args) {
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            long ans = 0;
            for (int i = 0; i < s.Length; i++) {
                if(s.Substring(i, 1) == t.Substring(i, 1)) {
                    ans++;
                }
            }

            
            Console.WriteLine(ans);
        }
    }
}

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

int main() {
  int n; cin >> n;
  map<string, vector<pair<int, int>>> mp;
  set<string> nameset;
  for (int i = 0; i < n; i++) {
    string s; int p; cin >> s >> p;
    nameset.insert(s);
    mp[s].push_back(make_pair(p, i + 1));
  }
  vector<string> name;
  for (auto& e: nameset) {
    name.push_back(e);
    sort(mp[e].rbegin(), mp[e].rend());
  }
  sort(name.begin(), name.end());

  for (auto e: name) {
    for (int i = 0; i < mp[e].size(); i++) {
      cout << mp[e].at(i).second << endl;
    }
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def main():
    N, K  = map(int,input().split())
    H = list(map(int,input().split()))
    count = 0
    for i in range(len(H)):
        if H[i] >= K: count += 1
    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 51440
//PLUS ULTRA
//one who sits atop all the clans : Lion's Sin Escanor 

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long 

typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){

    int k ; cin >> k;
    string s; cin >> s;

    int n  =s.size();

    if(k >= n){
    	cout << s << "\n";
    }else{
    	forn(i,0,k){
    		cout << s[i];
    	}

    	cout << "...\n";
    }
    
    
        


}

int main(){
    SPEED;

    int t = 1; 
    
    // cin >> t;
    

    while(t--) solve();




    return 0;
}
      
       


Measured memory_bytes: 3640
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	n, _ := strconv.Atoi(nextLine())
	in := nextLine()

	res := 0
	as := make([]int, n)

	for i, an := range strings.Split(in, " ") {
		a, _ := strconv.Atoi(an)
		as[i] = a
	}

	canContinue := true

	for canContinue {
		for i, an := range as {
			if an%2 != 0 {
				canContinue = false
				break
			}

			as[i] = an / 2

			if i == n-1 {
				res++
			}
		}
	}

	fmt.Printf("%d\n", res)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)

typedef pair<int, int> Pi;
#define fi first
#define se second

signed main()
{
  string S;
  bool izryt = false, flag = true;
  stack < char > st;
  
  cin.ignore();
  while(getline(cin, S), izryt || S != ".") {
    izryt = true;
    Rep(i, S.size()) {
      if(S[i] == '.' && i == (int)S.size() - 1) {
	izryt = false;
      } else if(S[i] == '(' || S[i] == '[') {
	st.push(S[i]);
      } else if(S[i] == ')' || S[i] == ']') {
	if(!st.empty() && (S[i] == ')' && st.top() == '(' || S[i] == ']' && st.top() == '[')) {
	  st.pop();
	} else {
	  flag = false;
	}
      }
    }
    if(!izryt) {
      if(flag && st.empty()) cout << "yes" << endl;
      else cout << "no" << endl;

      while(!st.empty()) {
	st.pop();
      }
      flag = true;
    }
  }

  return 0;
}

Measured memory_bytes: 3192
#B問題
A,B = map(int,input().split())
kuti = 1
kaisu = 0
for i in range(1,1000):
    if i == 1 and B == 1:
        kaisu = 0
        break
    kuti += A-1
    if kuti >= B:
        kaisu = i
        break
print(kaisu)

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver2 {
 public:
  LL n, p;
  vector<int> isPrime, minFactor;
  vector<LL> primes;
  Solver2(LL n, LL p) : n(n), p(p), isPrime(2e6 + 10, 1), minFactor(2e6 + 10){};
  void sieveMinFactor(vector<int> &isP, vector<int> &minFac, vector<long long> &prime) {
    fill(isP.begin(), isP.end(), 1);
    long long ub = (int)isP.size();
    isP[0] = isP[1] = 0;
    minFac[0] = 0;
    minFac[1] = 1;
    for (int i = 2; i < ub; ++i) {
      if (isP[i]) {
        minFac[i] = i;
        prime.push_back(i);
        for (long long j = (long long)i * i; j < ub; j += i) {
          isP[j] = 0;
          if (minFac[j] == 0) minFac[j] = i;
        }
      }
    }
  }
  void solve() {
    sieveMinFactor(isPrime, minFactor, primes);
    map<LL, LL> m;
    for (auto x : primes) {
      while (p % x == 0) {
        m[x]++;
        p /= x;
      }
    }
    if (p > 1) m[p] = 1;
    LL ans = 1;
    DBG(m)
    for (auto x : m) {
      for (LL i = 0; i < x.second / n; ++i) {
        ans *= x.first;
      }
    }
    cout << ans << endl;
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, p;
  std::cin >> n >> p;

  Problem::Solver2 sol(n, p);
  sol.solve();
  return 0;
}


Measured memory_bytes: 18036