akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
  string S,T;
  cin>>S>>T;
  int a=S.size();
  int b=1;
  for(int i=0;i<a;i++){
    if(S.at(i)!=T.at(i)){
      b=0;
    }
  }
  if(b==0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
    
  
}

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

int main() {
  int N,a,b,c;
  cin >> N >> a;
  vector<int> d(N);
  for(int i = 0; i < a; i++) {
    cin >> b >> c;
    d.at(b-1)++;
    d.at(c-1)++;
  }
  for(int i = 0; i < N; i++) {
    cout << d.at(i) << endl;
  }
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef set<int> si;
typedef string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
char S[4];
int main(){
  rep(i,4) cin>>S[i];
  sort(S,S+4);
  if(S[0]==S[1]&&S[2]==S[3]&&S[1]!=S[2]) prin("Yes");
  else prin("No");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

//---------------------------------------------
class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz;
    vector <ll> tree_rank;

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1), tree_rank(sz_) {
        for (ll i = 0; i < sz_; ++i) {
            par[i] = i; // 初期では親は自分自身
            tree_rank[i] = 0;
        }
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.resize(sz_, 1);
        tree_rank.resize(sz_);
        for (ll i = 0; i < sz_; ++i) {
            par[i] = i; // 初期では親は自分自身
            tree_rank[i] = 0;
        }
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        if (par[x]==x) {
            return x;
        }
        else {
            return par[x] = root(par[x]);
        }
    }

    // Union(Unite, Merge)
    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (tree_rank[x]<tree_rank[y]) {
            par[x] = y;
            siz[y] += siz[x];
        }
        else {
            par[y] = x;
            siz[x] += siz[y];
            if (tree_rank[x]==tree_rank[y]) tree_rank[x]++;
        }
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }

};

int main() {
    int N,K,L;
    cin >> N >> K >>L;
    
    UnionFind UFK(N),UFL(N);

    rep(i,K) {
        int p,q;
        cin >> p >> q;
        p--;
        q--;
        UFK.unite(p,q);
    }
    rep(i,L) {
        int r,s;
        cin >> r >> s;
        r--;
        s--;
        UFL.unite(r,s);
    }

    map<pair<ll,ll>,int> m;

    rep(i,N) {
        m[{UFK.root(i),UFL.root(i)}]++;
    }
    rep(i,N) {
        cout << m[{UFK.root(i),UFL.root(i)}] << " ";
    }
    cout << endl;

}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    string s;
    cin >> s;
    int N = s.size();
    int mi = 100000000;
    for (int i = 0; i < N - 2; i++) {
        int X = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
        if (abs(X - 753) < mi) {
            mi = abs(X - 753);
        }
    }
    cout << mi << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int n = input();
    string s;
    cin >> s;

    int ans = 0;
    range(m, 1, n) {
        set< char > s1, s2;
        range(i, 0, m) {
            s1.insert(s[i]);
        }
        range(i, m, n) {
            s2.insert(s[i]);
        }

        int cnt = 0;
        range(c, 'a', 'z' + 1) {
            if (s1.count(c) && s2.count(c)) cnt++;
        }

        chmax(ans, cnt);
    }

    cout << ans << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

int dp[220];
int main() {
	int n; cin >> n; 
	int p[4]; for(int i = 0; i < 4; ++i) cin >> p[i];
	int t[4]; for(int i = 0; i < 4; ++i) cin >> t[i];
	for(int i = 1; i < 220; ++i) {
		dp[i] = 1e9;
		for(int j = 0; j < 4; ++j) {
			if(i - t[j] >= 0) {
				dp[i] = min(dp[i], dp[i - t[j]] + p[j]);
			}
		}
	}
	int ans = 1e9;
	for(int i = n; i < 220; ++i) ans = min(ans, dp[i]);
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int dig=n%10;
    map<int,string>mp;
    mp[0]="pon";
    mp[1]="pon";
    mp[6]="pon";
    mp[8]="pon";
    mp[3]="bon";
    if(mp.find(dig)==mp.end())
        cout<<"hon";
    else
        cout<<mp[dig];
}

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

