akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>

using namespace std;

typedef long long li;

int main() {
    li n, k;
    cin >> n >> k;

    vector<li> xs(n), ys(n), ws(n);
    const li size = 2 * k;

    for (int i = 0; i < n; ++i) {
        li x, y;
        char w;
        cin >> x >> y >> w;
        xs[i] = x % size + 1;
        ys[i] = y % size + 1;
        ws[i] = (w == 'B');
    }

    vector<vector<li>> whites(size + 1, vector<li>(size + 1));
    vector<vector<li>> blacks(size + 1, vector<li>(size + 1));

    for (int i = 0; i < n; ++i) {
        if (ws[i]) {
            blacks[xs[i]][ys[i]] += 1;
        } else {
            whites[xs[i]][ys[i]] += 1;
        }
    }

    for (int i = 0; i <= size; ++i) {
        for (int j = 0; j < size; ++j) {
            blacks[i][j + 1] += blacks[i][j];
            whites[i][j + 1] += whites[i][j];
        }
    }

    for (int j = 0; j <= size; ++j) {
        for (int i = 0; i < size; ++i) {
            blacks[i + 1][j] += blacks[i][j];
            whites[i + 1][j] += whites[i][j];
        }
    }

    auto query = [&](const vector<vector<li>>& board, int lx, int ly, int ux, int uy) {
        return board[ux][uy] - board[ux][ly] - board[lx][uy] + board[lx][ly];
    };

    auto bound = [&](li x) {
        return min(max(0LL, x), size);
    };

    li ans = 0;
    for (int bi = 0; bi <= size; ++bi) {
        for (int bj = 0; bj <= size; ++bj) {
            li count = 0;
            for (int di = -2; di <= 2; ++di) {
                for (int dj = -2; dj <= 2; ++dj) {
                    li parity = (di + dj + 4) % 2;
                    li w_sgn = parity ? 1 : 0;
                    li b_sgn = 1 - w_sgn;

                    li lx = bound(bi + di * k);
                    li ly = bound(bj + dj * k);
                    li ux = bound(bi + (di + 1) * k);
                    li uy = bound(bj + (dj + 1) * k);

                    count += w_sgn * query(whites, lx, ly, ux, uy);
                    count += b_sgn * query(blacks, lx, ly, ux, uy);
                }
            }

            ans = max(ans, count);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 67328
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  int N;
  string s[200000];
  cin>>N;
  for (int i(0);i<N;i++){
    cin>>s[i];
  }
  sort(s,s+N);
  vector<pair<int,string>> t;
  t.push_back({1,s[0]});
  for (int i(1);i<N;i++){
    if (s[i] == s[i-1]){
      t[int(t.size())-1].first++;
    }else{
      t.push_back({1,s[i]});
    }
  }
  sort(t.rbegin(),t.rend());
  int maxi = t[0].first;
  vector<string> ans;
  ans.push_back(t[0].second);
  for (int i(1);i<int(t.size());i++){
    if (maxi == t[i].first){
      //cout << t[i].second << endl;
      ans.push_back(t[i].second);
    }else{
      break;
    }
  }
  //cout << ans.size() << endl;
  sort(ans.begin(),ans.end());
  for (int i(0);i<int(ans.size());i++){
    cout << ans[i] << endl;
  }
  return 0;
}



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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
ll n;
int a[N];
int cont[N];
int t[N];
ll good;
ii psum[N];

static inline int lsb(int x) {
    return x & -x;
}

bool check(int x) {
    memset(t, 0, sizeof t);
    auto query = [&](int x) {
        int res = 0;
        while (x >= 1) {
            res += t[x];
            x -= lsb(x);
        }
        return res;
    };
    auto update = [&](int x) {
        while (x <= n) {
            ++t[x];
            x += lsb(x);
        }
    };
    ll cnt = 0;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] >= x) {
            sum += 1;
        } else {
            sum -= 1;
        }
        psum[i] = {sum, i + 1};
    }
    sort(psum, psum + n);
    for (int i = 0; i < n; ++i) {
        if (psum[i].first >= 0) ++cnt;
        cnt += query(psum[i].second);
        update(psum[i].second);
    }
    return cnt >= good;
}

int main() {
    cin >> n;
    good = (n * (n + 1) / 2 + 1) / 2;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int l = 1, r = 1e9;
    while (l < r) {
        int m = (r - l + 1) / 2 + l;
        if (check(m)) {
            l = m;
        } else {
            r = m - 1;
        }
    }
    cout << l << endl;

    return 0;
}


Measured memory_bytes: 5216
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define F first
#define S second
using namespace std;

