akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Contest.A
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			var cin = new Scanner();

			string s = cin.Next();
			bool ok = true;
			if (s.Length % 2 == 1) ok = false;
            else
            {
				for (int i = 0; i < s.Length; i += 2)
                {
					if (s[i] != 'h' || s[i + 1] != 'i') ok = false;
                }
            }
            if (ok) Console.WriteLine("Yes");
            else
            {
                Console.WriteLine("No");
            }

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 13140
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    a, b, c, x, y = map(int, input().split())
    ans = 10**10
    for k in range(2*max(x, y)+1):
        i = max(x - k//2, 0)
        j = max(y - k//2, 0)
        ans = min(ans, a*i+b*j+c*k)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 69836
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
s = list(S())
ans = 0
one_cnt = 0
z_cnt = 0
dp = []
flg = 0
for i in range(n):
    if s[i] == "1":
        one_cnt += 1
        z_cnt = 0
        if flg:
            if dp:
                ans += max(dp)
                dp = []
            flg = 0
        if i == n - 1 or s[i + 1] == "0":
            # 手付かず、左端だけ消した、右端だけ残す、全て消した。
            if dp:
                if one_cnt >= 2:
                    ndp = [max(dp), max(dp[0] + pre, dp[1] + pre - 1, dp[2] + 1),
                           max(dp[0], dp[1], dp[2]) + one_cnt - 1,
                           max(dp[0], dp[1], dp[2]) + one_cnt]
                else:
                    ndp = [-INF, -INF, max(dp),
                           max(dp[0] + pre, dp[1] + pre - 1, dp[2] + 1)]
                dp = ndp
            else:
                dp = [0, -INF, -INF, -INF]
            pre = one_cnt
    else:
        z_cnt += 1
        one_cnt = 0
        if z_cnt >= 2:
            flg = 1

if dp:
    ans += max(dp)

print(ans)

Measured memory_bytes: 107864
S = STDIN.gets.chomp.split('')

index = 0
cnt = 0
bcnt = 0
bindex = 0
while true
  break if index == S.length

  si = S[index]

  # puts "i:#{index},#{si} cnt: #{cnt} bi: #{bindex} bc: #{bcnt}"
  # puts S.join(',')

  if si == 'B'
    bindex = index if bcnt == 0
    bcnt += 1
  elsif bcnt > 0 # W
    S[index] = 'B'
    S[bindex] = 'W'
    cnt += bcnt
    bindex = bindex+1
    # bcnt -= 1
  end
  index += 1
end

puts cnt


Measured memory_bytes: 25084
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reprr(i, m, n) for (ll i = m; i < n; i++)
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll N; cin >> N;
    vll a(N); rep(i, N) cin >> a[i], a[i]--;

    ll num = 0;
    ll cnt = 0;
    rep(i, N) {
        if (a[i] == num) num++;
        else cnt++;
    }
    cout << (cnt != N ? cnt : -1) << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    ll n;
    cin >> n;

    string res = "";
    while (n) {
        n--;
        res += (char)('a' + n%26);
        n /= 26;
    }

    reverse(ALL(res));
    cout << res << endl;
    

    return 0;
}

Measured memory_bytes: 3604
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  string a, b;

  cin >> a >> b;

  string ans;
  if (a > b)
    ans = '>';
  else if (a == b)
    ans = '=';
  else
    ans = '<';

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
D,X = map(int,input().split())
cnt = 0
A = []
Day = []
for i in range(0,N):
    x = int(input())
    A.append(x)

for i in range(0,N):
   Day = []
   for j in range(0,D):
       d = j*A[i] + 1
       if D >= d:
        Day.append(d)
   cnt += len(Day)


print(cnt+X)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define rg register
using namespace std;
const int MAXN=20010;
struct gao{   int u,v,Next;   }Edge[MAXN<<1];
int n,Lo,Le,Seq[10000010],Odd[MAXN],Even[MAXN];
int Ans,Es,Ps,First[MAXN],Match[MAXN],Vis[MAXN];
inline int Read()
{   rg int a=0,c=1;   rg char b=getchar();
	while(b!='-'&&(b<'0'||b>'9'))b=getchar();
	if(b=='-')c=-1,b=getchar();
	while(b>='0'&&b<='9')a=a*10+b-48,b=getchar();
	return a*c;
}
inline void Link(rg int u,rg int v)
{   Edge[++Es]=(gao){u,v,First[u]},First[u]=Es;   }
inline int Abs(rg int A){   return A<0?-A:A;   }
inline bool Judge(rg int Num)
{   if(Num%2==0||Num<=2) return 0;
	for(rg int i=3,End=sqrt(Num);i<=End;i+=2)
		if(Num%i==0) return 0;
	return 1;
}
inline bool Couple(rg int Now,rg int Sign)
{   for(rg int i=First[Now];i!=-1;i=Edge[i].Next)
	{   rg int v=Edge[i].v;   if(Vis[v]==Sign) continue ;
		Vis[v]=Sign;
		if(!Match[v]||Couple(Match[v],Sign)) return Match[v]=Now,Match[Now]=v,1;
	}
	return 0;
}
int main()
{   scanf("%d",&n);
	memset(First,-1,sizeof(First));
	for(rg int i=1;i<=n;i++) Seq[Read()]=1;
	for(rg int i=1e7+1;i>=1;i--) Seq[i]=Seq[i]!=Seq[i-1];
	for(rg int i=1;i<=1e7+1;i++) if(Seq[i]) i%2?Odd[++Lo]=i:Even[++Le]=i;
	if((Lo+Le)%2) return puts("0");
	for(rg int i=1;i<=Lo;i++)
		for(rg int j=1;j<=Le;j++) if(Judge(Abs(Odd[i]-Even[j]))) Link(i,Lo+j),Link(Lo+j,i);
	for(rg int i=1;i<=Lo;i++) if(!Match[i]) Ps+=Couple(i,i);
	Ans=Ps+(Lo-Ps)/2*2+(Le-Ps)/2*2+((Lo-Ps)%2)*3,printf("%d\n",Ans);
}


Measured memory_bytes: 39552
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T>
using MaxHeap = priority_queue<T, vector<T>, less<T>>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline void input(vector<T> &vec) {
    for (auto &e: vec) {
        cin >> e;
    }
}

template <class T>
inline void input(vector<vector<T>> &mat) {
    for (auto &vec: mat) {
        input(vec);
    }
}

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head&& head, Tail&&... tail) {
    static constexpr const char *delim[] = {"", " "};
    cout << head << delim[sizeof...(tail)];
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &strm, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        strm << e << delim[&e == &vec.back()];
    }
    return strm;
}

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class T>
inline bool chmax(T &a, const T &b) noexcept {
    return b > a && (a = b, true);
}

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

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

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

    cout << fixed << setprecision(10);

    var(double, x1, y1, x2, y2);

    print(hypot(diff(x1, x2), diff(y1, y2)));

    return 0;
}



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

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr;
typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; }};
Scanner sc(cin);

