akhauriyash/Code-Regression huggingface dataset:
n, k, q = map(int, input().split())
# n:参加人数
# k:初期ポイント
# q:正解の回数

# 最初のポイント初期化
menber_point = [k for _ in range(n)]

# 正解者リスト
correct_answer = [int(input()) for _ in range(q)]

# 正解したらポイント加算してあげる
for value in correct_answer:
    menber_point[value-1] += 1

# 正解の回数以下なら敗退判定
for mem in menber_point:
    if mem > q:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 15496
#include <vector>
#include <iostream>
#include <algorithm>

using std::cin;
using std::cout;
using std::swap;
using std::vector;
using std::for_each;

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for_each(v.begin(),v.end(),[](int &_e){cin >> _e;});
	int q;
	cin >> q;
	while (q--) {
		int b;
		int e;
		int t;
		cin >> b >> e >> t;
		for (int k = 0;k != e-b;++k) {
			swap(v[b+k],v[t+k]);
		}
	}
	int i = 1;
	for_each(v.begin(),v.end(),[&i,n](int _e){cout << _e << (i++ == n ? "\n" : " ");});
}


Measured memory_bytes: 3100
from heapq import heappush, heappop
Q = int(input())
X = [list(map(int, input().split())) for _ in range(Q)]

left_q = []
right_q = []
q_sum = 0
const = 0

for q, *w in X:
    if q == 1:
        x, y = w
        const += y
        
        if len(left_q) == 0 or x <= -left_q[0]:
            heappush(left_q, -x)
            q_sum += -left_q[0] - x
        else:
            heappush(right_q, x)
            q_sum += left_q[0] + x
            
        if len(right_q) > len(left_q):
            q_sum += -right_q[0] - left_q[0]
            heappush(left_q, -heappop(right_q))
        
        if len(left_q) - len(right_q) == 2:
            heappush(right_q, -heappop(left_q))
    else:
        print(-left_q[0], q_sum + const)


