akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include <string.h>



int main() {
	int i, j, k, l;
	int m, h, g;
	int f = 0;
	int n;
	int a, b;

	h = 1;

	scanf("%d %d", &a, &b);

	for (i = 0;h<b;i++) {
		h = h - 1 + a;
	}

	f = i;


	printf("%d", f);

	return 0;
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

type Job struct {
	A, B int
}

func main() {
	defer stdout.Flush()
	N := readInt()
	J := make([]Job, N)
	for i := range J {
		J[i].A = readInt()
		J[i].B = readInt()
	}

	pq := new(PriorityQueue)
	/*
	push := func(x Job) {
		heap.Push(pq, x)
	}
	pop := func() Job {
		x := heap.Pop(pq)
		return x.(Job)
	}
	empty := func() bool {
		return pq.Len() == 0
	}
	*/

	for _, x := range J {
		// push(x)
		heap.Push(pq,x)
	}
	t := 0
	for pq.Len() != 0  {
		j := heap.Pop(pq).(Job)
		t += j.A
		if j.B < t {
			println("No")
			return
		}
	}
	println("Yes")

}

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

type PriorityQueue []Job

func (pq PriorityQueue) Len() int {
	return len(pq)
}

func (pq PriorityQueue) Less(i, j int) bool {
	return pq[i].B < pq[j].B
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func (pq *PriorityQueue) Push(x interface{}) {
	old := *pq
	*pq = append(old, x.(Job))
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old) - 1
	x := old[n]
	*pq = old[:n]
	return x
}

Measured memory_bytes: 20736
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d",&a,&b);
	c=a+b;
	if(c==3)
	{
		printf("3");
	}
	else if(c==4)
	{
		printf("2");
	}
	else if(c==5)
	printf("1");
 } 

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int h,r;
  cin>>h>>r;
  if(h>0){
    cout<<1<<"\n";
  }
  else if(abs(h)==r){
    cout<<0<<"\n";
  }
  else if(abs(h)<r){
    cout<<1<<"\n";
  }
  else{
    cout<<-1<<"\n";
  }
  return 0;
}
/* 
   cout<<fixed<<setprecision(6)<<b<<"\n";
   return 0;
   }*/





Measured memory_bytes: 3232
from heapq import heapify,heappop,heappush
def next_num(n):
    if n==0:
        return[0,1]
    elif n==9:
        return[8,9]
    else:
        return[n-1,n,n+1]

K=int(input())
queue=[1,2,3,4,5,6,7,8,9]
heapify(queue)

for _ in range(K-1):
    now=heappop(queue)
    #print("now",now)
    for next_i in next_num(now%10):
        heappush(queue,now*10+next_i)
    #print(queue)
print(queue[0])

Measured memory_bytes: 12228
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;

int main() {
  cin >> N;

  string ans = "";
  ll v = 1;

  for (ll i = 0; i <= 40; i++) {
    if (N == 0) {
      break;
    }
    if (N % (2 * abs(v)) != 0) {
      ans = '1' + ans;
      N -= v;
    } else {
      ans = '0' + ans;
    }
    v *= -2;
  }
  if (ans == "") {
    cout << 0 << "\n";
    return 0;
  }

  bool non_zero = false;
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i] == '1') {
      non_zero = true;
    }
    if (non_zero) {
      cout << ans[i];
    }
  }
  cout << "\n";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
        var n = ReadLine().Split().Select(int.Parse).ToArray();
        var c = new char[n[0], n[1]];
        for(int y = 0; y < n[0]; y++)
        {
            var s = ReadLine();
            for(int x = 0; x < n[1]; x++)
            {
                c[y, x] = s[x];
            }
        }
        for(int y = 0; y < n[0]; y++)
        {
            for(int x = 0; x < n[1]; x++)
            {
                if(c[y, x] != '.')
                    continue;

                var count = 0;
                for(int j = -1; j < 2; j++)
                {
                    for(int i = -1; i < 2; i++)
                    {
                        if(0 <= y + j && y + j < n[0] && 0 <= x + i && x + i < n[1])
                        {
                            if(c[y + j, x + i] == '#')
                                count++;
                        }
                    }
                }

                c[y, x] = count.ToString()[0];
            }
        }
        var sb = new StringBuilder();
        for(int y = 0; y < n[0]; y++)
        {
            for(int x = 0; x < n[1]; x++)
            {
                sb.Append(c[y, x]);
            }
            sb.Append("\r\n");
        }
        Write(sb.ToString());
    }
}


