akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
// header {{{
#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
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

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

// init {{{
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;
// }}}

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

signed main() {
    int n; cin>>n;
    vector<int> p(n);
    REP(i,n) cin>>p[i];

    int jmx = 10000000, ans=0;
    REP(i,n){
        if(jmx > p[i]) ans++;
        jmx = min(p[i],jmx);
    }
    
    cout<<ans<<endl;

    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(100000)

def load_fields():
	fields = []
	i = 0
	H, W = 0, 0
	field = []
	for line in sys.stdin:
		line = line.rstrip()
		if line[0] not in ["#", "@", "*"]:
			line = line.split(" ")
			H, W = int(line[0]), int(line[1])
			if (len(field) != 0):
				fields.append(field)
				field = []
			if (H == 0 and W == 0):
				break

		else:
			field.append(list(line))
		i += 1
	return fields

def dfs(x, y, fruit):
	field[x][y] = "0"
	for dx in [-1, 0, 1]:
		if dx == -1: width = [0]
		if dx == 0: width = [-1, 0, 1]
		if dx == 1: width = [0]
		for dy in width:
			nx = x+dx
			ny = y+dy
			inField = (0 <= nx < H) and (0 <= ny < W)
			if inField and (field[nx][ny] == fruit):
				dfs(nx, ny, fruit)

fields = load_fields()
count = 0
for field in fields:
	H = len(field)
	W = len(field[0])
	for x in range(H):
		for y in range(W):
			if (field[x][y] != "0"):
				dfs(x, y, field[x][y])
				count += 1
	print(count)
	count = 0

Measured memory_bytes: 19028
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

void solve(int n,int m){
	int r,q,t,in,im,is;
	vector<vector<pii>> s(m);
	cin>>r;
	rep(i,r){
		cin>>t>>in>>im>>is;
		in--;im--;
		s[im].push_back(pii(t,(is==1?1:-1)));
	}
	rep(i,m)sort(all(s[i]));
	cin>>q;
	int ts,te;
	while(q--){
		cin>>ts>>te>>im;
		im--;
		int cnt=0,time=0,ans=0;
		rep(i,s[im].size()){
			if(s[im][i].sc>0){
				cnt++;
				if(cnt==1){
					time=min(te,max(ts,s[im][i].fs));
				}
			}
			else{
				cnt--;
				if(cnt==0){
					ans+=min(te,max(ts,s[im][i].fs))-time;
				}
			}
		}
		cout<<ans<<endl;
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;
	while(cin>>n>>m,n)solve(n,m);
}


Measured memory_bytes: 3336
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
int n, s, j, skip, nextskip, lis;
vector<int> a, sz, top, p, nextp;

int PatienceSorting(int nexti){
    int r = -1;
    int l = -1;
    if(p[0] == -1) r = 0;
    for(int i = 0; i < 2 * s; i++){
        top[i] = INF;
        sz[i] = 0;
    }
    for(int i = 0; i < n; i++){
        // filtering out irrelevant elements
        if(i < skip) continue;
        else if(r + 1 < p.size() && a[i] == p[r + 1]){
            r++;
            continue;
        }else if(r == -1 || a[i] < p[r] || (l >= j && a[i] > top[j])) continue;
        // push a[i] to the appropriate pile
        int h;
        if(l == -1 || a[i] > top[l]){
            l++;
            h = l;
        }else{
            h = lower_bound(top.begin(), top.end(), a[i]) - top.begin();
        }
        top[h] = a[i];
        sz[h]++;
        if(h == nexti){
            if(nextskip == -1) nextskip = i;
            nextp.push_back(a[i]);
        }
    }
    return l;
}

int main(){
    cin >> n;
    s = sqrt(n);
    j = 2 * s - 1;
    a.resize(n); sz.resize(2 * s); top.resize(2 * s);
    for(int i = 0; i < n; i++) cin >> a[i];
    p.push_back(-1);
    while(1){
        int l = PatienceSorting(-1);
        if(l < 2 * s - 1){
            lis += l + 1;
            break;
        }
        int nexti = -1;
        for(int i = 2 * s - 1; i >= s; i--){
            if(sz[i] <= s && sz[i] > 0){
                nexti = i;
                break;
            }
        }
        nextp.clear();
        nextskip = -1;
        PatienceSorting(nexti);
        p = nextp;
        skip = nextskip;
        lis += nexti + 1;
    }
    cout << lis << endl;
}


Measured memory_bytes: 3372
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, x, y, peri, ans;

int fun(int a, int b)
{
	int ret = 0;
	if (b - a <= peri / 2) {
		if (b <= a) {
			ret += a - b + 1;
		}
		int t1 = max(1, b - a);
		int t2 = min(peri / 2, b - 1);
		if (t2 >= t1) {
			ret += (t2 - t1 + 1) * 2;
			if (peri % 2 == 0 && t2 == peri / 2) ret--;
		}
	}
	return ret;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> x >> y;
	peri = y - x + 1;
	for (int i = 1; i < n; i++) {
		ans = 0;
		if (i <= peri / 2) {
			if (peri % 2 == 0 && i + i == peri) ans += peri / 2;
			else
				ans += peri;
		}
		int l1 = x - 1;
		if (l1 > 0)
			ans += fun(l1, i);
		int l2 = n - y;
		if (l2)
			ans += fun(l2, i);
		int l3 = x - 1 + n - y + 1;
		if (l1 > 0 && l2 > 0 && i <= l3 && i >= 3) {
			int t1 = max(i, l1 + 2);
			int t2 = min(l3, l1 - 1 + i);
			ans += t2 - t1 + 1;
		}
		cout << ans << E;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2);
        if(y%2==0)
         return (p*p)%hell;
        else
        return (x*((p*p)%hell))%hell;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    ll n;
    cin>>n;
   cout<<n*n*n;}

Measured memory_bytes: 3620
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 1; i <= N; ++i) {
		if (i % 2 == 0)continue;
		int cnt = 0;
		for (int j = 1; j * j <= i; ++j) {
			if (i % j == 0) {
				cnt++;
				if (j != i / j)cnt++;
			}
		}
		if (cnt == 8)ans++;
	}
	OUT(ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll mp[10];
vector<pair<P, P> > v;
ll ans = 0;
ll cou;
ll n, m, q;

void seica() {
	ll tmp = 0;
	REP(i, q){
		ll a = v[i].FI.FI;
		ll b = v[i].FI.SE;
		ll c = v[i].SE.FI;
		ll d = v[i].SE.SE;
		if(mp[b-1] - mp[a-1] == c)tmp += d;
	}
	ans = max(ans, tmp);
}

void dfs(int a, int b){
	mp[b] = a;
	if(b == n - 1){
		seica();
		return;
	}

	for(int i = a;i <= m;i++){
		dfs(i, b + 1);
	}
}

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

	cin >> n >> m >> q;
	REP(i, q){
		ll a, b, c, d;cin >> a >> b >> c >> d;
		v.EB(MP(a, b), MP(c, d));
	}

	dfs(1, 0);
	cout << ans << endl;

	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  vector<ll> b(n);
  rep(i, n) cin >> b[i];

  vector<ll> ans;
  while (b.size()) {
    bool ok = false;
    for (int i = b.size() - 1; i >= 0; --i) {
      if (b[i] == i + 1) {
        ans.push_back(b[i]);
        b.erase(b.begin() + i);
        ok = true;
        break;
      }
    }
    if (!ok) {
      puts("-1");
      return 0;
    }
  }

  for (int i = n - 1; i >= 0; --i) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 256
package main

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

func readLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func readChar(sc *bufio.Scanner) rune {
	return []rune(readLine(sc))[0]
}

func main() {
	dict := map[rune]rune {
		'A': 'T',
		'C': 'G',
		'T': 'A',
		'G': 'C',
	}

	sc := bufio.NewScanner(os.Stdin)
	c := readChar(sc)
	fmt.Println(string(dict[c]))
}


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

int main(){
  char A, B;
  cin >> A >> B;
  
  string ans = "123";
  ans.erase(remove(ans.begin(), ans.end(), A), ans.end());
  ans.erase(remove(ans.begin(), ans.end(), B), ans.end());
  
  cout << ans << endl;
}

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

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
	//freopen("input.txt", "r", stdin);
	
	int n; cin>>n;
	int a[n];
	for(int i=0; i<n; i++) cin>>a[i];
	
	vector<int > non_inc;
	non_inc.push_back(a[n-1]);
	
	for(int i=n-2; i>=0; i--)
	{
		if(a[i] >= non_inc.back())
			non_inc.push_back(a[i]);
		else if(a[i]<non_inc[0])
			non_inc[0] = a[i];
		else
		{
			auto it = upper_bound(non_inc.begin(), non_inc.end(), a[i]);
			*it = a[i];
		}
	}
	cout<<(int) non_inc.size();
}

Measured memory_bytes: 2168
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;
int gcd(ll a, ll b) { return (b % a == 0) ? a : gcd(b - a * (b / a), a); }
int main()
{
	ll i,j,k,t,n;
    cin>>n;
    ll a[n][3],dp[n][3];
    for(i=0;i<n;i++)
    {
    	for(j=0;j<3;j++){cin>>a[i][j];dp[i][j]=a[i][j];}
    }
    for(i=1;i<n;i++)
    {
    	for(j=0;j<3;j++)
    	{
dp[i][j]=a[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);     	}
    }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return 0;
}

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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	
	if(a==b) cout<<c<<endl;
	else if(b==c) cout<<a<<endl;
	else cout<<b<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


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

		 //br.readline(); = 入力された１行分を日本語変換して返してくれる。
		 String str = br.readLine();

		 /*配列の型(intとかStringとか) [] 配列名 = 配列を用意
		  *今回はstrAryって配列にstrを入れてる。
		  *str.split = splitってのはString内に用意されてるメソッド
		  *文字列を分割するときに使用。今回は空白で区切ってって仕様なので
		  *split(" ")としてます。*/
		 String[] strAry = str.split(" ");

		 /*おなじみの文字列から数値への変換。
		  *ただし今回は指定先が配列の何番って風になってる。*/
		 int a =  Integer.parseInt(strAry[0]);
		 int b =  Integer.parseInt(strAry[1]);

		 /*今回は条件分岐と出力の組み合わせ。
		  *if文を使って状況によって出力する文面を変えてます。*/
		 if(a < b){
			 System.out.println("a < b");
		 } else if(a > b){
			 System.out.println("a > b");
		 } else
			 System.out.println("a == b");
	}
}

