akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    for(auto itr = a.begin(); itr != a.end(); itr++){
		cout << *itr << " ";
	}
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){
	cout << "debug: " << a << " " << b << "\n";
}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << "debug: " << a << " " << b << " " << c << "\n";
}
void mark() {cout << "#" << "\n";}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll t; cin >> t;
    while(t--){
        ll n,m,a,b; cin >> n >> m >> a >> b;
        cout << floor_sum(n,m,a,b) << "\n";
    }
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    ll N;
    cin >> N;
    vll a(N);
    rep(i, N){
        cin >> a[i];
    }
    ll s = 0;
    rep(i, N){
        s ^= a[i];
    }
    if(s==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

int gcd(int c, int d) { return (d ? gcd(d, c%d) : c); }
ll lcm(int c, int d) { return ll(c) / gcd(c, d) * d; }

ll f(ll x, int c, int d) {
    ll ans = x;
    ans -= x / c;
    ans -= x / d;
    ans += x / lcm(c, d);
    return ans;
}

int main(){
    ll a, b;
    int c, d;
    cin >> a >> b >> c >> d;
    ll ans = f(b, c, d) - f(a-1, c, d);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int n;
  cin>>n;

  vector<ll>p(n);
  rep(i,n){
    cin>>p[i];
  }

  ll ans=0;

  rep(i,n){
    rep(j,n){
      rep(k,n){
        if(i<=j) continue;
        if(j<=k) continue;
        ll a=p[i],b=p[j],c=p[k];
        if(a==b||b==c||c==a) continue;
        if(a+b>c && b+c>a && c+a>b) {
          ans++;
        }
      }
    }
  }

  cout << ans << endl;

}

Measured memory_bytes: 3660
N = gets.to_i
as = gets.split.map(&:to_i)
ans = 0
repeat_count = 0
prev = -1
as.each do |a|
  if prev == a
    repeat_count += 1
  else
    ans += (repeat_count + 1) / 2
    repeat_count = 0
    prev = a
  end
end
ans += (repeat_count + 1) / 2
puts ans


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

vector<int> my_f(int n){
  vector<int> a(5);
  for(int i = 4; i >= 0; i--){
    a.at(i) = n%10;
    n /= 10;
  }
  return a;
}

int main(){
  int A, B;
  cin >> A >> B;
  int count = 0;
  for (int i = A; i <= B; i++){
    vector<int> p(5);
    p = my_f(i);
    if(p.at(0) == p.at(4) && p.at(1) == p.at(3))
      count++;
  }
  
  cout << count << endl;
  return 0;
}



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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

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


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

    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;

    vector<ll> reds (a), greens(b), colorless(c);
    for (int i = 0; i < a; ++i) cin >> reds[i];
    for (int i = 0; i < b; ++i) cin >> greens[i];
    for (int i = 0; i < c; ++i) cin >> colorless[i];

    ll ans = 0;
    sort(reds.begin(), reds.end(), greater<ll>());
    sort(greens.begin(), greens.end(), greater<ll>());
    sort(colorless.begin(), colorless.end());

    vector<ll> ar(reds.begin(), reds.begin() + x);
    vector<ll> ag(greens.begin(), greens.begin() + y);

    int r = x - 1, g = y - 1;
    --c;

    while (c >= 0 && (r >= 0 || g >= 0)) {
        int v = colorless[c];
       
        ll aa = r >= 0 ? ar[r] : 1e10;
        ll bb = g >= 0 ? ag[g] : 1e10;
        
        if (min(aa, bb) > v) break;

        if (aa < bb) ar[r--] = v;
        else ag[g--] = v;

        c--;
    }


    cout << accumulate(ar.begin(), ar.end(), 0LL) + accumulate(ag.begin(), ag.end(), 0LL) << endl;

    return 0;
}



Measured memory_bytes: 4096
#include <stdio.h>
#include <math.h>

int main(void)
{
    long long a, v, b, w, t;

    scanf("%lld %lld %lld %lld %lld", &a, &v, &b, &w, &t);

    v *= t;
    w *= t;

    if(v >= w + abs(a-b))
        printf("YES");
    else
        printf("NO");

    return 0;
}