const LL mod = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b == 0?a: gcd(b, a % b); }
template<typename T> T LCM(T a, T b) { return a*(b/gcd(a, b)); }
template<typename T> T expo(T base, T e, T mod) { T res = 1;
  while(e > 0) { if(e&1) res = res * base % mod; base = base * base % mod; e >>= 1; }
  return res;
}
template<typename T, typename S> T expo(T b, S e){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b), e>>1): (b*expo((b*b), e>>1));}
template<typename T, typename S> T modinv(T a, S mod) { return expo(a, mod-2, mod); }
template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<class T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &t) {
	os<<"["; FOR(it,t) { if(it != t.begin()) os<<", "; os<<*it; } os<<"]";
	return os;
}

const int MAXN = 1e5 + 100;

int n;
LL arr[MAXN];

LL way(bool yo) {
  LL res = 0, sum = 0;
  bool pos = yo;
  for(int i = 1; i <= n; i++) {
    sum += arr[i];
    if(pos) {
      if(sum <= 0) {
        res += (-sum)+1;
        sum = 1;
      }
    } else {
      if(sum >= 0) {
        res += (sum)+1;
        sum = -1;
      }
    }
    pos ^= true;
  }
  return res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for(int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  LL res = min(way(true), way(false));
  cout << res << '\n';
  return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<pair<ll, ll>> G[N];
    REP(i, N - 1)
    {
        ll u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        G[u].push_back(make_pair(v, w));
        G[v].push_back(make_pair(u, w));
    }

    vector<ll> dist(N, INT32_MAX);
    vector<bool> visited(N, false);
    queue<ll> Q;
    Q.push(0);
    dist[0] = 0;

    while(!Q.empty())
    {
        ll v = Q.front();
        Q.pop();
        if (!visited[v])
        {
            visited[v] = true;
            for (auto iter = G[v].begin(); iter != G[v].end(); ++iter)
            {
                ll u = (*iter).first;
                ll w = (*iter).second;
                Q.push(u);
                dist[u] = dist[v] + w;
            }
        }
    }

    REP(i, N)
    {
        int ans = dist[i] % 2 == 0 ? 0 : 1;
        cout << ans << endl;
    }
}


Measured memory_bytes: 8704
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string s = Console.ReadLine();
		string ans = "Yes";
		if(s.Length%2==1){
			ans = "No";
		} else {
			for(var i=0;i<s.Length/2;i++){
				if(s.Substring(i*2,2)!="hi"){
					ans = "No";
				}
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>
#define N 1000
 
int max(int x,int y){
  return x>y?x:y;
}
 
char str1[N+1],str2[N+1];
 
int LCS(){
int c[N+1][N+1];
int maxv=0,i,j,m,n;
 
m=strlen(str1);
n=strlen(str2);
 
for(i=0;i<=m;i++) c[i][0]=0;
for(j=0;j<=n;j++) c[0][j]=0;
 
for(i=1;i<=m;i++){
  for(j=1;j<=n;j++){
    if(str1[i-1]==str2[j-1]){
      c[i][j]=c[i-1][j-1]+1;
    } else {
      c[i][j]=max(c[i-1][j],c[i][j-1]);
    }
    maxv=max(maxv,c[i][j]);
    }
  }
 
return maxv;
}
 
int main(){
int n,i;
 
scanf("%d",&n);
for(i=0;i<n;i++){
  scanf("%s",str1);
  scanf("%s",str2);
  printf("%d",LCS());
  puts("");
  }
return 0;
}



Measured memory_bytes: 5688
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M,R;
    cin >> N >> M >> R;
    vector<ll> iku(R);
    rep(i,R){
        cin >> iku[i];iku[i]--;
    }
    vector<vector<ll>> cost(N,vector<ll>(N,INF));
    ll a,b,c;
    rep(i,M){
        cin >> a >> b >> c;a--;b--;
        cost[a][b] = c;cost[b][a] = c;
    }
    rep(i,N){
        rep(j,N){
            rep(k,N){
                cost[j][k] = min(cost[j][k],cost[j][i] + cost[i][k]);
            }
        }
    }
    sort(all(iku));
    ll ans = INF;
    do{
        ll cnt = 0;
        rep(i,R - 1){
            cnt += cost[iku[i]][iku[i + 1]];
        }
        chmin(ans,cnt);
    }while(next_permutation(all(iku)));
    cout << ans << endl;
}

Measured memory_bytes: 3784
N,M=map(int,input().split())
E=[list(map(int,input().split())) for i in range(M)]
INF=10**12
D=[[INF]*N for i in range(N)]
for i in range(N):
  D[i][i]=0
for i in range(M):
  D[E[i][0]-1][E[i][1]-1]=E[i][2]
  D[E[i][1]-1][E[i][0]-1]=E[i][2]
for k in range(N):
  for i in range(N):
    for j in range(N):
      D[i][j]=min(D[i][j],D[i][k]+D[k][j])
P=0
for i in range(M):
  for j in range(N):
    if D[j][E[i][0]-1]+E[i][2]==D[j][E[i][1]-1] or D[j][E[i][1]-1]+E[i][2]==D[j][E[i][0]-1]:
      break
    if j==N-1:
      P+=1
print(P)

Measured memory_bytes: 74344
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	if(a+b+c>21) cout << "bust" << endl;
	else cout << "win"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = s, i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = s; i < (n); ++i)
#define VFORS(i, s, n) for(int i = s; i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = s, i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = s, i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end());

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;

const int MOD = 1000000007;
const int INF = 1000000000;

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;
}

