akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 2e5+3;

void solve(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; ++i)cin >> a[i];
	int amount = 1000;
	
	vector<int> c;
	c.push_back(a[0]);
	for(int i = 1; i < n; ++i){
		if(a[i] != a[i - 1])c.push_back(a[i]);
	}
	int sz = (int)c.size();
	vector<int> b(sz,0);
	if(c[0] > c[1])b[0] = 1;
	else if(c[0] < c[1])b[0] = -1;
	
	for(int i = 1; i < sz; ++i){
		if(i == (sz - 1)){
			if(c[i] > c[i - 1])b[i] = 1;
			else b[i] = -1;
			break;
		}
		if(c[i] > c[i - 1] and c[i] > c[i + 1])b[i] = 1;
		else if(c[i] < c[i - 1] and c[i] < c[i + 1])b[i] = -1;
	}
	int j = 0;
	while(j < sz){
		if(b[j] == -1){
			int k = j;
			j++;
			while(j < sz){
				if(b[j] == 1){
					int buy = amount / c[k];
					int rem = amount % c[k];
					amount = (rem + (buy * c[j]));
					break;
				}else j++;
			}
		}
		j++;
	}
	cout << amount << endl;
}

int32_t main(){
	IO;
	
	int nT = 1;
	//cin >> nT;
	for(int i = 1; i <= nT; ++i)
		solve();
	return 0;
}


Measured memory_bytes: 3652
S = list(input())
K = int(input())

