akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef long double ld;
using namespace std;

const int N = 5 * 1000, M = 200;
int a[N + 10], b[N + 10][M + 10];
ll sum[N + 10][N + 10];

void add(int x1, int y1, int x2, int y2, int d) {
    sum[x1][y1] += d;
    sum[x1][y2 + 1] -= d;
    sum[x2 + 1][y1] -= d;
    sum[x2 + 1][y2 + 1] += d;
}

int main() {
    //ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n - 1; i++) {
        scanf("%d", &a[i]);
    }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            scanf("%d", &b[i][j]);
    for(int j = 1; j <= m; j++) {
        vector<int> l(n + 1, 1), r(n + 1, n), s;
        for(int i = 1; i <= n; i++) {
            while(!s.empty() && b[s.back()][j] <= b[i][j])
                s.pop_back();
            if(!s.empty())
                l[i] = s.back() + 1;
            s.push_back(i);
        }
        s.clear();
        for(int i = n; i >= 1; i--) {
            while(!s.empty() && b[s.back()][j] < b[i][j])
                s.pop_back();
            if(!s.empty())
                r[i] = s.back() - 1;
            s.push_back(i);
        }
        for(int i = 1; i <= n; i++) {
            //cout << l[i] << " " << i << " " << i << " " << r[i] << " " << b[i][j] << "\n";
            add(l[i], i, i, r[i], b[i][j]);
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
            //cout << sum[i][j] << " ";
        }
        //cout << "\n";
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++) {
        ll diff = 0;
        for(int j = i; j <= n; j++) {
            ans = max(ans, sum[i][j] - diff);
            diff += a[j];
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 200448
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll a,b,c,i,j,k;
    cin>>a>>b>>c;
    j=(a+b+c);
    if(j>=22)
    {
        cout<<"bust"<<endl;
    }
    else
    {
        cout<<"win"<<endl;
    }
}



Measured memory_bytes: 256
package main

import (
    "fmt"
    // "sort"
)

func main() {
    // var n int
    // fmt.Scan(&n, &x)
    // nums := make([]int,n);
    // m := make(map[int]int)

    var n,a,b int
    fmt.Scan(&n,&a,&b)

	c := a-b
	if c<0 {
		c = b-a
	}

    if c%2==1 {
		fmt.Println("Borys")    	
    } else {
		fmt.Println("Alice")    	    	
    }

	// fmt.Println()
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    string s, t;
    cin >> s >> t;
    if (s == t.substr(0, s.size())) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>

using namespace std;

int main()
{
    long long a,b,c,maxn,minn;
    scanf("%lld%lld%lld",&a,&b,&c);
    if(a>b)maxn=a;
    else maxn=b;
    if(a<b)minn=a;
    else minn=b;
    if(maxn<c)maxn=c;
    if(minn>c)minn=c;
    printf("%lld %lld\n",minn,maxn);
    return 0;
}


Measured memory_bytes: 2752
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        int zero = 0;
        int one = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '0') {
                zero++;
            } else {
                one++;
            }
        }
        System.out.println(Math.min(zero, one) * 2);

       
    }
}

Measured memory_bytes: 25292
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long int
#define mod 1000000007
#define vec vector<long long int>
#define fi first
#define se second
#define pb push_back
int main()
{
    ll a, b;
    ll v, w;
    ll t;
    cin >> a >> v;
    cin >> b >> w;
    cin >> t;
    ll x = v * t;
    ll y = w * t;
    if (x - y >= abs(a - b))
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }
}

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

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
using ll = long long int;
using ull =  unsigned long long int;

int main() {
	ll r, d, x;
	cin >> r >> d >> x;
	for (int i = 0; i < 10; i++) {
		x = r * x - d;
		cout << x << endl;
	}
	
}


Measured memory_bytes: 256
S=str(input()) #Sの入力
Smojisuu=len(S)
c=S.count("eraser")
S=S.replace("eraser","xxxxxx",c)
d=S.count("erase")
S=S.replace("erase","xxxxx",d)
e=S.count("dreamer")
S=S.replace("dreamer","xxxxxxx",e)
f=S.count("dream")
S=S.replace("dream","xxxxx",f)
g=S.count("x")
if len(S)>g:
  print("NO")
