akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    LL pre = 0;
    LL ans = 0;
    REP(i,N)
    {
        dump(i)
        dump(pre)
        LL tmp; cin >> tmp;
        if(pre == 1 && tmp > 0)
        {
            tmp--;
            ans++;
        }
        ans += tmp / 2;
        if(tmp % 2 == 1) pre = 1;
        else pre = 0;

        dump(ans)

    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,j,k,l;
    int n;
    int count=0;
    while(scanf("%d",&n)==1)
    {
        for(i=0;i<10;i++)
        {
            for(j=0;j<10;j++)
            {
                for(k=0;k<10;k++)
                {
                    for(l=0;l<10;l++)
                    {
                        if(i+j+k+l==n)
                        count++;
                    }
                }
            }
        }
        printf("%d\n",count++);
        count =0;
    }
    return 0;
}

Measured memory_bytes: 596
N,K = map(int,input().split())
ls = []
for i in range(N):
  ls.append(int(input()))
ls.sort()
ls.reverse()
minimum = 10**10
for i in range(N-K+1):
  if ls[i]-ls[i+K-1] < minimum:
    minimum = ls[i]-ls[i+K-1]
print(minimum)

Measured memory_bytes: 7384
#include<bits/stdc++.h>
#define INF 2147483647
#define SYOU(x) setprecision(x)
using namespace std;
long long i[300000];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=1,f=0;
  cin >>a>>b;
  if((a*b)%2==0) cout <<"No\n";
  else cout <<"Yes\n";
  return (0);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void YN(bool f){ cout << (f ? "YES" : "NO");}
void yn(bool f){ cout << (f ? "yes" : "no");}
void YeNo(bool f) {cout << (f ? "Yes" : "No");}
template <class T> T modpow(T a, T b) {
    const int MOD = 1e9 + 7;
    if (b == 0) return 1;
    if (b % 2 == 0) {
        long long d = modpow(a, b / 2);
        return (d * d) % MOD;
    } else {
        return (a * modpow(a, b - 1) % MOD);
    }
}
template<class T> T mod_nCr(T n, T r, T MOD) {
    T denom = 1;
    T numer = 1;
    for (ll i = 1; i <= r; i++) numer = (numer * i) % MOD;
    for (ll i = n - r + 1; i <= n; i++) denom = (denom * i) % MOD;
    return (denom * modpow(numer, MOD - 2) % MOD);
}
signed main(){
    int n,k; cin >> n >> k;
    const int mod = (1e9) + 7;
    int red = n - k;
    int blue = k;
    rep(i,k){
        int cnt = i + 1;
        if(i == 0 or i == k-1){
            // all use.
            cout << mod_nCr(red + 1, cnt,mod) << endl;
        } else {
            int ans = mod_nCr(red+1,cnt,mod);
            int tmod = mod_nCr((blue - cnt) + cnt - 1,blue
                               -cnt,mod);
            cout <<(ans *tmod) % mod << endl;
        }
    }
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define INF -1
#define ll long long
using namespace std;

int main()
{
	int h, k, tmp;
	ll int sum = 0LL;
	priority_queue<int, vector <int>, greater<int>> q;

	cin >> h >> k;

	for (int i = 0; i < h; i++) {
		cin >> tmp;
		q.push(tmp);
	}

	for (int i = 0; i < h - k; i++) {
		sum += (ll int)q.top();
		q.pop();
	}

	printf("%lld", sum);

	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> a, b, c;
  for (int i = 0; i < N; i++) {
    int ai;
    cin >> ai;
    a.push_back(ai);
  }
  for (int i = 0; i < N; i++) {
    int bi;
    cin >> bi;
    b.push_back(bi);
  }
  for (int i = 0; i < N-1; i++) {
    int ci;
    cin >> ci;
    c.push_back(ci);
  }
  int res = 0;
  for (int i = 0; i < N; i++) {
    res += b[a[i] - 1];
    if (i != 0 && a[i-1] == a[i] - 1) {
      res += c[a[i-1] - 1];
    }
  }
  cout << res;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * 解説通り実装したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			long nowT = 1, nowA = 1;
			for (int i = 0; i < n; i++) {
				int t = scanner.nextInt();
				int a = scanner.nextInt();
				long m = Math.max((nowT - 1 + t) / t, (nowA - 1 + a) / a);
				nowT = m * t;
				nowA = m * a;
			}
			System.out.println(nowT + nowA);
		}
	}
}


