akhauriyash/Code-Regression huggingface dataset:
const main = input => {
  const inputList = input.split('\n')
  const count = parseInt(inputList[0], 10)
  const nums = inputList.slice(1, count + 1)
  const result = nums.every(n => {
    const arr = n.split(' ')
    const time = parseInt(arr[0], 10)
    const x = parseInt(arr[1], 10)
    const y = parseInt(arr[2], 10)
    const sum = x + y

    return (
      time >= sum &&
      time%2 === sum%2
    )
  })
  
  if (result) {
    console.log('Yes')
  } else {
  	console.log('No')
  }
}

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


Measured memory_bytes: 29912
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

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

int re(int x1,int x2){
  return (x1 - x2) * (x1 - x2);
}

int main(){

  int n,d;
  cin >> n >> d;
  int x[n + 10][d + 10];
  int count = 0;
  rep(i, n) rep(j, d) cin >> x[i][j];
  for (int k = 0; k < n - 1;k++){
    for (int i = k+1; i < n ; i++)
    {
      int num = 0;
      for (int j = 0; j < d; j++)
      {
        num += re(x[k][j], x[i][j]);
      }

      if ((pow(num, 0.5)) == int(pow(num, 0.5)))
        count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

#define fi first
#define se second
typedef pair<int, int> pi;

int main()
{
    if (fopen("Test.INP", "r"))
        freopen("Test.INP", "r", stdin);

    string s, t;
    cin >> s >> t;

    int n = s.size();
    int m = t.size();

    int dp[n + 1][m + 1];
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= m; ++j)
        {
            if (!i || !j)
                dp[i][j] = 0;
            else if (s[i - 1] == t[j - 1])
                dp[i][j] = dp[i - 1][j - 1] + 1;
            else
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);

            /*
            if (i == 0 && j == 0)
                cout << 'X';
            else if (i == 0)
                cout << t[j - 1];
            else if (j == 0)
                cout << s[i - 1];
            else
                cout << dp[i][j];

            cout << ' ';
            */
        }
        //cout << endl;
    }
    //cout << endl;

    int i = n;
    int j = m;
    int cnt = dp[i][j];

    string res;
    while (cnt)
    {
        //cout << i << ' ' << j << " | " << s[i - 1] << ' ' << t[j - 1] << " | " << cnt << ' ';
        if (s[i - 1] == t[j - 1])
        {
            res = s[i - 1] + res;
            i--, j--, cnt--;
        }
        else
        {
            if (dp[i - 1][j] > dp[i][j - 1])
                i--;
            else
                j--;
        }
        //cout << res << '\n';
    }

    cout << res;
    return 0;
}


Measured memory_bytes: 35456
N = int(input())
restourants = dict()

for i in range(N):
    S, P = map(str,input().split())
    if S not in restourants:
        restourants[S] = {}
    restourants[S][int(P)] = i+1
for k, v in sorted(restourants.items()):
    v = sorted(v.items(),reverse=True)
    for i in v:
        print(i[1])
    

Measured memory_bytes: 3060
<?php
$L=trim(fgets(STDIN));
$p=[0,0];

for($i=0;$i<$L;$i++){
  $C=explode(' ',trim(fgets(STDIN)));

  if($C[0]<$C[1]) $p[1]+=3;
  elseif($C[0]>$C[1]) $p[0]+=3;
  else{
    ++$p[0];
    ++$p[1];
  }
}

echo $p[0],' ',$p[1];
?>

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

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

#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

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

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

  ll x;
  cin>>x;
  ll ans=0;

  ans += x/500*1000;
  x = x%500;
  ans += x/5*5;
  cout<<ans<<endl;
}



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