Measured memory_bytes: 1732
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cout << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cout << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x,n) rep(__i,n) pri(x,__i);
#define prar(x,b,e) repr(__i,b,e) pri(x,__i);

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

ll MOD = 1000000007;

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	int N = in();
	vector<ll> data(N);
	ll sum = 0;
	rep(i,N) {
		data[i] = in();
		sum += data[i];
	}
	
	ll psum = 0;
	ll ans = (ll)INF * 114514;
	rep(i,N-1) {
		psum += data[i];
		// pr(psum);
		ans = min(ans, abs(sum - psum - psum));
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
int main(){
	fast;
	ll k,cur=0; cin>>k;
	for(auto i=1;i<=k;++i){
		cur=(cur*10+7)%k;
		if(cur==0){
			cout<<i<<'\n';
			return 0;
		}
	}
	cout<<-1<<'\n';
	return 0;
}
//prime func
//subset production
//factorization
 
//dfs/bfs
//prim's/kruskal's
//dijikstra/warshall-floyd
//tree traversal
//DP - Recursion

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define pb push_back
#define eb emplace_back
#define sll set<ll>
#define ins insert
#define rep(i,n) for(int i=0;i<n;i++)
#define vpp vector<pair<int,int>>
#define mp make_pair
#define ft first
#define sc second
#define gp " ";
#define MAX 9999999
#define MOD 1000000007
#define mnn(v2) *min_element(v2.begin(),v2.end());
#define mxx(v2) *max_element(v2.begin(),v2.end());
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t,i,j,n,c=0,d=0;
    string s,a,b,k;
    cin>>s;
    if(s[3]==s[2] && s[5]==s[4])c=1;
   if(c==1)cout<<"Yes";
          else cout<<"No";
}


Measured memory_bytes: 3640
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(b%2==0)
    {
       if(a>=13)
       {
           cout<<b;
       }
       else if(a>=6&&a<=12)
       {
           cout<<b/2;
       }
       else
       {
           cout<<0;
       }
    }






    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
using namespace std;
typedef long long ll;
ll a[200005],b[200005];
int main(void)
{
 ll n;
 scanf("%lld",&n);
 for(ll i=0;i<=n;i++)
 {
  scanf("%lld",&a[i]);
  b[i]=1e18;
 }
 bool ok=true;
 b[0]=1;
 for(ll i=0;i<n;i++)
 {
  b[i+1]=(b[i]-a[i])*2;
  if(b[i]<0)
  {
   printf("-1");
   return 0;
  }
  if(b[i]>=1e18) break;
 }
 ll ans=a[n],now=a[n];
 if(a[n]>b[n])
 {
  printf("-1");
  return 0;
 }
 for(ll i=n-1;i>=0;i--)
 {
  now=min(b[i]-a[i],now)+a[i];
  ans+=now;
 }
 printf("%lld\n",ans);
}

Measured memory_bytes: 5392
#include <stdio.h>

int main(void) {

  int n;
  scanf("%d", &n);
  char s[n+1];
  scanf("%s", s);
  int first[10],second[10],third[10];
  for (int i = 0; i < 10; i++) {
    first[i] = 0;
  }
  long count = 0;
  for (int i = 0; i < n-2; i++) {
    if (first[s[i]-'0'] == 1) {
      continue;
    }
    first[s[i]-'0'] = 1;
    for (int j = 0; j < 10; j++) {
      second[j] = 0;
    }
    for (int j = i+1; j < n-1; j++) {
      if (second[s[j]-'0'] == 1) {
        continue;
      }
      second[s[j]-'0'] = 1;
      for (int k = 0; k < 10; k++) {
        third[k] = 0;
      }
      for (int k = j+1; k < n; k++) {
        third[s[k]-'0'] = 1;
      }
      for (int k = 0; k < 10; k++) {
        count += third[k];
      }
    }
  }
  printf("%ld\n", count);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

struct info{
    int mi, ma;
    info(){
        mi = 0;
        ma = 0;
    }
};

signed main(){
    
    while(1){

    int n, m; cin >> n >> m;
    if(!n) break;
    vector<info> p(n);
    
    for(int i = 0; i < m; i++){
        int s, k; cin >> s >> k;
        if(k == 1){
            int id; cin >> id;
            id--;
            p[id].mi += s;
            p[id].ma += s;
        }else{
            for(int j = 0; j < k; j++){
                int id; cin >> id;
                id--;
                p[id].ma += s;
            }
        }
    }

    int ans = 0;
    

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j) continue;
            ans = max(ans, p[j].ma - p[i].mi + 1);
       }
    }

    cout << ans << endl;

    }
    return 0;
}