Measured memory_bytes: 23512
N = input()
K = int(input())

# K = 1の時の組み合わせを求める関数
def func_1(N):
    Nm = int(N[0])
    return Nm + 9 * (len(N) - 1)

# K = 2の時の組み合わせを求める関数
def func_2(N):
    #NはStringなので
    #print(N[0])

    Nm = int(N[0])
    m = len(N)
    #if m == 1:
     #   print("0")
    #print((Nm-1)*(m-1)*9)
    #print((m - 1) * (m - 2) * 9 * 9 / 2)
    x = int(N) - Nm * pow(10, m-1)
    #print(x)
    #print(1)
    #print(func_1(str(x)))


    return  int((Nm-1)*(m-1)*9+(m-1)*(m-2)*9*9/2+func_1(str(x)))

def func_3(N):
    #print("OK")
    Nm = int(N[0])
    m = len(N)
   # if m == 1 or m == 2:
     #   print("0")
    return int(pow(9,3)*(m-1)*(m-2)*(m-3)/6+(Nm-1)*(m-1)*(m-2)*9*9/2+func_2(str(int(N)-Nm*(10**(m-1)))))



if K == 1:
    print(func_1(N))
elif K == 2:
    print(func_2(N))
elif K == 3:
    print(func_3(N))

Measured memory_bytes: 3064
n = int(input())
a = [int(x) for x in input().split(' ')]

x = {}
min_value = 1
is_found = False
for i in range(n):
    if a[i] == min_value:
        min_value += 1
        is_found = True

if is_found:
    print(n - (min_value - 1))
else:
    print(-1)


Measured memory_bytes: 26140
alphabet = "a".."z"
cnt = {}
for i in alphabet
   cnt[i] = 0
end


while line = gets
   line.each_char{|char|
      for i in alphabet
         if i == char.downcase
            cnt[i] += 1
         end
      end
   }
end

cnt.each{|val,key|
   puts "#{val} : #{key}"
}

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

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& it : a) cin >> it;
    int mx = a[0];
    ll ans = 0;
    for (int i = 1; i < n; i++) {
        mx = max(mx, a[i]);
        ans += ll(mx - a[i]);
    }
    cout << ans << '\n';
    return 0;
}

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

int main() {
    char a, b;

    cin >> a >> b;

    bool ans = false;

    if (a == 'H') {
        if (b == 'H') ans = true;
        else ans = false;
    }
    else {
        if (b == 'H') ans = false;
        else ans = true;
    }

    if (ans) cout << 'H' << endl;
    else cout << 'D' << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    int S;
    cin >> S;
    int ans = 1;
    while (S != 4 && S != 2 && S != 1)
    {
        S = ((S % 2) ? (3 * S + 1) : S / 2);
        ans++;
    }
    cout << (ans + 3) << endl;
    return 0;
}

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

for i in range(m):
    t1, t2 = input().split()
    ss.append([t1, t2])

ss.sort(key=lambda x:x[0])

t = ''
ac = 0
wa = 0
awa = 0
cIsSolved = False
for s in ss:
    if s[0] != t:
        t = s[0]
        cIsSolved = False
        wa = 0
    if s[1] == 'AC' and not cIsSolved:
        cIsSolved = True
        ac += 1
        awa += wa
    if s[1] == 'WA' and not cIsSolved:
        wa += 1
print(ac, awa)


Measured memory_bytes: 25988
using System;
        using System.Linq;
        using System.Collections.Generic;
        using static System.Math;

        public class Program
        {
            public static void Main(string[] args)
            {
            int n = int.Parse(Console.ReadLine());
            int[] ta = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] h = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            double abs = 0;
            int answer = 0;

            for(int i = 0; i < n; i++)
            {
                if (i == 0)
                {
                    abs = Abs(ta[1] - (ta[0] - h[i] * 0.006));
                    answer = i + 1;
                }

                double stock = Abs(ta[1] - (ta[0] - h[i] * 0.006));
                if(stock < abs)
                {
                    abs = stock;
                    answer = i + 1;
                }
            }
            Console.WriteLine(answer);
            }
        }

