akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define fast_io() ios::sync_with_stdio(false); cin.tie(nullptr)
#define fix(n) fixed << setprecision(n)

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    fast_io();
    
    ll n,r;
    cin >> n >> r;

    if(n < 10){
        cout << r + (100 * (10 - n)) << endl;
    } else {
        cout << r << endl;
    }

    return 0;
}

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

int main(){
    long long int a, b, c, n, k, ans;
    cin >> n >> k;
    if(k % 2 == 0){
        ans = (n / k)*(n / k)*(n / k);
        ans += ((2*n+k)/(2*k))*((2*n+k)/(2*k))*((2*n+k)/(2*k));
        cout << ans << endl;
    }
    else{
        cout << (n / k)*(n / k)*(n / k) << endl;
    }
    return 0;
}

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

int digit(int n)
{
    int res = 0;
    while (n > 0)
    {
        res++;
        n /= 10;
    }
    return res;
}

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

    int n;
    cin >> n;
    int a[15] = {};
    int ans = 0;
    set<long long> st;
    while (1)
    {
        a[0]++;
        for (int i = 0; i < 14; i++)
        {
            if (a[i] == 4)
            {
                a[i] = 0;
                a[i + 1]++;
            }
        }
        long long num = 0, cnt[3] = {};
        for (int i = 0; i < 15; i++)
        {
            num *= 10;
            if (a[i] == 0)
            {
                num /= 10;
                break;
            }
            else if (a[i] == 1)
            {
                cnt[0]++;
                num += 3;
            }
            else if (a[i] == 2)
            {
                cnt[1]++;
                num += 5;
            }
            else
            {
                cnt[2]++;
                num += 7;
            }
        }
        bool f = cnt[0] != 0 && cnt[1] != 0 && cnt[2] != 0;
        if (f && n >= num && st.find(num) == st.end())
        {
            ans++;
            st.insert(num);
        }
        if (digit(num) > digit(n))
            break;
    }
    cout << ans << endl;
}

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

struct point{
  double x,y;
  bool operator<( const point &u ) const {
      //return x < u.y;
      if(x != u.x) return x < u.x;
        return y < u.y;
  }
};
point a[100000];

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

double merge(int left,int right){
  if(left+1 == right) return dis(a[left],a[right]);
  int mid = (left+right)/2;
  double xm = min(merge(left,mid),merge(mid,right));

  vector<point> vec;
  for(int i = left; i <= right; i++){
    if(abs(a[mid].x-a[i].x) <= xm){
      vec.push_back({a[i].y,a[i].x});
    }
  }
  sort(vec.begin(),vec.end());
  for(int i = 0; i < vec.size(); i++){
    for(int j = i+1; j < vec.size(); j++){
      if(vec[j].x-vec[i].x > xm) break;
      xm = min(xm,dis(vec[i],vec[j]));
    }
  }
  return xm;
}

signed main(){

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

  sort(a,a+n);
  printf("%.10f\n",(merge(0,n-1)));

  return 0;
}



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

int main(void){
    string s;
    cin >> s;
    int mx = 0;
    for(int i = 0;i < s.size();i++){
        for(int j = i+1;j < s.size()+1;j++){
            string t = s.substr(i,j-i);
            //cout << t << endl;
            bool check = true;
            for(int k = 0;k < t.size();k++){
                if(t[k] != 'A' && t[k] != 'C' && t[k] != 'G' && t[k] != 'T')check = false;
            }
            if(check)mx = max(mx,(int)t.size());
        }
    }
    if((s[0] == 'A' || s[0] == 'C' || s[0] == 'G' || s[0] == 'T') && s.size() == 1)mx = 1;
    cout << mx << endl;
}

Measured memory_bytes: 256
n, k = [ int(v) for v in input().split() ]
a_list = [ int(v) for v in input().split() ]
f_list = [ int(v) for v in input().split() ]
a_list.sort()
f_list.sort(reverse=True)


def training(x):
    global a_list, f_list
    ret = 0
    for i in range(n):
        a = x // f_list[i]
        ret +=  max(0, a_list[i] - a)
    return ret

ans = -1

if training(0) <= k:
    ans = 0
else:
    ng = 0
    ok = 10**12
    while ok - ng > 1:

        mid = (ng+ok) // 2
        if training(mid) <= k:
            ok = mid
            mid = (ng+ok) // 2
        else:
            ng = mid
            mid = (ng+ok) // 2
    ans = ok
print(ans)



Measured memory_bytes: 119628
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
//define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
typedef long long ll;
const int mx=2e5+125;
//ll p[mx],a[mx],b[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
int main()
{
    faster();
    ld d;
    cin>>d;
    d/=3;
    d=d*d*d;
    cout<<fixed<<setprecision(8)<<d<<endl;
    return  0;
}


Measured memory_bytes: 3712
/*
  Author - KISHAN TIWARI
  Dream bigger. Do bigger.
  Wake up with determination. Go to bed with satisfaction.
*/
//Sometimes later becomes never. Do it now.
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define mod          1000000007
#define fi           first
#define se           second
#define pa           pair <ll,ll>
#define mp           make_pair
#define pb           push_back
#define ve           vector<ll>
#define vep          vector< pa >
#define all(a)       a.begin(), a.end()
#define sz(x)        (ll)x.size()
#define c(t)         cout<<t<<"\n"
using namespace std;
class gfg
{
 public : ll gcd(ll a, ll b){
    if (a == 0)
        return b;
    return gcd(b % a, a);
 }


// Function to return LCM of two numbers
  ll lcm(ll a, ll b)
 {
    return (a*b)/gcd(a, b);
 }
} ;
void solve()
{  ll a,b,c,d;
cin>>a>>b>>c>>d;
ll x=a/c,y=b/c;
ll z=y-x;
if(a%c==0)
    z++;
ll x1=a/d,y1=b/d;
ll z1=y1-x1;
if(a%d==0)
    z1++;
    gfg g;
ll f=g.lcm(c,d);
ll x2=a/f,y2=b/f;
ll z2=y2-x2;
if(a%f==0)
    z2++;

ll z3=z+z1-z2;
ll ans=b-a+1-z3;
c(ans);
}
int main()
{
    ios::sync_with_stdio(true);
   //freopen ("input.txt","r",stdin);
   //freopen ("output.txt","w",stdout);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {

        solve();
    }