Measured memory_bytes: 17084
#include <iostream>

using namespace std;

int main()
{
    char c;
    cin >> c;

    if(c == 'A')    cout << 'T';
    else if(c == 'T')   cout << 'A';
    else if(c == 'C')   cout << 'G';
    else if(c == 'G')   cout << 'C';

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int n = Integer.parseInt(str);

		for(int i=0; i<n; i++){
			System.out.println(dif(br.readLine()));
		}

	}

	static int dif(String st){
		char data[] = st.toCharArray();
		Arrays.sort(data);
		String big="",small="";
		int B,S;

		for(int i=0; i<data.length; i++){
			small += data[i];
		}

		for(int j=data.length-1; j>-1; j--){
			big += data[j];
		}

		B = Integer.parseInt(big);
		S = Integer.parseInt(small);

		return B-S;
	}
}

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

int main(){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    int res=0;
    for(int i=0; i<s.size(); i++) {
        res++;
        if(s[i]!=s[i+1]) {
            if(res%2==1) {
                cout<<"No";
                return 0;
            }
            res = 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() int {
	return scanInt(sc)
}

func resolve(n int) int {
	dp := make([]int, n+1)
	dp[0], dp[1] = 1, 1
	for i := 2; i <= n; i++ {
		dp[i] = dp[i-1] + dp[i-2]
	}
	return dp[n]
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}



Measured memory_bytes: 1124
#include<stdio.h>
#include<stdlib.h>

int compare_function(const void *a,const void *b) {
int *x = (int *) a;
int *y = (int *) b;
return *y - *x;
}

int main()
{
	long long int n,h;
	scanf("%lld %lld",&n,&h);
	long long int i;
	long long int weild[n],throwing[n];
	for (i=0;i<n;i++)
	{
		scanf("%lld %lld",&weild[i],&throwing[i]);
	}
	long long int maxweild=0,maxthrow=0,maxindex=-1;
	for (i=0;i<n;i++)
	{
		if (weild[i]>maxweild)
			maxweild = weild[i];
	}
	int flag=1;
	qsort(throwing,n,sizeof(long long int),compare_function);	
	long long int attack=0;
	while (h>0)
	{
		
		for (i=0;throwing[i]>=maxweild && h>0 && i<n;i++)
		{
			attack++;
			h -= throwing[i];
		}
		if (h<=0)
			flag=0;
		if (flag) {
			long long int temp = h/maxweild;
			attack += temp;
			if (h%maxweild>0) {
				attack++;
			}
			h = 0;
		}
	}
	printf("%lld",attack);
	return 0;
	
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	ll a,b,c;cin>>a>>b>>c;
	if(c-a-b<0)puts("No");
	else if(4*a*b<(c-a-b)*(c-a-b))puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
a,b,k = map(int, input().split())
a_ = min(a+k, b)
b_ = max(b-k+1, a)
s = list(range(a, a_)) + list(range(b_, b+1))
s = set(s)
s = list(s)
s.sort()
for s_ in s:
    print(s_)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define NFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); --i)
#define endl "\n"
#define mp make_pair
#define X first
#define Y second
#define inf 1e9
#define mod 1000000007
#define mod1 998244353
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()
#define sz(x) int(x.size())
// #define lli int
typedef long long int lli;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<lli,lli> pll;
typedef vector<lli> vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef complex <long double> complex_t;
const long double PI = acos((long double)-1.0);

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

vector<pair<ll,ll>> points;

ll power(ll b, ll e) {
    if (e == 0) return 1LL;
    if (e == 1) return b%mod1;
    ll p = power(b, e/2);
    p = (p*p)%mod1;
    if (e%2 == 1) p = (p * b)%mod1;
    return p;
}

int main() {
    int n; cin >> n;
    FOR(i, 1, n) {
        ll x1, y1; cin >> x1 >> y1;
        points.pb(mp(x1, y1));
    }
    ll totAnswer = power(2, n);
    ((totAnswer -= (n+1)) += mod1) %= mod1;
    FOR(i, 0, n-2) {
        FOR(j, i+1, n-1) {
            int count1 = 0;
            FOR(k, j+1, n-1) {
                if ((points[i].second - points[k].second)*(points[j].first - points[k].first) == (points[j].second - points[k].second)*(points[i].first - points[k].first)) {
                    count1 ++;
                }
            }
            totAnswer = ((totAnswer - power(2, count1)) + mod1)%mod1;
        }
    }
    cout << totAnswer << endl;
return 0;}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;

    int ans = 0;
    int ans2=0;
    ans2=2*c*(max(x,y));

    if(x>y){
        ans+=a*(x-y);
        x = y;
    }
    else if(y > x){
        ans += b*(y-x);
        y = x;
    }

    if((a+b)>2*c){
        ans += x*2*c;
    }
    else{
        ans+= (a+b)*x;
    }

    cout << min(ans,ans2);

    

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<utility>
#include<climits>
#include<set>
using namespace std;
#define ll long long

void solve(){
	int x,y;cin>>x>>y;
	if(y%2 or 4*x<y or 2*x>y)
	{
		cout<<"No";
		return;
	}
	cout<<"Yes";

}
int main(){ 
	ios_base::sync_with_stdio(false);
	    cin.tie(0);
	    cout.tie(0);
	    
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);
	    freopen("output.txt","w",stdout);
	#endif


	    int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
//          cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;

}


Measured memory_bytes: 3604
X, Y, A, B, C = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
p.sort()
q.sort()
r.sort(reverse=True)
p = p[A - X:]
q = q[B - Y:]
pi = 0
qi = 0
for v in r:
    if p[pi] < v or q[qi] < v:
        if p[pi] < q[qi]:
            p[pi] = v
            pi = min(pi + 1, X - 1)
        else:
            q[qi] = v
            qi = min(qi + 1, Y - 1)
    else:
        break
print(sum(p) + sum(q))

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if ( A + B > C + D) {
    cout << "Left" << endl;
  }
  if ( A +B == C + D)  {
    cout << "Balanced" << endl;
}
  if ( A+B < C+D) {
    cout << "Right" << endl;
}
}
    


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>

