akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void orz(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18;
/***********************************************************************/
struct job {
  int val, lim;
  bool operator < (const job &rhs) const {
    return val > rhs.val;
  }
};
int32_t main() {
 
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n, m;
  cin >> n >> m;
  set<int> s;
  for (int i = 0; i < m; ++i) s.insert(i);
  vector<job> a;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    x = m - x;
    if (x >= 0) {
      a.push_back({y, x});
    }
  }
  int ans = 0;
  sort(ALL(a));
  for (const auto x : a) {
    auto it = s.upper_bound(x.lim);
    if (it == s.begin()) continue;
    s.erase(--it);
    ans += x.val;
  }
  orz(ans);
  
  return 0;
}


Measured memory_bytes: 6140
n,m,c = map(int,input().split())
B = list(map(int,input().split()))
ans = 0

for i in range(n):
    A = list(map(int,input().split()))
    solve = c

    for j in range(m):
        solve += A[j]*B[j]
        
        if j == m-1 and solve > 0:
            ans += 1
            
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
const int mod = 1000000007;
#define Yes(ifeq) cout<<((ifeq)? "Yes":"No")<<endl;

void Main(){
  ll x;
  cin>>x;
  ll ans =0;
  ans+=x/500;
  x-=ans*500;
  ans*=1000;
  ans+=(x/5)*5;
  cout<<ans<<endl;
  return;

} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <bitset>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = Mint(2).pow(n);
  Mint pow(long long n) const {
    if (n==0) return Mint(1);
    Mint y = pow(n>>1); // pow(n/2)を計算する
    y *= y;
    if (n%2==1) y *= *this;
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return a.pow(mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    Mint one = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= (i + one);
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};


int main() {
  int N;
  std::cin >> N;
  std::vector<int > A(N);
  for (int i=0; i<N; i++) {
    std::cin >> A[i];
  }
  long long ans = 0;
  int max = -1;
  for (int i=0; i<N; i++) {
    if (max<=A[i]) {
      max = A[i];
      continue;
    } else {
      ans += max-A[i];
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 3608
n, m = gets.split.map(&:to_i)
relations = []
m.times do
  relations << gets.split.map(&:to_i).sort
end

# graph = Array.new(n) { [] }
# relations.each do |a, b|
#   graph[a - 1] << b - 1
#   graph[b - 1] << a - 1
# end

# groups = []

# 0.upto(n - 1) do |leader|
#   next if groups[leader]

#   queue = [leader]

#   until queue.empty?
#     current = queue.shift
#     next if groups[current]

#     graph[current].each do |friend|
#       next if groups[friend]

#       queue << friend
#     end

#     groups[current] = leader
#   end
# end

# puts groups.tally.values.max

union_find = (0...n).to_a

def root(union_find, a)
  return a if union_find[a] == a

  union_find[a] = root(union_find, union_find[a])
end

def unite(union_find, x, y)
  x = root(union_find, x)
  y = root(union_find, y)
  return if x == y

  union_find[x] = y
end

relations.each do |a, b|
  unite(union_find, a - 1, b - 1)
end

normalized_union_find = (0...n).map { |num| root(union_find, union_find[num])}

pp normalized_union_find.tally.values.max



Measured memory_bytes: 57408
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <complex>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;

const double PI=4*atan(1.0);
const int MAX_SIZE = 10000;
// OÏ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
// a1,a2ð[_Æ·éüªÆb1,b2ð[_Æ·éüªÌð·»è
int is_intersected_ls(P a1, P a2, P b1, P b2) {
    // üªª½sÈêÍdÈÁÄ¢È¢±ÆÉ·é
    if(abs(cross(a2-a1,b2-b1)) < EPS)return 0;
    return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
        ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int na;
int nb;
P ap[1001];
P bp[1001];
const int INF=1000000000;

int main(){

	cin>>na>>nb;
	for(int i=0;i<na;i++){
		int x,y;
		cin>>x>>y;
		ap[i]=P(x,y);
	}
	for(int i=0;i<nb;i++){
		int x,y;
		cin>>x>>y;
		bp[i]=P(x,y);
	}
	// ½s,Ü½ÍNXµÈ¢
	if(!is_intersected_ls(ap[0],ap[1],bp[0],bp[1])){
		double res=abs(ap[0]-ap[1])+abs(bp[0]-bp[1]);
		printf("%.10f\n",res);
	}
	else{
		double res=INF;
		// apðÅèµÄbpð®©·
		for(int i=2;i<nb;i++)
			if(!is_intersected_ls(ap[0],ap[1],bp[0],bp[i])&&!is_intersected_ls(ap[0],ap[1],bp[i],bp[1]))
				res=min(res,abs(ap[0]-ap[1])+abs(bp[0]-bp[i])+abs(bp[1]-bp[i]));
		for(int i=2;i<nb;i++){
			for(int j=2;j<nb;j++){
				if(i==j)continue;
				if(!is_intersected_ls(ap[0],ap[1],bp[0],bp[i])&&!is_intersected_ls(ap[0],ap[1],bp[i],bp[j])&&!is_intersected_ls(ap[0],ap[1],bp[j],bp[1]))
					res=min(res,abs(ap[0]-ap[1])+abs(bp[0]-bp[i])+abs(bp[1]-bp[j])+abs(bp[i]-bp[j]));
			}
		}
		// bpðÅèµÄapð®©·
		for(int i=2;i<na;i++)
			if(!is_intersected_ls(bp[0],bp[1],ap[0],ap[i])&&!is_intersected_ls(bp[0],bp[1],ap[i],ap[1]))
				res=min(res,abs(bp[0]-bp[1])+abs(ap[0]-ap[i])+abs(ap[1]-ap[i]));
		for(int i=2;i<na;i++){
			for(int j=2;j<na;j++){
				if(i==j)continue;
				if(!is_intersected_ls(bp[0],bp[1],ap[0],ap[i])&&!is_intersected_ls(bp[0],bp[1],ap[i],ap[j])&&!is_intersected_ls(bp[0],bp[1],ap[j],ap[1]))
					res=min(res,abs(bp[0]-bp[1])+abs(ap[0]-ap[i])+abs(ap[1]-ap[j])+abs(ap[i]-ap[j]));
			}
		}
		if(EQ(res,INF))cout<<-1<<endl;
		else printf("%.10f\n",res);
	}
	return 0;
}

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

string S;

signed main() {
    //cin.tie(0); ios::sync_with_stdio(false);
    cin >> S;
    if (S=="AAA" || S=="BBB") cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int input;
  while(cin >> input){
    if(input == 0) break;
    input = 1000 - input;
    int hantei[6] = {500,100,50,10,5,1};
    int n = 0;
    for(int i=0;i<6;i++){
      n += input / hantei[i];
      input %= hantei[i];
    }
    cout << n << endl;
  }
}


Measured memory_bytes: 3068
h,w=map(int,input().split())
s=list(input()for _ in range(h))
if h==w==1:
    print('No')
    exit()
elif h==1:
        for i in range(w):
            if s[0][i]=='#':
                if i==0:
                    if s[0][i+1]=='.':
                        print('No')
                        exit()
                elif i==w-1:
                    if s[0][i-1]=='.':
                        print('No')
                        exit()
                else:
                    if s[0][i-1]=='.'and s[0][i+1]=='.':
                        print('No')
                        exit()
elif w==1:
        for i in range(h):
            if s[i][0]=='#':
                if i==0:
                    if s[i+1][0]=='.':
                        print('No')
                        exit()
                elif i==w-1:
                    if s[i-1][0]=='.':
                        print('No')
                        exit()
                else:
                    if s[i-1][0]=='.'and s[i+1][i-1]=='.':
                        print('No')
                        exit()
else:
    for i in range(h):
      for j in range(w):
        if s[i][j]=='#':
            if i==0:
                if j==0:
                    if s[i+1][j]=='.'and s[i][j+1]=='.':
                        print('No')
                        exit()
                if j==w-1:
                    if s[i+1][j]=='.'and s[i][j-1]=='.':
                        print('No')
                        exit()
                else:
                    if s[i+1][j]=='.'and s[i][j+1]=='.' and s[i][j-1]=='.':
                        print('No')
                        exit()
            if i==h-1:
                if j==0:
                    if s[i-1][j]=='.'and s[i][j+1]=='.':
                        print('No')
                        exit()
                if j==w-1:
                    if s[i-1][j]=='.'and s[i][j-1]=='.':
                        print('No')
                        exit()
                else:
                    if s[i-1][j]=='.'and s[i][j+1]=='.' and s[i][j-1]=='.':
                        print('No')
                        exit()
            else:
                if j==0:
                    if s[i-1][j]=='.' and s[i+1][j]=='.' and s[i][j+1]=='.':
                        print('No')
                        exit()
                if j==w-1:
                    if s[i-1][j]=='.' and s[i+1][j]=='.' and s[i][j-1]=='.':
                        print('No')
                        exit()
                else:
                    if s[i-1][j]=='.' and s[i+1][j]=='.' and s[i][j-1]=='.'and s[i][j+1]=='.':
                        print('No')
                        exit()
print('Yes')

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

typedef unsigned long long int LL;

int n, m, s;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t;
	while (cin >> n >> m) {
		s = 0;
		for (int i = 0; i < m; i++) {
			cin >> t;
			s += t;
		}
		if (s > n)
			cout << -1 << endl;
		else
			cout << n - s << endl;
	}
}

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

using namespace std;

#define int long long
#define endl '\n'
const int N = 1e5 + 10;
int par[N], cost[N], sz[N];

void init(int n) {
    for (int i = 0; i < n; i++)
        par[i] = i, sz[i] = 1;
}

int find(int x) {
    int prep = par[x];
    if (x != par[x]) {
        par[x] = find(par[x]);
    }
    cost[x] += cost[prep];
    return par[x];
}


void unite(int u, int v, int wt) {
    int par1 = find(u), par2 = find(v);

    if (par1 == par2)
        return;
    int c = wt + cost[u] - cost[v];
    if (sz[par1] >= sz[par2]) {
        par[par2] = par1;
        cost[par2] = c;
        sz[par1] += sz[par2];
    } else {
        par[par1] = par2;
        cost[par1] = -c;
        sz[par2] += sz[par1];
    }
}

void solve() {
    int n, q;
    cin >> n >> q;

    init(n);

    for (int i = 0; i < q; i++) {
        int type;
        cin >> type;

        if (type == 0) {
            int x, y, z;
            cin >> x >> y >> z;

            unite(x, y, z);
        } else {
            int x, y;
            cin >> x >> y;

            if (find(x) == find(y))
                cout << cost[y] - cost[x] << endl;
            else
                cout << "?" << endl;
        }
    }
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 5564
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <sstream>

using namespace std;

string toString(int n){
    ostringstream sout;
    sout << n;
    string s = sout.str();
    return s;
}

int main(){
    string str;
    int n,k,ans;
    bool f=false;
    cin >> n >>k;
    vector<char> d(n);
    for(int i=0;i<k;i++)cin >> d[i];
    while(1){
        str = toString(n);
        f=false;
        for(int j=0;j<k;j++){
            if((int)str.find(d[j]) != -1){
                f=true;
            }
        }
        if(!f)break;
        n++;
    }
    cout << n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin>>n;
  vector<Pll> a;
  rep(i,n){
      ll x,l;
      cin>>x>>l;
      a.pb(mp(x+l,x-l));
  }
  sort(all(a));
  ll tmaxi=-INF;
  ll m=n;
  rep(i,n){
      if(a[i].S>=tmaxi){
          tmaxi=a[i].F;
      }
      else{
          m--;
      }
  }
  print(m);
}


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

int main() {
  int X, Y;
  cin >> X >> Y;
  
  if (2*X <= Y && Y <= 4*X && Y%2 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    int sum = 0;
    for(int i=0;i<n;i++){
        sum += 2 * min(x[i],k-x[i]);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
int main()
{
    string s;
    cin >> s;
    int l = s.length();
    int ans = 0;
    string ss = "";
	string sss = "";
    for(int i = 0; i < l; i++){
    	sss += s[i];
		if(sss != ss){
			ans++;
			ss = sss;
			sss = "";
		}
	}
    cout << ans<< endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
int main()
{
   int n,k,x,y;
   cin>>n>>k>>x>>y;
   if(n<k)
   {
      cout<<n*x<<nl;
   }
   else
   {
      if(n==k)
      {
         cout<<n*x<<nl;
      }
      else
      {
         cout<<((k*x)+((n-k)*y))<<nl;
      }
   }
    return 0;
}


Measured memory_bytes: 256
//url:
//problem name: 

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N; cin >> N;
    veci x(N),y(N);
    veci h(N);
    int H_up;
    REP(i,N) cin >> x[i] >> y[i] >> h[i];
    for(int cy = 0; cy <= 100; cy++) {
        for(int cx = 0; cx <= 100; cx++) {
            H_up = 1e9 + 1000;
            bool ok = true;
            int H;
            bool appear = false;
            for(int i = 0; i < N; i++) {
                if(h[i] == 0) chmin(H_up,h[i]+abs(cx-x[i])+abs(cy-y[i]));
                else if(!appear) {
                    H = h[i]+abs(cx-x[i])+abs(cy-y[i]);
                    if(H > H_up) ok = false;
                    appear = true;
                } else {
                    if(H != h[i]+abs(cx-x[i])+abs(cy-y[i]) || h[i]+abs(cx-x[i])+abs(cy-y[i]) > H_up) ok = false;
                }
            }
            bool go = true;
            REP(i,N) if(max(H-abs(cx-x[i])-abs(cy-y[i]),0) != h[i]) go = false;
            if(!go) continue;
            if(ok) {
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a.at(i);
  long long x = 0, y = 0;
  int j = 0, k = n-1;
  for (int i = 0; i < n; ++i) {
    if (x < y) {
      x += a.at(j);
      ++j;
    } else {
      y += a.at(k);
      --k;
    }
  }
  cout << max(x, y) - min(x, y) << endl;
  return 0;
}

Measured memory_bytes: 1792
# coding: utf-8
# Here your code !
input()
p =[int(x) for x in input().split(" ")]

r1_399 = 0
r400_799 = 0
r800_1199 = 0
r1200_1599 = 0
r1600_1999 = 0
r2000_2399 = 0
r2400_2799 = 0
r2800_3199 = 0
over3200 = 0

for i in p:
    if 1 <= i <400:
        r1_399 +=1
    elif 400 <= i <800:
        r400_799 +=1
    elif 800 <= i <1200:
        r800_1199 +=1
    elif 1200 <= i <1600:
        r1200_1599 +=1
    elif 1600 <= i <2000:
        r1600_1999 +=1
    elif 2000 <= i <2400:
        r2000_2399 += 1
    elif 2400 <= i < 2800:
        r2400_2799 += 1
    elif 2800<= i <3200:
        r2800_3199 += 1
    elif 3200<= i:
        over3200 += 1
num = 0
for i in [r1_399,r400_799,r800_1199,r1200_1599,r1600_1999,r2000_2399,r2400_2799,r2800_3199]:
    if i > 0:
        num+=1

nummax = num + over3200

if num == 0:
    num +=1
print(str(num)+" " +str(nummax))


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

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

int32_t main(){
	int n;
	cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; i++){
		if (i % 3 == 0 || i % 5 == 0);else{
			sum += i;
		}
	}
	cout << sum;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
    int m,n,l;
    cin >> n >> m >>l;
    vector< vector<int> > a(n, vector<int>(m)), b(m, vector<int>(l));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin  >> a[i][j];
        }
    }
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            cin  >> b[i][j];
        }
    }
    for(long i = 0; i < n; i++){
        for(long j = 0; j < l; j++){
            long c = 0;
            for(int k = 0; k < m; k++){
                c += a[i][k] * b[k][j];
            }
            cout << c;
            if(j != l-1) cout << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 3176
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int a, b;
    cin >> a >> b;
    if (a < b)
    {
        REP(i, b)
        {
            cout << a;
        }
        cout << endl;
    }
    else
    {
        REP(i, a)
        {
            cout << b;
        }
        cout << endl;
    }
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	string s;
	vector<ll> a(5);
	rep(i,n){
		cin >> s;
		if(s.at(0)=='M') a.at(0)++;
		else if(s.at(0)=='A') a.at(1)++;
		else if(s.at(0)=='R') a.at(2)++;
		else if(s.at(0)=='C') a.at(3)++;
		else if(s.at(0)=='H') a.at(4)++;
	}
	ll ans=0;
	rep(i,5){
		for(int j=i+1;j<5;++j){
			for(int k=j+1;k<5;++k){
				ans+=a.at(i)*a.at(j)*a.at(k);
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

void trace(int A[], int N) {
  int i;
  for ( i = 0; i < N; i++ ) {
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

void insertionSort(int A[], int N) {
  int i, v, j;
  for ( i = 1; i < N; i++) {
    v = A[i];
    j = i - 1;
    while ( j >= 0 && A[j] > v ) {
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    trace(A, N);
  }
}

int main() {
  int N, i, j;
  int A[100];

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

  trace(A, N);
  insertionSort(A, N);

  return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int N;
int A[2][3];

signed main()
{
  cin >> N;
  REP(n,2) {
    REP(m,3) {
      cin >> A[n][m];
    }
  }

  vector<int> mvec;
  REP(m,3) {
    if(A[0][m] < A[1][m]) {
      mvec.push_back(m);
    }
  }

  if(mvec.size() == 0) {

  } else if(mvec.size() == 1) {
    N = N%A[0][mvec[0]] + N/A[0][mvec[0]]*A[1][mvec[0]];
  } else if(mvec.size() == 2) {
    int ans = N;
    REP(n,N+1) {
      int tmp = (N-n)%A[0][mvec[0]] + (N-n)/A[0][mvec[0]]*A[1][mvec[0]] +
                n%A[0][mvec[1]] + n/A[0][mvec[1]]*A[1][mvec[1]];
      ans = max(ans, tmp);
    }
    N = ans;
  } else {
    int ans = N;
    REP(n1,N+1) {
      for(int n2 = 0; n2 + n1 <= N; n2++) {
        int n3 = N - n1 - n2;
        int tmp = n1%A[0][mvec[0]] + n1/A[0][mvec[0]]*A[1][mvec[0]] +
                  n2%A[0][mvec[1]] + n2/A[0][mvec[1]]*A[1][mvec[1]] +
                  n3%A[0][mvec[2]] + n3/A[0][mvec[2]]*A[1][mvec[2]];
        ans = max(ans, tmp);     
      }
    }
    N = ans;
  }

  mvec.clear();

  REP(m,3) {
    if(A[0][m] > A[1][m]) {
      mvec.push_back(m);
    }
  }

  if(mvec.size() == 0) {

  } else if(mvec.size() == 1) {
    N = N%A[1][mvec[0]] + N/A[1][mvec[0]]*A[0][mvec[0]];
  } else if(mvec.size() == 2) {
    int ans = N;
    REP(n,N+1) {
      int tmp = (N-n)%A[1][mvec[0]] + (N-n)/A[1][mvec[0]]*A[0][mvec[0]] +
                n%A[1][mvec[1]] + n/A[1][mvec[1]]*A[0][mvec[1]];
      ans = max(ans, tmp);
    }
    N = ans;
  } else {
    int ans = N;
    REP(n1,N+1) {
      for(int n2 = 0; n2 + n1 <= N; n2++) {
        int n3 = N - n1 - n2;
        int tmp = n1%A[1][mvec[0]] + n1/A[1][mvec[0]]*A[0][mvec[0]] +
                  n2%A[1][mvec[1]] + n2/A[1][mvec[1]]*A[0][mvec[1]] +
                  n3%A[1][mvec[2]] + n3/A[1][mvec[2]]*A[0][mvec[2]];
        ans = max(ans, tmp);     
      }
    }
    N = ans;
  }

  cout << N << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
 
int main(){
	
	int n,k,c; string s;
	cin>>n>>k>>c>>s;
	vector<int> t1(n),t2(n);
	for(int i=0; i<n; i++){
		t1.at(i)=n*2+1;
		t2.at(i)=n*3+1;
	}
	int cnt{},i{};
	while(i<n){
		if(s.at(i)=='o'){
			cnt++;
			t1.at(i)=cnt;
			if(cnt==k) break;
			i+=c+1;
		}
		else i++;
	}
	i=n-1;
	while(i>=0){
		if(s.at(i)=='o'){
			t2.at(i)=cnt;
			cnt--;
			if(cnt==-1) break;
			i-=c+1;
		}
		else i--;
	}
	for(int i=0; i<n; i++){
		if(t1.at(i)==t2.at(i)) cout<<i+1 << endl;
	}
	
}


Measured memory_bytes: 5216
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	int64_t N, M;
	cin >> N >> M;

	int64_t res;
	if (N > 2 && M > 2) {
		res = (N - 2) * (M - 2);
	} else {
		if (N == 2 || M == 2)
			res = 0;
		else if (N == 1 && M == 1)
			res = 1;
		else if (N == 1)
			res = M - 2;
		else if (M == 1)
			res = N - 2;
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int x, y, z = 2;
    int sum = 0;
    char order[10];
    
    fgets(order, 9, stdin);
    sscanf(order, "%d %d", &x, &y);
    while(z){
        if(x >= y){
            sum += x;
            x--;
        }else{
            sum += y;
            y--;
        }
        z--;
    }
    printf("%d\n", sum);
    return 0;
}

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

typedef long long ll;

int main() {
  ll N,W;
  cin >> N >> W;
  vector<ll> w(N);
  vector<ll> v(N);
  for(int i=0;i<N;i++){
    cin >> w.at(i) >> v.at(i);
  }
  vector<vector<ll>> sum(N,vector<ll>(W+1));
  for(int i=0;i<=W;i++){
    if(i >= w.at(0)){
      sum.at(0).at(i) = v.at(0);
    }else{
      sum.at(0).at(i) = 0;
    }
  }

  for(int i=1;i<N;i++){
    for(int j=0;j<=W;j++){
      if(j >= w.at(i)){
	      sum.at(i).at(j) = max(sum.at(i-1).at(j),
                         sum.at(i-1).at(j-w.at(i))+v.at(i));
      }else{
        sum.at(i).at(j) = sum.at(i-1).at(j);
      }
    }
  }
  
  cout << sum.at(N-1).at(W) << endl;
  
  return(0);
}

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

using namespace std;

long long gcd(long long a, long long b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main() {
    long long a, b;
    cin >> a >> b;

    cout << (a*b) / gcd(a, b) << endl;

    return 0;
}


Measured memory_bytes: 3604
#include<stdio.h>
int main(void)
{
	int n,m,i,j;
	int s,a,b,max;
	
	scanf("%d",&n);
	scanf("%d",&m);
	max=m;
	s=m;
	for(i=0;i<n;i++)	{
		scanf("%d %d",&a,&b);
		s=s+a-b;
		if(s<0)	{
			max=0;
			break;
		}
		if(s>max)	{
			max=s;
		}
	}
	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    string s,t;
    cin>>s>>t;
    map<char,char> A;
    set<char> B,C;
    int z=1;
    rep(i,26) B.insert('a'+i),C.insert('a'+i);
    rep(i,s.size()){
        if(A[s[i]]==t[i]) continue;
        if(C.count(s[i])&&B.count(t[i])){
            A[s[i]]=t[i],B.erase(t[i]),C.erase(s[i]);
            continue;
        }
        z=0;
    }
    if(z) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 776
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        public static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (1 <= input[0] && input[0] <= 9 && 1 <= input[1] && input[1] <= 9)
            {
                Console.WriteLine(input[0] * input[1]);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
#define MAX_N 1010
#define MAX_M 100010
const long long mod = pow(10,9)+7;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vec) for(int aqw=0;aqw<vec.size();aqw++){cout<<vec[aqw]<<" ";}ent;
#define rep1(n) for(ll i = 0; i < (n); ++i)
#define rep2(i, n) for(ll i = 0; i < (n); ++i)
#define rep3(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep4(i, a, b, c) for(ll i = (a); i < (b); i += (c))
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; }
#define INF 1e+9
#define print(x) cout<<x<<endl;
using P = pair<int, int>;
#define PLL pair<ll, ll>;
#define MAX_V 10010
#define PI 3.141592653589793
#define vecP vector<P>
 //cout << setprecision(15) << std::fixed;



int main() {
    int n, k;
    cin >> n >> k;
    vec A(n);
    for (int i = 0;i < n;i++) {
        cin >> A[i];
    }
    sort(all(A));
    int ans = INF;
    for (int i = 0;i <= n - k;i++) {
        chmin(ans, A[i + k-1] - A[i]);
    }
    print(ans);
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout << min(b + c, b + a + b + 1) << endl;
}

Measured memory_bytes: 256
//wawando's template

#include <iostream>
#include <string>
#include <fstream>
#include <functional>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>  //clock_t , clock() , CLOCKS_PER_SEC
#include <cstring>
#include <cctype>
#include <climits> // LLONG_MAX , LLONG_MIN , INT_MAX , INT_MIN

//MACROS
#define pb              push_back
#define mp              make_pair
#define INF             1000000000     //1 billion safer for floyd warshall, avoid overflow

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(0);
  int N, K;
  scanf("%d %d", &N, &K);

  double ans = 0.0;
  for(int i = 1; i <= N; i++) {
    if(i >= K) ans += 1;
    else {
      int p = ceil(log2((double)K/(double)i));
      ans += pow(2, -p);
    }
  }
  ans /= (double)N;
  printf("%.12lf\n", ans);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
n = list(map(int, input().split()))
i = 1
f = 0
n.sort()
for j in n:
  i = i * j
  if i > 10**18:
    print(-1)
    f = 1
    break
  elif i == 0:
    break
if f == 0:
  print(i)

Measured memory_bytes: 21604
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (k, n) = {
        let kn = get_line()
            .split_whitespace()
            .map(|n| n.parse().unwrap())
            .collect::<Vec<u64>>();
        (kn[0], kn[1])
    };
    let abs_dist = get_line()
        .split_whitespace()
        .map(|n| n.parse().unwrap())
        .collect::<Vec<u64>>();
    let mut diff = abs_dist
        .iter()
        .zip(abs_dist.clone()[1..].into_iter())
        .map(|(a, b)| b - a)
        .collect::<Vec<u64>>();
    diff.push((k - abs_dist.last().unwrap()) + abs_dist[0]);

    let max = diff.iter().max().unwrap();

    println!("{:?}", k - max);
}


Measured memory_bytes: 12012
def con(var):
    var=str(var)
    while(len(var)<6):
        var="0"+var
    return var



def run():
    N,M=input().split()
    N=int(N)
    M=int(M)
    P=[-1]*M
    Y=[-1]*M
    arr=[]
    for i in range(M):
        P[i],Y[i]=input().split()
        P[i]=int(P[i])-1
        Y[i]=int(Y[i])
        arr.append([P[i],Y[i],i])
    arr=sorted(arr,key=lambda x:x[1])
    ans=[0]*M
    cnt=[0]*N
    for i in range(M):
        cnt[arr[i][0]]=cnt[arr[i][0]]+1
        ans[arr[i][2]]=con(arr[i][0]+1)+con(cnt[arr[i][0]])
    for i in range(M):
        print(ans[i])
run()

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

_s = input()[:-1]


def chker(s):
    rs = s[::2]
    ls = s[1::2]

    if 'L' in rs:
        print('No')
        return

    if 'R' in ls:
        print('No')
        return

    print('Yes')


chker(_s)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define fin(ar,k,n) for(int i=k;i<n;i++) cin>>ar[i]
#define fout(ar,k,n) for(int i=k;i<n;i++) cout<<ar[i]<<' '
#define all(z) z.begin(),z.end()
#define mcc ((int)1e9+7)
#define mcf 998244353
#define mi map<int,int>
#define mem(a,n) memset(a,n,sizeof(a))
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> fst;

ll g[1001][1001],h,w;
char m[1001][1001];
void solve()
{
	g[1][1]=1;
	cin>>h>>w;
	for(int i=1;i<=h;i++)
	{
		for (int j=1;j<=w;j++) cin>>m[i][j];
	}
	for (int i=1;i<=h;i++)
	{
		for (int j=1;j<=w;j++)
		{
			if(m[i][j]=='.')
			{
				g[i][j]=(g[i][j]+g[i-1][j]+g[i][j-1])%mcc;
			}
		}
	}
	cout<<g[h][w]<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

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

using namespace std;

bool contain(vector<int> v, int n)
{
    vector<int>::iterator itr = find(v.begin(), v.end(), n);

    return (itr != v.end());
}

int main()
{
    int q;
    vector<int> l, r;
    cin >> q;
    l = vector<int>(q);
    r = vector<int>(q);
    for (int i = 0; i < q; i++){
        cin >> l[i] >> r[i];
    }

    vector<int> prime = vector<int>();
    prime.push_back(2);
    for (int i = 3; i <= 100000; i += 2){
        bool b = true;

        for (int n : prime){
            if (i % n == 0){
                b = false;
                break;
            }
        }

        if (b) prime.push_back(i);
    }

    vector<int> src = vector<int>(50000);
    for (int i = 1; i <= 100000; i += 2){
        int elem = i / 2;
        if (i == 1){
            src[elem] = 0;
        } else {
            src[elem] = src[elem - 1];

            if (contain(prime, i) && contain(prime, (i + 1) / 2)){
                src[elem]++;
            }
        }
    }

    for (int i = 0; i < q; i++){
        if (l[i] > 1){
            cout << (src[(r[i] / 2)] - src[(l[i] / 2) - 1]) << endl;
        } else {
            cout << src[(r[i] / 2)] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define INF (1<<29)
using namespace std;
typedef long long ll;
int main(){
      int l,a,b,c,d;
      cin>>l>>a>>b>>c>>d;
      cout<<l-max((a+c-1)/c,(b+d-1)/d)<<endl;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int32 n = s.size();
  int32 m = t.size();
  vector<int64> scnt(n+1,0);
  vector<int64> tcnt(m+1,0);
  REP(i,n){
    scnt[i+1] = scnt[i];
    if(s[i] == 'A')scnt[i+1]++;
  }
  REP(i,m){
    tcnt[i+1] = tcnt[i];
    if(t[i] == 'A')tcnt[i+1]++;
  }
  int32 q;
  cin >> q;
  while(q--){
    int32 a,b,c,d;
    cin >> a >> b >> c >> d;
    int32 cura = scnt[b] - scnt[a-1];
    int32 curb = b - a + 1 - cura;
    int32 tara = tcnt[d] - tcnt[c-1];
    int32 tarb = d - c + 1 - tara;
    if(((cura - tara) * 2 - (tarb - curb)) % 3 == 0){
      cout << "YES\n";
    }else{
      cout << "NO\n";
    }
  }
  return 0;
}

Measured memory_bytes: 2512
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int n, m;
    cin >> n >> m ;
    if(n==m) cout << "Yes" << endl;
    else cout << "No" << endl;

    //cout << ans << endl;
}

Measured memory_bytes: 256
import itertools

N = int(input())
xy = [[0.0, 0.0]] * N
for i in range(N):
  xy[i] = list(map(int, input().split()))

def distance(a, b):
  res = (a[0]-b[0])**2 + (a[1]-b[1])**2
  return res ** 0.5
  
ans = 0.0
combs = itertools.combinations(range(N), 2)
for comb in combs:
  ans += distance(xy[comb[0]], xy[comb[1]])

ans = ans * 2 / N
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <iostream>
#include <bitset>
#include <map>
#include <set>
#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;
//obj;
class binary{
public:
    bool isOK(int index, int key,vi a) {
    if (a[index] >= key) return true;
    else return false;
}
int binary_search(int key,vi a) {
   
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key,a)) ok = mid;
        else ng = mid;
    }
    return ok;
}
}obj;

int main(){
int n;cin>>n;
int x=7%n;
set<int> s;
int ans=1;
while(s.count(x)==0){
    if(x==0){
        cout<<ans<<endl;
        return 0;
    }
    s.insert(x);
    x=(x*10+7)%n;
    ++ans;
}
cout<<-1<<endl;
return 0;

 }


Measured memory_bytes: 50388
//
// Created by yamunaku on 2019/09/15.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    string s;
    cin >> s;
    bool ok=true;
    rep(i,s.size()){
        if(i%2){
            if(s[i]=='R') ok=false;
        }else{
            if(s[i]=='L') ok=false;
        }
    }
    if(ok) CYES;
    else CNO;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <complex>
#include <utility>
#include <queue>
#include <functional>

using point=std::complex<double>;
template <class T>
using lp_queue=std::priority_queue<T, std::deque<T>, std::greater<T>>;

constexpr double eps=1e-9;

double distance(
    const std::pair<point, double> &s,
    const std::pair<point, double> &t) {
  
  return std::max(0.0, std::abs(s.first-t.first)-(s.second+t.second));
}

double shortest(
    std::vector<std::vector<double>> &g, int s, int t)  {

  std::vector<double> d(g.size(), 1e14);
  d[s] = 0;
  lp_queue<std::pair<double, int>> q;
  q.emplace(0, s);
  while (!q.empty()) {
    double u=q.top().first;
    int v=q.top().second;
    q.pop();

    if (d[v] + eps < u)
      continue;

    for (int i=0; i<int(g.size()); ++i)
      if (i != v && u + g[v][i] + eps < d[i]) {
        d[i] = u + g[v][i];
        q.emplace(d[i], i);
      }
  }

  return d[t];
}

int main() {
  int xs, ys, xt, yt;
  scanf("%d %d %d %d", &xs, &ys, &xt, &yt);

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

  std::vector<std::pair<point, double>> p(N);
  for (int i=0; i<N; ++i) {
    double x, y, r;
    scanf("%lf %lf %lf", &x, &y, &r);
    p[i] = std::make_pair(point(x, y), r);
  }

  p.emplace_back(point(xs, ys), 0);
  p.emplace_back(point(xt, yt), 0);

  std::vector<std::vector<double>> g(N+2, std::vector<double>(N+2));
  for (int i=0; i<N+2; ++i)
    for (int j=i+1; j<N+2; ++j)
      g[i][j] = g[j][i] = distance(p[i], p[j]);

  printf("%.12f\n", shortest(g, N, N+1));
  return 0;
}



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

int n,a[200000];

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        a[i]-=i+1;
    }
    sort(a,a+n);
    long long ans;
    for(int i=0;i<n;i++)ans+=abs(a[i]-a[n/2]);
    printf("%lld\n",ans);
}

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

N = int(input())
data = []
for _ in range(N - 1):
    data.append(tuple(map(int, input().split())))

for i in range(N - 1):
    c_i, s_i, f_i = data[i] 
    ans = c_i + s_i
    if i == N - 2:
        print(ans)
        continue
    for j in range(i + 1, N - 1):
        c_j, s_j, f_j = data[j]
        if ans >= s_j:
            tmp = (ans - s_j) % f_j
            ans += c_j if tmp == 0 else f_j - tmp + c_j
        else:
            ans += s_j - ans + c_j
    print(ans)

print(0)

Measured memory_bytes: 3188