return 0;
}


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

using namespace std;

signed main(){

    
    int A,B;
    cin >> A;
    cin >> B;
    
    int i = 0;
    while (true) {
        if(B <= (A-1)*(i-1)+A){
            break;
        }
        i++;
    }
    
    cout << i;

 
 
    return 0;

 }


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

using namespace std;
const int MAX = 1000000009;

template<class T>
ostream& operator<<(ostream& os, const vector<T> &vec){
    os << "[";
    for(int i=0;i<vec.size();i++){
        os << (i==0?"":" ") << vec[i];
    }
    os <<  "]";
    return os;
}


int main(){
    long long n, x;
    cin >> n >> x;
    vector<long long> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    vector<long long> mins(n, MAX);
    long long minx = 10000000000000000;
    for(int i=0;i<=n;i++){
        long long accum = 0;
        for(int j=0;j<n;j++){
            mins[j] = min(mins[j], a[(j+n-i)%n]);
            accum += mins[j];
        }
        minx = min(minx, accum + x * i);
    }
    cout << minx << endl;

    return 0;
}


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

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  for (int d = 0; d < n; d++) {
    vector<int> a(9) ,b(9);
    for (int i = 0; i < 9; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < 9; i++) {
      cin >> b[i];
    }
    sort(b.begin(), b.end());
    double wa = 0, c = 0, suma = 0, sumb = 0;
    do{
      suma = 0;
      sumb = 0;
      c++;
      for (int i = 0; i < 9; i++) {
        if(a[i] > b[i])
          suma += a[i] + b[i];
        else
          sumb += a[i] + b[i];
      }
      if(suma > sumb)wa += 1;
    }while(next_permutation(b.begin(), b.end()));
    printf("%.6lf %.6lf\n", wa/c, 1.0 - wa/c);
  }
  return 0;
}

Measured memory_bytes: 1228
H, W = gets.chomp.split(" ").map(&:to_i)
S = []
H.times{
  S << gets.chomp.unpack('C*')
}

Lamp = []
H.times{
  Lamp << Array.new(W, 0)
}
S.each_with_index{|row, yidx|
  cnt = 0
  row.each_with_index{|s, x|
    if s == 35 then    # '#'.ord => 35
      cnt.times{|t| Lamp[yidx][x-1-t] = cnt}
      cnt = 0
    else
      cnt += 1
    end
  }
  cnt.times{|t| Lamp[yidx][W-1-t] = cnt}
}

ans = 0
(0...W).each{|x|
  cnt = 0
  (0...H).each{|y|
    if S[y][x] == 35 then  # '#'.ord => 35
      cnt.times{|t|
        tmp = Lamp[y-t-1][x] + cnt
        ans = tmp if ans < tmp
      }
      cnt = 0
    else
      cnt += 1
    end
  }
  cnt.times{|t|
    tmp = Lamp[H-1-t][x] + cnt
    ans = tmp if ans < tmp
  }
}

puts ans - 1


Measured memory_bytes: 72444
import java.util.Scanner;

public class Main {

	private static int play(char st, int rr, int ss, int pp) {
		int ans = 0;
		if(st == 'r') {
			ans = rr;
		}
		if(st == 's') {
			ans = ss;
		}
		if(st == 'p') {
			ans =  pp;
		}
		return ans;
	}

	private static char janc(char st) {
		char ans = 'a';
		if(st == 'r') {
			ans = 'p';
		}
		if(st == 's') {
			ans = 'r';
		}
		if(st == 'p') {
			ans = 's';
		}
		return ans;
	}

	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	// 入力
	int n = sca.nextInt();
	int k = sca.nextInt();
	int r = sca.nextInt();  // グーで勝った時の点数
	int s = sca.nextInt();  // チョキで勝った時の点数
	int p = sca.nextInt();  // パーで勝った時の点数
	String t = sca.next();
	boolean flg[] = new boolean[n];

	// 処理

	int ans = 0;

	for(int i = 0; i < n; i++) {
		if(i >= k) {
			if(t.charAt(i) == t.charAt(i-k) && flg[i-k] == true) {
				flg[i] = false;
			}
			else{
				ans = ans + play(janc(t.charAt(i)), r, s, p);
				flg[i] = true;
			}
		}
		else {
			if(janc(t.charAt(i)) == 'p') {
				ans = ans + play('p', r, s, p);
			}
			if(janc(t.charAt(i)) == 'r') {
				ans = ans + play('r', r, s, p);
			}
			if(janc(t.charAt(i)) == 's') {
				ans = ans + play('s', r, s, p);
			}
			flg[i] = true;
		}

	}

	// 出力
	System.out.println(ans);

	// 後始末
	sca.close();
	}
}

Measured memory_bytes: 28820
n=int(input())
a=[int(x) for x in input().rstrip().split()]
a.sort()
ma=max(a)
dp=[0]*ma
for i in a:
  dp[i-1]+=1

