akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define INF 1e9
#define pii pair<int, int>
#define pt(xx) cout << "\n" \
                    << xx << "\n"
#define debugv(x, n)               \
    cout << "\n"                   \
         << #x << ": ";            \
    rep(i, n) cout << x[i] << " "; \
    cout << endl
#define debug2d(x, m, n)            \
    cout << "\n"                    \
         << #x << " is: \n";        \
    for (int i = 0; i < m; ++i)     \
    {                               \
        for (int j = 0; j < n; ++j) \
        {                           \
            cout << x[i][j] << " "; \
        }                           \
        cout << endl;               \
    }
#define nl cout << endl

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

int N, M, K;
int ans;

signed main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    //==============================================
    cin >> N >> M;

    int tmp;
    if (N > M) {
        tmp = N;
        N = M;
        M = tmp;
    }




    if (N==1 && M==1) ans = 1;
    else if (N == 1) ans = M-2;
    else {
        ans = (N-2)*(M-2);
    }






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

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)
typedef long long ll;

int sum_digits(int num);
template <class T>
vector<T> copy_vector(vector<T> vec);
int gcd(int a, int b);

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<int>> a(h, vector<int>(w));
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; j++) {
            cin >> a[i][j];
        }
    }
    vector<pair<int, int>> routes;
    for(int i=0; i<h; i++) {
        if(i % 2) { // 奇数
            for(int j=w-1; j>=0; j--) {
                routes.push_back(make_pair(i, j)); 
            }
        } else { // 偶数
            for(int j=0; j<w; j++) {
                routes.push_back(make_pair(i, j)); 
            }
        }
    }
    int routes_size = routes.size();
    vector< pair< pair<int, int>, pair<int, int> > > move_log;
    for(int i=0; i<routes_size-1; i++) {

        pair<int,int> c_place = routes[i];
        int c_h = c_place.first;
        int c_w = c_place.second;

        pair<int,int> n_place = routes[i+1];
        int n_h = n_place.first;
        int n_w = n_place.second;

        if(a[c_h][c_w] % 2) { // 奇数
            a[c_h][c_w]--;
            a[n_h][n_w]++;
            move_log.push_back(make_pair( make_pair(c_h, c_w), make_pair(n_h, n_w) )); 
        }
    }

    int n = move_log.size();
    cout << n << endl;
    for(int i=0; i<n; i++) {
        pair<int, int> before_point = move_log[i].first;
        pair<int, int> after_point = move_log[i].second;

        int b_h = before_point.first + 1;
        int b_w = before_point.second + 1;

        int a_h = after_point.first + 1;
        int a_w = after_point.second + 1;

        cout << b_h << " " << b_w << " " << a_h << " " << a_w << endl; 
    }
    

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

int sum_digits(int num) {
    int rtn = 0;
    while(num != 0) {
        int tmp = num % 10; 
        rtn += tmp;
        num /= 10; 
    }   
    return rtn;
}
//int sum_digits(int num) {
//    int rtn = 0;
//    string num_str = to_string(num);
//    for(int i=0; i<num_str.size(); i++) {
//        rtn += num_str[i] - '0';
//    }   
//    return rtn;
//}

// vectorのコピー
template <class T>
vector<T> copy_vector(vector<T> vec) {
    vector<T> rtn;
    rtn.reserve(vec.size());
    copy(vec.begin(), vec.end(), back_inserter(rtn));
    return rtn;
}

// ユークリウッドの互除法
int gcd(int a, int b) {
    if(b==0) return a;
    else return gcd(b, a % b);
}



Measured memory_bytes: 7152
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#define int long long
#define REP(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define MOD 1000000007
#define IDE 0

using namespace std;

const int MAX_N = 1 << 20;
int segtr_size, dat[2 * MAX_N - 1];

void init(int n_) {
    segtr_size = 1;
    while (segtr_size < n_) segtr_size *= 2;
    REP(i,2 * segtr_size - 1) dat[i] = IDE;
}

int segfunc(int l, int m) {
    return l | m;
}

//k番目の値(0-indexed)をaに変更
void update(int k, int a) {
    k += segtr_size - 1;
    dat[k] = a;
    while (k > 0) {
        k = (k - 1) / 2;
        dat[k] = segfunc(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}

int find(int k) {
    return dat[k + segtr_size - 1];
}

int query(int a, int b, int k, int l, int r) {
    //cout << "query: " << a << b << k << l << r << "\n";
    if (r <= a || b <= l) return IDE;
    if (a <= l && r <= b) return dat[k];
    else {
        int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return segfunc(vl, vr);
    }
}

int alp_to_int(char c) {
    //cout << c << " " << (int)(c - 'a') << "\n";
    return (int)(c - 'a');
}

int count(int segtrval) {
    int retval = 0;
    REP(i,26) {
        retval += (segtrval >> i) % 2;
    }
    //cout << segtrval << " " << retval << "\n";
    return retval;
}

signed main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);    
    int n,q;
    cin >> n;
    init(n);
    vector<char> s(n);
    REP(i,n) {
        char st;
        cin >> st;
        s[i] = st;
        update(i, (1LL << alp_to_int(st)));
    }
    cin >> q;
    REP(_,q) {
        int qtype;
        cin >> qtype;
        if (qtype == 1) {
            int i;
            char c;
            cin >> i >> c;
            int c_int = alp_to_int(c);
            update(i-1, 1LL << c_int);
        } else {
            int l,r;
            cin >> l >> r;
            cout << count(query(l-1, r, 0, 0, segtr_size)) << "\n";
        }
    }

    return 0;
}

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