const int N = 200005;
int n, m;
vector < int > e[N];

void init() {
    scanf(II,&n,&m);
    rep (i,m) {
        int u, v; scanf(II,&u,&v);
        e[u].push_back(v);
        e[v].push_back(u);
    } 
}

int from[N];

void solve() {
    memset(from,-1,sizeof(from));
    queue < int > que;
    que.push(1);
    from[1] = 0;
    while (!que.empty()) {
        int u = que.front();
        que.pop();
        repe (i, e[u]) {
            int v = e[u][i];
            if (from[v] != -1) continue;
            from[v] = u;
            que.push(v);
        }    
    }
    repi (i,2,n) if (from[i] == -1) { puts("No"); return; }
    puts("Yes");
    repi (i,2,n) printf(IN,from[i]);
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
    init();
    solve();
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll X, Y, Z, K;
  IN(X,Y,Z,K);
  vll A(X), B(Y), C(Z);
  REP(i,X) IN(A[i]);
  REP(i,Y) IN(B[i]);
  REP(i,Z) IN(C[i]);

  if(X<Z){
    swap(A,C);
    swap(X,Z);
  }
  if(Y<Z){
    swap(B,C);
    swap(Y,Z);
  }

  vll AB(X*Y);
  REP(i,X){
    REP(j,Y){
      AB[i*Y+j] = A[i]+B[j];
    }
  }

  sort(ALL(AB));
  reverse(ALL(AB));
  AB.resize(K);

  vll ABC(K*Z);
  REP(i,K){
    REP(j,Z){
      ABC[i*Z+j] = AB[i]+C[j];
    }
  }

  sort(ALL(ABC));
  reverse(ALL(ABC));

  REP(i,K){
    printf("%lld\n", ABC[i]);
  }
  


  return 0;
}