l=[0]*ma
ans=0
for i in a:
  j=i
  if l[i-1]==0 and dp[i-1]==1:
    ans+=1
  while(j<=ma):
    l[j-1]+=1
    if j+i<=ma:
      j+=i
    else:
      break
print(ans)


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

int main() {
    ll n;
    cin >> n;
    vector<ll> v(n);
    rep(i,n) cin >> v[i];
    sort(v.begin(), v.end());
    double ans = v[0];
    rep(i,n-1) {
        ans = (ans+v[i+1])/2;
    }
    printf("%.15f\n", ans);
    return 0;
}


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

int main() {
  int a;
  string ans = "No";
  cin >> a;
  
  for (int i = 0; i <= 25; i++) {
    for (int j = 0; j <= 15; j++) {
        if (i*4 + j*7 == a) ans = "Yes";
    }
  }  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int mod = 1e9+7;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int fpm(int x,int y){
	int summ=1;
	while(y){
		if(y&1)summ=1ll*summ*x%mod;
		x=1ll*x*x%mod;
		y>>=1;
	}
	return summ;
}

int k,m,n,sum[1000010];
int main(){
	n=read();k=read();
	long long ans=0;
	for(register int i=k;i>=1;i--){
		sum[i]=fpm(k/i,n);
		for(register int j=i*2;j<=k;j+=i)
			(sum[i]=sum[i]-sum[j]+mod)%=mod;
		(ans+=1ll*sum[i]*i%mod)%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

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

ll cnt[60][60];

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

    int n;
    cin >> n;
    while(n--) {
        string s;
        cin >> s;
        if(find(s.begin(), s.end(), '.') == s.end())
            s += '.';
        int dec = 0;
        for(int i = 0; i < s.size(); i++) {
            if(s[i] == '.') {
                dec = (int)s.size() - 1 - i;
                break;
            }
        }
        while(dec < 9) {
            s += '0';
            dec++;
        }
        string t;
        for(auto &c : s)
            if(c >= '0' && c <= '9')
                t += c;

        //cout << t << endl;
        ll x = stoll(t);
        int v2 = 0, v5 = 0;
        while(x % 2 == 0) {
            v2++;
            x /= 2;
        }
        while(x % 5 == 0) {
            v5++;
            x /= 5;
        }
        cnt[v2][v5]++;
        //cout << v2 << " " << v5 << " " << cnt[v2][v5] << '\n';
    }
    ll ans = 0;
    for(int i = 0; i < 60; i++) {
        for(int j = 0; j < 60; j++) {
            for(int p = 0; p < 60; p++) {
                for(int q = 0; q < 60; q++) {
                    if(i + p < 18 || j + q < 18)
                        continue;
                    if(i == p && j == q)
                        ans += cnt[i][j] * (cnt[i][j] - 1);
                    else
                        ans += cnt[i][j] * cnt[p][q];
                }
            }
        }
    }
    cout << ans / 2 << '\n';
}

Measured memory_bytes: 3640
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()
	g := make([][]int, n)
	for i := 0; i < m; i++ {
		a, b := scanInt()-1, scanInt()-1
		g[a] = append(g[a], b)
	}

	var dfs func(a int, arr []int) bool
	t := 0
	ts := make([]int, n)
	var ans []int
	var s int
	dfs = func(a int, arr []int) bool {
		if len(arr) != 0 && a == s {
			ans = arr
			return true
		}
		for _, b := range g[a] {
			if ts[b] == t {
				continue
			}
			ts[b] = t
			if dfs(b, append(arr, b)) {
				return true
			}
		}
		return false
	}

	for i := 0; i < n; i++ {
		t++
		s = i
		if dfs(i, []int{}) {
			break
		}
	}

	if len(ans) == 0 {
		fmt.Fprintln(wr, -1)
		return
	}

	for {
		f := make([]bool, n)
		idx := map[int]int{}
		for i := 0; i < len(ans); i++ {
			f[ans[i]] = true
			idx[ans[i]] = i
		}
		a, b := -1, -1
		for i := 0; i < len(ans); i++ {
			next := ans[(i+1)%len(ans)]
			for _, v := range g[ans[i]] {
				if f[v] && v != next {
					a, b = i, idx[v]
					break
				}
			}
			if b != -1 {
				break
			}
		}
		// debug(ans, a, b)
		if b == -1 {
			fmt.Fprintln(wr, len(ans))
			for i := 0; i < len(ans); i++ {
				fmt.Fprintln(wr, ans[i]+1)
			}
			return
		}
		if a > b {
			ans = ans[b : a+1]
		} else {
			ans = append(ans[:a+1], ans[b:]...)
		}
	}
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,m,x; cin>>n>>m>>x;
  vector<int>num(m);
  int ini=0,fin=0;
  for(int i=0;i<m;i++){
    int a; cin>>a;
    if(a<x) ini++;
    else fin++;
  }
  if(ini>fin) cout<<fin<<endl;
  else cout<<ini<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); 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 FORA(i, v) for (auto &&i : v)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
vector<vector<int>> graph;
vector<bool> visited;
vector<vector<int>> visitedList;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A, B) << " " << max(0, A + B - N) << "\n";
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	cnt := 0
	for i := 0; i < n; i++ {
		for j := n - 1; j > i; j-- {
			if a[j] < a[j-1] {
				a[j], a[j-1] = a[j-1], a[j]
				cnt++
			}
		}
	}
	fmt.Println(strings.Trim(fmt.Sprint(a), "[]"))
	fmt.Println(cnt)
}



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

