akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
// clang-format on

string N;
vector<int> n;
int k;
int dp[100 + 5][2][100 + 5];

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  cin >> k;
  for (auto a : N) {
    n.push_back(a - '0');
  }
  int l = N.size();
  // 今の桁, samller, 0が含まれてる個数
  dp[0][0][0] = 1;
  for (int i = 0; i < l; i++) {
    for (int smaller = 0; smaller < 2; smaller++) {
      for (int j = 0; j < l; j++) {
        for (int x = 0; x <= (smaller ? 9 : n[i]); x++) {
          // 今の桁が0なら0の個数を一つインクリメントして、
          // それ以下のものを全部足し合わせる
          if (x == 0) {
            dp[i + 1][smaller || x < n[i]][j + 1] += dp[i][smaller][j];
          } else {
            dp[i + 1][smaller || x < n[i]][j] += dp[i][smaller][j];
          }
        }
      }
    }
  }

  cout << dp[l][0][l - k] + dp[l][1][l - k] << endl;

  return 0;
}


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

using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin>>N;
    ll suma=0;
    for(int i=1; i<=N; i++)
    {
        if(i%3==0 || i%5==0)
        {
            continue;
        }
        suma+=i;
    }
    cout<<suma;
    return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <cassert>
#include <bitset>
#include <climits>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
typedef long long int ll;
int main(){
  ll n;
  cin>>n;
  ll c1,c2,ct=0;
  for(int i=sqrt(n);i>=1;i--){
      if(n%i==0){
        c1=i;
        c2=n/i;
        break;
      }
    }
    cout<<(c1+c2-2);
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict, deque
from functools import reduce
import math

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    count = 0
    for i in range(N):
        if h[i] >= K:
            count += 1
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12504
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    if(k == 1) {
        cout << 0;
    }
    else {
        cout << n-k;
    }

    cout << endl;
    return 0;
}

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

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
ll N,M;
bool ok(ll n, ll m, ll val){
  ll s = val;//need s
  ll c = 2 * val;//need c
  if (n < s){
    ll tmp = s - n;
    m -= 2 * tmp;
  }
  if (m < c){
    return false;
  }
  return true;
}
int main() {
  cin >> N >> M;
  ll left,right;
  left = 0;
  right = 1LL << 50;
  while (right - left > 1){
    ll med = (right + left) / 2;
    if (ok(N, M, med)){
      left = med;
    }else{
      right = med;
    }
  }
  cout << left << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main () {

    string str;
    cin >> str;

    int q;
    cin >> q;

    for (int i = 0; i < q; i++) {

        string order;
        cin >> order;

        // cout << "Scan order" << endl;

        int a, b;
        cin >> a >> b;

        // cout << "Scan a & b" << endl;

        if (order == "print") {

            // cout << "Mode print" << endl;

            string out;
            out = str.substr(a, b + 1 - a);

            cout << out << endl;

        } else if (order == "reverse") {

            // cout << "Mode reverse" << endl;

            int j = 0;
            while (j <= (b - a) / 2) {

                char tmp;
                tmp = str[a + j];
                str[a + j] = str[b - j];
                str[b - j] = tmp; 
                j++;

            }

            // cout << "Result reverse: " << str << endl;

        } else if (order == "replace") {

            // cout << "Mode replace" << endl;
            
            string p;
            cin >> p;

            for (int j = a; j <= b; j++) {

                str[j] = p[j - a];

            }
        
        }

    }

    return 0;
}


Measured memory_bytes: 3176
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> r(n + 10, 0), l(n + 10, 0);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  ll ans = 0;
  for(int i = 0; i < n; i++) {
    if(i + a[i] <= n) {
      ans += r[i + a[i]];
    }
    if(i - a[i] >= 0) {
      ans += l[i - a[i]];
    }
    if(i + a[i] <= n) {
      l[i + a[i]]++;
    }
    if(i - a[i] >= 0) {
      r[i - a[i]]++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	long long n, ans = 0, f = 10;
	cin >> n;
	if (n % 2 == 0) {
		while (n >= f) {
			ans += (n / f);
			f *= 5;
		}
	}
	cout << ans << endl;
	return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n;cin>>n;
  string s,t,ans="";cin>>s>>t;
  rep(i,0,n){
      ans+=s[i];
      ans+=t[i];
  }
  cout<<ans<<ENDL;

}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  int count = 1;
  char pred = s[0];
  for (int i = 1; i < s.size(); i++) {
    if (s[i] != pred) {
      count++;
      pred = s[i];
    }
  }
  
  cout << count << endl;
  
  return 0;
}


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

int a[100005],b[100005],ta[100005],tb[100005];

int main(){
    int A,B,M;
    int x,y,c;
    int ans=0;
    cin>>A>>B>>M;
    for(int i=1;i<=A;i++){
        cin>>a[i];
    }
    memcpy(ta,a,sizeof(a));
    for(int i=1;i<=B;i++){
        cin>>b[i];
    }
    memcpy(tb,b,sizeof(b));
    sort(a+1,a+A+1);
    sort(b+1,b+B+1);
    ans=a[1]+b[1];
    for(int i=1;i<=M;i++){
        cin>>x>>y>>c;
        ans=min(ans,ta[x]+tb[y]-c);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int sum = 0, ma = 0;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    sum += a;
    ma = max(ma, a);
  }
  if (sum - ma > ma) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3604
import sys
readline = sys.stdin.readline

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())


def main():
    N, M = map(int, readline().rstrip().split())
    inp = [tuple(map(int, readline().rstrip().split())) for _ in range(M)]
    uf = UnionFind(N)
    res = [N * (N-1) // 2]
    res_0 = res[0]

    for a, b in inp[::-1][:-1]:
        if uf.same(a-1, b-1):
            res.append(res[-1])
        else:
            x = uf.find(a-1)
            y = uf.find(b-1)
            res.append(res[-1] - uf.size(x) * uf.size(y))
            uf.union(a-1, b-1)

    print(*res[::-1], sep='\n')

if __name__ == '__main__':
    main()

Measured memory_bytes: 26284
n, m, l = list(map(int, input().split()))

a = [0]*n
b = [0]*m
c = [[0 for col in range(l)] for row in range(n)]

for i in range(n):
    a[i] = list(map(int,input().split()))

for i in range(m):
    b[i] = list(map(int,input().split()))


for i in range(n):
    for j in range(l):
        c[i][j] = sum([a[i][k]*b[k][j] for k in range(m)])
#        for k in range(m):
#            c[i][j] += a[i][k]*b[k][j]
    print(*c[i])

Measured memory_bytes: 9076
#include <stdio.h>

int main()
{
	int N, T;
	scanf("%d%d", &N, &T);

	int cmin = 1001;
	for(int n=0; n<N; n++){
		int c, t;
		scanf("%d%d", &c, &t);
		if(t<=T && c<cmin){
			cmin = c;
		}
	}
	if(cmin > 1000){
		printf("TLE\n");
	} else {
		printf("%d\n", cmin);
	}

	return 0;
}


Measured memory_bytes: 128
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>
#include <set>
#include <cmath>
#include <functional>

using namespace std;

int main(void)
{
	int a, b, c;

	cin >> a >> b >> c;

	if (a == b)
	{
		cout << c << endl;
	}
	else if (a == c)
	{
		cout << b << endl;
	}
	else if (b == c)
	{
		cout << a << endl;
	}

	return 0;
}

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

template<class INT>
std::vector<INT> factorize(INT n){
    std::vector<INT> res;
    for (INT i = 1; i * i <= n; i++){
        if (n % i == 0){
            res.push_back(i);
            if (i * i != n)
                res.push_back(n / i);
        }
    }
    return res;
}

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    vector<int> A(n);
    for (int i = 0; i < n; i++)
        scanf("%d", &A[i]);
    auto F = factorize(accumulate(A.begin(), A.end(), 0));
    sort(F.begin(), F.end(), greater<int>());

    for (const auto &f: F){
        vector<int> B(n);
        int border = 0;
        bool flag = false;
        for (int i = 0; i < n; i++){
            B[i] = A[i] % f;
            border += min(B[i], f - B[i]);
            if (flag = border > k + k)
                break;
        }
        if (flag) continue;
        const auto S = accumulate(B.begin(), B.end(), 0);
        const auto i = S / f;
        nth_element(B.begin(), B.begin() + (n - i), B.end());
        if (max(accumulate(B.begin(), B.begin() + (n - i), 0), S - accumulate(B.begin() + (n - i), B.end(), 0)) <= k){
            printf("%d\n", f);
            return 0;
        }
    }

    puts("0");
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    LD h=IINF;
    int ss,aa,cc;
    rep(s,16){
      rep(a,16){
        rep(c,16){
          LD tmp=0;
          vector<LD> count(256,0);
          vector<int> r(n+1);
          r[0]=s;
          repp(i,1,n+1) r[i]=(a*r[i-1]+c)%256;
          rep(i,n){
            count[(v[i]+r[i+1])%256]++;
          }
          rep(i,256){
            if(count[i]>0)
            tmp-=count[i]/n*log(count[i]/n);
          }
          if(tmp<h-0.00001){
            h=tmp;
            ss=s,aa=a,cc=c;
          }
        }
      }
    }
    cout << ss SP aa SP cc << endl;
  }
  return 0;
}



