akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const ll INF = 1e9;
const double pi=acos(-1);

int main(){
  string s,t;
  cin >> s >> t;
  
  vector<vector<int>>vec(26);
  rep(i,s.size()){
    vec[s[i]-'a'].push_back(i);
  }
  rep(i,s.size()){
    vec[s[i]-'a'].push_back(i+s.size());
  }
  
  ll ans=0;
  ll now=-1;
  rep(i,t.size()){
    int c = t[i]-'a';
    if(vec[c].size()==0){
      cout << -1 << endl;
      return 0;
    }
    now = *upper_bound(vec[c].begin(),vec[c].end(),now);
    if(now>=s.size()){
      ans+=s.size();
      now-=s.size();
    }
  }
  ans+=now+1;
  cout << ans << endl;
}


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

int main(){
  int N; cin >> N;
  int p[100010];
  for(int i=0; i<N; i++){
    int a; cin >> a;
    if(i==a-1) p[i]=1;
    else p[i]=0;
  }
  int result=0;
  bool isSingle=false; //直前に1（が奇数個）あればtrue
  for(int i=0; i<N; i++){
    if(p[i]==0){
      if(isSingle){
        result++;
        isSingle=false;
      }
    }else{
      if(isSingle){
        result++;
        isSingle=false;
      }
      else{
        isSingle=true;
      }
    }
  }
  if(isSingle) result++;
  cout << result << endl;
}

Measured memory_bytes: 640
use proconio::input;


fn main() {
    input! {
        a: usize,
        b: usize,
        m: usize,
        va: [i32; a],
        vb: [i32; b],
        x: [(usize, usize, i32); m]
    }

    let mut ans = va.iter().min().unwrap()
                  + vb.iter().min().unwrap();

    for xi in x {
        let (ai, bi, c) = xi;
        ans = std::cmp::min(ans, va[ai-1] + vb[bi-1] - c);
    }

    println!("{}", ans);
}


Measured memory_bytes: 7916
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}


int main() {
  int n;
  scanf("%d", &n);
  vvi a(n, vi(n, 0));
  rep (i, n) {
    rep (j, n) {
      scanf("%d", &a[i][j]);
    }
  }
  int INF = INT_MAX / 2;
  vvi kingdom(n, vi(n, INF));
  rep (i, n) {
    rep (j, n) {
      if (i == j) { continue; }
      bool flag;
      flag = false;
      rep (k, n) {
        if (i == k || j == k) { continue; }
        if (a[i][k] + a[k][j] < a[i][j]) {
          printf("-1\n");
          return 0;
        }
        if (a[i][k] + a[k][j] == a[i][j]) {
          flag = true;
          break;
        }
      }
      if (flag) {
      } else {
        kingdom[i][j] = kingdom[j][i] = a[i][j];
      }
    }
  }

  ll ans = 0;
  rep (i, n) {
    rep (j, n) {
      if (kingdom[i][j] < INF) {
        ans += kingdom[i][j];
      }
    }
  }
  ans /= 2;
  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1528
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int n, m;
vector<vector<int>> s;
vector<int> p;
bool check(set<int> on){
    bool ok = true;
    for(int i = 0; i < m; i++){
        int cnt = 0;
        for(int j = 0; j < s[i].size(); j++){
            if(on.find(s[i][j]) != on.end()){
                cnt++;
            }
        }
        if(cnt % 2 != p[i]){
            return false;
        }
    }
    return true;
}
int rec(int now, set<int> on){
    if(now == n){
        if(check(on)) return 1;
        return 0;
    }

    set<int> nexton = on;
    nexton.insert(now);
    return rec(now + 1, on) + rec(now + 1, nexton);
}
int main(void){
    cin >> n >> m;
    s.resize(m);
    p.resize(m);

    for(int i = 0; i < m; i++){
        int k;
        cin >> k;
        for(int j = 0; j < k; j++){
            int ss;
            cin >> ss;
            ss--;
            s[i].push_back(ss);
        }
    }

    for(int i = 0; i < m; i++) cin >> p[i];
    set<int> on;
    cout << rec(0, on) << endl;
}   

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N), F(N);
    for (ll i = 0; i < N; i++) cin >> A[i];
    for (ll i = 0; i < N; i++) cin >> F[i];
    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<ll>());
    ll upper = 0;
    ll lower = 0;
    for (ll i = 0; i < N; i++) upper = max(upper, A[i] * F[i]);
    while (1) {
        if (upper == lower) break;
        ll medium = (upper + lower) / 2;
        ll training = 0;
        for (ll i = 0; i < N; i++) {
            if (A[i] * F[i] > medium) {
                training += A[i] - medium / F[i];
            }
        }
        if (training > K) lower = medium + 1;
        else upper = medium;
    }
    cout << upper << endl;

    return 0;
}


