akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
namespace rng { using namespace boost; using namespace boost::range; }
namespace adp { using namespace boost::adaptors; }

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

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    if (b == 1) {
        cout << 0 << nl;
        return 0;
    }
    ll x = (n >= b) ? b - 1 : n;
    cout << (a * x / b) << nl;
}


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

int main(){
	typedef long long ll;
	ll x,n;
	cin >> x >> n;
	vector<ll>v;
	for(ll i=0;i<n;i++){
		ll t;
		cin >> t;
		v.push_back(t);
	}
	sort(v.begin(),v.end());
	
	if(n==0){
		cout << x;
	}
	else{
		vector<ll>nv;
		
		for(ll i = 0;i<102;i++){
			bool np = true;
			for(ll j=0;j<n;j++){
				if(v[j]==i){
					np = false;
					break;
				}
			}
				if(np!=false)nv.push_back(i);
		}
		
		ll ans = 0;
		ll mini = 100;
		
		for(ll i=0;i<(nv.size());i++){
			if(abs(x-nv[i])<mini){
				mini = abs(x-nv[i]);
				ans = nv[i];
			}
		}
		cout << ans;
	}
}

Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>
#include <functional>
#include <stack>
#include <cmath>
using namespace std;

#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 llong long long

int main() {
  double v;
  while(scanf("%lf",&v) != EOF) {
    double t = v/9.8;
    double d = 4.9*t*t;
    double dover5 = d/5;
    int N = (dover5-(int)dover5 == 0)? (int)dover5+1: (int)dover5+2;
    printf("%d\n", N);
  }
  return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,s1;
    cin>>s;
    cin>>s1;
    int l=s1.length();
    s1.erase(s1.begin()+l-1);
    if(s==s1)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3624
import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		// テキスト入力
		Scanner sc = new Scanner(System.in);
		ArrayList<StringBuilder> one_obj = new ArrayList<StringBuilder>();
		String str_one_word = "";

		
		//
		while (true) {
			StringBuilder one_word = new StringBuilder(str_one_word);
			
			int height = sc.nextInt();
			int width = sc.nextInt();

			if (height == 0 && width == 0) {
				break;
			}

			// 高さ分ループする
			for (int h = 0; h < height; h++) {

				// 幅分ループ
				for (int w = 0; w < width; w++) {

					// 奇数列
					if (h % 2 == 0) {
						// 奇数個目は#
						if (w % 2 == 0) {
							one_word.append("#");
						} else {// 偶数個目は.
							one_word.append(".");
						}

						// 偶数列
					} else {
						// 奇数個目は.
						if (w % 2 == 0) {
							one_word.append(".");
						} else {// 偶数個目は#
							one_word.append("#");
						}
					}
				}
				// 一列が終わったので改行を追加
				one_word.append("\n");
			}

			one_obj.add(one_word);

		}
		for (int index = 0; index < one_obj.size(); index++) {
			System.out.println(one_obj.get(index));
		}
	}

}

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

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,a,n) for(int i=0;i<n;i++)

using namespace std;

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

	vector<int> a(5);
	int min = 10;
	int index = 0;
	for(int i=0;i < 5;i++){
		cin >> a[i];
		if(a[i]%10 < min && a[i]%10 != 0){index = i;min = a[i]%10;}
	}
	int ans = 0;
	for(int i = 4;i >= 0;i--){
		int temp = 	10 - a[i]%10;
		if(temp == 10)temp = 0;
		if(i == index)continue;
		ans += a[i] + temp;
	}
	cout << ans+a[index] << endl;
   
	return 0;
}


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

using namespace std;

int H[101010];
int dp[101010];

int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> H[i];
  }
  dp[0] = 0;
  for (int i = 1; i < N; ++i) {
    int mi = -1, tmp = 0;
    for (int j = 1; j < K + 1; ++j) {
      if (i - j < 0) continue;
      tmp = abs(H[i - j] - H[i]) + dp[i - j];
      if (mi == -1 || mi > tmp) mi = tmp;
    }
    dp[i] = mi;
  }
  cout << dp[N - 1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
    char x[1000];
    int sum,i;
    scanf("%s", &x);
    while(x[0] != '0') {
      sum=0; i=0;
      while(x[i] != '\0')
          sum += x[i++]-'0';
      printf("%d\n", sum);
      scanf("%s", &x);
    }

    return 0;
}




Measured memory_bytes: 2128
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000003;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

typedef bitset<2000> bt;

bt b[2000];