Measured memory_bytes: 31616
#include <stdio.h>
#include <string.h>

int main(void)
{
	int i;
	char str[101];
	int flag;
	int cnt = 0;
	int len;
	
	while (scanf("%s", str) != EOF){
		flag = 1;
		len = strlen(str);
		for (i = 0; i < len / 2; i++){
			if(str[i] != str[len -1 -i]){
				flag = 0;
				break;
			}
		}
		if(flag){
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return (0);
}

Measured memory_bytes: 540
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define RREP(i,n) for(int i=int(n)-1; i>=0; i--)
#define FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;

int main() {
    int x;
    cin >> x;
    Yes(x>=30);
}


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

#define ld long double
#define ll long long
#define ull unsigned long long

#define f first
#define s second

#define endl '\n'
#define pii pair <ll, ll>

#define ios ios_base::sync_with_stdio(0), cin.tie()
#define pb push_back
#define mp make_pair

#define pi 3.14159265358979323846264
#define y1 abacaba
 
#define fn "abc"

using namespace std;

const int MXN = 1e6 + 30;
const int MAXN = 1e3 + 2;
const ll INF = 1e9 + 7;
const ll BINF = 1e16;
const int mod = 1e9 + 7;
const ld EPS = 1e-15;   
const ll dx[] = {0, 0, 1, -1};
const ll dy[] = {1, -1, 0, 0};

int n;
int p[MXN];

int a, b;

int cnt, res, ans;

int main(){

    #ifdef DIAS
        freopen("input.txt", "r", stdin);
    #elif NAME 
    	freopen(fn".in", "r", stdin);
    	freopen(fn".out", "w", stdout);
    #endif       
    cin >> n;
    cin >> a >> b;
    for(int i = 1; i <= n; i++){
    	cin >> p[i];
    }
    for(int i = 1; i <= n; i++){
    	if(p[i] <= a) cnt ++;	
    }
    for(int i = 1; i <= n; i++){
    	if(p[i] <= b && p[i] > a) res ++;	
    }
    for(int i = 1; i <= n; i++){
    	if(p[i] > b) ans ++;	
    }
    cout << min(cnt, min(ans, res));
    return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if k >= max(b-a, c-a, d-a, e-a, c-b, d-b, e-b, d-c, e-c, e-d):
  print('Yay!')
else:
  print(':(')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
using namespace std;

int main() {

    string s;
    cin >> s;

    int cnt = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'o') {
            cnt ++;
        }
    }

    if ((15-s.size()+ cnt) >= 8) {
        cout << "YES" << endl;
    }else
    {
        cout << "NO" << endl;
    }
    
    
    

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

typedef long ll;

ll memo[10][1001][101];
ll dfs(int n, int s, int x)
{
	ll pat = 0;
	int i;
	if (n == 0) return s == 0;
	if (s < 0) return 0;
	if (x > 100) return 0;
	if (memo[n][s][x] != -1) return memo[n][s][x];
	
	for (i = x; i <= 100; i++){
		pat += dfs(n - 1, s - i, i + 1);
	}
	return memo[n][s][x] = pat;
}

int main(void)
{
	int N, S;
	while (scanf("%d %d", &N, &S), N || S){
		memset(memo, -1, sizeof(memo));
		printf("%ld\n", dfs(N, S, 0));
	}
	return 0;
}

Measured memory_bytes: 8932
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		int count=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			count=count+a;
			list.add(a);
		}
		int max = Collections.max(list);
		count=count-max;
		if(count>max) {
			System.out.println("Yes");
		}
		else
			System.out.println("No");
	}
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int max=a+b;
  if(max<(a-b)){
    max = a-b;
  }
  if(max<(a*b)){
    max = a*b;
  }
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 256
a = sorted(list(map(int, input().split())))
ans = 0
while a[2] - a[0] > 0 and a[2] - a[1] > 0:
    a[0] += 1
    a[1] += 1
    ans += 1