Measured memory_bytes: 19168
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    int n;
    cin >> n;
    vector<int> a(n);
    ll sum_p = 0,sum_n = 0,c = 0;
    for(auto &i : a){
        cin >> i;
        if(i >=0 ){
            sum_p += i;
        }else{
            c++;
            sum_n -= i;
        }
        i = abs(i);
    }
    sort(all(a));
    ll sum = sum_p+sum_n;
    if(c & 1){
        sum -= 2*a[0];
    }
    cout << sum << "\n";
}

Measured memory_bytes: 640
mod = int(1e9+7)
n = int(input())
ans1 = 1
ans2 = 1
ans3 = 1
for i in range(n):
    ans1 *= 10
    ans1 %= mod
    ans2 *= 9
    ans2 %= mod
    ans3 *= 8
    ans3 %= mod

ans = ans1 - 2*ans2 + ans3

print(ans%mod)

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

int main(void) {
    int N,M;cin>>N>>M;
    int sum = 0;
    for (int i = 0; i < M; i++) {
        int A;cin>>A;
        sum += A;
    }
    if (N >= sum) cout << N - sum << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 1000000007 
#define mod2 998244353
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}



int main() {
   fast();
   int n;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++){
    cin>>a[i];
   }
   int tri=0;
   for(int i=0;i<n;i++){
    tri=__gcd(a[i],tri);
   }
   for(int i=0;i<n;i++){
      a[i]=a[i]/tri;
   }
   if(n==1){
    cout<<mod-7<<"\n";
    return 0;
   }
   if(n==2){
    cout<<max(a[0]*tri,a[1]*tri);
    return 0;
   }
   sort(a,a+n);
   vector<int> v;
   for(int i=1;i<=sqrt(a[0]);i++){
    if(a[0]%i==0){
      v.pb(i);
      v.pb(a[0]/i);
    }
   }
   for(int i=1;i<=sqrt(a[1]);i++){
    if(a[1]%i==0){
      v.pb(i);
      v.pb(a[1]/i);
    }
   }
   sort(v.begin(),v.end());
   for(int i=v.size()-1;i>=0;i--){
    int count=0;
      for(int j=0;j<n;j++){
          if(a[j]%v[i]==0){
            count++;
          }
      }
      if(count==n-1){
        cout<<tri*v[i]<<"\n";
        return 0;
      }
   }
   cout<<tri<<"\n";
   return 0;


}


Measured memory_bytes: 4064
fun main(args: Array<String>) {
    var n = readInputLine().toInt()
    
    val aList = readInputLine().split(" ").map { it.toLong() }
    
    var ans = 0L
    
    for (a in aList) {
        var tmp = a
        while (tmp and 1L == 0L) {
            ans++
            tmp = tmp shr 1
        }
    }
    
    println(ans)
}
 
fun readInputLine(): String {
    return readLine()!!
}


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

int N;

ll cal(ll x)
{
	ll lst = N/x;
	return (1+lst)*lst/2;
}

void solve()
{
	ll ans = 0;
	for(ll d=1;d<=N;++d){
		ans += d*cal(d);
	}
	cout << ans << '\n';
}

int main()
{
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 3536
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        /*
        long n = long.Parse(Console.ReadLine());
        long[] input = new long[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=long.Parse(Console.ReadLine());
        }
        */
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        Console.WriteLine(Math.Max(input[0]*input[1],Math.Max(input[0]-input[1],input[0]+input[1])));


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 105
#define BLACK 0
#define GRAY 1
#define WHITE 2

int n;
int G[MAX][MAX];
int d[MAX], color[MAX];

void init();
void bfs();

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

    for(int i = 0; i < n; i++){
        int u,k; cin >> u >> k;
        for(int j = 0; j < k; j++){
            int v; cin >> v;
            G[u-1][v-1] = 1;
        }
    }

    bfs();

    for(int i = 0; i < n; i++){
        cout << i+1 << " " << d[i] << endl;
    }
    return 0;
}

void init(){
    for(int i = 0; i < n; i++){
        d[i] = -1;
        color[i] = WHITE;
        for(int j = 0; j < n; j++){
            G[i][j] = 0;
        }
    }
}