bt le[2000], ri[2000];
void solve() {
	int n; cin >> n;
	rep1(i, n - 1) {
		rep(j, i) {
			char t; cin >> t;
			if (t == '1') {
				b[i][j] = true;
			}
			else {
				b[j][i] = true;
			}
		}
	}
	rep(i, n)le[i][i] = ri[i][i] = true;

	int ans = 0;
	Rep1(i, 2, n) {
		rep(j, n - i + 1) {
			int l = j;
			int r = j + i - 1;
			le[r][l] = (b[l] & ri[l + 1] & le[r]).count();
			ri[l][r] = (b[r] & ri[l] & le[r - 1]).count();
		}
	}
	rep(i, n) {
		if (ri[0][i] && le[n-1][i])ans++;
	}
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n)solve();
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=0,n;
    cin>>n;
    char s[n];
    cin>>s;
    for(int i=0;i<n-2;i++){
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
         t++;
    }
    cout<<t;
    
      
    return 0;
}
     
   




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

class UnionFind:
    def __init__(self, n):
        self.par = [-1 for i in range(n)]
    
    def find_root(self, n):
        if self.par[n] < 0:
            return n
        else:
            self.par[n] = self.find_root(self.par[n])
            return self.par[n]

    def union(self, n_1, n_2):
        par_1 = self.find_root(n_1)
        par_2 = self.find_root(n_2)
        if par_1 == par_2:
            return
        else:
            if self.par[par_1] <= self.par[par_2]:
                self.par[par_1] += self.par[par_2]
                self.par[par_2] = par_1
            else:
                self.par[par_2] += self.par[par_1]
                self.par[par_1] = par_2

if __name__ == "__main__":
    ans = []
    unionfind = UnionFind(N)
    friend = [[] for _ in range(N)]
    for _ in range(M):
        a_i, b_i = map(int, input().split())
        a_i -= 1
        b_i -= 1
        unionfind.union(a_i, b_i)
        friend[a_i].append(b_i)
        friend[b_i].append(a_i)
    block = [[] for _ in range(N)]
    for i in range(K):
        c_i, d_i = map(int, input().split())
        c_i -= 1
        d_i -= 1
        block[c_i].append(d_i)
        block[d_i].append(c_i)
    for i in range(N):
        block_sum = 0
        for block_user in block[i]:
            if unionfind.find_root(i) == unionfind.find_root(block_user):
                block_sum += 1
        ans.append(str(unionfind.par[unionfind.find_root(i)] * -1 -1 - len(friend[i]) - block_sum))
        
    print(" ".join(ans))

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