if (a[2] - min(a[0],a[1])) & 1:
    ans += -((-(a[2] - min(a[0], a[1])) // 2)) + 1
else:
    ans += (a[2] - min(a[0], a[1])) // 2
print(ans)

Measured memory_bytes: 3064
import sys
for s in sys.stdin:
    c="d"
    for i in range(3):
        a=s[i]
        if a!="s"and a==s[i+3]==s[i+6]:
            c=a
            break
        j=i*3
        a=s[j]
        if a!="s"and a==s[j+1]==s[j+2]:
            c=a
            break
    else:
        a=s[4]
        if a!="s"and (s[0]==a==s[8] or s[2]==a==s[6]):c=a
    print c

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void store(unordered_map<int, int> &m, int n) {
    if (m.count(n)) {
        m[n]++;
    } else {
        m[n] = 1;
    }
}

void solve() {
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];

    unordered_map<int, int> m;
    REP(i, N) {
        store(m, a[i] - 1);
        store(m, a[i]);
        store(m, a[i] + 1);
    }

    int ans = 0;
    for (auto item : m) {
        ans = max(ans, item.second);
    }
    print(ans);
}

signed main() {
    solve();
}


Measured memory_bytes: 4644
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define lSon (node << 1)
#define rSon (lSon | 1)

#define maxN 5011
#define maxM 211
#define inf 1LL << 60

struct aint {
    int n;
    vector<ll> data;
    vector<ll> add;

    void init(int _n) {
        n = _n;
        data = add = vector<ll>(n * 4 + 11, 0);
    }

    void update(int node, int l, int r, int qL, int qR, ll v) {
        if (qL <= l && r <= qR) {
            add[node] += v;
            data[node] += v;
            return;
        }

        int mid = (l + r) >> 1;
        if (qL <= mid)
            update(lSon, l, mid, qL, qR, v);
        if (qR > mid)
            update(rSon, mid + 1, r, qL, qR, v);

        data[node] = max(data[lSon], data[rSon]) + add[node];
    }

    ll query(int node, int l, int r, int qL, int qR) {
        if (qL <= l && r <= qR)
            return data[node];

        int mid = (l + r) >> 1;
        ll ans = -inf;
        if (qL <= mid)
            ans = max(ans, query(lSon, l, mid, qL, qR));
        if (qR > mid)
            ans = max(ans, query(rSon, mid + 1, r, qL, qR));

        return ans;
    }


};

int n, m, i, j;
ll dist[maxN];
ll pay[maxN][maxM];

vector< pair<ll, int> > S[maxN];
aint work;
ll ans;

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d%d", &n, &m);
    for (i = 2; i <= n; i++) scanf("%lld", &dist[i]), dist[i] += dist[i - 1];
    for (i = 1; i <= n; i++)
        for (j = 1; j <= m; j++)
            scanf("%lld", &pay[i][j]);

    for (i = 1; i <= m; i++) S[i] = {{inf, n + 1}};

    work.init(n);
    for (i = 2; i <= n; i++)
        work.update(1, 1, n, i, i, -dist[i]);

    for (i = n; i > 0; i--) {
        for (j = 1; j <= m; j++)
            work.update(1, 1, n, i, i, pay[i][j]);

        for (j = 1; j <= m; j++) {
            while (S[j].back().first < pay[i][j]) {
                int l = S[j].back().second;
                int r = S[j][ S[j].size() - 2 ].second - 1;
                work.update(1, 1, n, l, r, pay[i][j] - S[j].back().first);
                S[j].pop_back();
            }
            S[j].pb(mp(pay[i][j], i));
        }

        ans = max(ans, work.query(1, 1, n, i, n) + dist[i]);
    }

    printf("%lld", ans);


    return 0;
}


Measured memory_bytes: 9088
#include <stdio.h>