void bfs(){
    queue<int> Q;
    int now = 0;
    color[now] = GRAY; d[now] = 0;
    Q.push(now);

    while (!Q.empty()){
        for(int i = 0; i < n; i++){
            if(color[i] == WHITE && G[now][i] == 1){
                Q.push(i); color[i] = GRAY; d[i] = d[now]+1;
            }
        }
        Q.pop(); now = Q.front(); color[now] = BLACK;
    }

}



Measured memory_bytes: 3104
import collections
N, M = map(int, input().split())
H = [0]
H += list(map(int, input().split()))

a_l = [1] * (N + 1)
for i in range(M):
    a, b = map(int, input().split())
    if H[a] > H[b]:
        a_l[b] = 0
    elif H[a] < H[b]:
        a_l[a] = 0
    else:
        a_l[a] = a_l[b] = 0
print(a_l.count(1) - 1)

Measured memory_bytes: 20492
//
// Manacher のアルゴリズム
//   res[i] := S[i] を中心とする S 上の奇数長の最長回文の半径 (中心を含む)
//   偶数長の回文を求めたいときは S = "abc" に対して "a$b$c" といった処理をするテクがある
//
// verified:
//   RUPC 2019 day3-E 往復文字列
//     https://onlinejudge.u-aizu.ac.jp/beta/room.html#RitsCamp19Day3/problems/E
//


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


struct Manacher {
    string S;
    vector<int> len;

    // construct
    Manacher(const string &iS) { init(iS); }
    void init(const string &iS) {
        S = "";
        for (int i = 0; i < (int)iS.size(); ++i) {
            S += iS[i];
            if (i + 1 < (int)iS.size()) S += "$";
        }
        construct();
    }
    void construct() {
        int N = (int)S.size();
        len.resize(N);
        int i = 0, j = 0;
        while (i < N) {
            while (i-j >= 0 && i+j < N && S[i-j] == S[i+j]) ++j;
            len[i] = j;
            int k = 1;
            while (i-k >= 0 && i+k < N && k+len[i-k] < j) len[i+k] = len[i-k], ++k;
            i += k, j -= k;
        }
    }

    // radius, center is i
    inline int get_odd(int i) { return (len[i*2] + 1) / 2; }

    // radius, center is between i-1 and i
    inline int get_even(int i) { return len[i*2-1] / 2; }

    // judge if [left, right) is palindrome
    inline bool ispalin(int left, int right) {
        int mid = (left + right) / 2;
        if ((right - left) & 1) return ( get_odd(mid) == (right - left + 1)/2);
        else return (get_even(mid) == (right - left)/2);
    }
};