int main(){
  bool g[21][21];
  int n;
  int x,y;
  while(cin>>n && n){
    int rx=10,ry=10,dx,dy,dxy;
    char ch;
    memset(g,0,sizeof(g));
    for(int i=0;i<n;i++){
      cin>>x>>y;
      g[x][y]=1;
    }
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>ch>>dxy;
      if(ch=='N') { dx=0;dy=1;}
      else if(ch=='E') { dx=1;dy=0;}
      else if(ch=='S') { dx=0;dy=-1;}
      else {dx=-1;dy=0;}
      while(dxy--){rx+=dx;ry+=dy;g[rx][ry]=0;}
    }
    bool f=0;
    for(int i=0;i<21;i++)
      for(int j=0;j<21;j++){
	if(g[i][j]) f=1;
      }
    if(f) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define T int t;cin>>t;while(t--)
#define f(i,n) for (int i=0;i<n;i++)
#define fa(i,a,b) for (int i=a;i<b;i++)
#define b(i,a,b) for (int i=a;i>=b;i--)
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define fi first    
#define se second
#define SZ(x) ((int)(x).size())
#define debug(x) cout<<">"<<#x<<" = "<<x<<endl;
#define MOD 1000000007
#define ce cout<<"\n"


int main()
{
    int a, b,c , f=1;
    cin>>a>>b>>c;
    if(a==b && b!=c || b==c && c!=a || a==c && c!=b)
        cout<<"Yes\n";
    else
        cout<<"No\n";


    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

inline int h(int n){
    return n*(n+1)/2;
}

signed main(){
    int a, b;
    cin >> a >> b;
    cout << h(b - a) - b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> pii;
int main() {
    ll n; cin >> n;
    ll res = n - 1;
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0) res = min(res, i-1 + n/i-1);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
const int N=4e3+5;
using namespace std;

int Turn(char c){
	if(c=='R') return 1;
	if(c=='G') return 2;
	if(c=='B') return 3;
	return 4;
}
long long a[N],n,cnt[4];
char s[N];
int main(){
	
	scanf("%d%s",&n,s);
	for(int i=0;i!=n;++i) a[i+1]=Turn(s[i]);
	for(int i=1;i<=n;++i)
		++cnt[a[i]];
	long long ans=cnt[1]*cnt[2]*cnt[3];
	for(int i=1;i<=n;++i)
	for(int j=i+2;j<=n;++j){
		if(i+j&1) continue;
		if(a[i+j>>1]!=a[i]&&a[i]!=a[j]&&a[j]!=a[i+j>>1])
			--ans;
	}
	printf("%lld\n",ans);
	return 0;	
}

Measured memory_bytes: 3832
/*
 #pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
*/
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")

#define NDEBUG
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <climits>
#include <list>
#include <functional>
#include <numeric>

//find out the use of the below
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define PI acos(-1)

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    fio;
    int n, k, c;
    cin >> n >> k >> c;
    string st;
    cin >> st;
    //lazy, eager
    vector<int> la(k), ea(k);
    int ind = 0;
    for (int i = 0; i < n && ind < k; ++i) {
        if (st[i] == 'o') {
            ea[ind] = i;
            ind++;
            i+=c;
        }
    }
    ind = k-1;
    for (int i = n-1; i>=0 && ind >= 0; --i) {
        if (st[i] == 'o') {
            la[ind] = i;
            ind--;
            i-=c;
        }
    }
    //nxt[i] gives the next 'o' index after i
    vector<int> nxt(n);
    int prev = n+1;
    for (int i = n-1; i>=0; --i) {
        nxt[i] = prev;
        if (st[i] == 'o')
            prev = i;
    }
    int ce = 0;//current eager index
    for (int i = 0; i < n; ++i) {
        if (ce >= k)
            break;
        if (st[i] == 'x')
            continue;
        while (i < ea[ce]) {
            i++;
        }
        if (i == ea[ce]) {
            if (nxt[i] > la[ce]) {
                ce++;
                cout << i+1 << '\n';
            }
        } else if (i > la[ce]){
            ce++;
            i--;
        } 
    }

    return 0;
}
/* BEFORE submitting, check for:
 *  1. Integer overflow
 *  2. Float/Double precision errors
 *  3. Array index out of bounds
 *  4. Edge cases.(n=1, n=max, etc.)
 *  5. Time complexity. No TLEs
 */



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

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll N,M, A, res = 0;
	
	cin >> N >> M;
	while (M--){
		cin >> A;
		res += A;
	}
	if ((N-res) >= 0) cout<< N-res;
	else cout << -1;
}


Measured memory_bytes: 3652
values = []
while True:
    value = input().split()
    if int(value[0]) == 0 and int(value[1]) == 0:
        break
    else:
        values.append(value)

for value in values:
    m = int(value[0])
    n = int(value[1])
    for i in range(m):
        row_output = ""
        for j in range(n):
            row_output += "#" if (i + j) % 2 == 0 else "."
        print(row_output)
    print()



Measured memory_bytes: 5624
#include <iostream>
using namespace std;
int main(){
	int n,s=100000;
	cin>>n;
	for(int i=0;i<n;i++){
		s*=1.05;
		if(s%1000!=0){
			s/=1000;
			s*=1000;
			s+=1000;
		}
	}
	cout<<s<<endl;
	cin>>n;
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <string>
#include <cctype>
#include <map>
using namespace std;
  
map<char, char> sym;
  
void init() {
  sym['i'] = 'i';
  sym['w'] = 'w';
  sym['('] = ')';
  sym[')'] = '(';
}
  
int main() {
  init();
    
  string str;
  getline(cin, str);
    
  int n = str.size();
  int cnt = 0;
  for(int i=0; i<n/2+1; i++) {
    if(sym[str[i]] != str[n-i-1]) cnt ++;
    str[n-i-1] = sym[str[i]];
  }
  cout << cnt << endl;
    
  return 0;
}

Measured memory_bytes: 1180
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

template<typename ty> bool Chkmax(ty &x, const ty &y) { return x < y ? x = y, 1 : 0; }
template<typename ty> bool Chkmin(ty &x, const ty &y) { return x > y ? x = y, 1 : 0; }

const int maxn = 3e3 + 10;

string Solve(string s)
{
	vector<int> ida, idb, pos, id;
	for (int i = 0; i < s.size(); ++ i)
	{
		if (s[i] == 'a') ida.push_back(i);
		else idb.push_back(i);
	}
	for (int i = 0, ta = 0, tb = 0; i < s.size(); ++ i)
	{
		if (s[i] == 'a')
		{
			id.push_back(ta);
			pos.push_back(idb[ta ++]);
		}
		else
		{
			id.push_back(tb);
			pos.push_back(ida[tb ++]);
		}
	}
	string res = "";
	if (s[0] == 'a')
	{
		for (int i = 0; i < s.size(); ++ i)
		{
			if (s[i] == 'a')
			{
				res += "ab";
				i = pos[i];
			}
		}
	}
	else
	{
		for (int i = ida.size() - 1; ~ i; -- i)
		{
			string t;
			for (int j = 0; j < s.size(); ++ j)
			{
				if (id[j] >= i) t.push_back(s[j]);
			}
			if (t > res) res = t;
		}
	}
	return res;
}

string f[maxn];

int main()
{
	int n;
	cin >> n;
	string s, t;
	cin >> s;
	vector<string> a;
	for (int i = 0, j = 0; i < s.size(); ++ i)
	{
		t.push_back(s[i]);
		if (s[i] == 'a') ++ j; else -- j;
		if (!j)
		{
			a.push_back(Solve(t));
			t.clear();
		}
	}
	string ans = "";
	for (int i = a.size() - 1; ~ i; -- i)
	{
		f[i] = a[i];
		for (int j = i + 1; j < a.size(); ++ j)
		{
			Chkmax(f[i], a[i] + f[j]);
		}
		Chkmax(ans, f[i]);
	}
	cout << ans << endl;
	return 0;
}


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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VC vector<char>
#define FOREACH(x,a) for(auto& (x) : (a) )
using namespace std;

int main() {
	int n, x;
	cin >> n >> x;
	int m = 10000;
	REP(i, n) {
		int a;
		cin >> a;
		x -= a;
		m = min(m, a);
	}
	cout << n + (x / m) << endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(dead_code, unused_variables)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize;n],
    }

    let mut cnt = vec![0;3];
    for i in 0..n{
        let id = a[i] -1;
        cnt[id] += 1;
    }
    let mut dp = vec![vec![vec![0.0;n+10];n+10];n+10];

    for k in 0..=n{
        for j in 0..=n-k{
            for i in 0..=n-j-k{
                let mut tmp = 0.0;
                if i == 0 && j == 0 && k == 0{
                    continue;
                }
                if i != 0{
                    tmp += dp[i-1][j][k] * (i as f64);
                }
                if j != 0{
                    tmp += dp[i+1][j-1][k] * (j as f64);
                }
                if k != 0{
                    tmp += dp[i][j+1][k-1] * (k as f64);
                }

                tmp += n as f64;
                tmp /= (i+j+k) as f64;
                dp[i][j][k] = tmp;
            }
        }
    }

    println!("{:.10}",dp[cnt[0]][cnt[1]][cnt[2]]);
}


