akhauriyash/Code-Regression huggingface dataset:
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>

ll N, M, A, B, C, D;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;

int main() {
	scanf("%lld %lld %lld %lld %lld", &A, &B, &C, &D, &N);
	ll min1 = A * 60;
	min1 += B;
	ll min2 = C * 60;
	min2 += D;
	min2 -= N;
	ll ans = min2 - min1;
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3792
class SortingThreeNumbers:
    def __init__(self, n):
        n.sort()
        print "%(a)d %(b)d %(c)d" % {'a':n[0],'b':n[1],'c':n[2]}
        return

if __name__ == "__main__":
    n = (map(int, raw_input().split()))
    SortingThreeNumbers(n)

Measured memory_bytes: 6280
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let q: usize = input();
    let qs: Vec<Query> = (0..q)
        .map(|_| {
            let i: i32 = input();
            if i == 1 {
                //let (a, b) = (input(), input());
                Query::Q1(input(), input())
            } else {
                Query::Q2
            }
        })
        .collect();

    let mut hl = std::collections::BinaryHeap::new();
    let mut hr = std::collections::BinaryHeap::new();
    let mut ans = 0i64;
    for q in qs {
        match q {
            Query::Q1(a, b) => {
                ans += b;
                hl.push(a);
                hr.push(Reverse(a));
                let l = hl.pop().unwrap();
                let Reverse(r) = hr.pop().unwrap();
                if l <= r {
                    hl.push(l);
                    hr.push(Reverse(r));
                } else {
                    ans += i64::abs(r - l);
                    hl.push(r);
                    hr.push(Reverse(l));
                }
            }
            Query::Q2 => {
                println!("{} {}", hl.peek().unwrap(), ans);
            }
        }
    }
}

enum Query {
    Q1(i64, i64),
    Q2,
}

#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
struct Reverse<T>(T);

impl<T: PartialOrd> PartialOrd for Reverse<T> {
    fn partial_cmp(&self, other: &Reverse<T>) -> Option<std::cmp::Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Reverse<T> {
    fn cmp(&self, other: &Reverse<T>) -> std::cmp::Ordering {
        other.0.cmp(&self.0)
    }
}


Measured memory_bytes: 16636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define cs cout << "Case " << ++xx << ": "
#define cS printf("Case %lld:\n",++xx)
#define bitoff(val,pos) val & ~(1ll<<pos)
#define biton(val,pos) val | (1ll<<pos)
#define bittgl(val,pos) val ^ (1ll<<pos)
#define bitchk(val,pos) (bool)(val & (1ll<<pos))
#define odevn(val,pos) (bool)(val & (1ll<<pos))
#define bitcnt(val) __builtin_popcount(val)zz
#define pi acos(-1ll)
#define flot(ds) cout << setprecision(ds) << fixed;
ll drcx[] = {0, 0, -1, 1, 1, 1, -1, -1};
ll drcy[] = {1, -1, 0, 0, 1, -1, 1, -1};
ll xx,fr[300009];
struct strk{
    ll id1,id2;
}str[300009];
ll bgmod(ll v1, ll v2, ll md){
    ll res = 1;
    v1 = v1 % md;
    while (v2 > 0){
        if (v2 & 1)
            res = (res * v1) % md;
        v2 = v2 >> 1;
        v1 = (v1 * v1) % md;
    }
    return res;
}
int main()
{
        map<char,ll>mp;
        vector<ll>vec;
        ll n,a,b,c,f=0,gcd;
        pair<ll,pair<ll,ll> >pp;
        priority_queue< pair<ll, pair<ll,ll> > >qq;
        char cc;
        cin >> cc;
        ll v=cc;
        if(v<97)
        {
            cout << "A" << endl;
        }
        else cout << "a" << endl;

    return 0;
}





Measured memory_bytes: 3592
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanRunes() []rune { return []rune(scanString()) }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	a := scanInt()-1
	b := scanInt()-1
	c := scanInt()-1
	d := scanInt()-1
	e := scanInt()-1

	t := min(a%10,min(b%10,min(c%10,min(d%10,e%10))))+1

	a += 10
	b += 10
	c += 10
	d += 10
	e += 10

	a /= 10
	b /= 10
	c /= 10
	d /= 10
	e /= 10