int main()
{
    int N, K;
    vector<int> A;
    cin >> K >> N;
    for(int i=0; i<N; ++i){
        int x;
        cin >> x;
        A.push_back(x);
    }
    int ans = 0;
    for(int i=1; i<N; ++i){
        ans = max(ans, A[i]-A[i-1]);
    }
    ans = max(ans, A[0]-A[N-1]+K);
    cout << K-ans << endl;
}

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

// #undef DEBUG
// #define DEBUG
// DEBUG {{{
// clang-format off
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
template<class T, class U> ostream & operator<<(ostream &o, pair<T, U> const &p) { o << "(" << p.first << ", " << p.second << ")"; return o; }
#ifdef DEBUG
#if !defined(DEBUG_OUT)
// #define DEBUG_OUT cerr
#endif
#define dump(...) [&](){auto __debug_tap=make_tuple(__VA_ARGS__);DEBUG_OUT<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<__debug_tap<<"\n";}()
template < class T > inline void dump2D(T &d, size_t sizey, size_t sizex) { for(size_t i = 0; i < sizey; i++) { DEBUG_OUT << "\t"; for(size_t j = 0; j < sizex; j++) DEBUG_OUT << d[i][j] << (j + 1 == sizex ? "" : "\t"); DEBUG_OUT << endl; } }
template < class T, class = typename iterator_traits< typename T::iterator >::value_type > ostream &operator<<(ostream &o, const T &a) { o << "{"; for(auto ite = a.begin(); ite != a.end(); ++ite) o << (ite == a.begin() ? "" : ", ") << *ite; o << "}"; return o; }
#else
#define dump(...) (42)
#define dump2D(...) (42)
template < class T, class = typename iterator_traits< typename T::iterator >::value_type > ostream &operator<<(ostream &o, const T &a) { for(auto ite = a.begin(); ite != a.end(); ++ite) o << (ite == a.begin() ? "" : " ") << *ite; return o; }
#endif
// clang-format on
// }}}

int sol() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for(auto &e:v) cin >> e, e--;
  int state = 0;
  int l, r;
  for(int i = 0; i < n; i++) {
    switch(state) {
      case 0:
        if(i != v[i]) {
          if(i % 2 != v[i] % 2) return 0;
          state = 1;
          l = i;
          r = v[i];
        }
        break;
      case 1:
        if(l % 2 == i % 2) {
          if(i == v[i]) return 0;
          if(i % 2 != v[i] % 2) return 0;
          r = max(r, v[i]);
        } else {
          // pivot
          if(i != v[i]) return 0;
        }
        if(r == i) {
          vector<int> goL, goR;
          for(int j = l; j <= r; j+=2) {
            if(v[j] < j) goL.emplace_back(v[j]);
            else goR.emplace_back(v[j]);
          }
          for(int j = 0; j < (int) goL.size() - 1; j++) if(goL[j] > goL[j+1]) return 0;
          for(int j = 0; j < (int) goR.size() - 1; j++) if(goR[j] > goR[j+1]) return 0;
          state = 0;
        }
        break;
    }
  }
  return 1;
}

int main() {
  cout << (sol() ? "Yes" : "No") << endl;
}



Measured memory_bytes: 2748
#include <bits/stdc++.h>
using namespace std;
int main (void) {
    int N, X, Y;
    cin >> N >> X >> Y;
    --X; --Y;
    vector<int> ans(N+1, 0);
    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) {
            ans.at( min(j - i, abs(X-i) + 1 + abs(Y-j) ) )++;
        }
    }
    for (int i = 1; i < N; i++) cout << ans.at(i) << endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000000
#define infll 1000000000000000000ll
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
#define N 2009
using namespace std;

int n,sz[N],mn[N],mx[N],q[N],fa[N],ans; vi e[N]; char ch[N];
bool cmp(int x,int y){ return mx[x]<mx[y]; }
void dfs(int x){
	sz[x]=(ch[x]=='1'); mx[x]=0;
	for (int y:e[x])
		if (y!=fa[x]){
			fa[y]=x; dfs(y);
			sz[x]+=sz[y]; mx[y]+=sz[y]; mn[y]+=sz[y];
			mx[x]+=mx[y];
		}
	int tp=0;
	for (int y:e[x]) if (y!=fa[x]) q[++tp]=y;
	sort(q+1,q+tp+1,cmp);
	int i,tmp=0;
	for (i=1; i<tp; i++) tmp+=mx[q[i]];
	mn[x]=max(0,mn[q[tp]]-tmp);	
}
int main(){
	scanf("%d%s",&n,ch+1); ans=inf;
	int i;
	for (i=1; i<n; i++){
		int x,y; scanf("%d%d",&x,&y);
		e[x].pb(y); e[y].pb(x);
	}
	for (i=1; i<=n; i++){
		memset(fa,0,sizeof(fa));
		dfs(i);
		if (!(mx[i]&1) && !mn[i]) dn(ans,mx[i]);	
	}
	printf("%d\n",ans<inf?ans/2:-1);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define endl '\n';
#define ll long long
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back

int Pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}


int main() {

   // IOS;
   ll n;
    cin>>n;
    string s;
   while(n>0){
     ll x=(n%26);
     //cout<<x<<endl;
     if(x==0){s+='z';}
     else {s+=(char)(x+96);}
     n/=26;
     if(x==0)n--;
   }
   for(ll i=s.length()-1;i>=0;i--){
    cout<<s[i];
   }



    return 0;
}


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

