akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int N, M, V, P;
int A[1010101];

bool can(int ind)
{
    if(N-ind <= P) return true;

    int jpt = V;
    
    jpt -= P-1; // P-1 problems stashed
    jpt -= ind; // ind problems stashed()
    jpt -= 1; // given to ind-th problem

    jpt = max(0, jpt);

    int pt_ind = M+A[ind];

    //printf("!%d %d %d\n", jpt, ind, pt_ind);

    //kick N-P'th problem
    if(A[N-P] > pt_ind) return false;

    long long sv = 0; //nokori value, distributed not exceeding jpt*M remaining probs

    for(int i=ind+1; i<=N-P; ++i)
        sv += pt_ind-A[i];
    
    return sv >= 1LL*jpt*M;

}
int main()
{
    cin >> N >> M >> V >> P;
    for(int i=0; i<N; ++i) cin >> A[i];
    sort(A, A+N);
    int lo = -1;
    int hi = N;

    while((lo+1)!=hi)
    {
        int mi = (lo+hi)>>1;
        if(can(mi)) hi = mi;
        else lo = mi;
    }
    //printf("%d %d\n", lo, hi);
    //hi~N-1: possible
    printf("%d\n", N-hi);
}

Measured memory_bytes: 640
use itertools::Itertools as _;
use num::integer::gcd;
use proconio::input;