void view(const std::vector<T> &v)
{
#ifndef ONLINE_JUDGE
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
#endif
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

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

    // c > b > a
    rep(i, k)
    {
        if (a >= b)
        {
            b *= 2;
            continue;
        }
        if (b >= c)
        {
            c *= 2;
            continue;
        }
    }
    if (b > a && c > b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

int main(){
  string s;
  cin >> s;
  int len = s.length();
  for(int i=0; i<len; i++){
    if(i%2 == 1){
      if(s.substr(i, 1) != "L" && s.substr(i, 1) != "U" && s.substr(i, 1) != "D"){
      	cout << "No" << endl;
        return 0;
      }
    }else {
      if(s.substr(i, 1) != "R" && s.substr(i, 1) != "U" && s.substr(i, 1) != "D"){
      	cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
from itertools import groupby
from collections import deque

N, K = [int(x) for x in input().split()]
blocks = [[tp, list(people)] for tp, people in groupby(input())]

ans = 0
cur = 0
stand = 0
target = deque()

for tp, people in blocks:
    if tp == '0':
        stand += 1
        if stand > K:
            removed = target.popleft()
            cur -= len(removed[1])
            if removed[0] == '1' and len(target) > 0:
                removed = target.popleft()
                cur -= len(removed[1])

    target.append([tp, people])
    cur += len(people)
    ans = max(ans, cur)

print(ans)

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

typedef long long ll;
#define PI 3.1415926535897932384626433
#define MOD 1000000007

int main(){
    ll n;
    cin >> n;
    ll d[n];
    for (ll i = 0; i < n; i++){
        cin >> d[i];
    }
    sort(d, d + n);

    int cen = n / 2;
    int l = d[cen-1], r = d[cen];
    if(r == l){
        cout << 0 << endl;
        return 0;
    }
    cout << r - l << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)
 
const ll mod = (ll)1e9+7;
const ll maxn = (ll)3e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;
 
ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};
 
bool dp[100005][72];
ll n;
ll ans = inf;
void DP(ll d , ll one){
    //cout << d << ' ' << one << '\n'; 
	if(one > 70) return;
	if(d == 0){
		ans = min(ans , one);
		return;
	}
	
	if(dp[d%n][one] == 1) return;
	dp[d%n][one] = 1;
	DP( (d*10)%n , one);
    DP((d*10 + 1)%n , one+1);
	return;
}
vector < ll > v;
 
void solve(){
 
	cin >> n;
	mem(dp , 0);
	DP(1 , 1);
	cout << ans << '\n';
	
	
	return;
}
 
 
int main() {
 
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
 
    return 0;
}

Measured memory_bytes: 171164
K = int(input())
ans_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
nex = ans_list.copy()


def resp(n):
    if n == "0":
        return ["0", "1"]
    elif n == "9":
        return ["8", "9"]
    else:
        n_tmp = int(n)
        return [n, str(n_tmp + 1), str(n_tmp - 1)]


for j in range(1000):
    tmp = nex.copy()
    nex = []
    for i in tmp:
        nex += [i + x for x in resp(i[-1])]
    ans_list += nex
    if len(ans_list) > 10 ** 5:
        break

ans_list = list(map(int, ans_list))
ans_list.sort()
print(ans_list[K - 1])


Measured memory_bytes: 96160
import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
a,b = rl()
c=a%4
d=b%4
ans=0
for i in range(4-c):
    ans^=a+i
for i in range(d+1):
    ans^=b-i
print(ans)

Measured memory_bytes: 9248
from decimal import *
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m

    return f(int(math.sqrt(n) * (1 + 1e-10)))



def main():
    a, b, c = MI()
    getcontext().prec = 20

    if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 59500
// Problem : A - Frog 1
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);


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

Measured memory_bytes: 1792
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut xs: Vec<i64> = sc.vec(n);

    for i in (1..n).rev() {
        if xs[i] < 0 {
            xs[i] *= -1;
            xs[i - 1] *= -1;
        }
    }

    if xs[0] >= 0 {
        put!(xs.iter().sum::<i64>());
    } else {
        xs[0] *= -1;
        put!(xs.iter().sum::<i64>() - xs.iter().min().unwrap() * 2);
    }

}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 12256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();
            var sharp = 0;
            var ans = 0;
            
            for (var i = 0; i < N; i++) {
               if (S[i] == '#') {
                   sharp++;
               } else {
                  if (sharp > 0) {
                     sharp--;
                     ans++; 
                  }
               }
            }
            
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13240
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>

#define big ((long long)(1e9)+7)

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
  string s;
  cin >> s;
  int a = 0;
  int b = 0;
  for(int i = 0;i < s.size();i++)
  {
    if(s.at(i) == 'A')
    {
      a++;
    }
    if(s.at(i) == 'B')
    {
      b++;
    }
  }
  if(a == 2 || b == 2)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;

class NoChange {
public:
        void solve(std::istream &in, std::ostream &out) {
                long long n, k;
                in >> n >> k;
                long long arr[n];
                long long dp[n];
                memset(dp, 0, sizeof(dp));
                for (int i = 0; i < n; i++) {
                        in >> arr[i];
                        if (i)
                                dp[i] = INT_MAX;
                        for (int j = i - 1; j >= 0 && j > i - k - 1; j--) {
                                dp[i] = min(dp[i], dp[j] + abs(arr[i] - arr[j]));
                        }
                }
                out << dp[n - 1] << "\n";
        }
};

int main() {
        NoChange solver;
        std::ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        std::istream &in(std::cin);
        std::ostream &out(std::cout);
        int t = 1;
        for (int i = 0; i < t; ++i) {
                solver.solve(in, out);
        }
        return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<233<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Love) for(int Kanna=0;Kanna<n;Kanna++)cout<<Hashimoto[Kanna]<<(Kanna==Love-1?"\n":" ");
#define FOR(Love,Hashimoto,Kanna) for(int Love=Hashimoto;Love<Kanna;Love++)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define inf (int)1e9
#define linf (ll)1e18
#define mod (inf+7)

int n;
pair<pii,int> a[111111];
set<pair<ll,pii > > e;
int f[111111];
int F(int a){
	return f[a]==a?a:f[a]=F(f[a]);
}
ll dist(int x,int y){
	return min(abs(a[x].first.first-a[y].first.first),abs(a[x].first.second-a[y].first.second));
}

int I_Love_Hashimoto_Kanna() {
  fastio;
  FOR(i,0,111111)f[i]=i;
  cin>>n;
  FOR(i,0,n){
  	cin>>a[i].first.first>>a[i].first.second;
  	a[i].second=i;
	}
	FOR(tot,0,2){
	  sort(a,a+n);
	  FOR(i,0,n-1){
      e.insert({dist(i,i+1),{a[i].second,a[i+1].second}});
			swap(a[i].first.first,a[i].first.second);
	  }
	  swap(a[n-1].first.first,a[n-1].first.second);
	}
	ll ans=0;
	for(set<pair<ll,pii > >::iterator itr=e.begin();itr!=e.end();itr++){
		int a,b,c;
		pair<ll,pii > edge=*itr;
		c=edge.first;
		a=edge.second.first;
		b=edge.second.second;
		a=F(a);
		b=F(b);
		if(a==b){
			continue;
		}
		ans+=c;
		f[a]=b;
	}
	cout<<ans<<endl;
	
  return 0;
}



Measured memory_bytes: 14464
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);
            if (A == B)
            {
                Console.WriteLine(A + B);
            }
            else
            {
                var max = Math.Max(A, B);
                Console.WriteLine(max + max - 1);
            }
        }

    }
}