Measured memory_bytes: 3252
s=lambda t,i:0--t//3**i
for _ in range(int(input())):
  a,b,c,d=map(int,input().split());mx=max([i for i in range(30) if s(a,i)==s(c,i)and s(a,i)%3==2and abs(s(b,i)-s(d,i))>=2]+[-1])+1;my=max([i for i in range(30) if s(b,i)==s(d,i)and s(b,i)%3==2and abs(s(a,i)-s(c,i))>=2]+[-1])+1
  if mx==my==0:print(abs(b-d)+abs(a-c));continue
  if mx<my:mx,a,b,c,d=my,b,a,d,c
  mi=3**(mx-1);ma=2*mi+1;ac=(3*mi)*((0--a//(3*mi))-1);a-=ac;c-=ac;print(abs(b-d)+min(abs(mi-a)+abs(mi-c),abs(ma-a)+abs(ma-c)))

Measured memory_bytes: 3316
import itertools

n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

c = list(itertools.combinations(range(n), 2))
ans = 0
for a, b in c:
    dist = 0
    for j in range(d):
        dist += (x[a][j]-x[b][j])**2
    if dist**(1/2) % 1 == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9208
#include <cstdio>
#include <iostream>
#include <cstdlib>

using namespace std;

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

    int minAbs = 99999;
    int minVal = 0;
    int sum = 0;
    for(int i = 0; i < n; i++){
        int value = l+i;
        if(abs(value) < minAbs){
            minAbs = abs(value);
            minVal = value;
        }
        sum += value;
    }

    printf("%d\n", sum - minVal);

    return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

alias graph = Graph!(int, int);

void main()
{
  auto rd = readln.split.to!(int[]), h = rd[0], w = rd[1];

  auto g = new int[][](10, 10);
  foreach (i; 0..10) g[i] = readln.split.to!(int[]);

  auto d = graph.floydWarshal(g);

  auto ans = 0;
  foreach (i; 0..h) {
    auto rd2 = readln.splitter;
    foreach (j; 0..w) {
      auto a = rd2.front.to!int;
      rd2.popFront();
      if (a >= 0) ans += d[a][1];
    }
  }

  writeln(ans);
}

template Graph(Wt, Node, Wt _inf = 10 ^^ 9, Node _sent = Node.max)
{
  import std.algorithm, std.array, std.conv;

  const inf = _inf, sent = _sent;

  Wt[][] floydWarshal(Wt[][] g)
  {
    Wt[][] dist;
    Node[][] inter;
    floydWarshal(g, dist, inter);
    return dist;
  }

  void floydWarshal(Wt[][] g, out Wt[][] dist, out Node[][] inter)
  {
    auto n = g.length;
    dist = g.map!(i => i.dup).array;

    inter = new Node[][](n, n);
    foreach (i; 0..n) inter[i][] = sent;

    foreach (k; 0..n)
      foreach (i; 0..n)
        foreach (j; 0..n)
          if (dist[i][j] > dist[i][k] + dist[k][j]) {
            dist[i][j] = dist[i][k] + dist[k][j];
            inter[i][j] = k.to!Node;
          }
  }
}


Measured memory_bytes: 508
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
// #define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    ll n;
    cin>>n;
    if(n==1){
        cout<<"Hello World"<<endl;
    }
    else{
        ll a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }

    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}


signed main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a * b, c * d) << endl;
}


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

typedef long long int ll;
#define rep(i,n) for(int i;i<n;i++)