Measured memory_bytes: 13340
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int H[100010];
    rep(i, N) cin >> H[i];
    rep(i, N) {
        int j = i;
        while(j + 1 < N && H[j] >= H[j + 1]) j++;
        //cout << i << " " << j << endl;
        if (H[i] - H[j] > 1) {
            cout << "No" << endl;
            return 0;
        }
        i = j;
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int score = 0;
  rep(i,n-1) {
    if (s[i] == s[i+1]) score++;
  }
  int ans = min(score+2*k, n-1);
  cout << ans << endl;
  return 0;
}

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

#define ll long long
const int MOD = 1e9 + 7;

void setIO(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

int main() {
	setIO();
	string s; int k; cin >> k;
	cin >> s;
	if(s.length() <= k){
		cout << s << "\n";
	}
	else{
		for(int i = 0; i < k; ++i){
			cout << s[i];
		}
		cout << "...\n";
	}
}


Measured memory_bytes: 3656
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i in range(N):
	ans += B[A[i]-1]
	if(i > 0 and A[i-1] + 1 == A[i]):
		ans += C[A[i-1]-1]
print(ans)

Measured memory_bytes: 3064
n=int(input())

d=['3','5','7','']
k=10
a=d
def make(k,l):
    if k==0:
        return l
    t=set()
    for i in l:
        for j in d:
            t.add(i+j)
    return make(k-1,t)

s=[]    
for i in make(k,d):
    if i!='':
        u=set()
        for j in i:
            u.add(j)
        if len(u)==3:
            s.append(int(i))

ans=sum([1 if x<=n else 0 for x in s])
print(ans)


Measured memory_bytes: 120020
N = int(input())
a,b = [], []
for i in range(N):
  x,y = map(int, input().split())
  a.append(x-y)
  b.append(x+y)
a.sort()
b.sort()
ans = max(a[-1] - a[0], b[-1] - b[0])
print(ans)

Measured memory_bytes: 25588
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
//take care of precedence rule of operators 
//do not forget to change the sizes of arrays and value of contants and other things after debugging  
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)
 
#define SZ(x)  (ll)(x.size())
 
//comment the below if not required
 
/*
 
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second
*/
 
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

//cout<<"Case #"<<c<<": "<<ans<<"\n" ;

ll t,n,i,j;
const ll N = 1e6+1; 

ll a[N],gc,isp[N],c[N],f;

void sieve()
{

    for(i=2;i<N;++i)
    {
        if(isp[i]==0)
        {
            isp[i]=i;

            for(j=i*i;j<N;j+=i)
            {
                if(!isp[j])
                    isp[j] = i;
            }
        }
    }

}

void solve(ll a)
{
    vector<ll> v;

    while(a!=1)
    {
        v.pb(isp[a]);
        a = a/isp[a];
    }

    v.erase(unique(v.begin(),v.end()),v.end());

    for(auto u : v)
            ++c[u];
}

int main()
{

    IOS;

    sieve();

    cin>>n;

    rep(i,1,n+1)
    {
        cin>>a[i];

        if(a[i]==1)
        {
            gc = a[i];
        }
        else
        {
            gc = __gcd(a[i],gc);
        }

        solve(a[i]);
    }

   

    rep(i,1,N)
    {
        if(c[i]>1)
            break;
    }


    if(i==N)
        f=1;


    if(f)
        cout<<"pairwise coprime";
    else if(gc==1)
        cout<<"setwise coprime";
    else
        cout<<"not coprime";




    return 0;
}