elif len(S)==g:
  print("YES")
else:
  print("error")


Measured memory_bytes: 3188
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int A, B;
	std::cin >> A >> B;
	std::cout << ((A-1)*(B-1)) << "\n";
}


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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("c.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;

    list<double> v;

    rep(i, n)
    {
        double tmp;
        cin >> tmp;
        v.push_back(tmp);
    }

    //v.sort(std::greater<int>());
    v.sort();
    //sort(v.begin(), v.end(), greater<int>());
    //sort(v.begin(), v.end());

    while(v.size() > 1)
    {
        //v.front();
        double tmp1 = v.front();
        v.pop_front();
        double tmp2 = v.front();
        v.pop_front();
        v.push_front((tmp1+tmp2)/2);
    }

    cout << v.front();



    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace::std;
using lint =long long;
#define rep(i,n) for(lint i=0;i<n;i++)
#define INF (1LL<<60)
using vec=vector<lint>;
string s;
pair<int,int> expr(int& i);
pair<int,int> expr2(int& i);
pair<int,int> term(int& i);
pair<int,int> expr(int& i){
    pair<int,int>res=make_pair(-1,-1);
    while(i<(int)s.size()){
        auto e=expr2(i);
        if(res==make_pair(-1,-1))res=e;
        else res=make_pair(min(res.first,res.second+e.first),res.second+e.second);
        if(s[i]==')')break;
        i++;
    }
    return res;
}
pair<int,int> expr2(int& i){
    pair<int,int>res=make_pair(-1,-1);
    while(i<(int)s.size()){
        auto e=term(i);
        if(res==make_pair(-1,-1))res=e;
        else res=make_pair(res.first+e.first,min(res.second,res.first+e.second));
        if(s[i]=='|')break;
        if(s[i]==')')break;
        i++;
    }
    return res;
}
pair<int,int> term(int& i){
    if(s[i]=='?'){
        i++;
        return make_pair(1,1);
    }else{
        i++;
        auto e=expr(i);
        i++;
        return e;
    }
}
int main(){
    cin>>s;
    int i=0;
    auto e=expr(i);
    cout<<e.second<<" "<<e.first<<endl;
}


Measured memory_bytes: 3332
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string w;
    getline(cin,w);
    int len=w.size();
    int i;
     printf("%c",toupper(w[0]));
    for(i=0;i<len;i++)
    {

        if(w[i]==' ')
        {
            printf("%c",toupper(w[i+1]));
        }
    }
    printf("\n");
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        System.out.println(S.equals("ABC") ? "ARC" : "ABC");
    }
}

Measured memory_bytes: 35624
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		final int N = Integer.parseInt(scan.next());
		final int K = Integer.parseInt(scan.next());
		scan.close();

		for (int i = 1; i <= K; i++) {
			if (N - K + 1 < i) {
				System.out.println(0);
			} else {
				BigInteger ans = BinominalCoefficient(N - K + 1, i)
						.multiply(BinominalCoefficient(K - 1, i - 1))
						.mod(BigInteger.valueOf(1000000000 + 7));
				System.out.println(ans);
			}
		}

	}

	private static Map<String, BigInteger> memo = new HashMap<String, BigInteger>();

	private static BigInteger BinominalCoefficient(int n, int k) {
		if (k * 2 > n) {
			k = n - k;
		}
		if (n == k || k == 0) {
			return BigInteger.valueOf(1);
		} else if (k == 1) {
			return BigInteger.valueOf(n);
		} else if (memo.containsKey(n + "," + k)) {
			return memo.get(n + "," + k);
		} else {
			BigInteger ans = BigInteger.valueOf(1);
			for (int i = 1; i <= k; i++) {
				ans = ans.multiply(BigInteger.valueOf(n - k + i)).divide(BigInteger.valueOf(i));
			}
			memo.put(n + "," + k, ans);
			return ans;
		}
	}

}

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

int main(){
    string s; int start,end;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A'){ start = i; break;}
    }
    for(int i = s.size()-1; i >= 0; i--){
        if(s[i] == 'Z'){ end = i; break;}
    }
    int ans = end-start+1;
    cout << ans << endl;
    return 0;
}

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

