akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define MorsheD ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
typedef long long ll;

const int sz = 1e5 + 5;
int ara[sz], dp[sz];

int solve(int src, int dest, int k) {
    if (src == dest - 1)
        return 0;

    if (dp[src] != -1)
        return dp[src];

    int ans = INT_MAX;
    for (int i = 1; i <= k; i++) {
        if (src + i < dest) {
            ans = min(ans, abs(ara[src] - ara[src + i]) + solve(src + i, dest, k));
        }
    }
    return dp[src] = ans;
}

int main(){
    // ===================
    MorsheD;
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // ===================

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

    memset(dp, -1, sizeof(dp));

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

    cout << solve(0, n, k) << "\n";

    return 0;
}


Measured memory_bytes: 12156
#include <stdio.h>

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


Measured memory_bytes: 2104
package main

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

func main() {
	sc := NewScanner()

	s := sc.ReadString()

	if s == "ABC" {
		fmt.Println("ARC")
	} else {
		fmt.Println("ABC")
	}
}

// util
// *   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

// *   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1756
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	S := nextLine()
	cnt := make(map[rune]int)
	for _, v := range S {
		cnt[v]++
	}
	if len(cnt) <= 2 {
		for _, v := range cnt {
			if v > 1 {
				fmt.Println("NO")
				return
			}
		}
	}
	max := 0
	min := int(1e5) + 7
	for _, v := range cnt {
		max = MaxOf(max, v)
		min = MinOf(min, v)
	}
	if max-min <= 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
	// fmt.Println(cnt)
}

func nextLine() 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 abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 2008
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
    if(x>y)return x;
    else return y;
}
ll min(ll x,ll y){
    if(x<y)return x;
    else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
    
    ll n;cin >> n;
    vector<ll> xs(n),ys(n);
    rep(i,n){
        ll x,y;cin >> x >> y;
        xs[i]= x+y;
        ys[i]= x-y;
    }
    sort(xs.begin(),xs.end());
    sort(ys.begin(),ys.end());
    cout << max(abs(xs[n-1]-xs[0]) , abs(ys[n-1] - ys[0])) << endl;
}

Measured memory_bytes: 6312
# -*- coding: utf-8 -*-


def comb(N, A):
    x = 1
    for i in range(A):
        x *= N
        N -= 1
        x %= MOD
    y = 1
    for i in range(A):
        y *= A
        A -= 1
        y %= MOD
    return x*pow(y, MOD-2, MOD) % MOD


N, A, B = map(int, input().split())
MOD = 10**9+7
print((pow(2, N, MOD)-1-comb(N, A)-comb(N, B)+MOD) % MOD)


Measured memory_bytes: 38640
#include<stdio.h>
int main(){
	int n, r, i, p, c, q, j;
	int card[50], t[50];
	while(1){
		scanf("%d %d", &n, &r);
		if((n == 0)&&(r == 0))
			break;
		else{
			for(i=0; i<n; i++)
				card[i]=n-i;
			for(j=0; j<r; j++){
				scanf("%d %d", &p, &c);
				q = p;
				for(i=0; i<(p-1);i++){
					t[i] = card[i];					
				}
				for(i=0; i<c; i++){
					card[i] = card[q-1];
					q++;
				}
				for(i=0; i<(p-1); i++){
					card[c]=t[i];
					c++;
				}
			}
		}
		printf("%d\n", card[0]);
	}
	return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <iostream>
using namespace std;
int n;
int pt,px,py,t,x,y;
int main(void){
    cin >> n;
    pt = px = py = 0;
    for(int i=1;i<=n;i++){
        cin >> t >> x >> y;
        if(t - pt < abs(px-x) + abs(py-y)){cout << "No"; return 0;}
        if((t - pt - abs(px-x) + abs(py-y)) % 2 != 0){cout << "No"; return 0;}
        px = x;
        py = y;
        pt = t;
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
list_row1= list(map(int, input().split()))
list_row2= list(map(int, input().split()))
list_row3= list(map(int, input().split()))
N = int(input())
list_b = []
for i in range(N):
    list_b.append(int(input()))
list_col1 = [list_row1[0], list_row2[0], list_row3[0]]
list_col2 = [list_row1[1], list_row2[1], list_row3[1]]
list_col3 = [list_row1[2], list_row2[2], list_row3[2]]
list_sla1 = [list_row1[0], list_row2[1], list_row3[2]]
list_sla2 = [list_row1[2], list_row2[1], list_row3[0]]
bingo_list = [list_row1, list_row2, list_row3, list_col1, list_col2, list_col3, list_sla1, list_sla2]
for lists in bingo_list:
    cnt = 0
    for i in range(3):
        if lists[i] in list_b:
            cnt += 1
    if cnt == 3:
        print("Yes")
        break
else:
    print("No")

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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int area=1;
		int length=0;
		int num = scan.nextInt();
		System.out.println(num/3600+":"+num%3600/60+":"+num%60);
	}
}

Measured memory_bytes: 17164
/* The journey is what brings us pleasure, not the destination <3 */

#include<bits/stdc++.h>

#define PI acos(-1)
#define _fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MOD 1000000007
#define MAX 1000000
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;

int tc;

void solve(){

    ll a,b,c,d,ans;
    cin>>a>>b>>c>>d;
    ans=a*c;
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
    cout<<ans<<endl;

}

int main(){

    _fastIO;

    //cin>>tc; while(tc--)
    solve();

    return 0;
}


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

using namespace std;

int rev(string a, int n){
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(a[i] != a[n-i-1]){
            ans = 1;
        }
    }
    return ans;
}