using namespace std;

constexpr static int MAXN = 1e5 + 10;

int n;
int p[MAXN];
int mask[MAXN];
int cnt[MAXN][16];
vector <pair <int, int>> adj[MAXN];

void dfs(int u, int parent) {
    p[u] = parent;
    for (auto v : adj[u]) {
        if (v.first != parent)
            dfs(v.first, u);
        else
            mask[u] = v.second;
    }
}

void calc(int u) {
    int val = 0;
    for (auto v : adj[u]) {
        if (v.first == p[u])
            continue;
        calc(v.first);
        val ^= v.second;
        for (int i = 1; i < 16; i++)
            cnt[u][i] += cnt[v.first][i];
    }
    cnt[u][mask[u] ^ val]++;

    /*
    cout << u << ":";
    for (int i = 1; i < 16; i++)
        cout << " " << cnt[u][i];
    cout << endl;
    */
}

int main() {
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int u, v, a;
        cin >> u >> v >> a;
        adj[u].push_back({v, a});
        adj[v].push_back({u, a});
    }

    int root = 0;
    while (root < n && adj[root].size() > 1)
        root++;
    dfs(root, -1);
    calc(root);
    // cout << "r: " << root << endl;

    int total = 0;
    int left = 0;
    // matched
    for (int i = 1; i < 16; i++) {
        // cout << i << ": " << cnt[root][i] << endl;
        total += cnt[root][i] / 2;
        cnt[root][i] %= 2;
        if (cnt[root][i] == 1) {
            total++;
            left ^= (1 << i);
        }
    }

    // merge
    vector <vector <int>> masks(17);
    for (int m = 0; m < (1 << 16); m++) {
        int bits = 0;
        int val = 0;
        for (int i = 0; i < 16; i++)
            if (m & (1 << i)) {
                bits++;
                val ^= i;
            }
        if (bits > 1 && val == 0)
            masks[bits].push_back(m);
    }
    for (int bits = 3; bits <= 16; bits++) {
        for (int m : masks[bits]) {
            if ((left & m) == m) {
                left ^= m;
                total--;
            }
        }
    }

    cout << total << endl;
}


Measured memory_bytes: 22144
/*
    アリナ・グレイはかわいい
*/

#include<bits/stdc++.h>
using namespace std;
#define itn int
#define endl "\n"

int main(void){
    int n;
    cin >> n;
    int a[n+1],b[n],c[n+1];
    for(int i = 0;i < n+1;i++)cin >> a[i],c[i] = a[i];
    for(int i = 0;i < n;i++)cin >> b[i];
    
    long long int sum = 0;
    for(int i = 0;i < n;i++){
        if(b[i] > a[i]){
            b[i] -= a[i],sum += a[i];
            if(b[i] > a[i+1])sum += a[i+1],a[i+1] = 0;
            else sum += b[i],a[i+1] -= b[i];
        }
        else a[i] -= b[i],sum += b[i];
    }
    
    cout << sum << endl;
}


Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cstring>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <cstdlib>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
typedef long long ll;
#define forn for(int i=0;i<n;i++) 
#define form for(int i=0;i<m;i++) 
#define pb push_back 
#define mp make_pair 
#define sc second 
#define f first 
#define kek cout<<"\n" 
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
const ll MOD = 1e9 + 7;
const int N = 1005;
const ll INF = 1e9;
using namespace std;
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
   ll n,k;
   cin>>n>>k;
   ll arr[n];
   forn cin>>arr[i];
   sort(arr,arr+n);
   ll sum=0;
   for(ll i=0;i<n-k;i++) sum+=arr[i];
   cout<<sum;
   return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
typedef long long ll;
int n,l,r;
ll a[100],c[100][100];
using namespace std;

map<ll,int> S;
bool cmp(ll x,ll y){return x>y;}
int main()
{
	#ifdef Kay
		freopen ("code.in","r",stdin);
		freopen ("code.out","w",stdout);
	#endif
	cin>>n>>l>>r;
	int i,j;
	for (i=1;i<=n;i++)
	cin>>a[i],S[a[i]]++;
	sort(a+1,a+1+n,cmp);
	ll sum=0;
	for (i=1;i<=l;i++) sum+=a[i];
	c[0][0]=1;
	for (i=1;i<100;i++)
	{
		c[i][0]=c[i][i]=1;
		for (j=1;j<i;j++)
		c[i][j]=c[i-1][j]+c[i-1][j-1];
	}
	for (i=1;a[i]!=a[l];i++);
	if (i!=1) printf ("%.6lf\n%lld",(double)sum/l,c[S[a[l]]][l-i+1]);
	else
	{
		ll tmp=0;
		for (i=l;i<=r;i++) tmp+=c[S[a[l]]][i];
		printf ("%.6lf\n%lld",(double)sum/l,tmp);
	}
	return 0;
}


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

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  ll ans = 1e18;
  for (int ab_cnt = 0; ab_cnt <= 200000; ab_cnt += 2) {  // ab 購入枚数
    int a_remain = max(0, x - ab_cnt / 2);               // a 残り枚数
    int b_remain = max(0, y - ab_cnt / 2);               // b 残り枚数
    ll cost = a_remain * a + b_remain * b + ab_cnt * c;
    ans = min(ans, cost);
  }
  cout << ans << endl;
}


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

