akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>

#define MAX 13

char mapI[MAX][MAX];
const static int N = 12;
int move[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

void dfs(int x, int y) {
    int nx, ny;
    mapI[x][y] = '0';
    for (int i = 0; i < 4; i++) {
        nx = x + move[i][0]; ny = y + move[i][1];
        if (0 <= nx && N > nx && 0 <= ny && N > ny && mapI[nx][ny] == '1') dfs(nx, ny);
    }
    return;
}


int main()
{
    while(scanf("%s",mapI[0])!=EOF){
        for(int i = 1; i < 12; i++)scanf("%s",mapI[i]);
        int sum = 0;
        for(int i = 0 ; i < 12; i++){
            for(int j = 0; j < 12 ;j++){
                if(mapI[i][j] =='1'){
                    sum++;
                    dfs(i,j);
                }
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}



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

#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;

#define MAX_N 25
#define NIL -1

struct Node {
  int parent, left, right;
};

Node T[MAX_N + 5];
int D[MAX_N + 5];
int H[MAX_N + 5];

void setDepth(int idx, int d) {
  D[idx] = d;
  if (T[idx].left != NIL) setDepth(T[idx].left, d + 1);
  if (T[idx].right != NIL) setDepth(T[idx].right, d + 1);
}

int setHeight(int i) {
  if (T[i].right == NIL && T[i].left == NIL) return 0;
  int h1 = 0, h2 = 0;
  if (T[i].left != NIL) {
    h1 = setHeight(T[i].left) + 1;
  }
  if (T[i].right != NIL) {
    h2 = setHeight(T[i].right) + 1;
  }
  return H[i] = max(h1, h2);
}

int findRoot(int n) {
  rep(i, n) {
    if (T[i].parent == NIL) return i;
  }
  return NIL;
}

string getNodeType(int i) {
  if (T[i].parent == NIL)
    return "root";
  else if (T[i].right == NIL && T[i].left == NIL)
    return "leaf";
  else
    return "internal node";
}

int main() {
  int n;
  cin >> n;
  rep(i, n) {
    T[i].parent = NIL;
    T[i].left = NIL;
    T[i].right = NIL;
    D[i] = 0;
    H[i] = 0;
  }
  rep(i, n) {
    int pid, left, right;
    // cin >> pid >> T[pid].left >> T[pid].right;
    cin >> pid >> left >> right;
    T[pid].left = left;
    T[pid].right = right;
    if (T[pid].left != NIL) T[T[pid].left].parent = pid;
    if (T[pid].right != NIL) T[T[pid].right].parent = pid;
  }
  int root_idx = findRoot(n);
  setDepth(root_idx, 0);
  setHeight(root_idx);

  rep(i, n) {
    int sibling;
    if (T[i].parent == NIL)
      sibling = NIL;
    else if (T[T[i].parent].right == i)
      sibling = T[T[i].parent].left;
    else if (T[T[i].parent].left == i)
      sibling = T[T[i].parent].right;
    else
      sibling = NIL;

    int degree;
    if (T[i].left != NIL && T[i].right != NIL)
      degree = 2;
    else if (T[i].left != NIL || T[i].right != NIL)
      degree = 1;
    else
      degree = 0;

    printf(
        "node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = "
        "%d, ",
        i, T[i].parent, sibling, degree, D[i], H[i]);
    cout << getNodeType(i) << endl;
    // if (i == 0)
    //   cout << "internal node";
    // else if (i == 1 || i == 2 || i == 4)
    //   cout << "leaf";
    // else
    //   cout << "root";
    // cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
using pll = pair<long long,long long>;

int main(){
    int L,R,d;
    cin >> L >> R >> d;
    int ans = 0;
    for(int i = L; i <= R; i++){
        if(i%d == 0)ans++;
    }
    cout << ans << endl;
    
}




Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define int long long
using namespace std;

signed main() {
	int n;
	cin >> n;
	vector<int> a(n);
	bool ans = true;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) ans = false;
	}
	if (ans == false) cout << "NO" << endl;
	else cout << "YES" << endl;
}


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

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

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

    ll N; cin >> N;

    ll x[10],y[10];

    for (int i = 0;i < N;i++){
        cin >> x[i] >> y[i];
    }

    vector<int> v;
    ll p = 1;
    for (int i = 0;i < N;i++){
        v.push_back(i);
        p *= (i+1);
    }

    double sum = 0;


    do {
        double tmp = 0;
        for (int i = 0;i < N-1;i++){
            tmp += sqrt((x[v[i]]-x[v[i+1]])*(x[v[i]]-x[v[i+1]])+(y[v[i]]-y[v[i+1]])*(y[v[i]]-y[v[i+1]]));
        }
        sum += tmp;
    } while (std::next_permutation(v.begin(), v.end()));

    double ans = sum/p;

    printf("%.10f\n", ans);
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
 
i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int n;
  cin >> n;
  vvt<pi> v(n);
  rep(i, 0, n) {
    int a;
    cin >> a;
    rep(j, 0, a) {
      int x, y;
      cin >> x >> y;
      v[i].push_back({x - 1, y});
    }
  }

  int ans = 0;
  rep(bit, 0, (1 << n)) {
    bool ok = true;
    rep(i, 0, n) {
      if((bit & (1 << i)) == 0) continue;

      for(auto &it : v[i]) {
        if(it.second == 0 && (bit & (1 << it.first))) ok = false;
        else if(it.second == 1 && !(bit & (1 << it.first))) ok = false;
      }
    }

    if(!ok) continue;

    int res = 0;
    rep(i, 0, n) {
      if(bit & (1 << i)) res++;
    }
    ans = max(ans, res);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int a[(1 << 18)], dp[(1 << 18)], b[(1 << 18)][2];

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int bits;
    cin>>bits;
    int n = (1 << bits);
    f(i, n) cin>>a[i], b[i][0] = a[i];
    for(int i = 0; i < bits; i++) {
        for(int mask = 0; mask < (1 << bits); mask++) {
            if(mask & (1 << i)) {
                int to = mask ^ (1 << i);
                vector<int> v = {b[mask][0], b[mask][1], b[to][0], b[to][1]};
                rs(v);
                b[mask][0] = v[0];
                b[mask][1] = v[1];
            }
        }
    }
    int ans = 0;
    for(int i = 1; i < n; i++) {
        cout<<max(ans, b[i][0] + b[i][1])<<"\n";
        ans = max(ans, b[i][0] + b[i][1]);
    }
    return 0;
}

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

int main(){
  int a;
  int num = 0;
  cin >> a;
  int b = a;
  for(int i = 0; i<9;++i){
    num += a%10;
    a = a/10;
    if(a == 0)
      break;
  }
  if(b%num == 0){cout << "Yes" << endl;
  }else{cout << "No" << endl;}
}

Measured memory_bytes: 256
#include<stdio.h>
#define rep(i,n) for(int (i)=0; (i) < (n); (i)++)
int main(void){
    int m, nmin, nmax, index=0;
    while(1){
        scanf("%d%d%d" , &m, &nmin, &nmax);
        if(m==0 && nmin==0 && nmax==0) break;
        int p[m],gap=0;
        rep(i,m) scanf("%d", &p[i]);
        for(int i=nmin; i <= nmax; i++){
            if(gap <= p[i-1]-p[i]){
                gap=p[i-1]-p[i];
                index=i;
            }
        }
        printf("%d\n",index);
    }
    return 0;
}



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


template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}


int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int>> jobs(m);
  rep(i,n){
    int a,b;
    cin >> a >> b;
    if (a > m)continue;
    jobs[m-a].push_back(b);
  }
  priority_queue<int> q;
  ll ans = 0;
  for(int i = m-1; i>= 0;--i){
    for(int b:jobs[i]){
      q.push(b);
    }
    if(!q.empty()){
      ans += q.top();
      q.pop();
    }

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


Measured memory_bytes: 5504
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char a,b;
    scanf("%c %c",&a,&b);
    while((a == 'H' || a == 'D') && (b == 'H' || b == 'D'))
    {
        if(a == 'H' && b == 'H')
        {
            printf("H");
            break;
        }

        else if(a == 'H' && b == 'D')
        {
            printf("D");
            break;
        }

        else if(a == 'D' && b == 'D')
        {
            printf("H");
            break;
        }

        else if(a == 'D' && b == 'H')
        {
            printf("D");
            break;
        }

    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
// template<class T> T gabs(const T& x) { return max(x, -x); }
// #define abs gabs

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

    int sum = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 1; j <= d; j += a[i]) {
            ++sum;
        }
    }

    cout << sum + x << endl;
    return 0;
}

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

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

    

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

#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)

int main() {
	int A,B;
	cin>>A>>B;
	int ans= max(A+B,A-B);
	ans=max(ans,A*B);
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {

    int i,s,temp;
    i = s = 0;
    int x[10000],y[10000];

    while(1){
    	scanf("%d %d", &x[i], &y[i]);
    	if(x[i] > y[i]){
    		temp = x[i];
    	    x[i] = y[i];
    	    y[i] = temp;
    	}

    	i++;

    	if(x[i-1]==0 && y[i-1] == 0){
    		break;
    	}
    }


    for(s=0;s<i-1;s++){
    	printf("%d %d\n",x[s], y[s]);
    }

    return 0;
}

Measured memory_bytes: 628
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<list>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
#define all(x) (x).begin(), (x).end()
//#define double long double

using namespace std;

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

const int MOD = 1e9 + 7;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

int B[100010];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N; cin >> N;
	REP(i, N-1) {
		cin >> B[i];
	}
	B[N - 1] = B[N - 2];
	int ans = B[0];
	REP(i, N-1) {
		ans += min(B[i], B[i + 1]);
	}
	print(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
#define pb push_back
#define ll long long
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
int main() 
{
    fast_io();
    int n; cin >> n;
    pair <double, double> arr[n];
    int f[n];
    for (int i = 0; i < n; ++i) {
        cin >> arr[i].first >> arr[i].second;
        f[i] = i;
    }
    double sum = 0;
    int total = 0;
    do {
        double x = arr[f[0]].first, y = arr[f[0]].second;
        for (int i = 1; i < n; ++i) {
            double a = (arr[f[i]].first-x)*(arr[f[i]].first-x);
            double b = (arr[f[i]].second-y)*(arr[f[i]].second-y);
            sum += sqrt(a+b);
            x = arr[f[i]].first; y = arr[f[i]].second;
        }
    } while (next_permutation(f, f+n));
    total = 1;
    for (int i = 1; i <= n; ++i)
        total *= i;
    cout << fixed << setprecision(9) << sum/total << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

const int mod = 998244353;
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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

struct UnionFind {
  vector<int> d;
  UnionFind(int n) : d(n, -1) {}
  int root(int x) {
    if(d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; }
};

mint dp[1000000];
bool seen[1000000];
ll num[1000000];
ll n;

mint dfs(ll k) {
  if(seen[k]) return dp[k];
  seen[k] = true;
  if(k == n) {
    dp[k] = 1;
    return 1;
  }
  dp[k] = dfs(k + num[k] + 1) + dfs(k + 1);
  return dp[k];
}

int main() {
  cin >> n;
  vector<P> p(n);
  rep(i, n) cin >> p[i].first >> p[i].second;
  sort(all(p));
  UnionFind uf(n);
  for(int i = n - 1; i >= 0; i--) {
    ll x = p[i].first, d = p[i].second;
    ll l = -1, r = n;
    while(l + 1 < r) {
      ll now = (l + r) / 2;
      if(p[now].first < x + d)
        l = now;
      else
        r = now;
    }
    rep2(j, i + 1, l + 1) {
      int nj = j + uf.size(j) - 1;
      uf.unite(i, j);
      j = nj;
    }
    num[i] = uf.size(i) - 1;
  }
  rep(i, n + 1) {
    dp[i] = 0;
    seen[i] = false;
  }
  cout << dfs(0) << endl;
}

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

using namespace std;

typedef long long int ll;

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

  ll n;
  cin >> n;
  vector < ll > primes;
  for(int i = 2; i <= 100; i++){
    bool ok = true;
    for(int j = 2; j < i - 1; j++){
      if(i % j == 0) ok = false;
    }
    if(ok) primes.push_back(i);
  }

  vector < ll > cnt(primes.size(), 0);
  for(int i = 2; i <= n; i++){
    int num = i;
    for(int j = 0; j < primes.size() && num > 1; j++){
      while(num % primes[j] == 0){
        num /= primes[j];
        cnt[j]++;
      }
    }
  }

  ll ans = 0;
  for(int i = 0; i < primes.size(); i++){
    for(int p = 2; p <= cnt[i] + 1; p++){
      for(int j = i + 1; j < primes.size(); j++){
        for(int q = 2; q <= cnt[j] + 1; q++){
          for(int k = j + 1; k < primes.size(); k++){
            for(int r = 2; r <= cnt[k] + 1; r++){
              if(p * q * r == 75) ans++;
            }
          }
          if(p * q == 75) ans++;
        }
      }
      if(p == 75) ans++;
    }
  }

  cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int a, b, c, x;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> x;
  
  int ans = 0;
  for (int i = 0; i <= a; i++) {
    int sum_a = i * 500;
    if (x < sum_a) break;
    
    for (int j = 0; j <= b; j++) {
      int sum_a_b = sum_a + j * 100;
      if (x < sum_a_b) break;
      
	  for (int k = 0; k <= c; k++) {
    	int sum_a_b_c = sum_a_b + k * 50;
    	if (x < sum_a_b_c) break;
        if (x == sum_a_b_c) {
		  ans++;
          break;
        }
      }
    }
  } 
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

char A[110];

void solve() {
	scanf("%s", A+1);
	int n = (int)strlen(A+1);
	int ans = 1e9;
	for(int i=0;i<26;i++){
		char c = 'a' + i;
		
		vector <int> v;
		for(int j=1;j<=n;j++) if(A[j] == c) v.pb(j);
		if(sz(v)){
			int c = max(v[0] - 1, n - v.back());
			for(int i=1;i<sz(v);i++) c = max(c, v[i] - v[i-1] - 1);
			ans = min(ans, c);
		}
	}
	printf("%d\n", ans);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
};

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int stg3(long int, int, int*, long int);

int main()
{
  long int x;
  int c, m[10]={0};
  scanf("%ld", &x);
  
  c = stg3(0, 0, m, x);
  
  printf("%d\n", c);
  
  return 0;
}

int stg3(long int n, int c, int *p, long int x){

  if(n <= x){
	  if(p[3]>0 && p[5]>0 && p[7]>0){
    	  c++; 
      }
  }
  if(n*10 <= x){
    p[3]++;
    c = stg3(n*10 + 3, c, p, x);
    p[3]--; p[5]++;
    c = stg3(n*10 + 5, c, p, x);
    p[5]--; p[7]++;
    c = stg3(n*10 + 7, c, p, x);
    p[7]--;
  }
      
  return c;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int cnt=0;
    while(1){
    if(b<=a){
        b = b*2;
        cnt++;
    }
    if(b>a) break;
  }
  while(1){
      if(c<=b){
          c *= 2;
          cnt++;
      }
    if(c>b) break;
  }
  if(cnt<=k) cout << "Yes" << endl;
  else cout << "No" << endl;

}

Measured memory_bytes: 3604
#include<stdio.h>
 
#define N 100001
  
int Partition(int A[],int p,int r);
  
int main(){
  int i,n,A[N],q;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
 
  q=Partition(A,0,n-1);
 
  for(i=0;i<n;i++){
    if(i==q){
      printf("[%d] ",A[i]);
    } else if(i!=n-1) {
      printf("%d ",A[i]);
    }
    else printf("%d",A[i]);
  }
  printf("\n");
 
  return 0;
}
 
int Partition(int A[],int p,int r){
  int i,j,s,t,u;
  s=A[r];
  i=p-1;
  for(j=p;j<=r-1;j++){
    if(A[j]<=s){
      i++;
      t=A[i];
      A[i]=A[j];
      A[j]=t;
    }
  }
  u=A[i+1];
  A[i+1]=A[r];
  A[r]=u;
  return i+1;
}

Measured memory_bytes: 996
#include <stdio.h>

int main(void){
	int m[20],i,h,mh;
	int n,sum;
	
	sum=0;
	h=0;
	mh=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&h);
		if(h>=mh){
			sum++;
			mh=h;
		}
	}

	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N,K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    Rep(i,K,N){
        Yes(A[i-K]<A[i]);
    }
}

Measured memory_bytes: 4784
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#define mod 1000000007
#define pie 3.141592653589793238
using namespace std;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<string> v(n);

  for(int i=0; i<n; i++){
    cin >> v[i];
  }

  sort(v.begin(), v.end());
  decltype(v)::iterator result = std::unique(v.begin(), v.end());
  v.erase(result, v.end());
  cout << v.size() << endl;
  
  return 0;
}

Measured memory_bytes: 9540
program main
implicit None
	integer(8),allocatable::l(:)
	integer(8)::n
	
	read*,n
	allocate(l(n))
	
	read*,l
	
	if(maxval(l)*2 >= sum(l))then
		print "(a)","No"
		else
		print "(a)","Yes"
	endif
end program main


Measured memory_bytes: 640
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

bool check(ll N, ll k)
{
    while (N%k == 0 and N>1)
        N /= k;
    return N%k == 1;
}

int main()
{
    ll N;
    cin >> N;
    int cnt = 0;

    // N%k = 0
    for (ll k=1; k*k<=N; ++k)
    if (N%k == 0)
    {
        if (k!=1 and check(N, k)) ++cnt;
        if (k!=N/k and check(N, N/k)) ++cnt;
    }

    //  N%k = 1
    for (ll k=1; k*k<=N-1; ++k)
    if ((N-1)%k == 0)
    {
        ++cnt;
        if ((N-1)/k != k)
            ++cnt;
    }
    --cnt;

    cout << cnt << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll k;
    cin >> k;

    if(k == 1) {
        cout << 1 << endl << 1 << endl;
        return 0;
    }

    // k/4*4色を構成
    ll c = ceil(k, 4LL) * 4, n = c/2;
    vector<vector<ll>> ret(n, vector<ll>(n, -1));
    REP(i, n) REP(j, n) {
        if(i%2) ret[i][j] = n+(i+j)%n+1;
        else ret[i][j] = (i+j)%n+1;
    }

    while(c > k) {
        REP(i, n) REP(j, n) {
            if(ret[i][j] == c) ret[i][j] -= n;
        }
        c--;
    }

    cout << n << endl;
    REP(i, n) {
        REP(j, n) cout << ret[i][j] << (j==n-1?'\n':' ');
    }

    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
using ll = long long;
using namespace std;

int main(){
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    if(n > k) cout << x * k + (n - k) * y << endl;
    if(n <= k) cout << x * n << endl;
    return 0; 
}

Measured memory_bytes: 256
/****************
 *		*
 * ALDS_1_7_A	*
 * Rooted Trees *
 *		*
 * 2019/09/21   *
 *		*
 ***************/

#include<iostream>
#include<cstdio>

using namespace std;

#define MAX 100002


typedef struct {
  int parent;
  int left_child;
  int right_brother;
} Node;

Node T[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  printf("node %d: parent = %d, depth = %d, ",u,T[u].parent,D[u]);

  if(T[u].parent == -1) printf("root, ");
  else if(T[u].left_child == -1) printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for(i=0,c = T[u].left_child; c != -1; i++,c = T[c].right_brother){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void rec(int u, int p){
  D[u] = p;
  
  if(T[u].right_brother != -1) rec(T[u].right_brother,p);
  if(T[u].left_child != -1) rec(T[u].left_child,p+1);
}

int main(void) {
  int i,j,d,v,c,l,r;

  scanf("%d",&n);
  for(i=0;i<n;i++) {
    T[i].parent = -1;
    T[i].left_child = -1;
    T[i].right_brother = -1;
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      
      if(j==0)
	T[v].left_child = c;
      else
	T[l].right_brother = c;

      l=c;
      T[c].parent = v;
    }
  }

  for(i=0;i<n;i++)
    if(T[i].parent == -1) r = i;

  rec(r,0);

  for(i=0;i<n;i++) print(i);

  return 0;
}



Measured memory_bytes: 7880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	string s;cin>>s;
	int n=s.size();

	int a[n+1]={};

	for(int i=0;i<n;i++) if(s[i]=='<') a[i+1]=a[i]+1;
	for(int i=n-1;i>=0;i--) if(s[i]=='>') a[i]=max(a[i],a[i+1]+1);
/*
	rep(i,n+1) cout<<a[i]<<" ";
	cout<<"\n";
*/
	ll ans=0;
	rep(i,n+1) ans+=a[i];

	cout<<ans<<"\n";

}

Measured memory_bytes: 2820
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		int h[] = new int[300];
		int w[] = new int[300];
		int endIndex = 0;
		
		for (int i = 0; i < 300; i++) {
			h[i] = scan.nextInt();
			w[i] = scan.nextInt();

			if (h[i] == 0 && w[i] == 0) {
				endIndex = i;
				break;
			}
		}
		
		for (int i = 0; i < endIndex; i++) {
			for (int height = 0; height < h[i]; height++) {
				for (int width = 0; width < w[i]; width++) {
					if (height % 2 == 0) {
						if (width % 2 == 0) 
							System.out.print("#");
						else
							System.out.print(".");
					}
					else {
						if (width % 2 == 0) 
							System.out.print(".");
						else
							System.out.print("#");
					}
				}
				System.out.println();
			}
			System.out.println();
		}
		
		scan.close();
	}
}

Measured memory_bytes: 26836
let x, n =
    stdin.ReadLine().Split()
    |> Array.map int
    |> fun a -> a.[0], a.[1]

let ary =
    try
        stdin.ReadLine().Split() |> Array.map int
    with _ -> [||]

let rec solve i =
    if not (Array.exists (fun p -> p = x - i) ary)
    then x - i
    elif not (Array.exists (fun p -> p = x + i) ary)
    then x + i
    else solve (i + 1)

solve 0 |> printfn "%d"


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

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

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

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

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

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

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

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

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

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

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

int main(){
  int N, K;
  std::cin >> N >> K;
  std::vector<int > A(N);
  int maxA = -1;
  for (int i=0; i<N; i++) {
    std::cin >> A[i];
    maxA = std::max(maxA, A[i]);
  }
  /*if (K==0) {
    printf("%d\n", maxA);
    return 0;
  }*/
  int min = 0, max = 1001001001;
  while(max-min>1) {
    int mid = (max+min)/2;
    long long cnt = 0;
    for (int i=0; i<N; i++) {
      //cnt += (long long)((double)A[i]/(double)mid+0.999)-1;
      cnt += (long long)(A[i]-0.000001)/mid;
    }
    if (cnt<=K) {
      max = mid;
    } else {
      min = mid;
    }
  }
  std::cout << max << std::endl;
  return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
 
int main()
{
    int N; cin >> N;
    vector<int> A(N); rep(i,N) cin >> A[i];

    auto iter1 = max_element(A.begin(), A.end());
    int m1 = *iter1;
    A[iter1 - A.begin()] = 0;
    auto iter2 = max_element(A.begin(), A.end());
    int m2 = *iter2;
    A[iter1 - A.begin()] = m1;

    rep(i,N) cout << ((A[i] != m1) ? m1 : m2) << endl;

    return 0;
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int n,m,ans,k[35],a[35][35],cnt[35];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>k[i];
		for(int j=1;j<=k[i];j++)
		{
			cin>>a[i][j];
			cnt[a[i][j]]++;
		}
	}
	for(int i=1;i<=m;i++)
		if(cnt[i]==n)
			ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cmath>
#include <vector>
#include <complex>
#include <algorithm>
#include <cstdio>
using namespace std;

// î{Ö(è)
#define EPS			(1e-10)
#define PI			(3.14159265358979323846)

#define X(a)		( (a).real() )
#define Y(a)		( (a).imag() )
#define EQ(a,b)		( -EPS<(a)-(b) && (a)-(b)<EPS )
#define EQV(a,b)	( EQ(X(a),X(b)) && EQ(Y(a),Y(b)) )

#define unit(a)		( (a)/abs(a) )
#define normal(a)	( (a)*P(0,1) )
#define dot(a,b)	( X((a)*conj(b)) )
#define cross(a,b)	( Y(conj(a)*(b)) )

#define pb push_back


// _(xNg)
typedef complex<double> P;
// _W (½p`) ¶ñ]ðOñÆ·éB
typedef vector<P> G;
// ¼ü
struct L : public vector<P>
{
	L(P a, P b) { push_back(a); push_back(b); }
};

bool intersectLL(L s, L t)
{
	return	abs(cross(s[1]-s[0], t[1]-t[0])) > EPS;
}

double distLP(L s, P p)
{
	return	abs(cross(s[1]-s[0], p-s[0]))/abs(s[1]-s[0]);
}

// ¼üÆ¼üÌð_
P crosspointLL(L s, L t)
{
	P a=s[0],b=s[1],c=t[0],d=t[1];

	double det=cross(d-c,b-a);
	assert(!(abs(det)<EPS));

	return a + (b-a) * cross(d-c,c-a)/det;
}


vector<P> contact_circleLLR(L s, L t, double r)
{
	vector<P> res;

	P a = s[1]-s[0];
	P b = t[1]-t[0];
	P q = crosspointLL(s,t);

	for(int i=0; i<2; i++)
	{
		double h  = arg(b/a)/2.0;
		double d  = r/sin(h);

		h += arg(a);
		res.push_back(q+polar(d,h));
		res.push_back(q-polar(d,h));

		a*=-1.0;
	}
	
	return res;
}


int main()
{
	double W,H,R; int N;
	while(cin >> W >> H >> N >> R, W||H||N||R)
	{
		vector<L> laser;
		vector<L> laserside;	
		vector<double> thick;	
		P f1(0,0),f2(W,0),f3(W,H),f4(0,H);
	
		laser.pb(L(f1,f2)); laserside.pb(L(f1,f2)); thick.pb(0);
		laser.pb(L(f2,f3)); laserside.pb(L(f2,f3)); thick.pb(0);	
		laser.pb(L(f3,f4)); laserside.pb(L(f3,f4)); thick.pb(0);
		laser.pb(L(f4,f1)); laserside.pb(L(f4,f1)); thick.pb(0);		
	
		for(int i=0; i<N; i++)
		{
			P a,b,w,v; double tk;
			cin >> X(a) >> Y(a);
			cin >> X(b) >> Y(b);
			cin >> tk;
			
			laser.pb(L(a,b));
			thick.pb(tk);
			
			v = b-a;
			w = a + unit(v)*P(0, tk);
			laserside.pb(L(w,w+v));
			w = a + unit(v)*P(0,-tk);
			laserside.pb(L(w,w+v));		
		}

		vector<P> cir,cc;
		for(int i=0;   i<laserside.size(); i++)
		for(int j=i+1; j<laserside.size(); j++)
		{
			if(intersectLL(laserside[i],laserside[j]))
			{
				cc = contact_circleLLR(laserside[i],laserside[j],R);
				
				for(int k=0; k<4; k++)
				if(-EPS<=X(cc[k]) && X(cc[k])<=W+EPS && -EPS<=Y(cc[k]) && Y(cc[k])<=H+EPS)
				{
					cir.pb(cc[k]);
					//cout << cc[k] << endl;
				}
			}
		}		
		
		
		bool safe=true;
		for(int i=0; i<cir.size(); i++)
		{
			safe=true; //cout << "circle:" << i << " " << cir[i] << endl;
			for(int j=0; j<laser.size(); j++)
			{
				if(distLP(laser[j],cir[i]) < R+thick[j]-EPS)
				{
					//printf("%.10lf %.10lf\n", distLP(laser[j],cir[i]),R+thick[j]-EPS);				
					safe=false;
					break;
				}
			}
			
			if(safe) break;
		}
		
		cout << (safe?"Yes":"No") << endl;
	}






















}

Measured memory_bytes: 1936
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
    
    int a[3], k;
    int sum=0;
    
    rep(i, 3){
        scanf("%d", &a[i]);
    }
    scanf("%d", &k);
    
    qsort(a, 3, sizeof(int), up_comp);
    
    for (int i=1; i<=k; i++) {
        a[2]=a[2]*2;
    }
    
    rep(i, 3){
        sum+=a[i];
    }
    
    printf("%d", sum);
    
    return 0;
}



Measured memory_bytes: 1724
#include <iostream>
using namespace std;
int main (void){
  int a, b;
  cin >> a >> b;
  
  int ans;
  if(a < 1 || a > 9 || b < 1 || b > 9){
    ans = -1;
  } else{
    ans = a * b;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
using System;

public class hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var sL = s.Length;
        var ix = 0;
        var flag = 0;
        while (true)
        {
            var a = s.IndexOf('A', ix);
            if (a >= sL - 1 | a == -1) break;
            var z = s.IndexOf('Z', a + 1);
            if (z != -1)
            {
                Console.Write("AZ");
                flag = 1;
                ix = z + 1;
                if (z >= sL - 1) break;
            }
            else break;
        }
        if (flag == 0) Console.WriteLine(-1);
        else Console.WriteLine();
    }
}

Measured memory_bytes: 9140
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

arr=list(map(int, arr_data[0]))

arr.sort()

print(int(str(arr[2]) + str(arr[1])) + arr[0])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a >= b) { a = b; return true; } return false; }

