akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード↓

ll n,cnt;
string s;
map<string, ll> Data;

int main() {
	cin >> n;
	rep(i, n) {
		cin >> s;
		Data[s] ++;
	}
	for (auto itr = Data.begin(); itr != Data.end(); itr++) cnt++;
	cout << cnt << endl;

	

	return 0;
}



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

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

int main()
{
	int N;
	vec(D)
		cin >> N;
	fx(N) {
		vecp(D)
	}
	sorts(D)
		if (D.at(N / 2) == D.at(N / 2 - 1)) {
			ce(0)
		}
		else {
			ce(D.at(N/2)-D.at(N/2-1))
		}

    return 0;
}



Measured memory_bytes: 892
N, A, B = map(int, input().split())

if N == 1 :
    if A != B :
        ans = 0
    else :
        ans = 1



elif A > B :
    ans = 0
elif A == B :
    ans = 1
else:
    ans = (B*(N-1)+A) - (A*(N-1)+B) + 1

print(ans)


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
#define pqasc priority_queue<long long, vector<long long>, greater<long long>>

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

class UnionFind{
private:
  vector<int> Parent; 
 public:
  UnionFind(int N){
    Parent = vector<int>(N, -1);
  }
  
  int root(int A){
    if(Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }
  
  int size(int A){
    return -Parent[root(A)]; 
  }
  
  bool connect(int A, int B){
    A = root(A);
    B = root(B);
    if(A == B){
      return false;
    }
    if(size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
  
  bool isSame(int A, int B){
    return root(A) == root(B);
  }
};

long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }

long long ngcd(vector<long long> a) {
  long long res = a[0];
  for(int i=1; i<a.size() && res!=1; i++) res = gcd(a[i], res);
  return res;
}

long long nlcm(vector<long long> a){
  long long res = a[0];
  for(int i=1; i<a.size(); i++) res = lcm(a[i], res);
  return res;
}

bool is_prime(long long n) {
  if(n < 2) return false;
  for (long long i = 2; i * i <= n; i++) if (n % i == 0) return false;
  return true;
}

int digsum(int n) {
  int res=0;
  while(n) res += n%10, n /= 10;
  return res;
}

int digcnt(int n){
  int res=0;
  while(n) res++, n /= 10;
  return res;
}

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  string s; cin>>s;
  int n=s.size();
  int ans=INF;
  rep(i,n-2){
    int tmp=0;
    rep(j,3){
      tmp=tmp*10+(s[i+j]-'0');
    }
    chmin(ans,abs(tmp-753));
  }
  cout<<ans<<endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

double dp[1<<15][15];
int prevBit[1<<15][15];
int prevPos[1<<15][15];
int num[15], dist[15], cnt[15];

int main() {
	int n;
	cin >> n;
	REP(i, n) scanf("%d %d %d", &num[i], &dist[i], &cnt[i]);
	
	fill(dp[0], dp[1<<15], INF);
	REP(i, n) dp[1<<i][i] = 0.0;
	
	REP(i, 1<<n) REP(j, n) {
		if (dp[i][j] == INF) continue;
		
		int weight = 0;
		REP(k, n) if ((i >> k) & 1) weight += cnt[k] * 20;
		double speed = 2000.0 / (70.0 + weight);
		
		REP(k, n) if (((i >> k) & 1) == 0) {
			int next = i | (1 << k);
			double cost = abs(dist[j] - dist[k]) / speed;
			if (dp[next][k] > dp[i][j] + cost) {
				prevBit[next][k] = i;
				prevPos[next][k] = j;
				dp[next][k] = dp[i][j] + cost;
			}
		}
	}
	
	pair<double, int> m = make_pair(INF, -1);
	REP(i, n) m = min(m, make_pair(dp[(1<<n)-1][i], i));
	int nowPos = m.second;
	int nowBit = (1 << n) - 1;
	vector<int> ans;
		
	while (nowBit > 0) {
		ans.push_back(num[nowPos]);
		int nextBit = prevBit[nowBit][nowPos];
		int nextPos = prevPos[nowBit][nowPos];
		
		nowBit = nextBit;
		nowPos = nextPos;
	}
	
	reverse(ans.begin(), ans.end());
	REP(i, ans.size()) printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
	return 0;
}

Measured memory_bytes: 8920
(defun sort-a (a)
  (sort a (lambda (x y) (> (cdr x) (cdr y)))))
(defun solve ()
  (let* ((k (read))
         (n (read))
         (a (make-array (1+ n) :element-type '(cons fixnum fixnum))))
    (dotimes (i n)
      (setf (aref a i) (cons i (read))))
    (setf (aref a n) (cons 0 0))
    (sort-a a)
    (decf (cdr (aref a 0)))
    (loop for i from 1 below k
          with c = (car (aref a 0))
          with j = 0
          when (eq c (car (aref a 0)))
          do (setf j 1)
          when (>= 0 (cdr (aref a j)))
          do (return-from solve (cdr (aref a 0)))
          do (decf (cdr (aref a j)))
          do (setf c (car (aref a j)))
          do (setf j 0)
          do (sort-a a))
    0))
(format t "~A~%" (solve))

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

int main(void){
    int n,w;
    cin>>n;
    
    if(n%2!=0){
        w = (n/2)+1;
        
        cout<<(double)w/(double)n<<endl;
    }else{
        cout<<0.5000000000<<endl;
    }
    return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;
int lis(vector<ll> const& a) {
    int n = a.size();
    const int INF = 1e9;
    vector<int> d(n+1, -INF);
    d[0] = INF;

    for (int i = 0; i < n; i++) {
        int j = upper_bound(d.begin(), d.end(), a[i],greater<int>()) - d.begin();
        if (d[j-1] >= a[i] && a[i] > d[j])
            d[j] = a[i];
    }

    int ans = 0;
    for (int i = 0; i <= n; i++) {
        if (d[i] >=0 )
            ans = i;
    }
    return ans;
}

int main() {
    IOS;
    cin>>n;
    vl v(n);cin>>v;
    cout<<lis(v);
    return 0;
}


Measured memory_bytes: 1536
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000






int main(){
	vector<long long>a;
	int n, k;
	long long x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	if (n == 1){
		printf("0\n");
		return 0;
	}

	f(i, n){
		scanf("%lld", &x);
		a.push_back(x);
	}
	sort(a.begin(), a.end());
	f(i, n){
		if ((2 * i) < (n - 1))ans -= (2 * a[i]);
		else if ((2 * i) >(n - 1))ans += (2 * a[i]);
	}
	if (n % 2 == 0){
		ans -= (a[(n / 2)] - a[(n / 2) - 1]);
	}
	else{
		x = min(a[(n / 2) + 1] - a[(n / 2)], a[(n / 2)] - a[(n / 2) - 1]);
		ans -= x;
	}

	printf("%lld\n", ans);


	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s;
	cout << s.front() << s.size()-2 << s.back() << endl;
	return 0;
}

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

int n,dp[2005][2005];

struct node
{
	int rt;
	int num;
}a[5005];

bool cmp(node a,node b)
{
	return a.num>b.num;
}

int work(int now,int l,int r)
{
	if (l>r)  return a[now].num;
	if (dp[l][r]!=-1)  return dp[l][r];
	
	int first=work(now+1,l+1,r)+a[now].num*abs(a[now].rt-l);
	int second=work(now+1,l,r-1)+a[now].num*abs(a[now].rt-r);
	dp[l][r]=max(dp[l][r],max(first,second));
	
	return dp[l][r];
}

signed main()
{
	cin>>n;
	memset(dp,-1,sizeof(dp));
	for (int i=1;i<=n;i++)  cin>>a[i].num,a[i].rt=i;
	
	sort(a+1,a+n+1,cmp);
	cout<<work(1,1,n)<<endl;
	
	return 0;
}

Measured memory_bytes: 35200
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int memo[100050];

int bank(int c){
    if(c<6) return c;
    if(memo[c]!=0) return memo[c];
    int ans=1<<30;
    chmin(ans,1+bank(c-6));
    if(c>=36)chmin(ans,1+bank(c-36));
    if(c>=216)chmin(ans,1+bank(c-216));
    if(c>=1296)chmin(ans,1+bank(c-1296));
    if(c>=7776)chmin(ans,1+bank(c-7776));
    if(c>=46656)chmin(ans,1+bank(c-46656));
    if(c>=9)chmin(ans,1+bank(c-9));
    if(c>=81)chmin(ans,1+bank(c-81));
    if(c>=729)chmin(ans,1+bank(c-729));
    if(c>=6561)chmin(ans,1+bank(c-6561));
    if(c>=59049)chmin(ans,1+bank(c-59049));
    memo[c]=ans;
    return ans;
}
void solve(){
    int n;
    cin >> n;
    print(bank(n));
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll X;cin>>X;
    for(ll i=-200;i<=200;i++){
        for(ll j=-200;j<=200;j++){
            if(i*i*i*i*i-j*j*j*j*j==X){
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vector<int> > vvi;
typedef vector<pii> vii;
typedef vector<vector<pii> > vvii;
typedef long double ld;
typedef map<int, int> mapii;
typedef map<string, int> mapsi;

#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)
#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)
#define INF  LLONG_MAX
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define pi  acos(-1)
#define mod(n,m) ((n % m + m) % m)
#define eps (1e-8)
#define reset(n, m) memset(n, m, sizeof n)
#define endl '\n'
#define output freopen("output.txt", "w", stdout)
#define mp(x, y, z) {x, {y, z}}

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

	int n;
	cin >> n;
	vi vec;
	vec.push_back(0);
	rep(i, 0, n)
	{
		int x;
		cin >> x;
		vec.push_back(x);
	}
	vec.push_back(0);

	ll dist = 0;
	rep(i, 0, sz(vec)-1)
	{
		dist += (abs(vec[i] - vec[i+1]));
//		cerr << vec[i] << " " << vec[i+1] << " " << dist << endl;
	}
	erep(i, 1, n)
	{
		ll temp = dist;
		temp -= abs(vec[i] - vec[i-1]);
		temp -= abs(vec[i] - vec[i+1]);
		temp += abs(vec[i-1] - vec[i+1]);
		cout << temp << endl;
	}

	return 0;
}


Measured memory_bytes: 1784
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    ll A, B, C;
    cin>>A>>B>>C;
    if(A+B>=C) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

ll num[MAXN];
int n;
ll a,b,c;

ll ceilDiv(ll x, ll y) {
	return x/y+(x%y!=0);
}

bool ok(ll t){
	ll extra = t;
	FOR(i,0,n){
		ll x = num[i]-b*t;
		if (x <= 0) continue;
		if (extra >= ceilDiv(x,c)){
			extra-=ceilDiv(x,c);
		} else {
			return false;
		}
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> a >> b;
	c = a-b;
	FOR(i,0,n){
		cin >> num[i];
	}
	ll lo = 1, hi = MOD;
	while (lo < hi) {
		ll mid = (lo+hi)/2;
		if (! ok(mid)) {
			lo = mid+1;
		} else {
			hi = mid;
		}
	}
	cout << lo << "\n";
}


Measured memory_bytes: 4364
import sys
input = sys.stdin.readline

d, g = [int(x) for x in input().split()]
pc = [[int(x) for x in input().split()] for _ in range(d)]

ans = float("inf")

for i in range(2 ** d):
    s = set() # コンプリートボーナスをもらう
    for j in range(d):
        if (i >> j) & 1:
            s.add(j)
    cnt = 0
    total = 0
    for k in s:
        cnt += pc[k][0]
        total += (k + 1)*pc[k][0]*100 + pc[k][1]
    if total >= g:
        ans = min(ans, cnt)
        continue
    for l in range(d - 1, -1, -1):
        flag = 0
        if l in s:
            continue
        for m in range(1, pc[l][0]):
            total += (l + 1) * 100
            cnt += 1
            if total >= g:
                flag = 1
                break
        if flag:
            break
    if total >= g:
        ans = min(ans, cnt)

print(ans)
            

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string,ll>;
using Map = map<char,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

int main(){
    ll L;
    cin >> L;
    ll R;
    cin >> R;
    if(R-L>2019){
        cout<<0<<endl;
    }
    else{
        ll ans=2020;
        for(ll j=L;j<R;j++){
            for(ll i=j+1;i<=R;i++){
                ans=min(ans,(j*i)%2019)
            ;}
        ;}
        cout<<ans<<endl;
        
    }
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
typedef  long long     ll ;
typedef  unsigned long long ull;
const double EPS= (1e-9);
using namespace std;
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
const int N=100000+9,mod=1000000000+7;
ll cnt[N],fres[N];
void go(int n){

   for(int i=1;i*i<=n;i++){

       if(n%i==0){
         cnt[i]++;
         if(n/i!=i) cnt[n/i]++;
       }

   }
}
ll power(ll b,ll p){

   if(p==0) return 1;
   if((p&(1ll))){
     return b%mod*power((b*b)%mod,p/2)%mod;
   }
   else{
    return  power((b*b)%mod,p/2);
   }
}
int main(){

    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        go(i);
    }
    ll ans=0;
    for(ll i=k;i>=1;i--){
        fres[i]=power(cnt[i],n);
         for(int j=i*2;j<=k;j+=i){
            fres[i]=((fres[i]-fres[j])+mod)%mod;
         }
         ans+= (1ll*fres[i]*i)%mod;
         if(ans>=mod) ans-=mod;

    }
    cout<<ans<<"\n";
}



















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

using namespace std;

long long nC2(long long n) {

    return (n*(n-1))/2;

}

int32_t main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    long long n;

    cin >> n;

    long long m;

    cin >> m;

    long long res = nC2(n) + nC2(m);

    cout << res << '\n';

    return 0;

}



Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ui unsigned int
#define ull unsigned ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define db double
#define mp make_pair
#define X first
#define Y second
#define FR first
#define vi vector<int>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,b,a) for(int i=(b);i>=(a);--i)
#define rep0(i,a,b) for(int i=(a);i<(b);++i)
#define fore(i,a) for(int i=0;i<(a).size();++i)
#define ls x<<1,l,m
#define rs x<<1|1,m+1,r
#define gc getchar
inline ll rd()
{
	ll x=0,w=1;char c=gc();while(!isdigit(c)&&c!='-')c=gc();
	if(c=='-')c=gc(),w=-1;while(isdigit(c))x=x*10+c-48,c=gc();return x*w;
}
const ll inf=1ll<<60;
int tt,cc,S,T;
namespace F
{
	const int N=1010;
	int hd[N],q[N*N],vis[N],pre[N],iter[N];ll d[N];
	struct E{int v,nxt;ll w,c;}e[100000];
	inline void add(int u,int v,ll w,ll c)
	{
		e[++cc]=(E){v,hd[u],w,c};hd[u]=cc;
		e[++cc]=(E){u,hd[v],0,-c};hd[v]=cc;
	}
	inline bool spfa()
	{
		rep(i,0,tt)d[i]=inf,pre[i]=0,vis[i]=0,iter[i]=hd[i];
		int ql=0,qr=0;q[++qr]=S;d[S]=0;vis[S]=1;
		while(ql<qr)
		{
			int x=q[++ql];vis[x]=0;
			for(int i=hd[x],y;i;i=e[i].nxt)if(e[i].w&&d[y=e[i].v]>d[x]+e[i].c)
			{
				d[y]=d[x]+e[i].c;pre[y]=i;
				if(!vis[y]){q[++qr]=y;vis[y]=1;}
			}
		}
		return d[T]<inf;
	}
	ll dfs(int x,ll f)
	{
		if(x==T)return f;ll sf=0;vis[x]=1;
		for(int&i=iter[x];i;i=e[i].nxt)if(e[i].w&&d[e[i].v]==d[x]+e[i].c&&!vis[e[i].v])
		{
			ll w=dfs(e[i].v,min(f-sf,e[i].w));
			e[i].w-=w;e[i^1].w+=w;sf+=w;vis[e[i].v]=w==0;
			if(sf==f)break;
		}
		vis[x]=0;return sf;
	}
	void flw(vector<pll>&p)
	{
		while(spfa())
		{
			ll sf=dfs(S,inf);p.pb(mp(d[T],sf));if(sf>(1ll<<50))break;
//			ll w=inf;for(int x=T;x!=S;x=e[pre[x]^1].v)w=min(w,e[pre[x]].w);p.pb(mp(d[T],w));
//			for(int x=T;x!=S;x=e[pre[x]^1].v)e[pre[x]].w-=w,e[pre[x]^1].w+=w;if(w>(1ll<<50))break;
		}
	}
}
const int N=35;
int n,m,o[N][N],c[N];
struct st{int s,p;ll c;}a[N][N];
inline bool cmp(st a,st b){return a.s<b.s;}
int main()
{
	n=rd();
	rep(i,1,n)
	{
		c[i]=rd();rep(j,1,c[i])a[i][j]=(st){rd(),rd(),rd()};
		sort(a[i]+1,a[i]+c[i]+1,cmp);
	}
	S=1;T=2;tt=2;cc=1;
	rep(i,1,n)
	{
		o[i][0]=S;o[i][c[i]]=T;
		rep0(j,1,c[i])o[i][j]=++tt;
		rep(j,1,c[i])
		{
			F::add(o[i][j-1],o[i][j],a[i][j].p,0);
			F::add(o[i][j-1],o[i][j],inf,a[i][j].c);
		}
	}
	m=rd();
	while(m--)
	{
		int u=rd(),v=rd(),w=rd();
		for(int j=1,k=1;j<=c[v];j++)
		{
			while(k<=c[u]&&a[u][k].s+w<a[v][j].s)k++;
			F::add(o[v][j-1],o[u][k-1],inf,0);
		}
	}
	vector<pll>p;p.clear();F::flw(p);m=rd();
	vector<pll>q;q.clear();ll x=0,y=0;
	fore(i,p){q.pb(mp(x,y));x+=p[i].Y;y+=p[i].X*p[i].Y;}
	while(m--)
	{
		ll A=rd();int x=lb(p.begin(),p.end(),mp(A,-inf))-p.begin();
		if(x==p.size())puts("-1");else printf("%lld\n",q[x].X*A-q[x].Y);
	}
	return 0;
}


Measured memory_bytes: 4512
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	static Queue<Q> queue = new LinkedList<Q>();
	static HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();

	static class Q {
		int pzl;
		int cnt;

		Q (int pzl, int cnt) {
			this.pzl = pzl;
			this.cnt = cnt;
		}
	}

	public static void f() {
		while (!queue.isEmpty()) {
			Q q = queue.poll();
			g(q.pzl, q.cnt);
		}
	}

	public static void g(int pzl, int cnt) {
		if (map.get(pzl) == null) {
			map.put(pzl, cnt);
			int index = search(pzl);
			if (index == 0) {
				queue.add(new Q(swap(pzl, index, 1), cnt + 1));
				queue.add(new Q(swap(pzl, index, 2), cnt + 1));
			} else if (index == 1 || index == 2) {
				queue.add(new Q(swap(pzl, index, 1), cnt + 1));
				queue.add(new Q(swap(pzl, index, 2), cnt + 1));
				queue.add(new Q(swap(pzl, index, 3), cnt + 1));
			} else if (index == 3) {
				queue.add(new Q(swap(pzl, index, 2), cnt + 1));
				queue.add(new Q(swap(pzl, index, 3), cnt + 1));
			} else if (index == 4) {
				queue.add(new Q(swap(pzl, index, 1), cnt + 1));
				queue.add(new Q(swap(pzl, index, 4), cnt + 1));
			} else if (index == 5 | index == 6) {
				queue.add(new Q(swap(pzl, index, 1), cnt + 1));
				queue.add(new Q(swap(pzl, index, 3), cnt + 1));
				queue.add(new Q(swap(pzl, index, 4), cnt + 1));
			} else if (index == 7) {
				queue.add(new Q(swap(pzl, index, 3), cnt + 1));
				queue.add(new Q(swap(pzl, index, 4), cnt + 1));
			}
		}
	}

	public static int search(int pzl) {
		for (int i = 7; 0 <= i; i--) {
			if (pzl % 10 == 0) {
				return i;
			} else {
				pzl /= 10;
			}
		}
		return -1;
	}

	public static int swap(int pzl, int index, int dir) {
		int k = 1;
		for (int i = 0; i < 7 - index; i++) {
			k *= 10;
		}
		if (dir == 1) {
			k /= 10;
			int a = (pzl / k) % 10 * k;
			pzl = pzl - a + a * 10;
		} else if (dir == 2) {
			k /= 10000;
			int a = (pzl / k) % 10 * k;
			pzl = pzl - a + a * 10000;
		} else if (dir == 3) {
			k *= 10;
			int a = (pzl / k) % 10 * k;
			pzl = pzl - a + a / 10;
		} else if (dir == 4) {
			k *= 10000;
			int a = (pzl / k) % 10 * k;
			pzl = pzl - a + a / 10000;
		}
		return pzl;
	}

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

		queue.clear();
		queue.add(new Q(1234567, 0));
		f();
		
		while (sc.hasNext()) {
			a = 0;
			for (int i = 0; i < 8; i++) {
				a *= 10;
				a += sc.nextInt();
			}
			f();
			System.out.println(map.get(a));
		}
	}
}

Measured memory_bytes: 14000
import java.util.ArrayList;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}

	public static void main(String[]$){
		int n=getInt();
		ArrayList<Integer>l=new ArrayList<>();
		int i=1;
		for(;true;++i) {
			l.add(i);
			if(i*(i+1)/2>n)
				break;
		}
		l.remove(Integer.valueOf(i*(i+1)/2-n));
		l.forEach(System.out::println);
	}
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second

typedef pair<lint, lint> P;
const lint MOD = 1e9+7;
const lint INF = MOD * MOD;
const int MAX = 100005;

int main(){
    int n; cin >> n;
    vector<P> vp;
    rep(i, n){
        long x, l; cin>>x>>l;
        vp.push_back(make_pair(x-l, x+l));
    }
    sort(all(vp),[](P const& l, P const& r)->bool{
        return l.se < r.se;
    });
    long now = -1e10; int ans = 0;
    rep(i, n){
        if(vp[i].fi >= now){
            ans++; now = vp[i].se;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
full = 0
for i in range(n):
    full += b[i]
for i in range(n - 1):
    if a[i] + 1 == a[i + 1]:
        full += c[a[i] - 1]
print(int(full))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(d==1){
        cout << 1<<endl;

    }
    else{
        cout << 0<<endl;
    }
    return 0;
}


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

typedef long long int ll; 

int main(void)
{
	ll k;
	char arr[105];
	cin >> k >> arr;
	ll len=strlen(arr);

    if(len<=k)
	cout << arr << endl;
	else
	{
		char ans[105];
	 	for(ll i=0;i<k;i++)
	 		cout << arr[i];
		for(ll i=0;i<3;i++)
		 	cout << ".";
	 	cout << endl; 
	} 


	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<math.h>

using namespace std;

void write(int , int);
int main()
{
  int H, W;
  cin >> H >> W;
  while(H!=0 || W!=0){
    write(H, W);
    cin >> H >> W;
  }
  return 0;
}

void write(int H, int W){
  for(int y=0; y<H; y++){
    for(int x=0; x<W; x++){
      cout << '#';
    }
    cout << endl;
  }
  cout << endl;
}



Measured memory_bytes: 3076
import sys
input = sys.stdin.readline

mod = 10**9+7
n, m = map(int, input().split())
l = [int(input()) for _ in range(m)]

t2 = 0
t1 = 1

for i in range(1,n+1):
  if l == [] or i != l[0]:
    t0 = (t2+t1)%mod
  else:
    l.pop(0)
    t0 = 0
  t2 = t1
  t1 = t0

print(t0)

Measured memory_bytes: 7080
'use strict';
const main = input => {
  const battle = (a, b) => {
    if(a%b==0) return b;
    return battle(b, a%b);
  } 
  const n = parseInt(input[0], 10), a = input[1].split(' ').map(val => parseInt(val, 10));
  // console.log(n, a);
  while(a.length != 1) {
    a[1] = battle(a[0], a[1]);
    a.shift();
  }
  // for (let i = 0; i < n-1; i++) {
  //   a[1] = battle(a[0], a[1]);
  //   a.shift();
  // }
  console.log(a[0]);
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 17484
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 998244353;
const int N = 2e5 + 10;

int dp[3010][3010];

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	for(int i = a; i <= c; i++) {
		for(int j = b; j <= d; j++) {
			if(i == a && j == b) {
				dp[i][j] = 1;
			}
			else {
				if(i != a) {
					dp[i][j] = (dp[i][j] + dp[i - 1][j] * j % mod) % mod;
				}
				if(j != b) {
					dp[i][j] = (dp[i][j] + dp[i][j - 1] * i % mod) % mod;
				}
				if(i != a && j != b) {
					dp[i][j] = (dp[i][j] - (dp[i - 1][j - 1] * (i - 1) % mod * (j - 1) % mod) + mod) % mod;
				}
			}
		}
	}
	cout << dp[c][d];

	return 0;
}

Measured memory_bytes: 74124
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }

int n,m;

	
void solve() {
    int n,d,cnt=0;
    cin>>n>>d;
    rep(i,0,n) {
		  int x,y;
		  cin>>x>>y;
		  int res=x*x+y*y;
		  double ans=sqrt(res);
		  if(ans<=d) cnt++;
		}
		
		cout<<cnt<<endl;
    
 }

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 3672
#include<iostream> 
#include<cstdio> 
using namespace std; 
int main()
{
    double r,S,R;
    cin >>r;
    S=r*r*3.141592653589;
    R=2*r*3.141592653589;
    printf("%f %f", S, R);
    return 0;
    
}


Measured memory_bytes: 3188
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int k,n;
	cin>>k>>n;

	int sum=0;

	for(i=1;i<=n;i++)
	{
		cin>>j;
		sum+=j;
	}

	if(sum>=k)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}

}

Measured memory_bytes: 3652
#include<iostream>

using namespace std;
int n,m,q;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    for(int i=1;i<=b;i++)
    {
        for(int j=1;j<=a;j++) cout<<'1';
        for(int j=a+1;j<=w;j++) cout<<'0';
        cout<<'\n';

    }
    for(int i=b+1;i<=h;i++)
    {
        for(int j=1;j<=a;j++) cout<<'0';
        for(int j=a+1;j<=w;j++) cout<<'1';
        cout<<'\n';
    }

}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
const int N = 30;

int a[N];
int n;
int b[N], c[N]; 

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    for (int i = 1; i <= n-1; i++) cin >> c[i];
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = ans + b[a[i]];
        if (a[i] - a[i-1] == 1) ans = ans + c[a[i-1]];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define Yes()           printf("Yes\n")
#define No()            printf("No\n")
#define YES()           printf("YES\n")
#define NO()            printf("NO\n")
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

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

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int n; cin >> n;
  vector<int> a(n); rep(i, n) cin >> a[i];
  sort(a);
  outl(a[n - 1] - a[0]);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
import java.io.*;
import java.util.*;

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

                long A = scan.nextLong();
                long B = scan.nextLong();
                long C = scan.nextLong();
                long K = scan.nextLong();

                if (K <= A) {
                        System.out.println(K);
                } else if (K <= A + B) {
                        System.out.println(A);
                } else {
                        System.out.println(2*A+B-K);
                }
        }
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

void solve() {
  int A, B, X;
  cin >> A >> B >> X;
  if (X >= A && X <= A + B) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
from math import sqrt
from typing import List, Tuple


def distance(p: Tuple[float, float], q: Tuple[float, float]) -> float:
    return sqrt((p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2)


def closest_distance(points: List[Tuple[float, float]]) -> float:
    def split(i: int, j: int) -> float:
        if j - i < 2:
            return float('INF')
        mid = (i + j) // 2
        d = min(split(i, mid), split(mid, j))
        lv, rv = points[mid][0] - d, points[mid][0] + d
        return merge(sorted([p for p in points[i:j]
                             if lv <= p[0] <= rv], key=itemgetter(1)), d)

    def merge(_points: List[Tuple[float, float]], d: float) -> float:
        n = len(_points)
        for i in range(n - 1):
            for j in range(i + 1, n):
                if d < _points[j][1] - _points[i][1]:
                    break
                d = min(d, distance(_points[i], _points[j]))
        return d

    points.sort(key=itemgetter(0, 1))
    return split(0, len(points))


if __name__ == '__main__':
    n = int(input())
    points = [tuple(map(float, input().split())) for _ in range(n)]
    print("{:.6f}".format(closest_distance(points)))  # type: ignore



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

C = A + B
ans = []
df = 0
f = 0

for i in range(N):
  s = S[i]
  if s == 'c':
    ans.append('No')
    continue
  elif s == 'a':
    df += 1
    if df <= C:
      ans.append('Yes')
    else:
      ans.append('No')
  elif s == 'b':
    df += 1
    f += 1
    if df <= C and f <= B:
      ans.append('Yes')
    else:
      df -= 1
      ans.append('No')
      
print('\n'.join(ans))
      


Measured memory_bytes: 5924
#include<bits/stdc++.h>
using namespace std;
long long DP[5005][5005];
int po=5e8+4;
int mod=1e9+7;
int main(){
  int N;
  string S;
  cin>>N>>S;
  DP[0][0]=1;
  for(int i=1;i<N+1;i++){
    (DP[i][0]=DP[i-1][1]+DP[i-1][0])%=mod;
    for(int j=1;j<N+1;j++){
      (DP[i][j]=DP[i-1][j-1]*2+DP[i-1][j+1])%=mod;
    }
  }
  long long ans=DP[N][S.size()];
  for(int i=0;i<S.size();i++){
    (ans*=po)%=mod;
  }
  cout<<ans<<endl;
  return 0;
}
  


Measured memory_bytes: 195712
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    
    ll N;
    cin >> N;
    ll ans = N;
    for (ll i = 1; i*i <= N; i++) {
        if(N%i == 0){
            ans = min(ans, i+N/i-2);
        }
    }
    cout << ans << endl;
    
    
    return 0;
}



Measured memory_bytes: 384
fun main(args: Array<String>){
  var n = readLine()!!.toInt()
  var h = readLine()!!.split(" ").map(String::toInt)
  var a = 0
  var num = h[0]
  for(i in 0..n-1){
    if(num<=h[i]){
      a++
      num = h[i]
    }
  }
  println(a)
}

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

int main(){
    int n;
    cin >> n;
    vector<int> alpha(26, 50);
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        vector<int> used(26,0);
        for(int j=0; j<s.size(); j++){
            used.at(s.at(j)-'a')++;
        }
        for(int j=0; j<26; j++){
            alpha.at(j) = min(alpha.at(j), used.at(j));
        }
    }
    for(int i=0; i<26; i++){
        //cout << alpha.at(i) << " ";
        for(int j=0; j<alpha.at(i); j++){
            cout << (char)(i+'a');
        }
    }
    cout << endl;
}

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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=1e9+7;
const int N=2e5+5;


int main(){
    ll A, B, K; cin >> A >> B >> K;
    ll res1, res2;
    if(A >= K){
        res1=A-K;
        res2=B;
    }
    else{
        res1=0;
        res2=max(0LL, B-(K-A));
    }
    cout << res1 << " " << res2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
//ここから



void solve(){
  string o,e;
  cin>>o>>e;
  int a=o.size(),b=e.size();
  rep(i,a+b){
    if(i%2==0)cout<<o[i/2];
    else cout<<e[i/2];
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 256