akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL-1
double EPS=1e-9;
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef complex<double> P;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
long long int MOD = 1000000007;
/*
cin >> n;
vi a(n);
rep(i,n)cin>>a[i];
*/
int n;
bool used[350];
int main(){
	int N,M;
	cin>>N>>M;
	vector<int> a[350];
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			int x;
			cin>>x;
			a[i].pb(x);
		}
	}
	int ans=N;
	rep(i,N)used[i+1]=false;
	for(int k=0;k<M;k++){
		int cnt[350]={0};
		for(int i=0;i<N;i++){
			int j=0;
			for(j=0;j<M;j++){
				if(!used[a[i][j]]){
					goto HOGE;
				}
			}
		  HOGE:
			cnt[a[i][j]]++;
			//cout<<a[i][j]<<" ";
		}
		int ma=0;
		int check=0;
		for(int i=1;i<=M;i++){
			if(ma<cnt[i])check=i;
			ma=max(ma,cnt[i]);
			//cout<<cnt[i]<<" ";
		}
		//cout<<check<<" ";
		used[check]=true;
		ans=min(ans,ma);
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int A, B, C;

int main() {
	cin >> A >> B >> C;
	cout << max(0, C - (A - B)) << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
using namespace std;

int main(){
	int N,M;
	cin>>N>>M;
	vector<int> a(100000);
	for(int i=0;i<M;i++)cin>>a[i];
	
	vector<int >dp(N);
	int x=0;
	if(a[x]==1){
		dp[0]=0;
		x++;
	}else dp[0]=1;
	if(a[x]==2){
		dp[1]=0;
		x++;
	}
	else dp[1]=1+dp[0];
	
	for(int i=2;i<N;i++){
		if(i==a[x]-1){
			dp[i]=0;
			x++;
		}else dp[i]=(dp[i-2]+dp[i-1])%1000000007;
	}
	cout<<dp[N-1];
}


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

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

  vector<int> a(4);
  for (int i = 0; i < (int)s.size(); i++) {
    a[i] = s[i] - '0';
  }

  for (int x = 0; x < 8; x++) {
    int sum = a[0];
    string s;
    s += (char)('0' + a[0]);

    for (int i = 0; i < 3; i++) {
      // ### ビット演算
      // *  & : 論理積
      // * << : 左シフト
      //
      // 0000
      //   0000 & 0001 == 0000 == 0
      //   0000 & 0010 == 0000 == 0
      //   0000 & 0100 == 0000 == 0
      // 0001
      //   0001 & 0001 == 0001 == 1
      //   0001 & 0010 == 0000 == 0
      //   0001 & 0100 == 0000 == 0
      // 0002
      //   0010 & 0001 == 0000 == 0
      //   0010 & 0010 == 0010 == 2
      //   0010 & 0100 == 0000 == 0
      // 0003
      //   0011 & 0001 == 0001 == 1
      //   0011 & 0010 == 0010 == 2
      //   0011 & 0100 == 0000 == 0
      // 0004
      //   0100 & 0001 == 0000 == 0
      //   0100 & 0010 == 0000 == 0
      //   0100 & 0100 == 0100 == 4
      // 0005
      //   0101 & 0001 == 0001 == 1
      //   0101 & 0010 == 0000 == 0
      //   0101 & 0100 == 0100 == 4
      // 0006
      //   0110 & 0001 == 0000 == 0
      //   0110 & 0010 == 0010 == 2
      //   0110 & 0100 == 0100 == 4
      // 0007
      //   0111 & 0001 == 0001 == 1
      //   0111 & 0010 == 0010 == 2
      //   0111 & 0100 == 0100 == 4
      //
      if (x & (1 << i)) {
        sum += a[i + 1];
        s += '+';
        s += (char)('0' + a[i + 1]);
      } else {
        sum -= a[i + 1];
        s += '-';
        s += (char)('0' + a[i + 1]);
      }
    }

    if (sum == 7) {
      s += "=7";
      cout << s << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll a,b;
  cin>>a>>b;
  ll c=a+b;
  if(c%2==0) {
cout<<c/2<<endl;
  }
  else {
cout<<c/2+1<<endl;
  }
}

Measured memory_bytes: 3608
def main():
    N = int(input())
    if N == 0:
        print(0)
    ans = ''
    base = 1
    while N != 0:
        if N % (base * -2) == 0:
            ans += '0'
        else:
            ans += "1"
            N -= base
        base *= -2
    ans = list(ans)
    ans.reverse()
    print(''.join(ans))

if __name__ == "__main__":
    main()

Measured memory_bytes: 61864
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int k,q,p[100005];

long long x,f[100005],ans;

pl c[100005],b[100005],a[100005];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> x >> k;
    for(int i=1;i<=k;i++){
        cin >> f[i];
    }
    cin >> q;
    for(int i=1;i<=q;i++){
        cin >> c[i].y >> c[i].x;
        b[i]={c[i].x,i};
    }
    sort(b+1,b+q+1);
    for(int i=1;i<=q;i++){
        p[b[i].y]=i;
        a[i]=c[b[i].y];
    }
    long long l=1,r=q,t=1,diff=0,left=0,right=x;
    for(int i=1;i<=k;i++){
        while(t<=q && a[p[t]].y<=f[i]){
            long long val;
            if(p[t]<l) val=left;
            else if(p[t]>r) val=right;
            else val=a[p[t]].x+diff;
            if(i%2) val-=(a[p[t]].y-f[i-1]);
            else val+=(a[p[t]].y-f[i-1]);
            if(val<0) val=0;
            if(val>x) val=x;
            cout << val << '\n';
            t++;
        }
        if(i%2){
            diff-=(f[i]-f[i-1]);
            right-=(f[i]-f[i-1]);
            left-=(f[i]-f[i-1]);
            if(left<0) left=0;
            if(right<0) right=0;
            while(l<=q && a[l].x+diff<=0) l++;
        }
        else{
            diff+=(f[i]-f[i-1]);
            right+=(f[i]-f[i-1]);
            left+=(f[i]-f[i-1]);
            if(left>x) left=x;
            if(right>x) right=x;
            while(r>=1 && a[r].x+diff>=x) r--;
        }
    }
    while(t<=q){
        long long val;
        if(p[t]<l) val=left;
        else if(p[t]>r) val=right;
        else val=a[p[t]].x+diff;
        if((k+1)%2) val-=(a[p[t]].y-f[k]);
        else val+=(a[p[t]].y-f[k]);
        if(val<0) val=0;
        if(val>x) val=x;
        cout << val << '\n';
        t++;
    }
}


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

int main()
{
    long long N,K;
    cin >> N >> K;
    
    long long temp;
    temp = LONG_LONG_MAX;
    
    //bool cont = true;
    
    temp = min(N%K,abs(N%K-K));
    
    cout << temp << endl;
    
    return 0;
}

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

int main() {
	int n,c,i;
	cin>>n>>c;
	int tim[200002]={0};
	int s[100002],e[100002],ch[100002];
	for(i=0;i<n;i++)cin>>s[i]>>e[i]>>ch[i];
	
	for(i=1;i<=c;i++)
	{
		int j;
		int tem[200002]={0};
		
		for(j=0;j<n;j++){if(ch[j]==i){tem[2*s[j]-1]++,tem[2*e[j]]--;}}
		
		for(j=1;j<200002;j++){tem[j]+=tem[j-1];}
		for(j=1;j<200002;j++){if(tem[j]>1)tem[j]=1;}
		
		for(j=0;j<200002;j++){tim[j]+=tem[j];}
	}
	int mx=0;
	for(i=0;i<200002;i++)mx= max(mx,tim[i]);
	cout<<mx<<endl;
	return 0;
}

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

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}

static const ULLONG UL_HUGE_DIVIDER = 1000000007LLU;
static const LLONG LL_HUGE_DIVIDER = 1000000007LL;

//static void ABC111D_RobotArms();
static void ABC114A_753();

#if 1
int main()
{
	//ABC111D_RobotArms();
	ABC114A_753();
	fflush(stdout);
	return 0;
}
#endif

static void ABC114A_753()
{
	int X;
	scanf(" %d", &X);

	const char *ans = "NO\n";
	switch (X) {
	case 3:
	case 5:
	case 7:
		ans = "YES\n";
		break;
	default:
		break;
	}
	printf(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <random>
#include <ctime>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ld long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast_io cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ld eps = (ld)1 / 1e9;
ll inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main()
{
    fast_io;
    ll k, a, b, i;
    cin >> k >> a >> b;
    for (i = a; i <= b; i++)
        if (i % k == 0) cout << "OK", exit(0);
    cout << "NG";
    return 0;
}

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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(2e5) + 17;

struct segtree {
    int n;
    vector<ll> T;

    segtree() = default;
    segtree(int n) : n(n) {
        T.resize(4 * n);
    }

    void upd(int i, ll x, int v, int l, int r) {
        if (l == r) {
            T[v] = max(T[v], x);
            return ;
        }

        auto m = (l + r) / 2;

        if (i <= m)
            upd(i, x, 2 * v, l, m);
        else
            upd(i, x, 2 * v + 1, m + 1, r);

        T[v] = max(T[2 * v], T[2 * v + 1]);
    }

    ll get(int lq, int rq, int v, int l, int r) {
        if (r < lq || l > rq)
            return 0;

        if (lq <= l && r <= rq)
            return T[v];

        auto m = (l + r) / 2;
        return max(get(lq, rq, 2 * v, l, m), get(lq, rq, 2 * v + 1,m + 1, r));
    }

    void upd(int i, ll x) {
        upd(i, x, 1, 0, n - 1);
    }

    ll get(int lq, int rq) {
        return get(lq, rq, 1, 0, n - 1);
    }
};

int n;
int h[MAXN], a[MAXN];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n)
        cin >> h[i];

    forn (i, n)
        cin >> a[i];

    return true;
}

void solve() {
    segtree T(n + 1);
    ll ans = 0;

    for (int i = 0; i < n; ++i) {
        ll res = T.get(0, h[i] - 1) + a[i];
        T.upd(h[i], res);
        ans = max(ans, res);
    }

    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
#ifdef SEREZHKA
    freopen("file.in", "r", stdin);
#endif
    
    while (read())
        solve();
    
    return 0;
}



Measured memory_bytes: 8064
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	ts := make([][]int, n)
	for i := 0; i < n; i++ {
		var x, y, p int
		fmt.Scan(&x, &y, &p)
		ts[i] = []int{x, y, p}
	}

	xd := make([][]int, n)
	yd := make([][]int, n)
	for i := 0; i < n; i++ {
		xd[i] = make([]int, 1<<uint(n))
		yd[i] = make([]int, 1<<uint(n))
		x, y := ts[i][0], ts[i][1]
		for j := 0; j < 1<<uint(n); j++ {
			mi := abs(x)
			for k := 0; k < n; k++ {
				if j&(1<<uint(k)) > 0 {
					mi = min(mi, abs(x-ts[k][0]))
				}
			}
			xd[i][j] = mi
			mi = abs(y)
			for k := 0; k < n; k++ {
				if j&(1<<uint(k)) > 0 {
					mi = min(mi, abs(y-ts[k][1]))
				}
			}
			yd[i][j] = mi
		}
	}

	ans := make([]int, n+1)
	for i := range ans {
		ans[i] = int(1e15)
	}

	for i := 0; i < int(math.Pow(3, float64(n))); i++ {

		var line int
		var xb, yb int
		v := i
		for j := 0; j < n; j++ {
			if v%3 != 0 {
				line++
				if v%3 == 1 {
					xb |= 1 << uint(j)
				} else {
					yb |= 1 << uint(j)
				}
			}
			v /= 3
		}

		var cnt int
		for j := 0; j < n; j++ {
			mi := min(xd[j][xb], yd[j][yb])
			cnt += mi * ts[j][2]
		}
		ans[line] = min(ans[line], cnt)
	}
	for i := 0; i <= n; i++ {
		fmt.Println(ans[i])
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 9836
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 100000000000000
#define endl '\n'
ll power(ll a,ll b,ll m){ll ans=1;while(b){if(b&1) ans=(ans*a)%m; b/=2;a=(a*a)%m;}return ans;}
int main()
{
	fastio;
	#ifdef gdb_18
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll d,t,s;
	cin>>d>>t>>s;
	if(s*t>=d)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;	
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
using namespace std;
int n,k,a[200001],ans;
int main()
{
	scanf("%d%d",&k,&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	ans=a[n]-a[1];
	for(int i=2;i<=n;i++)
		ans=min(ans,k-a[i]+a[i-1]);
	printf("%d",ans);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    
    vector<int> vec(N);
    
    for (int i = 0; i < N; i++){
        int a;
        cin >> a;
        vec.at(i) = a;
    }
    
    bool flag = false;
    
    int a = 1;
    
    for (int i = 1; i < N+1; i++){
        
        if (vec.at(a-1) == 2){
            flag = true;
            cout << i << endl;
            break;
        }
        
        a = vec.at(a-1);
    }
    
    if (flag == false)
        cout << -1 << endl;
        
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
#include <fstream>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int cnt[26][100];

int main(){
    
    REP(i,26)REP(j,100)cnt[i][j] = 0;
    int N; cin>>N;
    REP(i,N){
        string s; cin>>s;
        REP(j,s.size()){
            cnt[s[j]-'a'][i]++;
        }
    }
    
    int mincnt[26];
    REP(i,26)mincnt[i] = 1e9;
    
    REP(i,N)REP(j,26){
        mincnt[j] = min(mincnt[j],cnt[j][i]);
    }
    
    string ans;
    REP(i,26){
        if(mincnt[i]<1e9)REP(j,mincnt[i])ans.push_back((char)('a'+i));
    }
    
    sort(ans.begin(),ans.end());
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            double[] x = new double[n];
            double[] y = new double[n];

            string[] input = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                x[i] = double.Parse(input[i]);
            }

            string[] input2 = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                y[i] = double.Parse(input2[i]);
            }

            double sum = 0;
            double sum2 = 0;
            double sum3 = 0; 
            double max = 0;
            for (int i = 0; i < n; i++)
            {
                double t = Math.Abs(x[i] - y[i]);
                sum += t;
                sum2 += t * t;
                sum3 += t * t * t;
                if (t > max) max = t;
            }
            double ans2 = Math.Sqrt(sum2);
            double ans3 = Math.Pow(sum3, (double)1/3);

            Console.WriteLine(sum.ToString("f0"));
            Console.WriteLine(ans2.ToString("f5"));
            Console.WriteLine(ans3.ToString("f5"));
            Console.WriteLine(max.ToString("f0"));
        }
    }
}

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

using namespace std;

const int MAX = 1e5 + 5;
long long c[MAX] = {0};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	long long k;
	cin >> n >> k;
	for(int i = 0; i < n; i++) {
		int foo, bar;
		cin >> foo >> bar;
		c[foo] += bar;
	}
	for(int i = 0; i < MAX; i++) {
		if(k - c[i] <= 0) {
			cout << i << endl;
			return 0;
		}
		k -= c[i];
	}

}