fn main() {
    input! {
        _: usize,
        s: String,
    }
    let mut ans = 0;
    let chars: Vec<char> = s.chars().collect();

    let cnt = |c| s.chars().filter(|&x| x == c).count();
    let mut ans = cnt('R') * cnt('G') * cnt('B');

    for i in 0..chars.len() {
        let first = chars[i];
        for j in i + 1..chars.len() {
            if 2 * j - i >= chars.len() {
                continue;
            }
            let second = chars[j];
            if first != second {
                let third = chars[2 * j - i];
                if third != second && first != third {
                    ans -= 1;
                }
            }
        }
    }

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


Measured memory_bytes: 2144
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
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 rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "

//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    vector<vector<char>> c(10, vector<char>(10));
    rep(i,2){
        rep(j,3){
            cin >> c[i][j];
        }
    }
    if(c[0][0]==c[1][2] && c[0][2]==c[1][0] && c[0][1]==c[1][1]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x, A, B ;
    scanf("%d %d %d" , &x, &A, &B);

    double dis1=abs(x-A);
    double dis2=abs(x-B);
    while(dis1==dis2)
    {
        printf("None");

    }
        if(dis1>dis2)
    {
    printf( "B");
    }
    else
    {
    printf("A");
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N; cin >> N;
  vector<ll> A(N, 0);
  vector<ll> AA(N, 0);
  map<ll, ll> mp;
  ll ans = 0;
  REP(i, N){
    cin >> A[i];
    if(i){
      AA[i] = A[i] + AA[i-1];
      mp[AA[i]]++;
      if(AA[i] == 0) ans++;
    }else{
      AA[i] = A[i];
      mp[AA[i]]++;
      if(AA[i] == 0) ans++;
    }
  }
  REP(i, N-1){
    mp[AA[i]]--;
    ans += mp[AA[i]];
  }
  cout << ans << endl;
}

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

int main() {
	string s;
	cin >> s;
	int c = 0;
	if (s[0] == 'a' && s[1] == 'b' && s[2] == 'c' ) {
		c++;
	}

	if (s[0] == 'a' && s[1] == 'c' && s[2] == 'b') {
		c++;
	}

	if (s[0] == 'b' && s[1] == 'a' && s[2] == 'c') {
		c++;
	}

	if (s[0] == 'b' && s[1] == 'c' && s[2] == 'a') {
		c++;
	}

	if (s[0] == 'c' && s[1] == 'b' && s[2] == 'a') {
		c++;
	}

	if (s[0] == 'c' && s[1] == 'a' && s[2] == 'b') {
		c++;
	}

	if (c == 1) {
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
from collections import Counter, deque

N = int(input())
A = list(map(int, input().split())) + [N+1]
B = list(map(int, input().split())) + [N+1]
C = [0]
D = [0]

AB_cn = Counter(A+B)
if AB_cn.most_common()[0][1] > N:
    print("No")
else:
    print("Yes")
    for i in range(N+1):
        if len(C) != A[i]:
            C.extend([i]*(A[i]-len(C)))
        if len(D) != B[i]:
            D.extend([i]*(B[i]-len(D)))
    ans = 0
    for i in range(N):
        curr = C[i+1] - D[i]
        ans= max(curr, ans)
    B = B[:-1]
    print(*[B[(i-ans)%N] for i in range(N)])

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,m,s,t,vis[100005][3];
vi a[100005];
void solve(){
    memset(vis,-1,sizeof vis);
    cin>>n>>m;
    rep(i,0,m){
        int x,y;
        cin>>x>>y;
        a[x].pb(y);
    }
    cin>>s>>t;
    queue<pii> q;
    q.push({s,0});
    vis[s][0]=0;
    while(!q.empty()){
        int d=sz(q);
        rep(_,0,d){
            pii w=q.front();
            q.pop();
            for(auto i:a[w.x]){
                if(vis[i][(w.y+1)%3]==-1){
                    vis[i][(w.y+1)%3]=vis[w.x][w.y]+1;
                    q.push({i,(w.y+1)%3});
                }
            }
        }
    }
    if(vis[t][0]!=-1) cout<<vis[t][0]/3<<endl;
    else cout<<-1<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 6912
#include<bits/stdc++.h>
 
using namespace std;
long long mod=1e9+7;
long long INF=1e7;
double EPS = 1e-12;
const long long lim = 2e5+100;
typedef long long int lld;
typedef long long ll;

#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define mset(a, v) memset(a, v, sizeof(a))
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }
 
 
#define popcount __builtin_popcountll
 
ll powP(ll x, ll y) {
    ll ans = 1, po = x % mod;
    while(y > 0) {
        if(y & 1) ans = ans * po % mod;
        y >>= 1; po = po * po % mod;
    }
    return ans;
}


vector<ll> Ans, Adj[lim];
ll Array[lim], C[lim],dp[600][600];
pair<ll,ll> P[lim];

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    
    lld T,i,p,j,l,e,r,b,c,k,m,q,a,d,w,x,y,u,v,z,t,curr,prev,sum=0,val,countA=0,indicator=0,pos,h,minA,maxA,type,n,ans=0,left,right;
    string A,B; a=b=0;  
    vector<string> S;
    cin>>n>>l;
    rep(i,1,n){ cin>>A; S.push_back(A); }
    sort(S.begin(),S.end());
    for(auto i:S) cout<<i;
    cout<<endl;

    return 0;
}
    


Measured memory_bytes: 8336
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<ll, ll>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }


int main() {
    ll n; cin >> n;
    ll sum = 0;
    for(int i = 1; i <= n; ++i) {
        ll nnn = n/i;
        ll gn = nnn*(nnn+1)/2;
        sum += (gn*i);
    }
    cout << sum << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define r(i,n) for(long long i = 0; i<n; i++)
typedef long long ll;
using namespace std;

int main() {
  bool flag=true;
  int n,t1=0,x1=0,y1=0,t2,x2,y2;
  cin >> n;
  r(i,n){
      cin >> t2>> x2>> y2;
      if(abs(x1-x2)+abs(y1-y2)>t2-t1||(t2-t1-abs(x1-x2)-abs(y1-y2))%2==1)flag=false;
      t1=t2; x1=x2; y1=y2;
  }
  if(flag)cout<<"Yes"<<endl;
  else cout<< "No"<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

template <class T>
struct fenwick_tree {
  vector<T> x;
  fenwick_tree(int n) : x(n, 0) {}
  T sum(int i, int j) {
    if (i == 0) {
      T S = 0;
      for (; j >= 0; j = (j & (j + 1)) - 1) S += x[j];
      return S;
    } else
      return sum(0, j) - sum(0, i - 1);
  }
  void add(int k, T a) {
    for (; k < x.size(); k |= k + 1) x[k] += a;
  }
};

int main() {
  int N;
  while (cin >> N) {
    ++N;
    vector<ll> a(N, 0);
    for (int i = 1; i < N; i++) {
      cin >> a[i];
    }
    vector<int> stk;
    for (int i = 0; i < N; i++) {
      if (stk.empty() || a[stk.back()] < a[i]) {
        stk.push_back(i);
      }
    }
    vector<ll> xs = a;
    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());
    vector<ll> ys = a;
    for (auto& y : ys) {
      y = lower_bound(xs.begin(), xs.end(), y) - xs.begin();
    }
    vector<ll> ans(N, 0);
    fenwick_tree<ll> cnt(xs.size()), sum(xs.size());
    for (int i = stk.size() - 2, k = N - 1; i >= 0; i--) {
      int j = stk[i], p = stk[i + 1];
      while (j < k) {
        cnt.add(ys[k], 1);
        sum.add(ys[k], a[k]);
        --k;
      }
      ll c = cnt.sum(ys[j] + 1, ys[p]);
      ll s = sum.sum(ys[j] + 1, ys[p]);
      ans[p] += s - (c * a[j]);
      cnt.add(ys[j], c);
      sum.add(ys[j], c * a[j]);
    }
    for (int i = 1; i < N; i++) {
      cout << ans[i] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 6264
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  string s;
  cin >> N >> s;
  ll r_cnt = 0, b_cnt = 0;
  for (auto c : s) {
    if (c == 'R')
      r_cnt++;
    else
      b_cnt++;
  }
  if (r_cnt > b_cnt) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,p,d1,d2,number,maxs;
  while(1){
    maxs=0;
    cin>>n;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin>>p>>d1>>d2;
      if(maxs<d1+d2){
	number=p;
	maxs=d1+d2;
      }
    }
    cout<<number<<' '<<maxs<<endl;
  }
  return(0);
}



Measured memory_bytes: 3012
N, Y = [int(n) for n in input().split()]
ans = (-1, -1, -1)
for x in range(N+1):
  for y in range(N-x+1):
    if Y == 10000*x+5000*y+1000*(N-x-y):
      ans = (x, y, N-x-y)
print("{} {} {}".format(ans[0],ans[1],ans[2]))

Measured memory_bytes: 3064
#include<iostream>
#include <string>
#include<vector>

using namespace std;

 int main(){

 	int a, b;
 	cin >> a >> b;
 	if(a+b < 24){
 		cout << a+b << endl;
 	}
 	else{
 		cout << a+b-24 << endl;
 	}
 	return 0;

}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define exf(x)	 for(auto&& tmp : x) { cout << tmp << endl; }	// 拡張for
#define PI 3.14159265358979323846264338327950288
#define testP	 cout << "------------------ test ------------------" << endl;	// 動作確認テスト
#define testX(x) cout << "testout : " << x << endl;	// テストアウト
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

// ------------------ ベクター表示 ------------------ //
void printVec(vector<int>& vec) {
	cout << "";
	for (auto it = vec.begin(); it != vec.end(); it++) cout << *it << " ";
	cout << endl;
}

// ------------------ ベクター合計 ------------------ //
int sumVec(vector<int> v) {
	int sum = 0;
	for (size_t i = 0; i < v.size(); i++) sum += v[i];
	return sum;
}

// -------------------------------------------------- //
// ------------------ ここから本編 ------------------ //
// -------------------------------------------------- //

string S = "";

void GCD(ll N) {
	if (N == 0) return;
	else {
		if (N % 26 == 0) {
			S = 'z' + S;
			GCD(N / 26 - 1);
		}
		else {
			S = (char)((N % 26) + 96) + S;
			GCD(N / 26);
		}
	}
}

int main(void) {

	ll N;
	cin >> N;

	GCD(N);
	cout << S << endl;

	return 0;
}


Measured memory_bytes: 3584
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
  
signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);
  
  int n;
  cin >> n;
  vector<int> vs(n);
  REP(i,n) cin >> vs[i];
  sort(vs.begin(), vs.end(), greater<int>());
  stack<D> s;
  REP(i,n) s.push(vs[i]);

  while(s.size() != 1){
    double a = s.top();
    s.pop();
    double b = s.top();
    s.pop();
    s.push((a + b) / 2.0);
  }

  cout << s.top() << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  int x = a*b;
  if (x%2 == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;



int main() {
    
    int n;
    cin>>n;
    set<int> s;
    rep(i,n){
        int a;
        cin>>a;
        s.insert(a);
    }
    int m;
    cin>>m;
    rep(i,m){
        int a;
        cin>>a;
        if(s.count(a))s.erase(a);
        else s.insert(a);
    }
    irep(i,s){
        fin(*i);
    }
}


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

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


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

int main(){
  long long a, b;
  cin >> a >> b;
  if(a % 2 != b % 2){
    cout << "IMPOSSIBLE" << endl;
  } else{
    cout << (a + b) / 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int cnt = 0, ans = 0;
    bool even = false;
    for (auto c : s) {
        if (even ^ c == '0') cnt++;
        even ^= 1;
    }
    ans = cnt;
    cnt = 0, even = true;
    for (auto c : s) {
        if (even ^ c == '0') cnt++;
        even ^= 1;
    }
    ans = min(ans, cnt);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 512
import numpy as np

L,R = map(int, input().split())

if  R-L > 2018:
    print(0)
    
else:
    ans = 2018
    
    R = R % 2019
    L = L % 2019

    if L > R:
        R += 2019
        
    if R - L > 500:
        print(0)
        
    else:
        for i in np.arange(L, R+1):
            for j in np.arange(i+1, R+1):
                i = i % 2019
                j = j % 2019
                k = i * j % 2019
                ans = np.amin(np.array([k, ans]))
            
        print(ans)    

Measured memory_bytes: 12424
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define ti3 tuple<int,int,int>
ll int MOD=998244353;
int INF=1e6;
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    int n,m;
    cin>>n>>m;
    int map[1000][1000]={};
    rep(i,m){
        int a,b;
        cin>>a>>b;
        map[a][b]=1;
        map[b][a]=1;
    }
    int visited[1000]={},t[1000]={};
    vector<int> v;
    while(1){
        int pos,flag=0;
        rep2(i,1,n){
            if(!visited[i]){
                pos=i; flag=1;break;
            }            
        }
        if(!flag){
            sort(v.begin(),v.end());
            int l=0,r=0;
            rep(i,v.size()){
                if(l>r){
                    r-=v[i];
                }
                else l-=v[i];
            }
            int temp=abs(r-l);
            l=(n-temp)/2;
            r=n-l;
            cout<<(l*(l-1)/2+r*(r-1)/2);
            return 0;
        }
        queue<int> q;
        t[pos]=1;
        visited[pos]=1;
        q.push(pos);
        int one=1,two=0;
        while(!q.empty()){
            int p=q.front();
            q.pop();
            rep2(i,1,n){
                if(!map[p][i]&&i!=p){
                    if(visited[i]&&t[i]==t[p]){
                        cout<<-1; return 0;
                    }
                    if(!visited[i]){
                        if(t[p]==1){
                            t[i]=2;
                            two++;
                        }
                        else {t[i]=1;one++;}
                        q.push(i);
                        visited[i]=1;
                    }
                }
            }
        }
        v.push_back(-abs(one-two));
    }
}

Measured memory_bytes: 4224
#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++)
constexpr int MOD = 1000000007;
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() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<ll> acc(N + 1);
    for (int i = 0; i < N; i++) {
        acc[i + 1] = acc[i] + A[i];
    }
    ll ans = 1LL << 60;
    for(int j = 2; j < N - 1; j++) {
        int i1 = lower_bound(all(acc), acc[j] / 2) - acc.begin();
        int k1 = lower_bound(all(acc), acc[j] + (acc[N] - acc[j]) / 2) - acc.begin();
        vector<int> I = {i1};
        vector<int> K = {k1};
        if (i1 - 1 >= 0) I.push_back(i1 - 1);
        if (k1 - 1 >= 0) K.push_back(k1 - 1);
        for(int u = 0; u < I.size(); u++) {
            for(int v = 0; v < K.size(); v++) {
                int i = I[u], k = K[v];
                vector<ll> area;
                area.push_back(acc[i]);
                area.push_back(acc[j] - acc[i]);
                area.push_back(acc[k] - acc[j]);
                area.push_back(acc[N] - acc[k]);
                sort(all(area));
                ans = min(ans, area.back() - area[0]);
            }
        }
    }
    cout << ans << 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: 3456
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;//998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

template<int Modulus> 
struct ModInt {
    long long x;
    ModInt(long long x = 0) :x(x % Modulus) {}
    ModInt inverse() const {// x ^ (-1) 
        long long a = x,b = Modulus,p = 1,q = 0;
        while (b) {long long d = a/b; a -= d*b; swap(a,b); p -= d*q; swap(p,q);}
        return ModInt(p);
    }
    constexpr ModInt &operator+=(const ModInt a) {if ((x += a.x) >= Modulus) x -= Modulus; return *this;}
    constexpr ModInt &operator-=(const ModInt a) {if ((x += Modulus - a.x) >= Modulus) x -= Modulus; return *this;}
    constexpr ModInt &operator*=(const ModInt a) {(x *= a.x) %= Modulus; return *this;}
    constexpr ModInt &operator/=(const ModInt a) {return *this *= a.inverse();}

    constexpr ModInt operator+(const ModInt a) const {return ModInt(*this) += a;}
    constexpr ModInt operator-(const ModInt a) const {return ModInt(*this) -= a;}
    constexpr ModInt operator*(const ModInt a) const {return ModInt(*this) *= a;}
    constexpr ModInt operator/(const ModInt a) const {return ModInt(*this) /= a;}
    
    friend constexpr ostream& operator<<(ostream& os,const ModInt<Modulus>& a) {return os << a.x;}
    //friend constexpr istream& operator>>(istream& is,const ModInt<Modulus>& a) {return is >> a.x;}

    ModInt pow(long long N) {// x ^ N 
        ModInt a = 1;
        while (N) {
            if (N&1) a *= *this;
            *this *= *this;
            N >>= 1;
        }
        return a;
    }
};

using mint = ModInt<1000000007>;
struct Combination {
    int N;
    //using mint = ModInt<1000000007>;
    //using mint = ModInt<998244353>;
    vector<mint> fact,ifact,invs;
    Combination(int N): N(N),fact(N + 1),ifact(N + 1) {
        fact[0] = fact[1] = 1;
        ifact[0] = ifact[1] = 1;
        for (int i = 2;i < N + 1;++i) {fact[i] = fact[i - 1] * i;}
        ifact[N] = fact[N].inverse();
        for (int i = N;i >= 1;--i) {ifact[i - 1] = ifact[i] * i;}
    }
    void invs_build() {
        invs.resize(N + 1);
        invs[1] = 1;
        for (int i = 2;i < N + 1;++i) invs[i] = fact[i] * ifact[i - 1];
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n - k];
    }
};

int main() {
    string S;
    int K;
    cin >> K >> S;
    int M = S.size();
    int N = M + K;
    
    Combination comb(N);
    mint ans = 0;

    for (int i = M;i <= N;++i) {
        ans += comb(i - 1,M - 1) * mint(26).pow(N - i) * mint(25).pow(i - M);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35588
import java.util.Scanner;
public class Main {
	static long lcm(int a, int b) {
		int temp;
		long c = a;
		c *= b;
		while((temp = a%b) != 0) {
			a = b;
			b = temp;
		}
		return c/b;
	}
	
	
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		
		System.out.println(lcm(a,b));
		
		
		
		
		
		
		
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define MOD 1000000007
#define mod % MOD
#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define pb push_back
#define f first
#define s second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;


int gcd(int a,int b) 
{
  int R;
  while ((a % b) > 0)  
  {
    R = a % b;
    a = b;
    b = R;
  }

  if(b > 1)
  {
    return b;
  }


  
}
 
  
int find(int parent[], int i)  
{  
    if (parent[i] == -1)  
        return i;  
    return find(parent, parent[i]);  
}  
  
 
void Union(int  parent[], int x, int y)  
{  
    int xset = find(parent, x);  
    int yset = find(parent, y);  
    if(xset != yset) 
    {  
        parent[xset] = yset;  
    }  
}  
    

signed main()
{
    int n, k;
    cout << fixed << setprecision(6);
    cin >> n >> k;

    double a[n];

    double x = 0;

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

        x = a[i];

        x = x + 1;
        x = x/2;

        a[i] = x; 

    }

    double sum = 0;

    for (int i = 0; i < k; ++i)
    {
        sum  = sum + a[i];
    }

    double temp = sum;

   // cout << temp << endl;

    for (int i = 1 ; i + k <= n; ++i)
    {
        temp = temp - a[i-1];

       // cout << temp << " ";
        temp = temp + a[i + k - 1];
       // cout << temp << " ";

       
        if(temp > sum)
        {
            sum = temp;
        }

       //  cout << i << " " << temp << " " << sum << endl;
    }

    cout << sum << endl;



 

   

    return 0;
}  

Measured memory_bytes: 1792
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const rule = lines.shift().split(" ").map(Number);
  const K = rule[0];
  const S = rule[1];
  let count = 0;

  for (let i = 0; i <= K; i++) {
    for (let j = 0; j <= K; j++) {
      if (S - i - j >= 0 && S - i - j <= K) {
        count++;
      }
    }
  }

  console.log(count);
});


Measured memory_bytes: 7628
#include <iostream>
using namespace std;
int main(){
  while(1){
    int score[3],tscore;
    for(int i=0;i<3;i++) cin >>score[i];

    if(score[0] == -1 && score[1] == -1 && score[2] == -1) break;

    if(score[0] == -1 || score[1] == -1){
      cout << "F" << endl;
      continue;
    }

    tscore=score[0]+score[1];

    if(tscore>=80){
      cout << "A" << endl;
      continue;
    }else if(tscore>=65 && tscore<80){
      cout << "B" << endl;
      continue;
  }else if(tscore>=50 && tscore<65){
      cout << "C" << endl;
      continue;
  }else if(tscore<30 && score[2] >= 50){
    cout << "C" << endl;
    continue;
  }else if(tscore<30 && score[2] < 50){
    cout << "F" << endl;
    continue;
  }else if(tscore>=30 && tscore<50 && score[2] < 50){
    cout << "D" << endl;
    continue;
  }else if(tscore>=30 && tscore<50 && score[2] >= 50){
    cout << "C" << endl;
    continue;
  }
    }
    return 0;
}

Measured memory_bytes: 3092
import math


def rot60_on_complex_plane(start: complex, end: complex) -> complex:
    v = end - start
    arg = 1 / 2 + complex(0, (math.sqrt(3) / 2))
    return v * arg + start


def print_real_coordinate(z: complex) -> None:
    x = z.real
    y = z.imag
    print(f"{x:.8f} {y:.8f}")


def create_koch_points(p1: complex, p2: complex, n: int) -> None:
    if n == 0:
        return

    # Get s, t, u coordinates on the complex plane.
    s = (p2 - p1) * (1 / 3) + p1
    t = (p2 - p1) * (2 / 3) + p1
    u = rot60_on_complex_plane(s, t)

    # Call the function recursively by the case of n == 0.
    create_koch_points(p1, s, n - 1)
    print_real_coordinate(s)
    create_koch_points(s, u, n - 1)
    print_real_coordinate(u)
    create_koch_points(u, t, n - 1)
    print_real_coordinate(t)
    create_koch_points(t, p2, n - 1)


if __name__ == "__main__":
    n = int(input())
    start_point = (0 + 0j)
    end_point = (100 + 0j)

    print_real_coordinate(start_point)
    create_koch_points(start_point, end_point, n)
    print_real_coordinate(end_point)



Measured memory_bytes: 5764
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = LI()
    d = set()
    t = 0
    for c in a:
        if c >= 3200:
            t += 1
        else:
            d.add(c//400)
    l = len(d)
    return '{} {}'.format(max(l,1),l+t)


print(main())


Measured memory_bytes: 5460
#%%
from operator import mul
from functools import reduce
import itertools


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N = int(input())

m_cnt = 0
a_cnt = 0
r_cnt = 0
c_cnt = 0
h_cnt = 0

for _ in range(N):
    s = input()
    if s[0] == 'M':
        m_cnt += 1
    elif s[0] == 'A':
        a_cnt += 1
    elif s[0] == 'R':
        r_cnt += 1
    elif s[0] == 'C':
        c_cnt += 1
    elif s[0] == 'H':
        h_cnt += 1


ans = 0
march = (m_cnt, a_cnt, r_cnt, c_cnt, h_cnt)
for cb in itertools.combinations(march, 3):
    ans += cb[0] * cb[1] * cb[2]


print(ans)


Measured memory_bytes: 48236
#include <iostream>
#include <math.h>
#include <stack>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <iterator>
#include <cctype>
#include <cstdio>
#include <cstring>
#define rep(counter, limit) for (int counter = 0; counter < limit; counter++)
typedef long long ll; using namespace std;const int INF=1001001001;
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }
int lcm(int a, int b) { return a * b / gcd(a, b); }
bool primenum(int a) { if (a == 1) { return false; }if (a == 2) { return true; }if (a % 2 == 0) { return false; }for (int i = 3; i < sqrt(a) + 1; i += 2) { if (a != i) { if (a % i == 0) { return false; } } }return true; }
int main() {

  int k;
  cin>>k;
  ll sum=0;
  for(int a=1;a < k+1;a++){
    for(int b=1;b < k+1;b++){
      for(int c=1;c < k+1;c++){
        sum+=gcd(a,gcd(b,c));
      }
    }
  }
cout<<sum<<endl;

return 0;
}


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

struct Edge{
    int to, cap, rev;
};

const int INF = INT_MAX;
vector<Edge> G[100];

bool used[100];

void add_edge(int from, int to, int cap) {
    G[from].push_back((Edge){ to, cap, (int)G[to].size() });
    G[to].push_back((Edge){ from, 0, (int)G[from].size()-1 });
}

int maxflow(int s, int t, int f) {
    used[s] = true;
    int ret;
    if (s == t) {
        ret = f;
    } else {
        ret = 0;
        for (Edge &e: G[s]) {
            if ( ! used[e.to] && e.cap > 0) {
                int maxf = maxflow(e.to, t, min(f, e.cap));
                if (maxf > 0) {
                    e.cap -= maxf;
                    G[e.to][e.rev].cap += maxf;
                    ret = maxf;
                    break;
                }
            }
        }
    }
    return ret;
}

int main() {
    int V, E;
    cin >> V >> E;
    for (int i=0; i<E; ++i) {
        int u, v, c;
        cin >> u >> v >> c;
        add_edge(u, v, c);
    }

    int mx = 0;
    while (1) {
        fill(used, used+100, false);
        int f = maxflow(0, V-1, INF);
        if (f == 0) break;
        mx += f;
    }
    cout << mx << endl;

    return 0;
}


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

using namespace std;

int a[2][123456];

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int sum = 0;
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
			sum += a[i][j];
		}
	}
	for (int i = 1; i < n; i++) {
		sum -= a[0][i];
	}
	int ans = sum;
	for (int i = 1; i < n; i++) {
		sum += a[0][i] - a[1][i - 1];
		ans = max(ans, sum);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=5e5;

  int n;
  int a[N];
int cmp(int x,int y)
{
  return x>y;
} 
 
int main()
{
  cin>>n;
  for (int i=n;i;--i)
    scanf("%d",a+i);
  sort(a+1,a+n+1,cmp);
  int z=1;
  while (z<n&&a[z+1]>z) ++z;
  int x=a[z],y=z;
  while (a[y+1]>=z) ++y;
  if ((x-z&1)|(y-z&1))
    puts("First");
  else
    puts("Second");
  exit(0);
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

inline void solve(){
  int n, k;
  int a[155];
  cin >> n >> k;
  cinf(n,a);
  sort(a,a+n,greater<int>());
  int ans = 0;
  FOR(i,k){
    ans+=a[i];
  }
  cout << ans fin;
}


struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;
signed main(){solve();return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define INF (1<<21)
int dp[1001][1001];
pair<int,int> solve(vector<int> value , vector<int> weight , int W , int N){
	for(int i=0;i<1001;i++)
		for(int j=0;j<1001;j++)
			dp[i][j] = 0;
	for(int num=1;num<=N;num++){
		for(int w=0;w <= W;w++){
			dp[num][w] = max( dp[num][w] , dp[num-1][w]);
			if(w >= weight[num])dp[num][w] = max( dp[num][w] , dp[num-1][w-weight[num]] + value[num]);
		}
	}	
	int ans1 = *max_element(dp[N],dp[N]+W+1);
	int ans2 = find(dp[N],dp[N]+W+1,ans1)-dp[N];
	return make_pair(ans1,ans2);
}

int main(){
	int n,w,CaseNum=0;
	while(cin >> w && w){
		cout << "Case " << ++CaseNum << ":" << endl;
		cin >> n;
		vector<int> value(1+n) , weight(1+n);
		for(int i=1;i<=n;i++){
			scanf("%d,%d\n",&value[i],&weight[i]);
		}
		pair<int,int> ans = solve(value,weight,w,n);
		cout << ans.first << endl << ans.second << endl;
	}
}

Measured memory_bytes: 0
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if ((b - a) == (c - b)) {
      System.out.println("YES");  
    } else {
      System.out.println("NO");
    }

  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define dame {cout<< "No" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    ll kosu;
    reps(i,1,500){
        if(i*(i+1)/2==N) {kosu=i; break;}
        if(i*(i+1)/2>N) dame;
    }
    cout<< "Yes" <<"\n";
    cout<< kosu+1 <<"\n";

    vector<ll> ans[kosu+1];
    ll now=1;
    rep(i,kosu+1){
        rep(j,kosu-i){
            ans[i].emplace_back(now);
            ans[i+j+1].emplace_back(now);
            ++now;
        }
    }
    rep(i,kosu+1){
        cout<< kosu <<" ";
        for(auto x:ans[i]){
            cout<< x <<" ";
        }
        cout<<"\n";
    }

}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 3200
class BruteForce
  def initialize
    @n = 0
    @a = []
  end

  def solve
    @n    = gets.chomp.to_i
    @a = gets.scan(/\d+/).map(&:to_i)
    q    = gets.chomp.to_i
    m = gets.scan(/\d+/).map(&:to_i)

    ans = []

    m.each do |x|
      if makable(0, x)
        ans << "yes"
      else
        ans << "no"
      end
    end
    return ans
  end

  def makable(p,t)
    if p == @n - 1
      if ((@a[@n - 1] == t) || (t == 0))
        true
      else
        false
      end
    else
      makable(p+1, t - @a[p]) | makable(p+1, t)
    end
  end
end

if $0 == __FILE__
  puts BruteForce.new.solve
end

Measured memory_bytes: 6104
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <string>
#include <cmath>
//#include <vector>
//#include <time.h>
#include <queue>
//#include <stack>
//#include <map>
//#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
int a[10000];
int main()
{
    string ch[1010];
    int n,d;
    cin>>n>>d;
    for(int i=1;i<=n;i++)
        cin>>ch[i];
    sort (ch+1,ch+n+1);
    for(int i=1;i<=n;i++)
        cout<<ch[i];
    return 0;
}

Measured memory_bytes: 256
/*@author Vipen Loka*/
#include <bits/stdc++.h>
#define endl '\n'
#define ff first
#define ss second
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define deb(x) cout << #x << ':' << x << '\n';

using namespace std;

class Tree{
	int n;
	list<int> *tree;
public:
	int mx=0;
	vector<int> visited;
	Tree(int n){
		this->n=n;
		tree=new list<int>[n];
		visited.assign(n,0);
	}

	void addEdge(int a,int b){
		a--;b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	int dfs_util(int s){
		visited[s]=1;
		int c=1;
		for(auto &x:tree[s]){
			if(visited[x])continue;
			c+=dfs_util(x);
		}

		return c;
	}


	void dfs(int s){
		if(visited[s])return;
		mx=max(mx,dfs_util(s));
	}

};

void solve(){
	int i,j;
	int n,m;
	cin >> n >> m;
	Tree t(n);
	for (int i = 0; i < m; ++i)
	{
		int a,b;cin >> a >> b;
		t.addEdge(a,b);
	}

	for (int i = 0; i < n; ++i)
	{
		t.dfs(i);
	}

	int ans=t.mx;

	printf("%d\n",ans);
}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    
	int T=1;
	// cin >> T;
	while (T--){
		solve();
	}
}


Measured memory_bytes: 30536
#include <bits/stdc++.h>
using namespace std;
 
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=200;
const int mod=1e9+7;

ll n,m,dp[N][N][N],ans;
ll dpf[N][N];

int logi(ll k){
	int ans=0;
	while(k>1){
		ans++;
		k/=2;
	}
	return ans;
}

ll solve(int i,ll k,int cnt){
	ll a=logi(k);
	if(k<=0){
		return 1;
	}
//	cout<<i<<" "<<cnt<<" "<<a<<endl;
	if(dpf[i][cnt]!=-1)return dpf[i][cnt];
	ll ans=0;
	ll b=pow(2,a);
//	cout<<b<<endl;
	for(ll p=1;p<=n;p++){
		ans+=dp[i][p][a]*solve(p,k-b,cnt+1);
		ans%=mod;
	}
	return dpf[i][cnt]=ans;
}

int main(){
	memset(dpf,-1,sizeof(dpf));
	//fri("in.txt");
	//fro("out.txt");
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cin>>dp[i][j][0];
		}
	}
	for(int i=1;i<=log2(m+1);i++){
		for(int l=1;l<=n;l++){
			for(int k=1;k<=n;k++){
				for(int r=1;r<=n;r++){
					dp[l][r][i]+=(dp[l][k][i-1]*dp[k][r][i-1])%mod;
					dp[l][r][i]%=mod;
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans+=solve(i,m,0);
		ans%=mod;
	}
	cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 15360
#include<iostream>
using namespace std;
int main() {
	int p[3], d[2];
	int minp = 29999, mind = 29999;
	for (int i = 0; i < 3; i++) {
		cin >> p[i];
		if (p[i] < minp) minp = p[i];
	}
	for (int k = 0; k < 2; k++) {
		cin >> d[k];
		if (d[k] < mind) mind = d[k];
	}
	cout << mind + minp-50 << endl;
}

Measured memory_bytes: 3092
#include<stdio.h>

int main(void){
//13はあとでnに書き換える
int p,c,n,r;

int i,j,k = 0;
int counter;
int array_count;

/*
scanf("%d",&n);
scanf("%d",&p);
scanf("%d",&c);
*/
//puts("");

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

//書き潰される前にバッファに退避　大きさはc 関数1回ごとに初期化

//do{
/*
scanf("%d",&p);
scanf("%d",&c);
*/
while(1){

scanf("%d %d",&n,&r); /*n枚のデッキを r回シャッフルしてprintf 次に
p cはそのデッキの上からの枚数を考える
*/
if(n == 0 && r == 0) break;
int int_arr[n];
for(i=0;i<n;i++){
int_arr[i] = i+1;
}


for(k=0;k<r;k++){
array_count = 0;
counter = 0;
scanf("%d %d",&p,&c); 

// 1 10のとき　シャッフル必要ない　p-1 = 0だったら、シャッフルしないとか入れよう
if(p-1 == 0) continue;

int buffer[c]; 

for(j=n-p-c+1;j<n-p+1;j++){ //バッファに退避 終了条件+1いらないかも
buffer[-n+p+c-1+j] = int_arr[j];
array_count++;
}//ここ大丈夫

// ここからがまずい
/*
for(j=n-p-c+1;j<n-p+1;j++){ //バッファをプリント
printf("バッファは%d",buffer[-n+p+c-1+j]);
}
puts("");
*/

/*
for(j=n-p-c; j<n-p;j++){//上を下にシャッフル だめ
 int_arr[j+1] = int_arr[j+p]; //ここか デバッグ　ここの右辺　index がj+c=11でオーバフロー
 }
 
for(i = 0;i<n;i++){
printf("%d",int_arr[i]);
puts("");
}
 
puts("");
for(j=n-c+1;j<n;j++){
 int_arr[j]=buffer[-n+c-1+j]; //バッファからちゃんと戻されていない
}
*/

for(j=n-p+1; j<n;j++){//上を下にシャッフル　
int_arr[j-c] = int_arr[j]; 
counter = j;
 }

counter ++; //一番上までカウンタを持っていき、あとでバッファのサイズ分だけ引く

/*
puts("上から下にシャッフル"); //test
for(i = 0;i<n;i++){ 
printf("%d",int_arr[i]);
puts("");
}
*/

//printf("counterは%dです.\n",counter);
//printf("array_countは%dです.\n",array_count);

for(j=counter-array_count;j<n;j++){
 int_arr[j]=buffer[j-counter+array_count]; //バッファからうまく戻っていない
}

/*
puts("バッファから回復");
for(i = 0;i<n;i++){
printf("%d",int_arr[i]);
puts("");
}

puts("");
*/
}
    
printf("%d\n",int_arr[n-1]);

}
/*
}while(0);
*/
return 0;
}


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

import math
def prime(x):
  p = {}
  last = math.floor(x ** 0.5)
  if x % 2 == 0:
    cnt = 1
    x //= 2
    while x & 1 == 0:
      x //= 2
      cnt += 1
    p[2] = cnt
  for i in range(3, last + 1, 2):
    if x % i == 0:
      x //= i
      cnt = 1
      while x % i == 0:
        cnt += 1
        x //= i
      p[i] = cnt
  if x != 1:
    p[x] = 1
  return p

p = prime(N)

ans = 0
for i in p.values():
  c = 1
  t = i
  while t >= c:
    t -= c
    ans += 1
    c += 1

print(ans)

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

inline ll int maxm (ll int a,ll int b)
{    if(a>b) return a;
     else return b;
}
inline ll int minm (ll int a,ll int b)
{    if(a>b) return b;
     else return a;
}
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);cout.tie(NULL);

   int n;cin>>n;int a[n];
   for(int i=0;i<n;i++)cin>>a[i];
   int dp[n];
   dp[0]=0;
   dp[1]=abs(a[0]-a[1]);
   for(int i=2;i<n;i++)
   {
       dp[i]=min(abs(dp[i-1]+abs(a[i]-a[i-1])),abs(dp[i-2]+abs(a[i]-a[i-2])));
   }cout<<dp[n-1];
 }


Measured memory_bytes: 4424