Measured memory_bytes: 3160
MOD = 10 **9 + 7
s = input()

n = len(s)
o = [1] * (n+1)
a = [0] * (n+1)
b = [0] * (n+1)
c = [0] * (n+1)

for i in range(n):
    if s[i] == '?':
        o[i+1] = o[i] * 3
        a[i+1] = a[i] * 3 + o[i]
        b[i+1] = b[i] * 3 + a[i]
        c[i+1] = c[i] * 3 + b[i]
    else:
        o[i+1] = o[i]
        a[i+1] = a[i]
        b[i+1] = b[i]
        c[i+1] = c[i]
        if s[i] == 'A':
            a[i+1] += o[i]
        if s[i] == 'B':
            b[i+1] += a[i]
        if s[i] == 'C':
            c[i+1] += b[i]
    o[i+1] = o[i+1] % MOD
    a[i+1] = a[i+1] % MOD
    b[i+1] = b[i+1] % MOD
    c[i+1] = c[i+1] % MOD
print(c[n])

Measured memory_bytes: 19104
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 1000005


ll fact[SIZE],inv_fact[SIZE];

ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;
}

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

ll nCk(ll n,ll k){

	ll ret = fact[n]*inv_fact[k];
	ret %= MOD;
	ret *= inv_fact[n-k];

	return ret%MOD;
}