namespace LeetCodeProblem
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<string, int> mp = new Dictionary<string, int>();

            int n = Convert.ToInt32(Console.ReadLine());

            for(int i = 0; i < n; i++)
            {
                string str = Console.ReadLine();

                if(!mp.ContainsKey(str))
                {
                    mp.Add(str, 1);
                }
                else
                {
                    mp[str] += 1;
                }
            }

            Console.WriteLine(mp.Count);
        }

        private static List<int> GetList()
        {
            string[] array = Console.ReadLine().Split(" ");

            List<int> numbers = new List<int>();

            foreach(var ele in array)
            {
                numbers.Add(int.Parse(ele));
            }

            return numbers;
        }
    }
}


Measured memory_bytes: 49856
#include<iostream>
using namespace std;
int gl(int a,int b, int x, int y);
int main(){
	int a,b;
	while(cin >>a>>b){
		gl(a,b,a,b);
	}
	return 0;
}
int gl(int a, int b, int x, int y){
	if(b == 0){
		cout <<a<<" "<<x/a*y<<endl;
		return 0;
	}
	return gl(b,a%b,x,y);
}

Measured memory_bytes: 0
N, K = map(int, input().split())
S = input()

l = [0]
curr = '1'

#0と1の塊を探索
for c in S:
    if c != curr:
        l.append(1)
        curr = c
    else:
        l[-1] += 1
if curr == '0':
    l.append(0)

n_group = len(l) // 2
sum_ = 0
k = min(K, n_group)

#初期値として左端から1の塊を算出
for i in range(k):
    sum_ += l[2 * i] + l[2 * i + 1]
sum_ += l[2 * k]
max_ = sum_

#左端から0の塊を１つずつ取り替えて、最大値を算出
for i in range(k, n_group):
    sum_ -= l[2 * i - 2 * K] + l[2 * i + 1 - 2 * K]
    sum_ += l[2 * i + 1] + l[2 * i + 2]
    max_ = max(max_, sum_)

print(max_)

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    ll a,b,c,d,e,f,g;cin>>a>>b>>c>>d>>e>>f>>g;
    string s,t;cin>>s>>t;
    decimal;
    out(a*2*pi);
}

Measured memory_bytes: 3824
#include <stdio.h>

