akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define speed                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define oprecision                                                             \
  cout.precision(30);                                                          \
  cerr.precision(7);
#define bb bool
#define ii int
#define ll long long
#define ff float
#define dd double
#define cc char
#define ss string
#define forn(sz) for (int i = 1; i <= sz; i++)
#define forni(i, sz) for (int i = 1; i <= sz; i++)
#define fornid(i, m, sz) for (int i = m; i <= sz; i++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vii vector<ii>
#define vii64 vector<ll>
#define vb vector<bb>
using namespace std;
ss s;
ii main() {
  speed;
  oprecision;
  /*#ifndef ONLINE_JUDGE
    freopen("outd.txt", "rt", stdin);
  #endif*/
  // code
  cin >> s;
  if (s[0] == 'S')
    cout << "Cloudy";
  if (s[0] == 'C')
    cout << "Rainy";
  if (s[0] == 'R')
    cout << "Sunny";
    // endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


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

typedef long long ll;

const ll MIN = -1000000000000000000;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, k;
	cin >> n >> m >> k;
	vector<vector<int>> a(n, vector<int>(m));
	vector<vector<vector<ll>>> dp(n, vector<vector<ll>>(m, vector<ll>(4, -1)));
	for (int i = 0; i < k; i++) {
		int r, c, v;
		cin >> r >> c >> v;
		r--, c--;
		a[r][c] = v;
	}
	if (a[0][0]) dp[0][0][1] = a[0][0];
	dp[0][0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (i == 0 && j == 0) continue;
			for (int k = 0; k <= 3; k++) {
				if (j && dp[i][j - 1][k] != -1)
					dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
				if (j && k && a[i][j] && dp[i][j - 1][k - 1] != -1)
					dp[i][j][k] = max(dp[i][j][k], a[i][j] + dp[i][j - 1][k - 1]);
				if (k >= 2 || i == 0) continue;
				if (k == 1 && a[i][j] == 0) continue;
				ll prev = -1;
				for (int it = 0; it <= 3; it++) {
					prev = max(prev, dp[i - 1][j][it]);
				}
				if (prev == -1) {
					continue;
				}
				if (k == 0) {
					dp[i][j][k] = max(dp[i][j][k], prev);
				} else {
					dp[i][j][k] = max(dp[i][j][k], prev + a[i][j]);
				}	
			}
		}
	}
	//for (int i = 0; i < n; i++) {
		//for (int j = 0; j < m; j++) {
			//for (int k = 0; k <= 3; k++) {
				//cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
			//}
		//}
	//}
	ll answer = max({dp[n - 1][m - 1][0], dp[n - 1][m - 1][1], dp[n - 1][m - 1][2], dp[n - 1][m - 1][3]});
	cout << answer << endl;
}


Measured memory_bytes: 671580
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[0]:
    a*=0
for i in range(1,N-1):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    a=(a*min(T[i],A[i]))%(10**9+7)
print(a)

Measured memory_bytes: 18756
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int h,w;
    cin >> h >> w;
    if (h == 1 || w == 1) cout << 1 << endl;
    else cout << (1LL * h * w + 1) / 2 << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep2(i, n) for(ll i = 2; i <=(ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)
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; }

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 199;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//順列計算
ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n - k] % MOD) % MOD;
}