int main(){
    string a;
    
    cin >> a;
    int n = a.length();

    if(rev(a,n) == 0 && rev(a,((n-1)/2)) == 0){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,k;
ll a[100005];
ll dp[100005];
ll ans(ll index){
    if(index == (n-1)){
        return 0;
    }
    if(dp[index] != -1){
        return dp[index];
    }
    ll maxx = 1e10;
    for(ll i=index+1;i<=min(index+k,n-1);i++){
        maxx = min(maxx, ans(i) + abs(a[index] - a[i]));
    }
    
    return dp[index] = maxx;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<ans(0)<<"\n";
    
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n;
	double ans = 0.0, a;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		ans += 1.0 / a;
	}
	ans = 1.0 / ans;
	cout << ans << endl;
}

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

//void DFS(vector<int> adj[], int dis[], int s, bool vis[])
//{
//    vis[s]=true;
//    //cout<<s<<"  ";
//
//    for(int u:adj[s])
//    {
//        if(vis[u]==false)
//        {
//
//            dis[u]=max(dis[u], dis[s]+1);
//            //cout<<"\n"<<dis[u]<<"==";
//            DFS(adj,dis,u,vis);
//
//        }
//    }
//
//}

//vector<int> topological(vector<int> adj[], int s, vector<bool> &vis)
//{
//    vector<int> top;
//    queue<int> q;
//    q.push(s);
//
//    while(!q.empty())
//    {
//        int tp=q.front(); q.pop();
//        vis[tp]=true;
//        top.push_back(tp);
//
//        for(int u:adj[tp])
//        {
//            if(vis[u]==false)
//                q.push(u);
//        }
//
//    }
//}

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

    int n,e;
    cin>>n>>e;
    vector<int> adj[n+1];

    int indegree[n+1];
    memset(indegree,0,sizeof(indegree));

    while(e--)
    {
        int u,v; cin>>u>>v;
        adj[u].push_back(v);
        indegree[v]++;
    }

    int dis[n+1];

    for(int i=0;i<=n;i++)  dis[i]=INT_MIN;

    bool vis[n+1];
    memset(vis,false,sizeof(vis));

    queue<int> q;

    for(int i=1;i<=n;i++)
    {
        if(indegree[i]==0){
            q.push(i);
            dis[i]=0;
        }
    }

    while(!q.empty())
    {
        int tp=q.front(); q.pop();
        vis[tp]=true;

        for(int u:adj[tp])
        {
            indegree[u]--;
            if(indegree[u]==0 && vis[u]==false)
            {
                dis[u]=max(dis[u], dis[tp]+1);
                q.push(u);
            }

        }

    }


    //for(int x:dis) cout<<x<<" ";

    cout<<*max_element(dis+1,dis+n+1);

    return 0;
}


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