int main(){
    int n; cin >> n;
    vector<int> f(n, 0); // 下からi桁目 = i番目の時刻に働くか
    REP(i, n) REP(j, 10){
        int fn; cin >> fn;
        f[i] += (fn << j);
    }
    vector<vector<int>> p(n, vector<int>(11));
    REP(i, n) REP(j, 11) cin >> p[i][j];
    int ans = -2 * INF;
    FOR(i, 1, (1<<10)){
        int prf = 0;
        REP(j, n){
            int time = (i & f[j]);
            int cnt = 0;
            REP(k, 10) if(time & (1<<k)) ++cnt;
            prf += p[j][cnt];
        }
        chmax(ans, prf);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>

using namespace std;

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

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

    vector<int> b(a);
    b[0] = min(b[0],x);

    for (int i = 0; i < n - 1; i++) {
        if (b[i] + b[i+1] > x) {
            b[i+1] -= min(b[i+1], b[i]+b[i+1] - x);
        }
        if (b[i] > x)
            b[i] = x;
    }
    long ans = 0;
    for (int i = 0; i < n; i++) {
        ans += a[i] - b[i];
    }

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

Measured memory_bytes: 1024
N = int(input())
N_List = list(map(int,input().split()))

X = [x for x in N_List if x % 2 ==0]
Y = [y for y in X if y % 3 ==0 or y % 5 ==0]

if len(X) == len(Y):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 9188
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
	int k;
	int n;
	int a[100];
	int m = 0;
	int b = 0;
	scanf("%d %d", &k, &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &a[i]);
		if (m < a[i]) m = a[i];
	}
	b = (2 * m) - k - 1;
	if (b<=0) printf("0\n");
	else printf("%d\n",b);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll N;
    cin >> N;

    vector<ll> sum(N, 0);
    sum[0] = 0;
    rep(i, N - 1) { sum[i + 1] = sum[i] + i + 1; }

    // repv(sum) cout << *it << " ";
    // cout << endl;

    ll idx = lower_bound(ALL(sum), N) - sum.begin();
    cout << idx << endl;

    while (1) {
        N -= idx;
        idx = lower_bound(ALL(sum), N) - sum.begin();

        if (idx == 0) break;
        cout << idx << endl;
    }

    return 0;
}

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

string my_greater(string a, string b) {
  if (a.size() == b.size()) {
    if (a == b)
      return "EQUAL";
    else if (a[0] == b[0])
      return my_greater(a.erase(0, 1), b.erase(0, 1));
    else
      return a[0] > b[0] ? "GREATER" : "LESS";
  }
  else
    return a.size() > b.size() ? "GREATER" : "LESS";
}

