akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    vector<vector<int>> sheet(a, vector<int>(b));
    for (int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) {
            cin >> sheet[i][j];
        }
    }
    auto getColumn = [&](int p) {
        vector<int> ans = {};
        for (int i = 0; i < a; ++i) {
            ans.push_back(sheet[i][p]);
        }
        return ans;
    };
    auto sum = [&](const vector<int>& list){
        int ans = 0;
        for (int i : list) ans += i;
        return ans;
    };
    vector<int> line(b);
    for (int k = 0; k < b; ++k) {
        line[k] = sum(getColumn(k));
    }
    sheet.push_back(line);
    for (int k = 0; k < a + 1; ++k) {
        sheet[k].push_back(sum(sheet[k]));
    }
    for (int l = 0; l < a + 1; ++l) {
        for (int i = 0; i < b + 1; ++i) {
            if (i != b) cout << sheet[l][i] << " ";
            else cout << sheet[l][i];
        }
        cout << endl;
    }
}



Measured memory_bytes: 3156
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int32_t; using i64 = int64_t; using f64 = double_t; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(n, m, i) for (i32 i = (n); i < (m); ++i)
#define upto(n, m, i) for (i32 i = (n); i <= (m); ++i)
#define downto(n, m, i) for (i32 i = (n); i >= (m); --i)
#define foreach(xs, x) for (auto &x : (xs))
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end())
#define maximum(xs) (*max_element(all(xs)))
#define minimum(xs) (*min_element(all(xs)))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
const i64 MOD = 1000000007;

vec<i32> primes;
void initprimes(i32 n) {
    vec<bool> m(n); times(n, i) m[i] = true;
    m[0] = false;
    m[1] = false;
    range(2, sqrt(n)+1, i) {
        if (m[i]) {
            i32 j = pow(i, 2);
            while (j < n) {
                m[j] = false;
                j += i;
            }
        }
    }
    range(2, n, i) {
        if (m[i])
            primes.append(i);
    }
}

i32 n;

i32 main()
{
    cin >> n;
    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }

    initprimes(n+1);

    i32 d[1001];
    memset(d, 0, sizeof(d));
    upto(2, n, i) {
        i32 t = i;
        foreach(primes, p) {
            while (t / p * p == t) {
                d[p]++;
                t /= p;
            }
        }
    }

    i64 ans = 1;
    upto(1, n, i) {
        ans *= d[i]+1;
        ans %= MOD;
    }

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

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

int main(){
  long long int N,A,B;
  long long int ans=0;
  cin >> N >> A >> B;
  if((B-A)%2==0){
    cout << (B-A)/2 << endl;
  }else{
    if(A-1<=N-B){
      ans+=A-1;
      B-=(A-1);
      B--;
      ans++;
      ans+=(B-1)/2;
    }else{
      ans+=N-B;
      A+=(N-B);
      A++;
      ans++;
      ans+=(N-A)/2;
    }
    cout << ans << endl;
      
  }
}

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

vector<vector<int>> g;
int p[111111];
int main() {
    int n, m;
    cin >> n >> m;
    g.resize(n + 1);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> q;
    q.push(p[1] = 1);
    int c = 1;
    while(!q.empty()) {
        int i = q.front();
        q.pop();
        for(int j : g[i])
            if(!p[j])
                q.push(j), p[j] = i, c++;
    }
    if(c < n) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes\n";
    for(int i = 1; i < n; i++)
        cout << p[i + 1] << '\n';
    return 0;
}


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