Measured memory_bytes: 26948
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int gcd(int a, int b){
    int c;
    while(b != 0){
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main(){
    int n, x;
    cin >> n >> x;
    vector<int> a(n + 1);
    in_arr(int, a, n);
    a[n] = x;
    sort(a.begin(), a.end());
    vector<int> d(n);
    rep(i, n){
        d[i] = a[i + 1] - a[i];
    }
    if(d.size() == 1){
        cout << d[0] << endl;
        return 0;
    }
    int ans = gcd(d[0], d[1]);
    rep(i, n){
        ans = gcd(ans, d[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = inputs[0]
    T = inputs[1]

    appeared = {}
    appeared_count = {}
    for i, _ in enumerate(S):
        if T[i] in appeared:
            if not appeared[T[i]] == S[i]:
                return "No"
        else:
            appeared[T[i]] = S[i]
            if S[i] in appeared_count:
                appeared_count[S[i]] += 1
            else:
                appeared_count[S[i]] = 1
    for k, v in appeared_count.items():
        if v > 1:
            return "No"
    return "Yes"


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)


Measured memory_bytes: 4136
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

#define INF 1000000000

typedef const vector<int> &rvint;
typedef vector<vector<int> > vvint;

void WF(vvint &v){
	int n = v.size();
	for(int k = 0; k < n; ++k)
	for(int i = 0; i < n; ++i)
	for(int j = i + 1; j < n; ++j){
		v[i][j] = v[j][i] = min(v[i][j], v[i][k] + v[k][j]);
	}
}

int calccost(rvint r, rvint q, rvint sumdc, int d){
	if( d == INF ) return INF;

	int x = upper_bound(q.begin(), q.end(), d) - q.begin() - 1;
	return sumdc[x] + r[x] * (d - q[x]);
}

int main(){
	int n, m, c, s, g;
	int x, y, d, cm;
	int p[20];
	while( scanf("%d%d%d%d%d", &n, &m, &c, &s, &g), n != 0 ){
		vector<vvint> mindist(c, vvint(n, vector<int>(n, INF) ) );
		vvint mincost(n, vector<int>(n, INF) );
		
		for(int i = 0; i < m; ++i){
			scanf("%d%d%d%d", &x, &y, &d, &cm);
			--x; --y; --cm;
			d = min(d, mindist[cm][x][y]);
			mindist[cm][x][y] = mindist[cm][y][x] = d;
		}
		
		for(int i = 0; i < c; ++i){
			scanf("%d", &p[i]);
		}
		
		for(int i = 0; i < c; ++i){
			vector<int> sumdc(p[i]), r(p[i]), q(p[i]);
			for(int j = 1; j < p[i]; ++j){
				scanf("%d", &q[j]);
			}
			for(int j = 0; j < p[i]; ++j){
				scanf("%d", &r[j]);
			}
			
			for(int j = 1; j < p[i]; ++j){
				sumdc[j] = sumdc[j-1] + (q[j] - q[j-1]) * r[j-1];
			}

			WF(mindist[i]);
			
			for(int j = 0; j < n; ++j)
			for(int k = j + 1; k < n; ++k){
				int a = calccost(r, q, sumdc, mindist[i][j][k]);
				mincost[j][k] = mincost[k][j] = min(mincost[j][k], a);
			}
		}

		WF(mincost);
		int ans = mincost[s-1][g-1];
		printf("%d\n", ans < INF ? ans : -1);
	}
}

Measured memory_bytes: 1796
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;		
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

	ll modinv(ll a)
	{
		ll b = max, u = 1, v = 0;
		while (b) 
		{
			ll t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= max;
		if (u < 0)
			u += max;
		return u;
	}

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	priority_queue<ll> q;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll need = 0;
	int change = 0;
	for (int i = 0; i < n; i++)
	{
		ll in;
		cin >> in;
		if (in > a[i])
			need += in - a[i], change++;
		else if (in < a[i])
			q.push(a[i] - in);
	}

	while (need > 0)
	{
		if (q.empty())
			break;
		need -= q.top();
		q.pop();
		change++;
	}

	if (need > 0)
		printf("-1");
	else
		printf("%d", change);

	//printf("%d", r);

	return 0;
}


Measured memory_bytes: 2292
/*
 _ _ _   _    _   _    _   _ _ _   _    _   _ __ _   __       __
|  _ _| | |  | | | |  | | |  _  | | |  | | |  __  | |   \   /   |
| |_ _  | |__| | | |  | | | |_| | | |__| | | |__| | | |\ \_/ /| |
|_ _  | |  __  | | |  | | |  _ <  |  __  | |  __  | | | \   / | |
 _ _| | | |  | | | |__| | | |_| | | |  | | | |  | | | |  \_/  | |  _   _   _
|_ _ _| |_|  |_| |_ __ _| |_ _ _| |_|  |_| |_|  |_| |_|       |_| |_| |_| |_|

*/

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
#define endl "\n"

const int  MOD=1000000007;
ll dp[3030][3030]={0};

void solve() {
    ll n,T;
    cin>>n>>T;
    pair<ll,ll> p[n];
    for(long int i=0; i<n; i++){
        cin>>p[i].fi>>p[i].se;
    }
    sort(p,p+n);
    ll ans=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<T;j++){
            dp[i][j]=max(dp[i][j],dp[i-1][j]);
            if(j+p[i-1].fi<T){
                dp[i][j+p[i-1].fi]=max(dp[i-1][j+p[i-1].fi],dp[i-1][j]+p[i-1].se);
            }
        }
        ans=max(ans,dp[i-1][T-1]+p[i-1].se);
    }
    cout<<ans<<endl;
}
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t = 1;
    // cin>>t;
    for (long int tt = 1; tt <= t; tt++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 74708
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int>vec(n);
for(int i =0;i<n;i++){
    cin >> vec[i];
}
int max = vec[0];
int min = vec[0];
for(int i = 0;i<n;i++){
    if(vec[i] > max){
        max = vec[i];
    }
}
for(int i = 0;i<n;i++){
    if(vec[i] < min){
        min = vec[i];
    }
}
cout << max - min << endl;
}


Measured memory_bytes: 256
x = int(input())

if x < 600:
    print("8")
elif x < 800:
    print("7")
elif x < 1000:
    print("6")
elif x < 1200:
    print("5")
elif x < 1400:
    print("4")
elif x < 1600:
    print("3")
elif x < 1800:
    print("2")
elif x < 2000:
    print("1")


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

int main(){
    int x;
    int a,b;
    cin>>a>>b;
    x=(a+b);
    if (x%2==0) {
        x=x/2;
    }
    else{
        x=(x+1)/2;
    }
    cout<<x;
    return 0;
    
}


Measured memory_bytes: 256
n = int(input())
a = [int(m) for m in input().split()]
b = [int(m) for m in input().split()]
difp = []
difm = []
difmmm = []
difr = []
for i in range(n):
    if a[i] - b[i] >= 0:
        difp.append([a[i] - b[i], i])
    else:
        difm.append([a[i] - b[i], i])
        difmmm.append(1)
        difr.append(abs(a[i] - b[i]))

difp.sort(reverse=True)

if sum(a) < sum(b):
    print(-1)
    exit()
Q = sum(difmmm)
R = sum(difr)
tmp = 0
sign = Q
if difm == []:
    print(0)
    exit()
for i in range(len(difp)):
    tmp += difp[i][0]
    if tmp >= R:
        sign += i + 1
        break

print(sign)

Measured memory_bytes: 30936
#include <bits/stdc++.h>
#include <atcoder/all>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

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

void solve(ll N, ll M, vector<ll> A, vector<ll> B) {
  dsu d(N);
  REP(i, M)
    d.merge(A[i] - 1, B[i] - 1);
  cout << d.groups().size() - 1 << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;
  ll M;
  cin >> M;
  vector<ll> A(M);
  vector<ll> B(M);
  REP(i, M) {
    cin >> A[i];
    cin >> B[i];
  }

  solve(N, M, move(A), move(B));

  return 0;
}


Measured memory_bytes: 9044
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const int N=  2e5 + 10;
map<int, int> mp;
int a[N];
ll ans;
int main(){
	int n;
	scanf("%d", &n);
	for(int i =1; i <= n; i++){
		scanf("%d", &a[i]);
		mp[i - a[i]]++;
	}
	for(int i = 1; i <= n; i++){
		mp[i - a[i]]--;
		ans += mp[i + a[i]];
	}
	printf("%lld", ans);
}

Measured memory_bytes: 21448
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, L;
const int MAX_N = 100000;
ll a[MAX_N];

int main(){
  cin >> N >> L;
  REP(i, N) cin >> a[i];

  REP(i, N - 1) {
    if(a[i] + a[i + 1] >= L) {
      cout << "Possible" << endl;
      REP(j, i) {
        cout << j + 1 << endl;
      }
      for (int j = N - 1; j >= i + 1; j--) {
        cout << j << endl;
      }
      return 0;
    }
  }

  cout << "Impossible" << endl;

  return 0;
}



Measured memory_bytes: 1664
#include <stdio.h>
#include <string.h>
#define M 1000000
#define L 14
char H[M][L];
int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  else return 0;
}
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}
int h1(int key){ return key%M; }
int h2(int key){ return 1+(key%(M-1)); }
int find(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0)return 0;
  }
  return 0;
}
int insert(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}
int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