Measured memory_bytes: 13140
#include<stdio.h>

int n,a[50];

int solve(int i,int m){
  int res;
  if(m==0)return 1;
  if(i>=n)return 0;
  res = solve(i+1,m) ||  solve(i+1,m - a[i]);
  return res;
}

int main(){
  int q,M,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf(" %d",&a[i]);
  scanf(" %d",&q);
  for(i=0;i<q;i++){
    scanf(" %d",&M);
    if(solve(0,M))printf("yes\n");
    else printf("no\n");
}
  return 0;
}
 



Measured memory_bytes: 2108
#include <bits/stdc++.h>
    #define HAR BAR LAGTA HAI APUN HI J BHAGWAAN HAI!!
    #define UTSAV  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #define ll long long int
    #define MAX 1e9
    #define MIN -1e9
    #define md 1000000007
    #define pb push_back
    #define all(x) (x).begin(), (x).end()
    #define debug(x) cerr<<#x<<'='<<(x)<<endl;
    #define output(x) cout << ( x ? "YES" : "NO" ) << '\n' ;
    #define mxn 200005
    using namespace std;
    int main()
    {
        UTSAV
        int n;
        cin>>n;
        int a[n],b[n];
        int c = 0;
        bool ok = false;
        for(int i=0;i<n;i++){
            cin>>a[i]>>b[i];
            if(a[i]==b[i]) c++;
            else{
                if(c>2) ok = true;
                c=0;
            }
        }
        if(c>2) ok = true;
        if(ok) cout<<"Yes"<<endl;
        else cout<<"No";
        return 0;
    }