Measured memory_bytes: 4360
N, M = map(int, input().split())
a = []
b = []
ikeru = [0]*(N+1)
for i in range(M):
    a_tmp, b_tmp = map(int, input().split())
    a.append(a_tmp)
    b.append(b_tmp)

for i in range(M):
    if a[i] == 1:
        ikeru[b[i]] = 1
ikeru_2 = [0]*(N+1)
for i in range(M):
    if ikeru[a[i]] == 1:
        ikeru_2[b[i]] = 1
if ikeru_2[N] == 1 or ikeru[N] == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 22000
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	vector<int>list;

	for (int i = 0; i < 3; i++) {
		int num;
		cin >> num;
		list.push_back(num);
	}

	sort(list.begin(), list.end());

	cout << (list[1] * list[0]) / 2 << endl;





	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	m=10**9+7
	n,a,b=MI()
	f=[1]
	for i in range(b+5):
		t=f[-1]*(n-i)*pow(i+1,m-2,m)
		t%=m
		f.append(t)
	#print(f)

	ans=pow(2,n,m)-1-f[a]-f[b]
	ans%=m
	print(ans)




























if __name__ == "__main__":
	main()


Measured memory_bytes: 17020
#include<stdio.h>

long ru2(int a){
	int i;
	long r=1;
	for(i=0;i<a;i++)r=r*2;
	return r;
}