Measured memory_bytes: 238604
// amigos y no más
// dile a la jardinera que traigo flores
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define MOD 998244353LL
#define LIM 262150
 
using namespace std;
 
typedef long long ll ;
 
int a,b,c;

int main() {
	fastio;
	cin>>a>>b>>c;

	if(a+b+c >= 22 )cout<<"bust";
	else  cout<<"win";
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    while (a > 0 && c > 0) {


    c -= b;
    if (c <= 0) {
        cout << "Yes";
        break;
    }
    a -= d;
    if (a <= 0) {
        cout <<"No";
        break;

    }



    }

return 0;

}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

#define INF 1e6

using namespace std;

//-------------------------------------------------
//--Segment tree
//-------------------------------------------------
template<typename T>
class SegmentTree
{
private:
    using F = function<T(T,T)>;
    ::std::vector<T> btree;
    F f, _update;
    T e;
    int n;
public:
    SegmentTree(int _n, F f, T e, F g=[](T a,T b){return b;})
         : f(f),e(e),_update(g)
    {
        init(_n);
    }
    SegmentTree(const ::std::vector<T> &v, F f, T e, F g=[](T a,T b){return b;})
         : f(f),e(e),_update(g)
    {
        int _n = v.size();
        init(_n);
        for(int i=0; i<_n; i++) btree[i+n-1] = v[i];
        build();
    }
    void init(int _n){
        n = 1;
        while(_n>n) n<<=1;
        btree.resize(2*n-1, e);
    }
    void build(){
        for(int i=n-2; i>=0; i--) btree[i] = f(btree[2*i+1], btree[2*i+2]);
    }
    void update(int k, T a){
        k += n-1;
        btree[k] = _update(btree[k], a);
        while(k>0){
            --k>>=1;
            btree[k] = f(btree[2*k+1], btree[2*k+2]);
        }
    }
    T query(int a, int b){
        T L=e, R=e;
        a+=n-1; b+=n-1;
        while(a<b){
            if (!(a & 1)) L=f(L, btree[a++]);
            if (!(b & 1)) R=f(btree[--b], R);
            a>>=1; b>>=1;
        }
        return f(L, R);
    }
    T operator[](int k){return btree[k+n-1];}
};