int main(){

    bool a=false,b=false,c=false,d=false;

    int t;

    rep(i,4){
        cin >> t;
        if(t==1){
            a=true;
        }
        if(t==7){
            b=true;
        }
        if(t==9){
            c=true;
        }
        if(t==4){
            d=true;
        }
    }

    if(a&&b&&c&&d){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
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 (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
const int N=100000;
//const ll M = 1000000000+7;

ll cnt = 0; 

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

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


  bool table[N+1];
  for(ll cnt=2;cnt<=N;cnt++){
    if(!table[cnt]){
      for(int i=2;i<=N/cnt;i++){
      	table[cnt*i] = true;
      }
    }
  }
  table[0] = true;
  table[1] = true;
  
  ll ac[N+1];
  ac[0] = 0;
  for(int i=1;i<=N;i++){
    if(!table[i]&&!table[(i+1)/2]) ac[i] = ac[i-1]+1;
    else ac[i] = ac[i-1];
  }

  //rep(i,54) cout << i<<" " <<table[i]<<endl;
  ll l,r;
  rep(i,n){
    cin >> l >> r;
    cout <<ac[r] -ac[l-1] <<endl;
  }
  
}


Measured memory_bytes: 1536
package main

import (
  "fmt"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}

func main() {
  var n, a, b int
  fmt.Scan(&n, &a, &b)
  fmt.Println(minInt(a*n, b))
}

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

void solve(long long A, long double B)
{
    cout << fixed << std::setprecision(0) << floor(A * B) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long A;
    scanf("%lld", &A);
    long double B;
    scanf("%Lf", &B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 3828
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int[] hs = new int[n + 2];
        hs[0] = hs[n + 1] = 0;
        for (int i = 1; i <= n; i++) {
            hs[i] = sc.nextInt();
        }

        boolean f = true;
        int ans = 0;
        while (f) {
            f = false;
            for (int i = 0; i <= n; i++) {
                if (hs[i] == 0) {
                    if (hs[i + 1] > 0) {
                        ans++;
                    }
                    continue;
                } 
                
                hs[i]--;
                f = true;
            }
        }
        System.out.println(ans);
    }
}


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

int main(){
	int n,n2,cnt=0,ans=0;
	string s;
	cin >> s;
	n=s.size();
	n2=s.size();
	for(int i=0;i<s.size();i++){
		if(s[i]=='p') cnt++;
	}
	if(cnt>0&&(n+1)/2>cnt){
		n-=cnt;
	}
	else ans-=cnt;
	
	if(n>(n2+1)/2){
		ans+=n-((n2+1)/2);
	}
	cout << ans << endl;
	
	
	return 0;
}

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

a=1
b=N//a
dis=abs(b-a)

for i in range(1,int(N**0.5)+1):
    if N%i==0:
        _a=i
        _b=N//i
        _dis=abs(_b-_a)
        if _dis<dis:
            a=_a
            b=_b
            dis=_dis

print(a-1+b-1)

Measured memory_bytes: 9472
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer[] n = new Integer[5];
		for (int i = 0; i < 5; i++) {
			n[i] = scanner.nextInt();
		}
		Arrays.sort(n, Collections.reverseOrder());
		System.out.printf("%d %d %d %d %d\n", n[0], n[1], n[2], n[3], n[4]);
	}
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll s;
  cin >> s;
  vll x(3,0), y(3,0);
  x[1] = 1e9;
  y[1] = 1;
  x[2] = (x[1]-s%x[1])%x[1];
  y[2] = (s+x[2])/x[1];

  REP(i, 3)
    cout << x[i] << " " << y[i] << " ";
  cout << endl;
}



Measured memory_bytes: 256
X = int(input())
t = 1
max_t = (t* (t+1)) // 2

# t=1で1 t=2で 2,3 t= 3で 4, 5, 6  t=4で 7,8,9,10  t=5で 11,12,13,14,15までいける

while max_t < X:
    
    t += 1 
    max_t = (t* (t+1)) // 2
    
print(t)