int main(){
	int n,m;
	long kiso;
	scanf("%d%d",&n,&m);
	kiso=(n-m)*100+m*1900;
	printf("%ld\n",(long)ru2(m)*(long)kiso);
	return 0;
}

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


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            MainStream();
        }
        static void MainStream()
        {
            Scan sc = new Scan();
            write wr = new write();

            int N = sc.intarr[0];
            string S = sc.str;

            int max = 0;
            
            for(int i=1; i<S.Length; i++)
            {
                int count = 0;
                var before = S.Substring(0,i).ToCharArray().Distinct();
                var after = S.Substring(i).ToCharArray().Distinct();



                foreach(var m in before)
                {
                    foreach(var n in after)
                    {
                        if(m == n)
                        {
                            count ++;
                        }
                    }
                }
                max = Math.Max(max, count);
            }
            wr.wri(max);
        }
    }

    class Scan
    {
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
        public char[] chararr => str.ToArray();


    }



    class write
    {
        public void wri<Type>(Type x)
        {
            Console.WriteLine(x);
        }
    }

    class Method
    {
        static public int max(params int[] nums)
        {

            int maxx = nums[0];
            for (int i = 1; i < nums.Length; i++)
            {
                maxx = Math.Max(maxx, nums[i]);
            }
            return maxx;
        }
    }
}


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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;
#define N (1<<18)
template<class T>
struct RMQ{
	pair<T,int>dat[2*N];
	T inf;
	function<pair<T,int>(pair<T,int>,pair<T,int>)>merge;
	RMQ(T Inf,function<pair<T,int>(pair<T,int>,pair<T,int>)>Merge){
		inf=Inf;merge=Merge;
		rep(i,2*N-1){
			dat[i].first=inf;
			if(i>=N-1)dat[i].second=i-N+1;
		}
	}
	void update(int k,T x){
		k+=N-1;
		dat[k].first=x;
		while(k){
			k=(k-1)/2;
			dat[k]=merge(dat[k*2+1],dat[k*2+2]);
		}
	}
	pair<T,int>query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l||r<=a)return make_pair(inf,-1);
		if(a<=l&&r<=b)return dat[k];
		auto lb=query(a,b,k*2+1,l,(l+r)/2);
		auto rb=query(a,b,k*2+2,(l+r)/2,r);
		return merge(lb,rb);
	}
	T getValue(int a,int b){
		return query(a,b).first;
	}
	int getIndex(int a,int b){
		return query(a,b).second;
	}
};
template<class T>
pair<T,int>RangeMax(pair<T,int>a,pair<T,int>b){
	return a.first>=b.first?a:b;
}
template<class T>
pair<T,int>RangeMin(pair<T,int>a,pair<T,int>b){
	return a.first<=b.first?a:b;
}