#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define fi first
#define se second
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef long double ld;
typedef string st;
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
const ll MOD = 1e9 + 7 ;
const ll INF=1e14;
ll mpow(ll a,ll b,ll p=MOD){a=a%p;ll res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const ll N=800005;

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

  ll n,k;
  cin>>n>>k;
  ll a[n];
  forn(i,n) cin>>a[i];
  ll dp[n];
  dp[0]=0;
  for(ll i=1;i<n;i++)
  {
    ll l=1e12;
    for1(j,k)
    {
      if(i-j>=0)
      {
        l=min(l,dp[i-j]+abs(a[i]-a[i-j]));
      }
    }
    dp[i]=l;
  }
  cout<<dp[n-1];
}
//nothing is impossible

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

int main(void) {
    int a, b, k, cnt = 0, ans = 0;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> k;
    for (int i = min(a, b); i >= 1; --i) {
        if (a % i == 0 && b % i == 0) {
            cnt++;
            if (cnt == k) {
                ans = i;
                break;
            }
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef pair<double,double> P1;
const double EPS = 1e-10;
typedef pair<P,P> L;

//kaitenn
P rotate(P p, double rad){
  double x = real(p) * cos(rad) - imag(p) * sin(rad);
  double y = real(p) * sin(rad) + imag(p) * cos(rad);
  return P(x,y);
}

//円
struct Circle{
  P c; //中心点
  double r; //半径
  Circle(P c=P(0,0), double r=0):c(c),r(r){}
};

L getIntangent(Circle a,Circle b,double f=1.0){
  P base=b.c-a.c;
  double w=a.r+b.r;
  double h=sqrt(max(0.0,norm(base)-w*w));
  P k=base*P(w,h*f)/norm(base);
  return L(a.c+k*a.r,b.c-k*b.r);
}

L getOuttangent(Circle a,Circle b,double f=1.0){
  P base=b.c-a.c;
  double h=b.r-a.r;
  double w=sqrt(max(0.0,norm(base)-h*h));
  P k=base*P(w,h*f)/norm(base)*P(0,f);
  return L(a.c+k*a.r,b.c+k*b.r);
}

vector<L> tangentCC(Circle a,Circle b){
  double dis=abs(a.c-b.c),R=a.r+b.r;
  vector<L> res;
  if(dis>R+EPS)res.push_back(getIntangent(a,b));
  if(dis>R-EPS)res.push_back(getIntangent(a,b,-1));
  if(dis>abs(a.r-b.r)+EPS)res.push_back(getOuttangent(a,b));
  if(dis>abs(a.r-b.r)-EPS)res.push_back(getOuttangent(a,b,-1));
  return res;
}

int main(){
  Circle c[2];
  double a,b;
  for(int i=0;i<2;i++){
    cin>>a>>b>>c[i].r;
    c[i].c=P(a,b);
  }
  vector<L> r=tangentCC(c[0],c[1]);
  vector<P1> r1;
  for(int i=0;i<(int)r.size();i++)r1.push_back(P1(r[i].first.real(),r[i].first.imag()));
  sort(r1.begin(),r1.end());
  for(int i=0;i<(int)r1.size();i++)
    printf("%.10f %.10f\n",r1[i].first,r1[i].second);
  return 0;
}

Measured memory_bytes: 1272
fun main(args: Array<String>) {
    val s = readLine() ?: return
    when (s) {
        "SUN" -> 7
        "MON" -> 6
        "TUE" -> 5
        "WED" -> 4
        "THU" -> 3
        "FRI" -> 2
        else -> 1
    }.apply {
        println(toString())
    }
}


Measured memory_bytes: 31936
N = int(input())
A = list(map(int, input().split()))

if A[0] == 1:
    if len(A) > 1:
        print(-1)
        exit()
    else:
        print(1)
        exit()
elif A[0] > 1:
    print(-1)
    exit()

S = [0] * (N + 2)
for i in range(N, -1, -1):
    S[i] = S[i + 1] + A[i]

sec = [0] * (N + 1)
sec[0] = 1
for i in range(1, N + 1):
    a = A[i]
    v = sec[i - 1] * 2
    if v < a:
        print(-1)
        exit()
    sec[i] = min(v - a, S[i + 1])

print(sum(A) + sum(sec[:-1]))
# print(sec)
# print(A)

Measured memory_bytes: 92680
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, X, M = map(int, rl().split())
    
    A = []
    idx = dict()
    cnt = 0
    while 1:
        if X in idx:
            roop_start = idx[X]
            roop_size = cnt - roop_start
            break
        A.append(X)
        idx[X] = cnt
        X = X ** 2 % M
        cnt += 1
    
    if N <= roop_start:
        print(sum(A[:N]))
        return
    
    roop_cnt, rem = divmod(N - roop_start, roop_size)
    ans = sum(A[:roop_start])
    ans += roop_cnt * sum(A[roop_start:roop_start + roop_size])
    ans += sum(A[roop_start:roop_start + rem])
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 77468
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
a, b = map(int, input().split())
#s = input()
#s,t = input().split()
#
#import sys
#sys.setrecursionlimit(10**6)
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

print(max([a+b, a-b, a*b]))

Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    A,B,C=map(int,input().split())
    if (A==B or B==C or C==A) and not A==B==C:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	n, _ := strconv.Atoi(nextLine())
	cols := strings.Split(nextLine(), " ")

	var sum float64

	for i := 0; i < n; i++ {
		fl, _ := strconv.ParseFloat(cols[i], 64)
		sum += 1 / fl
	}
	fmt.Println(1 / sum)

}

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


Measured memory_bytes: 640
n = int(input())
h = list(map(int, input().split()))

for i in range(n - 1, 0, -1):
    if h[i - 1] > h[i]:
        h[i - 1] -= 1

ans = 'Yes' if all(h[i] <= h[i + 1] for i in range(0, n - 1)) else 'No'
print(ans)

Measured memory_bytes: 14224
# C - Sum of product of pairs
from itertools import accumulate


def main():
    N, *A = map(int, open(0).read().split())
    rev_cumsum = list(accumulate(reversed(A[1:])))[::-1]
    MOD = 10 ** 9 + 7
    res = sum(a * c for a, c in zip(A[:-1], rev_cumsum)) % MOD
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 31780
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long W = sc.nextLong();
		long H = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();
		sc.close();
		BigDecimal TWO = new BigDecimal(2);
		BigDecimal bg_W = new BigDecimal(W);
		BigDecimal bg_H = new BigDecimal(H);
		int ans2 = 0;
		if (new BigDecimal(x).multiply(TWO).equals(bg_W) && new BigDecimal(y).multiply(TWO).equals(bg_H)) {
			ans2 = 1;
		}

		System.out.print(bg_W.multiply(bg_H).divide(TWO, 8, BigDecimal.ROUND_DOWN));
		System.out.println(" " + ans2);
	}
}