//-------------------------------------------------

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

    SegmentTree<int> seg(n+1, [](int x,int y){return min(x,y);}, INF);
    seg.update(n, 0);
    for(int i=n-1; i>=0; i--){
        if (s[i]=='1') continue;
        int upd = seg.query(i+1, min(i+m+1, n+1)) + 1;
        seg.update(i, upd);
    }
    if (seg[0]>=INF){
        cout<<"-1\n";
        return 0;
    }
    int x = seg[0], idx=0;
    for(int i=0; i<=n; i++){
        if (seg[i]==x-1){
            cout << i-idx << " ";
            idx = i; x--;
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1744
# vim: fileencoding=utf-8


def main():
    n, x = map(int, input().split())
    li = list(map(int, input().split()))
    li.sort()
    ans = 0
    for i in range(len(li)):
        x = x - li[i]
        if x < 0:
            break
        ans += 1
    if x > 0:
        ans -= 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61904
import sys
input = sys.stdin.readline
tuples = ("A", "C", "G", "T")
def print_ans(B):
    """Test Case
    >>> print_ans("ATCODER")
    3
    >>> print_ans("HATAGAYA")
    5
    >>> print_ans("SHINJUKU")
    0
    """
    max_len = 0
    tmp = 0
    for b in B:
        if b in tuples:
            tmp += 1
            max_len = max(max_len, tmp)
        else:
            tmp = 0
    print(max_len)

    

if __name__ == '__main__':
    B = input().rstrip()
    print_ans(B)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(void){
	int a,b;
	while(1){
		int max=-1;
		char c[5];
		c[0]= 'A';
		c[1]= 'B';
		c[2]= 'C';
		c[3]= 'D';
		c[4]= 'E';
		int maxchar=0;
		
		for(int i=0;i<5;i++){
					cin >> a >> b;
			if(a == 0  && b == 0) break;
			else if(max < a+b){
				max =a+b;
				maxchar=i;
			}
		}
			if(a == 0 && b ==0) break;
		cout << c[maxchar] << " " << max <<endl;
				
	}
		
		}

Measured memory_bytes: 1160
hyo=[list(map(int,input().split())) for i in range(3)]
a=[]
b=[]
for i in range(3):
    a.append(hyo[i][0]-hyo[i][1])
    b.append(hyo[i][0]-hyo[i][2])
if len(set(a))==1 and len(set(b))==1:print("Yes")
else:print("No")
        

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int main()
{
    int n,d,x,a[110],sum=0;
    cin>>n>>d>>x;
    REP(i,n)cin>>a[i];
    REP(i,n)sum+=(d-1)/a[i]+1;
    cout<<sum+x<<endl;
}

Measured memory_bytes: 256
class Dice():
    def __init__(self):
        self.num = [0 for _ in range(6)]
    
    def set_num(self, n0, n1, n2, n3, n4, n5):
        self.num[0] = n0
        self.num[1] = n1
        self.num[2] = n2
        self.num[3] = n3
        self.num[4] = n4
        self.num[5] = n5
    
    def roll(self, order):
        tmp = self.num.copy()
        
        if order == "N":
            self.set_num(tmp[1], tmp[5], tmp[2], tmp[3], tmp[0], tmp[4])
        elif order == "S":
            self.set_num(tmp[4], tmp[0], tmp[2], tmp[3], tmp[5], tmp[1])
        elif order == "E":
            self.set_num(tmp[3], tmp[1], tmp[0], tmp[5], tmp[4], tmp[2])
        elif order == "W":
            self.set_num(tmp[2], tmp[1], tmp[5], tmp[0], tmp[4], tmp[3])
        elif order == "rot_Clock":
            self.set_num(tmp[0], tmp[2], tmp[4], tmp[1], tmp[3], tmp[5])
        else:
            print("Error: 不正な入力です")

    def get_top_num(self):
        return self.num[0]
        
    
# Input)()
init_num = [int(_) for _ in input().split()]
n_question = int(input())

# Main 
dice = Dice()
dice.set_num(init_num[0], init_num[1], init_num[2], init_num[3], init_num[4], init_num[5])


for i in range(n_question):
    n_top, n_front = map(int, input().split())
    index_n_top = dice.num.index(n_top)
    index_n_front = dice.num.index(n_front)
    
    # print(f"(Init{i}) n_top: {n_top}, n_front: {n_front}")
    # print(f"(Init{i}) dice: {dice.num}")
    # print(f"(Init{i}) index_n_top: {index_n_top}, index_n_front: {index_n_front}")
    # print()
    
    while index_n_top != 0:
        if index_n_top in [0, 1, 4, 5]:
            dice.roll("N")
            index_n_top = dice.num.index(n_top)
            index_n_front = dice.num.index(n_front)
            # print("roll N")
            # print(f"-> index_n_top: {index_n_top}, index_n_front: {index_n_front}")
        else:
            dice.roll("E")
            index_n_top = dice.num.index(n_top)
            index_n_front = dice.num.index(n_front)
            # print("roll E")
            # print(f"-> index_n_top: {index_n_top}, index_n_front: {index_n_front}")
            
    while index_n_front != 1:
            dice.roll("rot_Clock")
            index_n_top = dice.num.index(n_top)
            index_n_front = dice.num.index(n_front)
            # print("roll C")
            # print(f"-> index_n_top: {index_n_top}, index_n_front: {index_n_front}")                
                
    print(dice.num[2])


Measured memory_bytes: 5624
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

template<typename Val, typename Cmp = less<Val> >
struct MonotonicQueue {
	vector<pair<Val, int>> q;
	int head, tail;
	Cmp cmp;
	MonotonicQueue(Cmp cmp = Cmp()) : cmp(cmp) {}
	void init(int n) {
		q.resize(n);
		clear();
	}
	bool empty() const { return head == tail; }
	void clear() {
		head = tail = 0;
	}
	void enque(int i, Val x) {
		while(head < tail && cmp(x, q[tail - 1].first))
			-- tail;
		q[tail ++] = make_pair(x, i);
	}
	void deque(int i) {
		if(head < tail && q[head].second == i)
			++ head;
	}
	Val get() const {
		return q[head].first;
	}
};

int main() {
	int N; int M; int K;
	while(~scanf("%d%d%d", &N, &M, &K)) {
		vector<int> A(N);
		for(int i = 0; i < N; ++ i)
			scanf("%d", &A[i]);
		vector<ll> dp(N);
		rep(i, N)
			dp[i] = A[i];
		rer(k, 2, K) {
			MonotonicQueue<ll, greater<ll>> mq;
			mq.init(N);
			reu(i, k - 2, N) {
				ll x = dp[i];
				mq.deque(i - M - 1);
				if(k - 2 < i)
					dp[i] = (ll)k * A[i] + mq.get();
				mq.enque(i, x);
			}
		}
		ll ans = *max_element(dp.begin(), dp.end());
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 2944
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"
)

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	reader = os.Stdin
	writer = os.Stdout
	run()
}

func run() {
	r := readFloatsFromStdin()[0][0]

	area := r * r * math.Pi
	circumference := r * 2 * math.Pi

	results := make([]string, 2)
	results[0] = strconv.FormatFloat(area, 'f', 6, 64)
	results[1] = strconv.FormatFloat(circumference, 'f', 6, 64)

	fmt.Fprintln(writer, strings.Join(results, " "))
}

// readFloatsFromStdin parses lines of inputs into 2D float64 array.
func readFloatsFromStdin() [][]float64 {
	out := [][]float64{}
	scanner := bufio.NewScanner(reader)

	for scanner.Scan() {
		var floats []float64

		for _, s := range strings.Split(scanner.Text(), " ") {
			i, err := strconv.ParseFloat(s, 64)

			if err != nil {
				fmt.Fprintln(os.Stderr, "Failed to parse string into float64.\n", err)
				os.Exit(1)
			}

			floats = append(floats, i)
		}

		out = append(out, floats)
	}

	return out
}



Measured memory_bytes: 1132
#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i = 0; i < n; i++){
		scanf("%d",&a[i]);
	}
	for(int i = n - 1; i >= 0; i--){
		if(i != 0) {
			printf("%d ",a[i]);
		}
		else{
			printf("%d",a[i]);
		}
	}
	printf("\n");
	return 0;
}