int main(void)
{
	int n,i,s=100000;
	scanf("%d",&n);
	for(i=0 ; i<n ; i++){
		s*=1.05;
		if(s%1000>0){
		s-=s%1000;
		s+=1000;
	}
	}
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 1720
n, q = map(int, input().split())
result = [0 for i in range(n + 1)]
max_a = -1
max_v = 0

for i in range(q):
    a, v = map(int, input().split())
    result[a] += v
    if result[a] > max_v:
        max_a = a
        max_v = result[a]
    elif result[a] == max_v:
        if a < max_a:
            max_a = a
    elif a == max_a and result[a] <= max_v:
        max_a = result.index(max(result))
        max_v = result[max_a]
    print(max_a, max_v)



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

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

signed main(){
    int N, W;
    cin >> N >> W;
    vector<int> weight(N), value(N);
    rep(i,N) cin >> weight[i] >> value[i];
    
    const int V_MAX = 1e3 * N + 100;
    
    //dp table
    vector<vector<int>> dp(N+1,vector<int>(V_MAX, INT_MAX));
    
    //initial condition
    dp[0][0] = 0;
    
    rep(i,N){
        dp[i+1] = dp[i];
        rep(v,V_MAX){
            if(v >= value[i]){
                int new_weight = dp[i][v-value[i]] + weight[i];
                chmin(dp[i+1][v], new_weight);
            }
        }
    }
    
    for(int i=V_MAX-1; i>=0; i--){
        if(dp[N][i] <= W){
            cout << i << endl;
            break;
        }
    }
    
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main(){

    int N;
    cin >> N;

    rep(i, N){
        for(int j = i + 1; j < N; j++){
            int ans = __builtin_ctz(i ^ j) + 1;
            cout << ans << (j < N - 1 ? ' ' : '\n');
        }
    }

}

Measured memory_bytes: 512
while True:
  H,W=map(int,input().split())
  if H==0 and W==0:
    break
  for h in range(H):
    for w in range(W):
      if h % 2 ==0:
        if w % 2 ==0:
          print("#",end="")
        else:
          print(".",end="")
      else:
        if w % 2 ==0:
          print(".",end="")          
        else:
          print("#",end="")
    print()
  print()


Measured memory_bytes: 7004
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		int a = scan.nextInt();
		int b = scan.nextInt();
		String u = scan.next();
		scan.close();
		System.out.println((s.equals(u))? (a-1)+" "+b:a+" "+(b-1) );
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
#include <iomanip>
#include <functional>
#include <array>
#include <memory>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#undef NDEBUG
#include <assert.h>

using namespace std;
typedef long long ll;

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

	int x;
	cin >> x;
	cout << (x < 1200 ? "ABC" : x < 2800 ? "ARC" : "AGC") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int n, T;
	cin>>n>>T;
	int mn = -1;
	for(int i=0;i<n;i++) {
		int c, t;
		cin>>c>>t;
		if(t <= T) {
			if(mn > c || mn == -1) {
				mn = c;
			}
		}
	}
	if(mn == -1) {
		cout<<"TLE"<<endl;
	} else {
		cout<<mn<<endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="SUN"){
    cout<<7;
  }else if(s=="MON"){
    cout<<6;
  }else if(s=="TUE"){
    cout<<5;
  }else if(s=="WED"){
    cout<<4;
  }else if(s=="THU"){
    cout<<3;
  }else if(s=="FRI"){
    cout<<2;
  }else if(s=="SAT"){
    cout<<1;
  }
  return 0;
}

Measured memory_bytes: 256
import math
import collections
import itertools

def resolve():

    N=int(input())
    H=list(map(int,input().split()))

    Max=0
    cnt=0
    for i in range(1,N):
        if(H[i-1]>=H[i]):
            cnt+=1
        else:
            cnt=0
        Max=max(Max,cnt)

    print(Max)
    
resolve()


Measured memory_bytes: 20652
package main

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

var (
	N        int
	S        string
	patterns [4]string = [4]string{"SS", "SW", "WS", "WW"}
	sheep    []bool
	strings  []bool
)

func readVariables() {
	N = nextInt()
	S = nextStr()
	// fmt.Scan(&N)
	// fmt.Scan(&S)
	sheep = make([]bool, N)
	strings = make([]bool, N)
	// fmt.Println(N, len(strings), len(S))
	// fmt.Println("S=", S)
	// fmt.Println(sheep, strings)
	for i := 0; i < N; i++ {
		c := string(S[i])
		strings[i] = c == "o"
	}
}

func main() {
	readVariables()
	var c int
	// fmt.Println(strings)
	for _, v := range patterns {
		sheep[0] = string(v[0]) == "S"
		sheep[N-1] = string(v[1]) == "S"
		sheep[1] = g(sheep[N-1], sheep[0], strings[0])
		// fmt.Println(sheep[1], g(sheep[N-1], sheep[0], strings[0]), sheep[N-1], sheep[0], strings[0])
		for i := 2; i < N-1; i++ {
			sheep[i] = g(sheep[i-2], sheep[i-1], strings[i-1])
		}
		ok1 := sheep[N-1] == g(sheep[N-3], sheep[N-2], strings[N-2])
		ok2 := sheep[0] == g(sheep[N-2], sheep[N-1], strings[N-1])
		if ok1 && ok2 {
			// fmt.Println(sheep)
			break
		}
		c++
	}
	// fmt.Println(c)
	if c < 4 {
		for _, v := range sheep {
			if v {
				fmt.Print("S")
			} else {
				fmt.Print("W")
			}
		}
		fmt.Println()
	} else {
		fmt.Println(-1)
	}
}

func g(left, center, saysSame bool) bool {
	same := center && saysSame || !center && !saysSame
	if same {
		return left
	} else {
		return !left
	}
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, 1000000), 1000000)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}