Measured memory_bytes: 2940
# n, m, k = map(int, input().split())
# t = []
# for i in range(n):
#     t.append([1] * n)
# for i in range(m + k):
#     a, b = map(int, input().split())
#     t[a - 1][b - 1] = 0
#     t[b - 1][a - 1] = 0
# for i in range(n):
#     for j in range(n):
#         if (i == j):
#             t[i][j] = 0
# ans = ''
# for i in range(n):
#     if (i == n - 1):
#         ans += str(sum(t[i]))
#     else:
#         ans += str(sum(t[i])) + ' '
# print(ans)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n, m, k = map(int, input().split())
friends = {}
blocks = {}
for i in range(n):
    friends[i] = 0
    blocks[i] = 0
uf_friends = UnionFind(n)
for i in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    friends[x] += 1
    friends[y] += 1
    uf_friends.union(x, y)

for i in range(k):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    if (uf_friends.same(x, y)):
        blocks[x] += 1
        blocks[y] += 1

ans = []
for i in range(n):
    ans.append(str(uf_friends.size(i) - friends[i] - blocks[i] - 1))

print(' '.join(ans))


Measured memory_bytes: 116060
N,M = map(int,input().split())

#AC,WA
P = [0]*N
Penalty = 0
Accepted = 0

for i in range(M) :
    p,S = input().split()
    p = int(p)
    
    if S == "AC" and P[p-1] != -1:
        Penalty += P[p-1]
        Accepted += 1
        P[p-1] = -1
    elif S == "WA" and P[p-1] != -1:
        P[p-1] += 1

print(Accepted,Penalty)

Measured memory_bytes: 9660
N, M= map(int, input().split())
L1, R1= map(int, input().split())

for x in range(M-1):
    L, R = map(int, input().split())
    if L > L1:
        L1 = int(L)
    if R < R1:
        R1 = int(R)

if R1 == L1:
    print("1")
if L1 > R1:
    print("0")
if L1 < R1: 
	print(R1-L1+1)

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

int main(){
  int dp[101][10001]={0},n,m,v[101],w[101];
  cin>>n>>m;
  for(int i=1;i<=n;i++){
    cin>>v[i]>>w[i];
  }
  for(int i=1;i<=n;i++){
    for(int j=0;j<=m;j++){
      if(j-w[i]>=0)dp[i][j]=max(dp[i-1][j],dp[i][j-w[i]]+v[i]);
      else dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][m]<<endl;
  return 0;
}

Measured memory_bytes: 7048
#include <stdio.h>

int main(void)
{
  int n;
  scanf("%d", &n);
  int b[n - 1];
  for (int i = 0; i < n - 1; i++){
    scanf("%d", &b[i]);
  }
  
  long sum = 0;
  sum += b[0];
  for (int j = 1; j < n - 1; j++){
    sum += b[j - 1] < b[j] ? b[j - 1] : b[j];
  }
  sum += b[n - 2];
  
  printf("%ld\n", sum);
  return 0;
}

Measured memory_bytes: 128
// Problem : B - String Palindrome
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()
using namespace std;
using namespace __gnu_pbds;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
template<class T>
T abst(T a)
{return a<0?-a:a;}
template<class T> using ordered_set=tree<
T,
null_type,
less_equal<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
bool ispalin(string s){
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-1-i])
		return false;
	}
	return true;
}
void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string s;cin>>s;
string s1,s2;
int n=s.size();
for(int i=0;i<(n-1)/2;i++)
s1+=s[i];
for(int i=(n+3)/2-1;i<n;i++)
s2+=s[i];
if(ispalin(s) and ispalin(s1) and ispalin(s2))
cout<<"Yes";
else
cout<<"No";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            if(N == 1)
            {
                Console.WriteLine(1);
            }
            else if(N % 2 == 0)
            {
                Console.WriteLine(0.5);
            }
            else
            {
                Console.WriteLine((N / 2 + 1.0) / N);
            }




        }
    }
}

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

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

    int n,k,s;cin>>n>>k>>s;

    int ans=(s==1e9?1:s+1);

    for(int i=0;i<n;i++)
    {
        if(i<k)cout<<s<<" ";
        else cout<<ans<<" ";
    }

    cout<<"\n";

    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>

using namespace std;