struct Point {
  double x, y;
  Point(){};
  Point(double x, double y) : x(x), y(y){};
  Point operator+(const Point &q) {
    Point t;
    t.x = x + q.x;
    t.y = y + q.y;
    return t;
  }
  Point operator+=(const Point &q) {
    x += q.x;
    y += q.y;
    return *this;
  }
  Point operator-(const Point &q) {
    Point t;
    t.x = x - q.x;
    t.y = y - q.y;
    return t;
  }
  Point operator-=(const Point &q) {
    x -= q.x;
    y -= q.y;
    return *this;
  }
  template <typename T> Point operator*(T d) {
    return Point(x * d, y * d);
  }
  template <typename T> Point operator*=(T d) {
    x *= d;
    y *= d;
    return *this;
  }
  template <typename T> Point operator/(T d) {
    return Point(x / d, y / d);
  }
  template <typename T> Point operator/=(T d) {
    x /= d;
    y /= d;
    return *this;
  }
  bool operator<(const Point &q) {
    return (x != q.x) ? (x < q.x) : (y < q.y);
  }
  bool operator>(const Point &q) {
    return (x != q.x) ? (x > q.x) : (y > q.y);
  }
  double norm(void) {
    return sqrt(x * x + y * y);
  }
  double arg(void) {
    return acos(x / this->norm()) * Point(1, 0).sign(*this);
  }
  Point rotate(double t) {
    double c = cos(t), s = sin(t);
    return Point(c * x - s * y, s * x + c * y);
  }
  Point reverseX(void) {
    return Point(-x, y);
  }
  Point reverseY(void) {
    return Point(x, -y);
  }
  Point unit(void) {
    return (*this).norm() == 0 ? Point(0, 0) : (*this) / (*this).norm();
  }
  Point floor(void) {
    return Point((int)x, (int)y);
  }
  double dot(const Point &q) {
    return x * q.x + y * q.y;
  }
  double det(const Point &q) {
    return x * q.y - y * q.x;
  }
  int sign(const Point &q) {
    double d = (*this).det(q);
    return (d > 0) - (d < 0);
  }
  bool on_seg(Point p1, Point p2, Point q) {
    return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
  }
  Point intersection(Point p1, Point p2, Point q1, Point q2) {
    return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
  }
};

int main() {
  int n;
  while (cin >> n, n) {
    int m = 1;
    double d;
    vector<Point> a(n);

    for (int i = 0; i < n; ++i) {
      scanf("%lf,%lf", &a[i].x, &a[i].y);
    }

    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (i != j && (d = (a[j] - a[i]).norm()) <= 2) {
          int c1 = 2, c2 = 2;
          d /= 2;
          Point e = (a[j] - a[i]).rotate(M_PI / 2).unit();
          Point p = (a[i] + a[j]) / 2 + e * sqrt(1 - d * d);
          Point q = (a[i] + a[j]) / 2 - e * sqrt(1 - d * d);
          if (fabs(p.x) <= 10 && fabs(p.y) <= 10) {
            for (int k = 0; k < n; ++k) {
              if (k != i && k != j && (p - a[k]).norm() <= 1) c1++;
            }
          }

          if (fabs(q.x) <= 10 && fabs(q.y) <= 10) {
            for (int k = 0; k < n; ++k) {
              if (k != i && k != j && (q - a[k]).norm() <= 1) c2++;
            }
          }

          m = max(m, max(c1, c2));
        }
      }
    }

    cout << m << endl;
  }
}

Measured memory_bytes: 3092
a, b, c, x, y = map(int, input().split(" "))

def only_plus(n):
    if n < 0:
        return 0
    else:
        return n