int main(){
    int n;cin>>n;
    vector<int> A(n),B(n),C(n-1);

    for(int i = 0; i < n; i++){
        cin>>A[i];A[i]--;
    }
    for(int i = 0; i < n; i++) cin>>B[i];
    for(int i = 0; i < n-1; i++) cin>>C[i];

    int res = B[A[0]];

    for(int i = 1; i < n; i++){
        res+=B[A[i]];
        if(A[i]-A[i-1] == 1) res+=C[A[i-1]];
    }
    cout<<res;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

template<typename T = int, class F = std::plus<T>, class F_INV = std::minus<T>, const T E = T()>
struct BinaryIndexedTree {
    const F op = F(); const F_INV op_inv = F_INV();
    int n; vector<T> dat;
    template<class U = vector<T>> void build(U&& v) {
        n = v.size(); dat.assign(n, E); for (int i = 0; i < n; ++i) add(i, v[i]);
    }
    void add(int k, T v) { for (int i = k; i < n; i |= i + 1) dat[i] = op(dat[i], v); }
    void update(int k, T v) { add(k, op_inv(v, query(k, k + 1))); }
    T query(int a, int b) {
        if (a == b) return E;
        T ret = E; for (int i = b - 1; i >= 0; i = (i & (i + 1)) - 1) ret = op(ret, dat[i]);
        return op_inv(ret, query(0, a));
    }
};

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    rep(i, N) {
        cin >> P[i];
        P[i]--;
        Q[P[i]] = i;
    }

    vector<int> a(N), b(N);
    int oa = 0, ob = 0;
    rep(i, N) {
        if (ob + oa < Q[i]) {
            oa += Q[i] - (oa + ob);
            a[i] = i + oa;
            b[i] = -i + ob;
        }
        else {
            ob += Q[i] - (oa + ob);
            a[i] = i + oa;
            b[i] = -i + ob;
        }
    }

    for (int i = 0; i < N; ++i) {
        cout << (1 + a[i]) << (i == N - 1 ? '\n' : ' ');
    }
    for (int i = 0; i < N; ++i) {
        cout << ((int)1e9 + b[i]) << (i == N - 1 ? '\n' : ' ');
    }
}

Measured memory_bytes: 896
n = int(input())
L = list(map(int,input().split()))
L.sort()
mod = 10**9+7
if len(L)%2 == 0 and len(set(L))*2 == len(L):
    print(2**len(set(L))%mod)
elif len(L)%2 == 0 and len(set(L))*2 != len(L):
    print(0)