int main()
{
  int i, j;
  int n;
  int sum;
  int count;
  
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    count = 0;
    for (i = 0; i < n/2; i++) {
      sum = 0;
      for (j = i + 1; j < n; j++) {
        sum += j;
        if (sum > n) break;
        if (sum == n) {
          count++;
          break;
        }
      }
    }
    printf("%d\n", count);
  }
  return 0;
}

    
  



Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll total, legs;
    cin >> total;
    cin >> legs;
    
    ll min = total * 2;
    ll max = total * 4;

    if (legs >= min && legs <= max && (legs % 2 == 0))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3620
import itertools
H, W, K = [int(x) for x in input().split()]
c = []
for _ in range(H):
  c.append(input())

ans = 0
for h_selected in itertools.product(*[(0, 1)]*H):
  for w_selected in itertools.product(*[(0, 1)]*W):
    count = 0
    for h in range(H):
      if h_selected[h]:
        continue
      for w in range(W):
        if w_selected[w]:
          continue
        if c[h][w] == '#':
          count+=1
    #print(h_selected, w_selected, count)
    if count == K:
      ans += 1
print(ans)

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

using namespace std;
typedef long long ll;
typedef long double ld;
using graph = vector<vector<int>>;

#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 FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define all(x) (x).begin(),(x).end()
#define size(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000

#define pb push_back
#define mp make_pair
#define f first
#define s second

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 (b<a) { a=b; return true; } return false; }

#define FIND(a,b) find(all(a),b)!=a.end()

vector<bool> seen;
bool dfs(const graph &g, int v, int y) {
    seen[v] = true;
    if(find(all(g[v]),y)!=g[v].end())return true;
    for (auto next_v : g[v]) {
        if (seen[next_v]) continue;
        return dfs(g, next_v,y);
    }
    return false;
}

int main(){
	string s,t;cin>>s>>t;
	cout<<t+s<<endl;
}





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

struct line{
    int h, p, q;
    line(){}
    ~line(){}
    bool operator<(const line& b) const{
        return h < b.h;
    }
};

int main(){
    int n, m, a;
    while(true){
        scanf("%d%d%d", &n, &m, &a);
        if((n|m|a) == 0) break;
        vector<int> amd(n);
        for(int i = 0; i < n; i++){
            amd[i] = i + 1;
        }
        vector<line> ll(m);
        for(int i = 0; i < m; i++){
            scanf("%d%d%d", &ll[i].h, &ll[i].p, &ll[i].q);
        }
        sort(ll.begin(), ll.end());
        for(int i = 0; i < m; i++){
            swap(amd[--ll[i].p], amd[--ll[i].q]);
        }
        printf("%d\n", amd[--a]);
    }
    
    return 0;
}

Measured memory_bytes: 1204
# coding: utf-8
n = int(input())
h = list(map(int, input().split()))
def lr(h):
  start = -1
  last = n
  for i, num in enumerate(h):
    if num != 0:
      start = i
      break
  for i, num in enumerate(h):
    if num == 0 and i > start:
      last = i
      break
  return start, last

def water(l, r, h):
  for i in range(l, r):
    h[i] -= 1
  return h

times = 0

while True:
  l, r = lr(h)
  if l == -1:
    break
  h = water(l, r, h)
  times += 1

print(times)

Measured memory_bytes: 3064
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<iomanip>
#include<complex>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef stack<int> SI;
typedef queue<int> QI;
typedef list<int> LI;
typedef pair<int,int> PII;
typedef long long LL;