int main() {
  string a, b;
  cin >> a >> b;
  
  cout << my_greater(a, b) << endl;
  
  return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
a_cnt = abs(abs(x) - abs(y))

if x + a_cnt == y:
    print(a_cnt)
elif x + a_cnt == -y:
    print(a_cnt + 1)
elif x - a_cnt == -y:
    print(a_cnt + 1)
else:
    print(a_cnt + 2)


Measured memory_bytes: 2940
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define mod (int)1000000007
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = DBL_EPSILON;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline int gcd(int a, int b) {
	while (b) {
		int c = a;
		a = b; b = c % b;
	}
	return a;
}
inline int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
bool isprime(int n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
int mypow(int a, int b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	int memo = mypow(a, b >> 1);
	return memo * memo;
}
int modpow(int a, int b, int m = mod) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	int memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && a != c) {
		puts("Yes");
	}
	else if (b == c && a != b) {
		puts("Yes");
	}
	else if (a == c && b != a) {
		puts("Yes");
	}
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
import sys, os
import collections

MOD = 10 ** 9 + 7

def solve(input_stream):
  a = read_int(input_stream)
  s = input_stream.readline().strip()
  if a < 3200:
    return [str("red")]
  else:
    return [s]

def read_ints(input_stream):
  return [i for i in map(int, input_stream.readline().strip().split())]

def read_int(input_stream):
  return int(input_stream.readline().strip())


if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        UL H, W; cin >> H >> W;
        UL arr[101][101]; rep(y, H) rep(x, W) cin >> arr[x][y];
        rep(y, H) {
            UL tmp = 0;
            rep(x, W) tmp += arr[x][y];
            arr[W][y] = tmp;
        }
        rep(x, W + 1) {
            UL tmp = 0;
            rep(y, H) tmp += arr[x][y];
            arr[x][H] = tmp;
        }
        rep(y, H + 1) {
            rep(x, W + 1) {
                if (x) cout << " "; cout << arr[x][y];
            } cout << endl;
        }
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



Measured memory_bytes: 3172
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct node *link;

struct node{
  int item;
  link next, prev;
};

int main(void){
  int n, i, j, getitem, size = 0;
  char s[16];
  link head, end;
  head = malloc(sizeof(*head));
  head->item = -1;
  head->next = NULL;
  head->prev = NULL;
  end = head;
  
  scanf("%d", &n); //input number
  
  for(i = 0; i < n; i++){
    scanf("%s", s);
    if(!strcmp(s, "insert")){ //insert
      scanf("%d", &getitem);
      link x;
      x = malloc(sizeof(*x));
      x->item = getitem;
      x->next = head;
      x->prev = NULL;
      head->prev = x;
      head = x;
      size++;
    }else if(!strcmp(s, "delete")){ //delete
      scanf("%d", &getitem);
      link x;
      x = malloc(sizeof(*x));
      x = head;
      if(head->item == getitem){ //head is delete point
	head = head->next;
	head->prev = NULL;
	size--;
	continue;
      }
      while(x->next->item != -1){ //look for delete point
	if(x->next->item == getitem){
	  x->next = x->next->next;
	  x->next->prev = x;
	  size--;
	  break;
	}else{
	  x = x->next;
	}
      }
    }else if(!strcmp(s, "deleteFirst")){ //deleteFirst
      if(size == 0){
	continue;
      }
      head = head->next;
      head->prev = NULL;
      size--;
    }else if(!strcmp(s, "deleteLast")){ //deleteLast
      if(size == 0){ //no element 
	continue;
      }else if(size == 1){ //only one element(same as deleteFirst)
	head = head->next;
	head->prev = NULL;
	size--;
	continue;
      }
      end->prev->prev->next = end;
      size--;
    }
  }


  //output
  link x;
  x = malloc(sizeof(*x));
  x = head;
  for(i = 0; i < size-1; i++){
    printf("%d ", x->item);
    x = x->next;
  }
  printf("%d\n", x->item);
  return 0;
}

Measured memory_bytes: 36068
x,n = map(int,input().split())
Data = list(map(int,input().split()))
if not x in Data:
    print(x)
else:
    i = 1
    while True:
        if not x-i in Data:
            print(x-i)
            break
        if not x+i in Data:
            print(x+i)
            break
        i+=1

Measured memory_bytes: 9024
N=int(input())

MOD=10**9+7
if N==1:
    ans=0
elif N==2:
    ans=2
else:
    ans10=1
    ans9=1
    ans8=1

    for i in range(N):
        ans10=ans10*10%MOD
        ans9=ans9*9%MOD
        ans8=ans8*8%MOD

    ans=(ans10-2*ans9+ans8)%MOD

print(ans)


Measured memory_bytes: 63188
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

long long int a[100007];
long long int A[100007];
long long int B[100007];
int main()
{
    int N;
    scanf("%d\n",&N);
    for(int i=0; i<N+1; i++) scanf("%lld ", &A[i]);
    for(int i=0; i<N; i++) scanf("%lld ", &B[i]);
    for(int i=0; i<N+1; i++) a[i]=A[i];

    for(int i=0; i<N; i++)
    {
        long long int p = A[i]-B[i];
        A[i] = max(p, (long long int)0);
        if(A[i]==0)
        {
            p = A[i+1] + p;
            A[i+1] = max(p, (long long int)0);
        }
    }

    long long int res=0;
    for(int i=0; i<N+1; i++)
    {
        res += a[i]-A[i];
    }
    printf("%lld",res);

    return 0;
}

Measured memory_bytes: 2560
import Control.Monad
import Data.List
import Control.Applicative

solver :: [Int] -> [Int]
solver = (\\) [1..30]


main :: IO()
main = do
  contents <- map (read :: String -> Int) <$> replicateM 28 getLine
  let (x1:x2:_) = solver contents
  if x1 < x2
    then mapM_ print [x1, x2]
    else mapM_ print [x2, x1]

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

struct Vertex
{
    vector<pll> node;
};

Vertex V[100005];
int A[100005];
bool U[100005];

int main()
{
    int N;
    cin >> N;
    REP(i, N - 1)
    {
        ll u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        V[u].node.push_back(pll(v, w));
        V[v].node.push_back(pll(u, w));
    }

    queue<pll> q;
    q.push(pll(0, 0));
    A[0] = 0;

    while (!q.empty())
    {
        pll t = q.front();
        q.pop();
        if (U[t.first])
            continue;
        U[t.first] = true;
        REP(i, V[t.first].node.size())
        {
            pll n = V[t.first].node[i];
            if (U[n.first])
                continue;

            ll cost = t.second + n.second;
            A[n.first] = cost % 2;

            q.push(pll(n.first, cost));
        }
    }

    REP(i, N)
    {
        cout << A[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 8320
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: String = input();
    let s: String = s.chars().rev().collect();

    let x = vec!["dream", "dreamer", "erase", "eraser"];
    let x: Vec<String> = x.iter().map(|s| s.chars().rev().collect()).collect();

    let mut ok = true;
    let mut i = 0;
    while i < s.len() {
        let mut found = false;
        for y in &x {
            if s[i..].len() < y.len() {
                continue;
            }
            let temp: String = s[i..i + y.len()].to_string();
            if temp == *y {
                found = true;
                i += y.len();
                break;
            }
        }
        if !found {
            ok = false;
            break;
        }
    }

    println!("{}", if ok { "YES" } else { "NO" });
}


Measured memory_bytes: 4352
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, M;
    scan(N, M);
    auto a = readln.split.to!(int[]);

    auto t = a.sum();

    int cnt;
    foreach (ai ; a) {
        if (4*ai*M >= t) {
            cnt++;
        }
    }

    yes(cnt >= M);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


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

long long i,j,k,n,tab[100010];
int cei(int x)
{
	float f=(float)x/2;
	int e=x/2;
	if (e==f)
	 return e;
	return e+1;
}

int main()
{
	
	cin>>n;
	for (i=1;i<=n;i++)
	 cin>>tab[i];
	long long ans=0;
	for (i=1;i<=n;i++)
	{
		if (tab[i]!=i) continue;
		int hitung=0;
		while (tab[i]==i && i<=n)
		{
			hitung++;
			i++;
		}
		ans+=cei(hitung);
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define N 1010
#define M 10010
#define inf 1000000000000LL
#define LL long long 
using namespace std;
int d[N],q[N],cur[N],a[N],to[M],nxt[M],n,S,T,cnt=1;
LL w[M],x[N],ans,sum;
void addedge(int u,int v,LL W){
    w[++cnt]=W;to[cnt]=v;nxt[cnt]=a[u];a[u]=cnt;
}
bool bfs(){
    memset(d,-1,sizeof(d));
    memcpy(cur,a,sizeof(a));
    d[S]=0;
    int h=0,t=0;
    q[t++]=S;
    while (h!=t){
        int u=q[h++];h%=N;
        for (int i=a[u];i;i=nxt[i]) {
            int v=to[i];
            if (d[v]!=-1||w[i]<=0) continue;
            d[v]=d[u]+1;
            q[t++]=v;t%=N;
        }
    }
    return d[T]!=-1;
}
LL dfs(int u, LL f){
    if (u==T||f==0) return f;
    LL ret=0LL;
    for (int &i=cur[u];i;i=nxt[i]) if (w[i]>0&&d[to[i]]==d[u]+1) {
        int v=to[i];
        LL tmp=dfs(v,min(f-ret,w[i]));
        w[i]-=tmp;w[i^1]+=tmp;
        ret+=tmp;
        if (f==ret) return ret;
    }
    return ret;
}
int main(){
    scanf("%d",&n);
    S=0,T=n+1;LL sum1=0LL;
    for (int i=1;i<=n;i++) {
        scanf("%lld",&x[i]);
        if (x[i]<0) {
              addedge(S,i,-x[i]);
              addedge(i,S,0);
              sum-=x[i];
        }
        else if (x[i]>0) {
            addedge(i,T,x[i]);
            addedge(T,i,0);
        }
        for (int j=i*2;j<=n;j+=i) {
            addedge(i,j,inf);
            addedge(j,i,0);
        }
        sum1+=x[i];
    }
    while (bfs()) ans+=dfs(S,inf);
    printf("%lld\n",sum1+sum-ans);
}

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

int main()
{
  ll h,n,s=0;
  cin>>h>>n;
  vector<ll>a(n);
  for(ll i=0;i<n;i++) cin>>a[i];
  for(ll i=0;i<n;i++)
    s+=a[i];
  ll res=ceil(1.0*h/s);
  //cout<<s;
  if(res<=1)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define FOR(i, s, n) for(int i=(int)(s); i<(int)(n); ++i)
#define ALL(n) (n).begin(), (n).end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;

const ll MAX_V = 100000;
const ll INF = 1e9;
const ll MOD = 998244353;

int main(){
    ll n; cin >> n;
    if (n % 2 == 0) cout << n << endl;
    else cout << (2*n) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#define MAXSIZE 10000
#define PI 3.141592653589
using namespace std;
int main(){
  while(1){
    int H,W;
    std::cin >> H>>W;
    if(0==H&&0==W){
      return 0;
    }
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        std::cout << "#" ;
      }
      std::cout  << '\n';
    }
    std::cout  << '\n';
  }

}

Measured memory_bytes: 3100
#include<stdio.h>
int main()
{
    int w[1000],h[1000],i;
    for(i=0;;i++)
    {
        scanf("%d%d",&h[i],&w[i]);
        if(h[i]==0 && w[i]==0)
            break;
    }
    for(i=0;;i++)
    {
        int a,b;
        for(a=1;a<=h[i];a++)
        {
            if(a==1 || a==h[i])
                {
                    for(b=1;b<=w[i];b++)
                        {
                            printf("#");
                        }
                        printf("\n");
                }
            else
            {
                for(b=1;b<=w[i];b++)
                {
                if(b==1 || b==w[i])
                printf("#");
                else
                printf(".");
                }
                printf("\n");
            }
        }

        if(h[i]==0 && w[i]==0)
            break;
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

//?????????????????????
void ans(int *array){
	for(int i = 3; i >= 0; --i){
		int kai = array[i] / 10;
		int amari = array[i] % 10;
		array[i] = amari;
		array[i - 1] += kai;
	}

	string ans;
	if (array[0] != 0 && array[0] != 1) ans += to_string(array[0]) + 'm';
	else if (array[0] == 1) ans += 'm';
	if (array[1] != 0 && array[1] != 1) ans += to_string(array[1]) + 'c';
	else if (array[1] == 1) ans += 'c';
	if (array[2] != 0 && array[2] != 1) ans += to_string(array[2]) + 'x';
	else if (array[2] == 1) ans += 'x';
	if (array[3] != 0 && array[3] != 1) ans += to_string(array[3]) + 'i';
	else if (array[3] == 1) ans += 'i';

	cout << ans << endl;
	return;
}

//??????????????????????????°???array?????\??????????????¢??°
void slove(string s, int *array){
	int size = s.size();

	rep(i, size){
		if ('0' <= s[i] && s[i] <= '9'){
			if (s[i + 1] == 'm') array[0] += s[i] - '0';
			else if(s[i + 1] == 'c') array[1] += s[i] - '0';
			else if(s[i + 1] == 'x') array[2] += s[i] - '0';
			else if(s[i + 1] == 'i') array[3] += s[i] - '0';
			i++;
		}else{
			if (s[i] == 'm') array[0]++;
			else if(s[i] == 'c') array[1]++;
			else if(s[i] == 'x') array[2]++;
			else if(s[i] == 'i') array[3]++;
		}
	}
}

int main(void){
	int array[5];
	int n; cin >> n;
	rep(i, n){
		string s1, s2;
		cin >> s1 >> s2;
		slove(s1, array);
		slove(s2, array);
		ans(array);
		rep(j, 5) array[j] = 0;
	}

	return 0;
}

Measured memory_bytes: 3220
import java.util.*;
public class Main{
	
	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
        int c = s.nextInt();
        int d = s.nextInt();
        int flag = 0;
        while(true) {
        	if(a <= 0 || c <= 0) {
        		break;
        	}else {
        		if(flag == 0) {
        			c -= b;
        			flag = 1;
        		}else {
        			a -= d;
        			flag = 0;
        		}
        	}
        }
        if(a > 0) {
        	System.out.println("Yes");
        }else {
        	System.out.println("No");
        }
	}
}

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

ll n,i,a[105];
double pro,sum;

int main()
{
	cin>>n;
  	for(i=0;i<n;i++)
      cin>>a[i];
    pro=1;
  	for(i=0;i<n;i++)
      pro=pro*a[i];
  	
  	for(i=0;i<n;i++)
      sum+=pro/a[i];
	printf("%0.6lf",pro/sum);  	
}

Measured memory_bytes: 256
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                while(true) {
                        Integer N = sc.nextInt();
                        Integer K = sc.nextInt();
                        if (N == 0 && K == 0) {
                                break;
                        }
                        Integer[] a = new Integer[N];

                        Long ans = Long.MIN_VALUE;
                        for (Integer i = 0; i < N; i++) {
                                a[i] = sc.nextInt();
                                if (i != 0) {
                                        a[i] += a[i-1];
                                }
                                if (i >= K) {
                                        ans = Math.max(a[i] - a[i - K], ans);
                                }
                        }
                        System.out.println(ans);
                }
        }
}

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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;

signed main(){
    string s; cin >> s;
    int ans = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '1'){
            ans++;
        }
    }
    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N, a[100], b, A = 0, B = 0;
  
  scanf("%d", &N);
  for (int i = 0; i < N; i++){
    scanf("%d", &b);
    if(i == 0){
      a[0] = b;
    } else {
      for (int j = i - 1; j >= 0; j--){
        if(b > a[j]){
          a[j + 1] = a[j];
          if(j == 0){
            a[j] = b;
          }
        } else {
          a[j + 1] = b;
          break;
        }
      }
    }
  }
  
  for (int i = 0; i < N; i++){
    if(i%2 == 0){
      A += a[i];
    } else {
      B += a[i];
    }
  }
  
  printf("%d\n", A - B);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    for (int k = 1; k <= m; ++k) {
        for (int x = 0; x < n-1; ++x) {
            if(v[x]%k > v[x+1]%k) swap(v[x], v[x+1]);
        }
    }
    for (auto &&i : v) {
        printf("%d\n", i);
    }
    return 0;
}



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

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

    ll ans = b / x - a / x;
    if (a % x == 0) ans++;

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


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 

int main() {
   int N;
   cin >> N;
   vector<int> vec(N);
   for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
   }

   sort(vec.begin(), vec.end());
   int Counter = 0;
   for (int i = 0; i < N-1; i++) {
      if (vec[i] < vec[i+1]) {
         Counter += 1;
      }  
   }

   cout << Counter+1 << endl;
}

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

using namespace std;
#ifdef ONLINE_JUDGE
#define cerr if(false)cerr
#endif
#define int long long
#define ld1 long double
#define watch(x) cerr << (#x) << " is " << (x) << endl
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL),cout<<setprecision(14);
#define cint int t;cin>>t;while(t--)
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define N 50011
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
#define MAXN (int)1e6 + 11
#define INF (int)1e9
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define endl '\n'