int dp[200000],nx[200000];

RMQ<int>seg(INF,RangeMin<int>);

int main(){
	int n,m;cin>>n>>m;
	string s;cin>>s;
	memset(dp,0x3f,sizeof(dp));
	dp[n]=0;
	nx[n]=n;
	seg.update(n,n);
	for(int i=n-1;i>=0;i--){
		if(s[i]=='1')continue;
		int r=min(n+1,i+m+1);
		auto p=seg.query(i+1,r);
		dp[i]=min(INF,p.first+1);
		nx[i]=p.second;
		seg.update(i,dp[i]);
	}
	if(dp[0]==INF){
		puts("-1");return 0;
	}
	int x=0;
	vector<int>ans;
	while(x!=n){
		ans.push_back(nx[x]-x);
		x=nx[x];
	}
	for(int i:ans)cout<<i<<' ';
	cout<<endl;
}

Measured memory_bytes: 6392
N, K = map(int, input().split())
p = 0
for i in range(1, N+1):
  if i>=K:
    p += 1/N
  else:
    c = 0
    while i<K:
      i *= 2
      c += 1
    p += (1/N)*(0.5)**c
print(p)

Measured memory_bytes: 9428
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn =new Scanner(System.in);
		int t =1;
		 long mod = (long)(Math.pow(10, 9)+(long)7);
		// System.out.println(mod);
		while(t-->0){
			int n=scn.nextInt();
			long []arr =new long[n];
			long sum=0l;
		  for(int i=0;i<arr.length;i++){
			  arr[i]=scn.nextLong();
			  sum+=arr[i];
             // sum%=mod;
			  
		  }
		  long ans=0l;
		   for(int i=0;i<n;i++){
			   sum-=arr[i];
			   ans+=(((arr[i]%mod)*(sum%mod)))%mod;
			  // ans%=mod;
		   }
		 
		   System.out.println(ans%mod);
		}

	}

}