int main() {
    long long N; 
    int K;
    cin >> N >> K;
    int h;
    long long ans=0;
    for (long long i=0; i<N; i++) {
        cin >> h;
        if (h>=K) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll a,b,c,d;cin>>a>>b>>c>>d;
	while(a>0&&c>0){
		c-=b;
		if(c<=0) break;
		a-=d;
		}
	cout<<(a>0? "Yes":"No");
}


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

int main(){
    int n,a;
    int n1,n2;
    cin >> n >> a;
    n1=n/500;
    n2=(n-n1*500)/1;
    if(n2>a) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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


// type {{{

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int,int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;

// }}}


// macro {{{

#define rep(i,n) for (ll i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i,n) for (ll i=1, i##_len=(n); i<=i##_len; ++i)

#define SZ(x) ((ll)(x).size())

#define all(x) begin(x),end(x)

// }}}


// Debug {{{

#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "[";
    rep (i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

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

// }}}


// chmax, chmin {{{

template<class T>
bool chmax(T& a, const T& b) {
    if (a < b) { a = b; return true; }
    return false;
}
template<class T>
bool chmin(T& a, const T& b) {
    if (b < a) { a = b; return true; }
    return false;
}

// }}}



// constants {{{

#define inf(T) numeric_limits<T>::max()

const ll MOD = 1e9+7;
const ld EPS = 1e-9;

// }}}


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

    for (;;) {
        int n; cin >> n;
        if (n == 0) break;
        vi L(n);
        rep(i, n) cin >> L[i];

        int s, a, c;
        double mi = inf(double);

        rep(S, 16) rep(A, 16) rep(C, 16) {
            map<int,int> cnt;
            int x = S;
            rep(i, n) {
                x = (A * x + C) % 256;
                ++cnt[(x + L[i]) % 256];
            }

            double ent = 0;
            for (auto& tp : cnt) {
                double p = (double)tp.second / n;
                ent -= p * log(p);
            }
            if (mi > ent + EPS) {
                mi = ent;
                s = S, a = A, c = C;
            }
        }
        cout << s << " " << a << " " << c << endl;
    }

    return 0;
}



Measured memory_bytes: 3376
#include<stdio.h>
#include<string.h>

int n,vis[101][101];

struct point{int x,y;};
struct point grid[101][101];

int dfs(int x,int y,int fg){
  
  vis[y][x]=fg;
  struct point nx=grid[y][x];
  int res=vis[nx.y][nx.x];
  
  if(vis[nx.y][nx.x]==0)res=dfs(nx.x,nx.y,fg);
  
  return vis[y][x]=res;
}

int main(void){
  
  struct point p;
  int i,j,cnt;  

  while(scanf("%d",&n),n){
    memset(vis,0,sizeof(vis));
    
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	scanf("%d %d",&p.x,&p.y);
	grid[i][j]=p;
      }
    }
    
    for(i=0,cnt=1;i<n;i++){
      for(j=0;j<n;j++){
	if(!vis[i][j]){
	  if(dfs(j,i,cnt)==cnt)cnt++;  
	}
      }
    }
    
    printf("%d\n",cnt-1);
  }
  
  return 0;
}

Measured memory_bytes: 732
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    int cnt = 0;
    rep(i,n){
        cin >> a[i];
        while(a[i]%2==0){
            cnt++;
            a[i] /= 2;
        }
    }
    cout << cnt << endl;
}


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