int main(){

	fact[0] = 1;
	for(ll i = 1; i < SIZE; i++){
		fact[i] = i*fact[i-1];
		fact[i] %= MOD;
	}
	inv_fact[SIZE-1] = mod_inverse(fact[SIZE-1],MOD);
	for(ll i = SIZE-1; i >= 1; i--){

		inv_fact[i-1] = inv_fact[i]*i;
		inv_fact[i-1] %= MOD;
	}

	ll N,M,K;
	scanf("%lld %lld %lld",&N,&M,&K);

	ll all = N*M;
	ll mult = nCk(all-2,K-2);

	ll ans = 0;

	for(int loop = 0; loop < 2; loop++){
		for(ll diff = 1; diff <= M-1; diff++){

			ll tmp = ((M-diff)%MOD*(N*N)%MOD)%MOD;
			tmp *= diff;
			tmp %= MOD;
			ans += (tmp*mult)%MOD;
			ans %= MOD;
		}
		swap(N,M);
	}

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 15872
def solve(N, M):
  U = [False]*N
  a = 1
  b = N
  ans = []
  for i in range(M):
    while U[b-a] or U[a+N-b] or (b-a)*2==N:
      b -= 1
    ans += [(a, b)]
    U[b-a] = U[a+N-b] = True
    a += 1
    b -= 1
  return ans

def check(N, M, ans):
  S = set()
  for i in range(N):
    for a in ans:
      s = tuple(sorted(((a[0]+i)%N, (a[1]+i)%N)))
      if s in S:
        return False
      S.add(s)
  return True

"""
for M in range(1, 10):
  for N in range(M*2+1, 100):
    ans = solve(N, M)
    if not check(N, M, ans):
      print(N, M)
      exit(0)
"""

N, M = map(int, input().split())
for a, b in solve(N, M):
  print(a, b)


Measured memory_bytes: 22056
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#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 llong long long
#define pb(a) push_back(a)

using namespace std;

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


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


#define ARRAY_MAX 100005
const int INF = INT32_MAX / 3;
const ll MOD = 1e9 + 7;

int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };


/******************************************************************************************/


//xのn乗をmで余りを取る
ll mod_pow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1LL;
	}
	else if (n % 2 == 0) {
		return mod_pow(x * x % m, n / 2, m);
	}
	else {
		return (x * mod_pow(x, n - 1, m)) % m;
	}
}

ll dp[100005][2] = {};