const int mod=1000000007;
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];

    map<int,int> mp;
    for(int i=0;i<n;i++){
        mp[i-a[i]]++;
    }
    int ans=0;
    for(int i=0;i<n;i++){
        ans+=mp[i+a[i]];
        mp[i-a[i]]--;
    }
    cout<<ans<<endl;
}

int32_t main() {
    faster;

#ifndef ONLINE_JUDGE
    READ("inp.txt");
    WRITE("out.txt");
    double beg=clock();
#endif

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

    while(t--){
        solve();
    }

#ifndef ONLINE_JUDGE
    double end=clock();
    cerr<<"*** Total time = "<<(end-beg)/CLOCKS_PER_SEC;
#endif
}


Measured memory_bytes: 27960
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int a,b,x;
  cin >> a>>b>>x;
  
  cout << (a<=x && x<=a+b?"YES":"NO" ) << endl;

  
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main(string[] _)
    {
        _ = Console.ReadLine().Split(' ');
        int n = int.Parse(_[0]);
        int m = int.Parse(_[1]);
        Int64[] x = new Int64[n];
        Int64[] y = new Int64[m];

        _ = Console.ReadLine().Split(' ');
        for (int i = 0; i < n; i++)
        {
            x[i] = Int64.Parse(_[i]);
        }
        _ = Console.ReadLine().Split(' ');
        for (int i = 0; i < m; i++)
        {
            y[i] = Int64.Parse(_[i]);
        }
        Int64 xx = 0;
        for (int i = 1; i <= n; i++)
        {
            xx += ((i - 1) * x[i - 1] - (n - i) * x[i - 1]);
        }
        Int64 yy = 0;
        for (int i = 1; i <= m; i++)
        {
            yy += ((i - 1) * y[i - 1] - (m - i) * y[i - 1]);
        }

        Console.WriteLine(((xx % 1000000007) * (yy % 1000000007)) % 1000000007);
    }
}