anss = []
for i in range(0, 2 * max(x, y) + 1, 2):
    anss.append(c * i + a * only_plus(x - (i // 2)) + b * only_plus(y - (i // 2)))
    
print(min(anss))


Measured memory_bytes: 7096
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int h,w;
	cin>>h>>w;
	vector<vi> row(h,vi()), col(w,vi());
	for(auto &i:row)i.PUB(-1);
	for(auto &i:col)i.PUB(-1);
	REP(i,0,h-1) {
		string s;
		cin>>s;
		REP(j,0,w-1) {
			if(s[j]=='#') {
				row[i].PUB(j);
				col[j].PUB(i);
			}
		}
	}
	for(auto &i:row)i.PUB(w);
	for(auto &i:col)i.PUB(h);
	int cnt = 0;
	REP(i,0,h-1) {
		REP(j,0,w-1) {
			auto inRow = lower_bound(row[i].begin(),row[i].end(),j);
			if(*inRow==j)continue;
			int ri = inRow - row[i].begin();
			int ci = lower_bound(col[j].begin(),col[j].end(),i)-col[j].begin();
			int rows = row[i][ri]-row[i][ri-1]-1;
			int cols = col[j][ci]-col[j][ci-1]-1;
			cnt=max(rows+cols-1,cnt);
		}
	}
	cout<<cnt;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 37676
//#pragma GCC optimize("-O3")
/*
				C++
				encoding: UTF-8
				Last Modified: 16/Nov/19 05:33:46 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on


signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	int n;
	cin >> n;
	string s;
	cin >> s;
	if (n <= 1) {
		pr ("No");
		return 0;
	}
	string a = "", b = "";
	fr (i, 0, n / 2) a += s[i];
	fr (i, n / 2, n) b += s[i];
	if (a == b)
		pr ("Yes");
	else
		pr ("No");
	return 0;
}

Measured memory_bytes: 256
n,k,l=[int(x) for x in input().split()]
from collections import deque
road=[{i} for i in range(n)]
rail=[{i} for i in range(n)]
for i in [0]*k:
    p,q=[int(x)-1 for x in input().split()]
    road[p].add(q)
    road[q].add(p)
for i in [0]*l:
    r,s=[int(x)-1 for x in input().split()]
    rail[r].add(s)
    rail[s].add(r)
flag=[0]*n
for i in range(n):
    if flag[i]==1:
        continue
    flag[i]=1
    d=deque(road[i])
    while d:
        tmp=d.popleft()
        if flag[tmp]==1:
            continue
        flag[tmp]=1
        d.extend(road[tmp])
        road[i].update(road[tmp])
    for j in road[i]:
        road[j]=road[i]
flag=[0]*n
for i in range(n):
    if flag[i]==1:
        continue
    flag[i]=1
    d=deque(rail[i])
    while d:
        tmp=d.popleft()
        if flag[tmp]==1:
            continue
        flag[tmp]=1
        d.extend(rail[tmp])
        rail[i].update(rail[tmp])
    for j in rail[i]:
        rail[j]=rail[i]
ans=[0]*n
for i in range(n):
    if ans[i]!=0:
        continue
    sumset=road[i]&rail[i]
    for j in sumset:
        ans[j]=str(len(sumset))
print(" ".join(ans))

Measured memory_bytes: 175164
#include<iostream>
#include<algorithm>
using namespace std;
const int dy[] = { 1, 0, -1, 0}, dx[] = { 0, 1, 0, -1};
int w, h, cntw, cntb;
bool used[2][50][50];
char mas[50][50];
void dfs(int y,int x,bool wb){
  if(y < 0 || y >= h || x < 0 || x >= w || mas[y][x] != '.' || used[wb][y][x]++) return;
  for(int i = 0 ; i < 4 ; i++ ) dfs( y + dy[i], x + dx[i], wb);
}
int main(){
  while(cin >> w >> h , w){
    fill_n(**used,5000,0);
    cntw = cntb = 0;
    for(int i = 0 ; i < h ; i++ ){
      for(int j = 0 ; j < w ; j++ ) cin >> mas[i][j];
    }
    for(int i = 0 ; i < h ; i++ ) for(int j = 0 ; j < w ; j++ ){
      if(mas[i][j] == 'W') for(int k = 0 ; k < 4 ; k++ ) dfs(i+dy[k],j+dx[k],1);
      if(mas[i][j] == 'B') for(int k = 0 ; k < 4 ; k++ ) dfs(i+dy[k],j+dx[k],0);
    }
    for(int i = 0 ; i < h ; i++ ){
      for(int j = 0 ; j < w ; j++ ){
        if(used[0][i][j] && !used[1][i][j]) cntw++;
        else if(!used[0][i][j] && used[1][i][j]) cntb++;
      }
    }
    cout << cntw << " " << cntb << endl;
  }
}

Measured memory_bytes: 1224
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<string>
#define PI 3.14159265359
using namespace std;
int main(){
    string a;
    getline(cin,a);
    for(int i = 0 ; i < a.size() ; i++ )
    {
        if(a[i] >= 65 && a[i] <= 90)cout << (char)(a[i] + 32);
        else if(a[i] >= 97 && a[i] <= 122)cout << (char)(a[i] - 32);
        else cout << (char)a[i];
        
    }
    cout <<endl;
    return 0;
}


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

int main(void) {
  int N, ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int N; cin >> N;
    vec A(N); cin >> A;
    
    vec dp(N + 1, 0);
    dp[0] = 1000;
    REP(i, N){
        REP(j, i + 1){
            chmax(dp[i + 1], dp[j]);
            if(A[j] < A[i]){
                int n = dp[j] / A[j], r = dp[j] % A[j];
                chmax(dp[i + 1], A[i] * n + r);
            }
        }
    }
    Out(dp[N]);

    return 0;
}


Measured memory_bytes: 3560
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

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

    int q;
    cin >> q;

    deque<char> ans;
    for (auto c : s) ans.push_back(c);

    bool r = false;
    for (int i=0; i<q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            r = !r;
            continue;
        }
        
        int f;
        char c;
        cin >> f >> c;
        if ((!r && f==1) || (r && f==2)) {
          ans.push_front(c);
        } else {
          ans.push_back(c);
        }
    }

    if(r) reverse(ans.begin(), ans.end());
  
    while(!ans.empty()) {
        putchar(ans.front());
        ans.pop_front();
    }
    cout << endl;

}


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

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  vector<int> hs(h), ws(w);
  set<P> s;
  rep(i,n) {
    int r, c;
    cin >> r >> c;
    --r; --c;
    hs[r]++;
    ws[c]++;
    s.emplace(r,c);
  }
  int mh = 0, mw = 0;
  rep(i,h) mh = max(mh, hs[i]);
  rep(j,w) mw = max(mw, ws[j]);
  vector<int> is, js;
  rep(i,h) if (mh == hs[i]) is.push_back(i);
  rep(j,w) if (mw == ws[j]) js.push_back(j);
  int ans = mh+mw;
  for (int i : is) for (int j : js) {
    if (s.count(P(i,j))) continue;
    cout << ans << endl;
    return 0;
  }
  --ans;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 23752
from collections import Counter


def solve(n, aaa):
    if all(a == 0 for a in aaa):
        return True

    if n % 3 != 0:
        return False

    cnt = Counter(aaa)
    if len(cnt) == 2:
        (a1, c1), (a2, c2) = cnt.most_common()
        if c1 != n * 2 // 3 or c2 != n // 3:
            return False
        return a2 == 0

    if len(cnt) == 3:
        if any(c != n // 3 for c in cnt.values()):
            return False
        a1, a2, a3 = cnt.keys()
        return a1 ^ a2 == a3

    return False


n = int(input())
aaa = list(map(int, input().split()))
print('Yes' if solve(n, aaa) else 'No')


Measured memory_bytes: 14460
//C++のpriority_queue<int>は，デフォルトでは値の大きさが優先度となる

#include<iostream>
#include<vector>
#include<queue>
#include<math.h>
using namespace std;

int main(void) {
  priority_queue<int> q;
  int N,M,temp;
  cin >> N >> M;
  for (int i = 0; i < N; i++){
    cin >> temp;
    q.push(temp);
  }
  
  for (int i = 0; i < M; i++){
    temp = q.top(); q.pop();
    temp = floor(temp/2.0);
    q.push(temp);
  }
  
  long long ans = 0;
  
  for (int i = 0; i < N; i++){
    ans += q.top(); q.pop();
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 892
#include<math.h>
c,i,p,P,f;main(n){float x[100],y[100],d,t,T;for(;scanf("%d",&n),n;printf("%d\n",c)){for(T=2000,i=n;i--;y[i]>T||(T=y[p=f=i]))scanf("%f,%f",x+i,y+i);c=n;d=0;do{T=9;for(i=n;i--;)if(i-p)t=atan2f(y[i]-y[p],x[i]-x[p]),t>d||(t+=2*M_PI),t>T||(T=t,P=i);p=P,d=T,c--;}while(p-f);}exit(0);}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;



int main(void){
    int x,y;
    cin >> x >> y;
    bool f=false;
    for(int i=0;i<=x;i++){
        for(int j=0;i+j<=x;j++){
            if(i*2+j*4==y && i+j==x)
                f=true;
        }
    }
    if(f)
        printf("Yes\n");
    else
    {
        printf("No\n");
    }
    
    return 0;
}

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

using namespace std;


#define mod        1000000007
#define ft         first
#define sd         second
#define pb         push_back
#define all(x)     x.begin(),x.end()
#define ll         long long int
#define bl         bool
#define db         long double
#define vbi        vector<bool> 
#define vlli       vector<ll>
#define mp         make_pair
#define ms(x,v)    memset(x, v, sizeof x)
#define cnl        printf("\n");
#define fr(i,b)    for(ll i=0; i<=b; i++)
#define frr(i,b)   for(ll i=0;i<b;i++)
#define fb(i,b)    for(ll i=b-1; i>=0; i--)
#define PI         3.14159265
ll i,j,k;

int main(){
   
   
ll n; cin>>n; 
vlli v(n+1);
vlli b(n);
frr(i,n+1) cin>>v[i];
frr(i,n) cin>>b[i];
ll ans=0;
for(i=0;i<=n-2;i++){
  if(v[i]<b[i]) {
    ans=ans+v[i];
    ll x;

    x=v[i+1]-(b[i]-v[i]);

    if(x<=0) ans=ans+v[i+1],v[i+1]=0;
    else ans=ans+(v[i+1]-x),v[i+1]=x; 
  
  }
  else {
    ans=ans+b[i];
  }
}
if(b[n-1]>=(v[n-1]+v[n])) ans=ans+(v[n-1]+v[n]);
else  ans=ans+b[n-1];

cout<<ans<<endl;





return 0;
}


Measured memory_bytes: 1792
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ar := make([]int, n)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	t := ar[0]
	for _, v := range ar {
		if t == v {
			continue
		}
		if t < v {
			t = v - 1
			continue
		}
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define wi(t) int t;cin>>t;while(t--)
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve()
    {
  
  ll int a;
  cin>>a;
  cout<<a+(a*a)+(a*a*a);
  
  
  
    }

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

  //  wi(t)
    {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}






Measured memory_bytes: 10684
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<stack>
#include<queue>
#include<string>
#include<iostream>
//#include<tuple>
#include<utility>
#include<set>
#include<queue>
#include<iomanip>
#include<iterator>
//#include<chrono>
//cout<<setprecision(12)
//fixed
//#include<random>
using namespace std;
typedef long long int llint;
typedef long double lldo;
const llint big=1e15+100000;
const int mod=1e9+7;
const lldo eps=1e-9;
const long double pai=3.141592653589793238462643;
#define mt make_tuple
#define mp make_pair
#define fir first
#define sec second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define res resize
#define ins insert
#define era erase
#define dme(in) cout<<in<<endl;return 0
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int main(void){
	int i,j,k,n,p;cin>>n>>p;
	static llint dp[1001][1001]={0};
	vector<int>dag;//0,3,1,2,5,4,6
	vector<int>zi(n);
	queue<int>kra;kra.push(n-1);
	vector<vector<pair<int,pair<int,int> > > > mti(n);//??\??????
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){dp[i][j]=big;}
	}
	dp[0][0]=0;
	for(i=0;i<p;i++){
		int s,e,t1,t2;cin>>s>>e>>t1>>t2;s--;e--;
		zi[s]++;
		mti[e].pub(mp(s,mp(t1,t1+t2)));
	}
	while(!kra.empty()){
		int ba=kra.front();kra.pop();
		dag.pub(ba);
		for(i=0;i<mti[ba].size();i++){
			zi[mti[ba][i].fir]--;
			if(zi[mti[ba][i].fir]==0){kra.push(mti[ba][i].fir);}
		}
	}
	reverse(dag.begin(),dag.end());
	for(i=1;i<dag.size();i++){
		int no=dag[i];
		for(j=0;j<mti[no].size();j++){
			int mae=mti[no][j].fir;
			mineq(dp[no][no],dp[mae][mae]+mti[no][j].sec.sec);//????????¨?????????2????????????
			int ti=mti[no][j].sec.fir;//?????£???????????????
			for(k=0;k<i;k++){
				mineq(dp[dag[k]][no],dp[dag[k]][mae]+ti);//1??????????????????
				mineq(dp[no][dag[k]],dp[dag[k]][mae]+ti);//1??????????????????
			}
			for(k=0;k<mti[no].size();k++){
				int mak=mti[no][k].fir;
				if(mae==mak){continue;}
				int tk=mti[no][k].sec.fir;//?????£???????????????
				mineq(dp[no][no],dp[mae][mak]+ti+tk);
			}
		}
	}
	cout<<dp[n-1][n-1]<<endl;
	return 0;
}

Measured memory_bytes: 11068
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=a;i>b;i--)
#define mkp(a,b) make_pair(a,b)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(a,(max(b,c))
#define min3(a,b,c) min(a,(min(b,c))
#define read(a) cin>>a
#define readt(a,b) read(a),read(b)
using namespace std;
bool compare(pair<int,int>& p1,pair<int,int>& p2)
{
    return p1.second<p2.second;
}
int main()
{
    fastio
    int d,t,s;
    cin>>d>>t>>s;
    if(s*t<d) cout<<"No\n";
    else cout<<"Yes\n";
    
}

Measured memory_bytes: 3660
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;

const int MOD = 998244353;

int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}

int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

set<string> S;

int modpow(int a, int b)
{
	int r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}

int calc(string &s)
{
	int n=s.length();
	int diff=0;
	for(int i=0;i<n-1;i++)
	{
		diff+=(s[i]!=s[i+1]);
	}
	if(diff==0) return 1;
	int ans=add(modpow(3,n-1),MOD-modpow(2,n-1));
	if(n%3==0)
	{
		int sum=0;
		for(int i=0;i<n;i++)
		{
			sum+=s[i]-'a';
		}
		sum%=3;
		if(sum==0) 
		{
			ans=add(ans,MOD-modpow(2,n/3));
			if(n==3) ans=add(ans,MOD-1);
		}
		else ans=add(ans,modpow(2,n/3-1));
	}
	if(diff==n-1) ans=add(ans,1);
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin>>s; cout<<calc(s)<<'\n'; return 0;
	/*
	string s; cin>>s;
	int n=s.length();
	S.insert(s);
	queue<string> q;
	q.push(s);
	while(!q.empty())
	{
		string u=q.front(); q.pop();
		//cerr<<u<<'\n';
		for(int i=0;i<n-1;i++)
		{
			if(u[i]!=u[i+1])
			{
				string t=u;
				if((u[i]=='a'&&u[i+1]=='b')||(u[i]=='b'&&u[i+1]=='a')) t[i]=t[i+1]='c';
				else if((u[i]=='c'&&u[i+1]=='b')||(u[i]=='b'&&u[i+1]=='c')) t[i]=t[i+1]='a';
				else if((u[i]=='a'&&u[i+1]=='c')||(u[i]=='c'&&u[i+1]=='a')) t[i]=t[i+1]='b';
				if(S.find(t)==S.end()) q.push(t);
				S.insert(t);
			}
		}
	}	
	cerr<<S.size()<<' '<<calc(s)<<'\n';
	*/
}


Measured memory_bytes: 720
fun main(args: Array<String>){
    val a = readLine()!!
    var b = 0
    if(Integer.parseInt(a[0].toString()) == 1){ b++ }
    if(Integer.parseInt(a[1].toString()) == 1){ b++ }
    if(Integer.parseInt(a[2].toString()) == 1){ b++ }
    println(b)
}


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

int main(){
  int N;
  cin >> N;
  int ans=0;
  for(int i=1; i<=N; i+=2){
    int cnt=0;
    for(int j=1; j<=i; j++){
        if(i%j==0) cnt++;
    }
    if(cnt==8) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> pint;
typedef map <int,int> mapii;
typedef map <char,int> mapci;
typedef map <string,int> mapsi;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <char> vc;
typedef set <int> si;
typedef set <ll> sll;
typedef set <char> sc;
#define pb(i) push_back(i) ;
#define ms(arr) memset(arr,0,sizeof(arr))
#define deb(x) cout<< #x <<" "<< x<<endl;
#define loop(i,n) for(int i=0;i<n;i++)
#define Loop(i,k,n) for(ll i=k;i<=n;i++)
#define testcase int t;cin>>t; while(t--)

int count(int n)
{
    int m=n;
    int ctr=0;
    while(m>0)
    {
        int rem=m%10;
        m=m/10;
        ctr++;
    }
    return ctr;
}
int main() {
    int n;
    cin >> n;
    int ctr = 0;
    for (int i = 1; i <= n; i++) {
        if (count(i) & 1)
            ctr++;
    }
    cout << ctr;
}

Measured memory_bytes: 256
# include <cstdio>
# include <cmath>
# include <vector>

using namespace std;

int calc_ab_polynomial( int a, int b ) { return ( pow( a, 5 ) - pow( b, 5 ) ); }

int main(void) {
  int x, i, j, a = 0, b = 0, chk = 0; scanf( "%d", &x );
  for(i = 119;i > -119;i--) {
    chk = 0;
    for(j = 118;j > -120;j--) {
      if( calc_ab_polynomial( i, j ) == x ) {
        chk = 1; a = i; b = j;
        printf( "%d %d\n", i, j );
        break;
      }
    }
    if( chk == 1 ) { break; }
  }
  return 0; 
}  

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

int main(){
	int n,q,c,t,x;
	cin>>n>>q;
	queue<int> Q[1005];
	for(int i=0;i<q;i++){
		cin>>c;
		switch(c){
			case 0:
				cin>>t>>x;
				Q[t].push(x);
				break;
			case 1:
				cin>>t;
				if(!Q[t].empty()) cout<<Q[t].front()<<endl;
				break;
			case 2:
				cin>>t;
				if(!Q[t].empty()) Q[t].pop();
		}
	}
	return 0;
}


Measured memory_bytes: 4300
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int amount = scan.nextInt();
		int[] value = new int[amount+1];
		for (int i=1;i<amount+1;i++){
			value[i]=scan.nextInt();
		}
		for(int i=1;i<amount+1;i++){
			int calc =0;
			System.out.print("node "+i+": key = "+value[i]+", ");
			if(i != 1){
				calc = i/2;
				System.out.print("parent key = "+value[calc]+", ");
			}
			if(i*2 <= amount){
				calc = i*2;
				System.out.print("left key = "+value[calc]+", ");
			}
			if(i*2+1 <= amount){
				calc = i*2+1;
				System.out.print("right key = "+value[calc]+", ");
			}
			System.out.println("");
		}
	}
}

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

int main() {
  int n, cnt = 0;
  cin >> n;
  string s;
  cin >> s;
  for(int i = 0; i < 1000; i++) {
    vector<int> v(3);
    v[0] = i % 10;
    v[1] = (i % 100) / 10;
    v[2] = i / 100;
    int idx = 0;
    for(int j = 0; j < n; j++) {
      if(s[j] - '0' == v[idx]) idx++;
      if(idx == 3) {
        cnt++;
        break;
      }
    }
  }
  cout << cnt;
}

Measured memory_bytes: 3684
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/26 21:09:42 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

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

// TOP
void	Main()
{
	int	a, b, c, d;
	cin >> a >> b >> c >> d;

	if ((c + (b - 1))/ b <= (a + (d - 1)) / d)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
// END

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


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

#define rep(i, c) for (int i = 0; i < c; i++)

#define MOD 1000000000 + 7

ll dp[100005][13];

int main(){
    string S;
    cin >> S;
    int N = (int) S.length();

    if (S[0] == '?') {
        for (int i = 0; i < 10; i++)
        {
            dp[0][i] = 1;
        }
    }
    else {
        dp[0][S[0] - '0'] = 1;
    }

    char ch;
    for (int i = 1; i < N; i++){
        ch = S[i];
        if (ch == '?'){
            for (int j = 0; j < 10; j++){
                for (int m = 0; m < 13; m++){
                    dp[i][(m * 10 + j) % 13] += dp[i - 1][m];
                    dp[i][(m * 10 + j) % 13] %= MOD;
                }
            }
        }
        else {
            for (int j = 0; j < 13; j++){
                dp[i][(j * 10 + int(ch - '0')) % 13] += dp[i - 1][j];
                dp[i][(j * 10 + int(ch - '0')) % 13] %= MOD;
            }
        }
    }
    cout << dp[N - 1][5] << endl;
}

Measured memory_bytes: 10624
num = [int(input()) for _ in range(5)]

ans = 0
flag = 0
for i in num:
    if i % 10 == 0:
        ans += i
    else:
        ans += i // 10 * 10 + 10
        flag = 1

ma = 0
if flag:
    for i in num:
        if i % 10 == 0:
            continue
        ma = max(ma, 10 - i % 10)

print(ans - ma)



Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
        int N;
        cin >> N;
        int x,min,diff=-1000001010;
        cin >> min;
        for(int i=0 ; i<N-1 ; i++ ){
                cin >> x;
                if((x-min)>diff)
                        diff=x-min;
                if(min>x)
                        min=x;
        }
        cout<<diff<<endl;
        return 0;
}


Measured memory_bytes: 3120
def fb(n):
    if n % 5 == 0 & n % 3 == 0:
        return 0
    elif n % 3 == 0:
        return 0
    elif n % 5 == 0:
        return 0
    else:
        return n


n = int(input())
l = []
for i in range(n + 1):
    l.append(fb(i))
print(sum(l))

Measured memory_bytes: 33672
# ABC103D_IslandsWar.py

import operator

"""
区画スケジューリング
まず、(ai, bi) の組を bi について昇順にソートします。ソートした順に、以下を行う。
• 既にその要望を満たしている場合、何もしない。
• 要望を満たしていない場合、bi − 1 番目の島と bi 番目の島を接続する橋を取り除く。
TLE に注意
"""

n, m = map(int, input().split())
bridges = [0]
ms = sorted((tuple(map(int, input().split())) for i in range(m)), key=operator.itemgetter(1))

for i in range(m):
    if ms[i][0] <= bridges[-1]:
        pass
    else:
        bridges.append(ms[i][1] - 1)

if __name__ == "__main__":
    print(len(bridges)-1)


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

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

    int size = s.length();
    for(int i=0;i<s.length();i++){
        int x = s[i] - 'A';

        x = (x + n) % 26;
        putchar('A' + x);
    }

}

Measured memory_bytes: 256
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ld> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
ld EPS=1e-4;
// cout << "Case #" << index << " :IMPOSSIBLE";

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n;
    cin>>n;
    V vec(n);
    rep(i,n)cin>>vec[i];
    rep(i,n)vec[i]*=1000000000+1e-5;
    map<P,ll> mp;
    rep(i,n){
       // cout<<(ll)vec[i]<<endl;
        ll reg2=0;
        while((ll)vec[i]%2==0){
            vec[i]/=2;
            reg2++;
        }
        ll reg5=0;
        while((ll)vec[i]%5==0){
            vec[i]/=5;
            reg5++;
        }
        
        if(reg2>18){
            reg2=18;
        }
        if(reg5>18){
            reg5=18;
        }
        mp[{reg2,reg5}]++;
        //cout<<reg2<<" "<<reg5<<endl;
    }
    ll res=0;
    rep(i,19){
        rep(j,19){
            rep(k,19){
                rep(l,19){
                    if(!(i+k>=18&&j+l>=18)){
                        continue;
                    }
                    if(i==k&&j==l&&mp[{i,j}]>=1){
                        res+=(mp[{i,j}])*(mp[{i,j}]-1);
                    }else if(!(i==k&&j==l)){
                        res+=mp[{i,j}]*mp[{k,l}];
                    }
                }
            }
        }
    }
    cout<<res/2<<endl;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int X, N;
    cin >> X >> N;
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    int ans = inf;
    int res = inf;
    REPS(i, -100, 200) {
      bool f = false;
      rep(j, N) {
        if (i == p[j]) {
          f = true;
          break;
        }
      }
      if (f) continue;
      if (ans > abs(i - X)) {
        ans = min(ans, abs(i - X));
        res = i;
      }
    }

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

Measured memory_bytes: 3656
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int result = 0;
		for(int i = 1; i <= N; i++) {
			int sum = 0;
			for(int j = i; j > 0 ; j /= 10) {
				sum += j % 10;
			}
			if(A <= sum && sum <= B) {
				result += i;
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 21844