Measured memory_bytes: 2816
#include<iostream>
int main(){
  int a,b;
  std::cin>>a>>b;
  
  if(a<b){
    for(int i=0;i<b;i++){
      std::cout<<a;
    }
    std::cout<<std::endl;
  }else if(b<=a){
    for(int i=0;i<a;i++){
      std::cout<<b;
    }
    std::cout<<std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, x; cin >> n >> x;
    if (x == 1 || x == 2*n-1) {cout << "No" << endl; return 0;}
    vint ans(2*n-1);
    rep(i,2*n-1) ans[i] = i + 1;
    for (int i = -1; i <= 1; i++) {
        rep(j,2*n-1) {
            if (ans[j] == x+i) {
                swap(ans[j],ans[n+i-1]);
                break;
            }
        }
    }
    cout << "Yes" << endl;
    rep(i,ans.size()) cout << ans[i] << endl;
}

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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	multiset<int> memo;
	for (int i = n-1; i >= 0; --i)
	{
		auto itr=memo.upper_bound(a[i]);
		if (itr!=memo.end())
		{
			memo.erase(itr);
		}
		memo.insert(a[i]);
	}
	cout<<memo.size()<<endl;
	return 0;
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
const bool DEBUG = true;
#define coutd if(DEBUG) cout 
#define ff first
#define ss second
#define debug(x) cout << "> x:" << x << endl;
#define len(x) int(x.size())
#define all(x) x.begin(), x.end()
using ll = long long;
using ii = pair<ll, ll>;
using vi = vector<ll>;
using vii = vector<ii>;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(){
	ios::sync_with_stdio(0);
	ll n, k;
	cin >> n >> k;
	vector<ll> vs(n);
	for(ll i=0; i<n; ++i) cin >> vs[i];
	vector<ll> bl(60);
	vector<ll> bd(60);
	for(ll i=0; i<n; ++i){
		for(ll j=0; j<60; ++j){
			if(vs[i]&(1LL<<j)) ++bl[j];
			else ++bd[j];
		}
	}
	ll ans=0;
	bool fl = false;
	for(ll j=59; j>=0; j--){
		if(bd[j]>bl[j]){
			if(fl or (k&(1LL<<j))) ans|=(1LL<<j);
		}
		if(k&(1LL<<j) and bl[j]>=bd[j]) fl=true;
	}
	//cout << ans << endl;
	ll res=0;
	for(ll i=0; i<n; ++i) res+=(vs[i]^ans);
	cout << res << endl;
}

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

int main()
{
  int N;//行の数
  int M;//for文で回す
  int C;//最後に足す
  cin >> N >> M >> C;
  int B[20];
  int A[20][20];
  int count = 0;
  int ans = 0;

  //Bの値を決める
  for(int j = 0; j < M; j++)
  {
    cin >> B[j];
  }
  //Aの値を決める
  for(int i = 0; i < N; i++)
  {
    for(int j = 0; j < M; j++)
    {
      cin >> A[i][j];
    }
  }

  //正答するコード家計三
  for(int i = 0; i < N; i++)
  {
    for(int j = 0; j < M; j++)
    {
      ans += B[j]*A[i][j];
    }
    if(ans + C > 0) count++;
  
    ans = 0;//初期化
  }


  cout << count << endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  std::string T; std::cin >> T;
  for(char& c: T) if(c=='?') c = 'D';
  fin(T);
  return 0;
}


Measured memory_bytes: 3968
#include <iostream>

using namespace std;

int main()
{
	int c[3];
	
	while ( cin >> c[0] >> c[1] >> c[2] ) {
		bool rest[11];
		for (int i=1; i<=10; i++) rest[i] = true;
		rest[c[0]] = rest[c[1]] = rest[c[2]] = false;
		
		int safe_count = 0;
		for (int i=1; i<=20-c[0]-c[1]; i++) {
			if (rest[i]) safe_count++;
		}
		
		if (safe_count>=4) cout << "YES";
		else cout << "NO";
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3072
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<iterator>
#include<stack>
#include<queue>
#include<utility>
#include<functional>
#include<bitset>
#include<numeric>
#include<cstring>
#include<tuple>
using namespace std;

int d, q, day, nw, one, two, sumc = 0;
vector< int > c( 30 ), t( 400 );
vector< vector< int > > arr( 400, vector< int >( 30, 0 ) );

int three( void )
{
	vector< int > last( 30, 0 );
	int ans = 0, res = 0;
	for( int i = 1; i <= d; ++i )
	{
		res -= c[ t[ i ] ] * last[ t[ i ] ];
		last[ t[ i ] ] = i;
		res += c[ t[ i ] ] * last[ t[ i ] ];
		ans += res;
	}
	return ans;
}

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

	cin >> d;
	for( int i = 1; i <= 26; ++i )
	{
		cin >> c[ i ];
		sumc += c[ i ];
	}
	for( int i = 1; i <= d; ++i )
	{
		for( int j = 1; j <= 26; ++j )
		{
			cin >> arr[ i ][ j ];
		}
	}
	for( int i = 1; i <= d; ++i )
	{
		cin >> t[ i ];
		one += arr[ i ][ t[ i ] ];
	}
	two = sumc * ( d * ( d + 1 ) ) / 2;
	cin >> q;
	for( int i = 1; i <= q; ++i )
	{
		cin >> day >> nw;
		one -= arr[ day ][ t[ day ] ];
		t[ day ] = nw;
		one += arr[ day ][ t[ day ] ];
		cout << one - two + three() << "\n";
	}
	return 0;
}

Measured memory_bytes: 3644
input0 = int(input())
input1 = int(input())
input2 = int(input())
input3 = int(input())
input4 = int(input())
K = int(input())

list = (input0,input1,input2,input3,input4)
max = max(list)
min = min(list)
fig = max - min

if fig <= K :
    print ("Yay!")
else :
    print (":(")

Measured memory_bytes: 3064
import java.util.*;
    public class Main{
	public static void main(String[] args){
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	}
    }


Measured memory_bytes: 21972
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        N: usize,
    }
    let ans = (N-1) * N / 2;
    println!("{}", ans);
}


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