#define d(x)  cout<<#x<<" = "<<(x)<<endl;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EP empty()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).rbegin()) i=(c).rbegin(); i!=(c).rend(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c,n) sort(c,c+n)
#define VSORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define DFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define DREP(i,n) DFOR(i,n,0)
#define INF 1000000000
#define PI  acos(-1.0)
//cin.tie(0);ios::sync_with_stdio(false);
////////////////////////////////////////////////
int main()
{
	char c=0;
	int n=0,f=0;
	cin>>n;
	REP(i,n)
	{
		cin>>c;
		if(c=='Y')f=1;
	}
	if(f==1)cout<<"Four"<<endl;
	else cout<<"Three"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <limits>
using namespace std;

int arr[300005];
long long int prefNSum[300005];		//arr[1] ~ arr[i] 중 가장 큰 N개의 합
long long int suffNSum[300005];		//arr[i] ~ arr[N] 중 가장 작은 N개의 합
priority_queue<int, vector<int>, greater<int> > minHeap;
priority_queue<int> maxHeap;
int main(){
	int N, tmp;
	scanf("%d", &N);
	for(int i=1; i<=3*N; ++i)
		scanf("%d", arr+i);
	for(int i=1; i<=N; ++i){
		minHeap.push(arr[i]);	
		prefNSum[N] += arr[i];
	}
	for(int i=N+1; i<=2*N; ++i){
		tmp = minHeap.top();
		if(arr[i] >= tmp){
			prefNSum[i] = prefNSum[i-1] - tmp + arr[i];
			minHeap.pop();
			minHeap.push(arr[i]);
		}else{
			prefNSum[i] = prefNSum[i-1];
		}
	}

	for(int i=3*N; i>2*N; --i){
		maxHeap.push(arr[i]);
		suffNSum[2*N+1] += arr[i];
	}
	for(int i=2*N; i>N; --i){
		tmp = maxHeap.top();
		if(arr[i] <= tmp){
			suffNSum[i] = suffNSum[i+1] - tmp + arr[i];
			maxHeap.pop();
			maxHeap.push(arr[i]);
		}else{
			suffNSum[i] = suffNSum[i+1];
		}
	}
	long long int ans = numeric_limits<long long int>::min();
	for(int i=N; i<=2*N; ++i){
		ans = max(ans, prefNSum[i] - suffNSum[i+1]);
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 5112
#include <iostream>
#include <map>
#include <string>

using namespace std;

struct node{
    int num, pos;
};

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

    int l = 0, r = S.size()-1;
    int cnt = 0;

    while(l < r){
        if(S[l] == S[r]){
            l++; r--;
        }else{
            if(S[l] != 'x' && S[r] != 'x'){
                cout << -1 << endl;
                return 0;
            }
            if(S[l] == 'x'){
                cnt++;
                l++;
            }else if(S[r] == 'x'){
                cnt++;
                r--;
            }
        }
    }

    cout << cnt << endl;

    return 0;

}

Measured memory_bytes: 512
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();
        if (u.equals(s)) a--;
        else b--;
        System.out.println(a + " " + b);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll x,k,d;
    cin >> x >> k >> d;
    x = abs(x);
    if(x/d <= k){
        if((k-x/d)%2==0) cout << x%d << endl;
        else cout << min(x%d+d, abs(x%d-d)) << endl;
    }else {
        cout << d*(x/d-k)+x%d << endl;
    }
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String args[]){

		Scanner cin = new Scanner(System.in);

		int A = cin.nextInt();
		int B = cin.nextInt();

		if(A+B>=10){
			System.out.println("error");
		}else{
			System.out.println(A+B);
		}
	}
}


Measured memory_bytes: 21716
<?php
    // 末尾に改行をつけて出力
    function output($str) {
        echo $str . PHP_EOL;
    }

    list($n, $a, $b) = array_map('intval', explode(' ', trim(fgets(STDIN))));

    $sum = $a + $b;
    $blue = (int)(floor($n / $sum)) * $a;
    $wk = $n % $sum;
    if ($wk > $a) {
        $blue += $a;
    } else {
        $blue += $wk;
    }
    output($blue);


Measured memory_bytes: 4728
import java.util.Scanner;


public class Main {


//	final int MOD = 1000000007;

//	public static int min = 3000000;

	public static void main(String[] args) {

		int ans = 0;
		Scanner sc = new Scanner(System.in);
		boolean f = false;

		int k = sc.nextInt();
//		int m = sc.nextInt();
//		int k = sc.nextInt();
		String s = sc.next();
		String[] sa = s.split("");

//		long k = sc.nextLong();

//		int[] a = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}

//		String s = sc.next();

//		int[] ans = new int[n];

//		ArrayList<Integer> list = new ArrayList<>();

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

		if(k >= sa.length) {
			System.out.println(s);
		} else {
			for(int i = 0; i < k; i++) {
				System.out.print(sa[i]);
			}
			System.out.print("...");
			System.out.println();
		}

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

//		if(!f) {
//			System.out.println("Yes");
//		} else {
//			System.out.println("No");
//		}

//		System.out.println(ans);

		sc.close();
	}



}