Measured memory_bytes: 37584
#include <iostream>
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
using namespace std;

int t;
int main() {
	cin >> t;
	if(t >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
    return 0;
}


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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    i64 N,M;
    cin >> N >> M;

    if(N==1 and M==1){
        cout << 1 << endl;
        return;
    }
    if(N==1){
        cout << M-2 << endl;
        return;
    }
    if(M==1){
        cout << N-2 << endl;
        return;
    }
    cout << (N-2)*(M-2) << endl;
}

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


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

public class Main {
    public static void main(String args[]) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int n = in.nextInt();
        int res = Integer.MAX_VALUE;

        for (int i = 1; i < n; i++) {
            res = Math.min(res, f(i) + f(n - i));
        }

        out.println(res);
        out.close();
    }

    private static int f(int i) {
        int res = 0;

        while (i > 0) {
            res += i % 10;
            i /= 10;
        }

        return res;
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f), 32768);
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}


Measured memory_bytes: 21076
# coding: utf-8
# Your code here!
a,b,c = map(int, input().split())
a1=a+b
a2=a+c
a3=b+c
if(a1<=a2 and a1<=a3):
    print(a1)
elif(a2<=a1 and a2<=a3):
    print(a2)
else:
    print(a3)


Measured memory_bytes: 2940
N = int(input())
A = list(map(int,input().split()))
#state0は未定、1は広義単調増加、2は広義単調減少
state = 0
m = A[0]
ans = 1