int main()
{
  int N,Q;
  string S;
  cin>>N>>Q;
  cin>>S;
  int AC[N]={ };
  int cnt=0;
  for(int i=1;i<N;i++){
    if(S[i-1]=='A' && S[i]=='C'){
      cnt++;
    }
    AC[i]=cnt;
  }
  for(int i=0;i<Q;i++){
    int l,r;
    cin>>l>>r;
    cout<<AC[r-1]-AC[l-1]<<endl;
  }
  
}

Measured memory_bytes: 1408
/*
    STARK_BOY
*/
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repe(i,a,b) for(ll i=a;i<=b;i++)
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long ll;
typedef vector< ll > vi;
typedef vector<pair<ll,ll> > vpii;
typedef pair<ll,ll> pii;
#define all(c) c.begin(),c.end()
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define PI           3.14159265358979323846  /* pi */
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
#define N 1000005
//Variables Start
ll inf=1e18,MOD=1e9+7;
//Variables End

int main()
{
    ios
    int ti=1;
    //cin>>ti;
    while(ti--)
    {
		double r;
		cin>>r;
		double ans=2.0*PI*r;
		cout<<fixed<<setprecision(12)<<ans<<endl;      
    }
    return 0;
        
}


Measured memory_bytes: 3804
import fractions
from functools import reduce

N = int(input())
T = list(int(input()) for _ in range(N))


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(T))


Measured memory_bytes: 64044
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,X,sum=0,count=1;
    cin>>N>>X;
    vector<int>a(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    for(int i=0;i<N;i++){
        sum=sum+a[i];
        if(sum>X){
            break;
        }
        count++;
    }
    cout<<count<<endl;
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;


// dp[i] := i 回目の時点でのj個表が出ている確率
double dp[3000][3000];

int main() {
    lli n;
    cin1(n);
    double p[n];
    REPE(i,1,n) {
        cin >> p[i];
    }

    dp[0][0] = 1;
    dp[0][1] = 0;
    REPE(i,1,n) {
        REPE(j,0,i) {
            dp[i][j] = dp[i-1][j-1] * p[i] + dp[i-1][j] * (1-p[i]);
        }
    }
    double ans = 0;
    REPE(i,(n+1)/2, n) {
        ans += dp[n][i];
    }
    cout << std::setprecision(10) <<  ans << endl;

}


Measured memory_bytes: 68864
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> dp(n + 1);
	dp[0] = 0;
	for (int i = 1; i <= 5; i++) {
		dp[i] = i;
	}
	if (n <= 5) {
		cout << dp[n] << endl;
		return 0;
	}
	for (int i = 6; i <= n; i++) {
		int dpi = dp[i - 1] + 1;
		int a = 6;
		while (i >= a) {
			dpi = min(dpi, dp[i - a]+1);
			a *= 6;
		}
		a = 9;
		while (i >= a) {
			dpi = min(dpi, dp[i - a]+1);
			a *= 9;
		}
      dp[i]=dpi;
	}
	cout << dp[n] << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << - 1 << endl;}
void unhap() {cout << ":(" << endl;}

int main() {
  char c;
  cin >> c;
  string s = "abcdefghijklmnopqrstuvwxyz";
  for (int i = 0; i < 25; i++) {
    if (s.at(i) == c) {
      cout << s.at(i + 1) << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {
	// public static void printArray(int[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	public static String joinInt(int[] a, String separator) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < a.length; i++) {
			if (i > 0) {
				sb.append(separator);
			}
			sb.append(a[i]);
		}
		return sb.toString();		
	}

	static int[] nextIntArray(Scanner sc, int N) {
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] v = new int[N];
		for (int i = 0; i < N; i++) {
			v[i] = sc.nextInt();
		}
		Arrays.sort(v);
		double x = v[0];
		for (int i = 1; i < N; i++) {
			x = (x + v[i])/2;
		}
		System.out.println(x);
	}
}


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