if len(set(S)) == 1:
    print(len(S)*K //2)
else:
    cnt = [1]
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            cnt[-1] += 1
        else:
            cnt.append(1)
    
    res = 0
    for c in cnt:
        res += c//2*K

    if S[0] == S[-1]:
        if (cnt[0]+cnt[-1])%2 == 0:
            res += K-1
    
    print(res)

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

#define all(a) (a).begin(), (a).end()

int main(){
	int n,cnt=0;
	string s;
	cin>>n>>s;

	for (int i = 0; i < s.size(); ++i){
		if(s[i]=='R')
			cnt++;
	}

	if(cnt>n-cnt){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
map<string, map<string, lli>> m;
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i, 1 << n)
    {
        string red = "", blue = "";
        rep(j, n)
        {
            if ((i >> j) & 1) {
                red.push_back(s[j]);
            } else {
                blue.push_back(s[j]);
            }
        }
        m[red][blue]++;
    }
    lli ans = 0;
    rep(i, 1 << n)
    {
        string red = "", blue = "";
        rep(j, n)
        {
            if ((i >> j) & 1) {
                red.push_back(s[n + j]);
            } else {
                blue.push_back(s[n + j]);
            }
        }
        reverse(red.begin(), red.end());
        reverse(blue.begin(), blue.end());
        ans += m[blue][red];
    }
    cout << ans << endl;
}


Measured memory_bytes: 119552
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define uniq(x) ((x).erase(unique(all(x)),(x).end()))
#define sz(x) ((int)(x).size())

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

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


struct S{
  ll zero, one, inversion;
};
using F = bool;

S op(S l, S r){
  return S{
    l.zero + r.zero,
    l.one + r.one,
    l.inversion + r.inversion + l.one * r.zero
  };
}
S e(){return S{0, 0, 0};}
S mapping(F l, S r){
  if(!l)  return r;
  return S{r.one, r.zero, r.one * r.zero - r.inversion};
}
F composition(F l, F r){return (l ^ r);}
F id(){return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,Q;
  cin >> N >> Q;
  vector<S> A(N);
  rep(i,N){
    int a;
    cin >> a;
    if(a == 0)  A.at(i) = {1, 0, 0};
    else  A.at(i) = {0, 1, 0};
  }

  lazy_segtree<S, op, e, F, mapping, composition, id> seg(A);
  rep(_,Q){
    int t,l,r;
    cin >> t >> l >> r;
    l--;
    if(t == 1){
      seg.apply(l, r, true);
    }
    else if(t == 2){
      cout << seg.prod(l, r).inversion << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 20376
#include <stdio.h>

int main(){
    int N,M,a;
    long long int MOD=1000000007;
    int stairs[100000]={};
    int broken[100000];
    scanf("%d %d",&N,&M);
    for(int i=0;i<M;i++){
        scanf("%d",&broken[i]);
    }
    int j=0;
    for(int i=0;i<N;i++){
        if(i==broken[j]-1){
            j=j+1;
            continue;
        }else if(i==0){
            stairs[i]=1;
        }else if(i==1){
            stairs[i]=stairs[i-1]+1;
        }else{
            stairs[i]+=stairs[i-1];
            stairs[i]=stairs[i]%MOD;
            stairs[i]+=stairs[i-2];
            stairs[i]=stairs[i]%MOD;
        }
    }
    printf("%d",stairs[N-1]);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    cout << N*(N+1)/2 << endl;
    return 0;
}


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

using namespace std;
     
int main(){
    int N,M,X;
    int left=0,right=0;
    cin >> N >> M >> X;
    vector<int> A(M);
    vector<int> B(N+1,0);
    for(int i=0;i<M;i++){
        cin >> A.at(i);
    }
    for(int i=0;i<M;i++){
        B.at(A.at(i)) = 1;
    }
    for(int i=1;i<X;i++){
        if(B.at(i)==1) left++;
    }
    for(int i=X+1;i<N+1;i++){
         if(B.at(i)==1) right++;
    }

    cout << (left>right ? right : left) << endl;   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int sum=0;
  int tmp=N;
  int tmp1;
  while(tmp!=0){
    tmp1=tmp;
    sum+=tmp%10;
    tmp=tmp1/10;
  }
  if(N%sum==0)
     cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
      
}
 
  


Measured memory_bytes: 256
// クイックソート
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 100000
//const int INFTY = 2147483647;

typedef struct card
{
    char picture;
    int number;
}CARD;

int partition(CARD A[], int p, int r);
void quickSort(CARD A[], int p, int r);

int main(void)
{

    int n;
    CARD st_card[MAX_N], st_card_copy[MAX_N];

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> st_card[i].picture >> st_card[i].number;

        st_card_copy[i].picture = st_card[i].picture;
        st_card_copy[i].number = st_card[i].number;
    }

    quickSort(&st_card[0], 0, n - 1);

    int num_1, num_2;
    char stable[] = "Stable\n";
    char not_stable[] = "Not stable\n";
    char *str = &stable[0];

    // 安定なソートなのかを確認
    for(int i = 0; i < n; i++)
    {
        if( st_card[i].number == st_card[i + 1].number )
        {
            for(int j = 0; j < n; j++)
            {
                if( ( st_card[i].picture == st_card_copy[j].picture )
                    && ( st_card[i].number == st_card_copy[j].number ) )
                {
                    num_1 = j;
                }

                if( ( st_card[i + 1].picture == st_card_copy[j].picture )
                    && ( st_card[i + 1].number == st_card_copy[j].number ) )
                {
                    num_2 = j;
                }
            }

            if( num_1 > num_2 )
            {
                str = &not_stable[0];
                // 処理終了
                break;
            }
        }
    }

    printf("%s", str);

    for(int i = 0; i < n; i++)
    {
        printf("%c %d\n", st_card[i].picture, st_card[i].number);
    }

    return 0;
}

// クイックソートを実施する関数
// p : 範囲の先頭
// q : 範囲の最後尾
void quickSort(CARD A[], int p, int r)
{
    int q;

    if( p < r )
    {
        q = partition(A, p, r);
        quickSort(A, p, q - 1);
        quickSort(A, q + 1, r);
    }

    return;
}

// パーティション ソート の実施
// A[r]を基準として, 小さい要素は左側, 大きい要素は右側に並ぶ
// p : 範囲の先頭
// q : 範囲の最後尾
int partition(CARD A[], int p, int r)
{
    int x = 0, i = 0;
    CARD tmp;

    x = A[r].number;
    i = p - 1;

    for(int j = p; j < r; j++)
    {
        if( A[j].number <= x )
        {
            i++;

            // A[i] と A[j]を交換
            tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }

    // A[i + 1] と A[r]を交換
    tmp = A[i + 1];
    A[i + 1] = A[r];
    A[r] = tmp;

    return i + 1;
}



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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;
const int N = 110, mod = 1e9 + 7;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

int mx[N], f[N][N * N];

I int pow_mod(reg a, reg k) {reg ans = 1; for(; k; k >>= 1, a = (LL)a * a % mod) if(k & 1) ans = (LL)ans * a % mod; return ans;}
I int add(cr x, cr y) {return x + y >= mod ? x + y - mod : x + y;}

int main() {
	reg n = read(), k = read();
	f[n + 1][0] = 1, mx[n + 1] = 0;
	fd(i, n, 1) fo(j, 0, mx[i + 1]) if(f[i + 1][j]){
		fo(h, 0, k) {
			if(h <= i) {
				reg c = j + (j + h) / i;
				mx[i] = _max(mx[i], c), f[i][c] = add(f[i][c], f[i + 1][j]);
			} else {
				mx[i] = _max(mx[i], j), f[i][j] = add(f[i][j], f[i + 1][j]);
			}
		}
	} reg ans = (LL)k * (k + 1) / 2 * n * pow_mod(k + 1, n - 1) % mod;
	fo(i, 0, mx[1]) ans = (ans - (LL)i * f[1][i]) % mod;
	pr2(ans < 0 ? ans + mod : ans);
	return 0;
}



Measured memory_bytes: 2560
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
mod = 10**9 + 7

#maincode-------------------------------------------------

n = ini()
a = inl()
A = 10**6 + 5
b = [0] * A
ans = 0

for i in a:
    if b[i] != 0:
        b[i] = 2
        continue
    for i in range(i,A,i):
        b[i] += 1

for i in a:
    if b[i] == 1:
        ans += 1

print(ans)

Measured memory_bytes: 33440
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N,K=get_i
l=get_i.sort{|x,y| y<=>x}
puts l[0..K-1].inject(:+)

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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<long long> vecll;
typedef vector<unsigned long long> vecull;


int n;

int main(void) {
    cin >> n;

    veci odds(100001, 0);
    veci evens(100001, 0);

    int odd_max = 0, odd_max2 = 0;
    int even_max = 0, even_max2 = 0;

    rep(i, n) {
        int v;
        cin >> v;
        if (i % 2 == 0) {
            odds[v]++;
            if (odd_max != v && odds[v] >= odds[odd_max]) {
                odd_max2 = odd_max;
                odd_max = v;
            }
        }
        else {
            evens[v]++;
            if (even_max != v && evens[v] >= evens[even_max]) {
                even_max2 = even_max;
                even_max = v;
            }
        }
    }

    int ans = (n / 2) - odds[odd_max] + (n / 2) - evens[even_max];
    if (odd_max == even_max) {
        ans = min((n / 2) - odds[odd_max2] + (n / 2) - evens[even_max], (n / 2) - evens[even_max2] + (n / 2) - odds[odd_max]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<pi>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}


double memo[301][301][301];
double f(int i, int j, int k, int n) {
    if(i + j + k == 0) return 0.0;
    if(memo[i][j][k] != 0.0) return memo[i][j][k];
    double s = i + j + k;
    double ret = n - s;
    if(i) ret += (f(i - 1, j, k, n) + 1) * i;
    if(j) ret += (f(i + 1, j - 1, k, n) + 1) * j;
    if(k) ret += (f(i, j + 1, k - 1, n) + 1) * k;
    ret /= s;
    memo[i][j][k] = ret;
    return ret;
}



int main(){
    double n, r, a = 0, b = 0, c = 0;
    cin >> n;
    rep(i, n) {
        cin >> r;
        if (r == 1) a ++;
        else if (r == 2) b ++;
        else c ++;
    }
    cout << fixed << setprecision(15) << f(a, b, c, n) << endl;
}



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

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;
	
	long long int sum1=0,sum2=0;
	cin>>sum2;
	long long int temp = sum2;
	while(temp > 0){
		sum1 += temp % 10;
		temp /= 10;
	}
	
	if(sum2 % sum1 == 0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define roop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int n;
    cin >> n;

    map<string, int> mp;

    roop(i, n){
        string s; cin >> s;
        mp[s]++;
    }

    cout << mp.size() << endl;

    return 0;
}


Measured memory_bytes: 19268
// inputに入力データ全体が入る
function Main(input) {
  var ans = 0;
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.trim().split("\n");
  // var [N] = input[0].split(" ").map((n) => parseInt(n));
  if( input[0][input[0].length -1] == 's') {
    input += 'es'
  } else {
    input += 's'
  }


  console.log(input);
}
// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require("fs").readFileSync("./input.txt", "utf-8"));


Measured memory_bytes: 29676
use proconio::input;

fn main() {
    input! {
        x: i64,
    };
    let mut res = 100;
    let mut count = 0;

    while x > res {
        res = res as i64 + (res / 100) as i64;
        count = count + 1;
    }
    println!("{}", count);
}



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

int main() {
  int A1 , A2 , A3 ; 
  cin >> A1 >> A2 >> A3 ;
  
  if (A1 + A2 + A3 >= 22){
    cout << "bust" << endl  ;
  }
  else {
    cout << "win" << endl ; 
  }
  
  
  
  
  
  
  
  
  
}


Measured memory_bytes: 3632
n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in [0]*n]
ans = 0
for i in range(n):
    for j in range(i+1, n):
        tmp = sum((k-l)**2 for k, l in zip(x[i], x[j]))
        if (tmp**0.5).is_integer():
            ans += 1
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 r=sc.nextInt();
		int c=sc.nextInt();
		long[][] a=new long[r+1][c+1];
        
        for(int i=0;i<r;i++){
            for(int j=0;j<c;j++){
				a[i][j]=sc.nextInt();
                a[r][j]+=a[i][j];
                a[i][c]+=a[i][j];  
            }
            a[r][c]+=a[i][c];
        }
        for(int i=0;i<=r;i++){
            for(int j=0;j<=c;j++){
                if(j!=c){
            		System.out.print(a[i][j]+" ");
                }else{
                	System.out.print(a[i][j]);
                }
            }
            System.out.println();
        }
        sc.close();
    }
}



Measured memory_bytes: 41140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 10000000000000000LL;
int N,M;
ll p[100003];
ll L[100002];//[p[i],p[i+1])
ll Lx[100002];
ll Ly[200002];
ll s[100001],t[100001];
int main(){
  cin >> N >> M;
  for(int i=0;i<N;i++)
    cin >> s[i] >> t[i];
  p[0] = 0;
  p[M+1] = INF;
  for(int i=1;i<M+1;i++)
    cin >> p[i];
  M+=2;

  sort(p,p+M);

  ll gs=0,ks=0;  
  for(int i=1;i<M;i++){
    if( i & 1 ) ks += (p[i]-p[i-1]);
    else gs += (p[i] - p[i-1]);
    Lx[i] = p[i] - gs;
    Ly[i] = p[i] - ks;
  }

  ll res = 0 ;
  for(int i=0;i<N;i++){
    if( s[i] < t[i] ){
      int id = upper_bound(p,p+M,s[i]) - p;
      int jd = upper_bound(p,p+M,t[i]) - p - 1;
      res += abs( p[id]-s[i] );
      if( id & 1 ) res += Lx[jd] - Lx[id];        
      else res += Ly[jd] - Ly[id];
      if( ( jd - id ) & 1 ) res += abs( p[jd] - t[i] );    
    } else {
      int id = upper_bound(p,p+M,s[i]) - p - 1;
      int jd = upper_bound(p,p+M,t[i]) - p;
      res += abs( p[id]-s[i] );
      if( id & 1 ) res += Ly[id] - Ly[jd];        
      else res += Lx[id] - Lx[jd];
      if( ( jd - id ) & 1 ) res += abs( p[jd] - t[i] );    

    }
  }

  cout << res << endl;
  

}

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

int main()
{
    std::vector<std::pair<int, int>> d(26, std::pair<int, int>(0, 0));
    std::string s; std::cin >> s;
    for (int i = 0; i < (int)s.size(); i++){
        int cc = s[i] - 'a';
        auto& dd = d[cc];
        dd.second = std::max(dd.second, i - dd.first);
        dd.first = i+1;
    }
    for (auto& dd: d) {
        dd.second = std::max(dd.second, (int)s.size() - dd.first);
    }
    /*
    for (int i = 'a'; i < 'z'; i++) {
        const auto dd = d[i - 'a'];
        if (dd.second < s.size()) {
            std::cout << (char)i << " " << dd.second << std::endl;
        }
    }
    */
    std::sort(d.begin(), d.end(), [](const auto& a, const auto& b){
        return a.second < b.second;
    });

    std::cout << d[0].second << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


class Combination:
    def __init__(self, n: int, mod: int):
        self.mod = mod
        self.fact = [0] * (n + 1)
        self.factinv = [0] * (n + 1)
        self.inv = [0] * (n + 1)
        
        self.fact[0] = self.fact[1] = 1
        self.factinv[0] = self.factinv[1] = 1
        self.inv[1] = 1
        for i in range(2, n + 1):
            self.fact[i] = (self.fact[i - 1] * i) % mod
            self.inv[i] = (-self.inv[mod % i] * (mod // i)) % mod
            self.factinv[i] = (self.factinv[i - 1] * self.inv[i]) % mod
    
    def ncr(self, n: int, r: int):
        if r < 0 or n < r:
            return 0
        r = min(r, n - r)
        return self.fact[n] * self.factinv[r] % self.mod * self.factinv[n - r] % self.mod
    
    def nhr(self, n: int, r: int):
        return self.ncr(n + r - 1, r)
    
    def npr(self, n: int, r: int):
        if r < 0 or n < r:
            return 0
        return self.fact[n] * self.factinv[n - r] % self.mod


def solve():
    N, M = map(int, rl().split())
    MOD = 10 ** 9 + 7
    
    com = Combination(5 * 10 ** 5, MOD)
    ans = 0
    for i in range(N + 1):
        exp = -1 if i % 2 == 1 else 1
        ans += com.ncr(N, i) * exp * com.npr(M, i) * com.npr(M - i, N - i) ** 2
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    solve()


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

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;

ll n, a, b;
vector<ll> mon;

bool val(ll ex) {
	ll lb = b * ex;
	ll dropped = 0;
	
	for (int i = 0; i < n; ++i) {
		ll val = mon[i] - lb;
		if (val > 0) {
			dropped += ceil((long double)val / (a - b));
		}
	}
	
	return dropped <= ex;
}

ll bsearch(ll l, ll r) {
	if (l == r) return l;
	if (l + 1 == r) {
		if (val(l)) return l;
		return r;
	} else {
		ll m = (l + r) / 2;
		if (val(m)) return bsearch(l, m);
		else return bsearch(m + 1, r);
	}
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> n >> a >> b;
	mon.resize(n);
	for (auto& i : mon) cin >> i;
	cout << bsearch(0, 1e9);
}


Measured memory_bytes: 3992
#include<stdio.h>
int main(void){
    int n,a[1000]={0},b[1000]={0},c[1000]={0},cuta[1000],cutb[1000],cutc[1000],i,j,k,x,y[1000]={0},z;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        scanf("%d",&b[i]);
        scanf("%d",&c[i]);
    }
    for(j=0;j<n;j++){
        for(k=j+1;k<n;k++){
            if(a[j]==a[k]){
                cuta[j]=1;
                cuta[k]=1;
            }
        }
    }
    for(j=0;j<n;j++){
        for(k=j+1;k<n;k++){
            if(b[j]==b[k]){
                cutb[j]=1;
                cutb[k]=1;
            }
        }
    }
    for(j=0;j<n;j++){
        for(k=j+1;k<n;k++){
            if(c[j]==c[k]){
                cutc[j]=1;
                cutc[k]=1;
            }
        }
    }
    for(i=0;i<n;i++){
        if(cuta[i]==1)a[i]=0;
        if(cutb[i]==1)b[i]=0;
        if(cutc[i]==1)c[i]=0;
        z=a[i]+b[i]+c[i];
        printf("%d\n",z);
    }
    return 0;
}

Measured memory_bytes: 620
#include<iostream>
#include<algorithm>
#include<queue>
typedef long long ll;
using namespace std;
const int maxn = 1e5+10;
vector<int>ve[maxn];
//如果想要队列 从小到大排列 

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	int a,b;
	for(int i=1;i<=n;i++)
	{
		cin>>a>>b;
		if(a<=m)
		{
			ve[m-a+1].push_back(b);
		}
	}
	ll ans = 0;
	priority_queue<int>que;//队列从小到大飘排列 
	for(int i=m;i>=1;i--)
	{
		for(auto v:ve[i])
			que.push(v);
		if(!que.empty())
		{
			ans+=que.top();	
			que.pop();
		}	
	}
	cout<<ans<<endl;
	return 0;
}

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

#define CK(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second
#define ll long long;

const int INF = 1e9;
const long long  LLINF = 1e15;

using namespace std;
long long N, S[105];

bool dp[110][10010];

int main() {
  cin>>N;
  long long sumd = 0, sum = 0;
  REP(i,0,N){
    cin>>S[i];
  }

  dp[0][0] = true;

  REP(i,0,N){
    REP(j,0,10010-S[i]){
      if(dp[i][j]){
        dp[i+1][j] = true;
        dp[i+1][j+S[i]] = true;
      }
    }
  }

  int ans = 0;
  REP(i,0,N+1){
    REP(j,0,10010){
      if(dp[i][j] && j%10 != 0){
        ans = max(ans, j);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
a[3],*d,i=11,t;main(b){for(;--i;)for(scanf("%d",&b),d=a;d<a+3;d++)*d<b?t=b,b=*d,*d=t:0;return !printf("%d\n%d\n%d\n",a[0],a[1],a[2]);}

Measured memory_bytes: 0
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();
    for (int i=A; i<=B; i++) {
      if (i >= A && i <= A + K - 1) {
        System.out.println(i);
        continue;
      }
      if (i >= B - K + 1 && i <= B) {
        System.out.println(i);
        continue;
      }
    }
  }
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N;
int B[110];

signed main() {
    cin >> N;
    rep(i, N - 1) {
        cin >> B[i];
    }
    int ans = 0;
    ans += B[0];//A[0]=B[0]
    for (int i = 1; i < N - 1; ++i) {
        ans += min(B[i - 1], B[i]);
    }
    ans += B[N - 2];
    cout << ans << endl;
    return 0;
}


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

int main(){
    int a,b,c,x,y,s,t,r;
    cin >> a >> b >> c >> x >> y;
   	if(x >= y){
    	s = (2*c*y + (x-y)*a);
    } 
    else{
     	s = (2*c*x + (y-x)*b);
    }
    t = (a*x + b*y);
    r = c*max(x,y)*2;
    cout << min({s,t,r}) << endl;
}

Measured memory_bytes: 256
from math import gcd
def resolver(X):
    i = 1
    while True:
        if (360 * i) % X == 0:
            return (360 * i) // X
        i += 1



def main():
    X = int(input())
    ans = resolver(X)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9108
#include <iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>

using namespace std;

int main(){
    string S;
    cin >> S;
    int X;
    vector<int> v(S.size()-2,30000);
    int j=0;
    for(int i=2;i<S.size();i++){
        X=(S[i]-'0')+(S[i-1]-'0')*10+(S[i-2]-'0')*100;
        v[j]=max(753,X)-min(753,X);
        j++;
    }
    sort(v.begin(),v.end());
    cout << v[0] << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

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

type Pair struct {
	a int
	b int
}

func solve(n int, p []Pair) string {
	sort.Slice(p, func(i, j int) bool {
		return p[i].b < p[j].b
	})
	ans := "Yes"
	t := 0
	for i := 0; i < n; i++ {
		t += p[i].a
		if t > p[i].b {
			ans = "No"
			break
		}
	}
	return ans
}

func main() {
	n, _ := strconv.Atoi(input())
	p := make([]Pair, n)
	for i := 0; i < n; i++ {
		a, _ := strconv.Atoi(input())
		b, _ := strconv.Atoi(input())
		p[i] = Pair{a, b}
	}
	fmt.Println(solve(n, p))
}


Measured memory_bytes: 7632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int k = scanner.nextInt();
		int lastMinus = -1;
		int[] candles = new int[n];
		for (int i=0; i<n; i++){
			candles[i] = scanner.nextInt();
			if (candles[i]<0) lastMinus++;
		}
		int ans = Integer.MAX_VALUE;
		int minI;
		int maxI = Math.min(n-1, lastMinus+k);
		if (lastMinus<n-1 && candles[lastMinus+1]==0) {
			minI = Math.max(0, lastMinus-k+2);
		}else {
			minI = Math.max(0, lastMinus-k+1);
		}
		for (int i=minI; i<=maxI-k+1; i++){
			int left = candles[i];
			int right = candles[i+k-1];
			if (left<0 && right<=0) ans = Math.min(ans, -left);
			else if (0<=left && 0<right) ans = Math.min(ans, right);
			else ans = Math.min(ans, right-left+Math.min(-left, right));
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 49740
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(s: str, x: int, y: int):
    s_list = list(map(len,s.split("T")))
    x_s_list = s_list[0::2]
    y_s_list = s_list[1::2]

    x_dp = [set() for _ in range(len(x_s_list))]
    for index,count in enumerate(x_s_list):
        ## 最初は
        if index == 0:
            x_dp[index].add(count)
            continue
        
        for j in x_dp[index-1]:
            x_dp[index].add(j-count)
            x_dp[index].add(j+count)


    y_dp = [set() for _ in range(len(y_s_list))]
    for index,count in enumerate(y_s_list):
        ## 最初は
        if index == 0:
            y_dp[index].add(count)
            y_dp[index].add(-count)  
            continue
        
        for j in y_dp[index-1]:
            y_dp[index].add(j-count)
            y_dp[index].add(j+count)
    
    if not y_dp:
        if y != 0:
            print(NO)
        else:
            if x in x_dp[-1]:
                print(YES)
            else:
                print(NO)
        return

    if not x_dp:
        if x != 0:
            print(NO)
        else:
            if y in y_dp[-1]:
                print(YES)
            else:
                print(NO)
        return

    if x in x_dp[-1] and y in y_dp[-1]:
        print(YES)
    else:
        print(NO)

    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(s, x, y)

if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N;
  if(N%1000==0){
      cout << 0 <<endl;
  }
  else{
      int a;
      a=N/1000;
      cout << 1000*(a+1)-N << endl;
  }
  }


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

int main(){
  int n;
  cin >> n;
  int a[110];
  for(int i = 0;i < n; ++i) cin >> a[i];

  sort(a,a+n,greater<int>());
  int anko = a[0];
  sort(a,a+n);
  int maojini = a[0];
  
  cout << anko - maojini << endl;
  
  return 0;
}

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

namespace Watch
{
    class Program
    {
        static void Main(string[] args)
        {
            int second = int.Parse(Console.ReadLine());

            int hour = second / 3600;
            int restS = second % 3600;
            int minute = restS / 60;
            int restS2 = restS % 60;

            Console.WriteLine(hour + ":" + minute + ":" + restS2);
        }
    }
}



Measured memory_bytes: 15968
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
const int maxn = int(4e4) + 7, P = int(1e9) + 7;
typedef long long ll;
ll fac[maxn], inv[maxn];
ll Pow(ll x,ll y){
    x%=P;
    ll ans=1;
    while(y){
        if (y&1) ans=ans*x%P;
        x=x*x%P;
        y>>=1;
    }
    return ans%P;
}
void init() {
    fac[0] = 1;
    for (int i = 1; i <= maxn - 10; ++i) fac[i] = fac[i - 1] * i % P;
    inv[maxn - 10] = Pow(fac[maxn - 10], P - 2);
    for (int i = maxn - 11; i >= 0; --i) inv[i] = inv[i + 1] * (i + 1) % P;
}

ll C(int x, int y) {
    return fac[x] * inv[y] % P * inv[x - y] % P;
}

int n, a[2000007], b[2000007], dp[4007][4007];

int main() {
//    freopen("in.txt", "r", stdin);
    init();
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d%d", a + i, b + i);
        dp[2001 - a[i]][2001 - b[i]]++;
    }
    for (int i = 1; i <= 4001; i++)
        for (int j = 1; j <= 4001; j++) {
            dp[i][j] = (dp[i][j] + dp[i - 1][j]) % P;
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % P;
        }
    ll ans = 0;
    for (int i = 1; i <= n; i++) ans = (ans + dp[2001 + a[i]][2001 + b[i]]) % P;
    for (int i = 1; i <= n; i++) ans = (ans - C(a[i] + a[i] + b[i] + b[i], a[i] + a[i]) + P) % P;
    printf("%lld\n", ans * Pow(2, P - 2) % P);
    return 0;
}

Measured memory_bytes: 67928
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000

using vi = vector<int>;


int main() {

	int a;
	string s;

	cin >> a >> s;

	cout << (a >= 3200 ? s : "red") << endl;

	return 0;
}

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

int main() {
  int A,B;
  char op,pu;
  cin >> A >> op>> B;
  pu ='+';
  
  if (op == pu){
    cout << A+B << endl;
  }
  else {
    cout << A-B << endl;
  }
       
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
# define int long long
# define mo 1000000007
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

signed main()
{
   gok
    int a,b;
    cin>>a>>b;
    int gg = __gcd(a,b);
    cout<<(a*b)/gg;
    return 0;
}


Measured memory_bytes: 384
ABCD = list(input())
A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])
L = []
L.append(A+B+C+D)
L.append(A+B+C-D)
L.append(A+B-C+D)
L.append(A-B+C+D)
L.append(A+B-C-D)
L.append(A-B+C-D)
L.append(A-B-C+D)
L.append(A-B-C-D)
for i in range(len(L)) :
    if L[i] == 7 :
        if i == 0 or i == 1 or i == 2 or i == 4 :
            p1 = "+"
        else :
            p1 = "-"
        if i == 0 or i == 1 or i == 3 or i == 5 :
            p2 = "+"
        else :
            p2 = "-"
        if i == 0 or i == 2 or i == 3 or i == 6 :
            p3 = "+"
        else :
            p3 = "-"
        break
print("{}{}{}{}{}{}{}=7".format(A,p1,B,p2,C,p3,D))


Measured memory_bytes: 3064
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

#define Ms(s, n) memset(s, n, sizeof(s))
#define Rp(i,l,m) for(int i=l; i<m; ++i)
#define Rpd(i,l,m) for(int i=l; i>=m; --i)
#define Rpp(i,l,m) for(int i=l; i<=m; i++)
#define RpAll(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define All(a) (a).begin(), (a).end()
#define Fi first
#define Se second
#define Pb push_back
#define Pf push_front
#define Is insert
#define Sz(a) int((a).size())
#define ooi INT_MAX
#define ool LLONG_MAX
typedef long long ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
const int MOD = (int) 1e9 + 7;
const ld PI = acos((ld) -1);
inline ll gcd(ll a,ll b) {ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
inline ll fpow(ll n,ll k){ll r=1; for(;k;k>>=1){if(k&1)r=r*n%MOD;n=n*n%MOD;}return r;}
const int base = 311;
const int N = 2e5 + 5;

ll n, m, k, test, a[N], F[N][3];

void Solve(){
    cin >> n;
    bool ok = true;
    int mx = 0;
    for(int i = 1; i<=n; i++){
        int x;
        cin >> x;
        if(mx - x > 1) ok = false;
        mx = max(mx, x);
    }
    if(ok) cout << "Yes"; else cout << "No";
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    Solve();
    return 0;
}



















Measured memory_bytes: 256
#import "stdio.h"
int main() {
  int x1,y1,x2,y2;
  scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
  printf("%d %d %d %d",x2+y1-y2,y2+x2-x1,y1-y2+x1,x2-x1+y1);
  return 0;
}


Measured memory_bytes: 7496
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(fabs(a-c)<=d||(fabs(a-b)<=d&&fabs(b-c)<=d))
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	} 
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

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

    if(((A < C) && (C < B)) || ((B < C) && (C < A))){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define sd(t)       scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii         cout << "hii" << endl
#define okay        cout << "okay" << endl
#define hey         cout << "hey" << endl
const int INF = 1e12;
const int MOD = 998244353;
const int mod = 1e9+7;


template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.x << ' ' << v.y; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.x << "=>" << i.y << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("jjj.txt", "w", stdout);
    #endif
} 

inline int mul(int a, int b, int m = mod) { return (a * b) % m; }
inline int add(int a, int b, int m = mod) { return (a + b) % m; }
inline int sub(int a, int b, int m = mod) { return (a - b + m) % m; }

const int N = 2e6+5;

void solve(){
    int n;
    cin >> n;

    vi arr(n+1, 1);

    arr[0] = 0;
    for(int i=2; i<n; i++){
        for(int j=i; j<n; j+=i){
            arr[j]++;
        }
    }

    int ans = accumulate(all(arr), 0);
    cout << ans-1 << endl;
}                            

int32_t main(){
    fast();
    int t = 1;
    // cin>> t;
    for(int i=1; i<=t; i++){
        // cout << "Case #" << i << ": ";
        solve();
    }
    starboy1299();
}

Measured memory_bytes: 11152
import heapq

N,M = (int(x) for x in input().split())
A = []

A = list((-1)*(int(x)) for x in input().split())
heapq.heapify(A)

sum = 0

while M != 0:
    heapq.heappush(A,int(heapq.heappop(A)/2))
    M -= 1

for i in range(len(A)):
    sum += -A[i]

print(sum)




Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<char>> c(h,vector<char> (w));
  for(int i = 0;i < h;i++) {
    for(int j = 0;j < w;j++) {
      cin >> c.at(i).at(j);
    }
  }
  for(int i = 0;i < 2 * h;i++) {
    for(int j = 0;j < w;j++) {
      cout << c.at(i / 2).at(j);
    }
    cout << endl;
  }
}

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

int check_overlap(int &l, int &r, int l2, int r2);

int main()
{

	int n,m;
	cin >> n >> m;

	vector<pair<int,int>> request(m);
	for (int i=0;i<m;++i)
	{
		cin >> request[i].first >> request[i].second;
	}
	sort(request.begin(),request.end());

	int count=1;
	int left=request[0].first;
	int right=request[0].second;

	for (int i=1;i<m;++i)
	{
		if (check_overlap(left,right,request[i].first,request[i].second)==0)
		{
			// no overlap
			++count;
			left=request[i].first;
			right=request[i].second;
		}
	}

	cout << count << endl;


}

int check_overlap(int &l, int &r, int l2, int r2)
{
	// l<=l2 is guaranteed in this program
	if (l2<r)
	{
		// overlapped - update l & r to overlapped range
		l=l2;
		if (r2<r)
		{
			r=r2;
		}
		return 1;
	}
	else
	{
		// not overlapped
		return 0;
	}
}




Measured memory_bytes: 1024
//author: chinmay0402
//One day your whole life will flash before your eyes, make sure you make it worth watching
#include<bits/stdc++.h>
using namespace std;

//policy based data structures
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define ll long long int
#define lld long double
#define fl float
#define vs vector<string>
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll>>
#define fst first
#define scd second
#define sll set<ll>
#define mll map<ll,ll>
#define flash ios_base::sync_with_base(false);cin.tie(NULL);
#define INF (ll)10000000000000000
#define MOD (ll)1000000007
#define pb push_back
#define mll map<ll,ll>
#define test ll t;cin>>t;while(t--)
#define sortv(v) sort(v.begin(),v.end())
#define max3(a,b,c) max(a,max(b,c))

#define forn(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define fornr(i,n) for(ll i=n-1;i>=0;i--)
#define forab(i,a,b,c) for(ll i=a;i<=b;i+=c)

template<typename T>
void read(T &x){
 cin>>x;
}
template<typename T,typename T1>
void read(T &x, T1 &y){
 cin>>x>>y;
}
template<typename T,typename T1, typename T2>
void read(T &x, T1 &y, T2 &z){
 cin>>x>>y>>z;
}
template<typename T,typename T1, typename T2, typename T3>
void read(T &x, T1 &y, T2 &z , T3 &a){
 cin>>x>>y>>z>>a;
}
template<typename T>
void reada(T oneD,ll n){
 for(ll i=0;i<n;i++)
  cin>>oneD[i];
}
template <typename T>
void readv(vector< T > &oneD,ll n){
 forn(i,n){
  ll x;
  read(x);
  oneD.push_back(x);
 }
}

#define iread1(n) ll n;read(n);
#define iread2(n,m) ll n,m;read(n,m);
#define iread3(x,y,z) ll x,y,z;read(x,y,z);

ll gcd(ll a, ll b){
 if(a==0)
  return b;
 else
  return gcd(b%a,a);
}

ll gcdExt(ll a,ll b, ll &x, ll &y){
 if(a==0){
  x=0;
  y=1;
  return b;
 }
 ll x1,y1;
 ll gcd=gcdExt(b%a,a,x1,y1);
 x=y1-(b/a)*x1;
 y=x1;
 return gcd;
}

ll pwr(ll a, ll b){
 ll res=1;
 while(b>0){
  if(b&1)
   res=res*a;
  a*=a;
  b>>=1;
 }
 return res;
}

ll pwrm(ll a, ll b, ll m){
 a%=m;
 ll res=1;
 while(b>0){
  if(b&1)
   res=res*a%m;
  a=a*a%m;
  b>>=1;
 }
 return res;
}

ll pwrm_which_works_too(ll a, ll b, ll m){
 a%=m;
 if(a==0)
  return 0;
 else if(b==0)
  return 1;
 else if(b&1)
  return (a*pwrm(a,b/2,m)%m*pwrm(a,b/2,m)%m)%m;
 else
  return (pwrm(a,b/2,m)%m*pwrm(a,b/2,m)%m)%m;
}

vector<bool>sieve(1000000,true);
void Sieve(){
 sieve[0]=false;
 sieve[1]=false;
 for(ll i=2;i*i<=1000000;i++){
  if(sieve[i]==true){
   for(ll j=i*i;j<1000000;j+=i)
    sieve[j]=false;
  }
 }
}

vll sieve_spf(1000001);
void Sieve_spf(){
 ll n=1000001;
 
 forn(i,n)
  sieve[i]=i;
 
 sieve[0]=-1;
 sieve[1]=-1;
 
 forab(i,2,n,2)
  sieve[i]=2;
 
 forab(i,3,n,2)
  if(sieve[i]==i)
   forab(j,i*i,n,i)
    if(sieve[j]==j)
     sieve[j]=i;
}


int main(){
 
 #ifdef ENABLE_FILE_IO
 freopen("in", "r", stdin);
 freopen("out", "w", stdout);
 #endif

 //START OF PROGRAM LOGIC
  iread2(n,k);
  ll ans=0;
  for(ll i=k;i<=n+1;i++){
   ans=(ans+i*(n-i+1)+1)%MOD;
  }
  cout<<ans%MOD<<"\n";
 //END OF PROGRAM LOGIC
 return 0;
}


Measured memory_bytes: 10976