Measured memory_bytes: 2704
#include<stdio.h>
int main(void)
{
    int count=0;
    char s[10];
    scanf("%s",s);
    if(s[0]=='1')
        count++;
    if(s[1]=='1')
        count++;
    if(s[2]=='1')
        count++; 
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    string s; cin >> s;
    vector<string> day = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    REP(i, day.size()){
        if(s == day[i]) cout << 7 - i << endl;
    }
}

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

int main() {
   string s;
   cin >> s;

   int cnt = 0;
   int n = s.size();
   for (int i = 1; i< n; i++) {
      if (s[i-1] != s[i]) cnt++;
   }

   cout << cnt << endl;

   return 0;
}

Measured memory_bytes: 512
N,K=map(int,input().split())
A=[int(x) for x in input().split()]

#最後に（白か黒か）塗るKマスの位置を求める。
#重要なのは該当部分以外はKマスの制約を考えなくて良いこと。i->i+K-1マス黒く塗った後にi+1->i+Kマス白く塗れば独立する

#plは当該区間の正の総和、maは当該区間の負の総和。
#最後に選ぶ連続するK個は以下の条件を満たすK個
#黒く塗ると仮定すると損をする値（ma）と白く塗る場合損をする値（pl)のminをとり、その最小値区間(reで記録)。
pl=0
ma=0
re=0

#まずは０を起点とするK個の情報を記録。その後、始点と追加点を加減しながらO(N)で求める
for i in range(K):
  if A[i] >= 0:
    pl+=A[i]
  else:
    ma+=(-A[i])
re=min(pl,ma)

for i in range(1,N-K+1):
  if A[i-1] >= 0:
    pl-=A[i-1]
  else:
    ma+=A[i-1]
  if A[i+K-1]>=0:
    pl+=A[i+K-1]
  else:
    ma+=(-A[i+K-1])
  if min(pl,ma) < re:
    re=min(pl,ma)
    