int main() {

	string s;
	cin >> s;


	dp[0][0] = 1;

	for (int i = 0; i < s.size(); i++)
	{
		//必ず小さくなるもの
		dp[i + 1][1] += 3LL * dp[i][1];
		dp[i + 1][1] %= MOD;

		if (s[i] == '1') {
	
			//同じか小さくなるか
			dp[i + 1][0] += 2LL * dp[i][0];//同じケース(1,0),(0,1)のケース
			dp[i + 1][0] %= MOD;
			dp[i + 1][1] += dp[i][0];//小さくなる(0,0)のケース
			dp[i + 1][1] %= MOD;
			
		}
		else
		{
			dp[i + 1][0] += dp[i][0];//(0,0)のケース
			dp[i + 1][0] %= MOD;
		}
	}

	cout << (dp[s.size()][0] + dp[s.size()][1]) % MOD << endl;

	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main(){
  int n ,i=0 ,index;
  string s;
  cin >> n;
  cin.ignore();

  while( i < n ){
    getline(cin,s);
    while( true ){
      string::size_type index = s.find( "Hoshino" );
      if( index != string :: npos ){
	s.replace( index ,7 ,"Hoshina" );
      }
      else{
	break;
      }
    }
    cout << s << endl;
    i++;
  }
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lf long double
#define vi vector<int>
#define vl vector<long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define MOD 1000000007
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define in insert
#define all(x) x.begin(),x.end()
#define zapp ios::sync_with_stdio(false);cin.tie(0)
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll inv(ll x) {return power(x, MOD - 2);}
const int MAXN = 1e5 + 5;
//const bool is_in = container.find(element) != container.end();
int main()
{
	zapp;
	bool poss = false;
	ll i, k, a, b;
	cin >> k;
	cin >> a >> b;
	for (i = a; i <= b; i++)
	{
		if (i % k == 0)
			poss = true;
	}
	if (poss)
		cout << "OK";
	else
		cout << "NG";

	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  int N = S.size();
  if(N<4)
  {
    cout << "No" << endl;
    return 0;
  }
  else
  {
    if(S[0]=='Y'&&S[1]=='A'&&S[2]=='K'&&S[3]=='I')
    {
      cout << "Yes" << endl;
    }
    else
    {
      cout << "No" << endl;
    }
    
  }
  return 0;
}


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

int main(){
  string N;
  cin >> N;
  
  int d=N.size();
  long long sum=0;
  for(int bit=0; bit <(1<<(d-1)); bit++){
    string fml;
    fml.push_back(N[0]);
    for(int i=0; i<d-1; i++){
      if(bit & (1<<i)){
        fml.push_back('+');
        fml.push_back(N[i+1]);
      }else{
        fml.push_back(N[i+1]);
      }
    }
    long long add=0;
    for(int i=0; i<fml.size(); i++){
      if(fml[i]=='+'){
        sum+=add;
        add=0;
      }else{
        add*=10;
        add+=fml[i]-'0';
        if(i==fml.size()-1) sum+=add;
      }
    }
  }
  cout << sum <<endl;
}

Measured memory_bytes: 256
#!/usr/bin/perl

while (<>) {
    chomp;
    $s = $_;
}

$l = length($s);
$f1 = 1;
$b1 = $l / 2 + 1;
$ln = $l / 2 - 1;
foreach $n (1 .. $l / 2 - 1) {
    $f2--;
    $b1--;
    $b2 = $b2 - 2;
    $f = substr($s , $f1 - 1, $ln);
    $b = substr($s , $b1 - 1, $ln);
    if($f eq $b) {
        print $ln * 2, "\n";
        last;
    }
    $ln--;
}


Measured memory_bytes: 384
K = int(input())
S = input()
if 1 <= K and K <= 100:
   if type(K) == int:
      if S.islower() == True:
        if len(S) <= 100 and 1 <= len(S):
          if len(S) <= K:
            ans = S
          else:
            ans = S[:K] + '...'
print(ans)

Measured memory_bytes: 9184
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
        new Main().run();
    }
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int p = scan.nextInt();
			if(n == 0 && p == 0){
				break;
			}
			int[] m = new int[n];
			int i = 0;
			while(true){
				if(i >= n){
					i %= n;
				}
				if(p == 1){
					if(check(m,i)){
						System.out.println(i);
						break;
					}else{
						p--;
						m[i]++;
					}
				}else if(p == 0){
					p = m[i];
					m[i] = 0;
				}else{
					p--;
					m[i]++;
				}
				i++;
			}
		}
	}
	public boolean check(int[] n,int a){
		for(int i = 0;i < n.length;i++){
			if(i == a){
				continue;
			}
			if(n[i] > 0){
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 20376
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>

using namespace std;

double EPS = 1e-10;

double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}

struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}

  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }

  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }

  point operator * (double d){
    return point(x*d,y*d);
  }
};

double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}