Measured memory_bytes: 60812
#!/usr/bin/env python3


def solve(N, A):
    MOD = 10**9 + 7
    total = sum(A)
    ans = 0

    for i in range(N - 1):
        total -= A[i]
        ans += A[i] * total
        ans %= MOD

    return ans


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = solve(N, A)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31604
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll ans = 0;
void dfs(int n,  int count, vector<int>path,
	vector<vector<int>>map) {
	if (count == path.size()) {
		ans++;
	}
	else {
		for (int i = 1; i < path.size(); i++) {
			if (map[n][i] == 1 && path[i] == 0) {
				path[i]++;
				count++;
				dfs(i,count, path, map);				
				path[i] = 0;
				count--;
			}
		}
	}
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>>map(n, vector<int>(n,0));
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		map[a][b]++;
		map[b][a]++;
	}

	vector<int>path(n,0);
	path[0] = 1;
	dfs(0, 1, path, map);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2;
int n;
int arr[N];
int main(){
	cin>>n;
	for(int i=2;i<=n;i++){
        int v;
        cin>>v;
        arr[v]++;
	}
	for(int i=1;i<=n;i++)cout<<arr[i]<<endl;
}

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

int main(){
	int N;
	string S;
	cin >> N;
	if (N == 0)S = "0";
	while (N) {
		if (N % 2) {
			N--;
			S += "1";
		}
		else
			S += "0";
		N /= 2;
		N = -N;
	}
	reverse(S.begin(), S.end());
	cout << S << endl;
}

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

long long kirui[100010] = {};
long long gurui[100010] = {};
vector<long long> vec;
int main(){
    long long n;
    cin >> n;

    long long tmp = 1;

    int i = 0;
    while(llabs(tmp) <= 10e15){
        if(tmp > 0){
            kirui[i+1] = tmp;
        }else{
            gurui[i+1] = tmp;
        }
        kirui[i+1] += kirui[i];
        gurui[i+1] += gurui[i];

        vec.push_back(tmp);
        tmp *= -2;
        i++;
    }

    if(n == 0){
        cout << 0 << endl;
        return 0;
    }

    string ans = "";
    for(int i = vec.size()-1;i >= 0;i--){
        if(gurui[i] <= n-vec[i] && n-vec[i] <= kirui[i]){
            n-=vec[i];
            ans = ans+"1";
        }else{
            if(ans != ""){
                ans += "0";
            }
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <numeric>
#include <functional>
#include <cstdlib>
#include <regex>
#include <list>
int main() {
	int a, b, c, d;
	std::cin >> a >> b >> c >> d;
	for (int i = 0; i < (c - a);++i) {
		std::cout << "R";
	}
	for (int i = 0; i < (d - b);++i) {
		std::cout << "U";
	}
	for (int i = 0; i < (c - a);++i) {
		std::cout << "L";
	}
	for (int i = 0; i < (d - b);++i) {
		std::cout << "D";
	}
	std::cout << "D";
	for (int i = 0; i < (c - a + 1);++i) {
		std::cout << "R";
	}
	for (int i = 0; i < (d - b + 1);++i) {
		std::cout << "U";
	}
	std::cout << "L";
	std::cout << "U";
	for (int i = 0; i < (c - a + 1);++i) {
		std::cout << "L";
	}
	for (int i = 0; i < (d - b + 1);++i) {
		std::cout << "D";
	}
	std::cout << "R";
	std::cout << std::endl;
	return 0;
}

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

#define all(x) x.begin(),x.end()
#define pb(x) emplace_back(x)
#define forn(i,N) for(int i=0;i<N;i++)

using namespace std;
using ll=long long int;
using ld=long double;
using vi=vector<int>;
using vll=vector<ll>;
using vd=vector<double>;

int main() {
//freopen("input.txt","rt",stdin);
ios::sync_with_stdio(false);
cin.tie(nullptr);

int a,b,c;
cin>>a>>b>>c;
cout<<(a+b+c>=22 ? "bust" : "win")<<endl;
return 0;
}


Measured memory_bytes: 3624
"use strict"

function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v)
  const N = input[0]
  const K = input[1]

  let ans = 0

  if (K % 2 === 1) {
    //奇数
    for (let i = 1; i <= N; i++) {
      if (i % K === 0) ans++
    }
    ans = Math.pow(ans, 3)
  } else {
    //偶数
    let tmp = 0
    let tmp2 = 0
    for (let i = 1; i <= N; i++) {
      if (i % K === K / 2) {
        tmp++
      }
      if (i % K === 0) {
        tmp2++
      }
    }
    ans += Math.pow(tmp, 3)
    ans += Math.pow(tmp2, 3)
  }

  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))

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

