akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

template<typename T>
using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll const mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
}

ll const maxn = 3e5+5;
bool chet[maxn];
ll cnt[maxn];
ll go (vector<ll>a){
    for(auto& x : a) {
        for(ll i = 0;i<=60;i++){
            if(!chet[i] && ((1LL << i) & x)){
                x^=(1LL << i);
            }
        }
    }
    for(ll bit = 59;bit>=0;bit--){
        ll maxmask = (1LL << (bit+1)) - 1;
        for(ll i = 0;i<a.size();i++){
            if(a[i] <= maxmask && a[i]&(1LL << bit)){
                for(ll j = 0;j<a.size();j++){
                    if(j == i) continue;
                    if(a[j]&(1LL << bit)) a[j]^=a[i];
                }
                break;
            }
        }
    }
    ll kek = 0;
    for(ll x : a){
        if((kek^x) > kek) kek^=x;
    }
    return kek;
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n; cin >> n; vector<ll>a(n);
    ll sm = 0;
    for(ll i =0 ;i<n;i++) {
        cin >> a[i], sm^=a[i];
        for(ll j = 60;j>=0;j--){
            if((1LL << j) & a[i]){
                cnt[j]++;
            }
        }
    }
    for(ll i = 0;i<=60;i++){
        if(cnt[i]%2 == 0) chet[i] = 1;
    }
    ll kek = go(a);

    cout << kek + (sm^kek) << endl;

    return 0;
}
/*

*/

Measured memory_bytes: 1792
S = gets.chomp
#puts S[0] != S[1] || S[0] != S[2] || S[1] != S[2] ? "Yes" : "No"
#puts S.include?("A") && S.include?("B") ? "Yes" : "No"
puts S.split(//).uniq.length == 2 ? "Yes" : "No"



Measured memory_bytes: 1916
// https://beta.atcoder.jp/contests/abc115

#define SUBMIT

#include <bits/stdc++.h>
using namespace std;

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

    int ans = 0;
    int a, b;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        if (h <= a && w <= b) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=input()
l=a.split(" ")
l=[int(i) for i in l]
mx=max(l)
mn=min(l)
dis=[]
cnt=0
for p in range(mn,mx+1):
  dis.append(0)
  for i in l:
    dis[cnt]+=(p-i)**2
  cnt+=1
print(min(dis))

Measured memory_bytes: 9192
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = 5;
        long m = sc.nextLong();
        long min = 100000000000000000L;
        for (int i = 0; i < n; i++) {
            min = Math.min(min, sc.nextLong());
        }
        
        long tmp = m / min;
        if (m % min != 0) {
            tmp++;
        }
        
        System.out.println(4 + tmp);
    }
}


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

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if((a==b && c!=b) || (a==c && c!=b) || (b==c && b!=a))
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P  = pair<ll,ll>;
using v  = vector<ll>;
using vv = vector<v>;
const int MOD = 1000000007;