Measured memory_bytes: 35724
//集計処理・バケット法・ソート？

#define MAX_N 100;
#include<iostream>

#include<vector>
using namespace std;


int main()
{
    int W,H,N;
    scanf("%d %d %d",&W,&H,&N);
    int left=0,right=W,lower=0,upper=H;
    int x,y,a;
    for(int i=0;i<N;++i)
    {
        scanf("%d %d %d",&x,&y,&a);
        if(a==1)
        {
            left=max(left,x);
        } 
        else if(a==2)
        {
            right=min(right,x);
        }
        else if(a==3)
        {
            lower=max(lower,y);
        }
        else if(a==4)
        {
            upper=min(upper,y);
        }

    }
    // cout<<left<<" "<<right<<" "<<lower<<" "<<upper<<endl;

    int dx=max(right-left,0);
    int dy=max(upper-lower,0);

    int ans=dx*dy;
    cout<<ans<<endl;

    return 0;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> //required
//#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define lb long double
#define pb push_back
#define loop(i,start,n) for(ll i=start;i<n;i++)
#define rloop(i,n,start)for(ll i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e15
#define NEG_INF -1e15
#define pll pair<ll,ll>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//using namespace __gnu_pbds;
//template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 


int main(){
	IOS;
	ll n;
	cin >> n;
	cout << (1000 - n % 1000) % 1000 << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int count=0;
	int temp=1;
	int i=1;
	while(temp<b){
		count++;
		temp=a*i-(i-1);
		i++;
	}
	cout<<count<<"\n";
	return 0;
}

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

using namespace std;
typedef  long long ll;

#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
const int maxn=1e6+10;
const int mod=1e9+7;
int a[maxn],b[maxn];
int main()
{
    int wa=0,ac=0;
    int n,m;
    cin>>n>>m;
    mem(a,0);
    mem(b,0);
    for(int i=0; i<m; i++)
    {
        int t;
        string zt;
        cin>>t>>zt;
        if(zt=="AC"&&a[t]==0)
        {
            a[t]=1;
            wa+=b[t];
            ac++;
        }
        else if(zt=="WA")
        {
            b[t]++;
        }
    }
    printf("%d %d",ac,wa);
    return 0;
}


Measured memory_bytes: 8064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int k = sc.nextInt();
      int x = sc.nextInt();
      int a = x - k+1;
      for (int i = 0; i < k*2-1;i++) {
        System.out.print(a++ + " ");
      }
    }
}

Measured memory_bytes: 23760
N = int(input())
monster = list(map(int, input().split()))

monster.sort(reverse = True)

while sum(monster[1:N]) != 0:
    monster.sort(reverse = True)
    for i in range(N-1):
        if monster[i+1] != 0:
            monster[i] = monster[i] % monster[i+1]

print(monster[0])

Measured memory_bytes: 14224
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,num = IL()
a = IL()

a.sort()

cnt = 0
for i in range(N):
    if i != N-1:
        if num-a[i] > 0:
            num -= a[i]
            cnt += 1
        elif num-a[i] == 0:
            cnt += 1
            break
    else:
        if num-a[i] == 0:
            cnt += 1
print(cnt)

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll a;
  ld b;
  cin>>a>>b;
  ll ans=a*b;
  cout<<ans<<endl;
}