int main(){
    long long N, A, B;
    long long X, Y;
    long long a1, a2, a3, a;
    cin >> N >> A >> B;

    X = min(A,B);
    Y = max(A,B);

    if( (Y-X)%2==0 ){
        cout << (Y-X)/2 << endl;
    }else{
        a1 = min( (N-X), Y-1 );
        a2 = N-Y + (N - (X+N-Y))/2 + (N - (X+N-Y))%2;
        a3 = X-1 + ( (Y-X+1) - 1 )/2 + ( (Y-X+1) - 1 )%2;
        a = min(a1,a2);
        a = min(a,a3);
        cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a,b,x;
        while(true){
        a=sc.nextInt();b=sc.nextInt();
        if(a==0 && b==0) break;if(a>b){x=a;a=b;b=x;}
        System.out.printf("%d %d\n",a,b);
        }
    }
}


Measured memory_bytes: 41728
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>

int max(int ai,int bi){
	if(ai>bi){return ai;}
	else{return bi;}
}

int a[55];
int b[55];
int c[55];
int d[55];

int main(){

	int N,M;
	scanf("%d %d",&N,&M);

	int i,j;

	for(i=1;i<=N;i++){
		scanf("%d %d",&a[i],&b[i]);
	}

	for(i=1;i<=M;i++){
		scanf("%d %d",&c[i],&d[i]);
	}

	for(i=1;i<=N;i++){
		int dist=INT_MAX;
		int idx=-1;
		for(j=1;j<=M;j++){
			if(dist>abs(a[i]-c[j])+abs(b[i]-d[j])){
				dist=abs(a[i]-c[j])+abs(b[i]-d[j]);
				idx=j;
			}
		}
		printf("%d\n",idx);
	}

	return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    ll n,ans=0;
    cin>>n;
    for(ll i = 1; i*i <= n; i++)
    {
        if(n%i>0) continue;
        ll j = n/i;
        if(i>j) swap(i,j); // i<=j
        if(j-i<=1) continue;
        ans+=j-1;
    }
    
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())


diff_x = tx - sx
diff_y = ty - sy

if diff_y > 0:
    base_v = [abs(diff_y) * 'U', abs(diff_y) * 'D']
    add_v = ['U', 'D']
else:
    base_v = [abs(diff_y) * 'D', abs(diff_y) * 'U']
    add_v = ['D', 'U']
if diff_x > 0:
    base_h = [abs(diff_x) * 'R', abs(diff_x) * 'L']
    add_h = ['L', 'R']
else:
    base_h = [abs(diff_x) * 'L', abs(diff_x) * 'R']
    add_h = ['R', 'L']

ans = []
for i in range(2):
    if i == 1:
        ans.append(add_h[0])
    ans.append(base_v[0])
    if i == 1:
        ans.append(add_v[0])
    ans.append(base_h[0])
    if i == 1:
        ans.append(add_h[1])
        ans.append(add_v[1])
        ans.append(add_h[1])
    ans.append(base_v[1])
    if i == 1:
        ans.append(add_v[1])
        ans.append(add_h[0])
    ans.append(base_h[1])
    if i == 1:
        ans.append(add_v[0])