int main() {
  long n,x,ans=0;
  cin >> n >> x;
  vector<long> a(n);
  for(long i=0;i<n;i++) cin >> a[i];

  for(long i=1;i<n;i++) {
    if(a[i-1]+a[i]>x) {
      if(a[i-1]>x) {
        ans+=a[i-1]+a[i]-x;
        a[i]=0;
      } else {
        ans+=a[i-1]+a[i]-x;
        a[i]=x-a[i-1];
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3948
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

ll sum[200005], b[200005], c[200005];

// Segment Tree
constexpr int MAX_N = 1 << 17;
constexpr int INI = 0;
int num, dat[2 * MAX_N - 1];

// まず呼ぶ
void init(int n_) {
	num = 1;
	while (num < n_) num *= 2;
	for (int i = 0; i < 2 * num - 1; ++i) dat[i] = INI;
}

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

// [a, b)の値を取得
// kはノードのインデックス
// [left, right)はノードkが対応する範囲
// query(a, b, 0, 0, num)で呼ぶ.
int query(int a, int b, int k, int left, int right) {
	if (right <= a || b <= left) return INI; // 結果に影響しない値を返すようにする 用変更
	if (a <= left && right <= b) return dat[k];
	int vleft = query(a, b, 2 * k + 1, left, left + (right - left) / 2);
	int vright = query(a, b, 2 * k + 2, left + (right - left) / 2, right);
	return vleft + vright;
}

int main() {
	int n; ll k; cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		ll a; cin >> a;
		sum[i] = a;
	}
	for (int i = 1; i <= n; ++i) sum[i] += sum[i - 1];
	for (int i = 0; i <= n; ++i) b[i] = sum[i] - i*k;
	sort(b, b + n + 1);
	int pos = 1;
	c[0] = b[0];
	for (int i = 1; i <= n; ++i) {
		if (c[pos - 1] == b[i]) continue;
		c[pos++] = b[i];
	}
	for (int i = 0; i <= n; ++i) {
		int lo = -1, hi = pos;
		while (hi - lo > 1) {
			int mid = lo + (hi - lo) / 2;
			if (c[mid] <= sum[i] - i*k) lo = mid;
			else hi = mid;
		}
		b[i] = lo;
	}
	init(pos);
	ll ans = 0;
	for (int i = 0; i <= n; ++i) {
		ans += (ll)query(0, b[i] + 1, 0, 0, num);
		update(b[i], query(b[i], b[i] + 1, 0, 0, num) + 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6016
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

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

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

    map<char, vector<ll>> mp;
    int n = s.size();
    rep(i, n) mp[s[i]].push_back(i);

    int m = t.size();
    ll prev = -1;
    ll cnt = 0;
    rep(i, m) {
        if (mp[t[i]].size() == 0) {
            cout<<-1<<endl;
            return 0;
        }

        vector<ll>::iterator iter = upper_bound(mp[t[i]].begin(), mp[t[i]].end(), prev);
        if (iter == mp[t[i]].end()) {
            cnt++;
            prev = mp[t[i]][0];
        }
        else {
            prev = *iter;
        }
    }
    cout<<cnt * n + prev + 1<<endl;
}

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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
template<class T> using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-10;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n;
ll a[200005];
map<ll, ll> dp[200005];
void solve() {
    cin >> n;
    rep(i, n) cin >> a[i];

    dp[0][0] = 0;
    rep(i, n) for (auto& v : dp[i]) {
        auto ni = min(n, i + 2);
        auto nj = v.first + 1;
        if (nj >= max(0, (ni - 1) / 2) && nj <= (ni + 1) / 2) {
            auto val = dp[ni].try_emplace(nj, -inf).first;
            maxs(val->second, v.second + a[i]);
        }
        ni = i + 1;
        nj = v.first;
        if (nj >= max(0, (ni - 1) / 2) && nj <= (ni + 1) / 2) {
            auto val = dp[ni].try_emplace(nj, -inf).first;
            maxs(val->second, v.second);
        }
    }
    cout << dp[n][n / 2] << endl;
}

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


Measured memory_bytes: 33344
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define pb push_back
# define pdd pair < db , db >
# define int ll
int32_t main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    static ll s1[1 << 20];
    static ll s2[1 << 20];
    int n,k;
    fi>>n>>k;
    for (int i = 1;i <= n;++i)
    {
        fi>>s2[i];
        s1[i] = max(0ll,s2[i]);
        s1[i] += s1[i - 1];
        s2[i] += s2[i - 1];
    }
    ll ans = 0;
    for (int i = 1;i <= n - k + 1;++i)
        ans = max(ans,max(s2[i + k - 1] - s2[i - 1],0ll) + s1[i - 1] + s1[n] - s1[i + k - 1]);
    fo << ans << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int n; cin >> n;
  Graph arr(3, vi(n));
  rep(i,3) rep(j,n) cin >> arr[i][j];

  map<int, int> former, latter;
  for (auto v : arr[0]) ++former[v];
  for (auto v : arr[2]) ++latter[v];

  vl sum1(n+1), sum2(n+1);
  sum1[0] = accumulate(all(arr[0]), 0LL);
  sum2[0] = accumulate(all(arr[2]), 0LL);

  rep(i,n) {
    auto p = *begin(former);
    int k = p.first;
    if (arr[1][i] > k) {
      sum1[i+1] = sum1[i] + arr[1][i] - k;
      ++former[arr[1][i]];
      --former[k];
      if (former[k] == 0) former.erase(k);
    }
    else sum1[i+1] = sum1[i];
  }

  reverse(all(arr[1]));

  rep(i,n) {
    auto p = *rbegin(latter);
    int k = p.first;
    if (arr[1][i] < k) {
      sum2[i+1] = sum2[i] + arr[1][i] - k;
      ++latter[arr[1][i]];
      --latter[k];
      if (latter[k] == 0) latter.erase(k);
    }
    else sum2[i+1] = sum2[i];
  }

  reverse(all(sum2));

  ll ans = -1e14;
  rep(i,n+1) ans = max(ans, sum1[i]-sum2[i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 12408
/*input
6 3
6 5 2 5 3 2
*/
 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <climits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
#include <tgmath.h>
 
using namespace std;
 
/*******  All Required define Pre-Processors and typedef Constants *******/
#define ar array
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define tests int r; cin >> r; while(r--)
#define MP make_pair
#define PI acos(-1)
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
#define godspeed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
 
#define M(x) ((x)%(1000000007))
#define MAXN   100001  
 

std::vector<int> ans;

void factorize(long long n){
   
   int count = 0;
   while (!(n % 2)) {
      n/= 2;
      count++;
   }
   if (count)
      ans.push_back(count);
   for (long long i = 3; i <= sqrt(n); i += 2) {
      count = 0;
      while (n % i == 0) {
         count++;
         n = n / i;
      }
      if (count)
      	ans.push_back(count);
   }
   if (n > 2)
   	ans.push_back(1);
}






int main() {
 	int64 n;
 	int64 k;
 	cin>>n>>k;

 	int arr[n+1];
 	for(int i = 1;i<n+1;i++){
 		int64 a;
 		cin>>a;
 		arr[i] = a;
 	}
 	int visited[n+1];
 	memset(visited,0,sizeof(visited));
 	int j = 1;
 	int count = 0;
 	int end = 0;
 	while(visited[j]==0 && count<k){
 		end = j;
 		visited[j] = count+1;
 		count++;
 		j = arr[j];

 	}
 	if(!(count<k)){
 		cout<<j<<endl;
 	}
 	else{
 		//j is start of cycle. 
 		//end is end of cycle.
 		
 		count = visited[end]-visited[j]+1;
 		//count is length of cycle. 
 		k = k - (visited[j]-1);
 		//cout<<k<<endl;
 		int p = k%count;
 		rep(r,p+1){
 			end = arr[end];
 		}
 		cout<<end<<endl;
 	}

}



 


Measured memory_bytes: 5208
s = input()
a = int(s[0:2])
b = int(s[2:4])
if 1<=a<=12 and 1<=b<=12:
    print("AMBIGUOUS")
elif (a==0 or a>12) and 1<=b<=12:
    print("YYMM")
elif 1<=a<=12 and (b==0 or b>12):
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3060
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  print((x-a)%b);

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
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;
}

int main(){
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    pair<int,int>ans=make_pair(100*A,0);
    for(int i=0;i<=100;i++){
        if(100*A*i<=F){
            int J=(F-100*A*i)/(100*B);
            for(int j=0;j<=J;j++){
                if(100*A*i+100*B*j<=F){
                    int K=(F-100*A*i-100*B*j)/C;
                    for(int k=0;k<=K;k++){
                        if((A*i+B*j)*E>=k*C&&100*A*i+100*B*j+C*k<=F){
                            int L=(F-100*A*i-100*B*j-C*k)/D;
                            for(int l=0;l<=L;l++){
                                int sugar=k*C+l*D;
                                int water=100*(A*i+B*j);
                                if(sugar<=E*(A*i+B*j)&&sugar+water<=F&&sugar+water>0){
                                    if(double(100*sugar)/double(water+sugar)>double(ans.second*100)/double(ans.first)){
                                        ans.first=sugar+water;
                                        ans.second=sugar;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout<<ans.first<<" "<<ans.second<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>
#include <map>

int main()
{
    std::vector<int> table(2 * 100000 + 1);
    int n{};
    std::cin >> n;
    std::vector<int> history(n);
    std::set<int> set;
    for (int i = 0; i < n; i++) {
        std::cin >> history[i];
        table[history[i]]++;
        set.insert(history[i]);
    }
    long long total{};
    for (auto num : set) {
        const long long tmp = table[num];
        if (tmp > 1) {
            total += tmp * (tmp - 1) / 2;
        }
    }

    for (int i = 0; i < n; i++) {
        const long long tmp = table[history[i]];
        auto result = total;
        if (tmp > 1) {
            result -= tmp * (tmp - 1) / 2;
            result += (tmp - 1) * (tmp - 2) / 2;
        }
        std::cout << result << std::endl;
    }
    return 0;
}


Measured memory_bytes: 9088
require 'date'

def age(b,d)
  r=d.year-b.year
  r+=1 if b.month < d.month or (b.month==d.month and b.day < d.day)
  r
end

b=2.times.map{
  y,m,d=gets.split.map &:to_i
  Date.new(y,m,d)
}.sort

p [b[0]-1,b[0]+1,b[1]-1,b[1]+1].each.map{|i|age(b[0],i)-age(b[1],i)}.max

Measured memory_bytes: 7008
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    // Aを0-basedに変換
    for (auto &&i : a) {
        i--;
    }

    int log_k = 1;
    while ((1LL << log_k) < m) log_k++;

    // next[k][i]: i番目の要素の2^k個次の要素
    vector<vector<int>> next(log_k, vector<int>(n, 0));
    next[0] = a;

    for (int k = 0; k < log_k - 1; k++) {
        for (int i = 0; i < n; i++) {
            next[k + 1][i] = next[k][next[k][i]];
        }
    }

    int p = 0;
    for (int k = 0; k < log_k; k++) {
        if (m & (1LL << k)) p = next[k][p];
    }

    cout << p + 1 << "\n";
}


Measured memory_bytes: 100056
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    if(a!=0 && 0<a+b<=pow(10,18))
        cout<<a*(n/(a+b))+min(n%(a+b),a)<<endl;
    else
        cout<<0<<endl;
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long h = scan.nextLong();
        long w = scan.nextLong();

        if (w == 1 || h == 1) {
            System.out.println(1);
            return;
        }

        if (w % 2 == 0) {
            System.out.println((w / 2) * h);
        } else {
            if (h % 2 == 0) {
                System.out.println(w * (h / 2));
            } else {
                System.out.println((w * h + 1) / 2);
            }
        }
    }
}


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

int main(){
  int N,M;
  cin >> N >> M;
  int load[M][2];
  int ans[N]={0};
  for(int i=0;i<M;i++){
    cin >> load[i][0] >> load[i][1];
  }
  for(int i=0;i<M;i++){
    ans[load[i][0]-1]++;
    ans[load[i][1]-1]++;
  }
  for(int i=0;i<N;i++){
    cout << ans[i] <<endl;
  }
    
}

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

int visited[50][50];
const int offset[8][2] = {
    {1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}
};
int grid[50][50];

void dfs(int i, int j, int h, int w){
    for (int k = 0; k < 8; k++) {
        int ii = i + offset[k][0], jj = j + offset[k][1];
        if (ii < 0 || ii >= h || jj < 0 || jj >= w) {
            continue;
        }
        if (!visited[ii][jj] && grid[ii][jj]) {
            visited[ii][jj] = 1;
            dfs(ii, jj, h, w);
        }
    }
}


int main(int argc, char *argv[])
{
    
    cin.tie(0);
    ios::sync_with_stdio(false);

    int w, h;

    
    while (cin >> w >> h, w != 0 && h != 0) {
        memset(visited, 0, 50*50*sizeof(int));
        memset(grid, -1, 50*50*sizeof(int));
        
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> grid[i][j];
            }
        }
        int cnt = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (visited[i][j] || !grid[i][j]) {
                    continue;
                }
                dfs(i, j, h, w);
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3304
/*

  "With age, comes wisdom. With travel, comes understanding.
   Remember that happiness is a way of travel – not a destination"

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int             long long int
#define ld              long double
#define F               first
#define S               second
#define pb              push_back
#define si              set <int>
#define vi              vector <int>
#define pii             pair <int, int>
#define vpi             vector <pii>
#define vpp             vector <pair<int, pii>>
#define mii             map <int, int>
#define mpi             map <pii, int>
#define spi             set <pii>
#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>
#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
     int x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> Set;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 100005;
int cache[101][N], i, j, n, w;
vpi v;

int dp(int i, int val, int mx)
{
     if (val == 0)
          return 0;
     if (i == n || val < 0)
          return 1e18;
     int &ans = cache[i][val];
     if (ans != -1)
          return ans;
     ans = 1e18;
     if (val - v[i].S <= mx)
          ans = min(ans, v[i].F + dp(i + 1, val - v[i].S, mx));
     ans = min(ans, dp(i + 1, val, mx));

     return ans;
}

void solve()
{
     cin >> n >> w;
     v.resize(n);
     for (i = 0; i < n; i++)
          cin >> v[i].F >> v[i].S;

     memset(cache, -1, sizeof cache);
     int mx = 0;
     for (i = 1; i < N; i++)
     {
          int x = dp(0, i, i);
          if (x <= w)
               mx = max(mx, i);
     }
     cout << mx;

}

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

     cout << setprecision(9) << fixed;
     clock_t z = clock();
     solve();
     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

     return 0;
}

Measured memory_bytes: 79232
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= 9; i++)
	{
		for (int j = 1; j <= 9; j++)
		{
			if (n == i * j)
			{
				cout << "Yes";
				return 0;
			}
		}
	}

		cout << "No";
		return 0;
}

Measured memory_bytes: 256
N, L = map(int, input().split())
apples = []

absmin = 99999999
flg = -1
for i in range(1, N+1):
    apples.append(L + i - 1)
    if absmin > abs(L + i - 1):
        absmin = min(absmin, abs(L + i - 1))
        flg = ((L + i - 1) > 0)
if flg:
    print(sum(apples)-absmin)
else:
    print(sum(apples)+absmin)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int f[30];
str s;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>s;
    for(int i=0;i<s.size();i++){
        int d = numerize(s[i]);
        f[d]++;
    }
    bool valid = true;
    for(int i=0;i<s.size();i++){
        int d = numerize(s[i]);
        if(f[d]!=2){valid=false;}
    }
    if(valid)cout<<"Yes\n";
    else{cout<<"No\n";}

}


Measured memory_bytes: 764
import java.io.*;
import java.util.StringTokenizer;

class Main {

    public static void main(String[] args) throws IOException {
        init(System.in);
        int n = nextInt();
        int min = Integer.MAX_VALUE;
        for (int i = 1; i < n; i++) {
            int sum = digitSum(i) + digitSum(n - i);
            min = Math.min(min, sum);
        }
        System.out.println(min);
    }

    private static int digitSum(int num) {
        int sum = 0;
        while (num > 0) {
            sum += num % 10;
            num /= 10;
        }

        return sum;
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

//    private static long nextLong() throws IOException {
//        return Long.parseLong(next());
//    }
//
//    //    Get a whole line.
//    private static String line() throws IOException {
//        return reader.readLine();
//    }
//
//    private static double nextDouble() throws IOException {
//        return Double.parseDouble(next());
//    }
}



Measured memory_bytes: 20564
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

long long mod=1000000007;

int main(){
	vector<long long>x,y;
	long long n,m;
	long long tmp,sumx,sumy;
	sumx = 0;
	sumy = 0;
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> tmp;
		x.push_back(tmp);
	}
	for(int i=0;i<m;i++){
		cin >> tmp;
		y.push_back(tmp);
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	for(long long i=0;i<n;i++){
		sumx = (sumx + (2*i-n+1)*x[i])%mod; 
	}
	for(long long i=0;i<m;i++){
		sumy = (sumy + (2*i-m+1)*y[i])%mod; 
	}
	cout << sumx*sumy%mod <<endl;
	return 0;
}

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

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

  vector<int> a(n);
 rep(i,n) cin >> a[i];

  int h = 0;
  ll ans =0;
  rep(i,n){
    h = max(h, a[i]);
    ans += h - a[i];
}
    cout << ans << endl;
        
return 0;
}

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

int main()
{
  int h, w;
  cin >> h >> w;
  vector<string> a;
  for (int i = 0; i < h; ++i)
  {
    string s;
    cin >> s;
    bool c = true;
    for (int j = 0; j < w; ++j)
    {
      if (s[j] == '#')
        c = false;
    }
    if (!c)
      a.push_back(s);
  }
  vector<int> check;
  for (int i = 0; i < w; ++i)
  {
    bool c = true;
    for (int j = 0; j < a.size(); ++j)
    {
      if (a[j][i] == '#')
        c = false;
    }
    if (!c)
      check.push_back(i);
  }
  for (int i = 0; i < a.size(); ++i)
  {
    for (int j = 0; j < w; ++j)
    {
      bool c = true;
      for (int k = 0; k < check.size(); ++k)
      {
        if (check[k] == j)
          c = false;
      }
      if (!c)
        cout << a[i][j];
    }
    cout << endl;
  }

  return 0;
}

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

using namespace std;

#define int long long
//#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 998244353;


void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        b[i] = x - 1;
        a[x - 1]++;
    }

    int cnt = 0;
    for (int i = 0; i < n; i++) {
       if(a[i]) cnt += a[i] * (a[i] - 1) / 2;
    }

    for (int j = 0; j < n; j++) {
        int i = b[j];
        if (a[i]) cnt -= a[i] * (a[i] - 1) / 2;
        if (a[i] - 1 > 0) cnt += (a[i] - 1) * (a[i] - 2) / 2;
        cout << cnt << '\n';
        if(a[i] - 1 > 0) cnt -= (a[i] - 1) * (a[i] - 2) / 2;
        if(a[i]) cnt += a[i] * (a[i] - 1) / 2;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(12);
    srand(time(0));
    cout << fixed;
    solve();
}

Measured memory_bytes: 5760
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
count = B[A[0]-1]
for i in range(1, N):
    #print(count, B[A[i]-1], i)
    count += B[A[i] -1]
    if A[i] - A[i-1] == 1:
        count += C[A[i] -2]
print(count)

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

string judge(double weight){
  string bclass;
  if(weight <= 48.00){
    bclass = "light fly";
  }else if(48.00 < weight && weight <= 51.00){
    bclass = "fly";
  }else if(51.00 < weight && weight <= 54.00){
    bclass = "bantam";
  }else if(54.00 < weight && weight <= 57.00){
    bclass = "feather";
  }else if(57.00 < weight && weight <= 60.00){
    bclass = "light";
  }else if(60.00 < weight && weight <= 64.00){
    bclass = "light welter";
  }else if(64.00 < weight && weight <= 69.00){
    bclass = "welter";
  }else if(69.00 < weight && weight <= 75.00){
    bclass = "light middle";
  }else if(75.00 < weight && weight <= 81.00){
    bclass = "middle";
  }else if(81.00 < weight && weight <= 91.00){
    bclass = "light heavy";
  }else if(91.00< weight){
    bclass = "heavy";
  }
  
  return bclass;
}

int main(void){
  double weight;
  while(cin >> weight){
    cout << judge(weight) << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}

string strin(){string s;cin>>s;return s;}
char chin(){char c;cin>>c;return c;}
ll lin() {ll x;scanf("%lld",&x);return x;}

int main(){
    bool a=(chin()=='H'),b=(chin()=='H');
    if((a&b)|(!a&!b)) cout<<"H"<<endl;
    else cout<<"D"<<endl;
}

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

int main() {
int N,D,ans=0;
  long long x,y;
  cin>>N>>D;
  for(int i=0;i<N;i++){
    cin>>x>>y;
    if(sqrt(x*x+y*y)<=D)ans++;
   //cout<< sqrt(x*x+y*y)<<endl;
  }
cout<<ans;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int n, a[100], P, Q, R; vector<int>S[5];
long long maxn = -(1LL << 60); vector<int>maxid;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		S[a[i] + 2].push_back(i);
	}
	for (int i = 0; i <= S[0].size(); i++) {
		for (int j = 0; j <= S[1].size(); j++) {
			for (int k = 0; k <= S[2].size(); k++) {
				for (int l = 0; l <= S[3].size(); l++) {
					for (int m = 0; m <= S[4].size(); m++) {
						long long ret = 1; vector<int>A;
						for (int p = 0; p < i; p++) { ret *= -2; A.push_back(S[0][p]); }
						for (int p = 0; p < j; p++) { ret *= -1; A.push_back(S[1][p]); }
						for (int p = 0; p < k; p++) { ret *= 0; A.push_back(S[2][p]); }
						for (int p = 0; p < l; p++) { ret *= 1; A.push_back(S[3][p]); }
						for (int p = 0; p < m; p++) { ret *= 2; A.push_back(S[4][p]); }
						sort(A.begin(), A.end());
						if (ret > maxn) {
							maxn = ret;
							maxid = A;
						}
						else if (ret == maxn) {
							if (A.size() < maxid.size()) maxid = A;
							else if (A.size() == maxid.size() && A < maxid) maxid = A;
						}
					}
				}
			}
		}
	}
	cout << maxid.size() << endl;
	for (int i = 0; i < maxid.size(); i++) cout << maxid[i] << endl;
	return 0;
}


Measured memory_bytes: 3160
import std.string;
import std.stdio;
import std.algorithm;

void main() {
	auto s = readln.chomp.dup;
	auto t = readln.chomp.dup;

	if (s.length == 0 || t.length == 0) {
		writeln();
		return;
	}

	auto dp = new int[][t.length + 1];
	foreach (ref e;dp) {
		e = new int[s.length + 1];
	}

	foreach (size_t i, te;t) {
		foreach (size_t j, se;s) {
			if (te == se) {
				dp[i + 1][j + 1] = max(dp[i][j] + 1, dp[i + 1][j], dp[i][j + 1]);
			} else  {
				dp[i + 1][j + 1] = max(dp[i][j], dp[i + 1][j], dp[i][j + 1]);
			}
		}
	}

	auto result = new char[dp[t.length][s.length]];

	auto y = t.length, x = s.length;

	for (;;) {
		auto num = dp[y][x];

		while (y >= 1 && dp[y - 1][x] == num) {
			--y;
		}

		while (x >= 1 && dp[y][x - 1] == num) {
			--x;
		}

		if (y == 0 || x == 0) break;

		result[num - 1] = s[x - 1];

		--x;
		--y;
	}

	writeln(result);
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

int main(){
    ll X, Y;
    cin >> X >> Y;

    bool ans = false;
    REP(i,X+1){
        int y = X - i;
        int sum = 2*i + 4*y;
        if(sum == Y){
            ans = true;
            break;
        }
    }

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


Measured memory_bytes: 3620
# coding: utf-8
import re
import math
import fractions
#import numpy as np

mod=int(10**9+7)

def lcm(a,b):
    #return a*b*pow(fractions.gcd(a,b),mod-2,mod)
    return a*b//fractions.gcd(a,b)
#main
N=int(input())
A=list(map(int,input().split()))
l=A[0]
for a in range(1,N):
    l=lcm(l,A[a])
l%=mod

ans=0
for a in A:
    ans+=l*pow(a,mod-2,mod)
    ans%=mod
print(ans)


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

int main(){
	int n, l;
	cin >> n >> l;

	int sum = 0;
	int mini = 1000;
	rep(i, n){
		sum += l+i;
		if(abs(l+i) < abs(mini)) mini = l+i;
	}

	cout << sum - mini << endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = Integer.parseInt(sc.next());
    	int[] d = new int[n];
    	for(int i=0; i<n; i++) {
    	    d[i] = Integer.parseInt(sc.next());
    	}
    	Arrays.sort(d);
    	int count = 1;
    	for(int i=1; i<n; i++) {
    	    if(d[i] > d[i-1]) count++;
    	}
    	System.out.println(count);
    }
}

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

int main() {
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) {
            bool s = (i < B) ^ (j < A);
            cout << (s ? 1 : 0);
        }
        cout << endl;
    }
}

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

using namespace std;

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

  string S;
  cin >> S;

  if (S == "ABC") {
    cout << "ARC" << '\n';
  } else {
    cout << "ABC" << '\n';
  }

  return 0;
}


Measured memory_bytes: 3568
#include "iostream"
using namespace std;

int main()
{
	int L[100], pos = 0, ans=1;
	int n, x;
	cin >> n >> x;
	for (int i = 0; i < n; i++)
	{
		cin >> L[i];
		pos += L[i];
		if (pos <= x)
		{
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d",&a,&b);
   c=3*a+b;
   if(c%2==0)
   {
       printf("%d\n",c/2);
   }
    if(c%2==1)
   {
       printf("%d\n",(c-1)/2);
   }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  int N; cin >> N;
  vector<int> d(N); rep(i, N) cin >> d.at(i);
  int ans = 0;
  rep(i, N-1){
    for(int j = i+1; j < N; j++){
      ans += d.at(i)*d.at(j);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
	//freopen("1.in","r",stdin);
	string s;
	cin>>s;
	int ans=s.size();
	for(char i='a';i<='z';++i)
	{
		int now=0,mx=0;
		for(auto c:s)
		if(c==i)now=0;
		else mx=max(mx,++now);
		ans=min(ans,mx);
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string S;
  	cin >> S;
  	int x = S.size();
  	int y = 0;
  	if(S.size()%2==0){
    	for(int i=0;i<x/2;i++){
        	if(S[i]!=S[x-1-i])y++; 
        }
    }else{
    	for(int j=0;j<x/2;j++){
        	if(S[j]!=S[x-1-j])y++;
        }
    }
  	cout << y << endl;
}


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

#define ff first
#define ss second
#define pb push_back

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

const int N = 100005;

char s[15];
int n;

void f(int id, char lst){
  if(id == n){
    printf("%s\n", s);
    return;
  }
  for(char c = 'a'; c <= lst+1; c++){
    s[id] = c;
    f(id+1, max(lst, c));
  }
}

int main() {
  scanf("%d", &n);
  f(0, 'a'-1);

	return 0;
}


Measured memory_bytes: 1536
fun main(args: Array<String>) {
    abc064d()
}

fun abc064d() {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    var unpairedRight = 0
    var unpairedLeft = 0
    s.map { it == '(' }.forEach { isLeft ->
        if (isLeft) {
            unpairedLeft++
        } else {
            if (unpairedLeft > 0) {
                unpairedLeft--
            } else {
                unpairedRight++
            }
        }
    }

    val answer = "(".repeat(unpairedRight) + s + ")".repeat(unpairedLeft)

    println(answer)
}


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

typedef long long ll;
//loop
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//STL
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

void Main() {
    ll n,k,x,y;
    cin >> n >> k >> x >> y;
    ll ans = 0;
    REP(i,n) {
        if (i < k) {
            ans += x;
        } else {
            ans += y;
        }
    }
    cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	Main();
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int n, m;
	for (; cin >> n >> m;)
	{
		if (n == 0 && m == 0)
		{
			break;
		}

		vector<int> a(n);
		for (int i = 0; i < n; i++)
		{
			cin >> a.at(i);
		}

		int maxs = -1 << 31;

		for (int i = 0; i < n - m; i++)
		{
			int sum = accumulate(a.begin() + i, a.begin() + i + m, 0);
			maxs = max(maxs, sum);
		}

		cout << maxs << endl;
	}
}


Measured memory_bytes: 3108