Measured memory_bytes: 3748
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(void) {
  int n, c, k;
  cin >> n >> c >> k;
  int t[100000];
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }

  sort(t, t + n);
  int departure = -1;
  int got = 0;
  int res = 1;
  for (int i = 0; i < n; i++) {
    if (departure < 0) {
      departure = t[i] + k;
      got = 1;
    } else if (departure < t[i]) {
      departure = t[i] + k;
      got = 1;
      res++;
    } else if (got == c) {
      departure = t[i] + k;
      got = 1;
      res++;
    } else {
      got++;
    }
  }
  cout << res << endl;
  return EXIT_SUCCESS;
}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
 private static Scanner sc;
 public static void main(String[] args){
  int i,x;
  sc = new Scanner(System.in);
  int n = sc.nextInt();
   for(i=3;i<=n;i++){
	   x=i;
	   if(n<3||n>10000){
		   break;
	   }
       if(x%3==0){
    	     System.out.print(" "+i);
    	     continue;
       }else if(x%10==3){
    	     System.out.print(" "+i);
    	     continue;
       }
       if(x>10 && x<=100){
    	   x=i;
           x/=10;
           if(x==3 && x%10!=0){
        	   System.out.print(" "+i);
        	   continue;
           }
       }else if(x>100 && x<=1000){
    	   x=i;
           x=x-(x/100)*100;
           x/=10;
           if(x==3 && x%10!=0){
        	   System.out.print(" "+i);
        	   continue;
           }
           x=i;
           x/=100;
           if(x==3 && x%100!=0){
        	   System.out.print(" "+i);
        	   continue;
           }
       }else if(x>1000 && x<=10000){
    	   x=i;
           x=x-(x/1000)*1000;
           x=x-(x/100)*100;
           x/=10;
           if(x==3 && x%10!=0){
        	   System.out.print(" "+i);
        	   continue;
           }
           x=i;
           x=x-(x/1000)*1000;
           x/=100;
           if(x==3 && x%100!=0){
        	   System.out.print(" "+i);
        	   continue;
           }
           x=i;
           x/=1000;
           if(x==3 && x%1000!=0){
        	   System.out.print(" "+i);
        	   continue;
           }
       }
   }
   System.out.println();
}
}

Measured memory_bytes: 28696
<?php
	fscanf(STDIN,'%d%d',$k,$s);
	for($i=0;$i<=$k;$i++)
	{
		$c=$s-$i;
		if($c>$k)$a+=max(0,2*$k-$c+1);
		elseif($c>=0)$a+=$c+1;
	}
	echo $a;


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

struct Vertex
{
    vector<pll> node;
};

Vertex V[100005];
bool U[100005];
ll A[100005];

int main()
{
    ll N;
    cin >> N;
    memset(U, 0, sizeof(U));
    REP(i, N - 1)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        V[a].node.push_back(pll(b, i));
        V[b].node.push_back(pll(a, i));
    }

    queue<pll> q;
    q.push(pll(0, 0));
    while (!q.empty())
    {
        pll t = q.front();
        q.pop();
        U[t.first] = true;
        ll col = 1;
        REP(i, V[t.first].node.size())
        {
            pll n = V[t.first].node[i];
            if (U[n.first])
                continue;
            while (col == t.second)
                col++;
            A[n.second] = col;
            q.push(pll(n.first, col));
            col++;
        }
    }

    ll k = 0;
    REP(i, N - 1)
    {
        k = std::max(k, A[i]);
    }
    cout << k << endl;
    REP(i, N - 1)
    {
        cout << A[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 8960
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
const ll mod=1e9+7;
class mint {
public:
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x%mod + mod) % mod) {}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

//class combination {
//public:
//	vector<mint> fact, ifact;
//	combination(ll n) :fact(n + 1), ifact(n + 1) {
//		fact[0] = 1;
//		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
//		ifact[n] = fact[n].inv();
//		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
//	}
//	mint operator()(ll n, ll k) {
//		if (k < 0 || k > n) return 0;
//		return fact[n] * ifact[k] * ifact[n - k];
//	}
//}comb();

mint choose(ll n, ll a){
	mint x=1,y=1;
	rep(i,a){
		x*=n-i;
		y*=i+1;		
	}
	return x / y;
}
int main(){
   ll n,a,b;
   string s;
   cin >> n >> a >> b;
   mint ans;
   ans=2;
   ans=ans.pow(n);
   ans-=1;
   ans-=choose(n,a);
   ans-=choose(n,b);
   cout << ans.x << endl;
   return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int i,N,count=0;
    float res;
    
    scanf("%d",&N);
    
    for(i=1;i<=N;i++){
        if(i%2!=0){
            count++;
        }
    }
    
    res=(float)count/(float)N;
    
     printf("%.6f\n",res);

    
    return 0;
}

Measured memory_bytes: 128