print(''.join(ans))






Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int dp[2000][2000] = {};
int dh[2000][2000] = {};
int dw[2000][2000] = {};
int ds[2000][2000] = {};
int main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++) {
			if (s[j] == '#') {
				dp[i][j] = -1;
			}
			else {
				dp[i][j] = 0;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		int k = 1;
		for (int j = 0; j < w; j++) {
			if (dp[i][j] == -1){
				dh[i][j] = 0;
				k = 1;
			}
			else {
				dh[i][j] = k;
				k++;
			}
		}
	}
	for (int i = 0; i < w; i++) {
		int k = 1;
		for (int j = 0; j < h; j++) {
			if (dp[j][i] == -1) {
				dw[j][i] = 0;
				k = 1;
			}
			else {
				dw[j][i] = k;
				k++;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		int a = 0;
		for (int j = 0; j < w; j++) {
			if (dh[i][j] != 0) {
				a++;
			}
			if (dh[i][j] == 0) {
				for (int k = 0; k < a; k++) {
					dh[i][j-a+k] = a;
				}
				a = 0;
			}
		    else if (j == w - 1) {
				for (int k = 0; k < a; k++) {
					dh[i][j-a+k+1] = a;
				}
				a = 0;
			}
		}
	}
	for (int i = 0; i < w; i++) {
		int a = 0;
		for (int j = 0; j < h; j++) {
			if (dw[j][i] != 0) {
				a++;
			}
			if (dw[j][i] == 0) {
				for (int k = 0; k < a; k++) {
					dw[j-a+k][i] = a;
				}
				a = 0;
			}
			else if (j == h - 1) {
				for (int k = 0; k < a; k++) {
					dw[j-a+k+1][i] = a;
				}
				a = 0;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			ds[i][j] = dh[i][j] + dw[i][j];
		}
	}
	int ans = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			ans = max(ans, ds[i][j]);
		}
	}
	if (ans > 0) {
		cout << ans - 1;
	}
	else {
		cout << 0;
	}
}

Measured memory_bytes: 63744
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[10101010],b[10101010];
main() {
    int n;
    cin >>n;
    for (int i = 0; i < n;i ++)
		cin >>a[i] >>b[i];
    sort(a,a + n);
    sort(b,b + n);
    if (n % 2 == 0) {
        cout <<(b[n / 2 - 1] + b[n / 2] - a[n / 2 - 1] - a[n / 2] + 1);
    }
	else {
        cout <<(b[n / 2] - a[n / 2] + 1);
    }
}

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

B = [0, 0, 0]
for a in A:
  if a % 4 == 0:
    B[2] += 1
  elif a % 2 == 0:
    B[1] += 1
  else:
    B[0] += 1
print ("Yes" if B[0] <= B[2] or B[1] == 0 and B[0] - B[2] == 1 else "No")

Measured memory_bytes: 14252
//Candy Distribution Again

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / __gcd(a, b) * b
#define range(a) (a).begin(),(a).end()
const int inf = 2147483647;

int main (){
    int N,x;cin >> N >> x;
    vector<int> a(N);
    rep(i,0,N)cin >> a[i];
    sort(range(a));
    int i,c=0;
    for(i = 0;;i++){
        c+=a[i];
        if(c==x)break;
        else if(c>x){i--;break;}
        else if(i+1==N&&c<x){i--;break;}
    }
    cout << i+1 << endl;
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int s = 1;
  for (int i = 0; i < N; ++i) {
      if (s * 2 <= s + K)
          s *= 2;
      else
          s += K;
  }

  cout << s << endl;
}

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

int main(){
  int i,j,k=0;
  int X,N;
  
  scanf("%d %d",&N,&X);
  
  int A[N];
  for(i=0;i<N;i++){
    scanf("%d ",&A[i]);
    k+=A[i];
  }
  X -= k;

  int tmp;
  for (i=0; i<N; ++i) {
    for (j=i+1; j<N; ++j) {
      if (A[i] > A[j]) {
        tmp =  A[i];
        A[i] = A[j];
        A[j] = tmp;
      }
    }
  }


  printf("%d\n",(int)(X/A[0])+N);
  return 0;
}

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

int main() {
	string s;
    getline(cin,s);
    if((s.at(0) != s.at(1)) && ( s.at(1) != s.at(2)) && (s.at(2) != s.at(0))){
      cout << "Yes" << endl;
    } 
    else{
      cout << "No" << endl;
    }
}


Measured memory_bytes: 256
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
def ang(n) Array.new(n){gsmi} end
def debug(k,v) puts "#{k}: #{v}" end
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

$stdin = File.open('input.txt') if File.exist?('input.txt')
n = gi
hs =gsmi

ans = Array.new(n)
ans[0..1] = [0,(hs[1]-hs[0]).abs]
(2...n).each do |i|
  ans[i] = [i-1,i-2].map{ |e| ans[e]+(hs[e]-hs[i]).abs }.min
end if n!=2

puts ans[n-1]


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

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split("[\\s]+");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int c = Integer.parseInt(sl[2]);

    System.out.println(a + b >= c ? "Yes" : "No");
  }

}


Measured memory_bytes: 23252
import atexit
import io
import sys

buff = io.BytesIO()
sys.stdout = buff


@atexit.register
def write():
    sys.__stdout__.write(buff.getvalue())


x,y,z,k = map(int, raw_input().split())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
c = map(int, raw_input().split())
l1 = []
for i in xrange(x):
	for j in xrange(y):
		l1.append(a[i]+b[j])
l1.sort(reverse = True)
l2 = []
for i in xrange(min(k,len(l1))):
	for j in xrange(z):
		l2.append(l1[i]+c[j])