void Print(int a[], int p){
	for(int i=0; i<p; ++i){
		if(i>0) printf(" ");
		printf("%d", a[i]);	
	}	
	printf("\n");
}

int main(){
	int n;
	int a[100];
	
	scanf(" %d", &n);
	for(int i=0; i<n; ++i) scanf(" %d", &a[i]);
	
	for(int i=0; i<n; ++i){
		int v=a[i];
		int j=i-1;
		
		while(j>=0 && a[j]>v){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=v;
		
		Print(a, n);
	}
		
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N, M;
string s;
int a[220000], b[220000];
vint G[220000];
int nA[220000], nB[220000];

void dfs(int x) {
    if (nA[x] != 0 && nB[x] != 0)return;
    nA[x] = nB[x] = 0;
    for (int i = 0; i < G[x].size(); i++) {
        if (x == G[x][i])continue;
        if (nA[G[x][i]] == 0 && nB[G[x][i]] == 0)continue;
        if (s[x] == 'A')nA[G[x][i]]--;
        else nB[G[x][i]]--;
        dfs(G[x][i]);
    }
}

signed main() {
    cin >> N >> M >> s;
    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
        if (s[a[i]] == 'A')nA[b[i]]++;
        else nB[b[i]]++;
        if (s[b[i]] == 'A')nA[a[i]]++;
        else nB[a[i]]++;
    }
    for (int i = 0; i < N; i++) {
        if (nA[i] == 0 && nB[i] == 0)continue;
        dfs(i);
    }
    for (int i = 0; i < N; i++) {
        if (nA[i] != 0 && nB[i] != 0) {cout << "Yes" << endl; return 0;}
    }
    cout << "No" << endl;
    return 0;

}


Measured memory_bytes: 20228
#include <iostream>
#include <vector>
#include <numeric>

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    long long X; cin >> X;

    long long tmp = 0;
    for (long long i = 1; i <= X; ++i) {
        tmp += i;
        if (tmp >= X) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nx = Input.arL;
        WriteLine(nx[0] + f(nx[1], nx[0] - nx[1]));
    }
    static long f(long a,long b)
    {
        var max = Max(a, b);
        var min = Min(a, b);
        if (max % min == 0) return max * 2 - min;
        return max/min*min*2 + f(max%min, min);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13140
h, w =map(int, input().split())
grid = [None]*h
count = -1
for i in range(h):
  grid[i] = input()
  count += grid[i].count("#")

x, y = 0, 0

while True:
  if x == h-1 and y == w-1:
    if count == 0:
      print("Possible")
    else:
      print("Impossible")
    break
  elif x == h-1:
    if grid[x][y+1] == ".":
      print("Impossible")
      break
    y += 1
    count -= 1
  elif y == w-1:
    if grid[x+1][y] == ".":
      print("Impossible")
      break
    x += 1
    count -= 1
  else:
    if grid[x+1][y] == grid[x][y+1]:
      print("Impossible")
      break
    if grid[x+1][y] == "#":
      x += 1
    else:
      y += 1
    count -= 1

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<climits>
#include<map>
#include<queue>
#include<iomanip>

using namespace std;

int main(){

	long long N,M;

	cin >> N >> M;

	if(M-2*N>=0){
	 cout << N + (M - 2*N)/4 << endl;
	}else{
		cout << M/2 << endl;
	}

	return 0;

}


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

const long long maxn = 1e5+10 ;
multiset<long long> a ;
pair<long long, long long> hehe[maxn] ;

int main(){

    ios::sync_with_stdio(0) ;
    cin.tie(0) ;

    long long n, m ;
    long long ans = 0 ;
    cin >> n >> m ;
    for(long long i = 0; i < n; i++){

        long long tmp ;
        cin >> tmp ;
        a.insert(tmp) ;
        ans += tmp ;

    }
    for(long long i = 0; i < m; i++){

        cin >> hehe[i].second >> hehe[i].first ;

    }
    sort(hehe,hehe+m,greater<pair<long long, long long> >()) ;
    for(long long i = 0; i < m; i++){

        long long b = hehe[i].second, c = hehe[i].first ;

        while(b>0 && *a.begin()<c){

            ans = ans - *a.begin() + c ;
            a.erase(a.begin()) ;
            a.insert(c) ;
            b--;

        }
 //       for ( auto itr = a.begin(); itr != a.end(); ++itr) {
 //           cout << *itr << ' ';
 //       }

    }
    cout << ans ;

}


Measured memory_bytes: 6528
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int N=100005;
int n;
vector<int>t[N];
int dp[N];
void dfs(int v,int from){
	int sum=0,mx=0,cnt=0;
	for(int i=0;i<t[v].size();i++){
		int u=t[v][i];
		if(u==from)continue;
		dfs(u,v);
		sum+=dp[u];
		if(dp[u]==0)cnt++;
	}
	if(cnt>=1){
		dp[v]+=sum;
		dp[v]+=cnt-1;
	}else{
		dp[v]+=sum;
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		t[a].push_back(b);
		t[b].push_back(a);
	}
	int start=0;
	for(int i=0;i<n;i++){
		if(t[start].size()<t[i].size())start=i;
	}
	dfs(start,-1);
	printf("%d",max(dp[start],1));
	return 0;
}

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

int main () {
  string a ;
  cin >> a ;
  
  if( a[0] == 'Y' && a[1] == 'A' && a[2] == 'K' && a[3] == 'I' ) cout << "Yes" << endl ;
  else cout << "No" << endl ;
}

Measured memory_bytes: 256
//Darker and Darker

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int h,w;cin>>h>>w;
    vecrep(h,a,string);
    int dx[4]={1,0,-1,0};
    int dy[4]={0,1,0,-1};

    queue<P>q;
    vector<vector<int>>dist(h,vector<int>(w,-1));

    rep(i,0,h)rep(j,0,w){
        if(a[i][j]=='#'){
            q.push(mp(i,j));
            dist[i][j]=0;
        }
    }

    while(!q.empty()){
        P t = q.front();
        q.pop();
        rep(i,0,4){
            if(t.first+dy[i]<0||t.first+dy[i]>=h||t.second+dx[i]<0||t.second+dx[i]>=w)continue;
            if(a[t.first+dy[i]][t.second+dx[i]]=='#'||dist[t.first+dy[i]][t.second+dx[i]]!=-1)continue;
            dist[t.first+dy[i]][t.second+dx[i]]=dist[t.first][t.second]+1;
            q.push(mp(t.first+dy[i],t.second+dx[i]));
        }
    }

    int ans=0;
    rep(i,0,h)rep(j,0,w){
        ans=max(ans,dist[i][j]);
    }
    
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 29192
import collections

n = int(input())
s = input()
s_w = s.count("W")
s_e = s.count("E")

w_array = [0 for x in range(n)]
e_array = [0 for x in range(n)]
w_tmp = 0
e_tmp = 0

for i in range(n):
    if s[i] == "W":
        w_tmp += 1
    else:
        e_tmp += 1
    w_array[i] += w_tmp
    e_array[i] += s_e - e_tmp

res = min(s[1:].count("E"), s[:-1].count("W"))

for count in range(1, n-1):
    if w_array[count]+e_array[count+1] < res:
        res = w_array[count]+e_array[count]

print(res)



Measured memory_bytes: 27672
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	std::cout << std::fixed;
	std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int n;
	cin>>n;
	vector<int> a(n);
	FOR(i,0,n){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	LD ans=0,bf=(a[0]+a[1])/2.;
	FOR(i,2,n){
		bf=(bf+a[i])/2.;
	}
	cout<<bf<<endl;

	return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
int main(void)
{
    int e;
    while (scanf("%d", &e), e) {
        int res=(1<<29), x, y, z, m, tz, ty;
        for(z=0;(tz=z*z*z)<=e;++z) for(y=0;tz+(ty=y*y)<=e;++y) {
            x=e-ty-tz;
            m=x+y+z;
            if (m<res) res=m;
        }
        printf("%d\n", res);
    }
    return 0;
}

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

int main() {
  int i,t;
  string s,n;
  cin >> s;
  t=1;
  for (i = 0; i < 3; i++) {
    n = s.at(i);
    if (n == "a") {
      t *= 2;
    }else if(n == "b"){
      t *= 3;
    }else if(n == "c"){
      t *= 5;
    }else{
      cout << "Huh?" << endl;
    }
  }
  if (t == 30) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

long double f[7][111][7][111][7],ans,sum[7][111][7][111][7];
int n,C,a[7],b[7],jc[7];
bool bo[7];

void work()
{
	memset(f,0,sizeof(f));
	memset(sum,0,sizeof(sum));
	f[1][b[1]>>1][1][0][1]=1.0;
	for (int j=0; j<=C; j++)
	{
		if (j) sum[1][b[1]>>1][1][j][1]=sum[1][b[1]>>1][1][j-1][2];
		sum[1][b[1]>>1][1][j][2]=sum[1][b[1]>>1][1][j][1]+f[1][b[1]>>1][1][j][1];
	}
	for (int i=2; i<=n; i++)
	{
		for (int j=0; j<C; j++)
			for (int k=2; k<=i; k++)
				for (int l=(b[1]>>1); l<=C; l++)
					for (int m=1; m<=i; m++) if (m!=k)
					{
						int tj,tk;
						if (j-(b[i]>>1)>l||j-(b[i]>>1)==l&&k>m) tj=l,tk=m; else
						if (j+(b[i]>>1)>l) tj=j+(b[i]>>1),tk=k; else
						if (j+(b[i]>>1)<l) tj=l,tk=m; else tj=l,tk=max(k,m);
						f[i][min(tj,C)][tk][j][k]+=sum[i-1][l][m-(m>k)][j][k]/(1.0*C)/(1.0*(i-1));
					}
		if (i<n)
		{
			for (int j=(b[1]>>1); j<=C; j++)
				for (int k=1; k<=i; k++)
					for (int l=0; l<=C; l++)
					{
						if (l) sum[i][j][k][l][1]=sum[i][j][k][l-1][i+1];
						for (int m=2; m<=i+1; m++)
							sum[i][j][k][l][m]=sum[i][j][k][l][m-1]+f[i][j][k][l][m-1];
					}
		}
	}
	for (int i=C-(b[1]>>1); i<=C; i++)
		for (int j=1; j<=n; j++)
			for (int k=0; k<C; k++)
				for (int l=1; l<=n; l++) ans+=f[n][i][j][k][l];
}

void dfs(int x)
{
	if (x==n+1) {work(); return;}
	for (int i=2; i<=n; i++)
		if (!bo[i]) bo[i]=1,b[x]=a[i],dfs(x+1),bo[i]=0;
}

int main()
{
	jc[0]=1;
	for (int i=1; i<=6; i++) jc[i]=jc[i-1]*i;
	scanf("%d%d",&n,&C),C<<=1;
	for (int i=1; i<=n; i++) scanf("%d",&a[i]),a[i]<<=1;
	sort(a+1,a+1+n),reverse(a+1,a+1+n),b[1]=a[1];
	memset(bo,0,sizeof(bo)),bo[1]=1,dfs(2);
	return printf("%.16lf\n",(double)ans),0;
}

Measured memory_bytes: 132480
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if(a < b && a < c){
            System.out.println(a + " " + Math.min(b, c) + " " + Math.max(b, c));
        }
        else if(b < a && b < c){
            System.out.println(b + " " + Math.min(a, c) + " " + Math.max(a, c));
        }
        else{
            System.out.println(c + " " + Math.min(a, b) + " " + Math.max(a, b));
        }
        sc.close();
    }
}



Measured memory_bytes: 26404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define For(i, a, n) for (ll (i) = (a); (i) < (n); (i)++)
#define prl(x) cout << (x) << endl
#define pr(x) cout << (x)

template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) {return '"' + s + '"';}
string to_string(char c){return string(1, c);}
string to_string(const char* s) {return to_string((string) s);}
string to_string(bool b){return (b ? "true" : "false");}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p){return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p){return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";}
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) res += ", ";
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
  return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template<typename T>