int main(){
    int n;
    ll d,a;
    cin >>n>>d>>a;
    
    vector<P> xh(n);
    rep(i,n){
        cin >>xh[i].first>>xh[i].second;
        xh[i].second = (xh[i].second+a-1)/a;
    }
    
    sort(xh.begin(),xh.end());
    
    v x,h;
    rep(i,n){
        x.push_back(xh[i].first);
        h.push_back(xh[i].second);
    }
    
    v f(n,0);
    ll ans = 0;
    
    rep(i,n){
        if(i)f[i]+=f[i-1];
        
        h[i] -= f[i];
        if(h[i]<=0)continue;
        
        ll ran = x[i]+2LL*d;
        
        auto itr = upper_bound(x.begin(), x.end(), ran)-x.begin();
        if(itr<n)f[itr] -= h[i];
        
        ans += h[i];
        
        f[i] += h[i];
        //cout << f[i] <<" "<< ans << endl;
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 8292
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

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

int main() {

	int k,x;
	cin >> k >> x;
	if (k*500 >=x) cout << "Yes" << endl;
	else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define int long long
const int INF = 1e18, MOD = 998244353;
string s;
signed main() {
    INCANT;
    int n, a[111111];
    int cnt[111111] = {};
    cin>>n;
    for (int i = 0; i < n; i++) {
        cin>>a[i];
        cnt[a[i]]++;
    }
    int ans = 1;
    if (a[0] != 0 || cnt[0] != 1) ans = 0;
    for (int i = 1; i < n; i++) {
        ans *= cnt[a[i] - 1];
        ans %= MOD;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1920
using System;

class Prorgram
{
  public static bool haveThree(int num)
  {
    bool flag = false;
    while(num != 0)
    {
      int surplus = num%10;
      if(surplus == 3) flag = true;
      num /= 10;
    }
    return flag;
  }
  public static void Main(string[] args)
  {
    int read = int.Parse(Console.ReadLine());
    for(int i = 1;i <= read;i++){
      if(i%3 == 0 || haveThree(i)){
        Console.Write(" "+i);
      }
    }
    Console.WriteLine();
  }
}

Measured memory_bytes: 9260
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

int n, b[101];
vector<int> ans;

int main() {
	cin >> n;
	inc(i, n) { cin >> b[i]; }
	
	bool f = true;
	dec1(i, n) {
		int p = -1;
		dec(j, i) { if(b[j] == j + 1) { p = j; break; } }
		if(p == -1) { f = false; break; }
		
		ans.PB(p + 1);
		incID(j, p, n) { b[j] = b[j + 1]; }
	}
	
	if(f) {
		dec(i, n) { cout << ans[i] << endl; }
	} else {
		cout << -1 << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep (i, N) { cin >> A[i]; }

    int m = 0;
    int mi = 0;
    for (int i = 0; i < N; ++i)
    {
        if (chmax(m, A[i]))
        {
            mi = i;
        }

    }

    A.erase(A.begin() + mi);
    int m2 = 0;
    int mi2 = 0;
    for (int i = 0; i < N-1; ++i)
    {
        if (chmax(m2, A[i]))
        {
            mi2 = i;
        }

    }
    

    for (int i = 0; i < N; ++i)
    {
        if (i == mi)
        {
            cout << m2 << endl;
        }
        else
        {
            cout << m << endl;
        }
    }



    return 0;
}


Measured memory_bytes: 2432
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        _n: usize, m: usize, x: usize,
        a: [usize; m],
    }

    let mut left = std::usize::MAX;
    let mut right = std::usize::MAX;
    for i in 0..=m {
        if a[i] < x {
            left = i;
        } else {
            right = i;
            break;
        }
    }

    let cost_l: usize = if left == std::usize::MAX {
        0
    } else {
        a[..=left].iter().count()
    };
    let cost_r: usize = if right == std::usize::MAX {
        0
    } else {
        a[right..].iter().count()
    };

    println!("{}", cost_l.min(cost_r));
}


Measured memory_bytes: 2192
import math

n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
d = 0
for i in range(n):
    for j in range(n):
        d += math.sqrt((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2)
print(d / n)


Measured memory_bytes: 3060
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
print(800*N-((N//15)*200))

Measured memory_bytes: 74456
#include <stdio.h>
 
int main(void)
{
	int a[110] = { 0 };
	int x, n;
	int ans1 = -1, kyo = 0;
	int f[110] = { 0 };
	scanf("%d%d", &x, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		f[a[i]] = 1;
	}
 
	for (int i = 0; i <= 101; i++) {
		if (i < x) {
			if (f[i] == 0) {
				ans1 = i;
				kyo = x - i;
			}
		}
		else if (x <= i) {
			if (ans1 == -1&&f[i]==0) {
				ans1 = i;
				kyo = i - x;
			}
			else
				if (f[i] == 0 && kyo > i - x)
					ans1 = i;
		}
	}
 
	if (n == 0)
		printf("%d\n", x);
	else
		printf("%d\n", ans1);
 
	return 0;
}

Measured memory_bytes: 1736
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll a, b;
    cin >> a >> b;
    a += b;
    if (a % 2 == 1) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << a/2 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int s[100010];
int main(){
	int n,i,x,max;
	scanf("%d\n",&n);
	memset(s,0,sizeof(s));
	for(i=0;i<n;i++){
		cin>>x;
		s[x-1+1]++;
		s[x+1]++;
		s[x+1+1]++;
	}
	max=s[0];
	for(i=1;i<=100002;i++)
	  if(max<s[i])max=s[i];
	cout<<max;
	return 0;
} 

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
        
    int add=0;
    
    if(str.contains("ooo")){
        add=300;
    }else if(str.contains("oox")||str.contains("oxo")||str.contains("xoo")){
        add=200;
    }else if(str.contains("oxx")||str.contains("xxo")||str.contains("xox")){
        add=100;       
    }

        
        System.out.println(700+add);
    }
}


Measured memory_bytes: 19668
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int caseCnt = 1;

            while (true)
            {
                int W = int.Parse(Console.ReadLine());

                if (W == 0) break;

                int[] dp = Enumerable.Repeat(-1, W + 1).ToArray();
                dp[0] = 0;

                int N = int.Parse(Console.ReadLine());
                int maxV = 0;

                for (int i = 0; i < N; i++)
                {
                    string[] input = Console.ReadLine().Split(',');
                    int v = int.Parse(input[0]);
                    int w = int.Parse(input[1]);

                    for (int j = W; j >= 0; j--)
                    {
                        if (dp[j] == -1) continue;

                        int sumW = w + j;
                        if (sumW > W) continue;

                        int sumV = dp[j] + v;

                        dp[sumW] = Math.Max(dp[sumW], sumV);
                        maxV = Math.Max(maxV, dp[sumW]);
                    }
                }
                int resW = Array.IndexOf(dp, maxV);

                sb.AppendLine("Case " + caseCnt + ":");
                sb.AppendLine(maxV.ToString());
                sb.AppendLine(resW.ToString());
                caseCnt++;
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 10212
import java.util.Scanner;

public class Main {

    private static long solve(int N, long K, long[] As) {
        boolean canBeUp = false;
        long X = 0;

        for(int i = 63; i >= 0; i--) {
            long selector = ((long)1) << i;
            boolean high = (K & selector) > 0;
            if (!high && !canBeUp) continue;

            int c = 0;
            for(int j = 0; j < N; j++) {
                if ((As[j] & selector) > 0) {
                    c += 1;
                }
            }
            boolean shouldHigh = 2 * c < N;
            if (shouldHigh) {
                X += selector;
            } else {
                canBeUp = true;
            }
        }

        long sum = 0;
        for(int i = 0; i < N; i++) {
            sum += X ^ As[i];
        }
        return sum;
    }

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

        final int N = sc.nextInt();
        final long K = sc.nextLong();

        long[] As = new long[N];
        for(int i = 0; i < N; i++) {
            As[i] = sc.nextLong();
        }

        long ans = solve(N, K, As);
        System.out.println(ans);
    }
}


Measured memory_bytes: 61608
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    char[] a = new char[n];
    String s = sc.next();
    int count = 1;

    for(int i=0 ; i<n ; i++){
      a[i] = s.charAt(i);
    }

    for(int i=0 ; i<n-1 ; i++){
      if(a[i]==a[i+1]){
        continue;
      }else{
        count++;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 26696
import numpy as np
n = int(input())
xyhl = [list(map(int, input().split())) for _ in range(n)]
xyhl1 = [xyh for xyh in xyhl if xyh[2] != 0]
xyhl0 = [xyh for xyh in xyhl if xyh[2] == 0]

tmaps = np.zeros((101, 101, len(xyhl1)), dtype="int64")
for d in range(len(xyhl1)) :
    for i in range(101) :
        for j in range(101) :
            x, y, h = xyhl1[d]
            tmaps[i, j, d] = abs(x-i)+abs(y-j)+h

tmap0 = np.zeros((101, 101, len(xyhl0)), dtype="int64")
for d in range(len(xyhl0)) :
    for i in range(101) :
        for j in range(101) :
            x, y, h = xyhl0[d]
            tmap0[i, j, d] = abs(x-i)+abs(y-j)+h

dmaps = np.diff(tmaps, axis=2)
xmap = np.logical_or.reduce(dmaps, axis=2)
place = np.where(np.logical_not(xmap))

for i, j in zip(place[0],place[1]) :
    for t in tmap0[i, j, :].flat :
        if tmaps[i, j, 0] > t :
            break
    else :
        ans = [i, j, tmaps[i, j, 0]]

print("{} {} {}".format(ans[0], ans[1], ans[2]))

Measured memory_bytes: 28256
fun main(args: Array<String>) {
    a45(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a45(args: Array<String>) {
    if (args.size != 3) {
        throw IllegalArgumentException()
    }
    val (up, down, height) = args.map { it.toInt() }
    print((up + down) * height / 2)
}



Measured memory_bytes: 33536
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        s: chars,
    };
    println!(
        "{}",
        s.iter().rposition(|x| *x == 'Z').unwrap() - s.iter().position(|x| *x == 'A').unwrap() + 1
    );
}


Measured memory_bytes: 4352
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		String[][] s = new String[H][W];
		for (int i=0; i<H; i++) {
				s[i] = sc.next().split("");
		}
		sc.close();

		String ans = "Yes";

		iLoop : for (int i=0; i<H; i++) {
			for (int j=0; j<W; j++) {
				if ("#".equals(s[i][j])) {
					Boolean upper = false;
					Boolean lower = false;
					Boolean left = false;
					Boolean right = false;

					if(i>0) {
						upper = "#".equals(s[i-1][j]);
					}

					if (i<H-1) {
						lower = "#".equals(s[i+1][j]);
					}

					if (j>0) {
						left =  "#".equals(s[i][j-1]);
					}

					if (j<W-1) {
						right = "#".equals(s[i][j+1]);
					}

					if (!(upper || lower || left || right)) {
						ans = "No";
						break iLoop;
					}
				}
			}
		}

		System.out.println(ans);
	}
}



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

int tb[10][10];
int flg[10000];

int ce(int a, int b, int c, int d)
{
	return tb[tb[tb[tb[0][a]][b]][c]][d];
}

bool chk(int a, int b, int c, int d)
{
	int e = ce(a, b, c, d), te = -1;
	for (int i = 0; i <= 9; i++)
	{
		te = tb[ce(i, b, c, d)][e];
		if (i != a && te == 0) return true;
		te = tb[ce(a, i, c, d)][e];
		if (i != b && te == 0) return true;
		te = tb[ce(a, b, i, d)][e];
		if (i != c && te == 0) return true;
		te = tb[ce(a, b, c, i)][e];
		if (i != d && te == 0) return true;
		te = tb[ce(a, b, c, d)][i];
		if (i != e && te == 0) return true;
	}
	te = tb[ce(b, a, c, d)][e];
	if (a != b && te == 0) return true;
	te = tb[ce(a, c, b, d)][e];
	if (b != c && te == 0) return true;
	te = tb[ce(a, b, d, c)][e];
	if (c != d && te == 0) return true;
	te = tb[ce(a, b, c, e)][d];
	if (d != e && te == 0) return true;
	return false;
}

int main()
{
	for (int i = 0; i < 10; i++)
		for (int j = 0; j < 10; j++)
			scanf("%d", &tb[i][j]);
	int ans = 0;
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			for (int k = 0; k < 10; k++)
			{
				for (int l = 0; l < 10; l++)
				{
					ans += chk(i,j,k,l);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3236
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(
				System.in))) {

			new Main().solution(br);
		}
	}

	private void solution(BufferedReader br) throws IOException {
		int base = 100000;
		int ratio = 5;
		int term = Integer.parseInt(br.readLine());

		int ans = calc(base, ratio, term);
		System.out.println(ans);
	}

	private int calc(int base, int ratio, int term) {
		int result = base;
		int interest;
		int fraction;

		for (int i = 1; i <= term; i++) {
			interest = result / 100 * 5;// ??????
			fraction = interest % 1000;// ?????°
			if (fraction != 0) {
				interest = interest - fraction + 1000;// ??????????????????
			}
			// if(fraction > 500){
			// interest = interest - fraction + 1000;
			// }else{
			// interest = interest - fraction;
			// }
			result += interest;
		}
		return result;
	}
}

Measured memory_bytes: 23988
l, r = (int(x) for x in input().split())
if r-l>= 2019:  # if range is big, then it is fine
    print(0)
else:
    cur = min(2019, (l % 2019) + (r - l))  # if within small range there would be number mod 2019 == 0
    if cur == 2019:
        print(0)
    else:
        # else just loop thorguh
        min_mod = float('inf')
        for i in range(l, r+1):
            for j in range(i+1,r+1):
                val = (i*j) % 2019
                if val < min_mod:
                    min_mod = val
                    if min_mod == 0:
                        break
            if min_mod == 0:
                print(0)
                break
        else:
            print(min_mod)

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



int main() {
	vector<string> week = {  "SAT" , "FRI", "THU" , "WED", "TUE","MON","SUN", };

	string A;
	cin >> A;

	rep(0, week.size()) {
		if (A == week[i]) {
			cout << i+1 << endl;
			return 0;
		}
	}

	
}

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

int cur = -1 , cnt = 0 ;

int m , n , k ;

struct T{
	int x ; int y ; int direc ; int id ;
	T(){}
	T( int foo , int bar , int type , int _id ){
		x = foo ; y = bar ; direc = type ; id = _id ;
	}
	bool operator < ( const T &op ) const{
		return ( x + y != op.x + op.y ) ? x + y < op.x + op.y : x > op.x ;
	}
} Ant[200010] ;

vector < T > Lis[200010] ;

int ans[200010] ;

pair < int, int > res[200010] ;

void find_answer( vector < T > &foo ){
	deque < int > q[2] ;
	for( int i = 0 ; i < (int)foo.size() ; ++ i ){
		T bar = foo[i] ;
		if( bar.direc == 1 ){
			q[bar.x % 2].push_front( bar.id ) ;
		}
		else{
			int need ;
			if( (bar.x + bar.y) % 2 == 0 ) need = bar.x % 2 ;
			else need = 1 - bar.x % 2 ;
			
			if( q[need].empty() ) ans[bar.id] = m - bar.x ;
			else{
				ans[q[need].back()] = m - bar.x ;
				q[need].pop_back() ; q[need].push_front(bar.id) ;
			}
		}
	}
	
	for( int i = 0 ; i < (int)foo.size() ; ++ i ){
		T bar = foo[i] ;
		if( bar.direc == 1 ) ans[q[bar.x % 2].back()] = n - bar.y , q[bar.x % 2].pop_back() ;
	}
}

int main(){
	#define NAME "Ant"
	//freopen( NAME".inp" , "r" , stdin ) ; freopen( NAME".out" , "w" , stdout ) ;

	cin >> m >> n >> k ;

	for( int i = 1 ; i <= k ; ++ i ){
		int x , y , type ; char c ; cin >> x >> y >> c ;
		if( c == 'E' ) type = 0 ;
		else type = 1 ;
		Ant[i] = T( x , y , type , i ) ;
	}

	sort( Ant + 1 , Ant + k + 1 ) ;

	for( int i = 1 ; i <= k ; ++ i ){
		if( cur != Ant[i].x + Ant[i].y ) cur = Ant[i].x + Ant[i].y , cnt ++ ;
		Lis[cnt].push_back( Ant[i] ) ;
	}

	for( int i = 1 ; i <= cnt ; ++ i ) find_answer(Lis[i]) ;	

	for( int i = 1 ; i <= k ; ++ i ) res[i] = make_pair(ans[i] , i) ;

	sort(res + 1 , res + k + 1) ;
	
	for( int i = 1 ; i <= k ; ++ i ) cout << res[i].second << endl ;

	return 0 ;
}


Measured memory_bytes: 19372
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cstdio>
#include<sstream>
#include<vector>
#include<algorithm>
#include<unordered_map>

using namespace std;
#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define gc(x)  scanf(" %c",&x);
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define ll long long
#define mod  998244353
const int N = 1e6 + 5;
const int M = 1e6 + 5;
int main(){
    ll r;
    cin>>r;
    cout<<r * r<<endl;
}


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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

signed main(){
    int N;
    string S;
    cin>>N>>S;
    int cur=0;
    while(cur<N&&S[cur]=='<')cur++;
    int ans=0;
    chmax(ans,N-cur);
    cur=N-1;
    while(cur>=0&&S[cur]=='>')cur--;
    chmax(ans,cur+1);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t H;
  cin >> H;
  int n = 0;
  int64_t ans = 1;
  while (H > 0) {
    H /= 2;
    n++;
  }
  for (int i = 0; i < n; i++) {
    ans *= 2;
  }
  cout << ans - 1 << endl;
}

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

int main(){
    int A,B,C,X,Y;
    cin>>A>>B>>C>>X>>Y;
    int ans=0;
    if(A+B>2*C){
        ans+=min(X,Y)*2*C;
        if(min(X,Y)==X&&B<2*C){
            ans+=(Y-min(X,Y))*B;
        }
        else if(min(X,Y)==Y&&A<2*C){
            ans+=(X-min(X,Y))*A;
        }
        else{
            ans+=(max(X,Y)-min(X,Y))*2*C;
        }
    }
    else{
        ans=A*X+B*Y;
    }
    cout<<ans<<endl;
    
  
 }
 




Measured memory_bytes: 3608
fun main(args: Array<String>) {
    val (n, m) = run {
        val (n, m) = readLine()!!.split(' ')
        Pair(n.toLong(), m.toInt())
    }

    val bridges = (0 until m).map {
        val (a, b) = readLine()!!.split(' ').map { it.toInt() }
        Pair(a, b)
    }.reversed()

    val unionFind = UnionFind(n.toInt())

    val res = LongArray(m) { 0L }
    res[0] = n * (n - 1) / 2

    bridges.take(m - 1).forEachIndexed { i, bridge ->
        val x = bridge.first - 1
        val y = bridge.second - 1

        if (unionFind.same(x, y)) {
            res[i + 1] = res[i]
            return@forEachIndexed
        }

        res[i + 1] = res[i] - unionFind.size(x).toLong() * unionFind.size(y).toLong()

        unionFind.unite(x, y)
    }

    res.reversed().forEach {
        println(it)
    }
}

private class UnionFind(n: Int) {

    private val par = IntArray(n) { -1 }

    fun find(x: Int): Int {
        if (par[x] < 0) {
            return x
        }
        par[x] = find(par[x])
        return par[x]
    }

    fun unite(x: Int, y: Int) {
        val x1 = find(x)
        val y1 = find(y)
        if (x1 == y1) return

        val (x2, y2) = if (par[x1] > par[y1]) {
            Pair(y1, x1)
        } else {
            Pair(x1, y1)
        }

        par[x2] += par[y2]
        par[y2] = x2
    }

    fun same(x: Int, y: Int): Boolean {
        return find(x) == find(y)
    }

    fun size(x: Int): Int {
        return -par[find(x)]
    }

}


Measured memory_bytes: 81020
#include <bits/stdc++.h>
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define sz(a)           (int)(a).size()
#define all(x)          (x).begin(), (x).end()
#define fore(i,a,b)     for(int i=a; i<b; i+=1)
#define forr(i,a)       for(int i=a; i>=0; i--)
#define F first
#define S second
 
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<string, int> si;
typedef pair<int, string> is;
typedef vector<string> vs;
const int MAX=1e5+10;


 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int a,b,c; cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x48, 0xc7, 0xc0, 0x00, 0x00, 0x00, 0x00,
	0x48, 0x89, 0xf9,
	0x48, 0x83, 0xc1, 0x03,
	0x48, 0x39, 0xf9,
	0x74, 0x12,
	0x48, 0x0f, 0xb6, 0x17,
	0x48, 0x83, 0xfa, 0x31,
	0x75, 0x03,
	0x48, 0xff, 0xc0,
	0x48, 0xff, 0xc7,
	0xeb, 0xe9,
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(char[]) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	char str[4];
	fgets(str, sizeof str, stdin);
	printf("%d\n", solve(str));

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}

Measured memory_bytes: 256
/*
 *  Lang    : C++
 *  Author  : little_angel
 */
#include <bits/stdc++.h>

#include <random>

using namespace std;
#define int long long


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    string a;
    cin >> a;
    if (isupper(a[0]))cout << "A" << endl;
    else cout << "a" << endl;
}

Measured memory_bytes: 3648
#include <stdio.h>
int main()
{
    int N,M,a,b,i,c[50]={};
    scanf("%d%d",&N,&M);
    for(i=0;i<M;i++){
        scanf("%d%d",&a,&b);
        c[a-1]++; c[b-1]++;
    }
    for(i=0;i<N;i++) printf("%d\n",c[i]);
    return 0;
}

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

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int cnt = 0;
    for(int ai : a){
        cnt += 1+(d-1)/ai;
    }

    int ans = cnt + x;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string.h>
#include <string>
#include <cstring>
using namespace std;

int data[100000];

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

	for(int i=0;i<N;i++){
		cin >> data[i];
	}
	int count = 0;

	for(int i=0;i<N-1;i++){
		if(data[i]==i+1){
			swap(data[i],data[i+1]);
			count++;
		}
	}
	if(data[N-1]==N){
		count++;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int len;
int n;
int a[1010100];
int b[1010100];

bool check(int x){
    for (int i=1;i<=n;i++) b[i] = a[i]>=x;
    int Mid = (1+n)>>1;
    int le=Mid-1,ri=Mid+1;
    for (;le && ri<=n;le--,ri++)
      if (b[le] == b[le+1]) return b[le];
      else if (b[ri] == b[ri-1]) return b[ri];
    return b[1];
}

int main(){
    scanf("%d",&len);
    n = 2*len-1;
    for (int i=1;i<=n;i++) scanf("%d",&a[i]);
    int l = 0,r = 1e9;
    while (l+1<r){
	    int mid = l+r>>1;
	    if (check(mid)) l = mid;else r = mid;
	}
	printf("%d",check(l)?l:r);
	return 0;
}

Measured memory_bytes: 5120
INF = float("inf")

N, *XYP = map(int, open(0).read().split())
XYP = list(zip(*[iter(XYP)] * 3))

def solve(XP):
    M = len(XP)
    XP.sort()

    dp = [[INF] * (M + 1) for _ in range(M + 1)]
    dp[0][0] = 0

    for i, (x, p) in enumerate(XP):
        dp[i + 1][0] = dp[i][0] + abs(x) * p

    for l, dpl in enumerate(dp[:M]):
        for r in range(l + 1, M + 1):
            val = INF
            for lx, _ in XP[l:r]:
                cur = 0
                for x, p in XP[l:r]:
                    cur += p * min(abs(x - lx), abs(x))
                val = min(val, cur)

            for i in range(1, M + 1):
                dp[r][i] = min(
                    dp[r][i],
                    val + dpl[i - 1]
                )

    res = [INF] * (N + 1)
    res[:M + 1] = dp[M]
    return res


A = [INF] * (N + 1)
for state in range(1 << N):
    XP, YP = [], []
    for i, (x, y, p) in enumerate(XYP):
        if (state >> i) & 1:
            XP.append((x, p))
        else:
            YP.append((y, p))

    X, Y = solve(XP), solve(YP)
    for i in range(N + 1):
        for j in range(N + 1 - i):
            A[i + j] = min(A[i + j], X[i] + Y[j])

for a in A:
    print(a)

Measured memory_bytes: 78964
from _collections import deque
h,w,k=map(int,input().split())
S=[input() for _ in range(h)]
A=deque([])
cnt=1

def func(X):
    global cnt
    ANS=[]
    c=X.count('#')
    a=0
    for x in X:
        ANS.append(cnt)
        if x=='#':
            cnt+=1
            a+=1
            if a==c:
                for _ in range(w-len(ANS)):
                    ANS.append(cnt-1)
                break
    A.append(ANS)



for i in range(h):
    if S[i].count('#')==0 and i!=0 and len(A)!=0:
        A.append(A[-1])
    elif S[i].count('#')!=0:
        func(S[i])

if len(A)!=h:
    for _ in range(h-len(A)):
        A.appendleft(A[0])

for ans in A:
    print(*ans)

Measured memory_bytes: 12668
/**
 * Heaps - Maximum Heap
 */

#include <iostream>

using namespace std;

int H, A[500001];

void heapfy(int *a, int i) {

    int l, r;
    l = i * 2;
    r = i * 2 + 1;

    int i_ = i;

    if (r <= H && a[r] > a[i_]) i_ = r;
    if (l <= H && a[l] > a[i_]) i_ = l;

    if (i_ != i) {
        int tmp = a[i];
        a[i] = a[i_];
        a[i_] = tmp;
        heapfy(a, i_);
    }
}

int main() {

    cin >> H;

    for (int i = 1; i <= H; i++) {
        cin >> A[i];
    }

    for (int i = H / 2; i >= 1; i--) {
        heapfy(A, i);
    }

    for (int i = 1; i <= H; i++) {
        cout << " " << A[i];
    }
    cout << endl;
}


Measured memory_bytes: 5032
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n, tmpa, maxi=0, mini=1e6;
    vector<int> a;
    cin >> n;
    rep(i, n){
        cin >> tmpa;
        a.push_back(tmpa);
        maxi = max(maxi, tmpa);
        mini = min(mini, tmpa);
    }

    ll res = inf;
    reps(num, mini, maxi+1){
        ll sum = 0;
        for(auto aa : a){
            sum += (num-aa)*(num-aa);
        }
        res = min(res, sum);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	string s;
	cin>>s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7')
		cout<<"Yes";
	else
		cout<<"No";
}


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

using namespace std;

int main(){
	int N, M;
	cin >> N >> M;
	int s[10], c[10];
	rep(i,M) cin >> s[i] >> c[i];
	int ans=-1;
	rep(i,M){
		if(s[i]>N){
			cout << ans << endl;
			return 0;
		}
	}
	if(N==1){
		if(M==0){
			cout << 0 << endl;
			return 0;
		}
		rep(i,10){
			rep(j,M){
				if(i!=c[j]) break;
				if(j==M-1){
					if(ans==-1) ans=i;
				}
			}
			if(ans!=-1) break;
		}
	}
	if(N==2){
		if(M==0){
			cout << 10 << endl;
			return 0;
		}
		for(int i=10; i<100; i++){
			rep(j,M){
				if(s[j]==1){
					if(i/10!=c[j]) break;
				}
				if(s[j]==2){
					if(i%10!=c[j]) break;
				}
				if(j==M-1){
					if(ans==-1) ans=i;
				}
			}
			if(ans!=-1) break;
		}
	}
	if(N==3){
		if(M==0){
			cout << 100 << endl;
			return 0;
		}
		for(int i=100; i<1000; i++){
			rep(j,M){
				if(s[j]==1){
					if(i/100!=c[j]) break;
				}
				if(s[j]==2){
					if((i/10)%10!=c[j]) break;
				}
				if(s[j]==3){
					if(i%10!=c[j]) break;
				}
				if(j==M-1){
					if(ans==-1) ans=i;
				}
			}
			if(ans!=-1) break;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

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



int main() {
    string S;
    cin >> S;
    int zero_count = count(S.begin(), S.end(), '0');
    int one_count = count(S.begin(), S.end(), '1');

    int m = min(zero_count, one_count);
    cout << m * 2 << endl;
}

Measured memory_bytes: 3716
//2018年  3月 22日 木曜日 17:37:48 JST
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, H, W;

map<pi, int> board;
int ans[10];

void solve() {
	cin >> H >> W >> N;
	rep(i, 0, N) {
		int a, b;
		cin >> a >> b; a--; b--;
		for(int j = -1; j <= 1; j++) {
			for(int k = -1; k <= 1; k++) {
				int cenx = a + j, ceny = b + k;
				if(cenx < 1 || cenx >= H - 1 || ceny < 1 || ceny >= W - 1) continue;
				board[pi(cenx, ceny)]++;
			}
		}
	}
	ll cnt = 0;
	for(auto pp : board) {
		ans[pp.sec]++;
		cnt++;
	}
	cout << 1LL * (H - 2) * (W - 2) - cnt << "\n";
	rep(i, 1, 10) {
		cout << ans[i] << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 56576
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N, M, wSum=0;
  cin >> N >> M;
  int A[10010];
  for (int i = 0; i < M; i++){
    cin >> A[i];
    wSum += A[i];
    }
  if(N >= wSum)
    cout << N - wSum << endl;
  else
    cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3656
n = io.read("*n")
local t = {}
for i = 1, n do
  t[i] = io.read("*n")
end
local function comp(a, b, c)
  if a == b or b == c or c == a then return false end
  return a < b + c and b < a + c and c < a + b
end
local r = 0
for i = 1, n - 2 do
  for j = i + 1, n - 1 do
    for k = j + 1, n do
      if comp(t[i], t[j], t[k]) then
        r = r + 1
      end
    end
  end
end
print(r)


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

#define int long long
#define abs llabs

int gcd (int a, int b, int & x, int & y) {
	if (a == 0) {
		x = 0; y = 1;
		return b;
	}
	int x1, y1;
	int d = gcd (b%a, a, x1, y1);
	x = y1 - (b / a) * x1;
	y = x1;
	return d;
}

bool find_any_solution (int a, int b, int c, int & x0, int & y0, int & g) {
	g = gcd (abs(a), abs(b), x0, y0);
	if (c % g != 0)
		return false;
	x0 *= c / g;
	y0 *= c / g;
	if (a < 0)   x0 *= -1;
	if (b < 0)   y0 *= -1;
	return true;
}

int n;
int ans = 1e18;

void try228(int a) {
    int x, y;
    int b = -n / a;
    gcd(a, b, x, y);
    x %= -b;
    if (x < 0) x += -b;
    if (x == 0) x += -b;
    int k = a * x;
    int gg = __gcd(k, n);
    if ((k + 1) % (n / gg) == 0) ans = min(ans, k);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    n *= 2;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0 && __gcd(i, n / i) == 1) {
            try228(i);
            try228(n / i);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<cmath>
#include<queue>
#include<utility>
#include<algorithm>
using namespace std;
#define INF 1000000
#define N 10


int main() {
	int n;
	while (1) {
		cin >> n;
		if (n==0)break;
		int dp[N][N];
		//?????????
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				dp[i][j] = INF;
			}
		}

		int a, b, c;
		while (n--) {
			cin >> a >> b >> c;
			dp[a][b] = c;
			dp[b][a] = c;
		}

		for (int k = 0; k < N; k++) {
			for (int i = 0; i < N; i++) {
				for (int j = 0; j < N; j++) {
					dp[i][j] = min(dp[i][j],dp[i][k] + dp[k][j]);
				}
			}
		}

		int sum[N];
		for (int i = 0; i < N; i++) {
			sum[i] = 0;
			for (int j = 0; j < N; j++) {
				if (i != j && dp[i][j] != INF) {
					sum[i] += dp[i][j];
				}
				
			}
		}

		int res = 0;
		for (int i = 1; i < N; i++) {

			if (sum[i] < sum[res] && sum[i] != 0) {
				res = i;
			}
		}

		cout << res << ' ' << sum[res] << endl;
	}


	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() 
{
    int x,n,y;
    cin>>x>>n;
    int hash[102]={0};
    for(int i=0;i<n;i++)
    {
        cin>>y;
        hash[y]=1;
    }
    int a=x,b=x,c=0;
    while(1)
    {
        if(hash[x]==0)
        {
            cout<<x;
            break;
        }
        else
        {
            if(c%2==0)
            {
                a--;
                x=a;
                c++;
            }
            else
            {
                b++;
                x=b;
                c++;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3676
#include<stdio.h>
#include<stdlib.h>

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}

int get_gcd(int a, int b);

int main()
{
	int i, n, lx, tmp, gcd; 
	
	scanf("%d %d", &n, &lx);
	
	int x[n + 1], diff[n];
	
	for(i = 0; i < n; i++){
		scanf("%d", &x[i]);
	}
	
	x[n] = lx;
	
	qsort(x, n + 1, sizeof(int), cmp);
	
	for(i = 0; i < n; i++){
		diff[i] = x[i + 1] - x[i];
	}
	
	qsort(diff, n, sizeof(int), cmp);
	
	gcd = diff[0];
	for(i = 1; i < n; i++){
		gcd = get_gcd(gcd, diff[i]);
		if(gcd == 1){
			break;
		}
	}
	
	printf("%d", gcd);
	

	return 0;
}

int get_gcd(int a, int b)
{
    int c, tmp, mod;

    if (a < b) {
        tmp = a;
		a = b;
		b = tmp;
    }

    while (b != 0) {
        mod = a % b;
        a = b;
        b = mod;
    }

    return a;
}

Measured memory_bytes: 1396
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace ARC94_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = (from n in ReadLine().Split(' ') select int.Parse(n)).ToArray<int>();
            Array.Sort(a);
            var diff_tot = 2 * a[2] - a[0] - a[1];
            WriteLine(diff_tot % 2 == 0 ? diff_tot / 2 : diff_tot / 2 + 2);
        }
    }
}


Measured memory_bytes: 13268
import 'dart:io';
main(List<String> args) {
	int ab = 0;	
	
  String aa = stdin.readLineSync();

  for (int i = 0; i < 3; i++) {
  ab = ab + int.parse(aa.substring(i,i+1));
	}
	
	  print(ab);
}

Measured memory_bytes: 12968
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////


int main() {

	ll A, B;
	cin >> A >> B;

	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) { cout << "Possible"; }
	else { cout << "Impossible"; }
	system("PAUSE");

}


Measured memory_bytes: 504