int main(){
  string s;
  char t;
  cin>>s;
  for(int i=0;i<s.length();i++){
    t=s[i];
    for(int k=i+1;k<s.length();k++){
      if(t==s[k]){cout<<"no"<<endl; return 0;}
    }
  }
  
  cout<<"yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
typedef long long ll;

int main (){
	/* n , k < 10^5
	  n以下の整数3つの組み合わせで任意の2つをとったときにKの倍数になっている→
	  2(a+b+c)がKの倍数になってて、kが奇数のときには、
	  a+b+cはkの倍数で、その2つの組み合わせがkの倍数だから、すべてkの倍数であるはず。
	  kが偶数の場合、a+b+cはk/2の倍数。
	  すべてが a%k = k/2を満たすか、
	  すべてが a%k = 0
	  を満たさないとだめ？

	  n以下のkの倍数をリストアップ、
	  kが偶数であれば、k/2を加えたリストも作成。
	  今、kが奇数なら、組み合わせはkの倍数の数^3になる？　→これは正しそう
	  kが偶数の時を考える。まずは、同様にしてkの倍数^3はこれを満たす、
	  更にk/2のリストからとっても良いので、これの^3を足せば良さそう
	*/
	ll NN, KK;
	ll length = 0;
	ll length2 = 0;
	ll ans = 0;
	cin >> NN >> KK;
	// KKのほうがでかいとき、2合わせて2KKになることはない。
	if (KK > NN){
		if(KK%2==0 && NN*2>= KK){
			cout << 1 << endl;
		}
		else {
			cout << 0 << endl;
		}
		return 0;
	}

	// NNの方が大きかった場合
	if(KK % 2 == 1){
		length = (NN-NN%KK)/KK;
		ans = length * length * length;
	}else {
		length = (NN-NN%KK)/KK;
		length2 = (NN-NN%(KK/2))/(KK/2) - length ;
		ans = length * length * length + length2 * length2 * length2;
	}
	cout  << ans << endl;
	return 0;	
}


Measured memory_bytes: 256
N,Q = map(int,input().split())
G = [[] for _ in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

counter = [0]*N
for i in range(Q):
    p,x = map(int,input().split())
    counter[p-1] += x

from collections import deque
visited = [-1]*N
q = deque()
q.append(0)

while q:
    cur = q.popleft()
    visited[cur] = 0
    for nx in G[cur]:
        if visited[nx] != -1: continue
        counter[nx] += counter[cur]
        q.append(nx)

print(*counter)







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

long long llmin(long long a, long long b){return a > b ? b : a;}

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

    long long ans = 0;
    for (int i = 1; i < n; i++)
    {
        //cout << llmin((x[i] - x[i - 1]) * a, b) << endl;
        ans += llmin((x[i] - x[i - 1]) * a, b);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <utility>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <cstdlib>
#include <set>
#include <chrono>
#include <climits>
#include <unordered_map>

#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define repf(i,st,end,inc) for(int i = st; i < end; i += inc)
#define repb(i,st,end,dec) for(int i = st; i >= end; i -= dec) 

#define MOD 1000000007

#define trace1(a) cout << a << endl;
#define trace2(a,b) cout << a << " | " << b << endl;
#define trace3(a,b,c) cout << a << " | " << b << " | " << c << endl;
#define trace4(a,b,c,d) cout << a << " | " << b << " | " << c << " | "<< d << endl;

using namespace std;
using namespace std::chrono;


int main(){
	fast;
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
	// #endif

	auto start = high_resolution_clock::now(); 

	string s;
	cin >> s;

	vector<int> lidx(s.size());
	vector<int> ridx(s.size());

	for(int i = 0; i < s.size(); i++){
		if (s[i] == 'R')
			ridx[i] = i;
		else
			ridx[i] = ridx[i-1];
	}
	for(int i = s.size() - 1; i >= 0; i--){
		if (s[i] == 'L')
			lidx[i] = i;
		else
			lidx[i] = lidx[i+1];
	}

	vector<int> ans(s.size(), 0);

	for(int i = 0; i < s.size(); i++){
		if (s[i] == 'R'){
			if ((lidx[i] - i)%2!=0)
				ans[lidx[i]-1]++;
			else
				ans[lidx[i]]++;
		}
		if (s[i] == 'L'){
			if ((i - ridx[i])%2!=0)
				ans[ridx[i]+1]++;
			else
				ans[ridx[i]]++;
		}
	}
	for (int i = 0; i < s.size(); i++)
		cout << ans[i] << " ";

	auto stop = high_resolution_clock::now(); 
	auto duration = duration_cast<microseconds>(stop - start);	
	// cout << endl;
	// cout << double(duration.count()) / 1000000 << endl; 

	return 0;
}


Measured memory_bytes: 1872
#include <bits/stdc++.h>
using namespace std;
     
int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

  while(C>0 && A>0){
      C=C-B;
      A=A-D;
  }

  if(C<=0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
   
return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<40;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main(){
  ld l;
  cin>>l;
  cout<<fixed<<setprecision(12)<<l*l*l/27;
  
}



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

namespace abc_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
            int A = inputs[0];
            int B = inputs[1];

            if (B % A == 0)
            {

                Console.WriteLine(A + B);
            }
            else
            {
                Console.WriteLine(B - A);

            }
            Console.ReadLine();

        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main() {
	ll x, y;
	cin >> x >> y;

	ll res;
	if (x*y == 0) {
		if (y > 0) { res = abs(y); }
		else if (y < 0) { res = abs(y) + 1; }
		else if (x > 0) { res = abs(x) + 1; }
		else { res = abs(x); }
	} else if (x*y > 0) {
		if (y >= x) { res = abs(x - y); }
		else { res = abs(x - y) + 2; }
	} else {
		res = abs(abs(x) - abs(y)) + 1;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,five=0,seven=0;
    for(int i=0;i<3;i++){
        cin>>a;
        if(a==5)five++;
        else if(a==7)seven++;
    }
    cout<<(five==2&&seven==1?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
def rec(i,j)
  @m[i][j]=0
  rec(i,j+1) if j<11 and @m[i][j+1]==1
  rec(i,j-1) if j>0 and @m[i][j-1]==1
  rec(i+1,j) if i<11 and @m[i+1][j]==1
  rec(i-1,j) if i>0 and @m[i-1][j]==1
end
loop do
  @m,c,t=[],0,12
  t.times{@m<<gets.split("").map(&:to_i)}
  t.times{|i|
    t.times{|j|
      if @m[i][j]==1
        rec(i,j);c+=1
      end
    }
  }
  p c
  break if !gets
end

Measured memory_bytes: 8824
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>
#include <queue>

using namespace std;

pair<int, int> dir[2] = { {1, 0}, {0, 1} };

class info
{
public:
	int y;
	int x;
	char curr;
	int flip;

public:
	info(int _y, int _x, char _curr, int _flip)
		: y(_y), x(_x), curr(_curr), flip(_flip)
	{}
};

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

	int H, W;
	cin >> H >> W;

	vector<string> mapinfo;

	for (int i = 0; i < H; i++)
	{
		string line;
		cin >> line;

		mapinfo.push_back(line);
	}

	vector<vector<vector<bool>>> visited(H, vector<vector<bool>>(W, vector<bool>(101, false)));

	int result = 101;

	queue<info> q;
	q.push(info(0, 0, mapinfo[0][0], mapinfo[0][0] == '#'));
	while (!q.empty())
	{
		info c = q.front();
		q.pop();

		if (c.y == H - 1 && c.x == W - 1)
		{
			result = min(result, c.flip);
			continue;
		}

		for (int i = 0; i < 2; i++)
		{
			int ny = c.y + dir[i].first;
			int nx = c.x + dir[i].second;

			if (ny >= H || nx >= W) continue;

			int need_flip = 0;
			if (mapinfo[ny][nx] != c.curr && c.curr == '.') need_flip = 1;
			if (visited[ny][nx][c.flip + need_flip]) continue;

			q.push(info(ny, nx, mapinfo[ny][nx], c.flip + need_flip));
			visited[ny][nx][c.flip + need_flip] = true;
		}
	}

	cout << result;

	return 0;
}


Measured memory_bytes: 1024
use std::io::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::collections::*;

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

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

fn main() {
    input!{
        s: String
    }
    let s = s.chars();
    for c in s {
        if c == '1' { 
            print!("9");
        } else { 
            print!("1");
        }
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<int> hi(n);
    vector<int> count(n);
    int j=0;
    for (int i = 0; i < n; i++){
        cin >> hi.at(i);
    }
    //入力終わり
    for (int i = 0; i < n-1; i++){
        if(hi.at(i) >= hi.at(i+1)){
            count.at(j)++;
        }else{
            j++;
        }
    }
    sort(count.begin(), count.end());//小さい順に並べる
    reverse(count.begin(), count.end());//リバース
    cout << count.at(0) << endl;
} 

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

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

const int MAXN = 2000 + 10;
const int MOD = 998244353;
int c[MAXN * 2][MAXN * 2];

int compute(int n, int k, int t) {
    int ans = 0;
    int cnt = (t - 1) / 2 - max(1, t - k) + 1;
    int rem = k - cnt * 2 - (t % 2 == 0 ? 1 : 0);

    if (rem == 0) {
        int p = 1;
        for (int i = 1; i <= cnt; ++i) {
            p = p * 2 % MOD;
            int val = (LL)p * c[n - 1][i - 1] % MOD;
            val = (LL)val * c[cnt][i] % MOD;
            ans = (ans + val) % MOD;
        }
    } else {
        int p = 1;
        for (int i = 0; i <= cnt && i <= n; ++i) {
            int val = (LL)c[cnt][i] * c[n + rem - 1][rem + i - 1] % MOD;
            val = ((LL)val * p) % MOD;
            p = p * 2 % MOD;
            ans = (ans + val) % MOD;
        }
    }

    if (t % 2 == 0) {
        ans = (ans + compute(n - 1, k - 1, t - 1)) % MOD;
    }
    return ans;
}

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

    for (int i = 0; i <= n + k; ++i) {
        c[i][0] = 1;
        for (int j = 1; j <= i; ++j) {
            c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
        }
    }

    for (int i = 2; i <= 2 * k; ++i) {
        cout << compute(n, k, i) << "\n";
    }
    return 0;
}


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

// Author - Kevin Mathew
// Birla Institute of Technology, Mesra

ll n, m, a[50];

void te(){
	cin >> n >> m;
	for(ll i=0;i<n;i++){
		ll k;
		cin >> k;
		for(ll i=0;i<k;i++){
			ll u;
			cin >> u;
			a[u]++;
		}
	}

	ll ans = 0;
	for(ll i=1;i<=m;i++)
		if(a[i] == n)
			ans++;

	cout << ans << "\n";
}

int main()
{
	// freopen("input.txt", "r", stdin);		//Comment
	// freopen("output.txt", "w", stdout);		//this out.
	ios::sync_with_stdio(false);			//Not
	cin.tie(NULL);							//this.
	cout.tie(0);							//or this.

	te();

	return 0;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))

dp = []

for i, h in enumerate(H) :
  if (i==0) :
    dp.append(0)
    continue
  
  if (i==1) :
    dp.append(abs(H[0]-H[1]))
    continue
  
  one = dp[i-1] + abs(H[i]-H[i-1])
  two = dp[i-2] + abs(H[i]-H[i-2])
  
  if (one < two):
    dp.append(one)
  else :
    dp.append(two)

print(dp[-1])

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

#define int long long
#define CASET int _T; cin >> _T; REP(caset, 0, _T)
#define REP(i, l, r) for (int i=(l); i<(r); ++i)
#define RREP(i, r, l) for (int i=(r); i>(l); --i)
#define sq(x) (x)*(x)
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define t4i tuple<int,int,int,int>
#define mii map<int,int>

const int INF = 1LL<<60;
const int MOD = 998244353;

template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
string to_string(string s) {return s;}
string to_string(bool b) {return b?"true":"false";}
template <typename A, typename B>
string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> t) {return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ")";}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> t) { return "(" + to_string(get<0>(t)) + ", " + to_string(get<1>(t)) + ", " + to_string(get<2>(t)) + ", " + to_string(get<3>(t)) + ")";}
template <typename A>
string to_string(vector<A> v) {
    bool first = true;
    string result = "[";
    for (A i : v) {
        if (!first) result += ", ";
        first = false;
        result += to_string(i); 
    }
    return result + "]";
}
string bin_string(int x) {
    const int d = 32;
    string result(d, ' ');
    REP(i, 0, d) result[d-1-i] = '0'+(x>>i & 1LL);
    return result;
}

int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}

main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int n;
    cin >> n;
    vi a(n), loc(n);
    REP(i, 0, n) {
        cin >> a[i];
        --a[i];
        loc[a[i]] = i;
    }
    REP(i, 0, n) {
        if (i!=a[i]) {
            swap(a[i], a[loc[i]]);
            break;
        }
    }
    REP(i, 0, n) {
        if (i!=a[i]) {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
}

Measured memory_bytes: 256
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto i: a)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        fl(i,0,n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define what(x) cerr << #x << " is " << x << endl;
int sum() { return 0; }template<typename T,typename... Args>T sum(T a, Args... args) { return a + sum(args...); }
#define p   2005


vec<int> v[p];
bool vis[p];
int dis[p];


void bfs(int n)
  { 
      vis[n]=true;
      queue<int> q;
      q.push(n);
      dis[n]=0;
      while(!q.empty())
         {
           int cu=q.front();
           q.pop();
           for(auto j: v[cu])
              {
                if(!vis[j])
                   {
                    q.push(j);
                    vis[j]=true;
                    dis[j]=dis[cu]+1;

                   }
              }


         }






  }

void solve()
{  
  int n,x,y;
  cin>>n>>x>>y;
  v[x].pb(y);
  v[y].pb(x);

  rep(i,1,n)
   {  
      v[i].pb(i+1);
      v[i+1].pb(i);
   }



// bfs(3);
// for(int i=1;i<=5;i++)
//    cout<<dis[i]<<" ";
 int ans[p];
  fill(ans,ans+p,0LL);
rep(i,1,n+1)
  {  
    bfs(i);

    rep(j,1,n+1)
       {  // cout<<dis[j]<<" ";
          ans[dis[j]]++;
       }
      // cout<<endl;
       fill(dis,dis+p,00L);
       fill(vis,vis+p,false);

  }
   rep(i,1,n)
     {
       cout<<ans[i]/2<<endl;;

    }

       
                   



}







   


  

signed main()
{fast
  int t;
  //cin>>t;
  t=1;
  while(t--)
    {solve();}
  
}












Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long Long;

int main(){
	ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	Long n;cin>>n;
	vector<Long> v;
	map<Long,Long> m;
	for(Long i=0;i<n;i++){
		Long l;cin>>l;
		v.push_back(l);
		m[l]++;
	}
	map <Long,Long>::iterator it;
	Long suma=0;
	for(it=m.begin();it!=m.end();++it){
	    Long a;
	    a=it->second;
		suma+=((it->second)*((it->second)-1))/2;
	}
	for(it=m.begin();it!=m.end();++it){
		m[it->first]=suma-((it->second)*((it->second)-1))/2+(((it->second)-1)*((it->second)-2))/2;
	}
	for(Long i=0;i<v.size();i++){
		cout<<m[v[i]]<<"\n";
	}
}

Measured memory_bytes: 11120
S = list(input())
N = len(S)
Ans = [0 for _ in range(N)] 
cnt = 0
cnt2 = 0
for i in range(N):
    # solve R
    if S[i] == "R":
        cnt += 1
    else:
        Ans[i] += int(cnt / 2)  # L側は切り捨て
        Ans[i-1] += int((cnt+1) / 2)  # R側は切り上げ
        cnt = 0
    
    # solve L
    if S[-i-1] == "L":
        cnt2 += 1
    else:
        Ans[-i-1] += int(cnt2 / 2)  # R側は切り捨て
        Ans[-i] += int((cnt2+1) / 2)  # L側は切り上げ
        cnt2 = 0
print(*map(int, Ans))
    

Measured memory_bytes: 57684
A=[]
fp =0
bp =0
 
n=int(raw_input())
while n:
    s = raw_input()
    if s[0] == 'i':
        A.append(int(s[7:]))
        fp += 1
    elif s[6] == ' ':
        try:
            i = A[::-1].index(int(s[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif s[6] == 'F':
        A.pop()
        fp -=1
    elif s[6] == 'L':
        bp +=1
    n -=1
 
for e in A[bp:fp+1][::-1]:
    print int(e),

Measured memory_bytes: 42328
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to, cor; };
char c[4005];
int a[4005];
int dp[2005][2005];
int bit[5000];
vector<P>B, W;
int lb[4005][4005], lw[4005][4005];
//int b[4005], w[4005];
int n;
int sum(int i) {
	int s = 0;
	while (i) {
		s +=bit[i];
		i -= i&-i;
	}
	return s;
}
void add(int i, int x) {
	while (i <= n) {
		bit[i] += x;
		i += i&-i;
	}
}

signed main() {
	cin >> n; n += n;
	rep(i, n) {
		cin >> c[i] >> a[i];
		if (c[i] == 'B') {
			B.push_back(P(a[i], i));
		}
		else W.push_back(P(a[i], i));
	}
	sort(B.begin(), B.end());
	sort(W.begin(), W.end());
	rep(i, B.size()) {
		int f = B[i].first, s = B[i].second;//num,plc
		lb[s + 1][f-1]++;
	}
	rep(i, W.size()) {
		int f = W[i].first, s = W[i].second;
		lw[s + 1][f-1]++;
	}
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j >= 0;j--) {
			lb[i][j] += lb[i][j + 1];
			lw[i][j] += lw[i][j + 1];
		}
	}
	rep(i, n) {
		rep(j, n) {
			lb[i + 1][j] += lb[i][j];
			lw[i + 1][j] += lw[i][j];
		}
	}
	//lb[i][j]...iより左にjより大きいのがいくつあるか

	rep(i, 2001)rep(j, 2001)dp[i][j] = inf;
	dp[0][0] = 0;
	rep(i, n) {
		rep(j, i + 1) {
			int nb = j, nw = i - j;
			if (j > n / 2 || nw > n / 2)continue;
			if(nw!=n/2)dp[nb][nw + 1] = min(dp[nb][nw + 1], dp[nb][nw] + lb[W[nw].second][nb] + lw[W[nw].second][nw+1]);
			if (nb != n / 2)dp[nb + 1][nw] = min(dp[nb + 1][nw], dp[nb][nw] + lb[B[nb].second][nb+1] + lw[B[nb].second][nw]);
		}
	}
	cout << dp[n / 2][n / 2] << endl;


/*	rep(i, n) {
		rep(j, n) {
			if (j)cout << ' '; cout << dp[i][j];
		}
		cout << endl;
	}*/
}

Measured memory_bytes: 282368
/**
*    created: 04.05.2020 02:17:52
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using Graph = vector<vector<int>>;

int main() {
    int n, m;
    cin >> n >> m;
    ll h[n];
    rep(i,n) cin >> h[i];

    Graph G(n);
    int a, b;
    rep(i,m){
        cin >> a >> b;
        G[b-1].emplace_back(a-1);
        G[a-1].emplace_back(b-1);
        //cout << G[b][0] << endl;
    }
    int count = 0;
    rep(i,n){
        bool hie=1;
        for(auto e:G[i]){
            //compare h[i],each h[e]:h[i]>h[e]
            hie &= (h[i] > h[e]);
        }
        count+=hie;
    }
    cout << count << endl;
}

Measured memory_bytes: 8992
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A, B;
    cin >> A >> B;
    if(A - 2 * B <= 0)
    {
        cout << "0" << endl;
    }
    else
    {
        cout << A - 2 * B << endl;
    }
    
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



int main(){
    int n;
    cin >> n;
    int a,b;
    cin >> a >> b;

    int p[n];
    rep(i,n) cin >> p[i];

    int x = 0,y = 0, z = 0;

    for(int i=0;i<n;i++){
        if(p[i]>b){
            z++;
        }else if(p[i]<=a){
            x++;
        }else{
            y++;
        }
    }
    cout << min({x,y,z}) << endl;
}


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

struct Point{
	double x,y,z;
};

int N;
Point point[30];

double calc_len(Point a,Point b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z));
}

void func(){
	for(int i = 0; i < N; i++){
		scanf("%lf %lf %lf",&point[i].x,&point[i].y,&point[i].z);
	}

	Point tmp;
	tmp.x = 50.0,tmp.y = 50.0,tmp.z = 50.0;
	double ans = 10000.0,max_dist,move_dist = 10.0;
	int max_index;

	for(int i = 0; i < 10000; i++){
		max_dist = -1;

		for(int k = 0; k < N; k++){
			if(max_dist < calc_len(tmp,point[k])){
				max_dist = calc_len(tmp,point[k]);
				max_index = k;
			}
		}

		if(ans > max_dist){
			ans = max_dist;
		}

		tmp.x += (point[max_index].x-tmp.x)*move_dist;
		tmp.y += (point[max_index].y-tmp.y)*move_dist;
		tmp.z += (point[max_index].z-tmp.z)*move_dist;

		if(i%100 == 0)move_dist /= 2;
	}
	printf("%.10lf\n",ans);
}


int main(){
	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}
	return 0;
}

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

using namespace std;

#define int long long

int32_t main(){
  int n;
  cin>>n;
  
  map<int,int>m;
  int temp;
  for(int i=0;i<n;i++){
    cin>>temp;
    m[temp]++;
  }
  int ans = 0;
  
  for(auto it : m){
    if(it.first > it.second) ans += it.second;
    else if(it.second > it.first) ans += (it.second - it.first);
  }
  cout<<ans;
}

Measured memory_bytes: 6272
class Building:
    def __init__(self,max_floor,max_room):
        self.max_floor=max_floor
        self.max_room=max_room
        #[floor][room]で管理
        row=max_floor
        col=max_room
        self.room_info=[[0 for j in range(col)] for i in range(row)]
        
    def update_visited(self,f,r,v):
        self.room_info[f][r]+=v
        

class OfficialHouse:
    def __init__(self,max_building=4,max_floor=3,max_room=10):
        self.buildings=[]
        for building_id in range(max_building):
            self.buildings.append(Building(max_floor=max_floor,max_room=max_room))
            
    def update_visited(self,notice):
        
        #indexずれの修正
        b=notice.building_id-1
        f=notice.floor-1
        r=notice.room_number-1
        v=notice.visited_number
        self.buildings[b].update_visited(f,r,v)
        

    def print_official_house_info(self):
        b_max=len(self.buildings)
        f_max=self.buildings[0].max_floor
        r_max=self.buildings[0].max_room
        
        for b in range(b_max):
            for f in range(f_max):
                for r in range(r_max):
                    v=self.buildings[b].room_info[f][r]
                    print(f" {v}",end="")
                print("")
            if b != b_max-1:
                print("####################")
        

class Notice:
    def __init__(self,building_id,floor,room_number,visited_number):
        self.building_id=building_id
        self.floor=floor
        self.room_number=room_number
        self.visited_number=visited_number


def tell_notice(notice_list,house):
    for notice in notice_list:
        house.update_visited(notice)


def input_notice():
    n=int(input())
    
    notice_list=[]
    
    for i in range(n):
        b,f,r,v=tuple(map(int,input().split()))
    
        notice=Notice(building_id=b,floor=f,room_number=r,visited_number=v)
        
        notice_list.append(notice)

        
    return notice_list
    
    
def exe_notice():
    notice_ls=input_notice()
    
    house=OfficialHouse()
    
    tell_notice(notice_ls,house)
    
    house.print_official_house_info()



exe_notice()


Measured memory_bytes: 5644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define pb push_back
#define MOD 1000000007
#define sz5 100005
#define sz6 1000005
#define UP upper_bound
#define LB lower_bound
#define F first
#define S second
#define PI pair<int,int>
#define PL pair<ll,ll>
#define VI vector<int>
#define VL vector<ll>

double p[3003];

int main() {
	ll n,la,lb;
	cin>>n;
	vector<vector<double>> dp(n+5, vector<double>(n+5, 0.0));

	for(la=1;la<=n;la++)
		cin>>p[la];

	// dp[a][b] - a coins, n heads

	dp[0][0]=1.0;
	for(la=1;la<=n;la++){
		for(lb=0;lb<=la;lb++){
			if(lb>0)
				dp[la][lb] += dp[la-1][lb-1]*p[la];
			dp[la][lb] += dp[la-1][lb]*(1-p[la]);
		}
	}

	double ans=0.0;
	for(la=1;la<=n;la++){
		int head=la, tail=n-head;

		if(head>tail)
			ans+=dp[n][la];
	}

	printf("%.10lf\n",ans);

	return 0;
}

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);

template<typename a>
struct S001 {
  int n;
  std::vector<a> xs;
  S001(const std::vector<a>& ys) : xs(ys.size() + 1) {
    int n = (int)ys.size();
    a t = 0;
    xs[0] = 0;
    for(int i = 0; i < n; ++i) {
      t += ys[i];
      xs[i+1] = t;
    }
  }
  a operator [] (int i) {
    return xs[i];
  }
  a f(int x, int y) {
    return xs[y] - xs[x];
  }
};

struct Solver {
  int n, k;
  std::vector<long> xs;
  void read() {
    scanf("%d %d", &n, &k);
    xs.resize(n);
    for(int i = 0; i < n; ++i) {
      scanf("%ld", &xs[i]);
    }
  }
  void solve() {
    read();
    std::vector<long> ys, zs;
    std::transform(xs.begin(), xs.end(), std::back_inserter(ys),
                   [](long x) { return std::max((long)0, x); });
    std::transform(xs.begin(), xs.end(), std::back_inserter(zs),
                   [](long x) { return std::min((long)0, x); });
    S001<long> s(ys);
    S001<long> t(zs);
    long z = 11223344;
    for(int i = 0; i < n - k + 1; ++i) {
      long x = s.f(0, i) + s.f(i + k, n) + s.f(i, i + k) + t.f(i, i + k);
      long y = s.f(0, i) + s.f(i + k, n);
      if( i == 0 ) z = std::max(x, y);
      else z = std::max(std::max(z, x), y);      
    }
    printf("%ld\n", z);
  }
};

int main() {
  Solver s;
  s.solve();
  
  return 0;
}

Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repa(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define COUT(x) cout << (x) << endl
#define _GLIBCXX_DEBUG

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

  if (s[0] == s[2])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
function main(input) {
    const args = input.split(' ');
    const N = parseInt(args[0], 10),
          A = parseInt(args[1], 10),
          B = parseInt(args[2], 10);

    const nums = Array.from(new Array(N), (v, i) => ++i).filter((i) => {
        var n = i.toString().split('').reduce((p, c) => p + parseInt(c), 0);
        return (n >= A && n <= B);
    });

    console.log(nums.reduce((p, c) => p + c, 0));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 10096
# 2019/09/08


n,k=map(int,input().split())
s=list(input())

cnt=0
res=0
for i in range(n-1):
    if s[i]==s[i+1]:
        res+=1
    else:
        cnt+=1
res+=min(cnt,k)*2
res=min(n-1,res)

print(res)

Measured memory_bytes: 4084
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, 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; }

int main(){
    int n; ll k; cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ok = 1e18, ng = 0;
    while(ok - ng > 1){
        ll mid = (ok + ng) / 2;
        ll cnt = 0;
        rep(i,n) cnt += (a[i]+mid-1) / mid -1;
        if(cnt <= k) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}


Measured memory_bytes: 4832
n = int(input())

dish = []
ans = 0
for i in range(n):
    a, b = map(int,input().split())
    ans -= b
    dish.append(a+b)
dish.sort(reverse=True)    

for i in range(n):
    if not i%2:
        ans += dish[i]
        
print(ans)

Measured memory_bytes: 76716
N, Y =map(int,input().split())
ans = (-1,-1,-1)
for yukichi in range(N+1):
    for ichiyo in range(N+1-yukichi):
        hideyo = N-yukichi-ichiyo
        if Y == 10000*yukichi+5000*ichiyo+1000*hideyo:
            ans = (yukichi,ichiyo,hideyo)
print(*ans)

Measured memory_bytes: 3060
# ABC126 E
f=lambda:map(int,input().split())
N,M=f()

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)

    def find_root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]
        
    def unite(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
                
    def is_same_group(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def count(self, x):
        return -self.root[self.find_root(x)]
    
uf=UnionFind(N)
for _ in [0]*M:
    x,y,z=f()
    uf.unite(x,y)
    
res=0
for i in range(N):
    if uf.root[i+1]<0:
        res+=1
print(res)

Measured memory_bytes: 79772