Measured memory_bytes: 3328
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

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

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

	char pre = '0';
	int cnt = 0;
	int ret = 0;
	REP(i, 3){
		if(S[i] == 'R'){
			if(pre == 'R') cnt++;
			else cnt = 1;
			ret = max(ret, cnt);
		}
		pre = S[i];
	}

	cout << ret << endl;


	return 0;
}


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

int main(void){
    int n, p[20020], s[20020], a[20020], b[20020];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
        s[p[i]] = 900000000 + i;
    }
    
    a[n] = 1000000000;  b[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
        b[i] = b[i + 1] + 1;
        a[i] = s[i] - b[i];
        if (a[i] >= a[i + 1]) {
            a[i] = a[i + 1] - 1;
            b[i] = s[i] - a[i];
        }
    }
    for (int i = 0; i < n; i++) cout << a[i] << " ";
    cout << endl;
    for (int i = 0; i < n; i++) cout << b[i] << " ";
    cout << endl;
    /*
    for (int i = 0; i < n; i++) cout << p[i] << " ";
    cout << endl;
    for (int i = 0; i < n; i++) cout << s[i] << " ";
    cout << endl;*/
    
}


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

int a[5], cnt;

bool CMP (int x,int y)
{
	return x<y;
}

int main()
{
	scanf("%d%d%d", &a[1], &a[2], &a[3]);
	sort(a+1, a+4, CMP);
	for(int i=1; ; i++)
	{
		if(a[1]==a[2] && a[2]==a[3]) break;
		if(a[1]+2<=a[2])
		{
			a[1]+=2, cnt++;
		}
		else
		{
			a[1]++; a[2]++;
			cnt++;
		}
		sort(a+1, a+4, CMP);
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;

int geth(int x){
    while(x/10 > 0){
        x /= 10;
    }
    return x;
}

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

    int ans=0;
    int ntail = n%10;
    vector<int> digit;
    // digit.push_back(ntail);
    int m = n;
    while(m>0){
        digit.push_back(m%10);
        m /= 10;
    }
    reverse(digit.begin(),digit.end());
    // vecprint(digit);
    int c[10][10] = {0};
    rep(i,1,n){
        c[geth(i)][i%10]++;
    }
    rep(i,1,n){
        int head = geth(i);
        int tail = i%10;
        ans += c[tail][head];

    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import heapq

t = int(input())
for _ in range(t):
    n = int(input())
    l = [[] for i in range(n+1)]
    r = [[] for i in range(n+1)]
    ans = 0
    for i in range(n):
        a,b,c = map(int,input().split())
        if b > c:
            l[a].append(b-c)
            ans += c
        else:
            r[a].append(c-b)
            ans += b
    q = []
    for i, lx in enumerate(l):
        for x in lx:
            if len(q) < i:
                heapq.heappush(q,x)
            else:
                heapq.heappushpop(q,x)
    ans += sum(q)
    q = []
    for i,rx in enumerate(r[::-1][1:],1):
        for x in rx:
            if len(q) < i:
                heapq.heappush(q,x)
            else:
                heapq.heappushpop(q,x)
    ans += sum(q)
    print(ans)

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

int main() {
  string A;
  cin >> A;
  if (A[0] == A[1]) {
    cout << "Bad" << endl;
  }
  else if (A[1] == A[2]) {
    cout << "Bad" << endl;
  }
  else if (A[2] == A[3]) {
    cout << "Bad" << endl;
  }
  
  else {
    cout << "Good" << endl;
  }
}


Measured memory_bytes: 256
# coding: utf-8

A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
# K= map(int, input().split(", "))



n=int(input())

# print(A)

print(A[n-1])


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

using namespace std;
#define Fill(a, b) memset(a, b, sizeof(a))
#define Debug(x) cout << #x << "=" << (x) << endl;
typedef long long LL;
const LL inf = 1LL << 61;
const LL mod = 1000000007;
//Fill(dp,0x3f3f3f3f)
#define DEBUG
#ifdef DEBUG
#endif

int main()
{
    std::ios::sync_with_stdio(false);
    int n, m;
    scanf("%d%d", &n, &m);
    double ans=0, lst = 0;
    double suc = 1.0;
    for(int i = 1; i <= m; i++)suc = suc*0.5;
    double fal = 1-suc, co_fal = 1.0;
	int s = 0;
	//cout << suc << " " << fal << endl;
	if(m!=n)s = 1;
	double sum = 0;
    for(int i = 1; i <= 1000000; i++)
    {
    	ans += co_fal*suc*(1900*m+100*(n-m))*i;
    	co_fal = co_fal*fal;
    	sum = sum+m*1900;
    }
    int tans = ans;
    if(ans-tans>1e-9)tans++;
    printf("%d\n", tans);






















    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::HashSet;
use std::cmp;
use std::f64::consts;

fn main() {
    let n: i32 = read();
    let mut f: Vec<Vec<i32>> = Vec::new();
    let mut p: Vec<Vec<i32>> = Vec::new();

    for i in 0..n {
        let eachf = (0..10).map(|_| read()).collect();
        f.push(eachf);
    }

    for i in 0..n {
        let eachp = (0..11).map(|_| read()).collect();
        p.push(eachp);
    }


    let mut count = -1000000000;
    for i in 0..i64::pow(2, 10) {
        let mut my_count = 0;
        let mut each_vec: Vec<i64> = Vec::new();
        for j in 0..10 {
            if (1 & i >> j) == 1 {
                my_count+=1;
                each_vec.push(1);
            } else {
                each_vec.push(0);
            }
        }
        if my_count == 0 {
            continue;
        }

        let mut each_count = 0;
        for my in 0..n as usize {
            let mut same_count = 0;
            for f_index in 0..10 {
                if each_vec[f_index] == 1 && f[my][f_index] == 1{
                    same_count += 1;
                }
            }
            each_count += p[my][same_count];
        }
        count = cmp::max(count, each_count);
    }

    println!("{}", count);
}

fn calc_distance(x: i32, y: i32, target_x: i32, target_y: i32) -> i32 {
    let diff_x = (target_x - x).abs();
    let diff_y = (target_y - y).abs();

    return diff_x + diff_y;
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// 最大公約数
fn gcd(a: i32, b: i32) -> i32 {
    match b {
        0 => a,
        _ => gcd(b, a % b)
    }
}

// 最小公倍数
fn lcm(a: i32, b: i32) -> i32 {
    a * b / gcd(a, b)
}

// 階乗
fn kaijou(n: i32)->i32 {
    if n == 1 {
        return n;
    }
    return n * kaijou(n-1);
}

Measured memory_bytes: 4352
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i + 100 * j + 50*k == x:
        count = count +1
print(count)

Measured memory_bytes: 3064
import math
import sys
import itertools
import queue
from fractions import gcd

#sys.setrecursionlimit(10000)

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

from math import factorial
import collections

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    sl = []
    for _ in range(N):
        tmp = sorted(sys.stdin.readline().rstrip())
        sl.append(''.join(tmp))
    c = collections.Counter(sl)
    ans = 0
    for n in c.values():
        r = 2
        if n > 1:
            ans += factorial(n) // (factorial(n - r) * factorial(r))

    print(int(ans))


Measured memory_bytes: 21480
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
	
	int n;
	cin >> n;
	if(n < 105){
		puts("0");
		return 0;
	}
	
	int ans = 0;
	for(int i = 105; i <= n; i += 2){
		if(divisor(i).size() == 8){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N,T=[int(i) for i in input().split()]
A=[]
B=[]
for i in range(N):
    C=[int(i) for i in input().split()]
    A.append(C)
for i in range(N):
    if A[i][1]<=T:
        B.append(A[i][0])
    else:
        continue
if len(B)==0:
    print("TLE")
else:
    print(min(B))

Measured memory_bytes: 3060
from collections import deque

d = deque(input())
q = int(input())

reverse = False

for _ in range(q):
    query = list(input().split())
    if query[0] == '1':
        if reverse:
            reverse = False
        else:
            reverse = True
        continue
    else:
        if query[1] == '1':
            if reverse:
                d.append(query[2])
            else:
                d.appendleft(query[2])
        else:
            if reverse:
                d.appendleft(query[2])
            else:
                d.append(query[2])

if reverse:
    d = list(reversed(d))


print("".join(map(str, d)))

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

int main()
{
	long long a, b, x;
	cin >> a >> b >> x;

	long long ans = b / x + 1;
	if( a == 0 ) ;
	else ans -= (a - 1) / x + 1;

	cout << ans << endl;
}


Measured memory_bytes: 3640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1000000000000000000;

signed main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<((c>=a&&c<=b)?"Yes":"No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

string s;
int ans;

bool SameAll(string x) {
    for(int i = 1; i < x.size(); i++) {
        if(x[i] != x[i - 1]) return false;
    }
    return true;
}

int f(string x, char c) {
    x = c + x + c;
    int pos = 0, res = 0;
    for(int i = 1; i < x.size(); i++) {
        if(x[i] == c) {
            res = max(res, i - pos - 1);
            pos = i;
        }
    }
    return res;
}

void solve() {
    cin >> s;
    if(SameAll(s)) cout << "0\n";
    else {
        ans = INF;
        for(int i = 0; i < s.size(); i++) {
            ans = min(ans, f(s, s[i]));
        }
        cout << ans << "\n";
    }
}

int main() {

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

    solve();

}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair< int, int > P;   
typedef pair< ll, P > PP;

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

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

	string s;
	cin >> s;
	int ans = 700;
	REP(i, 3) ans += 100 * (s[i] == 'o');
	cout << ans << endl;
 
    return 0;
}


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

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A[NMAX],B[NMAX],C,D,E;
int dp[NMAX] = {};
std::map<ll, ll> mp;
string S;
vec v;

ll ans = 0;

void solve(){
  // main algorithm
  ll sum = 0;
  for(auto&& p : mp) {
    sum += p.second;
    if (sum >= K)
    {
      cout << p.first << endl;
      return;
    }
  }
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  // cout << ans << endl;
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> N >> K;
  for (int i = 0; i < N; ++i)
  {
    scanf("%lld%lld", &A[i], &B[i]);
    mp[A[i]] += B[i];
  }
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    int n, m;
    cin >> n >> m;
    std::vector<int> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    std::vector<int> suma;
    suma.pb(0);
    for (int i = 0; i < n; i++) {
        suma.pb((suma[i] + a[i]) % m);
    }
    int sum = 0;
    std::map<int, int> record;
    for (int i = 0; i <= n; i++) {
        sum += record[suma[i]];
        record[suma[i]]++;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 5748
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
#include <deque>
using namespace std;
//#define N (1000000000+7)
#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;
typedef vector<ll> vec;
typedef vector<vec> mat;
const int inf = (int)1e9; 
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

template <typename T>
struct SegmentTree{
    typedef function<T(T,T)> F;
    int n;
    F f;
    T unit;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(int newn,F f,T t):f(f),unit(t){
        init(newn);
    }
    SegmentTree(const vector<T> &v,F f,T t):f(f),unit(t){
        int n_ = v.size();
        init(n_);
        for(int i=0;i<n_;i++)dat[n+i]=v[i];
        for(int i=n-1;i;i--){
            dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
        }
    }
 
    void init(int n_){
        n=1;
        while(n<n_)n<<=1;
        dat.assign(n<<1,unit);
    }
    
    void update(int k,T x){
        dat[k+=n]=x;
        while(k>>=1)
            dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
    }
    T query(int a,int b){
        T vl=unit,vr=unit;
        for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1){
            if(l&1)vl=f(vl,dat[l++]);
            if(r&1)vr=f(dat[--r],vr);
        }
        return f(vl,vr);
    }
 
};

int main(void){
	int n,k;
	cin>>n>>k;
	vector<int>L(k),R(k);
	for(int i=0;i<k;i++)cin>>L[i]>>R[i];
	auto f = [](ll l,ll r){
		return (r+l+N)%N;
	};
	SegmentTree<ll> seg = SegmentTree<ll>(n+1,f,0);
	seg.update(1,1);
	for(int i=2;i<=n;i++){
		for(int j=0;j<k;j++){
			int l = i-R[j];
			int r = i-L[j];
			if(l>n)continue;
			if(r<1)continue;
			l = max(l,1);
			r = min(r,n);
			ll now = seg.query(i,i+1);
			ll t = seg.query(l,r+1);
			seg.update(i,(now+t)%N);
		}
	}
	cout<<seg.query(n,n+1)<<endl;
	return 0;
}


Measured memory_bytes: 7472
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << '\n';
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

//------------------------- Libraries -------------------------//

vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

//--------------------------- Solve ---------------------------//

void solve() {
    long long N; cin >> N;

    set<long long> ans;

    vector<long long> v0 = enum_divisors(N-1);
    for (auto K : v0) {
        if (K == 1) continue;
        ans.insert(K);
    }

    vector<long long> v = enum_divisors(N);
    for (auto K : v) {
        if (K == 1) continue;
        if (K == N) {
            ans.insert(K);
            break;
        }

        long long n = N;
        while (n % K == 0) {
            n /= K;
            if ((n-1) % K == 0) ans.insert(K);
        }

        n = N;
        while (n % K == 0) {
            n /= K;
            if (n == 1) ans.insert(K);
        }
    }

    cout << ans.size() << '\n';
}

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

    solve();

    return 0;
}

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

int main() {
  string s, t;
  char c;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    for (int j = i+1; j < s.size(); j++) {
      if (s[i] > s[j]) {
        c = s[i];
        s[i] = s[j];
        s[j] = c;
      }
    }
  }
  for (int i = 0; i < t.size(); i++) {
    for (int j = i+1; j < t.size(); j++) {
      if (t[i] < t[j]) {
        c = t[i];
        t[i] = t[j];
        t[j] = c;
      }
    }
  }
  if (s < t) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <cstdint> // int64_t, int_fast64_t

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"

typedef std::int_fast64_t ll; // at least int64 > 9*10^18
typedef std::uint_fast64_t ull; // at least uint64

#define int ll
#define MOD 1000000007

signed main() {
  int n,m;
  std::cin >> n >> m;
  std::vector<int> comb(n+2,0);
  comb[0] = 1;
  rep(i,m) {
    int a;
    std::cin >> a;
    comb[a] = -1;
  }
  rep(i,n) {
    if(comb[i]==-1) continue;
    rep(j,2) {
      if(comb[i+j+1]!=-1) comb[i+j+1] = (comb[i+j+1] + comb[i])%MOD;
    }
  }
  std::cout << comb[n] << ENDL;
  return 0;
}

Measured memory_bytes: 1024
lmap = lambda f, s: list(map(f, s))
n, m = map(int, input().split())
a = [lmap(int, input().split()) for i in range(n)]
a = lmap(lambda xs: xs + [sum(xs)], a)
a.append(lmap(sum, zip(*a)))
for xs in a: print(*xs)


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

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<map>
#include<stack>
#include<queue>
#include<math.h>

using namespace std;
vector<long long int>global(100001, -1);

long long int compute(long long int arr[], long long int start, long long int n)
{
	if (global[start] != -1)
		return global[start];

	if (start == n - 2) {
		global[start] = abs(arr[start] - arr[start + 1]);
		return global[start];
	}
	if (start >= n - 1) {
		return 0;
	}


	global[start] = min(abs(arr[start] - arr[start + 1]) + compute(arr, start + 1, n), abs(arr[start] - arr[start + 2]) + compute(arr, start + 2, n));
	return global[start];
}


int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long int n;
	cin >> n;
	long long int arr[n];
	for (long long int i = 0; i < n; i++)
		cin >> arr[i];

	cout << compute(arr, 0, n) << endl;







	return 0;


}


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

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld\n",x)
#define print2(x) printf("%lld ",x)
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok = true, flag = false;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 333333


int main(void) {
  cin >> n;
  vll v(n);
  vector<pll> a, b;
  rep(i, n) scan(v[i]);
  rep(i, 111111) {
	pll p(0, i);
	a.pb(p); b.pb(p);
  }
  rep(i, n) scan(v[i]);
  for (ll i = 0;i < n;i += 2) {
	a[v[i]].first++;
  }
  for (ll i = 1;i < n;i += 2) {
	b[v[i]].first++;
  }
  
  sort(rall(a));
  sort(rall(b));
  
  if (a[0].second != b[0].second) {
	ans = n - a[0].first - b[0].first;
  }
  else {
	ans = max(a[0].first + b[1].first, b[0].first + a[1].first);
	ans = n - ans;
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 4708
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
L = np.array(inpl())
print(len(L[L>=k]))

Measured memory_bytes: 21060
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on
int A, B;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> A >> B;

  ll ans = lcm(A, B);
  cout << ans << endl;

  return 0;
}


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

int main() {
    //N: マスの数0~Nまで, M: 料金所の数, X: 始めのマス
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(M);
    for(int i=0; i<M; i++) cin >> A[i];

    int first_count=0;
    for(int i=X; i>=0; i--) {
        for(int j=0; j < M; j++) {
            if(i == A[j]) first_count++;
        }
    }

    int second_count=0;
    for(int i=X; i<N; i++) {
        for(int j=0; j < M; j++) {
            if(i == A[j]) second_count++;
        }
    }


    cout << min(first_count, second_count) << endl;


}


Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main(){
    int x,y;
    cin >> x >> y;
    if(x > y){
        cout << "a > b" << endl;
    }
    else if(x < y){
        cout << "a < b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
    return 0;
}


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


#include <iostream>

using namespace std;

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

long long lcm(long long a, long long b)
{
   return a * b / gcd(a, b);
}

int main()
{
   long long a, b;
   cin >> a >> b;
   cout << lcm(a, b) << endl;
   return 0;
}




Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<50);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

void solve(){
	string s,t;cin>>s>>t;
	map<int,char>mp;
	map<int,char>mp2;
	rep(i,26){
		mp['a'+i]=-1;
		mp2['a'+i]=-1;
	}
	rep(i,s.size()){
		//cout<<(char)s[i]<<(int)mp[s[i]]<<endl;
		if(mp[s[i]]!=-1){
			if((int)mp[s[i]]!=(int)t[i]){
				cout<<"No"<<endl;
				return;
			}
		}	
		mp[s[i]]=t[i];
	//	cout<<(char)s[i]<<(char)mp[s[i]]<<endl;
	}
	rep(i,t.size()){
		if(mp2[t[i]]!=-1){
			if(mp2[t[i]]!=s[i]){
				cout<<"No"<<endl;
				return;
			}
		}
		mp2[t[i]]=s[i];	
		//cout<<(char)t[i]<<(int)mp2[t[i]]<<endl;
	}
	cout<<"Yes"<<endl;
}

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


Measured memory_bytes: 916
#include<iostream>
using namespace std;
int main(void) {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    for(int i = 0; i < 3; i++) {
        for(int j = i; j < 3; j++) {
            if(a[j] < a[i]) {
                int tmp = a[i];
                a[i] = a[j];
                a[j] = tmp;
            }
        }
    }
    cout << a[0] << ' ' << a[1] << ' ' << a[2] << endl;

    return 0;
}

Measured memory_bytes: 3100
#include <stdio.h>

int main(void){

    double x1,x2,y1,y2,sum;

    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    sum=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
    printf("%f\n",sqrt(sum));

    return 0;
}

Measured memory_bytes: 652
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, h[100005];
    cin >> n;
    rep(i,n){
      cin >> h[i];
    }

    reps(i,n-1){
      if( h[i - 1] < h[i] ){
	h[i] --;
      }
      else if( h[i - 1] > h[i] ){
	cout<< "No" <<'\n';
	return 0;
      }
    }
    cout << "Yes"<<'\n';
    return 0;
}


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

using namespace std;
typedef long long ll;


ll P = 998244353;
ll DP[3001][3001] = {0};

int main(){
  int A,B,C,D;
  std::cin >> A >> B >> C >> D;
  DP[A][B] = 1;
  for(int a=A+1; a<=C; a++)
    DP[a][B] = DP[a-1][B] * B % P;
  for(int b=B+1; b<=D; b++)
    DP[A][b] = DP[A][b-1] * A % P;
  for(int a=A+1; a<=C; a++)
    for(int b=B+1; b<=D; b++)
      DP[a][b] = (P + b*DP[a-1][b] + a*DP[a][b-1] - (a-1)*(b-1)*DP[a-1][b-1]%P) % P;

  std::cout << DP[C][D] << std::endl;
  return 0;
}

Measured memory_bytes: 73828
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;

int main() {
    cin >> N;

    vi A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            ans += A[i] * A[j];
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(x) cout << x << endl;
using namespace std;
int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    while (true) {
        c -= b;
        if (c <= 0) {
            put("Yes");
            return 0;
        }
        a -= d;
        if (a <= 0) {
            put("No");
            return 0;
        }
    }

    return 0;
}

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

#define ll long long

int main() {
	ll n, y, a, b, c, num;
	cin >> n >> y;
	ll sum;
	for (a = 0; a <= n; a++) {
		for (b = 0; b <= n; b++) {
			c = n - a - b;
			if (a < 0 || b < 0 || c < 0)continue;
			num = a + b + c;
			if (num != n)continue;
			sum = a * 10000 + b * 5000 + c * 1000;
			if (sum == y) {
				cout << a << " " << b << " " << c << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

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


int main() {
    ll n;
    cin >> n;
    map<ll,ll> a;
    rep(i,n){
        ll in;
        cin >> in;
        a[in]++;
    }
    ll ans = 0;
    for(auto m : a){
        if(m.second%2)ans++;
    }
    cout << ans << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 50;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

int N;
vector<P> V;

void solve() {
    multiset<int> S;
    sort(all(V));
    reverse(all(V));
    int ans = 0;
    S.insert(0);
    S.insert(0);
    S.insert(N + 1);
    S.insert(N + 1);
    for (auto& v : V) {
        itn num = v.first;
        int id = v.second;
        auto it = S.lb(id);
        it--;
        auto L1 = *it--;
        auto L2 = *it++;
        it++;
        itn R1 = *it++;
        int R2 = *it;
        ans += num * (L1 - L2) * (R1 - id);
        ans += num * (R2 - R1) * (id - L1);
        S.insert(id);
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(N) {
        int a;
        cin >> a;
        V.eb(a, i + 1);
    }


    solve();
    return 0;
}


Measured memory_bytes: 6512
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <deque>
#include <math.h>
#include <cstring>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <stack>
#include<cassert>
#include <cfloat>
#include <list>
using namespace std ;
#define ll long long
#define submitStage int TCF = 1 ;
#define testStage int TCF = 1000 ;
#define testMyStupedCode TCF--
void FastInputOutput(){
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
void ReadFromFile( string name , string extention ){
    string fullPath = name + "." + extention ;
    freopen( fullPath.c_str() , "r" , stdin ) ;
}
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
inline char C(){
    char c ;
    scanf( "%c" , &c ) ;
    return c ;
}
inline ll power(ll x, ll p, ll m){
    ll res = 1;
    while(p){
        if(p & 1)
            res = (res * x) % m;
        x = (x * x) % m;
        p >>= 1;
    }
    return res;
}
long double ModLog(long double base, long double x) {
    return (logl(x) / logl(base));
}

const int N = 1e5 + 5;
ll dp[N];
int w[101], v[101];
ll inf = 1e13 + 5, n;
int main(){
     //freopen("//Users//Mr.X//Desktop//tests//tst.text", "r", stdin);
     n = D();
     int W = D();
     int V = 0;
     for(int i = 0; i < n; ++i){
          w[i] = D(), v[i] = D();
          V += v[i];
     }
     for(int i = 0; i <= V; ++i)
          dp[i] = inf;
     dp[0] = 0;
     int ans = 0;
     for(int i = 0; i < n; ++i)
         for(int j = V - v[i]; j >= 0; --j){
               dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
               ans = max(j * (dp[j] <= W), ans);
               ans = max(ans, (j + v[i]) * (dp[j + v[i]] <= W));
         
         }
     printf("%d", ans);
     return 0;
}


Measured memory_bytes: 1024