int main() {

	int n, m; cin >> n >> m;
	vector<ll> a(n), b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	vector<ll> c(m), d(m);
	for (int i = 0; i < m; i++) {
		cin >> c[i] >> d[i];
	}
	for (int i = 0; i < n; i++) {
		ll ans;
		ll dist = 9223372036854775807LL;
		for (int j = m - 1; j >= 0; j--) {
			ll tmpDist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (chmin(dist, tmpDist)) {
				ans = j;
			}
		}
		cout << ans  + 1 << endl;
	}
	return 0;
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;
const ll MOD = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

int main() {
    ll n, x; cin >> n >> x;
    V<ll> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    v.push_back(x);
    sort(ALL(v));

    ll g = v[1] - v[0];
    for(int i = 2; i < n + 1; i++){
        g = gcd(g, (v[i] - v[i - 1]));
    }
    cout << g << endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int N, M;
string S;

bool inside(vector<char> s, char c){
	for(int i = 0; i < s.size(); i++)
		if(s[i] == c) return true;
	return false;
}

int main(void){
	//IO("test.in", "test.out");
	cin >> N >> S;
	for(int i = 1; i < S.length(); i++){
		vector<char> c;
		string x = S.substr(0, i);
		string y = S.substr(i, S.length() - i);
		for(int i = 0; i < x.length(); i++)
			for(int j = 0; j < y.length(); j++)
				if(x[i] == y[j] && !inside(c, x[i])) c.push_back(x[i]);
		if(c.size() > M) M = c.size();
	}
	printf("%d\n", M);
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

ll f(ll b,ll n){
  if(n < b) return n;
  else{
    // cout << f(b,floor(n / b)) << endl;
    //cout << "hi" << endl;
    // cout << b << endl;
    // cout << n % b << endl;
    return f(b,floor(n / b)) + (n%b);
  }
}


vector<int> divisors(int n) {
    vector<int> res;
    for(int i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i);
        if(n/i == i) continue; // 上の行で追加済み。
        res.push_back(n/i);
    }
    return res;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,s;
  cin >> n >> s;


  if(s == n){
    cout << n+1LL << endl;
    return 0;
  }

  if(s>n){
    cout << -1 << endl;
    return 0;
  }
  set<ll> st;
  for(ll i = 2; i*i <= n; i++){
    if(s == f(i,n)){
      st.insert(i);
    }
  }



  for(ll p = 1; p * p < n && p <= s; p++ ){
    ll m = s-p;
    if(n-m >= 0 && (n-m) %p == 0){
      ll b= (n-m)/p;
      if(b > p && b > m && f(b,n) == s) st.insert(b);
    }
  }
  if(st.size()) cout << *st.begin() << endl;
  else cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 256
n, *a = map(int, open(0).read().split())
mita = [0] * -~n
mita[-1] = 3
mod = 10 ** 9 + 7
c = 1
for i in range(n):
    c = c * (mita[a[i] - 1] - mita[a[i]]) % mod
    mita[a[i]] += 1
print(c)


Measured memory_bytes: 19944
N = int(input())
S = [None for _ in range(N)]

for i in range(N):
   S[i] = input()

a = S.count('AC')
b = S.count('WA')
c = S.count('TLE')
d = S.count('RE')

print('AC x %d' %a)
print('WA x %d' %b)
print('TLE x %d' %c)
print('RE x %d' %d)

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


int main(void){
    vector<int> a;
    rep(i,3){
        int x;
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(),a.end(),greater<int>());
    int ans = a[0]*10+a[1]+a[2];
    cout << ans <<endl;
    
    return 0;
    
}





















































Measured memory_bytes: 256