int is_intersected_ls(point a1, point a2, point b1, point b2) {
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int main(void){
  int n;
  point p[3],k,s;

  cin >> n;
  while(n--){
    for(int i=0;i<3;i++)
      cin >> p[i].x >> p[i].y;
    
    cin >> k.x >> k.y >> s.x >> s.y;
    int cnt=0;
    for(int i=0;i<3;i++)
      for(int j=i+1;j<3;j++)
	if(i!=j)
	  cnt+=is_intersected_ls(p[i],p[j],k,s);
    
    if(cnt%2)cout << "OK" << endl;
    else cout << "NG" << endl;
    
  }

  return 0;
}

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

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

    if (n % k == 0)
    {
        std::cout << 0 << endl;
        return 0;
    }
    std::cout << 1 << endl;

    return 0;
}

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

int main() {
    string S;
    cin >> S;
    ll s1 = stoi(S.substr(0, 2));
    ll s2 = stoi(S.substr(2, 2));
    if(0 < s1 && s1 <= 12) {
        if(0 < s2 && s2 <= 12) {
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else {
        if(0 < s2 && s2 <= 12) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,ans=0;
	cin>>a>>b;
	if(a>b){
		ans+=a;
		a--;
		ans+=max(a,b);
	}
	else {
		ans+=b;
		b--;
		ans+=max(a,b);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
int main(void)
{
  int n;
  cin >> n;
  vector<pair<double,int> > pos;
  double answer=0.0;
  REP(i,n){
    int r;
    cin >> r;
    double tmppos=r;
    REP(j,pos.size()){
      double bpos=pos[j].first;
      int br=pos[j].second;
      tmppos=max(tmppos,bpos+sqrt(1.0*(r+br)*(r+br)-(r-br)*(r-br)));
    }
    pos.push_back(make_pair(tmppos,r));
    answer=max(answer,tmppos+r);
  }
  cout << fixed << setprecision(10) << answer << endl;
  return 0;
}

Measured memory_bytes: 3284
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
#define pll pair<ll,ll>
#define pii pair<int,int>
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
 
ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b) ;} 

template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}
 
void dfs(int u,vector<vector<ll>> &graph,int col,vector<ll> &vis){
	vis[u] = col;
	for(int i=0;i<graph[u].size();i++){
		int v = graph[u][i];
		if(vis[v]==0){
			dfs(v,graph,col,vis);
		}
	}
}

void solve(){
	ll n,m;cin>>n>>m;
	vector<vector<ll>> graph(n+1);
	for(int i=0;i<m;i++){
		ll a,b;
		cin>>a>>b;
		graph[a].pb(b);
		graph[b].pb(a);
	}
	vector<ll> data;
	vector<ll> vis(n+1);
	ll col = 1;
	for(int i=1;i<=n;i++){
		if(vis[i]==0){
			dfs(i,graph,col,vis);
			col++;
		}
	}
	vector<ll> info(col);
	for(int i=1;i<=n;i++){
		info[vis[i]]++;
	}
	sort(info.begin(),info.end());
	reverse(info.begin(),info.end());
	ll sub = 0;
	ll ans = 0;
	for(int i=info.size()-1;i>=0;i--){
		if(info[i]-sub>0){
			sub+=info[i] - sub;
		}
	}
	cout<<sub<<endl;
}
 
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	ll t;
	// cin>>t;
	t=1;
	while(t--){
		solve();
	}    
    return 0;
}

Measured memory_bytes: 25072
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<ll,int> P;
const ll INF = 100000000000;
int main(){
	int n;
	ll a[300][300];
	ll b[300][300];
	ll ans = 0;
	priority_queue<P,vector<P>,greater<P> > pq;
	scanf("%d",&n);
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%lld",&a[i][j]);
	for(int i=0;i<n;i++) for(int j=0;j<i;j++) pq.push(make_pair(a[i][j],n*i+j));
	for(int i=0;i<n;i++) for(int j=0;j<n;j++) b[i][j] = INF;
	while(!pq.empty()){
		P now = pq.top(); pq.pop();
		ll cost = now.first;
		int h = now.second / n;
		int w = now.second % n;
		bool flag = false;
		b[h][w] = b[w][h] = a[h][w];
		for(int k=0;k<n;k++){
			if(k==h||k==w) continue;
			if(b[h][k]+b[k][w]<cost){
				printf("-1\n");
				return 0;
			}else if(b[h][k]+b[k][w]==cost){
				flag = true;
			}
		}
		if(!flag) ans += cost;
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--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 (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL <<60;
typedef long long ll;
using namespace std;

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

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

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    int n;
    cin>>n;
    ll a[n];
    rep(i,0,n-1) cin>>a[i];
    map<int,int> mp;
    ll ans = 0;
    rep(i,0,n-1){
        int sa = i - a[i];
        int wa = i + a[i];
        ans += mp[sa];
        mp[wa]++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 22156
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        k: usize,
        v: [usize; n]
    }
    let g = v.iter().fold(0, |ac, &x| gcd(ac, x));
    let m = v.iter().cloned().max().unwrap();
    if k <= m && k % g == 0 {
        println!("POSSIBLE");
    } else {
        println!("IMPOSSIBLE");
    }
}

fn gcd(n: usize, m: usize) -> usize {
    let mut l = min(n, m);
    let mut r = max(n, m);
    while l > 0 {
        let t = l;
        l = r % l;
        r = t;
    }
    r
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N;
    int cnt = 0;
    while(true)
    {
        if(cnt*cnt > N)
        {
            break;
        }
        else
        {
            cnt++;
        }
    }
    cout << (cnt-1)*(cnt-1) << endl;
}

Measured memory_bytes: 256
#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 n; ll d;
  cin >> n >> d;
  ll ans = 0;
  rep(i,n) {
    ll x, y;
    cin >> x >> y;
    if(x*x + y*y <= d*d) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3668
let N = Int(readLine()!)!
var A = readLine()!.characters.split(" ").map{Int(String($0))!}
let B = readLine()!.characters.split(" ").map{Int(String($0))!}
var ans = 0
for i in 0..<N {
  ans += min(min(A[i],B[i])+A[i+1],B[i])
  A[i+1] -= min(A[i+1],B[i]-min(A[i],B[i]))
}
print(ans)

Measured memory_bytes: 8704
a, b, k = map(int, input().split())

if k > 0 and k >= a:
  k -= a
  a = 0
else:
  a -= k
  k = 0

if k > 0 and k >= b:
  k -= b
  b = 0
else:
  b -= k
  k = 0

print('{} {}'.format(a, b))

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>

////Problem A
using namespace std;

#include <stdio.h>

int main(void){
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int ispoor = 0;
if (a == b && b != c) ispoor = 1;
if (b == c && c != a) ispoor = 1;
if (c == a && a != b) ispoor = 1;

if (ispoor)
{
    puts("Yes");
}
else
{
    puts("No");
}
return 0;
}

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

int main() {
  int A, B, C, D, E, F = 0;
  scanf("%d %d", &A, &B);
  C = A + B;
  D = A - B;
  E = A * B;

  if (C > D && C > E) {
    F = C;
  } else if (D > E) {
    F = D;
  } else {
    F = E;
  }
  printf("%d\n", F);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,k,l,a,b,c,d;
    cin>>a>>b;
    c=0;
    k=a;
    while(k<=b)
    {
        c++;
        k*=2;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256
main = do
  str <- getLine
  let [n, k] = map read (words str) ::[Int]
  str <- getLine
  let listA = take n $ map read (words str) ::[Int]
  print $ 1 + if (n-k) == 0 then 0 else ceiling $ toRational (n-k) / toRational (k-1)
  

Measured memory_bytes: 18812
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <set>

#define DEBUG 0

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(){

	lli n,m;
	cin>>n>>m;
	vector<lli> a;
	map<lli,lli> b;
	lli sum = 0;
	b[0]++;
	for(lli i=0;i<n;i++){
		lli tmp;
		cin>>tmp;
		a.push_back(tmp);
		sum += tmp;

		b[sum%m]++;
	}

	lli ans = 0;

	for(auto itr = b.begin();itr != b.end(); itr++){
		lli cnt = itr->second;
		ans += ((cnt -1)*(cnt)/2);
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 5240
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for comb_a in range(min(int(x / 500), a) + 1):
	current_x = x - comb_a * 500
	for comb_b in range(min(int(current_x / 100), b) + 1):
		current_x = x - comb_a * 500 - comb_b * 100
		if current_x / 50 <= c:
			count += 1
			# print(comb_a, comb_b, int(current_x / 50))

print(count)


Measured memory_bytes: 3060
//Never stop chasing!-MdSourav.
#include <bits/stdc++.h>

#define yes            cout<<"YES"<<endl
#define no             cout<<"NO"<<endl
#define sz(x)          x.size()
#define ll                    long long int
#define ls             long int
#define start          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test           int t;cin>>t;while(t--)
#define f(i, a, n)     for(int i=a; i<n;i++)
#define gcd(a,b)       __gcd(a,b)
#define lcd(a,b)       (a*b)/gcd(a,b)
#define pb             push_back
#define mp(x,y)        make_pair(x,y)
#define rsrt(v)        sort(v.begin(),v.end(),greater<int>())
#define srt(v)         sort(v.begin(),v.end())
#define basrt(a,n)     sort(a,a+n,greater<int>())
#define asrt(a,n)      sort(a,a+n)
#define fact(n)        ll x=1;for(ll i=1;i<=n;i++){x=(x*i);}
#define F              first
#define S              second
#define deb(x)         cout << #x << ": " << x << endl;
#define enter(v,n)     for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define INF 	       1000000007
#define unique(v)      v.erase(unique(v.begin(),v.end()),v.end())
using namespace std;

double pi=3.14159265358979323846;
typedef vector<ll> vll ;
typedef vector<int> vii ;

template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v)
{
    os << '{';
    for (const auto &x : v) os << " " << x;
        return os << '}';
}

void solve()
{
	    int a;
	    cin >>a;
	    int ans=0;
	    ans=ans+a;
	    ans=ans+a*a;
	    ans=ans+a*a*a;
	    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
    ll test_case=1;
   // cin>>test_case ;
    while(test_case--)
	{
		 solve();
	}

	return 0;
}

Measured memory_bytes: 3656
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    let (n, m, d): (f64, f64, f64) = stdin.lock().gets().split(' ').values();

    if d == 0.0 {
        println!("{}", (n - d) / (n * n) * (m - 1.0));
    } else {
        println!("{}", (n - d) * 2.0 / (n * n) * (m - 1.0));
    }
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }

trait Values<T> { fn values(&mut self) -> T; }
impl<'a, I, T1, T2, T3> Values<(T1, T2, T3)> for I
    where I: Iterator<Item=&'a str>,
          T1: std::str::FromStr, T1::Err: std::fmt::Debug,
          T2: std::str::FromStr, T2::Err: std::fmt::Debug,
          T3: std::str::FromStr, T3::Err: std::fmt::Debug {
    fn values(&mut self) -> (T1, T2, T3) {
        (self.next().unwrap().parse().unwrap(),
         self.next().unwrap().parse().unwrap(),
         self.next().unwrap().parse().unwrap())
    }
}


Measured memory_bytes: 4352
from collections import deque

def enqueue(t, x):
    global Qlist
    Qlist[t].appendleft(x)

def front(t):
    global Qlist
    if Qlist[t] != deque():
        print(Qlist[t][-1])

def dequeue(t):
    global Qlist
    if Qlist[t] != deque():
        Qlist[t].pop()


n, q = map(int, input().split())
Qlist =[]
for i in range(n):
    Q = deque()
    Qlist.append(Q)

for j in range(q):
    queryi = list(map(int, input().split()))
    
    if queryi[0] == 0:
        enqueue(queryi[1], queryi[2])

    elif queryi[0] == 1:
        front(queryi[1])

    else: 
        dequeue(queryi[1])


Measured memory_bytes: 14596
w, h, n = map(int, input().split())

x = [0] * n
y = [0] * n
a = [0] * n

for i in range(n):
    x[i], y[i], a[i] = map(int, input().split())

r = w
l = 0
t = h
b = 0

for i in range(n):
    if a[i] == 1 and l < x[i]:
        l = x[i]
    elif a[i] == 2 and r > x[i] :
        r = x[i]
    elif a[i] == 3 and b < y[i]:
        b = y[i]
    elif a[i] == 4 and t > y[i]:
        t = y[i]

area = [[0 for i in range(l, r)] for i in range(b, t)]

area = sum(area, [])

print(area.count(0))


Measured memory_bytes: 38384
// abc136_b
#include <iostream>
#include <sstream>
using namespace std;

int main(void) {
	int N;
	cin >> N;
	int count = 0;
	for (int i = 1; i <= N; i++) {
		ostringstream oss;
		oss << i;
		//cout << oss.str() << endl;
		string str = oss.str().c_str();
		int len = str.length();
		if (len % 2 != 0) {
			count++;
		}
	}
	cout << count << endl;
	return 0;


}

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

int main() {
	string w,t;
	cin >> w;
	int cnt = 0;
	while (1) {
		cin >> t;
		if (t == "END_OF_TEXT") break;
		//transform(t.cbegin(), t.cend(), t.begin(), tolower);
		for (int i = 0; i < t.length(); ++i) {
			t[i] = tolower(t[i]);
		}
		//if (t.find(w) != string::npos)
		//	++cnt;
		if (t == w) ++cnt;
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 3140
class Process1
  @name
  @time
  @endtime

  attr_accessor :name, :time, :endtime

  def initialize(name, time)
    @name = name
    @time = time
  end
end

def main
  line1 = STDIN.gets.chomp.split(" ")
  n = line1[0].to_i
  q = line1[1].to_i

  queue = Array.new(n)
  n.times do |i|
    line = STDIN.gets.chomp.split(" ")
    process = Process1.new(line[0], line[1].to_i)
    queue[i] = process
  end

  time = 0
  processes_ended = Array.new
  while queue.empty? == false
    process = queue.shift
    if process.time > q
      time += q
      process.time -= q
      queue.push(process)
    else
      time += process.time
      process.time -= process.time
      process.endtime = time
      processes_ended.push(process)
    end
  end
  processes_ended.each do |process|
    puts "#{process.name} #{process.endtime}"
  end
end

main

Measured memory_bytes: 15424
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define ld long double
typedef pair<ll,ll> pll;
typedef pair<pll,pll> ppll;
typedef vector <ppll> vi;
#define out(x) return cout<<x,0;
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define lc(n) 2*n+1
#define rc(n) 2*n+2
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

int main() {
    FAST;
    ll n, k, m, z = 0, x = 0, y = 0, ans = 0, j, t = 0, c = 0,i;
    cin >> n ;
    vi v;
    map < pll , bool > mp; 
    for ( i = 0 ; i < n ; i ++ ){
    	cin >> x >> y;
    	v.pb({{x-y , 1} , {x , y}});
    	v.pb({{y+x , 0} , {x , y}});
    	mp[{x-y , y+x}] = 1;
    }
    sort(all(v));
    c = 0;
    y = 0;
    for ( i = 0 ; i < 2*n ; i ++ ){
    	if ( v[i].ff.ss == 1 ) c ++;
    	else if ( mp[{v[i].ss.ff-v[i].ss.ss , v[i].ss.ff+v[i].ss.ss}] == 0 ) continue;
    	else{
    	    if ( c > 0 ){
    	        c --;
    	        ans += c;
    	    }
    	    j = i - 1;
    	    while ( j >= y ){
    	        mp[{v[j].ss.ff-v[j].ss.ss , v[j].ss.ff+v[j].ss.ss}] = 0;
    	        j --;
    	    }
    	    y = i;
    		c = 0;
    	}
    }
    cout << n - ans;
}


Measured memory_bytes: 14696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); 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 (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll MAX_SIZE = 1000005;
array<ll, MAX_SIZE> fac, inv, finv;
void fac_init() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % MOD;
    finv[0] = modpow(fac[MAX_SIZE - 1], MOD - 2, MOD);
    repe(i, 1, MAX_SIZE) finv[i] = finv[i - 1] * (MAX_SIZE - i) % MOD;
    reverse(all(finv));

    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, MOD - 2, MOD);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % MOD; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % MOD * finv[a - b] % MOD; }

int main() {
    init();
    fac_init();
    ll N, M;
    cin >> N >> M;

    if(abs(N-M)>=2){
        cout << 0 << endl;
    }else if(abs(N-M)==1){
        cout << fac[N] * fac[M] % MOD << endl;
    }else{
        cout << fac[N] * fac[M] * 2 % MOD << endl;
    }
}

Measured memory_bytes: 23680
W, H, x, y = map(int, input().split())

# 大きくない方とかって書いてあるけど、別にイコールの場合でもいいんかい！
# 中心の座標を求める
centerX = (W / 2)
centerY = (H / 2)

if ((x, y) == (centerX, centerY)):
    print((W * H) / 2, 1)

else:
    print(W * H / 2, 0)


Measured memory_bytes: 9080
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll n;
	cin>>n;
	if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9)
	{
		cout<<"hon"<<"\n";
	}
	else if(n%10==0 || n%10==1 || n%10== 6 || n%10==8)
	{
		cout<<"pon\n";
	}
	else
	{
		cout<<"bon\n";
	}
	return 0;
}

Measured memory_bytes: 3636
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    int x;
    cin >> x;
    i64 ans = 0;
    ans += x / 500 * 1000;
    x %= 500;
    ans += x / 5 * 5;
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <math.h>

#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
#define ll long long
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;

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

    if(m<2*n){
        cout << m/2 << endl;
    }else{
        cout << n+(m-2*n)/4 << endl;
    }
    return 0;
}

Measured memory_bytes: 256