Measured memory_bytes: 110424
#[cfg(debug_assertions)]
include! {"./debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

macro_rules! read {
    ([$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ([$t:ident]) =>
        (rl().split_whitespace().map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    (_, [$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!(_, [$t])).collect::<Vec<_>>());
    (_, [$t:ident]) =>
        (rl().split_whitespace().skip(1).map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    ($($t:ident),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ($t:ident) => (read_type!(rl(), $t));
    ($($t:ident),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(read_type!(w.next().unwrap(), $t)),*)
    }};
}

macro_rules! read_type {
    ($s:expr, chars) => {
        $s.chars().collect::<Vec<char>>()
    };
    ($s:expr, usize1) => {
        read_type!($s, usize) - 1
    };
    ($s:expr, $t:ty) => {
        $s.parse::<$t>().unwrap()
    };
}

fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

////////////////////////////////////////////////////////////////////////////////

fn main() {
    let (n, k) = read!(usize, usize1);
    let mut s = read!(chars);

    s[k] = (s[k] as u8 + b'a' - b'A') as char;

    println!("{}", s.into_iter().collect::<String>());
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string.h>
#include <set>
using namespace std;
multiset<int>d;
int main(void){
   int n,m;
   cin>>n;
   for(int i=0;i<n;i++){
       int num;
       cin>>num;
       d.insert(num);
   }
   cin>>m;
   for(int i=0;i<m;i++){
       int num;
       cin>>num;
       if(d.find(num)==d.end()){
           cout<<"NO"<<endl;
           return 0;
       }
       d.erase(d.find(num));
   }
   cout<<"YES"<<endl;
   return 0;
}

Measured memory_bytes: 9600
use proconio::*;
fn main(){
input!{t:usize}
for _ in 0..t{
input!{n:usize,mut a:[(usize,i64,i64);n]}
let mut z=0;
let mut b=vec![];
let mut c=vec![];
for(_,l,r)in a.iter(){z+=std::cmp::min(l,r);}
for(k,l,r)in a{if l>=r{b.push((k,r-l))}else{c.push((n-k,l-r))}}
for mut a in vec![b,c]{
a.sort();
let mut s=std::collections::BinaryHeap::new();
let mut i=0;
while i<a.len()&&a[i].0==0{i+=1}
for j in 1..=n{
while i<a.len()&&a[i].0==j{s.push(a[i].1);i+=1}
while s.len()>j{s.pop();}
}
z-=s.iter().sum::<i64>();
}
println!("{}",z);
}
}

Measured memory_bytes: 13768
#include<bits/stdc++.h>
using namespace std;
int main(){
  int tmp;
  cin>>tmp;
for(int i=1;i<=9;i++){
  for(int j=1;j<=9;j++){
    if(tmp==i*j){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
}
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<lint,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
bool su[114514];
lint a[114514];
vector<lint> so;
map<lint,int> num;
int main()
{
	int n;
	memset(su,false,sizeof(su));
	REP(i,2,100100){
		if(su[i]) continue;
		so.pb(i);
		for(int j=i*2;j<114510;j+=i) su[j]=true;
	}
	/*cout<<so.size()<<endl;
	rep(i,so.size()){
		if(so[i]*so[i]*so[i]>11451419190){
			cout<<i<<endl;break;
		}
	}*/
	//cout<<so[0]<<endl;
	scanf("%d",&n);
	rep(i,n){
		scanf("%lld",&a[i]);
		//cout<<a[i]<<endl;
	}
	rep(i,n){
		vector<pint> p;
		for(int j=0;j<so.size();j++){
			lint t=so[j]*so[j]*so[j];
			if(t>a[i]) break;
			while(a[i]%t==0) a[i]/=t;
		}
		//cout<<a[i]<<endl;
		num[a[i]]++;
	}
	int out=n;if(num[1]>0) out-=num[1]-1;
	num[1]=0;
	REP(i,2,114514){
		lint x=i,y=(lint)i*i*i;
		vector<lint> p;
		for(int j=0;so[j]*so[j]<=x && j<so.size();j++){
			int t=0;
			while(x%so[j]==0) x/=so[j],t++;
			if(t>1){x=-1;break;}
			if(t>0) p.pb(so[j]);
		}
		if(x<0) continue;
		if(x>1) p.pb(x);
		int m=p.size();//cout<<x<<' '<<m<<endl;
		REP(j,0,(1<<m)){
			lint t=1;
			rep(k,m){
				t*=p[k];
				if((j&(1<<k))) t*=p[k];
			}
			//if(t<10 && y/t<10) cout<<t<<' '<<y/t<<endl;
			//out+=max(num[t],num[y/t]);
			out-=min(num[t],num[y/t]);
			num[t]=num[y/t]=0;
		}
	}
	/*map<lint,int>::iterator it=num.begin();
	while(it!=num.end()){
		out+=(*it).se;it++;
	}*/
	cout<<out<<endl;
}


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

#define fr(i,b,e) for(int i=(b); i!=(e); ++i)
#define rep(i,e) for(int i=0; i!=(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long int ll;
using graph = vector<vector<int>>;
using edgedp = vector<vector<pair<int,ll>>>;
constexpr int INF=1000000;
//constexpr int MOD=998244353;
constexpr int MOD=1e9+7;

int calc_pw(ll n, ll p){
    if(n/p==0){
        return 0;
    }else{
        return calc_pw(n/p,p)+1;
    }
}


int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll x;
    cin >> x;
    ll cnt=0;
    ll m=100;
    ll add;
    while(m<x){
        m+=m/100;
        ++cnt;
    }
    cout << cnt << endl;
}   




Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;

class Unionfind
{
    int root[100002], rank[100002];
    
public:
    Unionfind(int n){
        for(int i = 0; i < n; i++){
            root[i] = i;
            rank[i] = 0;
        }
    }
    
    int find(int i){
        if(root[i] == i) return i;
        return root[i] = find(root[i]);
    }
    
    bool same(int i, int j){
        return find(i) == find(j);
    }
    
    void unite(int i, int j){
        if(same(i, j)) return;
        if(rank[i] < rank[j]) root[i] = j;
        else{
            root[j] = i;
            if(rank[i] == rank[j]) rank[i]++;
        }
    }
};

int main()
{
    int n;
    cin >> n;
    int x[100002], y[100002];
    P px[100002], py[100002];
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        px[i] = P(x[i], i);
        py[i] = P(y[i], i);
    }
    sort(px, px + n);
    sort(py, py + n);
    vector<P> v[100002];
    for(int i = 1; i < n; i++){
        v[px[i - 1].second].push_back(P(px[i].first - px[i - 1].first, px[i].second));
        v[px[i].second].push_back(P(px[i].first - px[i - 1].first, px[i - 1].second));
    }
    for(int i = 1; i < n; i++){
        v[py[i - 1].second].push_back(P(py[i].first - py[i - 1].first, py[i].second));
        v[py[i].second].push_back(P(py[i].first - py[i - 1].first, py[i - 1].second));
    }
    priority_queue<P, vector<P>, greater<P>> que;
    bool used[100002];
    fill(used, used + n, false);
    int l = v[0].size();
    for(int i = 0; i < l; i++){
        que.push(v[0][i]);
    }
    int ans = 0;
    used[0] = true;
    while(que.size()){
        P now = que.top();
        que.pop();
        if(!used[now.second]){
            used[now.second] = true;
            ans += now.first;
            l = v[now.second].size();
            for(int i = 0; i < l; i++){
                P next = v[now.second][i];
                if(!used[next.second]) que.push(next);
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
  int a, b, c;
  cin>>a>>b>>c;
  if (a+b+c <= 21) puts("win"); else puts("bust");
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

ll N,M,now,A,ans=1,mod=1000000007,bef=-1;
ll fi[100100];

bool flag=false;

int main(){
    cin>>N>>M;
    fi[0]=1;
    fi[1]=1;
    rep(i,100010){
        fi[i+2]=(fi[i+1]+fi[i])%mod;
    }
    rep(i,M){
        cin>>A;
        if(A-bef<2){
            flag=true;
            break;
        }
        bef=A;
        ans=(ans*fi[A-1-now])%mod;
        now=A+1;
    }
    if(flag){
        out(0);
        return 0;
    }
    ans=(ans*fi[N-now])%mod;
    out(ans);


    
    
}


Measured memory_bytes: 1024
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	int n, m;cin >> n >> m;
	vi ass(m);
	int sum = 0;
	forn(i, m) cin >> ass[i], sum += ass[i];
	if(n >= sum) cout << (n - sum);
	else cout << -1;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3664
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const [a, b] = input.split(" ").map(Number);

  if(a % 3 === 0 || b % 3 === 0 || (a + b) % 3 === 0) {
    console.log("Possible");
  } else {
    console.log("Impossible");
  }
}

Measured memory_bytes: 7372
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <tuple>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    //    ifstream in("input.txt");
    //    cin.rdbuf(in.rdbuf());
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    
    int num = 0;
    rep(i, 4)
    {
        if (s[i] == '+') ++num;
        else --num;
    }
    
    cout << num << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d;
  int m,n,l;
  cin>>a>>b>>c>>d;
  m=a-b;
  n=b-c;
  l=a-c;
  if(abs(m)<=d && abs(n)<=d || abs(l)<=d)
    cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3596
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */

    //#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;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      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, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(int i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(int i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(int i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    #define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    #define te  ll ti;   cin >> ti;  while(ti--) solve();  
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 1224;

    void solve(){
      ll n, k;
      cin >> n >> k;
      ll a[n+10], dp[n+10];
      a[0] = 0;
      repA(i, 1, n) cin >> a[i];
      ll s = 1e17;
      repA(i, 1, n-k+1) {
      s = min(s, min(abs(a[i]), abs(a[i+k-1])) + a[i+k-1] - a[i]);
      }
      cout << s << endl;
    }

    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      //te 
      solve();
      return 0;
    }       

Measured memory_bytes: 1024
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

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

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

template <class T>
inline istream& operator>> (istream &in, vector<T> &vec) {
    for (auto &e : vec) in >> e;
    return in;
}

inline void read() {}

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

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

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

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

    string s;
    read(s);

    string k = "";
    while (k.length() < s.length()) {
        k += "hi";
    }
    print((k == s) ? "Yes" : "No");

    return 0;
}


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

for i in range(m+1):
    for j in range(n+1):
        #print((n - j) * i + (m - i) * j)
        if (n - j) * i + (m - i) * j == k:
            print("Yes")
            exit()

print("No")

Measured memory_bytes: 3060
program main
  implicit none

  integer(8) :: a, b, c

  read(*,*) a, b, c

  if (mod(a,2) == 0 .or. mod(b,2) == 0 .or. mod(c,2) == 0) then
     write(*,*) 0

  else
     write(*,*) min(a*b, b*c, c*a)

  end if
  stop
  
end program main


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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void) {
	int n, i, j, a[100003], s[3] = {}, t = 0, l, y;
	ll ans = 1;
	const int mod = 1e9 + 7;

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

	for (i = 0; i < n; i++) {
		l = 0;
		for (j = 0; j < 3; j++) {
			if (s[j] == a[i]) {
				if (l == 0) y = j;
				l++;
			}
		}
		if (l == 0) {
			cout << 0 << endl;
			return 0;
		}
		ans = ans * l % mod;
		s[y]++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int32_t;  using i64 = int64_t;  using str = string;
using u32 = uint32_t; using u64 = uint64_t; using usize = size_t;
using f64 = double_t; template <typename T> using vec = vector<T>;
#define times(n, i) for (i64 i = 0; i < (n); ++i)
#define range(n, m, i) for (i64 i = (n); i < (m); ++i)
#define upto(n, m, i) for (i64 i = (n); i <= (m); ++i)
#define downto(n, m, i) for (i64 i = (n); i >= (m); --i)
#define foreach(xs, x) for (auto &x : (xs))
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define maximum(xs) (*max_element(all(xs)))
#define minimum(xs) (*min_element(all(xs)))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
const i64 MOD = 1000000007;

i32 n, m;
i32 a[100000];

i32 main()
{
    cin >> n >> m;
    
    bool ok = false;
    i32 last = -1;
    times(n, i) {
        cin >> a[i];
        if (i > 0) {
            if (a[i] + a[i-1] >= m) {
                last = i;
                ok = true;
            }
        }
    }

    if (!ok) {
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;

    upto(1, last-1, i) {
        cout << i << endl;
    }
    downto(n-1, last, i) {
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 1152
class Node:
    def __init__(self,p,l,r):
        self.parent = p
        self.left = l
        self.right = r

def preorder(u):
    print u,
    if tree[u].left != -1:
        preorder(tree[u].left)
    if tree[u].right != -1:
        preorder(tree[u].right)

def inorder(u):
    if tree[u].left != -1:
        inorder(tree[u].left)
    print u,
    if tree[u].right != -1:
        inorder(tree[u].right)

def postorder(u):
    if tree[u].left != -1:
        postorder(tree[u].left)
    if tree[u].right != -1:
        postorder(tree[u].right)
    print u,



n = int(raw_input().strip())
tree = {}
for i in range(n):
    nid, left, right = map(int, raw_input().strip().split(' '))
    if not nid in tree: tree[nid] = Node(-1,left,right)
    else:
        tree[nid].left = left
        tree[nid].right = right
    if not left == -1:
        if not left in tree: tree[left] = Node(nid,-1,-1)
        else: tree[left].parent = nid
    if not right == -1:
        if not right in tree: tree[right] = Node(nid,-1,-1)
        else: tree[right].parent = nid

r = -1
for i in range(len(tree)):
    if tree[i].parent == -1:
        r = i
        break


print "Preorder"
print "",
preorder(r)
print
print "Inorder"
print "",
inorder(r)
print
print "Postorder"
print "",
postorder(r)
print

Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using P = pair<int, int>;

#define INFTY 2001

int n, x, y;
vector<vector<int>> route, mindis;

void bfs();

int main(){
    cin >> n >> x >> y;
    //vector<vector<int>> mindis;
    vector<int> tmp(n, INFTY), tmp2;
    rep(i, n){
        mindis.push_back(tmp);
        route.push_back(tmp2);
        mindis[i][i] = 0;
    }

    rep(i, n-1){
        //mindis[i][i+1] = 1;
        //mindis[i+1][i] = 1;
        route[i].push_back(i+1);
        route[i+1].push_back(i);
    }
    //mindis[x-1][y-1] = 1;
    //mindis[y-1][x-1] = 1;
    route[x-1].push_back(y-1);
    route[y-1].push_back(x-1);

    bfs();

    vector<int> count(n, 0);

    rep(i, n-1){
        rep2(j, i+1, n){
            count[mindis[i][j]]++;
        }
    }

    rep2(i, 1, n){
        cout << count[i] << endl;
    }

    // rep(i, n){
    //     rep(j, n){
    //         cout << mindis[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    return 0;
}

void bfs(){
    queue<int> q;
    rep(i, n){
        rep(j, route[i].size()){
            q.push(route[i][j]);
        }
        int cnt=1;
        while(!q.empty()){
            int s_size = q.size();
            int c;
            rep(j, s_size){
                c = q.front();
                q.pop();
                if(mindis[i][c]==INFTY/*||mindis[i][c]>cnt*/){
                    mindis[i][c] = cnt;
                    //mindis[c][i] = cnt;
                    int r_size = route[c].size();
                    rep(k, r_size)
                    {
                        if (mindis[i][route[c][k]] == INFTY/*||mindis[i][route[c][k]] > cnt)&& i<route[c][k]*/){
                            q.push(route[c][k]);
                            //cout << i << " : " << c << " : " << route[c][k] << endl;
                        }
                    }
                }
                
            }
            //p = c;
            cnt++;
        }
    }
}

Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,result;
    N=0;
    double num=0;
    double second_num=0;
    result=0;
    vector<int> vec;
    cin >> N;
    vec.resize(N);
    for (int i=0;i<N;i++){
        cin >> vec[i];
        num+=vec[i];
    }
    second_num=num/N;
    second_num=round(second_num);
    for (int i=0;i<N;i++){
        result=result+(vec[i]-second_num)*(vec[i]-second_num);
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, t) for(int i = 0; i < t; i++)
#define INF (1 << 30)

int main()
{
    string s;
    string tmp;
    int ans = INF;
    cin >> s;
    for (int start_itr = 0; start_itr + 2 < s.size(); start_itr++)
    {
        tmp = s.substr(start_itr, 3);
        if (abs(atoi(tmp.c_str()) - 753) < ans)
            ans = abs(atoi(tmp.c_str()) - 753);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
  while (1) {
    int n, S; cin >> n >> S;
    if (n == 0 && S == 0) break;
    vector<int> vec;
    for (int i = 0; i < n; i++) {
      int temp; cin >> temp;
      vec.push_back(temp);
    }
    sort(vec.begin(), vec.end());
    int ans = 0;
    for (int i = 0; i < n-1; i++) {
      if (vec[i] >= S) {
        ans += n-i-1;
      } else {
        vector<int>::iterator itr = vec.begin();
        advance(itr, i+1);
        ans += distance(lower_bound(itr, vec.end(), S-vec[i]+1), vec.end());
      }
    }
    cout << ans << endl;
   }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main()
{
	int n, i, j, k, l;
	int a[1000];
	
	scanf("%d", &n);

	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);

	for (i = 0; i < n; i++)
	{
		k = a[i];
		j = i - 1;
		while (j >= 0 && a[j] > k)
		{
			a[j + 1] = a[j];
			j--;
			a[j + 1] = k;
		}
		for (l = 0; l < n; l++)
		{
			printf("%d", a[l]);
			if (l != n - 1)
				putchar(' ');
		}
		putchar('\n');
	}


	return 0;
}


Measured memory_bytes: 2060
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	fib = [0,1,1,2]
	for i in range(3,10**5+100):
		fib.append(fib[i-1]+fib[i])
	n,m = map(int,input().split())
	last = 0
	ans = 1
	a =  []
	for i in range(m):
		a.append(int(input()))
	for t in a:
		ans *= fib[t-last]
		last =  t+1
	ans *= fib[n-last+1]
	print(ans%(10**9+7))


def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Measured memory_bytes: 491120
function Main (input) {
  const inputs = input.split(/\s/g).filter((value) => value).map((value) => parseInt(value));
  const prices = {
    A: inputs[0],
    B: inputs[1],
    AB: inputs[2]
  };
  const nums = {
    A: inputs[3],
    B: inputs[4]
  };
  const patterns = [
    // そのまま買う
    Object.keys(nums).map((key) => nums[key] * prices[key]).reduce((prev, current) => prev + current),
    // Aピザの枚数の倍ABを買う
    nums.A * 2 * prices.AB + (nums.A < nums.B ? (nums.B - nums.A) * prices.B : 0),
    // Bピザの枚数の倍ABを買う
    nums.B * 2 * prices.AB + (nums.B < nums.A ? (nums.A - nums.B) * prices.A : 0),
    // AとBが同じ枚数でABだけ買う
    nums.A === nums.B ? nums.A * 2 * prices.AB : 0,
  ].filter((value) => value > 0);

  console.log('%s', Math.min(...patterns));
  // console.log('%s', patterns);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21192
# UnionFind、0-index
#############################################################


class UnionFind:

    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, v):  # vが属する集合の根を返す
        if self.parents[v] < 0:
            return v
        else:
            self.parents[v] = self.find(self.parents[v])
            return self.parents[v]

    def unite(self, u, v):  # 「uが属する集合」と「vが属する集合」を併合（根同士を結ぶ）
        u = self.find(u)
        v = self.find(v)
        if u == v:
            return
        if self.parents[u] > self.parents[v]:  # u < v に統一する
            u, v = v, u
        self.parents[u] += self.parents[v]
        self.parents[v] = u

    def size(self, v):  # vが属する集合の要素数
        return -self.parents[self.find(v)]

    def same(self, u, v):  # uとvが同じ集合に属するか否か
        return self.find(u) == self.find(v)
#############################################################
# (x,y)をuniteする
# i = 1,2,...,Nについて、
# iとp[i-1]が同じ連結成分に含まれるならば、p_i = iとすることができる

N, M = map(int, input().split())
p = list(map(int, input().split()))

uf = UnionFind(N + 1)

for _ in range(M):
    x, y = map(int, input().split())
    uf.unite(x, y)
ans = 0
for i in range(1, N + 1):
    if uf.same(p[i - 1], i):
        ans += 1
print(ans)


Measured memory_bytes: 85456
N = int(input())
A = list(map(int, input().split()))

colors = [0 for _ in range(8)]
over = 0

for a in A:
    if 1 <= a < 400:
        colors[0] = 1
    if 400 <= a < 800:
        colors[1] = 1
    if 800 <= a < 1200:
        colors[2] = 1
    if 1200 <= a < 1600:
        colors[3] = 1
    if 1600 <= a < 2000:
        colors[4] = 1
    if 2000 <= a < 2400:
        colors[5] = 1
    if 2400 <= a < 2800:
        colors[6] = 1
    if 2800 <= a < 3200:
        colors[7] = 1
    if 3200 <= a:
        over += 1

c = colors.count(1)

if over == 0:
    maxi = c
else:
    maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)


Measured memory_bytes: 3064
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn is_prime(n: u32) -> bool {
    if n < 2 {
        return false;
    }
    let mid = ((n as f64).sqrt() as u32) + 1;
    for i in 2..mid {
        if n % i == 0 {
            return false;
        }
    }
    true
}

fn main() {
    let hw: Vec<usize> = read_vec();
    let h = hw[0];
    let w = hw[1];
    let sv: Vec<String> = read_col(h);
    let mut mat: Vec<Vec<char>> = vec![];
    mat.push(vec!['#'; w + 2]);
    for s in sv {
        let mut tmp = vec!['#'];
        for c in s.chars() {
            tmp.push(c);
        }
        tmp.push('#');
        mat.push(tmp);
    }
    mat.push(vec!['#'; w + 2]);

    let mut cnt: u32 = 0;
    for i in 1..h + 1 {
        for j in 1..w + 1 {
            if mat[i][j] == '.' {
                cnt += 1;
            }
        }
    }

    let mut cost: Vec<Vec<u32>> = vec![vec![1000000; w + 2]; h + 2];
    cost[1][1] = 1;

    loop {
        let mut idh: usize = 100;
        let mut idw: usize = 100;
        let mut tmp: u32 = 100000;
        for i in 1..h + 1 {
            for j in 1..w + 1 {
                if cost[i][j] < tmp && mat[i][j] == '.' {
                    tmp = cost[i][j];
                    idh = i;
                    idw = j;
                }
            }
        }
        if idh < 1 || idh > h || idw < 1 || idw > w {
            break;
        }
        mat[idh][idw] = '#';

        if mat[idh - 1][idw] == '.' && cost[idh][idw] + 1 < cost[idh - 1][idw] {
            cost[idh - 1][idw] = cost[idh][idw] + 1;
        }
        if mat[idh + 1][idw] == '.' && cost[idh][idw] + 1 < cost[idh + 1][idw] {
            cost[idh + 1][idw] = cost[idh][idw] + 1;
        }
        if mat[idh][idw - 1] == '.' && cost[idh][idw] + 1 < cost[idh][idw - 1] {
            cost[idh][idw - 1] = cost[idh][idw] + 1;
        }
        if mat[idh][idw + 1] == '.' && cost[idh][idw] + 1 < cost[idh][idw + 1] {
            cost[idh][idw + 1] = cost[idh][idw] + 1;
        }
    }

    if cost[h][w] > cnt {
        println!("{}", -1);
    } else {
        println!("{}", cnt - cost[h][w]);
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <map>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

void print(string a[], int n){
    for(int k = 0; k < n; k++)
        cout << a[k] << (k == n-1 ? '\n' : ' ');
    return;
}

void BubbleSort(string c[], int n){
    rep(i, n)for(int j = n-1; j > i; j--)
        if(c[j][1] < c[j-1][1]) swap(c[j], c[j-1]);
    return;
}

void SelectionSort(string c[], int n){
    rep(i, n){
        int minj = i;
        for(int j = i; j < n; j++)
            if(c[j][1] < c[minj][1]) minj = j;
        if(i != minj) swap(c[i], c[minj]);
    }
    return;
}

string is_stable(map<int, string> a, map<int, string> b, int n){
    rep(i, n) if(a[i] != b[i]) return "Not stable";
    return "Stable";
}

int main(){
    int n; cin >> n;
    string bans[n];
    string sans[n];
    map<int, string> def;
    map<int, string> bmap;
    map<int, string> smap;
    rep(i, n){
        string a; cin >> a;
        bans[i] = a;
        sans[i] = a;
        if(def.find(a[1] - '0') == def.end()) def[a[1] - '0'] = a[0];
        else def[a[1] - '0'] += a[0];
    }

    BubbleSort(bans, n);
    SelectionSort(sans, n);

    rep(i, n){
        if(bmap.find(bans[i][1] - '0') == bmap.end()) bmap[bans[i][1] - '0'] = bans[i][0];
        else bmap[bans[i][1] - '0'] += bans[i][0];
        if(smap.find(sans[i][1] - '0') == smap.end()) smap[sans[i][1] - '0'] = sans[i][0];
        else smap[sans[i][1] - '0'] += sans[i][0];
    }

    print(bans, n);
    cout << is_stable(def, bmap, n) << endl;
    print(sans, n);
    cout << is_stable(def, smap, n) << endl;


    return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)3e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int) 1e6 + 7; 
const double pi = acos(-1.0);
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;                        



int n, q;
bool par[maxn];
void solve(){
	scanf("%d%d", &n, &q);	
	while(q--){
		int u, v;
		scanf("%d%d", &u, &v);
		par[u] ^= 1, par[v] ^= 1;
	}
	forn(i, 1, n)
		if(par[i]){
			puts("NO");
			return;
		}
	puts("YES");
}
main () {
	int t = 1;
	//scanf("%d", &t);
	while(t--)
		solve(); 
}	    

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

    using namespace std;
    const int maxn = 4;
    typedef long long ll;
    const int INF = 1e9+7;

    list<int>sta[maxn];
    void action()
    {   //cout<<sqrt(880)<<endl;
        int n;
        scanf("%d",&n);
        while(n--)
        {
            ll a,b;
            scanf("%lld%lld",&a,&b);


            ll cnt = a*b;
            if(a<b)swap(a,b);

            if(a==b)
            {
                cout<<a+a-2<<endl;
                continue;

            }
            else if(a == b+1)
            {
                cout<<2*(b-1)<<endl;
                continue;
            }

            ll sq = sqrt(cnt);
            ll sq1 = sq;
            ll sq2 = sq;
            if(a<=sq)
            {
                sq1--;
                sq2--;
            }
            if(b<=sq)
            {
                sq1--;
                sq2--;
            }
            if(sq*sq==cnt)
                sq1--;

            ll cnt22 = ceil(sqrt(cnt));
            if(cnt22 * sq <cnt )
                sq1++;
            printf("%lld\n",sq1+sq2);

        }

    }
    int main()
    {

        action();
        return 0;
    }


Measured memory_bytes: 256
n = int(input())
count = 0
p = list(map(int,input().split()))
for i in range(n-2):
    if p[i] < p[i+1]:
        if p[i+1] < p[i+2]:
            count += 1
    elif p[i] > p[i+1]:
        if p[i+1] > p[i+2]:
            count += 1

print(count)


Measured memory_bytes: 2940
gets
c=0
puts$<.map{|s|a=0
b=s.chop.bytes.map{a+=81-_1*2}.min
[-b,a-b]}.sort_by{_1<_2 ?_1:2e9-_2}.map{_2+c+=_1-_2}.max>0||c<0?:No: :Yes

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

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

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

ll dp[2][102];

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

	string s;
  cin>>s;
  
  bool flag = false;
  ll n=s.size();
  REP(i,n){
    for(ll j=i; j<n; j++){
      string p="";
      p += s.substr(0,i);
      p += s.substr(j);
      if(p=="keyence")
        flag = true;
    }
  }
  
  if(flag)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;


}




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

int main() {
  int N,L;
  cin>>N>>L;
  vector<string> s(N);
  
  for (int i = 0; i <  N;i++) {
    cin>>s[i];
  }
  
  sort(s.begin(), s.end());
  
  for (int i = 0; i < N;i++) {
  cout<<s[i];
  }
  
  cout<<endl;
  
}


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

int main(){
    int n , m ;
    cin >> n >> m ;
    int A[n] ;
    vector<int> G[n] ;
    rep(i,n) cin >> A[i] ;
    rep(i,m){
        int a , b ;
        cin >> a >> b ;
        a-- ;b-- ;
        G[a].push_back(b) ;
        G[b].push_back(a) ;
    }
    int count = 0 ;
    rep(i,n){
        bool c = true ;
        for(auto p : G[i] ){
            if( A[p] > A[i] || A[p] == A[i]) c = false ;
        }
        if(c) count++ ;
    }
    cout << count << endl ;
}

Measured memory_bytes: 9124
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<iterator>
#include<math.h>
#include<cstring>
using namespace std;
void lets_play()

{
    char s[1000][1000],temp[1000];
    int i,j,n,l;
    cin>>n>>l;
   for(i=0;i<n;i++)
   {
            cin>>s[i];
   }

    for(i=0;i<n;i++)
   {
       for(j=i+1;j<n;j++)
          {
              if(strcmp(s[i],s[j])>0)
              {
                  strcpy(temp,s[i]);
                  strcpy(s[i],s[j]);
                  strcpy(s[j],temp);
              }
          }
   }

   for(i=0;i<n;i++)
   {
            cout<<s[i];
   }
}

int main()
{
        lets_play();

}


Measured memory_bytes: 3636
#!/usr/bin/env python3
from itertools import product

import numpy as np

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    n, m , x = map(int, input().split())
    c_list = []
    a_list = []
    for _ in range(n):
        c, *a = list(map(int, input().split()))
        a_list.append(a)
        c_list.append(c)
    # print(a_list)
    ans = float("inf")
    for pattern in product((0,1), repeat=n):
        arr = np.array([a_list[i] for i in range(n) if pattern[i] == 1])
        if arr.sum(axis=0).min() >= x:
            cost = sum([c_list[i] for i in range(n) if pattern[i] == 1])
            ans = min(ans, cost)
    if ans == float("inf"):
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 27364
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a) cout<<k<<endl;
  else if(k<=a+b) cout<<a<<endl;
  else{
    cout<<a-(k-(a+b))<<endl;
  }
}

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

int n, m, a, sum;

int main() {
  cin >> m >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    sum += a;
  }
  if (sum <= m) cout << m - sum;
  else cout << -1;
}

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

using namespace std;

using P = pair<int, int>;
using PI = pair<P, int>;
using Graph = map<P, vector<PI> >;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	Graph g;
	for (int i = 0; i < m; i++) {
		int p, q, c;
		cin >> p >> q >> c;
		P x0(p, 0), x1(p, c), y0(q, 0), y1(q, c);
		g[x1].emplace_back(y1, 0);
		g[y1].emplace_back(x1, 0);
		g[x1].emplace_back(x0, 0);
		g[x0].emplace_back(x1, 1);
		g[y1].emplace_back(y0, 0);
		g[y0].emplace_back(y1, 1);
	}

	deque<PI> q;
	q.emplace_front(P(1, 0), 0);
	map<P, int> minc;
	while (!q.empty()) {
		PI pi = q.front();
		q.pop_front();
		if (minc.find(pi.first) != minc.end() && minc[pi.first] <= pi.second) continue;
		minc[pi.first] = pi.second;
		if (pi.first == P(n, 0)) break;
		for (PI& npi : g[pi.first]) {
			int cost = pi.second + npi.second;
			if (minc.find(npi.first) != minc.end() && minc[npi.first] <= cost) continue;
			if (npi.second) q.emplace_back(npi.first, cost);
			else q.emplace_front(npi.first, cost);
		}
	}
	P dst(n, 0);
	if (minc.find(dst) == minc.end()) cout << -1 << endl;
	else cout << minc[dst] << endl;
	return 0;
}

Measured memory_bytes: 75392
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int m = sc.nextInt();
    long[] h = new long[n];
    boolean[] tmp = new boolean[n];
    Arrays.fill(tmp, true);
    int ans = 0;

    for(int i = 0; i < n; i++){
      h[i] = sc.nextLong();
    }

    for(int i = 0; i < m; i++){
      int a = sc.nextInt();
      int b = sc.nextInt();
      
      if(h[a - 1] > h[b - 1]){
        tmp[b - 1] = false;
      } else if(h[a - 1] < h[b - 1]){
        tmp[a - 1] = false;
      } else if(h[a - 1] == h[b - 1]){
        tmp[a - 1] = false;
        tmp[b - 1] = false;
      }
    }

    for(int i = 0; i < n; i++){
      if(tmp[i]){
        ans += 1;
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 60440
// Problem : A - BBQ Easy
// Contest : AtCoder - AtCoder Grand Contest 001
// URL : https://atcoder.jp/contests/agc001/tasks/agc001_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
const long long int  modu=1e9+7;
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define inp(x)  for(auto &t:x) cin>>t;
#define itr     vector<int>::iterator
#define debug(a) cout << #a << "=" << a << ' '<<endl;
#define out(x)  for(auto &t:x) cout<<t<<" "; cout<<endl;
#define ff first
#define ss second
#define pb push_back
#define initialize(a,v)  for(int i=0;i<a.size();++i) a[i]=v;
#define all(x) x.begin(),x.end()
#define mpt(mp) for(auto it=mp.begin();it!=mp.end();it++)
#define trav(x) for(int i=0;i<(int)x.size();++i)
#define mkp(a,b) make_pair(a,b)
#define sz(x)  (int)x.size()

int noofdig(int N)
{
	return floor(log10(N))+1;
}


ll f(ll a)
{

return 0;

}



void pre()
{

}



void solve()
{
	int n;
	cin>>n;
	ll ans=0;
	vi a(2*n);
	inp(a)
	sort(all(a));
	
	for(int i=0;i<2*n;i+=2)
	{
		ans+=min(a[i],a[i+1]);
		
	}
	
	cout<<ans<<endl;
	







}



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

	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int main(){
    long long i,n,ans=0,five[25]={};
    scanf("%lld",&n);
    five[0]=10;
    if(n%2==1){
        printf("0");
        return 0;
    }
    for(i=1; i<25; i++){
        five[i]=5*five[i-1];
    }
    for(i=0; i<25; i++){
        ans+=n/five[i];
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1708
#include <iostream>
using namespace std;
int main()
{  
    long s,c,scc=0;
    cin >> s >> c;
    if ( s > c/2 ) {
        scc = c/2;
    } else {
        scc = s;
        scc += (c - s * 2)/4;
    }
    cout << scc << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np

minans = 100000000

N = int(input())
X = np.array(list(map(int, input().split())))

ma = np.max(X)
mi = np.min(X)

for i in range(mi, ma+1):
	ans = np.sum((X-i) ** 2)
	if ans < minans:
		minans = ans

print(minans)

Measured memory_bytes: 13324
aI, aO, aT, aJ, aL, aS, aZ = map(int, input().split())

K = aO + aI // 2 * 2 + aJ // 2 * 2 + aL // 2 * 2

if aI > 0 and aJ > 0 and aL > 0:
  K = max(aO + 3 + (aI - 1) // 2 * 2 + (aJ - 1) // 2 * 2 + (aL - 1) // 2 * 2, K)

print(K)

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll a,b;
    cin >> a >> b;
    cout << (((a+b)%2==0)?(a+b)/2:(a+b)/2+1) << endl;

    return 0;
}

Measured memory_bytes: 256