namespace AtTest.AGC_Challenge
{
    class _022_A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string s = Read();
            var remain = new List<char>();
            for(int i = 0; i < 26; i++)
            {
                remain.Add((char)('a' + i));
            }

            for(int i = 0; i < s.Length; i++)
            {
                remain.Remove(s[i]);
            }

            if (s.Length < 26)
            {
                s += remain[0];
                Console.WriteLine(s);
                return;
            }
            else
            {
                for(int i = s.Length - 1; i >= 0; i--)
                {
                    for (int j = 0; j < remain.Count; j++)
                    {
                        if (s[i] < remain[j])
                        {
                            s = s.Substring(0, i);
                            s += remain[j];
                            Console.WriteLine(s);
                            return;
                        }
                    }
                    remain.Add(s[i]);
                    s = s.Substring(0, i);
                }
                Console.WriteLine(-1);
            }
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;

ll R, G, B, N, ans;

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

  cin >>  R >> G >> B >> N;

  for (int r = 0; r * R <= N; r++) {
    for (int b = 0; r * R + b * B <= N; b++) {
      ll rem = N - r * R - b * B;
      if (rem % G == 0) {
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string.h>
using namespace std;
const int N=1000000000;
int n,m;
long long s,a,b;
int main()
{
	cin>>s;
	a=N-s%N;
	if(s%N==0)
		a=0;
	b=(s+a)/N;
	cout<<0<<' '<<0<<' '<<N<<' '<<a<<' '<<1<<' '<<b;
}


Measured memory_bytes: 256
N = int(input())
eat_list = list(map(int,input().split()))
scores = list(map(int,input().split()))
c_list = list(map(int,input().split()))
"""
print(eat_list)
print(scores)
print(c_list)
"""

score = 0
for i_eat,eat in enumerate(eat_list):
    score += scores[eat-1]
    #print(i_eat,eat,score)
    if i_eat == 0:
        continue
    elif eat - 1 == eat_list[i_eat-1]:
        score += c_list[eat-2]
        #print("分岐",i_eat,eat,score)

print(score)


Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
    int x[5];
    for (int i=0; i<5; i++) scanf("%d",&x[i]);
    for (int i=0; i<5; i++){
        if (x[i] == 0) { 
            printf("%d\n", i + 1);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 1732
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var V = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var C = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int ans = 0;
        for(int i = 0; i < N; i++)
        {
            int k = V[i] - C[i];
            if (k>=0)
            {
                ans = ans + k;
            }

        }


        Console.WriteLine(ans);
    }
}




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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); 
	string s;
	cin >> s;
	string t = "NWSE";
	bool can[4] = {false};
	for(int i = 0; i < 4; i++) {
		if(s.find(t[i]) != string::npos) {
			can[i] = true;
		}
	}
	for(int i = 0; i < 2; i++) {
		if(can[i] ^ can[i + 2]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;		
	return 0;	
}


Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
using ll = long long int;

int gcd(int a,int b){
    int A,B;
    if(a>b) A=a,B=b;
    else A=b,B=a;
    int r = A % B;
    while(r!=0){
        A = B;
        B = r;
        r = A % B;
    }
    return B;
}

int main(void){
    int K;cin>>K;
    ll sum = 0;
    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                sum += gcd(i,gcd(j,k));
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int cnt = 0;
		for(int i=0;i<(1<<N);i++){
			
			int lit = 0;
			for(int j=0;j<M;j++){
				int sw = 0;
				for(int k=1;k<KS[j].Length;k++){
					if((i >> KS[j][k]) % 2 == 1) sw++;
				}
				if(sw % 2 == P[j]) lit++;
			}
			if(lit == M) cnt++;
		}
		
		Console.WriteLine(cnt);
		
	}
	int N,M;
	int[][] KS;
	int[] P;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		KS = new int[M][];
		for(int i=0;i<M;i++){
			KS[i] = ria();
			for(int j=1;j<KS[i].Length;j++) KS[i][j]--;
		}
		P = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>

using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
long long X;






int main()
{

	cin >> X;

	long n = 0;
	long ans = 1;
	while(1){
		if(ans > X)
			break;
		ans += ++n;

	}
	cout << n << endl;




}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

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

#############
# Main Code #
#############

S = str(inputS())

l = [None,"SAT","FRI","THU","WED","TUE","MON","SUN"]

for i in range(8):
  if S == l[i]:
    print(int(i))


Measured memory_bytes: 65768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
double reqe(){
    int l,a,b,c,d,e,f,s,m;
    cin>>l>>a>>b>>c>>d>>e>>f>>s>>m;
    double first=a+b+c+d+e;
    double second=d+e;
    double tane=s*m*f-l;
    double sum=first+(second)*(m-1);
  //  cout<<tane/sum<<endl;
    return tane/sum;
}
int main() {
    int n;
    while(true){
        cin>>n;
        if(n==0)break;
        vector<pair<double,string>> eff(n);
        rep(i,n){
            string s;
            cin>>s;
            eff[i].second=s;
            eff[i].first=-1*reqe();

        }
        sort(eff.begin(),eff.end());
        rep(i,n){
            cout<<eff[i].second<<endl;
        }
        cout<<'#'<<endl;

    }
    return 0;
}


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

#define MAX 2000000

int H,A[MAX+1];

void maxHeapify(int i)
{
    int l,r,largest;
    l = 2*i;
    r = 2*i + 1;

    if(l <= H && A[l] > A[i]) largest = l;
    else largest = i;
    if(r <= H && A[r] > A[largest]) largest = r;

    if(largest != i)
      {
       swap(A[i],A[largest]);
       maxHeapify(largest);
      }
}

int main()
{
    int i;
    cin >> H;
    for(i=1;i<=H;i++)
    {
        cin >> A[i];
    }
    for(i = H/2 ;i>=1;i--)
    {
        maxHeapify(i);
    }
    for(i=1;i<=H;i++)
    {
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N];
int n,k;
int check(int x);
int main()
{
	scanf("%d %d",&n,&k);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int l=1,r=1e9,ans=-1;
	while (l<=r)
	{
		int mid=(l+r)/2;
		if (check(mid))
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%d",ans);
	return 0;
}

int check(int x)
{
	int cnt=0;
	for (int i=1;i<=n;i++)
	{
		if (a[i]<=x)   continue;
		else
		{
			if (a[i]/x==0)   cnt+=a[i]/x-1;
			else   cnt+=a[i]/x;
		}
	}
	return cnt<=k;
}

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

int sum (int n )
{
    int ans =0;
    while( n>0)
    {
        ans += n%10;
        n = n/10;
    }
    return ans;
}
int main()
{
   int n , a, b;
   cin>>n>>a>>b;
   int ans =0;
   for(int i = 1;i<=n;i++)
   {
       int temp = sum( i);
       if( temp>= a&& temp <= b)
           ans += i;
   }
   cout<<ans;
}

Measured memory_bytes: 3624
use std::io;


fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i64 {
    return s.trim().parse()
        .expect("Please type a number!");
}
fn read_nums() -> Vec<i64>
{
    let line = read_line();
    let items: Vec<&str> = line.split(' ').collect();

    let mut nums: Vec<i64> = Vec::new();

    for item in items {
        nums.push(to_i(item));
    }
    return nums;
}


fn main() {
    //println!("start");
    let nm = read_nums();
    let m = nm[1];

    let mut max_l = 0;
    let mut min_r = 0;
    
    
    for i in 0..m {
        let lr = read_nums();
        let l = lr[0];
        let r = lr[1];
        if i==0 {
            max_l = l;
            min_r = r;
        } else {
            if l>max_l {
                max_l = l;
            }
            if r<min_r {
                min_r = r;
            }
        }
        
    }
    let mut ret = min_r-max_l+1;
    if ret < 0 {
        ret = 0;
    }
    print!("{}", ret);
}   

Measured memory_bytes: 4352
N = int(input())

A = list(map(int, input().split()))

A = [0] + A + [0]


base_lis = []
Sum = 0

for i in range(len(A)-1):
    number = abs(A[i]-A[i+1])
    base_lis.append(number)
    Sum = number + Sum

for i in range(1,N+1):
    print(Sum - abs(A[i-1] - A[i]) - abs(A[i] - A[i+1]) + abs(A[i-1] - A[i+1]))

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int n,x;
    cin>>n>>x;
    int mi=INF;
    REP(i,n){
        int m;
        cin>>m;
        x-=m;
        chmin(mi,m);
    }
    cout<<n+x/mi<<endl;
    return 0;
}

Measured memory_bytes: 256