l2.sort(reverse = True)
for i in xrange(k):
	print l2[i]

Measured memory_bytes: 154432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main() {
  ll N;
  cin>>N;
  ll ans=0;
  rrep(i,N-1){
      ans+=(N-1)/i;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3620
# 169A
# A × B を整数として出力せよ

# 1.入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())
# print(a, b)

# 2.受け取った入力値を使って、適切に処理(計算)すること
answer = a * b;

# 3.計算した結果を出力すること
print(answer)

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

// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> P;
typedef pair<lint, lint> Plint;
 
const int MOD = 1e9+7;
const int INF = 1<<18;
const lint INFLINT = 1LL<<60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
	vector<int> par;
	UnionFind(int n):par(n){rep(i,n)par[i]=i;}
	int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
	void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
	bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

int main() {
    string s;
    cin >> s;
    if(s == "ABC")cout<<"ARC";
    else cout << "ABC";
    return 0;
}


Measured memory_bytes: 3580
P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3):
    for j in range(i*i,10**6,i):
        P[j] = 0
Q = []
for i in range(2,10**6):
    if P[i]==1:
        Q.append(i)
N = int(input())
C = {}
for q in Q:
    if N%q==0:
        C[q] = 0
        while N%q==0:
            N = N//q
            C[q] += 1
if N>1:
    C[N] = 1
cnt = 0
for q in C:
    k = C[q]
    n = 1
    while k>(n*(n+1))//2:
        n += 1
    if k==(n*(n+1))//2:
        cnt += n
    else:
        cnt += n-1
print(cnt)

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

using namespace std;

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

#define rep(pos, len) for(int pos=0;pos<len;pos++)
#define repp(pos, len) for(int pos=1;pos<=len;pos++)

#define INF 987654321
#define IINF 2987654321987654321
#define MOD 998244353


int main() {
	int n; scanf("%d", &n);
	vector<int> v(n+1);
	for(int i = 1; i <= n; i++) {
		int t; scanf("%d", &t);
		v[t] = i;
	}	
	for(int i = 1; i <= n; i++)
		printf("%d ", v[i]);
}

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

int h, n;

int main(){
	cin >> h >> n;
	for(int i = 0; i < n; i++){
		int val;
		cin >> val;
		h -= val;
	}
	cout << ((h <= 0) ? "Yes\n" : "No\n");
	return 0;
}


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

int main() {
        int N;

        cin >> N;
        vector<vector<int>> D(N, vector<int>(3));
        vector<int> R(3);


        rep (n, N) {
                rep (i, 3) {
                        cin >> D.at(n).at(i);
                }
        }

        rep( n, N) {
                rep (i, 3) {
                        R.at(i) = D.at(n).at(i);
                        rep(n2, N) {
                                if (n != n2) {
                                        if (R.at(i) == D.at(n2).at(i)) R.at(i) = 0;
                                }
                        }
                }
                cout << accumulate(R.begin(), R.end(), 0) << endl;
        }
        return 0;
}



Measured memory_bytes: 3152
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int i,j,h,w,x,y,s,ll,sss,set[150][150],q[20000][2];
char map[150][150];

int mark(int x,int y,int k,int lev){
	if(x<0 || y<0 || x>h+1 || y>w+1 || set[x][y]>=sss)return 0;
	char c =map[x][y];
	if(c=='&'){
		printf("%d\n",k-sss+lev);
		return 1;
	}
	if( (c=='#' && lev==0) || (c!='#' && lev==1) ){
		set[x][y]=k+lev;
		q[j][0]=x;q[j][1]=y;
		j++;
		return 0;
	}
	set[x][y]=k;
	if(mark(x-1,y,k,lev))return 1;
	if(mark(x+1,y,k,lev))return 1;
	if(mark(x,y-1,k,lev))return 1;
	if(mark(x,y+1,k,lev))return 1;
	return 0;
}


int main(){
	while(scanf("%d %d",&w,&h)*w*h){
		for(i=0;i<=h+1;i++)memset(map[i],'.',w+2);
		for(i=1;i<=h;i++)scanf("%s",&map[i][1]);
		
		sss+=200;
		q[0][0]=0;q[0][1]=0;
		set[0][0]=sss;
		i=0;j=1;

		while(i<j){
			x=q[i][0]; y=q[i][1]; s=set[x][y];
			if(map[x][y]=='#')ll=1; else ll=0;
			if(mark(x-1,y,s,ll))break;
			if(mark(x+1,y,s,ll))break;
			if(mark(x,y-1,s,ll))break;
			if(mark(x,y+1,s,ll))break;
			i++;
		}

	}
	return 0;
}

Measured memory_bytes: 996
#!/usr/bin/env python3
from itertools import chain, repeat
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(H: int, W: int, N: int, a: "List[int]"):
    it = chain.from_iterable(repeat(i + 1, ai) for i, ai in enumerate(a))
    for i in range(H):
        l = [next(it) for j in range(W)]
        if i % 2 == 1:
            l.reverse()
        print(*l)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, W, N, a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3824