Measured memory_bytes: 23124
#include <cassert>
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int a[10005];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int alice = 0,bob=0;
    bool f=true;
    for(int j=n-1;j>=0;j--){
        if(f)alice+=a[j];
        else bob+=a[j];
        f=!f;
    }
    cout<<alice-bob;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const ll inf = 1e18;

template <class T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus; 
    exp >>= 1;
  }
  return result % modulus;
}

//mod(1e9+7)
const ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x = 0) : x(x % mod){}
    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
};

int main() {
    ll n, k;
    cin >> n >> k;
    mint sum = 0;
    vector<mint> x(k+1);
    for (int i = k; i >= 1; i--) {
        mint tmp = modpow(k/i,n,mod);
        for (int l = 2; i*l <= k; l++) tmp -= x[i*l];
        x[i] = tmp.x;
        sum += x[i] * i;
    }
    cout << sum.x << endl;
}


Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char a;
  cin >> a;
  if((a == 'a') || (a == 'i') || (a == 'u') || (a == 'e') || (a == 'o')) {
    cout << "vowel" << endl;
  } else {
    cout << "consonant " << endl;
  }
}

Measured memory_bytes: 3612
#pragma comment(linker, "/STACK:500000000")
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <time.h>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;

#define y0 y0ChloeGraceMoretz
#define y1 y1ChloeGraceMoretz
typedef long long ll;
typedef unsigned long long ull;
int nextInt() { int n; scanf("%d", &n); return n; }
ll nextLong() { ll n; scanf("%lld", &n); return n; }
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int INF = (int)2e9;
const int MOD = (int)1e9 + 7;

char s[20];