Measured memory_bytes: 14280
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;
long long modinv(long long a, long long mod) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

// nが大きく(例えば10^9)、kが小さい際に有効.
// nが間に合うならこちらも[https://izumo27.hatenablog.com/entry/2018/06/04/213000]
long long modcomb(long long n, long long k, long long mod) {
    // numerator / denominator
    long long nume = 1;
    long long deno = 1;
    rep(i, k) {
        nume *= (n - i);
        nume = nume % mod;
        deno *= (i + 1);
        deno = deno % mod;
    }
    return nume % mod * modinv(deno, mod) % mod;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    const long long MOD = 1000000007;

    ll N, K;
    cin >> N >> K;
    for (ll i = 1; i <= K; i++) {
        cout << (modcomb(N - K + 1, i, MOD) * modcomb(K - 1, i - 1, MOD)) % MOD
             << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
a = list(map(int, input().split(" ")))
min8 = a[0]/0.08
max8 = (a[0]+1)/0.08
min10 = a[1]/0.1
max10 =(a[1]+1)/0.1
b = max(min8, min10)
if ((min8>=max10) or (max8<=min10)):
    print(-1)
else:
    print(Decimal(b).quantize(Decimal('0'), rounding = ROUND_HALF_UP))

Measured memory_bytes: 5332
#include <iostream>

int main() {
  int x, y; std::cin >> x >> y;
  bool ans = true;
  // 偶数個
  if ((4*x-y)%2 != 0) ans = false;
  int crane = (4*x-y)/2;
  int turtle = x-crane;
  if (crane + turtle != x) ans = false;
  if (crane < 0) ans = false;
  if (turtle < 0) ans = false;

  if (ans) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  
  return 0;
}


Measured memory_bytes: 3540
###############################################################################

from bisect import bisect_left as binl
from copy import copy, deepcopy

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


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


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * sy) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def main():
    n, m = intin()

    divlist = get_divisors(m)
    divlist.sort()

    for div in divlist:
        if div >= n:
            print(m // div)
            return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3668
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<b;i++){
		int p;scanf("%d",&p);
		a-=p;
	}
	if(a<=0)printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
/* ****Tciitb**** */
                     
#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          int long long
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll ,ll >
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;



int main() {
  io
  
  ll a,b;cin>>a>>b;
  ll ans1=(a+b);
  ll ans2=(a-b);
  ll ans3=(a*b);
  cout<<max(ans1,max(ans2,ans3));

  }
  

  


  




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

int main()
{
    int n, x=0, count=0;
    string str;

    cin>>n>>str;

    while(str.find("ABC", x) != string::npos){
        count++;
        x= str.find("ABC", x) + 3;
    }

    cout<<count;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
    int64_t N, A, B, C;
    cin >> N >> A >> B >> C;
    vector< string > s(N);
    for(int i=0; i<N; i++) {
        cin >> s[i];
    }
    s.push_back("__");

    string ans;
    for(int i=0; i<N; i++) {
        if(s[i] == "AB") {
            if(A < B) {
                ++A;
                --B;
                ans.push_back('A');
            } else if(A > B) {
                --A;
                ++B;
                ans.push_back('B');
            } else if(s[i+1] == "BC") {
                --A;
                ++B;
                ans.push_back('B');
            } else {
                ++A;
                --B;
                ans.push_back('A');
            }
        } else if(s[i] == "BC") {
            if(B < C) {
                ++B;
                --C;
                ans.push_back('B');
            } else if(B > C) {
                --B;
                ++C;
                ans.push_back('C');
            } else if(s[i+1] == "AC") {
                --B;
                ++C;
                ans.push_back('C');
            } else {
                ++B;
                --C;
                ans.push_back('B');
            }
        } else {
            if(C < A) {
                ++C;
                --A;
                ans.push_back('C');
            } else if(C > A) {
                --C;
                ++A;
                ans.push_back('A');
            } else if(s[i+1] == "AB") {
                --C;
                ++A;
                ans.push_back('A');
            } else {
                ++C;
                --A;
                ans.push_back('C');
            }
        }
        if(A < 0 || B < 0 || C < 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    for(auto e: ans) {
        cout << e << endl;
    }
    return 0;
}


Measured memory_bytes: 9604
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d,n,num;
   
  while(cin >> n){
    num = 0;
    for(a = 0;a <=9;a++){
      for(b = 0;b <=9;b++){
    for(c = 0;c <=9;c++){
      for(d = 0;d <=9;d++){
        if(a+b+c+d == n)num++;
      }
    }
      }
    }
    cout << num<< endl;
  }
}

Measured memory_bytes: 3068
# https://atcoder.jp/contests/abc123/tasks/abc123_b

import itertools
import collections
import bisect

def main():
    # big value
    INF = int(1e15)
    last = INF
    menus = []
    for _ in range(5):
        m = int(input())
        if last == INF:
            last = m
        else:
            if m % 10 != 0:
                m_d = m % 10
                l_d = last % 10
                if m_d < l_d:
                    last = m
        menus.append(m)

    ans = 0
    last_done = False
    for m in menus:
        if m == last and not last_done:
            ans += m
            last_done = True
        else:
            if m % 10 == 0:
                ans += m
            else:
                ans += m + (10 - m % 10)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
 int main(){
   int l=0,lm=0;
string s,m;
   cin>>s;
   for(int i=0;i<s.size();i++){
     m=s.at(i);
   if(m=="A"||m=="T"||m=="G"||m=="C"){
     l++;
   }else{
     lm=max(l,lm);
     l=0;
   }
   }
     cout<<max(lm,l)<<endl;;
 }

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

using namespace std;

int main(void){
    double N;
    cin>>N;
    double T,A;
    cin>>T>>A;
    vector<double> H(N);
    for(int i=0;i<N;i++){
        cin>>H[i];
    }
    double ans=1000;
    for(int i=0;i<N;i++){
        double temp=T-H[i]*0.006;
        temp=abs(A-temp);
        ans=min(ans,temp);
    }
    for(int i=0;i<N;i++){
        if(ans==abs(A-(T-H[i]*0.006))){
            cout<<i+1<<endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<string>
#include<algorithm>

using namespace std;

bool is_number(const char& c){
  return (c >= '0' && c <= '9');
}

bool is_not_number(const char& c){
  return !(c >= '0' && c <= '9');
}

int string_to_int(const string& s){
  int n;
  istringstream iss(s);
  iss >> n;
  return n;
}

int solve(string& s){
  int n=0;
  string::iterator i, j;
  j = s.begin();
  while(1){
    i = find_if(j, s.end(), is_number);
    if(i == s.end()) return n;
    j = find_if(i, s.end(), is_not_number);
    n += string_to_int(string(i, j));
  }
}

int main(){
  int n = 0;
  string s;
  while(getline(cin, s)) n += solve(s);
  cout << n << endl;
  return 0;
}

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

int main(void) {
  ios::sync_with_stdio(false);
  string S;
  cin >> S;

  if(S == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , x , c = 1001 , m;
    cin >> n >> x;
    for( int i = 0 ; i < n ; i++ ) {
        cin >> m;
        c = min( c , m );
        x -= m;
    }
    cout << n + x / c;
}


Measured memory_bytes: 3648
import collections
N = int(input())
V = list(map(int,input().split()))
V_even = V[::2]
V_odd = V[1::2]
V_even_counter = collections.Counter(V_even)
V_odd_counter = collections.Counter(V_odd)
if V_even_counter.most_common()[0][0] != V_odd_counter.most_common()[0][0]:
    ans = N - V_even_counter.most_common()[0][1] - V_odd_counter.most_common()[0][1]
else:
    if len(V_even_counter) > 1 and len(V_odd_counter) > 1:
        ans = N - max(V_even_counter.most_common()[0][1] + V_odd_counter.most_common()[1][1],\
            V_even_counter.most_common()[1][1] + V_odd_counter.most_common()[0][1])
    elif len(V_even_counter) == 1 and len(V_odd_counter) > 1:
        ans = N - V_even_counter.most_common()[0][1] - V_odd_counter.most_common()[1][1]
    elif len(V_even_counter) > 1 and len(V_odd_counter) == 1:
        ans = N - V_even_counter.most_common()[1][1] + V_odd_counter.most_common()[0][1]
    else:
        ans = N//2
print(ans)


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

int main() {
   int n;
   cin >> n;
   int l[n];
   for(int i=0;i<n;i++)cin >> l[i];
   sort(l,l+n);
   reverse(l,l+n);
   int sum=0;
   for(int i=1;i<n;i++){
      sum += l[i];
   }
   if(l[0]<sum)cout<<"Yes";
   else cout<<"No";
   return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    S = input()
    ans = 0
    for i in range(1000):
        d0 = str(i % 10)
        d1 = str((i // 10) % 10)
        d2 = str((i // 100) % 10)
        j = 0
        found = False
        while j < N:
            if S[j] == d0:
                found = True
                j += 1
                break
            j += 1
        if not found:
            continue
        found = False
        while j < N:
            if S[j] == d1:
                found = True
                j += 1
                break
            j += 1
        if not found:
            continue
        found = False
        while j < N:
            if S[j] == d2:
                found = True
                j += 1
                break
            j += 1
        if not found:
            continue
        if found:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()


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

#define ls(x) ch[x][0]
#define rs(x) ch[x][1]
#define rep(i , j , k) for(int i = j ; i <= k ; i ++)
#define Rep(i , j , k) for(int i = j ; i >= k ; i --)

using namespace std ;
using ll = long long ;
using pii = pair <int , int> ;
using vii = vector <int> ;

auto ot = [&]() { cerr << "ATS TXDY" << '\n' ; int ATS_nantf_txdy = true ; } ;
auto _ios = [&]() { ios :: sync_with_stdio(false) ; cin.tie(nullptr) ; cout.tie(nullptr) ; } ;

namespace stO_ATS_Orz {
  template < class T > void cmax(T & x , T y) { if(x > y) x = y ; }
  template < class T > void cmin(T & x , T y) { if(x < y) x = y ; }
  template < class T > void abs(T x) { if(x < 0) x = -x ; }
  void main() {
    int n ;
    cin >> n ;
    int l = 0 , r = n , ans = 0 ;
    while(l <= r) {
      int mid = l + r >> 1 ;
      if(mid * 1.08 < n + 1) {
        l = mid + 1 ;
        ans = mid ;
      }
      else {
        r = mid - 1 ;
      }
    }
    if(ans * 1.08 >= n) { cout << ans << '\n' ; }
    else { cout << ":(" << '\n' ; }
  }
}
signed main() {
  _ios() ; ot() ;
  return stO_ATS_Orz :: main() , 0 ;
}

Measured memory_bytes: 384
x1, y1, x2, y2 = map(int, input().split())

def vector(x1, y1, x2, y2):
    return x2 - (y2 - y1), y2 + (x2 - x1)

x3, y3 = vector(x1, y1, x2, y2)
x4, y4 = vector(x2, y2, x3, y3)

print(x3, y3, x4, y4)

Measured memory_bytes: 3060
#include <stdio.h>
typedef long long ll;
#define max(a,b) ((a)>(b) ? (a) : (b))
int main(void){
  ll n,i,j=0,a[200000],tmp=0,result=0;
  scanf("%lld",&n);
  for(i=0;i<n;i++) scanf("%lld",&a[i]);
  for(i=0;i<n;i++){
    j=a[i];
    tmp=0;
    while(j%2==0){
      j/=2;
      tmp++;
    }
    result += tmp;
  }
  printf("%lld",result);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

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

    sort(v.begin(),v.end());
    double ans=v[0];
    rep(i,n){
        if(i==0) continue;
        
        ans+=v[i];
        ans/=2.0;
    }

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

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b
#define rep(i,n) for(int (i)=0;(i)<n;(i)++)
#define read(n) scanf("%d",&n);
#define readll(n) scanf("%lld",&n);
#define readdb(n) scanf("%lf",&n);
#define readch(n) scanf("%c",&n);
#define readstr(n) scanf("%s",n);
#define test printf("test\n");
#define init(n) memset(n,0,sizeof(n));

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
typedef struct p1{
	int first,second;	
}p; 
bool cmp (p a , p b){
	return a.first>b.first;
}
double qpow(double a, ll b) {
      double res = 1;
      while(b) {
          if (b & 1) res = res * a;
          a = a * a;
         b >>= 1;
     }
     return res;
}
ll C(ll n,ll x)
{
	ll ans = 1;
	for(ll i = n , j = 1 ; i >= n-x+1 ; i -- , j ++){
		ans *= i ;
		ans /= j ;
	}
	return ans;
}
int main(){
	int t;
	read(t);
	if(t == 1){
		printf("Hello World");
	}else{
		int a , b;
		read(a);
		read(b);
		printf("%d",a+b);
	}
	
	
	
	
	
	
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 return 0; 
}












Measured memory_bytes: 256