int main() {
    int n;
    long long k;
    cin >> n >> k;
    set<int> s;
    unordered_map<int,long long> m;
    int a, b;
    for (int i = 0; i < n; ++i){
        cin >> a >> b;
        s.insert(a);
        m[a] += b;
    }
    for (auto i : s){
        k -= m[i];
        if (k <= 0){
            cout << i << endl;
            break;
        }
    }
}

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

using namespace std;

int main()
{
	long long q, h, s, d, n, am;
	cin >> q >> h >> s >> d >> n;
	n *= 4;
	long long ans = 0;
	if (d < 2 * s && d < 4 * h && d < 8 * q) {
		am = n / 8;
		ans += d * am;
		n -= am * 8;
		cerr << "d = " << am << "\n";
	}
	if (s < 2 * h && s < 4 * q) {
		am= n / 4;
		ans += am * s;
		n -= am * 4;
		cerr << "s = " << am << "\n";
	}
	if (h < 2 * q) {
		am = n / 2;
		ans += am * h;
		n -= am * 2;
		cerr << "h = " << am << "\n";
	}
	cerr << "q = " << n << "\n";
	ans += n * q;
	cout << ans << "\n";

	return 0;
}

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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int h, w;
    while (true){
        cin >> h >> w;
        if(h == 0 && w == 0){
            break;
        }
        for (int i = 0; i < h; i++){
            for (int e = 0; e < w; e++){
                if (i%2==0){
                    if (e%2 == 0){
                        cout << "#";
                    }else{
                        cout << ".";
                    }
                }else{
                    if (e%2 == 0){
                        cout << ".";
                    }else{
                        cout << "#";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3128
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int calcDist(int x,int y){
	return x*x + y*y;
}

void func(){

	int ans_x = 0,ans_y = 0,tmp_x=0,tmp_y=0,dx,dy,maximum = 0,maximum_x,tmp_dist;

	while(true){
		scanf("%d %d",&dx,&dy);
		if(dx == 0 && dy == 0)break;

		tmp_x += dx;
		tmp_y += dy;

		tmp_dist = calcDist(tmp_x,tmp_y);
		if(tmp_dist > maximum){
			maximum = tmp_dist;
			maximum_x = tmp_x;
			ans_x = tmp_x;
			ans_y = tmp_y;

		}else if(tmp_dist == maximum && maximum_x < tmp_x){
			maximum_x = tmp_x;
			ans_x = tmp_x;
			ans_y = tmp_y;
		}
	}

	printf("%d %d\n",ans_x,ans_y);
}

int main(){

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

	for(int i = 0; i < N; i++)func();

	return 0;
}

Measured memory_bytes: 2624
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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 COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[n-k] % MOD;
}

ll HCOM(int n, int k){
  return COM(n+k-1,k);
}


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  init();
  
  ll n,m;
  cin>>n>>m;
  
  ll ans=0;
  for(int i=0;i<=n;i++){
    ll res=COM(n,i)*PER(m,i)%MOD*PER(m-i,n-i)%MOD*PER(m-i,n-i)%MOD;
    if(i%2==0) ans=(ans+res)%MOD;
    else ans=(ans-res+MOD)%MOD;
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 15592
import numpy as np

n, k = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.zeros(n)
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, n):
    ik = max(0, i-k)
    dp[i] = np.min(dp[ik:i]+np.abs(h[i]-h[ik:i]))

print(int(dp[n-1]))


Measured memory_bytes: 22924
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b >> c >> d;
  ans = a * c;
  ans = max(ans, a * d);
  ans = max(ans, b * c);
  ans = max(ans, b * d);
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
using namespace std;
int lll(long long int a,long long int b) {
	long long int x, tmp,r,A,B;
	A = a;
	B = b;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	x = b;
	//printf("%lld\n", &x);
	return x;
}
int main(void)
{
	long long int A, B, C, D;

	scanf("%lld%lld%lld%lld", &A, &B, &C, &D);
	long long int S;
	S=C*D/lll(C, D);
	
	
	//printf("%lld\n", S);
	long long int a, b, c;
	a = B / C - (A-1) / C;

	b = B / D - (A-1) / D;

	c = B / S - (A-1) / S;


	printf("%lld",(B - A + 1) - a - b + c);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		if(n>36) cout<<0<<endl;
		else
		{
			int ans=0;
			for(int i=0;i<=9;i++)
			for(int j=0;j<=9;j++)
			for(int k=0;k<=9;k++)
			for(int l=0;l<=9;l++)
			if(i+j+k+l==n) ans++;
			cout<<ans<<endl;
		}
	}
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

ll dp[105][2][4];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    int K;
    cin >> s >> K;
    int n = sz(s);
    dp[0][0][0] = 1;
    rep(i, n) {
        rep(j, 2) {
            rep(k, 4) {
                for (int l = 0; l <= (j == 1 ? 9 : (s[i]-'0')); ++l) {
                    if (k + (l != 0) >= 4) continue;
                    dp[i+1][j || (l < (s[i]-'0'))][k + (l != 0)] += dp[i][j][k]; 
                }
            }
        }
    }
    cout << dp[n][0][K] + dp[n][1][K] << endl;
}

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

int main()
{
	char moji;
	for(;;){
		scanf("%c",&moji);
		if(isupper(moji))
			cout<<(char)towlower(moji);
		else if(islower(moji))
			cout<<(char)toupper(moji);
		else{
			if(moji=='\n'){
			cout<<endl;
			break;
			}
			cout<<moji;
		}
	}
	return 0;
}

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

/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
#define endl '\n'

/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

void solve() {
	string s, t; cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < s.size(); i++)
		if (s[i] != t[i])
			ans++;
	cout << ans << endl;

	return ;
}

int32_t main() {

	/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);


	/* → → → → → → → → → → → → → → → → → → → → → → → → → → → →
	→ → → → → → → → → → → → → → → → → → → → → → → → → → → → */

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

	return 0;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, m{}; cin >> N;
  int A[N]; for (int &a: A) cin >> a;
  for (int i{}; i < N; ++i) for (int j{i + 1}; j < N; ++j) m = max(m, abs(A[i] - A[j]));
  cout << m;}

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

int main() {
    string s;
    int p = 700;
    cin >> s;
    if(s[0] == 'o') p += 100;
    if(s[1] == 'o') p += 100;
    if(s[2] == 'o') p += 100;

    cout << p << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please

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



	int N, K;
	cin >> N >> K;

	int x[50], y[50];
	vector<int> XZ, YZ;

	rep(i, N) {
		cin >> x[i] >> y[i];
		XZ.push_back(x[i]);
		YZ.push_back(y[i]);
	}

	vector<pair<int, ll>> kekka;
	for (int itrx : XZ) {
		for (int itry : YZ) {
			for (int itrx2 : XZ) {
				for (int itry2 : YZ) {
					int kosuu = 0;
					rep(i, N) if (itrx <= x[i] && x[i] <= itrx2 && itry <= y[i] && y[i] <= itry2) kosuu++;
					ll menseki = 1ll * (itrx2 - itrx) * (itry2 - itry);
					kekka.push_back(make_pair(kosuu, menseki));
				}
			}
		}
	}

	ll saishou = 4e18;
	for (pair<int, ll> itr : kekka) {
		if (itr.first >= K && saishou > itr.second) {
			saishou = itr.second;
		}
	}

	co(saishou);
	Would you please return 0;
}

Measured memory_bytes: 133340
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, a, sum = 0, ans = 0; cin >> n;
	int test[100001] = { 0 };
	for (int h = 0; h < n; h++) {
		cin >> a;
		test[h] = a;
	}
	for (int h = 1; h < n; h++) {
		if (test[h - 1] >= test[h]) {
			sum++;
		}
		else {
			sum = 0;
		}
		ans = max(ans, sum);
	}
	cout << ans << endl;
	cin >> n;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

ll mod = 1000000007;

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

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

  int x,n;
  cin >> x >> n;
  vi check(101);
  rep(i,n){
    int p;
    cin >> p;
    check[p] = 1;
  }

  int ret = 0;
  int mdf = 10000;

  rep(i,102){
    if(check[i]==1)continue;
    if(mdf > abs(x-i)){
      ret = i;
      mdf = abs(x-i);
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 3644