int main() {
	//freopen("in.txt", "rt", stdin);
	//freopen("out.txt", "wt", stdout);
	scanf("%s", s);
	for (int i = 0; i < 4; ++i) {
		printf("%c", s[i]);
	}
	printf(" ");
	for (int i = 4; i < 12; ++i) {
		printf("%c", s[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    stack<char> c;
    string s;
    cin>>s;
    int len=s.size(),flag=0;
    for(int i=0;i<len;i++)
    {
        if(c.empty()&&s[i]=='C')
            c.push(s[i]);
        if(c.size()==1&&s[i]=='F')
        {
            cout<<"Yes";
            flag=1;
            break;
        }
    }
    if(!flag)
        cout<<"No";
    return 0;
}


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

int main(){
   int N, K;
   std::cin >> N >> K;
   int p[N];
   for(int i=0; i<N; ++i){
      std::cin >> p[i];
   }
   int sum = 0;
   for(int i=0; i<K; ++i) sum += p[i];
   int max_sum = sum;
   for(int i=1; i<=N-K; ++i){
      sum -= p[i-1];
      sum += p[i+K-1];
      max_sum = std::max(max_sum, sum);
   }
   double ans = 0.5 * (max_sum + K);
   std::cout << std::fixed << std::setprecision(10) << ans << std::endl;
   return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;
using namespace std;

int main(){
    ll n, a, ans;
    map<ll,ll> Am, Ap;
    cin >> n;
    REP(int,i,0,n){ 
        cin >> a;
        Am[a-i]++;
        Ap[a+i]++;
    }

    ans = 0;
    for(auto i:Am){
        ans += i.second*Ap[-i.first];
    }
    cout << ans << endl;
}

Measured memory_bytes: 37808
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  vector<int> data{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  int k;
  cin >> k;
  
  cout << data.at(k - 1) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    
    char S[5],Moji_Shurui = 0,i,j;

    scanf("%s",S);

    if(S[0] == S[1] && S[1] == S[2] && S[2] == S[3]){
        printf("No");
    }else if(S[0] == S[2] && S[1] == S[3]){
        printf("Yes");
    }else if(S[0] == S[3] && S[1] == S[2]){
        printf("Yes");
    }else if(S[0] == S[1] && S[2] == S[3]){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;  //数字（整数）
  char op;  //演算子
  cin >> A >> op >> B;  //入力
 
  int ans;  //結果
  
  //演算
  if (op == '+'){
    ans = A + B;
  } else if (op == '-'){
    ans = A - B;
  }
  
  //出力
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long K = sc.nextLong();
		List<BigAry> list = new ArrayList<BigAry>();
		for (long i = 0; i < N; i++) {
			long a = sc.nextLong();
			long b = sc.nextLong();
			BigAry ary = new BigAry(a, b);
			list.add(ary);
		}
		list.sort((a, b) -> (int) a.value - (int) b.value);
		long sum = 0;
		for (int i = 0; i < list.size(); i++) {
			sum += list.get(i).num;
			if (sum >= K) {
				System.out.println(list.get(i).value);
				return;
			}
		}
	}

	public static class BigAry {
		private long value;
		private long num;

		public BigAry(long value, long num) {
			this.value = value;
			this.num = num;
		}
	}

}

Measured memory_bytes: 65984
import java.io.*;
import java.util.Arrays;

public class Main {
  // final String testCase = "[[\"2\\n3 1 2\\n6 1 1\",\"Yes\"],[\"1\\n2 100 100\",\"No\"],[\"2\\n5 1 1\\n100 1 1\",\"No\"]]";
  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out)) {
      
      int n = Integer.parseInt(in.readLine());
      int[][] table = new int[n][3];
      
      String[] lines;
      for(int i=0; i<n; i++) {
        lines = in.readLine().split(" ");
        for(int j=0; j<3; j++)
          table[i][j] = Integer.parseInt(lines[j]);
      }

      final int t = 0;
      final int x = 1;
      final int y = 2;
      int ct,cx,cy; ct = cx = cy = 0;
      boolean isPossible = true;
      for(int i=0; i<n; i++) {
        int d = Math.abs(table[i][x] - cx) + Math.abs(table[i][y] - cy);
        int time = table[i][t] - ct;
        if(time < d || (time-d) % 2 != 0) {
          isPossible = false;
          break;
        }
      }

      String ans = isPossible ? "Yes" : "No";
      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 46852
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define BOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
    
    ll H,W,N;
    cin>>H>>W>>N;
    set< pair<ll,ll> > S;
    REP(i,N){
        ll a,b; cin>>a>>b;
        S.insert(make_pair(a,b));
    }
    
    set< pair<ll,ll> > used;
    ll cnt[10];
    REP(i,10)cnt[i]=0;
    
    for(auto itr=S.begin();itr!=S.end();itr++){
        for(ll i=-1;i<=1;i++){
            for(ll j=-1;j<=1;j++){
                ll a=itr->first+i;
                ll b=itr->second+j;
                if(a>=2&&a<=H-1&&b>=2&&b<=W-1){
                    if(used.find(make_pair(a,b))==used.end()){
                        used.insert(make_pair(a,b));
                        ll sum=0;
                        for(ll k=-1;k<=1;k++){
                            for(ll l=-1;l<=1;l++){
                                if(S.find(make_pair(a+k,b+l))!=S.end()){
                                    sum++;
                                }
                            }
                        }
                        cnt[sum]++;
                    }
                }
            }
        }
    }
    
    ll zero=(H-2)*(W-2)-used.size();
    cnt[0]=zero;
    REP(i,10)cout<<cnt[i]<<endl;
    
    return 0;
}

Measured memory_bytes: 62720
n, c, k = map(int, input().split())
t = []
for _ in range(n):
    t.append(int(input()))
t.sort()
temp = t[0]
count = 0
ans = 1
for i in range(n):
    if count < c:
        if t[i] <= temp + k:
            count += 1
        elif t[i] > temp + k:
            temp = t[i]
            ans += 1
            count = 1
    elif count == c:
        count = 1
        temp = t[i]
        ans += 1
print(ans)

Measured memory_bytes: 7392
#include <stdio.h>

int main(void) {
	int a[4], b[4], i, j, hit, blow;
	while (scanf ("%d%d%d%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) != EOF){
		hit = blow = 0;
		for (i=0; i<4; i++){
			if (a[i] == b[i]) hit++;
			for (j=0; j<4; j++){
				if (i!=j && a[i]==b[j]) blow++;
			}
		}
		printf ("%d %d\n", hit, blow);
	}
	return 0;
}

Measured memory_bytes: 0
n = gets.to_i
res = 0.0
n.times do |_|
  x, u = gets.chomp.split
  case u
  when "JPY"
    res += x.to_f
  when "BTC"
    res += 380000.0  * x.to_f
  end
end
puts "%.6f" % res

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

points = [list(map(int, input().split(" "))) for _ in range(n)]
X = 0
Y = 1
ans = 10 ** 14
if n == 1:
    ans = 1
else:
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            x1, y1 = points[i]
            x2, y2 = points[j]
            p = x1 - x2
            q = y1 - y2
            cost = n
            for point1 in points:  # そのpointからcost0で遷移できる先があるかどうか
                fromx, fromy = point1
                for point2 in points:
                    tox, toy = point2
                    if fromx - tox == p and fromy - toy == q:
                        cost -= 1
                        break
            if ans > cost:
                ans = cost
print(ans)





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

long long n, k, m = 0;
long long h[200000];

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

	for (long long i = 0; i < n; i++)
		cin >> h[i];

	sort(h, h + n);

	if (k < n) {
		for (long long i = 0; i < n - k; i++)
			m += h[i];
	}

	cout << m << endl;

	return 0;
}

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

int main(){
 int N, X;
 cin >> N >> X;
 int L[N], D[N+1]={0};
 for(int i=0;i<N;i++){
  cin >> L[i] ;
 }
 int count=1;
 for(int i=1;i<N+1;i++){
   D[i]=D[i-1]+L[i-1];
   if(D[i]<=X) count++;
 }
  
 cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
long long a[101], b[101];
int main (){
	long long n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; ++i){
		cin >> b[i] >> a[i];
	}
	for(int i = 0; i <= n; ++i){
		for(int j = 0; j <= 1e5; ++j){
			dp[i][j] = 1e16;
		}
	}
	dp[0][0] = 0;
	for(int i = 1; i <= n; ++i){
		for(int j = 1e5; j >= 0; --j){
			dp[i][j] = dp[i - 1][j];
			if(j >= a[i]) dp[i][j] = min(dp[i][j], dp[i - 1][j - a[i]] + b[i]);
		}
	}
	for(int i = 1e5; i >= 0; --i){
		if(dp[n][i] <= m){
			cout << i;
			return 0;
		}
	} 
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,i,j,s=0,maxv=-1;
	cin>> n;
	string a[n+1];
	for (i=1;i<=n;i++)
		cin>> a[i];
	cin>> m;
	string b[m+1];
	for (i=1;i<=m;i++)
		cin>>b[i];
	for (i=1; i<=n; i++)
	{
		for (j=1; j<=n; j++)
			if (a[i]==a[j]) s++;
		for (j=1; j<=m; j++)
			if (a[i]==b[j]) s--;
		maxv=max(maxv, s);
		s=0;
	}
	if (maxv<0) cout << 0 << endl;
	else cout << maxv << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
//using long long ll;
int sum = 0;
bitset<3> kip(string S){
    //int n = S.size() - 1;
    //int a;
    string ret;
    for(int bit = 0;bit < (1 << 3);bit++){//+か-
        bitset<3> Hey(bit);//これでいいじゃん！！
        sum = S.at(0) - '0';//Aから足すかひくか的な
        //a = S.at(i) - '0';
        for(int i = 0;i<3;i++){//bitsetのi番目が1ならば、+を与えて、0ならば、-を与えるようにすればいいのでは
            if(Hey.test(i)){//足すかひくかの判定か？1ならたすかtrueが帰ってきたら、+を与えろ
                sum +=  S.at(i + 1) - '0';//B,C,Dにおけるやつだからね
            }else{
                sum -= S.at(i + 1) - '0';//0が帰ってきたらマイナスするんよ
            }    
        }
        //--------終わった後、7と一緒か調べる
        if(sum == 7){
            return Hey;//bitの構成を返す。
        }
    }
    return 0;
}



int main(){
    string S;
    cin >> S;
    bitset<3> Ans;
    Ans = kip(S);
    
    cout << S.at(0);
    for(int i = 0;i<3;i++){
        if(Ans.test(i)){//1やったら、
            cout << "+";
        }else{//0やったらまいなす
            cout << "-";
        }
        cout << S.at(i + 1);
    }
    cout << "=" << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;

  if(s[0]!='A'){
    cout << "WA" << endl;
    return 0;
  }
  
  int x=0,y;
  for(int i=2;i<s.size()-1;i++){
    if(s[i]=='C') {
      x++;
      y=i;
    }
  }
  if(x!=1) {
    cout << "WA" << endl;
    return 0;
  }
  
  for(int i=1;i<s.size();i++){
    if(i==y) continue;
    else if((int)s[i]<97 || 122<(int)s[i]){
      cout << "WA" << endl;
      return 0;
    }
  }
  
  cout << "AC" << endl;
  return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#define PI 3.14159265359
typedef long long ll;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
using namespace std;


ll llmin(ll x, ll y){
	if (x < y) return x;
	return y;
}

ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}

int main(){
	ll h, w;
	cin >> h >> w;

	if (h % 3 == 0 || w % 3 == 0){
		cout << 0 << endl;
		return 0;
	}

	ll ans = llmin(h, w); 

	for (int i = -1; i <= 1; i++){
		for (int j = -1; j <= 1; j++){
			ll a = (h/3+i)*w;
			ll b = (h-h/3-i)*(w/2+j);
			ll c = (h-h/3-i)*(w-w/2-j);
			ans = llmin(ans, llmax(a, llmax(b, c)) - llmin(a, llmin(b, c)));
		}
	}
	for (int i = -1; i <= 1; i++){
		for (int j = -1; j <= 1; j++){
			ll a = (w/3+i)*h;
			ll b = (w-w/3-i)*(h/2+j);
			ll c = (w-w/3-i)*(h-h/2-j);
			ans = llmin(ans, llmax(a, llmax(b, c)) - llmin(a, llmin(b, c)));
		}
	}
	cout << ans << endl;
	return 0;
}


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

ll mod;
vector<int> g[MAX];
vector<ll> dp(MAX,-1);
vector<ll> ans(MAX,-1);

ll dfs1(int i,int p = -1) {
  if(dp[i] != -1) return dp[i];
  ll res = 1;
  for(auto k : g[i]) {
    if(k != p) (res *= dfs1(k,i) + 1) %= mod;
  }
  return dp[i] = res;
}

void dfs2(int i, int p = -1) {
  int l = g[i].size();
  vector<ll> left(l+1,1);
  vector<ll> right(l+2,1); 
  for(int j = 1; j <= l; j++) {
    left[j] = (left[j-1]*(dp[g[i][j-1]]+1)) % mod;
    right[l+1-j] = (right[l+2-j]*(1+dp[g[i][l-j]])) % mod;
  }
  ans[i] = left[l];
  for(int j = 1; j <= g[i].size(); j++){
    ll v = dp[i];
    dp[i] = (left[j-1]*right[j+1]) % mod;
    if(g[i][j-1] != p) dfs2(g[i][j-1],i);
    dp[i] = v;
  }
}

int main(){
  int n;
  cin >> n >> mod;
  rep(i,n-1) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  ll a = dfs1(0); dfs2(0);
  rep(i,n) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 19712
n = gets.chomp.to_i
h = Hash.new(0)
(1..n).each do |i|
  (1..n).each do |j|
    h[i.gcd(j)] += 1
  end
end
s = 0
(1..n).each do |i|
  (1..n).each do |j|
    s += i.gcd(j) * h[j]
  end
end
puts s

Measured memory_bytes: 14428