int main() {
    int N; string S;
    cin >> N >> S;

    Manacher m(S);
    int res = N;
    for (int len = 2; len < N; ++len) {
        bool ok = true;
        for (int i = len - 1; i < N; i += len - 1) {
            if (m.get_odd(i) != min(i+1, N-i)) ok = false;
        }
        if (ok) {
            res = len;
            break;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 13836
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
string s, s1;
int dp[3005][3005];
int solve(int i, int j)
{
     if(i==s.size() || j==s1.size())
        return 0;
     if (dp[i][j]!=-1)
        return dp[i][j];
     int ans;
     if(s[i]==s1[j])
        ans= 1+solve(i+1,j+1);
     else{
        ans=max(solve(i+1,j),solve(i,j+1));
     }
     dp[i][j]=ans;
     return ans;

}
void sol(int i, int j)
{
    if(i==s.size() || j==s1.size())
        return;
    if(s[i]==s1[j]){
        cout << s[i];
        sol(i+1,j+1);
    }
    else{
        if(dp[i][j]==solve(i+1,j))
        {
            sol(i+1,j);
        }
        else if(dp[i][j]==solve(i,j+1))
        {
            sol(i,j+1);
        }
    }

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> s >> s1;
    memset(dp, -1, sizeof dp);
    int len = solve(0,0);
    sol(0,0);
    return 0;
}

Measured memory_bytes: 35840
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPD(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
#define TLE() cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms.\n";
const ll MOD = 1E9+7;
const ll IINF = 1E18;
const int INF = 1e9;
const double EPS = 1E-9;
const double PI = atan(1.0) * 4.0;
template<class T> T getbit(T s, int i) {return s>>i&1;}
template<class T> void flipbit(T& s, int i) {s^=(1LL<<i);}
constexpr int cntbit(ll x) {return __builtin_popcountll(x);}
constexpr int lg2(ll x) {return __lg(x);} // return int(log2(x))
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); 
ll fpow(ll a,ll p){ll res=1LL;while(p){if(p&1LL) res=res*a%MOD;a=a*a%MOD;p>>=1LL;} return res;}

const int N=1e5+5;
int n,m;
int dist[N*3];
vector<int> adj[N*3];

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	REP(i,m){
		int u,v;
		cin>>u>>v;
		adj[u].pb(v+n);
		adj[u+n].pb(v+2*n);
		adj[u+2*n].pb(v);
	}
	int s,t;
	cin>>s>>t;
	auto bfs=[&]()->int{
		memset(dist,-1,sizeof dist);
		queue<int> q;
		dist[s]=0;
		q.push(s);
		while(!q.empty()){
			int u=q.front();
			q.pop();
			for(int v:adj[u])
				if(dist[v]==-1){
					dist[v]=dist[u]+1;
					q.push(v);
				}
		}
		return dist[t];
	};
	int res=bfs();
	cout<<(res==-1?-1:res/3)<<'\n';
}



Measured memory_bytes: 21184
N,M = map(int,input().split())
A = list(map(int,input().split()))
weight = [0,2,5,5,4,5,6,3,7,6]
dp = [-1]*(N+1)
dp[0] = 0

for i in range(N+1):
    if dp[i] == -1:continue
    for a in A:
        if i+weight[a] < N+1:
            dp[i+weight[a]] = max(dp[i+weight[a]],dp[i]*10+a)
print(dp[N])

Measured memory_bytes: 14692
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

char s[5];
int main() {
	scanf("%s", s);
	bool r = false;
	for (int i = 0; i < 3; i++)
		r |= s[i] == s[i + 1];
	printf(r ? "Bad\n" : "Good\n");
}

Measured memory_bytes: 128
import java.util.*

fun main(args: Array<String>){
	val cin = Scanner(System.`in`)
    val n = cin.nextInt()

    var sum: Long = 0
    val a: MutableList<Long> = mutableListOf()
    for (i in 1..n) {
        val ai = cin.nextLong()
        a.add(ai)
        sum += ai
    }

    var sum_one: Long = 0
    for (i in 1..n) {
        sum_one += i
    }
    
    var ok = 1
    var bye_n: Long = 0
    if (sum % sum_one == 0.toLong()) {
        bye_n = sum/sum_one
    } else {
        ok = 0
    }

    var real_bye_n: Long = 0

    val cuts: MutableList<Long> = mutableListOf()

    if (ok == 1) {
        for (i in 1..n) {
            var sub: Long
            if (i == n) {
                sub = a[0] - a[n-1]
            } else {
                sub = a[i] - a[i-1]
            }
            var cut: Long = bye_n - sub
            if (cut < 0) {
                ok = 0
                break
            }
            if (cut % n == 0.toLong()) {
                cut = cut/n
            } else {
                ok = 0
                break
            }
            real_bye_n += cut
            cuts.add(cut)
        }
    }

    if (ok == 1 && real_bye_n != bye_n) {
        ok = 0
    }

    if (ok == 1) {
        for (i in 1..n) {
            
        }
    }

    if (ok == 1) {
        println("YES")
    } else {
        println("NO")
    }
}

Measured memory_bytes: 59580
# -*- coding: utf-8 -*-
from collections import defaultdict


n = int(input())
words = defaultdict(int)
for _ in range(n):
    sorted_word = sorted(input())
    words[''.join(sorted_word)] += 1

cases = 0
for key, val in words.items():
    if val == 1:
        continue
    cases += (val * (val - 1) // 2)

print(cases)

Measured memory_bytes: 64252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> h(n);
  for(int i = 0;i < n;i++){
    cin >> h[i];
  }
  long long lo = 1, hi = 1e9;
  while(lo < hi){
    ll mid = (lo + hi) / 2;
    vector<int> cp = h;
    long long cnt = 0;
    for(auto el : h){
      if(el - mid * b > 0){
        cnt += (el - mid * b + a - b - 1) / (a - b);
      }
    }
    if(cnt > mid)
      lo = mid + 1;
    else
      hi = mid;
  }
  cout << lo;

}


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

int main() {
    int H, W;
    cin >> H >> W;

    vector<string> G(H);
    rep(i, H) cin >> G[i];

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

    auto bfs = [&](int sy, int sx) {
        int res = 0;
        queue<pair<int, int>> que;
        vector<vector<int>> dist(H, vector<int>(W, -1));
        que.emplace(sy, sx);
        dist[sy][sx] = 0;
        while(!que.empty()) {
            auto cur = que.front(); que.pop();
            int y = cur.first, x = cur.second;
            for(int i = 0; i < 4; ++i) {
                int ny = y + dy[i], nx = x + dx[i];
                if(ny < 0 || nx < 0 || ny >= H || nx >= W) continue;
                if(dist[ny][nx] != -1) continue;
                if(G[ny][nx] == '.') {
                    que.emplace(ny, nx);
                    dist[ny][nx] = dist[y][x] + 1;
                    res = max(res, dist[ny][nx]);
                }
            }
        }
        return res;
    };
    int ans = 0;
    rep(i, H) rep(j, W) {
        if(G[i][j] == '.') {
            int mx = bfs(i, j);
            ans = max(ans, mx);
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int comp(const void *a,const void *b){
    return -strcmp((char*)a,(char*)b);
}
int main(void){
    char s[100+5], t[100+5];
    scanf("%s %s", s, t);
    
    qsort(s, strlen(s), sizeof(char), strcmp);
    qsort(t, strlen(t), sizeof(char), comp);
    if(strcmp(s, t)>=0)printf("No\n");
    else printf("Yes\n");
}


Measured memory_bytes: 1632
#include <stdio.h>
int S[100000],n;
int search(int T){
  int l=0,r=n,m;
  while(l<r){
    m=(l+r)/2;
    if(T==S[m]) return 0;
    else if(T>=S[m]) l=m+1;
    else if(T<=S[m]) r=m;
  }
  return 1;
}

int main(){
  int q,T,i,a=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&T);
    if(search(T)==0) a++;
  }
  printf("%d\n",a);
  return 0;
}



Measured memory_bytes: 2112
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<int> B(N);
    rep(i,N) {
        cin >> B[i];
        B[i]--;
    }
    vector<int> ans;
    while (!B.empty()) {
        int M = B.size();
        bool ok = false;
        for (int i = M-1; i >= 0; i--) {
            if (B[i]==i) {
                ans.emplace_back(i+1);
                B.erase(B.begin()+i);
                ok = true;
                break;
            }
        }
        if (!ok) {
            cout << -1 << ln;
            return 0;
        }
    }
    reverse(all(ans));
    for (auto i : ans) cout << i << ln;
    return 0;
}


Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

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

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	ok := false
	for i := 0; i <= 25; i++ {
		for j := 0; j <= 15; j++ {
			if i*4+j*7 == N {
				ok = true
			}
		}
	}

	if ok {
		fmt.Fprintln(wtr, "Yes")
	} else {
		fmt.Fprintln(wtr, "No")
	}
	wtr.Flush()
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int  k[32];
int main(){
  int k[32]={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 n;
  cin >> n;
  cout << k[n-1];
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n, m, x, a[100];
	cin >> n >> m >> x;
	int s = 0, t = 0;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		if (a[i] > x)s++;
		else t++;
	}
	cout << (s < t ? s : t)<< endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stdio.h>
#define rep(i,n) for(int i = 0; i < (n); ++i);
using namespace std;

int main() {
	string S;
	cin >> S;
	if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
/******************************************************************************

рассвет.

*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define all(a) (a).begin(),(a).end()
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int>
#define vplli vector <pair <lli,lli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s)
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i];
using namespace std;

const lli MOD=1e9+7;
const lli MAXN=5e4+1;
const ld PI=acos(-1);

int main(){
    rapgame
    //freopen("bridges.in", "r", stdin);
    //freopen("bridges.out", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--){
         read2(x,a);
         cout << (x<a ? "0":"10");
    }
    return 0;
}

Measured memory_bytes: 3620
def main():
    N,K = map(int,input().split())
    XY = [list(map(int,input().split())) for _ in [0]*N]
    
    iX = sorted(x for x,y in XY)
    iY = sorted(y for x,y in XY)
    X = {x:i for i,x in enumerate(iX)}
    Y = {y:i for i,y in enumerate(iY)}

    c = [[0]*(N+1) for i in [0]*(N+1)]
    for x,y in XY:
        c[Y[y]+1][X[x]+1] = 1

    for i in range(N):
        ci1 = c[i+1]
        for j in range(N):
            ci1[j+1] += ci1[j]
    for i in range(N):
        ci1 = c[i+1]
        ci = c[i]
        for j in range(N):
            ci1[j+1] += ci[j+1]

    ans = 10**20
    for u in range(N):
        for d in range(u+K-1,N):
            l = 0
            r = K-1
            dY = iY[d]-iY[u]
            cd = c[d+1]
            cu = c[u]
            while r<N:
                if cd[r+1]+cu[l]-cu[r+1]-cd[l] >=K:
                    ans = min(ans, (iX[r] - iX[l])*dY)
                    l+=1
                else:r+=1

    print(ans)
main()

Measured memory_bytes: 3064
#include <stdio.h>
int main()
{
  int N=0;
  int D=0;
  int a = 0;
  int b = 0;
  scanf("%d %d",&N,&D);

  a = N/(1+2*D);
  b = N%(1+2*D);
  if(b!=0)
  {
    a++;
  }
  printf("%d",a);
  return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static int N,sum,ans;
	static Block block;
	static List<Block> list= new LinkedList<Block>();
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		label:while(true){
			N=cin.nextInt();
			if(N==0)break;
			sum=cin.nextInt();
			ans=0;
			list= new LinkedList<Block>();
			list.add(new Block(sum));
			for(int i=1;i<N;i++){
				int in=cin.nextInt();
				sum+=in;
				list.add(new Block(in));
			}
			int sankaku=1;
			int step=2;
			while(true){
				if(sankaku==sum){
					break;
				}
				sankaku+=step++;
				if(sankaku>(100*101)/2){
					System.out.println(-1);
					continue label;
				}
			}
			while(true){
				step=1;
				int s=0;
				for(Block b:list){
					if(step!=b.num)break;
					step++;
					s+=b.num;
				}
				if(sum==s){
					System.out.println(ans);
					break;
				}
				ans++;
				if(ans>10000){
					System.out.println(-1);
					continue label;
				}
				int size=list.size();
				List<Integer> rm=new ArrayList<Integer>();
				for(int i=0;i<list.size();i++){
					Block b=list.get(i);
					b.num--;
					if(b.num==0){
						list.remove(i);
						i--;
					}
				}
				list.add(new Block(size));

				for(Block b:list){
//					System.out.println(b.num);
				}
//				System.out.println();

//				System.out.println(sum+" "+s);
//
			}
		}

	}
	static class Block{
		int num;
		Block left,right;
		Block(int a){
			num=a;
		}
	}
}

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

c = 0
for i in range(N-1, -1, -1):
    m = min(A[i+1], B[i])
    c += m
    A[i+1] -= m
    B[i] -= m
    m = min(A[i], B[i])
    c += m
    A[i] -= m
    B[i] -= m
print(c)


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

int main(){
    int N;
    cin >> N;
    vector<long long> H(N);
    for(int i=0; i<N; i++){
        cin >> H[i];
    }

    long long val = H[N-1];
    for(int i=N-2; i>=0; i--){
        if(H[i] <= val){
            val = H[i];    
            continue;
        }else{
            if(H[i]-1 <= val){
                val = H[i] - 1;
                continue;
            }
        }

        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    return 0;

}

Measured memory_bytes: 3936
#include<iostream>
#include<queue>
#include<string>
using namespace std;

int main() {
	string sa, sb, sc;
	queue<char>qa, qb, qc;
	cin >> sa >> sb >> sc;
	for (int i = 0; i < sa.size(); i++) qa.push(sa[i]);
	for (int i = 0; i < sb.size(); i++)qb.push(sb[i]);
	for (int i = 0; i < sc.size(); i++)qc.push(sc[i]);

	char now = 'a';
	while (1) {
		if (now == 'a') {
			if (qa.empty())break;
			now = qa.front();
			qa.pop();
		}
		else if (now == 'b') {
			if (qb.empty())break;
			now = qb.front();
			qb.pop();
		}
		else {
			if (qc.empty())break;
			now = qc.front();
			qc.pop();
		}
	}
	now -= 32;
	cout << now << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL H; std::cin >> H;
  LL n = pow(2, (LL)log2(H));
  std::cout << 2 * n - 1 << std::endl;
}


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

int main(){
  int n,m;cin>>n>>m;
  vector<int> h(n);
  vector<bool> hans(n,true);
  for(int i=0;i<n;i++)cin>>h[i];
  
  for(int i=0;i<m;i++){
    int a,b;cin>>a>>b;a--;b--;
    if(h[a]<h[b])hans[a]=false;
    else if(h[a]>h[b])hans[b]=false;
    else {hans[a]=false;hans[b]=false;}
  }
  
  int ans=0;
  for(int x:hans)if(x)ans++;
  cout<<ans<<endl;
}

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

using namespace std;

const int N=2e5+5;

int arr[N];
int issorted[N];
int n,k;
set<int> ss;

int issort(int x)
{
	if(x<k-1) return 0;
	return (issorted[x]-issorted[x-k+1])==k-1;
}

int main()
{
	cin >> n >> k;
	for(int i=0;i<n;i++) {cin >> arr[i]; if(i) issorted[i]=(arr[i]>arr[i-1])+issorted[i-1];}
	for(int i=0;i<k;i++) ss.insert(arr[i]);
	int ans=1-issort(k-1);
	for(int i=k;i<n;i++)
	{
		ss.insert(arr[i]);
		int mn=(*ss.begin()),mx=*(--ss.end());
		//if(issort(i)) cout << i << " " << (mn==arr[i-k]&&mx==arr[i]) << endl;
		if((mn==arr[i-k]&&mx==arr[i]) || issort(i));
		else ans++;
		ss.erase(arr[i-k]);
	}
	for(int i=k-1;i<n;i++) if(issort(i)) {ans++; break;}
	printf("%d\n",ans);
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
int n,k;
int a[200005];
int cnt[200005];
int num;
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(!cnt[a[i]])
			num++;
		cnt[a[i]]++;
	}
	if(num<=k)
	{
		cout<<"0\n";
		return 0;
	}
	num-=k;
	sort(cnt,cnt+n+1);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(!num)
			break;
		if(cnt[i]==0)
			continue;
		ans+=cnt[i];
		num--;
	}
	cout<<ans<<"\n";
	return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>

int min(int [], int);
int max(int [], int);

int main(void)
{
    int i, n, q, com, b, e, A[1000];

    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", A + i);

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d %d %d", &com, &b, &e);
        if (com)
            printf("%d\n", max(A + b, e - b));
        else
            printf("%d\n", min(A + b, e - b));
    }

    return 0;
}

int min(int A[], int N)
{
    int min, i;
    
    for (min = 0, i = 1; i < N; i++)
        if (A[i] < A[min]) min = i;
    return A[min];
}

int max(int A[], int N)
{
    int max, i;
    for (max = 0, i = 1; i < N; i++)
        if (A[i] > A[max]) max = i;
    return A[max];
}


Measured memory_bytes: 2060
import math
from fractions import gcd
import collections


N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

yaku = sorted(make_divisors(N))
num = math.floor(math.sqrt(N))

for a in yaku:
    if (a >= num):
        print(len(str(a)))
        exit()

Measured memory_bytes: 5088
#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
using namespace std;

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	int n,k;cin>>n>>k;
	vi p(n);
	rep(i,n)cin>>p[i];
	
	vi t(n-k+1);
	{
		int cnt=0,j=1;
		rep(i,n-k+1){
			while(j<i+k){
				if(p[j-1]>p[j])
					cnt++;
				j++;
			}
			t[i]=cnt;
			if(p[i]>p[i+1])
				cnt--;
		}
	}

    // rep(i,n-k+1) printf("%lld ", t[i]); printf("\n");
    
	vi sm(n-k+1);
	{
		set<int> s;
		int j=0;
		rep(i,n-k){
			while(j<i+k+1)
				s.insert(p[j++]);
			if(*s.bg==p[i]&&*prev(s.ed)==p[j-1])
				sm[i+1]=1;
			s.erase(p[i]);
		}
	}
	int ans=0,z=0;
	rep(i,n-k+1)if(!sm[i]){
		if(t[i])ans++;
		else z++;
	}
	ans+=bool(z);
	cout<<ans<<endl;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define inf 12345678987654321
using namespace std;

int main()
{
    ll i,j,k,l,m,n,o,p,z=0;
  string s,t;
  cin>>s>>t;
  for(i=0;i<t.size();i++)
  {
      if(t[i]==s[0])
      {
          //cout<<s[i]<<endl;
          for(j=0,k=i;j<s.size();j++,k++)
          {
              if(s[j]!=t[k])break;
              //cout<<s[j]<<" "<<t[k]<<endl;
              if(k==t.size()-1)k=-1;
          }
          if(j==s.size())
          {
              cout<<"Yes"<<endl;
              return 0;
          }
      }
  }
  cout<<"No"<<endl;

    return 0;
}



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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(_v) for(auto _x:_v){cout<<_x<<" ";}cout<<endl
#define printVS(_vs) for(auto _x : _vs){cout << _x << endl;}
#define printVV(_vv) for(auto _v:_vv){for(auto _x:_v){cout<<_x<<" ";}cout<<endl;} cout << endl;
#define printP(_p) cout << _p.first << " " << _p.second << endl
#define printVP(_vp) for(auto _p : _vp) printP(_p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;

typedef complex<double> P;
typedef vector<P> G;
#define here(g, i) g[i]
#define next(g, i) g[(i + 1) % g.size()]
#define prev(g, i) g[(i - 1 + g.size()) % g.size()]
const double EPS = 1e-10;
const double INF = 1e12;
const double PI = acos(-1);

P readP() {
    double x, y;
    cin >> x >> y;
    return P(x, y);
}


G readG(int n) {
    G g(n);
    rep(i, n) g[i] = readP();
    return g;
}

double cross(P a, P b) {
    return imag(conj(a) * b);
}

double areaG(G g) {
    int n = g.size();
    double ret;
    rep(i, n) {
        ret += cross(here(g, i), next(g, i));
    }
    return ret / 2;
}


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

    G tri = readG(3);
    double S = abs(areaG(tri));
    vector<double> len(3);
    rep(i, 3) {
        len[i] = abs(here(tri, i) - next(tri, i));
    }
    double r = 2 * S / (len[0] + len[1] + len[2]);
    double ans = 0;
    rep(i, 3) {
        ans = max(ans, len[i] * r / (2 * r + len[i]));
    }
    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int n,m,a[22][22],ans=0;
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>m;
	fo(i,0,n) fo(j,0,m)cin>>a[i][j];
	fo(i,0,n) fo(j,i+1,n){
		int x=0;
		fo(k,0,m)x+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
		fo(k,0,1010) if(x==k*k){ans++;break;}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  int s;
  cin >> s;
  int s_1, s_2, s_3;
  s_1 = s / 100;
  s_2 = (s-s_1*100) / 10;
  s_3 = s-s_1*100-s_2*10;
  cout << s_1+s_2+s_3 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 5e5 + 5;
ll *v;
ll n, m;

void solve(){
    cin >> n;
    double x = n / 3.0;
    double ans = x * x * x;
    cout << setprecision(6) << fixed << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

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

using namespace std;

int n,m,x;

int main(){
	cin>>n>>m;
	int a=1;
	for(int i=0;i<m;i++){
		a*=2;
	}
	x=(1900*m+100*(n-m))*a;
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
while line = gets
	#a,b,c,d,e,f = [2,-1,-3,-9,9,27].map(&:to_f)
	a,b,c,d,e,f = line.split(" ").map(&:to_f)
	y = a==0?c/b : (f-(d*c/a))/(e-(b*d/a))
	x = d==0?(c-(b*y))/a : (f-e*y)/d
	x = 0 if x.abs == 0.0
	y = 0 if y.abs == 0.0
	puts sprintf("%.3f %.3f",x,y)
end

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

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

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

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

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

    ($next:expr, 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")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:usize,
        q:usize,
        s:chars,
        lrq:[(usize,usize);q],
    }
    let mut v = vec![0;n];
    for j in 0..n-1  {
        if s[j] == 'A' && s[j+1] == 'C' {
            v[j+1] = v[j] + 1;
        } else {
            v[j + 1] = v[j];
        }
    }
    for &(l,r) in &lrq {
        let sum = v[r-1] - v[l-1];
        println!("{}",sum);
    }
}

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

int main(){
  int x,y;
  cin >>x >>y;
  int ans = 0;
  if(x==1) ans+=300000;
  if(y==1) ans+=300000;
  if(x==2) ans+=200000;
  if(y==2) ans+=200000;
  if(x==3) ans+=100000;
  if(y==3) ans+=100000;
  if(x==1 && y==1) ans+=400000;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
short flag[5005][5005];
int main(){
  int N, M;
  scanf("%d %d", &N, &M);
  for(int i = 0; i < M; i++){
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
    flag[A][B] = max< short >( flag[A][B], C + 1);
  }
  int ret = 0;
  for(int i = 1; i <= N; i++){
    for(int j = 1; j <= i; j++){
      flag[i][j] = max< short >( flag[i][j], max( flag[i - 1][j - 1], flag[i - 1][j]) - 1);
      if(flag[i][j] > 0) ret++;
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 48912