string to_string(priority_queue<T>& q){
    priority_queue<T> copy;
    bool first = true;
    string res = "{";
    while(!q.empty()){
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(q.top());
        copy.push(q.top());
        q.pop();
    }

    swap(q, copy);
    res += "}";
    return res;
}

void debug_out() {cerr << endl;}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef _LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main(void){
    ll h, w, a, b;
    cin >> h >> w >> a >> b;
    rep(y, h){
        rep(x, w){
            if (y < b) pr(x < a ? 0 : 1);
            else pr(x < a ? 1 : 0);
        }
        prl("");
    }

    return 0;
}


Measured memory_bytes: 3608
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


int main(){
    ll n,k;
    cin>>n>>k;
    n++;
    cout<<(n/2>=k?"YES":"NO")<<endl;
    
    
    
    return 0;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

struct modint{
    using i64=int_fast64_t;
    i64 a;
    static constexpr i64 MOD=1000000007;
    modint(){a=0;}
    modint(i64 a_){
        a=a_%MOD;
        if(a<0) a+=MOD;
    }
    modint inv()const{
        i64 n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y;
        y.a=a+x.a;
        if(y.a>MOD) y.a-=MOD;
        return y;
    }
    modint operator-(const modint& x){
        modint y;
        y.a=a-x.a;
        if(y.a<0) y.a+=MOD;
        return y;
    }
    modint operator*(const modint& x){
        modint y;
        y.a=(a*x.a)%MOD;
        return y;
    }
    modint operator/(const modint& x){
        modint y;
        y.a=(a*x.inv().a)%MOD;
        return y;
    }
    modint& operator+=(const modint& x){
        a+=x.a;
        if(a>=MOD) a-=MOD;
        return *this;
    }
    modint& operator-=(const modint& x){
        a-=x.a;
        if(a<0) a+=MOD;
        return *this;
    }
    modint& operator*=(const modint& x){
        (a*=x.a)%=MOD;
        return *this;
    }
    modint& operator/=(const modint& x){
        (a*=x.inv().a)%=MOD;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    int_fast64_t a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(int_fast64_t a,int_fast64_t b){
    modint _;
    int_fast64_t n=1,A=a;
    while(b){
        if(b&1) (n*=A)%=modint::MOD;
        (A*=A)%=modint::MOD;
        b>>=1;
    }
    _.a=n;
    return _;
}

int k;
modint ans = 1;
vector<ll> edge[100005];

void dfs(int parent, int grand, int color_num) {
    ans *= color_num;

    color_num = k - 1;    /* 親の分 */
    if(grand != -1) color_num--; /* 親の親の分 */
    REP(i, edge[parent].size()) {
        if(edge[parent][i] == grand) continue;
        dfs(edge[parent][i], parent, color_num);
        color_num--;  /* 兄の分 */
    }

}

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

    REP(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    dfs(0, -1, k);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10368
from collections import deque


def main():

    N = int(input())
    G = [{} for _ in range(N)]

    for _ in range(N - 1):
        u, v, w = map(int, input().split())
        u, v = u - 1, v - 1
        G[u][v] = w
        G[v][u] = w

    dist = [-1] * N
    q = deque([0])
    dist[0] = 0

    while q:
        v = q.popleft()
        for n in G[v].keys():
            if dist[n] == -1:
                q.appendleft(n)
                dist[n] = dist[v] + G[v][n]

    print("\n".join([str(x % 2) for x in dist]))


if __name__ == '__main__':
    main()


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

#define ms(s, n) memset(s, n, sizeof(s))
#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 FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;

void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int a, b;
    cin >> a >> b;
    cout << max(0, a - 2 * b);
    return 0;
}


Measured memory_bytes: 256
#template
from collections import Counter
def inputlist(): return [int(j) for j in input().split()]
#template
K = int(input())
if K % 2 == 0:
    d = K//2
    print(d**2)
    exit()
else:
    da = (K+1)//2
    db = (K-1)//2
    print(da*db)

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int m; cin >> m;
    ll n = 0, s = 0;
    while (m--) {
        ll d, c; cin >> d >> c;
        n += c;
        s += d*c;
    }
    cout << (n-1+(s-1)/9) << endl;
}



Measured memory_bytes: 256
using System;
using System.Linq;

namespace ABC155
{
    class B
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();


            for (int i = 0; i < N; i++)
            {
                if (A[i] % 2 == 0 && (A[i] % 3 != 0 && A[i] % 5 != 0)) { Console.WriteLine("DENIED"); return; }
            }
            Console.WriteLine("APPROVED");
        }

    }
}


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