int main(){
    ll n;
    cin >> n;
    ll num_divisor[n];
    rep1(i, n-1) num_divisor[i] = 1;
    for(int i = 2; i <= n-1;i++){
        for(int j = i; j <= n-1; j += i){
            num_divisor[j]++;
        }
    }
    ll ans = 0;
    rep1(i, n-1){
        ans += num_divisor[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10960
n = int(input())
a = [int(x) for x in input().split()]
l = []
def wari(b):
    count = 0
    while b % 2 == 0:
        count = count + 1
        b = b / 2
    return count
for i in range(n):
    x = a[i]
    ans = wari(x)
    l.append(ans)
print(min(l))

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

int main()
{
    int n;
    cin >> n;
    vector<long> ryuka(n+10,0);
    ryuka[0] = 2;
    ryuka[1] = 1;
    for(int i = 2; i <= n; i++){
        ryuka[i] = ryuka[i-1] + ryuka[i-2];
    }
    cout << ryuka[n] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int k;
    cin>>k;
    cin>>s;

    int len=s.size();
    if(len<=k)
    {
        cout<<s<<endl;
    }

    else
    {
        for(int i=0;i<k;i++)
        {
          cout<<s[i];
        }
        cout<<"..."<<endl;
    }
    return 0;
}


Measured memory_bytes: 3476
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

int main()
{
	string str;
	long long int n, a;
	cin >> n ;

	long long int current = 1;
	long long int ret = 0;

	for (long long int i = 0; i < n; i++)
	{
		cin >> a;
		if (a == current)
			current++;

		ret += (a - 1) / current;
		if (current == 1)
			current++;
	}


	cout << ret << endl;

	//		sort(c, c + n, greater<int>()); //降順ソート

	return 0;
}

Measured memory_bytes: 384
// AOJ 3124 Run, Twins
// 2020.1.14 bal4u

#include <stdio.h>

int main()
{
	int A, B, P, Q, R;
	scanf("%d%d%d%d%d", &A, &B, &P, &Q, &R);
	printf("%lf\n", (double)(B*(P+R)+A*Q)/(Q+R));
	return 0;
}



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

int main(){
    string num;
    cin >> num;

    if(num.size() == 1){
        cout << num[0] << endl;
        return 0;
    }

    int top = (int)(num[0] - '0') - 1;

    int under;
    for(int i=1; i<num.size(); i++){
        if(num[i] != '9'){
            under = (num.size()-1)*9;
            cout << top + under << endl;
            return 0;
        }
    }
    under = (num.size()-1)*9;
    cout << top + under + 1 << endl;
    return 0;
    
}

Measured memory_bytes: 3596
n = int(input())
lst = list(map(int, input().split()))
mod = 10**9+7

# 累積和リストの作成
sums = [0]*(n+1)
for i in range(n):
    sums[i+1] = lst[i] + sums[i]

# 題意より、lst の1つ前までが対象
ans = 0
for i in range(n-1):
    ans += (sums[n] - sums[i+1]) * lst[i]
print(ans % mod)


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

void Main()
{
  int N; cin >> N;
  vector<ll> A(N);
  rep(i,N) {cin >> A[i];}
  sort(A.begin(), A.end());
  ll s = 0, l = 0;
  for (int i = 1; i < N; i++) {
    if (A[i-1] == A[i]) {
      s = l;
      l = A[i];
      A[i-1] = 0; A[i] = 0;
    }
  }
  cout << s*l << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 1024
def main():
    """最適二分探索木での探索一回あたりの期待値の最小値を求める
    """
    inf = 10*6
    n = int(input())
    # 内包よりはやい
    P = [0.0] + list(map(float, input().split()))
    Q = list(map(float, input().split()))
    E = [[0.0]*(n+1) for _ in range(n+1)]
    W = [[0.0]*(n+1) for _ in range(n+1)]
    for i in range(1, n+1):
        W[i][i] = Q[i-1] + P[i] + Q[i]
        E[i][i] = P[i] + (Q[i-1] + Q[i])*2
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            W[i][j] = W[i][j-1] + P[j] + Q[j]
    for d in range(1, n):
        for i in range(1, n-d+1):
            j = i + d
            e = Q[i-1] + E[i+1][j] + W[i][j] 
            for k in range(i+1, j):
                ne =  E[i][k-1] + E[k+1][j] + W[i][j]
                if ne < e:
                    e = ne
            ne = E[i][j-1] + Q[j] + W[i][j]
            if ne < e:
                e = ne
            E[i][j] = e
    print(E[1][-1])

if __name__ == "__main__":
    main()


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

int main() {

	int N;
	cin >> N;
  	vector<int> num(N);
  	for(int i=0;i<N;i++)cin >> num[i];
    int maxNum = num[0];
  	int minNum = num[0];
  	
  	for(int i=1; i<N; i++){
        if(num[i] > maxNum){
       		 maxNum = num[i];
      	}
        if(num[i] < minNum){
       		 minNum = num[i];
      	}
    }
  
   	 cout << maxNum-minNum << endl;

}


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

int main () {
  string s;
  cin>>s;
  int cnt;
  cnt =700;
  if(s.at(0) =='o') cnt +=100;
  if(s.at(1) =='o') cnt +=100;
  if(s.at(2) =='o') cnt +=100;
  cout <<cnt<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()
A = li()

flag = [0]*N
#for i in range(N):
    #flag[i] = A[i]
flag2 = [0]*N

for i in range(M):
    a, b = mi()
    a -= 1
    b -= 1
    flag[a] = max(A[a], A[b], flag[a])
    flag[b] = max(A[a], A[b], flag[b])
    if A[a] == A[b]:
        flag2[a] = flag2[b] = 1
cnt = 0
for i in range(N):
    if A[i] >= flag[i] and not flag2[i]:
        cnt += 1
print(cnt)

Measured memory_bytes: 20236
list1 = []
while True:
    x = input()
    a = int(x.split()[0])
    b = x.split()[1]
    c = int(x.split()[2])
    if b == "+":
        d = a+c
    elif b == "-":
        d = a-c
    elif b == "*":
        d = a*c
    else:
        if c == 0:
            break
        d = int(a/c)
    if b == "?":
        break
    else:
        list1.append(d)
for i in list1:
    print(int(i))
    
        
        


Measured memory_bytes: 5596
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int L;
string S, T;
string repeat(string &pat, int num) {
  string o = "";
  rep(_, num) o += pat;
  return o;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> L >> S >> T;
  vector<P> cand;
  for (int x=0; x*S.length()<=L; x++) {
    int y = L-x*S.length();
    if (y % T.length()) continue;
    y /= T.length();
    cand.pb(P(x, y));
  }
  assert(cand.size());
  string s = "~";
  s = min(s, repeat(S, cand.front()._1) + repeat(T, cand.front()._2));
  s = min(s, repeat(T, cand.front()._2) + repeat(S, cand.front()._1));
  s = min(s, repeat(S, cand.back()._1) + repeat(T, cand.back()._2));
  s = min(s, repeat(T, cand.back()._2) + repeat(S, cand.back()._1));
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 2672
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c; cin >> c;
    if ('A' <= c && c <= 'Z') cout << 'A' << '\n';
    else cout << 'a' << '\n';
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string.h>
#include <vector>

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

using namespace std;

int main(void){
    //input
    int n, m;
    cin >> n >> m;
    vector<int> vote(n);
    rep(i,n) cin >> vote[i];

    int sum = 0;
    rep(i,n) sum += vote[i];

    float deadline = (float)sum/(4*m);
    int selected_item = 0;
    rep(i,n){
        if(vote[i] < deadline) continue;
        selected_item++;
    }

    if(selected_item >= m){cout << "Yes";}
    else{cout << "No";}

    //debug
    //rep(i,n) cout << vote[i];
    //cout<<sum;

    return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


li a[100100];

int main() {
    li n;
    cin >> n;
    rin{cin >> a[i];}
    li res = 0;
    rin{
        while (a[i] % 2 == 0) {
            ++res;
            a[i] /= 2;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define BRK(x) { (x); break; }
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using namespace std;


int N;
llint K;
PII ab[100010];


int solve(){
	llint p = 0;
	K--;
	rep(i, 0, N){
		p += ab[i].se;
		if(K < p) return ab[i].fi;
	}
	return -1;
}


signed main(){
	cin >> N >> K;
	rep(i, 0, N) cin >> ab[i].fi >> ab[i].se;
	sort(RNG(ab, N));

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
const int N=100001;
using namespace std;
int main(){
    int n,x[N],y[N],t[N];
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    for(int i=1;i<=n;i++)
        if(x[i]+y[i]>t[i]||(t[i]-x[i]-y[i])%2!=0){//判断，如果不行直接输出“No”
        cout<<"No";
            return 0;   
            }
            cout<<"Yes";
            return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>

// data structure
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <vector>

#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[]) {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> a;
  for (auto i = 0; i < n; i++) {
    int v;
    std::cin >> v;
    a.push_back(v);
  }

  // 総得票数
  int sum = 0;
  for (auto &v : a) {
    sum += v;
  }

  int count = 0;
  for (auto &v : a) {
    if ((double)v >= (double)sum / (4.0 * m))
      count++;
  }

  if (count >= m)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
    cin>>a[i];
sort(a,a+n);
ll ans=0;
for(int i=0;i<n-2;i++)
    {int k=i+2;
        for(int j=i+1;j<n;j++)
{
    while(k<n&&a[i]+a[j]>a[k])
        {k++;}
    if(k>j)
        ans+=k-j-1;

}}
cout<<ans;
return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
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>
 
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 main(void){
    int n, k;
    cin >> n >> k;

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

    vector<int> sum(n + 1, 0);
    for(int i = 0; i < n; i++){
        sum[i + 1] = sum[i] + a[i];
        sum[i + 1] %= k;
    }

    for(int i = 0; i <= n; i++){
        sum[i] -= i;
        sum[i] %= k;
        if(sum[i] < 0) sum[i] += k;
    }

    map<int,int> mp;
    queue<int> q;
    ll ans = 0;
    for(int i = 0; i <= n; i++){
        ans += mp[sum[i]];
        mp[sum[i]]++;
        q.push(sum[i]);
        if(q.size() >= k){
            mp[q.front()]--;
            q.pop();
        }
    }
    cout << ans << endl;

    
}

Measured memory_bytes: 12032
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535
#define MOD 1000000007
#define rep(i, n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define MAX ((ll)1<<(ll)31)-1

int main(void) {
	int a, b; cin >> a >> b;
	cout << 6 - a - b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=100;
int gi(){
    char ch=getchar(); int x=0,q=0;
    while(ch<'0'||ch>'9') q=ch=='-'?1:q,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return q?-x:x;
}
int n,m,f[N][N],la,lb;
ll ans;
char s[N],a[N],b[N];
void dfs(int x){
    if (x>n){
	for (int i=0; i<=la; ++i)
	    for (int j=0; j<=lb; ++j)
		f[i][j]=0;
	f[0][0]=1;
	for (int i=0; i<=la; ++i)
	    for (int j=0; j<=lb; ++j){
		if (s[m-i-j]==a[i+1]) f[i+1][j]+=f[i][j];
		if (s[m-i-j]==b[j+1]) f[i][j+1]+=f[i][j];
	    }
	ans+=f[la][lb];
	return;
    }
    a[++la]=s[x],dfs(x+1),--la;
    b[++lb]=s[x],dfs(x+1),--lb;
    return;
}
int main(){
    scanf("%d%s+1",&n,s+1),m=2*n;
    dfs(1);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

n, m, k = map(int, input().split())
F = [[] for i in range(n)]
B = [set() for i in range(n)]
l = [0]*n

for i in range(m):
    a, b = map(int, input().split())
    F[a - 1].append(b - 1)
    F[b - 1].append(a - 1)

for i in range(k):
    c, d = map(int, input().split())
    B[c - 1].add(d - 1)
    B[d - 1].add(c - 1)

seen = [0]*n
cnt = 0
r = []

def dfs(x):
    if seen[x] == 0:
        r[cnt].add(x)
        seen[x] = 1
        for i in F[x]:
            dfs(i)

for i in range(n):
    if seen[i] == 0:
        r.append(set())
        dfs(i)
        cnt += 1

ans = [0]*n

for i in r:
    lr = len(i)
    for j in i:
        ans[j] = lr - len(F[j]) - len(i & B[j]) - 1

print(*ans)

Measured memory_bytes: 84584
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n'
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
	int n, T;
	int c[105], t[105];
	cin>>n>>T;
	int i;
	int ans = inf;
	FOR0(i, n)
	{
		cin>>c[i]>>t[i];
		if(t[i]<=T)
			ans = MIN2(ans, c[i]);
	}
	if(ans==inf)
	{
		cout<<"TLE";
		return 0;
	}
	cout<<ans;
	
}


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

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

Measured memory_bytes: 256
N, A, B, C, D = map(int, input().split())
S = input()
flag = True

if '##' in S[A : C]:
    flag = False
if '##' in S[B : D]:
    flag = False
    
if C > D:
    if '...' not in S[B-2 : D+1]:
        flag = False
    
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>

using namespace std;

typedef long long ll;

string s;
int K;
int main() {
  cin >> s;
  cin >> K;
  set<string> S;
  for (int i = 0; i < s.size(); i++) {
    for (int j = i; j - i < K && j < s.size(); j++) {
      S.insert(s.substr(i, j - i + 1));
    }
  }
  set<string>::iterator it = S.begin();
  for (int i = 0; i < K - 1; i++, it++);
  cout << *it << endl;
  return 0;
}


Measured memory_bytes: 1664
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define re register
#define ri re int
#define il inline
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x)
{
	T f=1;x=0;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
	x*=f;
	return x;
}
ll rd(){ll x;rd(x);return x;}
const int inf=1<<30;

const int N=100005;
int a[N],h[N];
int main()
{
	int n=rd();int m=rd();
	F(i,1,n) rd(h[i]);
	while(m--)
	{
		int x,y;
		rd(x);rd(y);
		if(h[x]<=h[y]) a[x]=1;
		if(h[x]>=h[y]) a[y]=1;
	}
	int ans=0;
	F(i,1,n) ans+=1-a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4416
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main() {

  ll N;cin>>N;

  for(int h=1;h<=3500;h++){
    for(int n=1;n<=3500;n++){
      if(4*h*n-N*n-N*h==0)continue;
      if((N*h*n)%(4*h*n-N*n-N*h)==0){
        ll w=(N*h*n)/(4*h*n-N*n-N*h);
        if(w>3500)continue;
        if(w>0){
          cout<<h<<" "<<n<<" "<<w<<endl;
          return 0;
        }
      }
    }
  }
  if(1116*5244==3494*1750)out("YES");

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];
char a[60][60];
char b[60][60];

int main() {
	int n, m;
	cin >> n >> m;
	bool flag = false;
	rep(i, n) {
		rep(j, n) {
			cin >> a[i][j];
		}
	}
	rep(i, m) {
		rep(j, m) {
			cin >> b[i][j];
		}
	}
	rep(i, n) {
		rep(j, n) {
			if (b[0][0] == a[i][j]) {
				bool flag2 = true;
				rep(k, m) {
					rep(l, m) {
						if (b[k][l] != a[k + i][j + l])flag2 = false;
					}
				}
				if (flag2)flag = true;
			}
		}
	}
	if (flag)puts("Yes");
	else puts("No");
	return 0;
}


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

using namespace std;
int main(){

  int n, ans=0;
  cin >> n;
  long long int a[100000];

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

  sort(a, a+n);

  int x=a[0], cnt=1;

  for(int i=1; i<n; i++){
    if(x==a[i]){
      cnt++;
    } else if(x!=a[i]){
      if(cnt%2!=0){
        ans++;
      }
      x=a[i];
      cnt=1;
    }
  }
  if(cnt%2!=0){
    ans++;
  }
  
  cout << ans << endl;

  return 0;
}

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

void	dfs(int w, int h, int grid[50][50], bool seen[50][50],
			int dx[], int dy[], int x, int y)
{
	seen[y][x] = true;
	int	nx, ny;
	for (int i = 0; i < 8; ++i) {
		nx = x + dx[i];
		ny = y + dy[i];
		if (nx < 0 || w <= nx || ny < 0 || h <= ny)
			continue;
		if (grid[ny][nx] == 0)
			continue;
		if (seen[ny][nx])
			continue;
		dfs(w, h, grid, seen, dx, dy, nx, ny);
	}
}

int	main()
{
	int		w, h;
	int		grid[50][50];
	bool	seen[50][50];
	int		dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
	int		dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
	while (cin >> w >> h) {
		if (w == 0 && h == 0)
			return 0;
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				cin >> grid[i][j];
				seen[i][j] = false;
			}
		}
		int	num_island = 0;
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if (grid[i][j] == 0)
					continue;
				if (seen[i][j])
					continue;
				++num_island;
				dfs(w, h, grid, seen, dx, dy, j, i);
			}
		}
		cout << num_island << endl;
	}
}



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

const int MAX = 105;
int n, cnt, A[MAX];

void print_array() {
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      cout << A[i];
    } else {
      cout << " " << A[i];
    }
  }
  cout << endl;
}

void bubble_sort() {
  bool flag = true;
  while (flag) {
    flag = false;
    for (int i = n - 1; i > 0; i--) {
      if (A[i] < A[i-1]) {
        int tmp = A[i];
        A[i] = A[i-1];
        A[i-1] = tmp;
        flag = true;
        cnt++;
      }
    }
  }
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  bubble_sort();
  print_array();
  cout << cnt << endl;
}


Measured memory_bytes: 3088
// agrawal117
// chahatagrawal117

#include<bits/stdc++.h>
#define mod 1000000007
#define endl '\n'
typedef long long int ll ;
using namespace std;
#define MAX 100004
void solve(string s ,int p)
{
    ll ans=0;
    for(int i=0;i<s.size();i++){
        if((s[i]-'0') % p ==0 )  ans+=(i+1);
    }
    cout<<ans<<endl;
    exit(0);
}
int main()
{
    ll n,p;
     
     p=2019;
     string s; cin>>s;
     n=s.size();
     ll arr[n+2];
     ll val=1LL;
     map<ll,ll> mp;
     ll ans=0;
     for(int i=0;i<s.size();i++){
         arr[i]=s[s.size()-i-1]-'0';
         arr[i]%=p; arr[i]*=val;
         arr[i]%=p;
         val*=10;
         val%=p;
         ans+=arr[i];
        //  cout<<arr[i]<<" ";
         ans%=p;
         mp[ans]++;
     }
     cout<<endl;
     mp[0]++;
     ans=0;
     for(auto i : mp) 
     {
         ll val= i.second;
         ans+=(val*(val-1))/2;
     }
     cout<<ans<<endl;
     
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MAX (int)1e9 + 99
#define maxof(a,b,c) max(a,max(b,c))
#define minof(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vb vector<bool>
#define ll long long
#define ull unsigned long long
#define vll vector<ll>
#define pa pair<int, int>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define MOD 1000000007
#define bitcnt(x) __builtin_popcount(x)
#define gcd(a,b) __gcd(a,b)
#define all(x) (x).begin(),(x).end()
#define ts(x) to_string(x)
#define set0(x) memset(x, 0, sizeof(x))
const double pi = 3.14159265358979323846;
ll binpow(ll, ll);
ll mult(ll, ll);
ll add(ll , ll);
ll division(ll, ll);
ll nCr(ll, ll);
ll inv(ll);
void calc();
template<class T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) {if (!v.empty()) {os << v.front();for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];} return os;}
const int N=50010;
//ll fact[N];

vector<vi> edges(100005,vi());
ll dp[100005][2];

ll dfs(int i, int color, int parent)
{
    if(dp[i][color] != -1) return dp[i][color];

    ll res = 1;
    for(int j: edges[i])
    {
        if(j==parent) continue;
        if(color == 0) res = mult(res, add(dfs(j,0,i), dfs(j,1,i)));
        else res = mult(res, dfs(j,0,i));

    }

    return dp[i][color] = res;
}


void solve()
{
    int n;
    cin>>n;
    memset(dp,-1,sizeof(dp));
    rep(i,n-1)
    {
        int a,b;
        cin>>a>>b;
        edges[a].pb(b);
        edges[b].pb(a);
   }

   //0 for white, 1 for black
   ll ans = add(dfs(1,0,-1),dfs(1,1,-1));
   cout<<ans;
}

int main()
{
    fastio;
    
    int t=1;
    //cin>>t;
    
    rep(i,t)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}

ll add(ll a, ll b){
    a+=b;
    while(a>=MOD) a-=MOD;
    while(a<0) a+=MOD;
    return a;
}

ll mult(ll a, ll b){
    return (a * 1ll * b) % MOD;
}


ll binpow(ll a, ll b){
    ll c = 1;
    while(b > 0)
    {
        if(b % 2 == 1)
            c = mult(c, a);
        a = mult(a, a);
        b /= 2;
    }
    return c;   
}

ll inv(ll a){
    return binpow(a, MOD-2);
}

ll division(ll a, ll b){
    return mult(a, inv(b));
}

/*ll nCr(ll n, ll r){
    if(r > n) return 0;
    return division(fact[n], mult(fact[n-r], fact[r]));
}

void calc(){
    fact[0] = 1;
    srep(i,1,N-1)
        fact[i] = (i*1ll*fac[i-1])%MOD;

}*/

Measured memory_bytes: 17084
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <algorithm>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=510;
int x[N],lst[N],cnt[N],seq[N*N];
inline bool lcmp(int a,int b){
	return x[a]<x[b];
}
inline bool Main(){
	int n=ni;
	for(int i=1;i<=n;i++){
		x[i]=ni,lst[i]=i,cnt[i]=i-1;
	}
	sort(lst+1,lst+n+1,lcmp);
	int p=1,pl=1,pr=1;
	for(int i,t=1;i=lst[t],t<=n;t++){
		for(;p<x[i]&&pr<=n;cnt[lst[pr]]?--cnt[seq[p++]=lst[pr]]:++pr);
		for(;p<x[i]&&pl<t;cnt[lst[pl]]?--cnt[seq[p++]=lst[pl]]:++pl);
		if(p<x[i]||cnt[i])return false;
		seq[p++]=i;
		assert(pr>=t);
		apmax(pr,t+1);
		cnt[i]=n-i;
	}
	assert(pr>n);
	for(int tp=n*n;p<=tp;cnt[lst[pl]]?--cnt[seq[p++]=lst[pl]]:++pl);
	puts("Yes");
	for(int i=1,ti=n*n;i<=ti;i++){
		printf("%d ",seq[i]);
	}
	putchar('\n');
	return true;
}
int main(){
	if(!Main()){
		puts("No");
	}
	return 0;
}

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

int f(int n) {
  while (n > 9) n /= 10;
  return n;
}

int main() {
  int N;
  cin >> N;
  vector<vector<int>> V(10, vector<int>(10));
  for (int i = 1; i <= N; i++) V.at(f(i)).at(i % 10)++;
  int sum = 0;
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++)
      sum += V.at(i).at(j) * V.at(j).at(i);
  cout << sum << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//一括include
using namespace std;
int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    if ((100 * r + 10 * g + b) % 4 == 0)
    {
        cout << "YES" << endl;
    }
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep(i,q) for(int i = 0; (q) > i; i++)
int main(){
  int K,S;cin>>K>>S;
  int ret = 0;
  rep(i,K+1){
    rep(j,K+1){
      if(i+j <= S && i+j+K >= S)ret++;
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    long long i,x,y,n,k;
    x=1;
    y=0;
    cin>>n>>k;
    for (i=0;i<n;i++)
    {
    	cin>>arr[i];
	}
    for (i=0;i<n;i++)
    {
    	y+=arr[i];
    	if (y<=k)
    	{
    		x++;
		}
		else
		{
			break;
		}
	}
	cout<<x<<endl;	
}

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


int main(void)
{
	long long X, K, D;
	std::cin >> X >> K >> D;

	if(X < 0)
		X = -X;

	long long ans;
	long long p = X/D;

	X = X - std::min(p, K) * D;
	K = K - std::min(p, K);

	if(K % 2 == 0)
		ans = X;
	else
		ans = std::abs(X - D);

	std::cout << ans << std::endl;


	return EXIT_SUCCESS;
}


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

int main (){
int n,temp=-1 ;
cin>>n;
    temp=n%10;


if (temp==0||temp==1||temp==6||temp==8)
    cout<<"pon";
else {if (temp==3)
    cout <<"bon";
else cout<<"hon";}

return 0;}

Measured memory_bytes: 3568
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	char op;
	while(true){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '?') break;
		switch(op){
		case '+':
			printf("%d\n",a+b);
			break;
		case '-':
			printf("%d\n",a-b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		}
	}
}


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

using namespace std;

#define run_forrest_run ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define vi vector <int>
#define pii pair <int, int>
#define sz(a) (int)a.size()
#define F first
#define S second
#define si set <int>
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);} 

const int inf = 1e8+1-1;	
const int mod = inf + 7;

const int N = 1e5+500;
int a[N];

int main()
{                   
	run_forrest_run;
	int n, d;
	cin >> n >> d;
	int cnt = 0;
	int a[n][d];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < d; j++)
			cin >> a[i][j];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i == j)
				continue;
			float distance = 0;
			for (int k = 0; k < d; k++) {
				distance+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
			}
			distance = sqrt(distance);
			if (ceil(distance) == floor(distance))
				cnt++;
		}
	}
	cout << cnt/2;
	return 0;
}

Measured memory_bytes: 256
ope = list(input().split())

stack = []

for o in ope:
    if o == '+':
        b, a = stack.pop(), stack.pop()
        stack.append(a + b)
    elif o == '-':
        b, a = stack.pop(), stack.pop()
        stack.append(a - b)
    elif o == '*':
        b, a = stack.pop(), stack.pop()
        stack.append(a * b)
    else:
        stack.append(int(o))

print(stack[0])



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

using namespace std;

int main()
{
    string s;
    cin >> s;
    if(s.length() >= 6 && s[2] == s[3] && s[4] == s[5]){
        cout << "Yes\n";
    }
    else cout << "No\n";
    return 0;
}

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
    string bo = "aiueo";
    string c;
    cin >> c;
    if (bo.find(c) == string::npos) {
        cout << "consonant" << endl;
    } else {
        cout << "vowel" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.lang.*;
import java.util.*;
public class Main 
{
    ///atcoder
    public static void main(final String args[]) 
    {
        final Scanner s = new Scanner(System.in);
        int r=s.nextInt();
        double ans=3.14159265;
        ans=ans*2.0;
        System.out.println(ans*r);
    }
}

Measured memory_bytes: 27144
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

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

//START OF CODE ->->->->->->->

void solve()
{
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,0,a.size()){
        cin>>a[i];
    }
    sort(all(a));
    int sum = 0;
    rep(i,0,k){
        sum += a[i];
    }
    cout<<sum<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



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

int main() {
  int a,b,n; cin >>a >>b;
  if (b==100) n=a*1000+b;
  else if (b/10 != 0) n=a*100+b;
  else n=a*10+b;
  
  bool ans = false;
  for (int i=1; i<n; i++){
    if (i*i == n){
      ans = true;
      break;
    }
  }
  
  if (ans) cout <<"Yes" <<endl;
  else cout <<"No" <<endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int main(int argc, char **argv) {
	ll n;
	cin >> n;
	ll res = 0;
	FOR(i, 1, n+1) {
		if (i % 2 == 0) continue;
		ll c = 0;
		FOR(j, 1, i+1) if (i % j == 0) ++c;
		if (c == 8) ++res;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>
#include<algorithm>
typedef long long ll;

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define fore(i,a) for(auto i:a)

using namespace std;
ll n;
ll a[200005];
int main(){
    cin>>n;
    rep(i,0,n){
        cin>>a[i];
    }
    ll ans=0;
    ll t=1;
    rep(i,0,n){
        if(a[i]==t){
            t++;
        }else{
            ans++;
        }
    }
    
    if(ans==n)ans=-1;
    
    puts(ans);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll inputLValue(){
    ll a;
    cin >> a;
    return a;
};

int main()
{
    int m1 = inputValue();
    int d1 = inputValue();
    int m2 = inputValue();
    int d2 = inputValue();
    int ans = 0;
    if(m1 != m2){
        ans = 1;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256