elif len(L)%2 == 1: 
    if L.count(0) == 1:
        L.pop(0)
        if len(set(L))*2 == len(L):
            print(2**(len(set(L)))%mod)
    else:
        print(0)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	long long ans = LLONG_MIN;
	for (int x : {a, b}) {
		for (int y : {c, d}) {
			ans = max(ans, 1ll * x * y);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
#include<math.h>
#include<string.h>
int max(int a,int b){
   if(a>b) return a;
   return b;
}
int min(int a,int b){
   if(a<b) return a;
   return b;
}
void sort(char *a,int l){
    for(int i=0;i<l;i++){
       for(int j=i+1;j<l;j++){
          char t;
         if(a[i]>a[j]) {
            t=a[i];
            a[i]=a[j];
            a[j]=t;
         }

       }
    }


}
typedef long long int lli;
lli s(lli a){
   for(lli sm=0;a;){
      sm+=a%10;
      a/=10;
      if(a==0) return sm;
   }
}
int main(){
  // printf("%lld ",100%s(100));
      lli a,b[1000];
    scanf("%lld",&a);
   if(a%s(a)){
     printf("No");
   }
   else printf("Yes");

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,m; cin>>n>>m;
    if(n==m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int		main(void)
{
	int h,w;
	scanf("%d%d", &h, &w);
	char s[h + 1][w + 1];
	int i;
	int count;
	int k;
	int n;
	int j;

	i = 0;
	while (i < h)
	{
		scanf("%s", s[i]);
		i++;
	}
	i = 0;
	while (i < h)
	{
		j = 0;
		while (j < w)
		{
			if (s[i][j] == '.')
			{
				k = i - 1;
				count = 0;
				while (k <= i + 1)
				{
					n = j - 1;
					while (n <= j + 1)
					{
						if (s[k][n] == '#')
							count++;
						n++;
					}
					k++;
				}
				s[i][j] = '0' + count;
			}
			j++;
		}
		i++;
	}
	i = 0;
	while (i < h)
	{
		printf("%s\n", s[i]);
		i++;
	}
	return (0);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n; cin >>n;
double a[n]={};
double ca=0;
for(ll i=0; i<n; i++){
cin>>a[i];
ca+=a[i];}
ca = ca/(double)n;
ll ans=0;
double k=abs(ca-a[0]);
rep(i,n){
if(k>abs(ca-a[i]))
ans=i,k=abs(ca-a[i]);}
cout << ans << endl;}


Measured memory_bytes: 3728
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

int main(){
    int numStones, numSteps;
    cin>>numStones>>numSteps;
    vector<int>v(numStones);
    for(int i=0;i<numStones;i++){
        cin>>v[i];
    }
    
    vector<int>dp(numStones,1e9);
    dp[0]=0;
    // x 0 
    //   1 2 3 4
    for(int i=1;i<numStones;i++){
        // dp[i] = abs(v[i]-v[i-numSteps]);
        for(int j=max(0,i-numSteps);j<i;j++){
            int val = dp[j]+abs(v[i]-v[j]);
            dp[i] = min(dp[i],val);
            //cout<<"j: "<<j<<" "<<dp[i]<<" ";
        }
        //cout<<endl;
    }
    // for(auto a : dp){
    //     cout<<a<<" ";
    // }
    // cout<<endl;
    cout<<dp[numStones-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
 
#define N 100000
#define Q 50000
 
int BinarySearch(int,int);
 
int S[N];
 
int main()
{
  int T[Q],n,q,i,count = 0;
 
  scanf("%d",&n);
 
  for(i = 0; i < n; i++){
    scanf("%d",&S[i]);
  }
 
  scanf("%d",&q);
 
  for(i = 0; i < q; i++){
    scanf("%d",&T[i]);
    count += BinarySearch(n,T[i]);
  }
 
  printf("%d\n",count);
 
  return 0;
}
int BinarySearch(n,key){
	int left = 0;
	int right = n;
	int mid;
	while(left < right){
		
		mid = (left + right) / 2;
	
		if(key == S[mid]) return 1;
	
		if(key > S[mid]) left = mid + 1;
	
		else if(key < S[mid]) right = mid;
	}
	return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
#define ll long long int
#define INF 0x3f3f3f3f
#define pb push_back
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll a,b,c; cin>>a>>b>>c;
	if(a%2==0 || b%2==0 || c%2==0) cout<<0<<endl;
	else
	{
	    ll arr[3];
	    arr[0]=a;
	    arr[1]=b;
	    arr[2]=c;
	    sort(arr,arr+3);
	    cout<<arr[0]*arr[1];
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
typedef long long ll;
ll N;

int main()
{
    scanf("%lld",&N);
    ll h,n,w;
    for(h=1;h<=3500;h++){
        for(w=1;w<=3500;w++){
            ll fz=N*h*w;
            ll fm=4*h*w-(N*h+N*w);
            if(fm==0)   continue;
            if(fz%fm!=0)    continue;
            ll n=fz/fm;
            if(n>0&&n<=3500)    {printf("%lld %lld %lld\n",h,n,w); return 0;}
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,j;
    cin>>n;
    vector<ll> dp(3,0);
    vector<ll> v(3);
    while(n--)
    {
        vector<ll> new_dp(3,0);
        for(i=0;i<3;i++)
        {
            cin>>v[i];
        }
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                if(i!=j)
                {
                    new_dp[j]=max(new_dp[j],dp[i]+v[j]);
                }
            }
        }
        dp = new_dp;
    }

    cout<<max(max(dp[0],dp[1]),dp[2])<<endl;
}















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

using namespace std;

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

  int n, k;
  cin >> n >> k;

  long long c = n / k;
  long long answer = c * c * c;


  if(k > 1 && k % 2 == 0) {
    long long d = 0;
    for(int i = 1; i <= n; ++i) {
      d += (i % k == k / 2);
    }
    answer += d * d * d;
  }

  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>

using namespace std;

typedef long long ll;
const ll nmax = 1e9 + 7;
const ll mod = 998244353;
const double PI = 2 * asin(1);


int main(){
  ll N, A, B; cin >> N >> A >> B;

  if ((B - A) % 2 == 0){
    cout << (B - A) / 2 << endl;
  }else{
    ll ans1 = ((B - A - 1) / 2) + min(A, N - B + 1);
    cout << ans1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>


int main(void) {
	using namespace std;
	int a, b;
	char op;
	while (cin >> a >> op >> b) {
		if (op == '?')break;
		else {
			switch (op) {
			case '+':
				cout << a + b << endl;
				break;

			case '-':
				cout << a - b << endl;
				break;

			case '*':
				cout << setprecision(9) << a * b << endl;
				break;

			case '/':
				cout << a / b << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3084
#include<iostream>
#include<algorithm>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
LL mod=1000000007;
LL LINF=1LL<<52;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    int l[n];
    for (int i = 0; i < n; i++) {
        scanf("%d",l+i);
    }
    sort(l,l+n);
    int ans = 0;
    for (int i = 0; i < n-2; i++) {
        for (int j = i+1; j < n-1;j++) {
            for (int k = j+1; k < n; k++) {
                if(l[i]+l[j]>l[k]) ans++;
            }
        }
    }
    printf("%d",ans);
    return 0;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n = read();
  print(n / 3);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, x; cin >> n >> x;
	vi m(n); cin >> m;
	int sum = 0;
	for (auto i : m) x -= i;
	cout << n + x / *min_element(ALL(m)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{	
	int n;
	scanf("%d",&n);	
	int a[n],b[n],c[n];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d", &a[i],&b[i],&c[i]);
		
	}
	int dp[3][n];
	dp[0][0]=a[0];
	dp[1][0]=b[0];
	dp[2][0]=c[0];
	int  j=0,max;
	for(i=1;i<n;i++)
	{	j=0;
		max=0;
		if(dp[1][i-1]<=dp[2][i-1])
		max=dp[2][i-1]+a[i];			
		else
		max=dp[1][i-1]+a[i];
		dp[j][i]=max;
		j++;
		if(dp[0][i-1]<dp[2][i-1])
		max=dp[2][i-1]+b[i];			
		else
		max=dp[0][i-1]+b[i];
		dp[j][i]=max;
		j++;
			if(dp[0][i-1]<=dp[1][i-1])
			max=dp[1][i-1]+c[i];			
			else
			max=dp[0][i-1]+c[i];
			dp[j][i]=max;
	}
	if(dp[1][n-1]>=dp[2][n-1]&&dp[1][n-1]>=dp[0][n-1])
	printf("%d",dp[1][n-1]);
	else if(dp[2][n-1]>=dp[0][n-1])
	printf("%d",dp[2][n-1]);
	else
	printf("%d",dp[0][n-1]);
	
	return 0;		
}


Measured memory_bytes: 2560
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <stack>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<pll> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll r,g,b,n ;
	cin >> r >> g >> b >> n ;
	ll ans = 0 ;
	for(int i=0;i<=3000;i++){
		if(r*i>n) break ;
		for(int j=0;j<=3000;j++){
			if(g*j>n-r*i) break ;
			if((n-r*i-g*j)%b==0) ans++ ;
		}
	}
	cout << ans << endl ;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int X,happy;
    cin >> X;
    int num_500, num_5;
    num_500 = X/500;
    num_5 = (X-num_500*500)/5;
    happy = num_500 * 1000 + num_5*5;
    cout << happy << endl;
}

Measured memory_bytes: 256
n = int(input())
a = sorted(list(map(int,input().split())),reverse=True)
w = 0
h = 0
for i in range(n-1):
    if a[i] == a[i+1] and w == 0:
        w = a[i]
        a[i+1] = 0
    if a[i] == a[i+1] and w != 0:
        h = a[i]
        break
if w == 0 or h == 0:
    ans = 0
else:
    ans = int(h*w)
print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);
using namespace std;
typedef long long ll;
typedef long double ld;


int main(){
	int n, l; cin >> n >> l;
	vector<int> a(n+1, 0);
	int sum = 0;
	for(int i = 1; i<=n; i++) a[i] = l+i-1, sum+= a[i];
	int mind = 1e9, idx = -1;
	for(int i = 1; i<=n; i++) {
		if (abs(a[i])<mind){
			mind = abs(a[i]);
			idx = i;
		}
	}
	cout << sum-a[idx] << endl;
	return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    int mn = -1;
    for(int i=1;i<=1000;i++){
        if(i*8/100 == a && i*10/100 == b)
        {
            mn = i;
            break;
        }
    }
    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1193&lang=jp
//連鎖消滅パズル
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
bool solve(){
  ll h; cin>>h;
  if(h<=0) return false;
  vector<vector<ll>> tbl(h,vector<ll>(5));
  for(auto&& l:tbl){
    for(auto&& v:l) cin>>v;
  }

  auto calc = [](vector<ll>& tbl){
    ll result=0;
    REP(i,tbl.size()){
      ll num=0;
      if(tbl.at(i)==0)continue;
      FOR(j,i+1,tbl.size()){
        if(tbl.at(i)!=tbl.at(j)) break;
        ++num;
      }
      ++num;
      if(num>=3){//先頭も含む
        FOR(j,i,i+num){
          result += tbl.at(j);
          tbl.at(j)=0; //消す
        }
        break;
      }
    }
    return result;
  };
  auto otosu =[&](){
    FOR(x,0,5){
      for(ll y=h-1;y>=0;--y){
        if(tbl[y][x]==0){
          for(ll y2=y-1;y2>=0;--y2){
            if(tbl[y2][x]!=0){
              swap(tbl[y][x],tbl[y2][x]);
              break;
            }
          }
        }
      }
    }
  };

  ll ans=0;
  do{
    dump(tbl); dump(ans);
    ll tmp=0;
    FOR(i,0,tbl.size()){
      tmp += calc(tbl.at(i));//消す
    }
    if(tmp==0)break;
    ans += tmp;
    //落す
    otosu();
  }while(true);
  cout<<ans<<endl;
  return true;
}
int main() {
#if LOCAL&01
  //std::ifstream in("./test/sample-1.in");
  std::ifstream in("./input.txt");
  std::cin.rdbuf(in.rdbuf());
#else
  cin.tie(0);
  ios::sync_with_stdio(false);
#endif
  while(solve()){
  }
  return 0;
}


Measured memory_bytes: 3136
#include <iostream>
#include <algorithm>
#include <functional>
#include <utility>
#include <string>



using namespace std;





int main(void){
    int N;
    scanf("%d",&N);
    string po1, po2, po3;
    cin >> po1 >> po2 >> po3;
    int ans=0;
    for(int i=0;i<N;i++){
        if(po1[i]==po2[i]&&po2[i]==po3[i])ans+=0;
        else if(po1[i]!=po2[i]&&po2[i]!=po3[i]&&po1[i]!=po3[i])ans+=2;
        else ans++;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_ABC089_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            int c = int.Parse(s[2]);

            int _1st, _2nd, _3rd;

            if (a > b)
            {
                if (a > c)
                {
                    _1st = a;

                    if (b > c)
                    {
                        _2nd = b;
                        _3rd = c;
                    }
                    else
                    {
                        _2nd = c;
                        _3rd = b;
                    }
                }
                else
                {
                    _1st = c;
                    _2nd = a;
                    _3rd = b;
                }
            }
            else
            {
                if (b > c)
                {
                    _1st = b;

                    if (a > c)
                    {
                        _2nd = a;
                        _3rd = c;
                    }
                    else
                    {
                        _2nd = c;
                        _3rd = a;
                    }
                }
                else
                {
                    _1st = c;
                    _2nd = b;
                    _3rd = a;
                }
            }


            int count = _1st - _2nd;

            int sub = _2nd - _3rd;

            count += sub / 2;

            if (sub % 2 == 1)
            {
                count += 2;
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
import sys
from collections import Counter


N = int(input())
C = Counter()
for s in sys.stdin.readlines():
    C[s[0]] += 1

I = ['M', 'A', 'R', 'C', 'H']
ans = 0
for i in range(1 << 5):
    bit = i
    if bin(bit).count('1') == 3:
        var = 1
        for k in range(5):
            if (bit >> k) & 1:
                var *= C[I[k]]
        ans += var

print(ans)


Measured memory_bytes: 54492
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int N_MAX = 210, M_MAX = N_MAX*(N_MAX-1)/2, R_MAX = 8;
const int INF = 1e8;
int V,E,R;
int G[N_MAX][N_MAX];

void warshall_floyd(){
  rep(w,V)rep(v,V)rep(u,V) 
    G[v][u] = min(G[v][u],G[v][w] + G[w][u]);
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> V >> E >> R;
  vector<int> vr(R);
  rep(i,R){
    cin >> vr[i];
    --vr[i];
  }
  sort(all(vr));

  rep(v,V)rep(u,V) G[v][u] = (v==u) ? 0:INF;

  rep(i,E){
    int f,t,c; cin >> f >> t >> c;
    --f;--t;
    G[f][t] = G[t][f] = c; 
  }

  warshall_floyd();

  ll res = INF;
  do{
    ll route = 0;
    rep(i,R-1) route += G[vr[i]][vr[i+1]];
    res = min(res,route);
  }while(next_permutation(all(vr)));

  cout << res << endl;
  return 0;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, K; cin >> N >> K;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    ll l = 0, r = (1e+9)+1;
    while(r-l>1){
        ll mid = (r+l)/2;
        ll cnt = 0;
        rep(i, N){
            cnt += (a[i]+mid-1)/mid-1;
        }
        if(cnt <= K) r = mid;
        else l = mid;
    }
    cout << r << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 9000
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(){
    int D,N;
    cin>>D>>N;
    if(N!=100){
    if(D==0){
        cout<<N<<endl;
    }
    if(D==1){cout<<N*100<<endl;}
    if(D==2){cout<<N*10000<<endl;}
    }
    if(N==100){
        if(D==0){
        cout<<N+1<<endl;
    }
    if(D==1){cout<<(N+1)*100<<endl;}
    if(D==2){cout<<(N+1)*10000<<endl;}
    }
    
}

Measured memory_bytes: 256
n,m,x = map(int,input().split())
l = []

for i in range(n):
    i = list(map(int,input().split()))
    l.append(i)

ans = []

for j in range(2**n):
    total = 0
    tmp = [0]*m
    for k in range(n):
        if ((j >> k) & 1):
            total += l[k][0]
            for o in range(1,m+1):
                tmp[o-1] += l[k][o]
    if all(t >= x for t in tmp):
        ans.append(total)

if ans:
    print(min(ans))
else:
    print(-1)

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

int main(){
  int H,W;
  cin >>H>>W;
  string S[H+1];  
  for (int i=0;i<H;i++){
    cin>>S[i];
  }
  for (int i=0;i<H;i++){
    cout<<S[i]<<endl;
    cout<<S[i]<<endl;
  }
  return 0;
}

  

Measured memory_bytes: 256
#include <stdio.h>
#define M 100

int main(void) {
  int A, B;
  (void)scanf("%d %d", &A, &B);
  A--;
  B--;

  printf("%d %d\n", M, M);
  for (int h = 0; h < M; h++) {
    for (int w = 0; w < M; w++) {
      if (h == 0) printf(".");
      else if (h == M - 1) printf("#");
      else if (w <= 1 || M-2 <= w)
        if (w % 4 <= 1) printf(".");
        else printf("#");
      else if (h == 1) {
        if ((w+1) % 4 <= 1) printf("#");
        else printf(".");
      }
      else if (w % 4 <= 1) {
        if (A > 0 && (w+h)%2 == 1) {
          A--;
          printf("#");
        } else
          printf(".");
      } else {
        if (B > 0 && (w+h)%2 == 1) {
          B--;
          printf(".");
        } else
          printf("#");
      }
    }
    puts("");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if ( c <= a + b) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}

	}




Measured memory_bytes: 21972
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.141592653289793;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define lld long double
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

int main()
{
	int n;
	string s1, s2;
	cin >> n >> s1 >> s2;
	for (int i = n; i >= 1; --i)
	{
		if(s1.substr(n-i,i)==s2.substr(0,i))
		{
			cout << 2*n - i << endl;
			return 0;
		}
	}
	cout << 2 * n << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>
using namespace std;
int main(){
    int n,m;
    for(;;){
        scanf("%d\n",&n);
        if(n==0) break;
        int cs[256];
        for(int i=0;i<=255;i++){
            cs[i]=-1;
        }
        char a,b;
        for(int i=0;i<n;i++){
            scanf("%c %c\n",&a,&b);
            cs[a]=b;
        }
        scanf("%d\n",&m);
        for(int i=0;i<m;i++){
            scanf("%c\n",&a);
            printf("%c",cs[a]>=0?cs[a]:a);
        }
        printf("\n");
    }
}

Measured memory_bytes: 0
// ABC055_A
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll N;
    cin >> N;
    
    // calculation
    cout << N*800 - (N/15)*200 << "\n";
    
    return 0;
}

Measured memory_bytes: 256
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline
mii=lambda:map(int,input().split())

n,x=mii()
a=list(mii())


if sum(a)==x:
    print(n)
else:
    # not possible to satisfy all
    # do a prefix
    ans=0
    a.sort()
    for i in range(n-1):
        if x>=a[i]:
            x-=a[i]
            ans+=1
    print(ans)


Measured memory_bytes: 38384
#include <stdio.h>

int main (){
	int a,b;
	scanf ("%d %d", &a, &b);
	char str[20];
	scanf("%s", str);
	int valid = !0; 
	if (str[a]!='-')
	{
		valid = 0;
	}
	for (int i=0 ; str[i]!='\0' ; i++)
	{
		if (i!=a)
		{
			if(str[i]<'0' || str[i]>'9')
			{
				valid = 0;
				break; // keluar dari loop
			}
		}
	}
	(valid) ? printf("Yes") : printf ("No");	
return 0;
}


Measured memory_bytes: 1716
#include <random>

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld eps = 1e-12;
constexpr int inf = numeric_limits<int>::max() / 2;
constexpr ll mod = 1e9 + 7;
mt19937_64 rnd{random_device()()};

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

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

  int n;
  cin >> n;
  vector<int> ng = {1,   2,    4,    8,    16,   32,    64,    128,  256,
                    512, 1024, 2048, 4096, 8192, 16384, 32768, 65536};
  auto itr = lower_bound(ng.begin(), ng.end(), n);
  if (itr != ng.end() && *itr == n) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  set<int> adj = {3, n + 2};
  vector<int> u = {1, 2, 3, n + 1, n + 2}, v = {2, 3, n + 1, n + 2, n + 3};
  for (int i = 4; i <= n - 1; i += 2) {
    u.push_back(n + 1);
    v.push_back(i);

    u.push_back(i);
    v.push_back(i + 1);

    u.push_back(n + 1);
    v.push_back(i + 1 + n);

    u.push_back(i + 1 + n);
    v.push_back(i + n);

    adj.insert(i);
    adj.insert(n + i + 1);
  }
  if (n % 2 == 0) {
    for (int i = n - 1; i >= 1; i--) {
      int x = i, y = n ^ 1 ^ x;
      if (x == y || y == 1) continue;
      u.push_back(n);
      if (adj.count(x)) {
        v.push_back(x);
      } else {
        v.push_back(n + x);
      }
      u.push_back(2 * n);
      if (adj.count(y)) {
        v.push_back(y);
      } else {
        v.push_back(n + y);
      }
      break;
    }
  }
  int sz = u.size();
  assert(sz == 2 * n - 1);
  for (int i = 0; i < 2 * n - 1; i++) {
    cout << u[i] << " " << v[i] << endl;
  }
}


Measured memory_bytes: 9584
n, l = map(int, input().split())

aji = []
abs_min_aji = abs(l)
abs_min_aji_i = 0
for i in range(n):
    v = l + i+1 - 1
    aji.append(v)
    if abs_min_aji > abs(v):
        abs_min_aji = abs(v)
        abs_min_aji_i = i

print(sum(aji)-aji[abs_min_aji_i])

Measured memory_bytes: 3060
#include<iostream>
#include <complex>
#include <vector>
#include<string>
using namespace std;
int main() {

	int a, b, c, d;

	cin >> a >> b >> c >> d;
	string result = "No";
	if (abs(a - c) <= d) {
		result = "Yes";
	}
	else if ((abs(a - b) <= d) && (abs(b - c) <= d)) {
		result = "Yes";
	
	}

	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
m,n = list(map(int,input().split()))
tbl = [[0 for i in range(n+1)] for j in range(m+1)]
s= [0 for i in range(n+1)]
for i in range(m):
    l=list(map(int,input().split()))
    l.append(sum(l))
    tbl[i]=l
for j in range(n+1):
    for i in range(m):
        s[j] += tbl[i][j]
tbl[m] = s
for i in range(m+1):
    for j in range(n):
        print(tbl[i][j],end=" ")
    print(tbl[i][n],end="\n")    


Measured memory_bytes: 6188
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector< pi > 
const int N=200005;

int main()
{
  ll h,a;
  cin>>h>>a;
  cout<<(h+a-1)/a;
  	return 0;
}

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

#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define pr(x) printf("%d",x)
#define prl(x) printf("%lld",x)
#define LL long long
#define pb push_back
#define PB pop_back
#define PF pop_front
#define F first
#define S second
#define inrow(vec)    for(int i=0;i<vec.size();i++)cout<<vec[i]<<" ";
#define incoloum(vec) for(int i=0;i<vec.size();i++)cout<<vec[i]<<endl;

const double PI=3.1415926;
const int KL=1e6;

using namespace std;

LL q,x,y,z,n,m,p[KL],mn=1e9,mx=-1e9,ans;
string t;
vector <LL> vec;
set <int> s;
map <int,int> M;


int main()
{
   cin>>m>>n;
   for(LL i=0;i<n;i++)
   {
       scl(x);y+=x;
   }
   if(y>=m)cout<<"Yes";
   else cout<<"No";
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int c[200002];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>c[i];
	sort(c,c+n);
	cout<<c[n-1]<<' ';
	int ans=2147483647,res,i;
	for(i=0;i<n-1;i++)
		if(fabs((c[n-1]/2.0)-c[i])<ans)
			ans=fabs(c[i]-(c[n-1]/2.0)),
			res=i;
	cout<<c[res];
}
//11


Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();		
		int x2 = sc.nextInt();		
		int x3 = sc.nextInt();		
		int x4 = sc.nextInt();		
		int x5 = sc.nextInt();		
		if(x1 == 0){
			System.out.println(1);
		}
		if(x2 == 0){
			System.out.println(2);
		}
		if(x3 == 0){
			System.out.println(3);
		}
		if(x4 == 0){
			System.out.println(4);
		}
		if(x5 == 0){
			System.out.println(5);
		}

	}
}


Measured memory_bytes: 27056
# -*- coding: utf-8 -*-

s = input()

i = len(s)

while i != 0:
    if s[i-5:i] == "dream":
        i -= 5
    elif s[i-7:i] == "dreamer":
        i -= 7
    elif s[i-5:i] == "erase":
        i -= 5
    elif s[i-6:i] == "eraser":
        i -= 6
    else:
        break

if i == 0:
    ans = "YES"
else:
    ans = "NO"

print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int N, A, B;
    cin >> N;
    if (N == 1)
        cout << "Hello World";
    else {
        cin >> A >> B;
        cout << A + B;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);

    int tmp;
    int min = 1000001;
    int max = -1000001;
    long long sum = 0;

    for (int i = 0; i < n; i++) {
        scanf("%d", &tmp);
        if (tmp < min) {
            min = tmp;
        }
        if (tmp > max) {
            max = tmp;
        }
        sum += tmp;
    }

    printf("%d %d %lld\n", min, max, sum);

    return 0;
}


Measured memory_bytes: 2144
#include <stdio.h>

#define N 100000


int main()
{
  int bi[N],nary[N],num1,num2,i;
  int left,right;
  int cnt=0;
  int mid,j;
  
  scanf("%d", &num1);
  for ( i = 0; i < num1; i++ ) scanf("%d", &bi[i]);

  scanf("%d",&num2);
  for(j=0;j<num2;j++) {
    scanf("%d",&nary[j]);
    left = 0;
    right = num1;
    while( left < right ){
      mid = (left + right) / 2;
      if (bi[mid] == nary[j]){
	cnt++;
	break;
      }
      else if (nary[j] < bi[mid]){
	right = mid;
      }
      else{
	left = mid + 1;
      }
    }
  }

  printf("%d\n",cnt);
	       
  return 0;
}




Measured memory_bytes: 3348
import os, sys, re, math

N = int(input())

factor = {}

def doit(n):
    ret = {}
    for i in range(2,11):
        while n % i == 0:
            n = n // i
            ret[i] = ret.get(i,0) + 1

    if n != 1:
        ret[n] = ret.get(n,0) + 1
    return ret

for i in range(2,N+1):
    tmp = doit(i)
    for k,v in tmp.items():
        factor[k] = factor.get(k,0) + v

d3 = 0
d5 = 0
d15 = 0
d25 = 0
d75 = 0

for k,v in factor.items():
    if v >= 74:
        d75 += 1
    if v >= 24:
        d25 += 1
    if v >= 14:
        d15 += 1
    if v >= 4:
        d5 += 1
    if v >= 2:
        d3 += 1

print(d75+d25*(d3-1)+d15*(d5-1)+d5*(d5-1)*(d3-2)//2)


Measured memory_bytes: 38384