public class Main {
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String ans = "Yay!";
        if(a > 8 || b > 8) ans = ":(";
        out.println(ans);
        out.flush();
        

    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}

Measured memory_bytes: 32500
use std::io;

fn main() {
    let line = parse_line::<String>();
    let split: Vec<&str> = line.split_whitespace().collect();
    let a = split[0].parse::<usize>().unwrap();
    let b = split[1].parse::<usize>().unwrap();
    let g = gcd(a, b);
    let result = a * b / g;
    println!("{}", result);
}

fn parse_line<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn gcd(i: usize, j: usize) -> usize {
    if i % j == 0 {
        j
    } else {
        gcd(j, i % j)
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,x,y,e,f,g,h;
	cin>>a>>b>>c>>d;
	x=c-a;
	y=d-b;
	e=c-y;
	f=d+x;
	g=a-y;
	h=b+x;
	cout<<e<<" "<<f<<" "<<g<<" "<<h<<endl;
	
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
// ll mod=1000000007;
// ld pi = 3.14159;

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,t1,i,j,k,temp,temp2,n,m,x,y,z,sum=0,o;
    // cin >> t;
    // while(t--){
    cin >> n;
    vector <ll> a(n);
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    temp=a[0];
    if(temp==0) cout << 0;
    else{
        for(i=1;i<n;i++){
            x = 1000000000000000000/temp;
            if(a[i]>x){
                cout << -1;
                return 0;
            }
            temp*=a[i];
        }
        cout << temp;
    }
}

Measured memory_bytes: 4000
#include <iostream>
#include <string>
#include <random>

using namespace std;

void a()
{
    string s;
    cin >> s;
    if(s.size() > 9)
    {
        cout << "NO" << endl;
        return;
    }
    string akb = "AKIHABARA";
    string result = "";
    int index = 0;
    for(int i = 0; i < akb.size(); i++)
    {
        if(s[index] == akb[i] && index < s.size())
        {
            result += s[index];
            index++;
        } else{
            result += "A";
        }
    }
    if(result == akb){
        cout << "YES" << endl;
    } else{
        cout << "NO" << endl;
    }
}

void b()
{
    string s;
    cin >> s;
    int a, b, c;
    a = b = c = 0;
    for(auto e : s)
    {
        if(e == 'a') a++;
        if(e == 'b') b++;
        if(e == 'c') c++;
    }
    if(s.size() == 1)
    {
        cout << "YES" << endl;
        return;
    }
    if(s.size() == 3)
    {
        if(a == 2 || b == 2 || c == 2)
        {
            cout << "NO" << endl;
            return;
        }
    }
    /*if(s.size() % 3 == 1)
    {
        if(a == b)
        {
           if(c - a == 1)
           {
               cout << "YES" << endl;
               return;
           }
        } else if(a == c){
            if(b - a == 1)
            {
                cout << "YES" << endl;
                return;
            }
        }else if(b == c)
        {
            if(a - b == 1)
            {
                cout << "YES" << endl;
                return;
            }
        }
    }*/
    int rest = s.size();
    string result = "";
    while(rest > 0)
    {
        if(a > 0)
        {
            a--;
            result += "a";
            rest--;
        }
        if(b > 0)
        {
            b--;
            result += "b";
            rest--;
        }
        if(c > 0){
            c--;
            result += "c";
            rest--;
        }
        if(result == "abc")
        {
            result = "";
        }
    }
    /*if(result[result.size() - 1] == result[result.size() - 2])
    {
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }*/
    if(result.size() <= 1)
    {
        cout << "YES" << endl;
        return;
    }
    if(result.size() >= 2)
    {
        if(result[result.size() - 1] == result[result.size() - 2])
        {
            cout << "NO" << endl;
            return;
        }
    }
    if(result.size() > 3)
    {
        cout << "NO" << endl;
        return;
    }
    int l = 0;
    int r = result.size() - 1;
    while (r - l >= 1)
    {
        if(result[l] != result[r])
        {
            cout << "YES" << endl;
            return;
        }
        l++;
        r--;
    }
    cout << "NO" << endl;
}

int main() {
    /*random_device rnd;
    int n = rnd() % 10 + 1;
    string temp;
    for(int i = 0; i < n; i++)
    {
        int num = rnd() % 3;
        if(num == 0)
        {
            temp += "a";
        }
        if(num == 1)
        {
            temp += "b";
        }
        if(num == 2)
        {
            temp += "c";
        }

    }
    cout << temp << endl;*/
    b();
    return 0;
}


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

using namespace std;

int main(){
    uint64_t n, p;
    cin >> n >> p;

    uint64_t res=1;
    uint64_t x=2;

    if(n==1){
        res=p;
        goto out;
    }

    while(p!=1 && pow(x, n) <= p){
        bool found=true;
        for(uint64_t i=0; i<n; ++i){
            if(p%x){
                found=false;
                break;
            }
            p/=x;
        }
        if(found){
            res*=x;
            continue;
        }
        ++x;
    }
out:
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ');
            var h = int.Parse(a[0]);
            var w = int.Parse(a[1]);
            var map = new List<char[]>();
            for (int i = 0; i < h; i++)
            {
                map.Add(Console.ReadLine().ToCharArray());
            }
            for (int x = 0; x < w; x++)
            {
                for (int y = 0; y < h; y++)
                {
                    if (map[y][x] != '.')
                    {
                        continue;
                    }
                    var cnt = 0;
                    for (int r = Math.Max(y - 1, 0); r < Math.Min(h , y + 2); r++)
                    {
                        for (int c = Math.Max(x - 1, 0); c < Math.Min(w , x + 2); c++)
                        {
                            if (map[r][c] == '#')
                            {
                                cnt++;
                            }
                        }
                    }
                    map[y][x] = (char)('0' + cnt);
                }
            }
            foreach (var row in map)
            {
                Console.WriteLine(new string(row));
            }
        }

    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    string s;
    cin >> s;
    int res = 700;
    rep(i, 3) {
        if(s[i] == 'o')
            res += 100;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int R,G,B,N;cin >> R >> G >> B >> N;
    ll res = 0;
    for(int rb=0;rb<=3000;rb+=R)for(int gb=0;gb<=3000;gb+=G){
        if(rb+gb<=N&&(N-(rb+gb))%B==0)res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

ll dp[55][3000][55];

int main() {
    int n,a;
    cin >> n >> a;
    vector<int> x(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    memset(dp,0,sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int s = 0; s <= n*a; ++s) {
            for (int k = 0; k <= n; ++k) {
                if(dp[i][s][k] == 0) continue;
                dp[i+1][s][k] += dp[i][s][k];
                dp[i+1][s+x[i]][k+1] += dp[i][s][k];
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans += dp[n][i*a][i];
    }
    cout << ans << endl;
    return 0;
}

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

int main(){

  string o,e; cin >> o >> e;
  for(int i=0;i<min(o.length(),e.length());i++){
    cout << o[i]<<e[i];
  }  
  if(o.length()>e.length()){
    cout<<o[o.length()-1]<<endl;
  }
  else if(o.length()<e.length()){
    cout<<e[e.length()-1]<<endl;;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;
using ll = long long;

using namespace std;
typedef pair<int, int> P;

int main(){
    ll n; cin >> n;
    map<string, int> mp;
    rep(i, n){
        string s; cin >> s;
        mp[s]++;
    }

    ll count=mp.size();
    out(count);

}

Measured memory_bytes: 19256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
// constexpr auto mod = 1000000007;
using namespace std;

ll N;
const string _753 = "753";

ll dfs(const string &s) {
  if (!s.empty() && stoll(s) > N) {
    return 0;
  }
  ll ret = all_of(ALL(_753),
                  [&s](const char &c) { return s.find(c) != string::npos; })
               ? 1
               : 0;
  for (auto &&c : _753) {
    ret += dfs(s + c);
  }
  return ret;
}

int main() {
  cin >> N;
  cout << dfs("") << endl;
  return 0;
}


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

prev = H[0]
flag = True
for i in range(N-1):
    now = H[-i-1]
    after = H[-i-2]
    if after - now > 1:
        flag = False
        break
    elif after - now == 1:
        H[-i-2] -= 1
    else:
        pass
print('Yes') if flag else print('No')

Measured memory_bytes: 84964