akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

#define rep(s, e) for(int i(s); i < e; ++i)
#define MAX_NUMBER_OF_A 100

void insertion_sort(int[], int);
void peek(int[], int);

int main() {
    int *A = new int[100];
    rep(0, MAX_NUMBER_OF_A) {
        A[i] = 0;
    }
    
    int n(0);
    cin >> n;
    rep(0, n) {
        cin >> A[i];
    }

    peek(A, n);

    insertion_sort(A, n);
    return 0;
}

void peek(int A[], int n) {
    rep(0, n) {
        if(i != 0) {
            cout << " ";
        }
        cout << A[i];
    }
    cout << "\n";
}

void insertion_sort(int A[], int n) {
    rep(1, n) {
        int v(A[i]);
        int j(i-1);
        while( j >= 0 && A[j] > v) {
            A[j+1] = A[j];
            j -= 1;
        }
        A[j+1] = v;
        peek(A, n);
    }
}


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    string s;
    ll w;
    cin>>s>>w;
    rep(i,s.size()) if(i%w==0) cout<<s[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N; cin >> N;
    vec<lint> A_list(N);
    range(i, 0, N) cin >> A_list.at(i);
    if (A_list.at(0) != 0) {
        cout << -1 << "\n";
        return 0;
    }
    lint ans = 0;
    reversed_range(i, 1, N) {
        lint cur_A = A_list.at(i), forward_A = A_list.at(i - 1);
        if (forward_A < cur_A - 1) {
            cout << -1 << "\n";
            return 0;
        }
        else if (forward_A != cur_A - 1) {
            ans += cur_A;
        } else {
            ans += 1;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 1792
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	string n;
	cin >> n;
	print(n[0] == n[2] ? "Yes" : "No");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 1000010
#define mod 1000000007
#define pi 3.141592653589793238
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define out(s) cout<<s
#define outs(s,a) cout<<s<<a
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
void solve(){
	ld a,b,h,m;
	in2(a,b);
	in2(h,m);
	cout<<fixed<<setprecision(12);
	ld a1=h/(ld)12.0;
	a1*=360;
	ld a2=m/(ld)60.0;
	a2*=360;
	a1+=m/2.0;
	ld mx=max(a1,a2);
	ld mn=min(a1,a2);
	ld ang=mx-mn;
	ang=min(ang,360.0-ang);
	ld sq=a*a+b*b-2*a*b*cos((ang*pi)/180.0);
	cout<<sqrt(sq)<<'\n';

}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	#endif
	clock_t t1=clock();
	gear_change;
	ll test=1;
	// in(test);
	while(test--){
		solve();
	}
	clock_t t2=clock();
	cerr<<"Time elapsed:- "<<(double)(t2-t1)/CLOCKS_PER_SEC<<'\n';
}	

Measured memory_bytes: 4176
n = int(input())

if n == 1:
    print('{0:.10f}'.format(1))
else:
    a = n%2
    if a == 1:
        amari = ((n-1)/2 +1)/n
        print('{0:.10f}'.format(amari))
    else:
        print('{0:.10f}'.format(0.5))


Measured memory_bytes: 2940
#pragma once
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const ll MAX = 210000;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string & S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
const ll ainf = 998244353;

void solv() {

	ll h, w, k;
	cin >> h >> w >> k;
	int t = 0;
	ll dp[101][8];
	memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;

	for (int hi = 1; hi < (h + 1); hi++)
	{
		for (int i = 0; i < 8; i++)
		{
			dp[hi][i] = dp[hi - 1][i];
		}

		for (int i = 1; i < (1 << (w - 1)); i++)
		{
			int bef = 0;
			bool ok = true;
			vector<int> p;
			vector<int> def;
			for(int dig = 0; dig < w ;dig++)
			{
				if (i >> dig & 1) {
					if (bef == 1) {
						ok = false;
						break;
					}
					bef = 1;
					p.push_back(dig);
				}
				else { 
					if (bef == 0)
						def.push_back(dig);
					bef = 0;
				}
			}

			if (!ok) continue;

			for (auto v : p)
			{
				dp[hi][v] += dp[hi - 1][v + 1];
				dp[hi][v] %= INF;
				dp[hi][v + 1] += dp[hi - 1][v];
				dp[hi][v + 1] %= INF;
			}

			for (auto v : def)
			{
				dp[hi][v] += dp[hi - 1][v];
				dp[hi][v] %= INF;
			}
		}
	}
	cout << dp[h][k - 1] << endl;
}

int main() {
	//COMinit();
	solv();

	return 0;
}


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

#define rp(i, k, n) for (int i = k; i < n; i++)
#define ll  long long


int main() {
    ll n, k;
    cin >> n >> k;
    // b > k
    // bをk+1 ~ nで固定（i=1~n-k)
    //それぞれについてありうるaを求める
    ll ans = 0;
    rp(i, 1, n-k+1) {
        // b = k+i
        ans += (n/(k+i)) * i;
        if (k == 0) {
            ans -= 1;
        }
        if (n%(k+i) >= k) {
            ans += (n%(k+i)) - k + 1;
        }
    }
    cout << ans <<endl;
    return 0;
}

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

int main()
{
  string ABCD;
  cin >> ABCD;
  int A, B, C, D;
  A = stoi(ABCD) / 1000;
  B = stoi(ABCD)%1000 / 100;
  C = stoi(ABCD)%100 / 10;
  D = stoi(ABCD)%10;
  char ops[3];
  if (A+B+C+D == 7)
  {
      ops[0] = '+';
      ops[1] = '+';
      ops[2] = '+';
  } else if (A+B+C-D == 7)
  {
      ops[0] = '+';
      ops[1] = '+';
      ops[2] = '-';
  } else if (A+B-C+D == 7)
  {
      ops[0] = '+';
      ops[1] = '-';
      ops[2] = '+';
  } else if (A+B-C-D == 7)
  {
      ops[0] = '+';
      ops[1] = '-';
      ops[2] = '-';
  } else if (A-B+C+D == 7)
  {
      ops[0] = '-';
      ops[1] = '+';
      ops[2] = '+';
  } else if (A-B+C-D == 7)
  {
      ops[0] = '-';
      ops[1] = '+';
      ops[2] = '-';
  } else if (A-B-C+D == 7)
  {
      ops[0] = '-';
      ops[1] = '-';
      ops[2] = '+';
  } else if (A-B-C-D == 7)
  {
      ops[0] = '-';
      ops[1] = '-';
      ops[2] = '-';
  }
  cout << A << ops[0] << B << ops[1] << C << ops[2] << D << "=7" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,dp[61][61],u,v,cnt=0;
long long p,ans=0;
char s[20];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s);
		m=strlen(s);
		p=0;cnt=0;u=v=0;
		int ok=0;
		for(int j=0;j<m;j++)
		{
			if(s[j]=='.')ok=1;
			if(s[j]>='0'&&s[j]<='9')
			{
				if(ok)cnt++;
				p=p*10ll+s[j]-'0';
			}
		}
		while(cnt<9)
		{
			cnt++;
			p=p*10ll;
		}
		//printf("@%lld\n",p);
		while(p%2==0)
		{
			u++;
			p/=2;
		}
		while(p%5==0)
		{
			v++;
			p/=5;
		}
		dp[u][v]++;
		//printf("%d %d\n",u,v);
	}
	for(int i=0;i<=50;i++)
	{
		for(int j=0;j<=50;j++)
		{
			for(int u=0;u<=50;u++)
			{
				for(int v=0;v<=50;v++)
				{
					if(j<i||(j==i&&v<u))continue;
					if(i+j>=18&&u+v>=18)
					{
						if(i==j&&u==v)ans+=1ll*dp[i][u]*(dp[i][u]-1ll)/2ll;
						else ans+=1ll*dp[i][u]*dp[j][v];
					}
					//if(i==j&&u==v)ans-=dp[i][u];
				}
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1712
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int

signed main(){
    string s;
    cin >> s;
    int s_center = ((s.length() + 1)/2)-1;
    string mae = s.substr(0,s_center);
    string usiro = s.substr(s_center + 1);
    if(mae == usiro){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  char c;
  cin >> c;
  cout << "Aa"[!!islower(c)] << '\n';
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()





//library mod int
template <int mod>
struct modint{
    ll x;

    //constructor
    modint(ll x=0): x((x%mod+mod)%mod){}

    //unary operator
    modint operator-() const { return modint(mod-x);}
    modint inv() const { return this->pow(mod-2);}
    
    //compound assignment
    modint& operator+=(const modint& a){
        if((x+=a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator-=(const modint& a){
        if((x-=a.x)<0) x+=mod;
        return *this;
    }
    modint& operator*=(const modint& a){
        (x*=a.x)%=mod;
        return *this;
    }
    modint& operator/=(const modint& a){
        return *this *= a.inv();
    }

    //arithmetic
    // なぜmodintの後ろに＆を書いたり書かなかったりしてるかの理解ができていない
    //おそらく＆をつけるとポインタで参照しているのでもとの値を書き換えることができる
    //＆をつけないとコピーを作ってからそれに対して計算するので、もとの値は変更されない
    modint operator-(const modint& a) const {return modint (*this) -= a ; }
    modint operator+(const modint& a) const {return modint (*this) += a ; }
    modint operator*(const modint& a) const {return modint (*this) *= a ; }
    modint operator/(const modint& a) const {return modint (*this) /= a ; }
    //n should not be smaller than 0.
    modint pow(ll n) const{
        auto x=modint(1);
        auto m=*this;
        while(n>0){
            if(n&1) x*=m;
            n>>=1;
            m*=m;
        }
        return x;
    }

    //compare
    bool operator==(const modint& a) const {return x==a.x ; }
    bool operator!=(const modint& a) const {return x!=a.x ; }

    //I/O
    friend istream& operator>>(istream& is, modint& a ) noexcept {return is >> a.x ; }
    friend ostream& operator<<(ostream& os, const modint& a ) noexcept {return os << a.x ; }
};

//modの調整
constexpr int mod = 1e9 + 7;
using mint = modint<mod>;

//////////////////////////////////////////////////////////////////////
//mint power
mint mpow(mint a, mint b){
    auto x=mint(1), m=a;
    auto n=b.x;
    while(n>0){
        if(n&1) x*=m;
        n>>=1;
        m*=m;
    }
    return x;
}

//combination
vector<mint> mintcombvector;
int startmintcomb(int n){
    mintcombvector.push_back(0);
    mintcombvector.push_back(1);
    rep(i,n) mintcombvector.push_back(mintcombvector[i+1]*(i+2));
    return 0;
}
mint comb(mint a, mint b){
    if(a.x<b.x || a.x<=0 || b.x<0) return mint(0);
    if(b.x==0) return mint(1);
    if(a==b) return mint(1);
    return mintcombvector[a.x]*(mintcombvector[b.x].inv())*(mintcombvector[a.x-b.x].inv());
}
//combinationを使いたいときは　startmintcomb(n=代入したい数の最大値); を始めに打つこと



int main(){
    int n; cin>>n;
    vector<mint> a(n);
    rep(i,n){
        cin>>a[i];
    }
    mint ans=0;
    vector<mint> p(n);
    p[0]=a[0];
    rep(i,n-1){
        p[i+1]=p[i]+a[i+1];
    }
    rep(i,n){
        ans+=a[i]*(p[n-1]-p[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6340
d = int(input())
c = list(map(int,input().split()))
s = []
day = [0 for i in range(26)]
for i in range(d):
    s.append(list(map(int,input().split())))
ans = 0
for i in s:
    max_index = -1
    large = 0
    for j in range(26):
        if large < i[j]:
            large = i[j]
            if not max_index == -1:
                day[max_index] += 1
                ans -= c[max_index]
            max_index = j
        else:
            day[j] += 1
            ans -= c[j]
    day[max_index] = 0
    ans += large
    print(max_index+1)


Measured memory_bytes: 9400
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        int[] i;
        i = new int[3];
        for(int j=0;j<3;j++)i[j] = sc.nextInt();

        Arrays.sort(i);
        System.out.println(i[0]+" "+i[1]+" "+i[2]);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}



Measured memory_bytes: 24340
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
int main(void)
{
    string s;
    cin >> s;
    Yes(s[0]==s[2]);
}

Measured memory_bytes: 256
//g++  5.4.0

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n ;
    cin >> n;
  
    vector <int> dp( 3 , 0 );

    
    while(n--){
 
        vector <int> newdp(3,0);
        vector <int> c(3);
        cin>>c[0]>>c[1]>>c[2];
        
        for(int i = 0 ; i < 3 ; i++)
        {
            for(int j = 0 ; j < 3 ; j++){
                if(i != j){
                    newdp[j] = max(newdp[j] , dp[i] + c[i] ) ; 
                }
            }
        }
        
       dp = newdp;
            
    }
    
 
    
    cout<<max(dp[0] , max ( dp[1] , dp[2] ) ) << endl;
    
    
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

string s, t;
int q;
int cum1[100010], cum2[100010];

signed main() {
	cin >> s >> t;
	for (int i = 0; i < (int)s.size(); i++) {
		cum1[i + 1] = cum1[i];
		if (s[i] == 'A')cum1[i + 1]++;
	}
	for (int i = 0; i < (int)t.size(); i++) {
		cum2[i + 1] = cum2[i];
		if (t[i] == 'A')cum2[i + 1]++;
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int x = cum1[b] - cum1[a - 1];
		int y = cum2[d] - cum2[c - 1];
		int v = b - a + 1;
		int w = d - c + 1;
		if (((w - v) % 3 == 0 && (y - x) % 3 == 0) || (((w - v) % 3 == 1 || (w - v) % 3 == -2) && ((y - x) % 3 == 2 || (y - x) % 3 == -1)) || ((w - v) % 3 == 2 || (w - v) % 3 == -1) && ((y - x) % 3 == 1 || (y - x) % 3 == -2))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=25,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int two[25];
vector<int> tmp;
vector<ii> e[MAXn];
int mypow(int x,int y){
  int ret=1,base=x;
  while( y ){
    if( y&1 ) ret*=base;
    base*=base;
    y>>=1;
  }
  return ret;
}
int main(){
  IOS();
  int l;
  cin>>l;
  two[0]=1;
  REP1(i,23) two[i] = two[i-1]*2;
  int idx=0;
  REP1(i,23){
    if( two[i]>l && two[i-1]<=l ){
      idx=i;
      break;
    }
  }
  debug(idx);
  while( l ){
    tmp.eb(l&1);
    l>>=1;
  }
  reverse(ALL(tmp));
  int cnt=0;
  REP1(i,idx-1){
    e[i].eb(mkp(i+1,0));
    e[i].eb(mkp(i+1,two[i-1]));
    cnt+=2;
  }
  int tp=mypow(2,idx-1);
  REP(i,SZ(tmp)){
    if( i==0 ) continue;
    if( tmp[i] ){
      e[idx-i].eb(mkp(idx,tp));
      cnt++;
      tp+=mypow(2,idx-i-1);
    }
  }
  cout<<idx<<' '<<cnt<<endl;
  REP1(i,idx){
    for( auto it:e[i] ) cout<<i<<' '<<it.X<<' '<<it.Y<<endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int main(){
	int n, k; scanf( "%d%d", &n, &k );
	int ans = (n-1) / (k-1) + (bool)( (n-1) % (k-1) );
	printf( "%d\n", ans );
	return 0;
}

Measured memory_bytes: 128
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod=MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
 
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}


const int N = 200005;
int n, m, arr[N];
vector<ii> updates[N];
ll BIT[2][N], ans[N];


void update(int k, int idx, int val){
    while(idx <= 2*m){
        BIT[k][idx] += val;
        idx += idx & (-idx);
    }
}


ll query(int k, int idx){
    ll ans = 0;
    while(idx){
        ans += BIT[k][idx];
        idx -= idx & (-idx);
    }
    return ans;
}



int main(){
 
    // ios_base::sync_with_stdio(0);
    // cin.tie(0);

    scanf("%d%d", &n, &m);
    ll tot = 0;
    for(int i=1;i<=n;i++){
        scanf("%d", &arr[i]);
        // arr[i]--;
        if(i > 1){
            int prev_ = arr[i-1], next_ = arr[i];
            if(prev_ > next_)   next_ += m;
            updates[prev_].pb(ii(prev_, prev_+1));
            updates[next_].pb(ii(prev_, -prev_-1));
            tot += next_ - prev_;
        }
    }

// cout<<tot<<endl<<endl;

    for(int i=1;i<=2*m;i++){

        if(i <= m)  ans[i] += (query(0, i-1)*i - query(1, i-1));
        else     ans[i-m] += (query(0, i-1)*i - query(1, i-1));

// cout<<"now at "<<i<<" "<<query(0, i-1)<<" "<<query(1, i-1)<<endl;

        for(auto it : updates[i]){
            update(1, it.ff, it.ss);
            if(it.ss > 0)   update(0, it.ff, 1);
            else    update(0, it.ff, -1);
        }
    }

    printf("%lld\n", tot - *max_element(ans+1, ans+m+1));
    return 0;
}








Measured memory_bytes: 13952
even=gets.chomp
odd=gets.chomp
n_even=0
n_odd=0
n_max=[even.length,odd.length].max
res=''

0.upto(n_max*2){|i|
  if i.even? then
    res<<even[n_even,1]
    n_even+=1
  else
    res<<odd[n_odd,1]
    n_odd+=1
  end
}
puts res

Measured memory_bytes: 1788
#include<stdio.h>
#include<string.h>
char S[100],St[100],T[100],c;
int P,Q,R,p,i,j,sp,St2[100],Res;
int not[3]={2,1,0};
int and[3][3]={{},{0,1,1},{0,1,2}};
int or[3][3]={{0,1,2},{1,1,2},{2,2,2}};
void pop(){T[p++]=St[--sp];}
void push(){St[sp++]=S[i];}
void NotPOP(){for(;St[sp-1]=='-';T[p++]=St[--sp]);}
int pop2(){return St2[--sp];}
void push2(int n){St2[sp++]=n;}


int cal()
{
	memset(St2,-1,sizeof(St2));
	for(i=sp=0;c=T[i];i++)
	{
		switch(T[i])
		{
		case '0':
		case '1':
		case '2':push2(T[i]-'0');break;
		case 'P':push2(P);break;
		case 'Q':push2(Q);break;
		case 'R':push2(R);break;
		case '*':push2(and[pop2()][pop2()]);break;
		case '+':push2(or[pop2()][pop2()]);break;
		case '-':push2(not[pop2()]);break;
		}
	}
	return St2[0];
}

int main()
{
	for(;scanf("%s",S),S[0]!='.';)
	{
		memset(St,0,sizeof(St));
		memset(T,0,sizeof(T));
		for(i=p=sp=0;S[i];i++)
		{
			switch(S[i])
			{
			case '0':
			case '1':
			case '2':
			case 'P':
			case 'Q':
			case 'R':T[p++]=S[i];NotPOP();break;
			case '(':push();break;
			case ')':pop();sp--;NotPOP();break;
			case '*':
			case '+':
			case '-':push();break;
			}
		}
		for(P=Res=0;P<3;P++)
			for(Q=0;Q<3;Q++)
				for(R=0;R<3;R++)
					if(cal()==2)
						Res++;
		printf("%d\n",Res);
	}
	return 0;
}

Measured memory_bytes: 536
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static bool Solve(int x, int y, int[] X, int[] Y)
        {
            for (int z = x + 1; z <= y; z++)
            {
                if (X.All(v => v < z) && Y.All(v => v >= z))
                {
                    return false;
                }
            }

            return true;
        }

        static void Main(string[] args)
        {
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = array[0], m = array[1], x = array[2], y = array[3];
            int[] X = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] Y = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Console.WriteLine(Solve(x, y, X, Y) ? "War" : "No War");
        }
    }
}

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

int main()
{
  long long int N,K;
  long long int H[200050];
  cin >> N >> K;
  for (int i=1;i<=N;i++)
  {
    cin >> H[i];
  }
  sort(H+1,H+N+1);
  long long int sum =0;
  for (int i=1;i<=N-K;i++)
    sum+=H[i];
  cout << sum << endl;
   return 0;
}

Measured memory_bytes: 1792
//ihdignite

#include <bits/stdc++.h>

using namespace std;

bool solve(int n, int a, string sa, string sb, char ca, char cb, int s) {
	int l = 0, r = s+1;
	for(int i = n-1; i >= 0; i--) {
		if(sb[i] == ca) {
			r = min(r+1, s+1);
		}
		if(sb[i] == cb) {
			l = max(l-1, 0);
		}
		if(sa[i] == ca) {
			l = l+1;
		}
		if(sa[i] == cb) {
			r = r-1;
		}
		if(l+1 >= r) {
			return 0;
		}
	}
	return a > l && a < r;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	int h, w, n, sr, sc;
	string sa, sb;
	cin >> h >> w >> n >> sr >> sc >> sa >> sb;

	cout << (solve(n, sr, sa, sb, 'U', 'D', h)&&solve(n, sc, sa, sb, 'L', 'R', w)?"YES":"NO") << '\n';

	return 0;
}

Measured memory_bytes: 1560
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 1000000007;
//const ll MOD = 998244353
const int inf = 1 << 30;
const ll linf = 1LL << 60;

ll N, M, V, P;
ll A[100000];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M >> V >> P;
    rep(i,N) cin >> A[i];
    sort(A, A+N, greater<ll>());
    ll st = P-1, en = N;
    while (en-st > 1) {
        ll mid = (st+en) / 2;
        ll x = A[mid]+M;
        ll v = V - (N-mid) - (P-1);
        if (v <= 0) {
            if (x >= A[P-1]) {
                st = mid;
            } else {
                en = mid;
            }
            continue;
        }
        if (x < A[P-1]) {
            en = mid;
            continue;
        }
        //cerr << mid << " " << x << " " << v << endl;
        ll sum = 0, sum2 = 0;
        for (int i = P-1; i < mid; i++) {
            sum += x-A[i];
            if (i <= mid-v) sum2 += x-A[i];
        }
        //cerr << sum << " " << sum2 << endl;
        ll hoge = min(sum/v, sum2);
        if (hoge >= M) st = mid;
        else en = mid;
    }
    cout << st+1 << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>

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

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
const ll INF = LONG_LONG_MAX;
const int MAX_P = 55555+1;



int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    
    string s;
    cin >> s;
    
    int a=-1,b=-1;
    repeat(i, s.length()){
        if(i+1 < s.length() && s[i] == s[i+1]){
            a = i+1;
            b = i+2;
            break;
        }
        if(i+2 < s.length() && s[i] == s[i+2]){
            a = i+1;
            b = i+3;
            break;
        }
    }
    cout << a << " " << b << endl;
    return 0;
}



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

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

int main() {
  while(cin >> W >> H && (W|H)) {
    string op;
    int x, y, d;
    x = y = d = 0;
    while(cin >> op && op != "STOP") {
      int nd, k;
      k = 0;
      if(op == "FORWARD") {
        nd = d;
        cin >> k;
      } else if(op == "BACKWARD") {
        nd = (d+2)%4;
        cin >> k;
      } else if(op == "RIGHT") {
        d = (d+1)%4;
      } else if(op == "LEFT") {
        d = (d+3)%4;
      }
      while(k--) {
        int nx = x + dx[nd];
        int ny = y + dy[nd];
        if(nx < 0 || nx >= W) break;
        if(ny < 0 || ny >= H) break;
        x = nx;
        y = ny;
      }
    }
    cout << x+1 << " " << y+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
int n,m,p,k,q,dp[64][2][3];
long long x[10010],y[10010];//dep,lim,mod
bool light(long long xx,long long yy){
	bool flag=0;
	for(int i=1;i<=n;i++){
		if(yy-y[i]<0||yy-y[i]>x[i]-xx) continue;
		flag^=(((x[i]-xx)|(yy-y[i]))==x[i]-xx);
	}
	return flag;
}
bool lres[3],rres[3],mres[3],res[3];
void calc(long long c,long long xx,long long yy,long long r){
	long long tmp=xx-c;r-=yy;
	if(r<0) return res[0]=res[1]=res[2]=0,void();
	memset(dp,0,sizeof(dp));
	dp[63][1][0]=1;
	for(int i=63;i>=1;i--){
		if(!((tmp>>(i-1))&1)){
			for(int j=0;j<3;j++){
				if(dp[i][0][j]) dp[i-1][0][(j*2)%3]^=1;
				if(dp[i][1][j]){
					if((r>>(i-1))&1) dp[i-1][0][(j*2)%3]^=1;
					else dp[i-1][1][(j*2)%3]^=1;
				}
			}
		}
		else{
			for(int j=0;j<3;j++){
				if(dp[i][0][j]) dp[i-1][0][(j*2)%3]^=1,dp[i-1][0][(j*2+1)%3]^=1;
				if(dp[i][1][j]){
					if((r>>(i-1))&1) dp[i-1][0][(j*2)%3]^=1,dp[i-1][1][(j*2+1)%3]^=1;
					else dp[i-1][1][(j*2)%3]^=1;
				}
			}
		}
	}
	yy=(yy%3+3)%3;
	res[yy]=dp[0][0][0]^dp[0][1][0];
	res[(yy+1)%3]=dp[0][0][1]^dp[0][1][1];
	res[(yy+2)%3]=dp[0][0][2]^dp[0][1][2];
}
long long work(long long c){
	long long l=-1e18,r=1e18,mid;
	for(int i=1;i<=n;i++){
		calc(c,x[i],y[i],r);
		rres[0]^=res[0],rres[1]^=res[1],rres[2]^=res[2];
	}
	int pos=0;
	for(int i=0;i<3;i++) if(rres[i]){
		pos=i;
		break;
	}
	while(l<r){
		mid=(l+r)>>1;memset(mres,0,sizeof(mres));
		for(int i=1;i<=n;i++){
			calc(c,x[i],y[i],mid);
			mres[0]^=res[0],mres[1]^=res[1],mres[2]^=res[2];
		}
		if(mres[pos]!=lres[pos]){
			r=mid;
			for(int i=0;i<3;i++) rres[i]=mres[i];
		}
		else{
			l=mid+1;
			for(int i=0;i<3;i++) lres[i]=mres[i];
		}
	}
	return l;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld%lld",&x[i],&y[i]);
	long long k=work(-1e17),lk=k,rk=k;
	for(int i=62;i>=0;i--) if(light(-1e17,lk-(1ll<<i))) lk-=1ll<<i;
	for(int i=62;i>=0;i--) if(light(-1e17,rk+(1ll<<i))) rk+=1ll<<i;
	printf("%lld %lld\n",(long long)(-1e17)+rk-lk,lk);
}


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

const int INF = 1e9;
int dp[44][444][444];

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  vector<int> a(N), b(N), c(N);
  rep(i, 0, N) cin >> a[i] >> b[i] >> c[i];
  rep(i, 0, 44) rep(j, 0, 444) rep(k, 0, 444) dp[i][j][k] = INF;
  dp[0][0][0] = 0;
  rep(i, 0, N) rep(j, 0, 404) rep(k, 0, 404) {
    if(dp[i][j][k] == INF) continue;
    chmin(dp[i+1][j][k], dp[i][j][k]);
    chmin(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
  }
  int ans = INF;
  rep(i, 1, 404) rep(j, 1, 404) {
    if(i * B == j * A) chmin(ans, dp[N][i][j]);
  }
  if(ans == INF) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 34176
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
    int N;
    cin>>N;
    string FW,W;
    map<string,int> check;
    cin>>FW;
    bool judge=true;
    int len=FW.size()-1;
    
    char lw=FW[len];
    check[FW]++;
    rep(i,N-1){
        cin>>W;
        len=W.size()-1;
        if(lw!=W[0]){
            judge=false;
            break;
        }
        lw=W[len];
        check[W]++;
        if(check[W]==2){
            judge=false;
            break;
        }
    }
    if(judge==true){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
   
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
const int inf = 999999999999999999;
struct P {
	int pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	int to, cost;
};
typedef long long ll;
typedef long double ld;
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------
int n, s;
int solve(int i, int bf,int res) {
	if (i == n&&res==0) return 1;
	int ans = 0;
	for (int j = 0; j < bf; j++) {
		ans += solve(i + 1, j, res - j);
	}
	return ans;
}
signed main() {
	while (cin >> n >> s&&n + s != 0) {
		cout << solve(0, 10, s) << endl;
	}
}

Measured memory_bytes: 3000
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int cnt[105]={0};
int main(){
	int i,j,n,k,d,num;
	scanf("%d%d",&n,&k);
	for(i=0;i<k;i++){
		scanf("%d",&d);
		for(j=0;j<d;j++){
			scanf("%d",&num);
			cnt[num]++;
		}
	}
	int ans=0;
	for(i=1;i<=n;i++)
		if(!cnt[i])
			ans++;
	printf("%d\n",ans);
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long X,A,B;
	cin>>X;
	for(A=-150;A<=150;A++){
		for(B=-150;B<=150;B++){
			if(pow(A,5)-pow(B,5)==X){
				cout<<A<<" "<<B<<endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 3976
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    vector<double> t(N + 1);
    vector<double> v(N + 1);
    rep(i, 0, N) cin >> t[i];
    rep(i, 0, N) cin >> v[i];
    t[N] = v[N] = 0.0;
    rrep(i, N - 1, 0)
    {
        chmin(v[i], v[i + 1] + t[i]);
    }

    double ans = 0.0;
    double vel = 0.0;
    rep(i, 0, N)
    {
        const double x = (t[i] + (v[i + 1] - vel)) * 0.5;
//        assert(x >= 0.0);

        if (x <= t[i])
        {
            if ((vel + x) <= v[i])
            {
                ans += ((vel + (vel + x)) * x * 0.5) + (((vel + x) + v[i + 1]) * (t[i] - x) * 0.5);
                vel = v[i + 1];
            }
            else
            {
                if (v[i] > v[i + 1])
                {
                    const double t1 = v[i] - vel;
                    const double t2 = t[i] - (v[i] - v[i + 1]);
//                    assert(t1 >= 0.0 && t1 <= t[i]);
//                    assert(t2 >= 0.0 && t2 <= t[i]);
//                    assert(t2 >= t1);
                    ans += ((vel + v[i]) * t1 * 0.5) + (v[i] * (t2 - t1)) + ((v[i] + v[i + 1]) * (t[i] - t2) * 0.5);
                    vel = v[i + 1];
                }
                else
                {
                    const double t1 = v[i] - vel;
//                    assert(t1 >= 0.0 && t1 <= t[i]);
                    ans += ((vel + v[i]) * t1 * 0.5) + (v[i] * (t[i] - t1));
                    vel = v[i];
                }
            }
        }
        else
        {
            if ((vel + t[i]) <= v[i])
            {
                ans += (vel + (vel + t[i])) * t[i] * 0.5;
                vel = vel + t[i];
            }
            else
            {
                const double t1 = v[i] - vel;
//                assert(t1 >= 0.0 && t1 <= t[i]);
                ans += ((vel + v[i]) * t1 * 0.5) + (v[i] * (t[i] - t1));
                vel = v[i];
            }
        }
    }
    printf("%.15lf\n", ans);
}


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

signed
main(){
		int n,m,t,p;
		while(cin >> n >> m >> t >> p && !(n==0 && m==0 && t==0 && p==0))
		{
				vector<vector<int> > z(m, vector<int>(n,1));

				//w,hは更新されていく幅と高さ
				int w = n, h = m;

				for(int i=0;i<t;i++)
				{
						int d,c;
						cin >> d >> c;

						if(d==1)
						{
								vector<vector<int> > tmp(h, vector<int>(w, 0)), tmp2(h, vector<int>(w, 0));
								//tmpの初期化
								for(int a=0;a<h;a++)
								{
										for(int b=0;b<w-c;b++)
										{
											tmp[a][b] = z[a][b+c];
										}
								}


								for(int a=0;a<h;a++)
								{
										for(int b=0;b<c;b++)
										{
											tmp2[a][b] = z[a][c-1-b];
										}
								}

								//最後にtmpの状態をzに適用
								for(int a=0;a<h;a++)
                                {
                                        for(int b=0;b<w;b++)
                                        {
                                        		z[a][b] = 0;
		 									z[a][b] = tmp[a][b] + tmp2[a][b];
										}
                                }

								//wの値を更新
								w = max(w-c,c);

						}
						else if(d==2)
						{
								vector<vector<int> > tmp(h, vector<int>(w, 0)),tmp2(h, vector<int>(w, 0));
								//tmpの初期化
								for(int a=0;a<h-c;a++)
								{
										for(int b=0;b<w;b++)
										{
											tmp[a][b] = z[a+c][b];
										}
								}

								for(int a=0;a<c;a++)
								{
										for(int b=0;b<w;b++)
										{
											tmp2[a][b] = z[c-1-a][b];
										}
								}

								//最後にtmpの状態をzに適用
								for(int a=0;a<h;a++)
                                {
                                        for(int b=0;b<w;b++)
                                        {
                                        		//初期化
                                        		z[a][b] = 0;
		 									z[a][b] = tmp[a][b] + tmp2[a][b];
										}
                                }

								//hの値を更新
								h = max(h-c,c);

						}

						//debug
						/*
						for(int a=0;a<m;a++)
						{
							for(int b=0;b<n;b++)
							{
								cout << z[a][b] << " ";
							}
							cout << endl;
						}
						*/

				}


				int ans = 0;

				for(int i=0;i<p;i++)
				{
						int x,y;
						cin >> x >> y;
						cout << z[y][x] << endl;

				}
		}
}


Measured memory_bytes: 3192
using System;

namespace diverta_2019_Programming_Contest_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int k = int.Parse(input[0]);
            int n = int.Parse(input[1]);

            if (n == 1)
                Console.WriteLine(0);
            else
            {
                int max = k - n + 1;
                Console.WriteLine(max - 1);
            }
        }
    }
}

Measured memory_bytes: 13140
from collections import defaultdict
N, K = map(int, input().split())
nums = [int(i) for i in input().split()]

num_freq = defaultdict(int)
for num in nums:
    num_freq[num] += 1

_sorted_nums = [[i] * j for i,
                j in sorted(num_freq.items(), key=lambda x:x[1])]
sorted_nums = []
for i in _sorted_nums:
    sorted_nums += i

borders = []
for i in range(1, N):
    if sorted_nums[i-1] != sorted_nums[i]:
        borders.append(i)

if len(num_freq) <= K:
    print(0)
else:
    print(borders[-K])


Measured memory_bytes: 59256
#include <algorithm>
#include <cmath>
#include <climits>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

int main() {
  std::string s; std::cin >> s;
  if (s.length() == 2) std::cout << s << std::endl;
  else {
    for (int i = 2; i >= 0; --i) std::cout << s[i];
    std::cout << std::endl;
  }
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n;cin>>n;

  V<ll> ans(10010,0);

  rep(i,1,101){
    rep(j,1,101){
      rep(k,1,101){
        if(i*i+j*j+k*k + i*j + j*k + k*i <10001){
          ans[i*i+j*j+k*k + i*j + j*k + k*i]++;
        }
      }
    }
  }

  rep(i,1,n+1){
    cout<<ans[i]<<ENDL;
  }
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3684
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
using namespace std;


int main()
{
	int i,N;
	cin >> N >> i;
	cout << N - i + 1<<endl;
	return 0;
}




Measured memory_bytes: 256