Measured memory_bytes: 3648
#include <stdio.h>
int msn[100000];
int msp[50000];
int main(void){
	int i,j,c,n,N;
	msn[0]=6;
	for(i=1;7*i+6<300000;i++){
		msn[2*i-1]=7*i+1;
		msn[2*i]=7*i+6;
	}
	N=2*i-1;
	c=0;
	for(i=0;i<N;i++){
		for(j=0;msn[j]*msn[j]<=msn[i];j++){
			if(msn[i]%msn[j]==0){
				break;
			}
		}
		if(msn[j]*msn[j]>msn[i]){
			msp[c++]=msn[i];
		}
	}
	while(1){
		scanf("%d",&n);
		if(n==1){
			break;
		}
		printf("%d:",n);
		for(i=0;i<c;i++){
			if(n%msp[i]==0){
				printf(" %d",msp[i]);
			}
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1084
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,C;
	cin>>N>>C;
	vector<vector<int> > cost(C,vector<int>(C));
	for(int i=0;i<C;++i){
		for(int j=0;j<C;++j){
			cin>>cost[i][j];
		}
	}
	vector< vector<int> > color(3,vector<int>(C,0));
	for(int r=0;r<N;++r){
		for(int c=0;c<N;++c){
			int koko;
			cin>>koko;
			int ter=(r+c)%3;
			color[ter][koko-1]++;
		}
	}
	int ans = INF;
	for(int a=0;a<C;++a){
	for(int b=0;b<C;++b){
		if(a==b)continue;
		for(int c=0;c<C;++c){
			if(a==c||b==c)continue;
			int res = 0;
			for(int d=0;d<C;++d){res += color[0][d]*cost[d][a];}
			for(int d=0;d<C;++d){res += color[1][d]*cost[d][b];}
			for(int d=0;d<C;++d){res += color[2][d]*cost[d][c];}
			ans = min(ans,res);
		}
	}}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
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<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

ll mod_pow(ll x, ll y) {
  ll res = 1LL;
  while (y > 0) {
    if ((y & 1)) {
      res = res * x % MOD;
    }
    x = x * x % MOD;
    y >>= 1;
  }
  return res;
}

ll n, ans;
vll a;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    a.resize(n);
    rep(i, 0, n) cin >> a[i];
    sort(ALL(a));
    rep(i, n % 2, n) {
      if (a[i] != a[i+1]) {
        cout << 0 << endl;
        return 0;
      }
      i++;
    }
    if (n % 2) ans = mod_pow(2, (n-1)/2);
    else ans = mod_pow(2, n/2);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
 
int main(){
  long long a, b, x, i, count = 0;
  
  scanf("%lld %lld %lld", &a, &b, &x);
  
  a = (a%x == 0) ? (a/x):(a/x + 1);
  b = b/x;
  for(i = a; i <= b; i++){
    count++;
  }
  
  printf("%lld\n", count);
  
  return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{

	int N;
	cin >> N;
	vecs(S)
		map<string, ll> K;
		fx(N) {
		string s;
		cin >> s;
		sorts(s)
			pb(S, s)
			K[s]++;
	}

		ll ans = 0;
	fx(N) {
		ans += K[S.at(x)] * (K[S.at(x)] - 1) / 2;
		K[S.at(x)] = 0;
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 16628
n = int(input())
a = list(map(int, input().split()))

ans = 'APPROVED'
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            ans = 'DENIED'
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main() {
  int N,K;
  cin >> N >> K;
  
  vector<double> P(N);
  for(int i=0;i<N;i++){
    cin >> P.at(i);
    P.at(i)=(P.at(i)+1)/2;
  }
  
 
  double sum=0;
  double result = 0;
  for(int i=0; i<N-K+1; i++){
    if(i==0){
       for(int j=0; j<K; j++){
         sum+=P.at(j);
       }
    }else{
      sum=sum-P.at(i-1)+P.at(i+K-1);
    }
    result=max(result,sum);
  }
  
  cout << fixed << setprecision(15) << result << endl;
}

Measured memory_bytes: 1792