for i in range(1,N):
    if m < A[i]:
        if state == 0:
            state = 1
        elif state == 2:
            ans += 1
            state = 0
    elif m > A[i]:
        if state == 0:
            state = 2
        elif state == 1:
            ans += 1
            state = 0
    m = A[i]

print(ans)


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

int main(){
  char ch;
  int count[26] = {0};
  int i;

  while(cin >> ch){
    count[tolower(ch) - 'a']++;
  }
  for(i = 0; i < 26; i++){
    cout << (char)(i + 'a') << " : " << count[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
#define y1 __zzd001
using namespace std;
typedef long long LL;
LL read(){
	LL x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
const int N=605;
int n,m;
int a[N][N],R[N][N],C[N][N];
char g[N][N];
int main(){
	n=read(),m=read();
	for (int i=1;i<=n;i++){
		scanf("%s",g[i]+1);
		for (int j=1;j<=m;j++)
			if (g[i][j]=='#')
				a[i+j][i-j+300]=1;
	}
	int n=600;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++){
			R[i][j]=R[i][j-1]+a[i][j];
			C[i][j]=C[i-1][j]+a[i][j];
		}
	LL ans=0;
	for (int x=1;x<=n;x++)
		for (int y1=1,t;y1<=n;y1++)
			if (a[x][y1])
				for (int y2=y1+1;y2<=n;y2++){
					if (!a[x][y2])
						continue;
					t=y2-y1;
					if (x>t)
						ans+=R[x-t][y2]-R[x-t][y1-1];
					if (x+t<=n)
						ans+=R[x+t][y2]-R[x+t][y1-1];
				}
	for (int x=1;x<=n;x++)
		for (int y1=1,t;y1<=n;y1++)
			if (a[y1][x])
				for (int y2=y1+1;y2<=n;y2++){
					if (!a[y2][x])
						continue;
					t=y2-y1;
					if (x>t)
						ans+=C[y2-1][x-t]-C[y1][x-t];
					if (x+t<=n)
						ans+=C[y2-1][x+t]-C[y1][x+t];
				}
	cout << ans;
	return 0;
}

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



int main(){
  int n;
  int i,k;
  long long sum;
  string a;
  cin >> n;
  map<string,int>mp;
  for(i=0;i<n;i++){
    cin >> a;
    sort(a.begin(),a.end());
    mp[a]++;
  }

  sum=0;

  for(auto& p : mp){
    k = p.second;
    sum += (long long)k*(k-1)/2;
  }

  cout << sum << endl;




  return 0;

}


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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

//DONT WASTE YOUR TIME
//prove yourself
//remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

const ll N= 1e6+55,mod = 1e9+7;

ll a[N];

int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	ll i,j,k,n,x,y,z;
	sc(n);
	for(i=0;i<n;i++)sc(a[i]);
	x=a[0];
	for(i=1;i<n;i++){
		x=__gcd(a[i],x);
	}
	if(x>0 && (x%2==0)){
		x=log2(x);
		pr(x);
	}
	else{
		printf("0\n");
	}


}

Measured memory_bytes: 256