	fmt.Fprintln(wr, (a+b+c+d+e)*10-10+t)
}


Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,r;
    cin >> n >> r;
    if(n>=10){
        cout << r << endl;
    }else{
        cout << r + 100*(10-n) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[110000];
int main(){
	scanf("%s",str);
	int cnt=0;
	int n=0;
	for(int i=0;str[i];i++){
		if(str[i]=='p')cnt++;
		n++;
	}
 
	printf("%d\n",n/2-cnt);
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=105;
int a[MAXN]; 
int main () {
    int n,cnt=0;
    scanf ("%d",&n);
    for (int i=0;i<n;i++) {
    	scanf ("%d",&a[i]);
	}
	bool flag=true;
	while (flag) {
		flag=false;
		for (int i=n-1;i>0;i--) {
			if (a[i]<a[i-1]) {
				swap(a[i],a[i-1]);
				cnt++;
				flag=true;
			}
		}
	}
	printf ("%d",a[0]);
	for (int i=1;i<n;i++) {
		printf (" %d",a[i]);
	}
	printf ("\n%d\n",cnt);
    return 0;
}


Measured memory_bytes: 2716
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		out.println(ir.next());
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return "ABC"+sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 21204
#include <stdio.h>

#define N 200000

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	static int tt[N];
	int n, t, i, ans;
	
	scanf("%d%d", &n, &t);
	for (i = 0; i < n; i++)
		scanf("%d", &tt[i]);
	ans = 0;
	for (i = 1; i < n; i++)
		ans += min(t, tt[i] - tt[i - 1]);
	printf("%d\n", ans + t);
	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

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;

#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 REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

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


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;


int main() {
    string s, t; cin >> s >> t;

    assert(s.length() + 1 == t.length());

    bool ok = true;
    REP(i, t.length() - 1) {
        if (s[i] != t[i]) ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
using namespace std;
#define ll long long

int d = 365;
//int k = 0;
vector<vector<int>> s(d, vector<int>(26, 0));
vector<ll> c(26);

void init() {
    cin >> d;
    for(int i = 0; i < 26; i++) cin >> c[i];
    for(int i = 0; i < d; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    return;
}

ll calc(vector<int> out, int k) {
    ll score = 0;
    vector<ll> last(26, 0);
    for(int i = 0; i < out.size(); i++) {
        //cout << i << endl;
        last[out[i]] = i+1; // タイプ番号
        //cout << "out[" << i << "] " << out[i] << " ";
        for(int j = 0; j < 26; j++) {
            score -= c[j]*((i+1)-last[j]);
        }
        score += s[i][out[i]];
        //cout << "score : " << score << endl;
    }

    //int p = min(int(out.size()+k), int(d));
    //cout << p << endl;
    //if(out.size() >= d) return score;
    //cout << k << endl;
    //cout << out.size() << " " << d << endl;
    int p = min(int(out.size()+13), d);
    for(int i = out.size(); i < p; i++) {
        //cout << i << endl;
        for(int j = 0; j < 26; j++) {
            score -= c[j]*((i+1)-last[j]);
        }
        //cout << score << endl;
    }
    return score;
}

/*
vector<int> proc(int k) {
    vector<int> out;
    ll ans = 0;
    //ll tmp = 0;
    ll max_v = -1;
    //for(int k = 0; k < 26; k++) {
    //cout << "k: " << k << endl;
    //vector<int> out;
    for(int i = 0; i < d; i++) {
        //max_v = -100000000000;
        max_v = LLONG_MIN;
        int best = 0;
        for(int j = 0; j < 26; j++) {
            out.push_back(j);
            ll tmp = calc(out);
            if(max_v < tmp) {
                max_v = tmp;
                best = j;
            }
            out.pop_back();
        }
        out.push_back(best);
    }
    //}
    return out;
}
*/

int main() {
    init();
    /*
    vector<int> out;
    vector<int> ans;
    for(int i = 0; i <= 26; i++) {
        out = proc(i);
        for(int j = 0; j < out.size(); j++) {

        }
    }
    */
    
    vector<int> out;
    ll ans = 0;
    ll max_v = -1;
    //for(int k = 0; k < 26; k++) {
        //cout << "k: " << k << endl;
        //vector<int> out;
    for(int i = 0; i < d; i++) {
        //max_v = -100000000000;
        max_v = LLONG_MIN;
        int best = 0;
        for(int j = 0; j < 26; j++) {
            out.push_back(j);
            for(int k = 0; k < 26; k++) {
                ll tmp = calc(out, k);
                if(max_v < tmp) {
                    max_v = tmp;
                    best = j;
                }
            }
            out.pop_back();
        }
        out.push_back(best);
    }
    //}
    
    for(int i = 0; i < d; i++) {
        cout << out[i]+1 << endl;
    }
    //cout << max_v << endl;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N;cin>>N;
    string S;cin>>S;
    int allE=count(all(S),'E');
    int e=0;
    int ans=INT_MAX;
    for(int i=0;i<S.size();i++){
        int cost=0;
        cost+=i-e;
        if(S[i]=='E')e++;
        cost+=allE-e;
        chmin(ans,cost);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 900
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>T operator()(T&& lhs, T&& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>T operator()(T&& lhs, T&& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();
}

void Main()
{
	std::int64_t X;
	std::cin >> X;
	std::int64_t m = 100;
	for (auto i = 1; ; ++i)
	{
		m += m / 100;
		if (X <= m)
		{
			std::cout << i << std::endl;
			return;
		}
	}
}

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

Measured memory_bytes: 3652
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		for(int i = 1; i <= 10000; i++){
			int x = sc.nextInt();

			if(x == 0){
			break;
			}else{
				System.out.println("Case " + i + ": " + x);
			}				
		}
	sc.close();
	}
}

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

int main() {
  string s; int q; cin >> s >> q;
  deque<char> d;
  rep(i, (int)s.size()) d.push_back(s[i]);
  int f = 0;
  rep(i, q) {
    int t; cin >> t;
    if (t == 1) {
      f++;
    }
    else if (t == 2) {
      int n; char c; cin >> n >> c;
      if (f % 2 == 0) {
        if (n == 1) d.push_front(c);
        else d.push_back(c);
      }
      else {
        if (n == 1) d.push_back(c);
        else d.push_front(c);
      }
    }
  }
  if (f % 2 == 1) {
    while (!d.empty()) {
      char ans = d.back(); d.pop_back();
      cout << ans;
    }
  }else {
    while (!d.empty()) {
      char ans = d.front(); d.pop_front();
      cout << ans;
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

const ll ccc=100000;
bool prime[ccc+1];
vector<ll> pr;
void makeprime(){
	ll i,j;
	for(i=2;i<=ccc;i++) prime[i]=true;
	for(i=2;i*i<=ccc;i++) if(prime[i]) for(j=2;j*i<=ccc;j++) prime[j*i]=false;
	for(i=2;i<=ccc;i++) if(prime[i]) pr.push_back(i);
}
ll gcd(ll x,ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	makeprime();
	
	int N;
	cin >> N;
	V<ll> a(N+1);
	for(int i=N;i>=0;i--){
		cin >> a[i];
	}
	set<ll> ans;
	for(ll p: pr){
		if(p>N+10) break;
		if(a[0]%p) continue;
		bool ok = true;
		rep(r,p-1){
			ll s = 0;
			for(int i=r;i<=N;i+=p-1) s += a[i];
			if(s%p){
				ok = false;
				break;
			}
		}
		if(!ok) continue;
		ans.insert(p);
	}
	ll g = 0;
	rep(i,N+1) g = gcd(g,abs(a[i]));
	for(ll p: pr){
		if(g%p == 0){
			ans.insert(p);
			while(g%p == 0) g/=p;
		}
	}
	if(g>1) ans.insert(g);
	for(ll p: ans) cout << p << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 1; i <= n; i += 2) {
    int y = 0;
    for(int j = 1; j <= i; j++) {
      if (i % j == 0) {
        y++;
      }
    }
    if (y == 8) {
      ans++;
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))

g = {}
for i in range(1, n+1):
    g[i] = 0

for _ in range(m):
    a, b = map(int, input().split())
    if g[a] < h[b-1]:
        g[a] = h[b-1]
    if g[b] < h[a-1]:
        g[b] = h[a-1]

ans = 0
for i in range(1, n+1):
    if h[i-1] > g[i]:
        ans += 1
print(ans)



Measured memory_bytes: 24488
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  long long N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N)
  {
    cin >> A[i];
    A[i]--;
  }

  vector<int> ans(N + 1);
  int now = 0;
  ans[0] = 0;
  rep(i, N)
  {
    ans[i + 1] = A[now];
    now = A[now];
  }
  vector<int> loop(N, -1);
  long long loop_num = 0;
  long long loop_pre = 0;
  rep(i, N)
  {
    if (loop[ans[i]] != -1)
    {
      loop_pre = loop[ans[i]];
      loop_num = i - loop_pre;
      break;
    }
    loop[ans[i]] = i;
  }

  if (K > loop_pre)
  {
    K = (K - loop_pre) % loop_num;
    cout << ans[loop_pre + K] + 1 << endl;
  }
  else
  {
    cout << ans[K] + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 5612
# -*- coding: utf-8 -*-
"""
A - Shrinking
https://atcoder.jp/contests/agc016/tasks/agc016_a

"""
import sys


def solve(s):
    ans = []
    for ch in set(s):
        t = list(s)
        x = 0
        while len(set(t)) > 1:
            t = [ch if a == ch or b == ch else a for a, b in zip(t, t[1:])]
            x += 1
        ans.append(x)
    return min(ans)


def main(args):
    s = input()
    ans = solve(s)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;

#define int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define ub            upper_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(4e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>
#define ordered_set   tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v) {
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}

void solve() {
	int n; cin >> n;
	set<pii> row, col;

	col.insert(mp(n, n));
	row.insert(mp(n, n));

	int q; cin >> q;
	int ans = (n-2)*(n-2);

	while(q--) {
		int t, x;
		cin >> t >> x;
		if(t == 1) {
			auto it = row.lb(mp(x, -1));
			ans -= (it->S-2);
			col.insert(mp(it->S, x));
		}
		else {
			auto it = col.lb(mp(x, -1));
			ans -= (it->S-2);
			row.insert(mp(it->S, x));
		}
	}
	cout << ans << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   
    start = clock(); 

    
    int test = 1;
    // cin >> test;
    
    cout << fixed << setprecision(2);
     
    for(int i = 1; i <= test; ++i){
    	solve();
    }

    cerr << time(start);
    return 0;
}


Measured memory_bytes: 16252
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
s = [input() for i in range(n)]
dic = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for i in range(n):
    dic[s[i]]+=1
for k,v in dic.items():
    print('{} x {}'.format(k,v))

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

#define lli long long int

lli bigmod = 1000000007, memo[2010][2010];

lli dp(lli x, lli y) {
	if (x < y)
		return 0;
	if ((y == 0) || (x == y))
		return 1;
	if (memo[x][y] == -1)
		memo[x][y] = (dp(x - 1, y) + dp(x - 1, y - 1)) % bigmod;
	return memo[x][y];
}

int main() {
	lli n, k, ans;
	scanf("%lld %lld", &n, &k);
	memset(memo, -1, sizeof memo);
	for (lli i = 1; i <= k; i++) {
		ans = (dp(k - 1, i - 1) * dp(n - k + 1, i)) % bigmod;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 31872
#include<bits/stdc++.h>
using namespace std;
const long long int INF=1e18L+5;
int main()
{
  long long int n,weight,i,j;
  long long int sum=0,ans=0;
    scanf("%lld%lld",&n,&weight);
    vector<long long int >w(n),v(n);
   //As weight is huge,let us considero value in dp[]
  for(i=0;i<n;i++)
  {
      scanf("%d%d",&w[i],&v[i]);
  }
  for(i=0;i<n;i++)
  sum=sum+v[i];

  vector<long long int>dp(sum+1,INF);
  dp[0]=0;
    for(i=0;i<n;i++)
    {
        for(j=sum;j>=v[i];j--)
        {
            dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
        }
    }

    ans=0;
    for(i=0;i<=sum;i++)
    {
     if(dp[i]<=weight)
     {
         ans=max(ans,(long long int )i);
     }
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;

ll ARR[200010];
ll LST[200010];

int main(int argc, char const *argv[])
{
  ll N, K; cin >> N >> K;
  RNG(i, 1, N+1) cin >> ARR[i];
  REP(i, 200010) LST[i] = -1;

  ll next = 1, cnt = 0;
  while (LST[next] == -1) {
    if (cnt == K) {
      cout << next << endl;
      return 0;
    }
    LST[next] = cnt;
    cnt++;
    next = ARR[next];
  }

  K -= cnt;
  K %= (cnt-LST[next]);
  // cout << "loop made: " << cnt << endl;
  // cout << "LOOP toutatu made: " << LST[next] << endl;
  // cout << "LOOP len: " << cnt-LST[next] << endl;
  // cout << "K: " << K << endl;

  if (K == 0) {
    cout << next << endl;
  } else {
    cnt = 1; next = ARR[next];
    while (cnt < K) {
      cnt++;
      next = ARR[next];
    }
    cout << next << endl;
  }
  return 0;
}


Measured memory_bytes: 6748
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);

		for (int i = 0; i <= 100; i++) {
			for (int j = 0; j <= 100; j++) {
				if (a * i == b * j + c) {
					System.out.println("YES");
					return;
				}
			}
		}

		System.out.println("NO");
	}
}

Measured memory_bytes: 32632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <math.h>

using namespace std;

#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)

#define INF 		2000000007
#define MOD			998244353

#define MAX 		100005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int ll;


int main(){
	int a,b;cin>>a>>b;

	if(a+b==15)
		cout << "+" << endl;
	else if(a*b==15)
		cout << "*" << endl;
	else cout << "x" << endl;


	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m];

        for (int i = 0; i < m; i++) {
            x[i] = sc.nextInt();
        }

        sc.close();

        Arrays.sort(x);

        int ans = 0;

        if (n >= m) {
            System.out.println(ans);
            return;
        }

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

        for (int i = 0; i < m - 1; i++) {
            list.add(x[i + 1] - x[i]);
        }

        Collections.sort(list, Comparator.reverseOrder());

        for (int i = 0; i < n - 1; i++) {
            list.remove(0);
        }

        for (int num : list) {
            ans += num;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 48776
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main(){
    char str[200];
    char str2[10][200];
    int shuffle;
    int h;
    int length;
    int count = 0;
    while(1){
        scanf("%s", str);
        //printf("%lu\n", strlen(str));
        if(strlen(str) == 1 and str[0] == '-'){
            break;
        }
        else{
            scanf("%d", &shuffle);
            count++;
            length = strlen(str);
            //printf("length %d\n", length);
            for(int i = 0; i < shuffle; i++){
                scanf("%d", &h);
                char front[h];
                char back[length - h];

                for(int j = 0; j < h; j++){
                    front[j] = str[j];
                }
                for(int j = 0; j < length - h; j++){
                    back[j] = str[h + j];
                }

                for(int j = 0; j < length; j++){
                    if(j < length - h){
                        str[j] = back[j];
                    }
                    else{
                        str[j] = front[j - length + h];
                    }
                }
                //printf("fron %s\n", front);
                //printf("back %s\n", back);

                //printf("str %s\n", str);

                /*
                strncpy(front, str, h);
                printf("fron %s\n", front);
                printf("length - h %d\n", length - h);
                strncpy(back, &str[h], length - h);
                printf("back %s\n", back);
                strcat(back, front);
                strcpy(str, back);
                printf("str %s\n", str);
                */
            }
            //printf("%s\n", str);
            strcpy(str2[count - 1], str);

        }
    }

    for(int i = 0; i < count; i++){
        printf("%s\n", str2[i]);
    }
    return 0;
}



Measured memory_bytes: 3160
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine

getIntList = readIntList <$> BS.getLine

getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine

calc :: [[Int]] -> Int -> Int
calc [] m = 0
calc (xy:xys) m = d + calc xys m'
  where
    x = head xy
    y = last xy
    n = (x + m) `mod` y
    d = if n == 0 then 0 else y - n
    m' = m + d

main = do
  n <- getInt
  xys <- getIntNList n
  let xys' = reverse xys
  print $ calc xys' 0

Measured memory_bytes: 36460
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>
#include<cassert>
using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	vector<bool> visited(B, false);
	long long curr = B;
	while (true) {
		if (curr % B == C) {
			cout << "YES" << endl;
			return 0;
		}
		if (visited[curr % B]) {
			cout << "NO" << endl;
			return 0;
		}
		visited[curr % B] = true;
		curr += A;
	}
}

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

using namespace std;

int main()
{
	int h, w;
	cin >> h >> w;

	vector< vector <bool> > a(h + 2, vector <bool> (w + 2, false));
	queue< vector <int> >q;

	a[0][0] = true;
	a[0][w + 1] = true;
	a[h + 1][0] = true;
	a[h + 1][w + 1] = true;
	for (int i = 1; i <= h; ++i)
	{
		for (int j = 1; j <= w; ++j)
		{
			char c;
			cin >> c;
			if (c == '#')
			{
				a[i][j] = true;
				vector <int>v = { i, j, 0 };
				q.push(v);
			}
			a[0][j] = true;
			a[h + 1][j] = true;
		}
		a[i][0] = true;
		a[i][w + 1] = true;
	}
	

	int c = 0;
	while (!q.empty())
	{
		vector <int> v = q.front();
		q.pop();

		int i = v[0];
		int j = v[1];

		if (!a[i - 1][j])
		{
			vector<int> v1 = { i - 1, j, v[2] + 1 };
			q.push(v1);
			a[i - 1][j] = true;
		}
		if (!a[i + 1][j])
		{
			vector<int> v1 = { i + 1, j, v[2] + 1 };
			q.push(v1);
			a[i + 1][j] = true;
		}
		if (!a[i][j - 1])
		{
			vector<int> v1 = { i, j - 1, v[2] + 1 };
			q.push(v1);
			a[i][j - 1] = true;
		}
		if (!a[i][j + 1])
		{
			vector<int> v1 = { i, j + 1, v[2] + 1 };
			q.push(v1);
			a[i][j + 1] = true;
		}
		c = v[2];
	}

	cout << c << endl;

	return 0;
}

Measured memory_bytes: 55860
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<algorithm>
typedef long long int ll;
using namespace std;

#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {X;}
#define TF(f) {f;}
#define END {}
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,a) for (int i=1;i<=(a);i++)
const ll MOD = (10*10*10*10*10*10*10*10*10+7);

    int A,B,C;
    int N,M,K,X,Y,W,H;
    int ans;
    //string S;
    bool S[101][101];
    int temp[100]={0};
    bool f=true;
    bool fir=true;

int main(){
    cin>>A>>B>>C;
    (B-A)==(C-B)?cout<<"YES":cout<<"NO";

    //cout<<ans;
}
/*A.size()!=0&&B.size()!=0&&C.size()!=0*/


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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#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 REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入


int main(){
    int N,C;
    cin>>N>>C;
    vector<vector<int>> ch(C,vector<int>(1e+5,0));
    int s,t,c;
    REP(i,N){
        cin>>s>>t>>c;
        c--;
        s--;
        REP2(j,s,t) ch[c][j]=1;
    }

    int ans=0;
    int cnt=0;
    REP2(x,0,1e+5){
        cnt=0;
        REP(i,C){
            cnt+=ch[i][x];
        }
        ans=max(cnt,ans);
    }
    cout << ans << endl;
    
    
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

P StoP(string a){
  int top=0,first=0;
  for(int i=0;i<a.size();i++){
    if(a[i]=='(') top++;
    else if(top) top--;
    else first++;
  }
  return P(first,top);
}

int main(){
  int n;
  cin>>n;
  
  P p[101];
  int cnt=0;
  for(int i=0;i<n;i++){
    string tmp;
    cin>>tmp;
    p[i]=StoP(tmp);
    if(!p[i].second) cnt+=p[i].first,i--,n--;
  }


  bool ans=1,used[101]={};
  int top=0;
  for(int i=0;i<n&&ans;i++){
    int idx=-1,mx=-1e9;
    for(int j=0;j<n;j++){
      if(used[j]||top-p[j].first<0)continue;
      int k=p[j].second-p[j].first;
      if(mx<k) mx=k,idx=j;
    }
    if(idx==-1) ans=0;
    top+=mx;
    used[idx]=1;
  }
  cout<<(ans&&!(top-cnt)? "Yes":"No")<<endl;
	
  
  return 0;
}

Measured memory_bytes: 3224
#include<stdio.h>
int main() {
  int kakusuu,max=0,sum=0;
  scanf("%d\n",&kakusuu);

  int length[kakusuu];
  for(int i=0;i<kakusuu;i++){
    scanf("%d",&length[i]);
    sum+=length[i];
    if(length[i]>max){
      max=length[i];
    }
  }

  if(max*2<sum){
    puts("Yes");
  }else{
    puts("No");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int l, r, n = in();
  bool f;
  while (n--){
    l = r = 0;
    f = true;
    REP(i, 10){
      int a = in();
      if (a > l) l = a;
      else if (a > r) r = a;
      else f = false;
      if (l < r) swap(l, r);
    }
    (f)?cout << "YES" << endl:cout << "NO" << endl;
  }

  return (0);
}

Measured memory_bytes: 1172
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define fastestiointhewest   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{  
   ll n,x; cin>>n>>x;
   ll a[n];
   rep(i,0,n) cin>>a[i];
   sort(a,a+n);
   int ans=0;
   rep(i,0,n)
   {
      if(x-a[i]<0) {x=0; break;}
      else ans++,x-=a[i];
   }
   if(x) ans--;
   cout<<ans;
}  
int main()
{   
    fastestiointhewest;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = long long;

i64 X, K;
i64 r[101010];
i64 Q;
i64 t[101010], a[101010];

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> X >> K;
    for (int j = 0; j < K; ++j) {
        cin >> r[j];
    }
    cin >> Q;
    for (int j = 0; j < Q; ++j) {
        cin >> t[j] >> a[j];
    }

    i64 sr[101010];
    sr[0] = 0;
    for (int j = 0; j < K; ++j) {
        i64 offset = (j == 0) ? r[0] : (r[j] - r[j-1]);
        i64 s = (j % 2 == 0) ? -1 : 1;
        sr[j+1] = sr[j] + s * offset;
    }

    i64 la = 0, ha = X, s = -1;

    i64 l[101010], h[101010];
    i64 ml[101010], mh[101010];
    l[0] = 0; h[0] = X;
    ml[0] = 0; mh[0] = X;

    for (int j = 0; j < K; ++j) {
        i64 offset = j == 0 ? r[0] : r[j] - r[j-1];
        la += s * offset;
        ha += s * offset;

        l[j+1] = max(0LL, min(X, l[j] + s * offset));
        h[j+1] = max(0LL, min(X, h[j] + s * offset));

        ml[j+1] = max(ml[j], -la);
        mh[j+1] = min(mh[j], X - (ha - X));

        s *= -1;
    }

    for (int j = K; j > 0; --j) r[j] = r[j-1];
    r[0] = 0;
    for (int j = 0; j < Q; ++j) {
        int idx = upper_bound(r, r+K+1, t[j]) - r - 1;
        i64 s = (idx % 2 == 0) ? -1 : 1;
        i64 offset = t[j] - r[idx];
        if (a[j] < ml[idx]) {
            cout << max(0LL, min(X, l[idx] + s * offset)) << endl;
        } else if (mh[idx] < a[j]) {
            cout << max(0LL, min(X, h[idx] + s * offset)) << endl;
        } else {
            cout << max(0LL, min(X, a[j] + sr[idx] + s * offset)) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 7552
#include<iostream>
using namespace std;
bool a[105];
int main(void)
{
    string s[105];
    int h,w;
    cin >> h >> w;
    for(int i=0;i<h;i++)
        cin >> s[i];

    for(int i=0;i<w;i++)
    {
        int cnt=0;
        for(int j=0;j<h;j++)
            if(s[j][i]=='.')
                cnt++;
        if(cnt==h)
            a[i]=false;
        else
            a[i]=true;
    }
    for(int i=0;i<h;i++)
    {
        if(s[i].find('#')<(int)s[i].size())
        {
            for(int j=0;j<w;j++)
            {
                if(s[i][j]=='#')
                    cout << s[i][j];
                else
                {
                    if(s[i][j]=='.' && a[j]==true)
                        cout << s[i][j];
                }
            }
            cout << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
D = [A[i + 1] - A[i] for i in range(N - 1)] + [A[0] - A[N - 1]]
k = int(sum(A) / (N * (N + 1) / 2))
if sum(A) % (N * (N + 1) / 2) != 0:
    print("NO")
    exit()

for d in D:
    if d - k > 0 or (d - k) % N != 0:
        print("NO")
        exit()

print("YES")


Measured memory_bytes: 14260
# -*- coding: utf-8 -*-
import sys


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    A, B, C, X, Y = list(map(int, input().split()))

    return A, B, C, X, Y


def main(A: int, B: int, C: int, X: int, Y: int) -> None:
    """
    メイン処理.

    Args:\n
        A (int): Aピザの値段
        B (int): Bピザの値段
        C (int): ABピザの値段
        X (int): Aピザの必要枚数
        Y (int): Bピザの必要枚数
    """
    # 求解処理
    ans = sys.maxsize
    max_c = 2 * max(X, Y)
    for c in range(0, max_c + 1, 2):
        a = max(X - c // 2, 0)
        b = max(Y - c // 2, 0)
        price = a * A + b * B + c * C
        ans = min(ans, price)

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    A, B, C, X, Y = get_input()

    # メイン処理
    main(A, B, C, X, Y)


Measured memory_bytes: 9184