#最後に塗るK以外の区間は自由に塗る。
#最後に塗るKの区間は黒く塗る場合でも白く塗る場合でも、結果に影響するのは(-re)分のみ。
ans=0
for i in range(N):
  ans+=max(0,A[i])
    
print(ans-re)

Measured memory_bytes: 14392
#include <iostream>
#include<iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout<< "YES"<<endl;
#define No cout<< "No"<<endl;
#define Yes cout<< "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define space ' '
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 100000;

bool IsPrime (ll n)
{
    ll i;
 
    if (n < 2)
        return 0;
    else if (n == 2)
        return 1;
 
    if (n % 2 == 0)
        return 0;
 
    for (i = 3; i <= n / i; i += 2)
         if (n % i == 0)
            return 0;
    return 1;
}

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

int main(){
    
    ll a,b;
    ll ans=1;
    ll G;
    cin >> a>>b;
    G = gcd(min(a,b),max(a,b));
    
    for(ll i=1;i*i<=G;i++){
        if(G%i==0){
            ll q = G/i;
            if(IsPrime(i))ans++;
            if(i!=q&&IsPrime(q))ans++;
        }
    }

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


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n, m := nextInt(), nextInt()
	a := make([]int, n)
	ac, wa := 0, 0
	for i := 0; i < m; i++ {
		p := nextInt()
		s := next()

		if a[p-1] == -1 {
			continue
		}
		if s == "WA" {
			a[p-1]++
		} else {
			ac++
			wa += a[p-1]
			a[p-1] = -1
		}
	}

	fmt.Println(ac, wa)
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
long long ans;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long long N, D, A;
    cin >> N >> D >> A;
    vector<pair<long long, long long> > XH(N);
    for (auto & xh : XH) {
        cin >> xh.first >> xh.second;
    }
    sort(XH.begin(), XH.end());
    vector<pair<long long, long long> > v;
    long long tmp = 0;
    for (int i = 0, j = 0; i < N; ++i) {
        while (D*2+XH[j].first < XH[i].first) {
            if (XH[j].second > 0) tmp -= XH[j].second;
            ++j;
        }
        if ((XH[i].second -= tmp) > 0) {
            long long cnt = (A + XH[i].second - 1) / A, damage = cnt*A;
            ans += cnt;
            tmp += damage;
            XH[i].second = damage;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3456
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int dp[5][3010];
 
signed main() {
    int N, Y; cin >> N >> Y;
    repq(x,0,N) repq(y,0,N-x) {
        int z = N - x - y;
        if(10000 * x + 5000 * y + 1000 * z == Y) {
            printf("%lld %lld %lld\n", x, y, z);
            return 0;
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env pypy3

#import numpy as np
#import scipy, scipy.special

# Python 3 modules: https://docs.python.org/3/library/

import math, itertools, operator
from math import *
from math import factorial as fact
from itertools import permutations, combinations
from functools import reduce
# Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
# Before Python 3.5
from fractions import gcd

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(inp = input, sep = ' ', conv = int):
    return map(conv, inp().split(sep = sep))

################################################################################

N, M = input_ints()
L, R = input_ints()
for i in range(M - 1):
    l, r = input_ints()
    L = max(L, l)
    R = min(R, r)
print(max(R - L + 1, 0))


Measured memory_bytes: 5120
def main():
    x,y,z,k = map(int,input().split())
    lia = sorted(list(map(int,input().split())))
    lib = sorted(list(map(int,input().split())))
    lic = sorted(list(map(int,input().split())))

    li2 = sorted(list(a+b for a in lia for b in lib),reverse = True)[:k]
    li3 = sorted(list(ab + c for ab in li2 for c in lic),reverse = True)[:k]

    print('\n'.join(map(str,li3)))

main()


Measured memory_bytes: 187576
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solver();
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		long ans = 1L << 60;

		for (int i = -100; i <= 100; i++) {
			long tmp = 0;
			for (int j = 0; j < n; j++) {
				tmp += (a[j] - i) * (a[j] - i);
			}
			ans=Math.min(ans, tmp);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 9676
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> p(N,K-Q);
  vector<int> a(Q);
  for(int i = 0; i< Q; i++){
    cin >> a.at(i);
  }
  for(int i = 0; i<Q; i++){
    int j = a.at(i)-1;
    p.at(j)++;
  }
  for(int i= 0;i<N; i++){
  if(p.at(i)>0) cout <<"Yes" << endl;
  else cout << "No" << endl;
}
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll h,w,n,r,c;
  cin >> h >> w >> n;
  set<pair<ll,ll>> vu;
  vector<ll> cnt(10);
  cnt[0] = (h-2)*(w-2);
  while(n--){
    cin >> r >> c;
    --r;
    --c;
    vu.emplace(r,c);
    for(ll x = max(0ll,r-2); x <= min(h-3,r); ++x){
      for(ll y = max(0ll,c-2); y <= min(w-3,c); ++y){
        int tmp = 0;
        for(ll i = x; i < x+3; ++i){
          for(ll j = y; j < y+3; ++j){
            if(vu.count(make_pair(i,j))) ++tmp;
          }
        }
        ++cnt[tmp];
        --cnt[tmp-1];
      }
    }
  }
  for(ll i : cnt) cout << i << '\n';
  return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define RREP(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sz(x) ((int)(x).size())
#define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define fs first
#define sc second

#define MOD 1000000007
#define INF 1LL<<55

#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)

using namespace std;

using ll = long long;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pll = P<ll,ll>;
using Pdd = P<double,double>;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<ll>;
using Vs = V<string>;

template<typename T1,typename T2> using M = map< T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

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

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

// please declaration dx[8], dy[8]
#define DX {-1,0,1,0,-1,-1,1,1}
#define DY {0,-1,0,1,-1,1,1,-1}
#define DX2 {-1,0,1,0}
#define DY2 {0,-1,0,1}


ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}// 最大公約数
ll lcm(ll a,ll b){return a*b/gcd(a,b);}// 最大公倍数
int factorial(int n){if(n > 1)return n * factorial(n - 1);else return 1;} // 階乗
struct io{io(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}io;// io 高速化

signed main() {
  ll n;
  in(n);
  if (n % 2 == 0) {
    out(n / 2.0 / n);
  } else {
    out((n + 1) / 2.0 / n);
  }

  return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author wnqmw
 */
public class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader kb = new BufferedReader(new InputStreamReader(System.in));
        
        double dim = Double.parseDouble(kb.readLine());
        
        double side = dim/3;
        System.out.println(Math.pow(side, 3));
    }
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,K,q,b;
  cin >>n>>K>>q;
  vector<int>A(n,K-q);
  for(int i=0;i<q;i++){
    cin>>b;
    A[b-1]+=1;
  }
  for(int i=0;i<n;i++){
    if(A[i]>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

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

int main(){
    int k,x;
    cin >> k >> x;
    for(int i = x - k + 1; i <= x + k -1; ++i){
        cout << i << endl;
    }
    
    return 0;
}

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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 13;

int g, p;
string s;

int main()
{
	cin >> s;
	
	int res = 0;
	for (int i = 0; i < s.size(); i ++ )
		if (p + 1 <= g)
		{
			p ++ ;
			if (s[i] == 'g') res ++ ;
		}
		else
		{
			g ++ ;
			if (s[i] == 'p') res -- ;
		}
	cout << res << endl;
	return 0;
}

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


int main(void)
{
  int a, b, x, y, z, i=0;

  while(scanf("%d %d", &a, &b) != EOF)
  {

   i = 0;

  if(a != 0 || b != 0)
  {
    if(a >= b)
    {
      x = a;
      y = b;
    }

    else
    {
      x = b;
      y = a;
    }

  do{
      x = x%y;
      z = x;
      x = y;
      y = z;
      i++;
     }while(y!=0);

  printf("%d %d\n", x, i);
  }
  }

  return 0;
}



Measured memory_bytes: 3128
#include <iostream>

using namespace std;

int main(){
  int n;
  while(true){
    cin>>n;
    if(!n)break;
    int seq[n];
    for(int i=0;i<n;i++)
      cin>>seq[i];
    int max = -1e9;
    for(int i=0;i<n;i++){
	int sum = 0;
      for(int j=i;j<n;j++){
	  sum+=seq[j];
	if(sum>max)max = sum;
      }
    }
    cout << max << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int k = in.nextInt();
			long[] an = new long[n+1];
			for (int i = 1; i < n + 1; i++) {
				an[i] = in.nextLong();
			}

			long[] rui = new long[n+1];
			if (an[1] > 0) {
				rui[1] = an[1];
			}
			for (int i = 2; i < n + 1; i++) {
				if (an[i] > 0) {
					rui[i] += rui[i-1]+an[i];
				} else {
					rui[i] += rui[i-1];
				}
			}

			long ans = 0;
			for (int i = 1; i <= n + 1 - k; i++) {
				long tmp = 0;
				tmp += rui[i-1] - rui[0];
				tmp += rui[n] - rui[i+k-1];

				long inside = 0;
				for (int j = i; j < i + k; j++) {
					inside += an[j];
				}
				if (inside > 0) {
					tmp += inside;
				}
				ans = Math.max(ans, tmp);
			}
			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 44112
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
for i in range(N):
    A.append(list(map(int, input().split())))

ans = 0
for i in range(N):
    sum = 0 
    for j in range(M):
        sum += A[i][j] * B[j]
    if sum + C > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3064