akhauriyash/Code-Regression huggingface dataset:
#line 2 "codes/header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

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

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "codes/solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    char a;cin>>a;
    if (0 <= a - 'a' && a - 'a' <= 25){
        cout << "a" << endl;
    }
    else{
        cout << "A" << endl;
    }
    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3564
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std ;

const int N = 300010 ;

int n, k[N] ;
int base[N] ;
long long s, ans ;

int main(){
    cin >> n ; int p ;
    for (int i = 1 ; i <= n ; ++ i)
        scanf("%d", &base[i]), k[i] = base[i] - i ;
    sort(k + 1, k + n + 1) ;
    if (n & 1) p = k[n / 2 + 1] ;
    else p = (k[n / 2] + k[n / 2 + 1]) / 2 ;
    for (int i = 1 ; i <= n ; ++ i)
        ans += 1ll * abs(base[i] - p - i) ;
    cout << ans << endl ; return 0 ;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    string S;
    cin >> S;
    int cnt = 0,used = 0;
    for(auto c:S){
        if(c == 'S')cnt++;
        else if(c == 'T' && cnt){
            cnt--;
            used += 2;
        }
    }
    cout << S.size() - used << endl;
}

Measured memory_bytes: 640
x=int(input())
i=2
cond="notyet"
while cond=="notyet":
    count=0
    for i in range(2,x):
        ex=x%i
        if  ex!=0:
            count+=1
    if count==x-2:
        ans=x
        cond="discovered"
    else:
        x=x+1
print(ans)

Measured memory_bytes: 3060
import numpy as np
N = int(input())
"""
x, y, h = np.array([list(map(int, input().split())) for i in range(N)]).T
"""
x = [0 for i in range(N)]
y = [0 for i in range(N)]
h = [0 for i in range(N)]
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())

H = 0
Cx = 0
Cy = 0
Flag = True
for i in range(101):
    for j in range(101):
        Flag = True
        for k in range(N):
            if h[k] != 0:
                H = h[k] + abs(i - x[k]) + abs(j - y[k])
                break
        for k in range(N):
            if h[k] != max(H - abs(i - x[k]) - abs(j - y[k]), 0):
                Flag = False
                break
        
        if Flag:
            Cx, Cy = i, j
            break
    if Flag:
        break

print("{} {} {}".format(Cx, Cy, H))

Measured memory_bytes: 12436
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;
const int INF = 1<<29;

int N, M, C, S, G;

int p[22];
int q[22][52], r[22][52];
int cost[22][200 * 100 + 2];

int mat[22][102][102];


int main(){
    while(true){
        cin >> N >> M >> C >> S >> G;
        if(N == 0) break;

        for(int c=0;c<=C;c++){
            for(int i=0;i<N;i++){
                for(int j=0;j<N;j++){
                    mat[c][i][j] = INF;
                }
            }
        }

        for(int i=0;i<M;i++){
            int x, y, d, c;
            cin >> x >> y >> d >> c;
            x--; y--; c--;
            mat[c][x][y] = min(mat[c][x][y], d);
            mat[c][y][x] = min(mat[c][y][x], d);
        }

        for(int i=0;i<C;i++){
            cin >> p[i];
        }
        for(int i=0;i<C;i++){
            for(int j=0;j<p[i]-1;j++){
                cin >> q[i][j];
            }
            q[i][p[i]-1] = INF;
            for(int j=0;j<p[i];j++){
                cin >> r[i][j];
            }
        }

        for(int c=0;c<C;c++){
            cost[c][0] = 0;
            int j = 0;
            for(int i=1;i<=20000;i++){
                cost[c][i] = cost[c][i-1] + r[c][j];
                if(q[c][j] <= i) j++;
            }
        }

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

        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                for(int c=0;c<C;c++){
                    if(mat[c][i][j] < INF){
                        mat[C][i][j] = min(mat[C][i][j], cost[c][mat[c][i][j]]);
                    }
                }
            }
        }

        for(int k=0;k<N;k++){
            for(int i=0;i<N;i++){
                for(int j=0;j<N;j++){
                    mat[C][i][j] = min(mat[C][i][j], mat[C][i][k] + mat[C][k][j]);
                }
            }
        }
        
        if(mat[C][S-1][G-1] < INF){
            cout << mat[C][S-1][G-1] << endl;
        }else{
            cout << -1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 5488
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
	ll a, b, q, s[100002], t[100002], x[100000],ans[100000];
	cin >> a >> b >> q;
	for (int i = 0; i < a; i++) {
		cin >> s[i+1];
	}
	for (int i = 0; i < b; i++) {
		cin >> t[i+1];
	}
	for (int i = 0; i < q; i++) {
		cin >> x[i];
	}
	s[0] = -10000000000;
	t[0] = -10000000000;
	s[a + 1] = 20000000000;
	t[b + 1] = 20000000000;
	for (int num = 0; num < q; num++) {
		int sover = a+1, sunder = 0, tover = b +1, tunder = 0;
		while (1) {
			int memo = (sover + sunder) / 2;
			if (x[num] > s[memo])sunder = memo;
			else if (x[num] < s[memo])sover = memo;
			else {
				sover = memo;
				sunder = memo;
				break;
			}
			if (sunder == sover - 1)break;
		}
		while (1) {
			int memo = (tover + tunder) / 2;
			if (x[num] > t[memo])tunder = memo;
			else if (x[num] < t[memo])tover = memo;
			else {
				tover = memo;
				tunder = memo;
				break;
			}
			if (tunder == tover - 1)break;
		}
		ll k = x[num];
			ans[num] = min(min(k-min(s[sunder], t[tunder]), max(s[sover], t[tover])-k), min(( t[tover]- s[sunder]) * 2 - max(k-s[sunder], t[tover]-k), (s[sover] - t[tunder]) * 2 - max(s[sover]-k,k- t[tunder])));
	}
	for (int i = 0; i < q; i++) {
		cout << ans[i] << endl;
	}
}



Measured memory_bytes: 4480
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		private const int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			//System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start();
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			long n = vs[0];
			long k = vs[1];
			long ans = n % k;
			ans = Math.Min(ans, Math.Abs(ans - k));
			Console.WriteLine(ans);


			Console.Out.Flush();
			//System.Diagnostics.Debug.WriteLine(stopwatch.Elapsed);
		}
	}
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main(){
  long double a, b, c;
  cin >> a >> b >> c;
  a = sqrt(a);
  b = sqrt(b);
  c = sqrt(c);
  long double eps = pow(10,-14);
  if(a + b + eps < c){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll A, B, C;
  IN(A,B,C);
  C -= (A-B);
  if(C<0) C=0;
  OUT(C);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
const ll INF = (ll)1e18L;
const int NMAX = 100100;
template<class X, class Y> X& remin(X& x, Y y) { return x = (y < x ? y : x); }
template<class X, class Y> X& remax(X& x, Y y) { return x = (y > x ? y : x); }
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    for (int n; std::cin >> n; ) {
        static ll dp[NMAX][3], cost[NMAX][3];
        std::fill(&dp[0][0], &dp[0][0] + 3 * NMAX, -INF);
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < 3; j++) {
                std::cin >> cost[i][j];
            }
        }
        for (int j = 0; j < 3; j++) dp[0][j] = 0;
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < j; k++) remax(dp[i][j], dp[i-1][k] + cost[i][j]);
                for (int k = j+1; k < 3; k++) remax(dp[i][j], dp[i-1][k] + cost[i][j]);
            }
        }
        std::cout << std::max({dp[n][0], dp[n][1], dp[n][2]}) << std::endl;
    }
    return 0;
}

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

using namespace std;

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

    int x,a;
    cin >> x >> a;

    if (x<a){
        cout << 0 << endl;
    }
    else{
        cout << 10 << endl;
    }

    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if (m == -1 && f == -1 && r == -1) 
                break;
            int p = m + f;
            if (m == -1 || f == -1)
                System.out.println("F");
            else if (p >= 80)
                System.out.println("A");
            else if (p >= 65)
                System.out.println("B");
            else if (p >= 50)
                System.out.println("C");
            else if (p >= 30) {
                if (r >= 50)
                    System.out.println("C");
                else
                    System.out.println("D");
            }
            else
                System.out.println("F");
        }
    }
}



Measured memory_bytes: 26172
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	std::string str; std::cin >> str;
	long long int k; std::cin >> k;
	std::vector<int> seq_length;
	for (auto i = 0; i < str.size(); ++i) {
		if (0 < i && str[i] == str[i - 1]) seq_length[seq_length.size() - 1]++;
		else seq_length.push_back(1);
	}
	if (seq_length.size() == 1) {
		std::cout << (seq_length.front() * k) / 2 << '\n';
	}
	else {
		if (str.front() == str.back()) {
			long long int res = seq_length.front() / 2 + seq_length.back() / 2;
			res += (seq_length.front() + seq_length.back()) / 2 * (k - 1);
			for (auto i = 1; i + 1 < seq_length.size(); ++i) {
				res += seq_length[i] / 2 * k;
			}
			std::cout << res << '\n';
		}
		else {
			long long int res = 0;
			for (auto s : seq_length) res += s / 2 * k;
			std::cout << res << '\n';
		}
	}
}

Measured memory_bytes: 888
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vP p(N);
    rep(i,N){
        cin >> p[i].first >> p[i].second;
    }
    vP g(M);
    rep(i,M){
        cin >> g[i].first >> g[i].second;
    }
    rep(i,N){
        ll ans=INF,place=-1;
        rep(j,M){
            if(chmin(ans,abs(p[i].first-g[j].first)+abs(p[i].second-g[j].second))){
                place=j+1;
            }
        }
        cout << place << endl;
    }
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3672
#include<stdio.h>
int main(){
  int c,i,k,n;
  c = 0;
  int h[100001];
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){scanf("%d",&h[i]);}
  for(i=0;i<n;i++){if(h[i]>=k)c++;}
  printf("%d",c);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(){
  int n,m;
  cin >> n >> m;
  int a[n];
  rep(i,n)cin >> a[i];
  int b[n];
  rep(i,n)a[i]--;
  rep(i,n){
    b[a[i]]=i;
  }
  UnionFind k(n);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    k.unionSet(a,b);
  }
  int ans=0;
  rep(i,n){
    if(k.findSet(i,b[i]))ans++;
  }
  cout << ans << endl;
}   


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
const int N=1e6+5;
int n,h,d,sum,jc[N],xu[N],f[N],g[N];
signed main()
{
	cin>>n>>h>>d;
	int x=0,xjh=1;
	for(int i=1;i<=n;i++)
	{
		xjh=xjh*i%mod;
		x=(x+xjh)%mod;
	}
	sum=0;f[0]=1;
	for(int i=1;i<=h;i++)
	{
        sum+=f[i-1];
        if(i>d)sum-=f[i-d-1];
        sum=(sum%mod+mod)%mod;
        if(i!=h)f[i]=sum*x%mod;
        else f[i]=sum;
	}
	for(int i=1;i<=n;i++)f[h]=f[h]*i%mod;
	cout<<(f[h]%mod+mod)%mod;
}

Measured memory_bytes: 10496
#include <stdio.h>
int main(void)
{

int x[101][101], y[101];
int a[101] = {0};
int m, n, i, j;

scanf("%d %d",&m,&n);

for(i = 1; i <= m; i++){
 for(j = 1; j <= n; j++)
scanf("%d",&x[i][j]);
}

for(i = 1; i <= n; i++)
scanf("%d",&y[i]);

for(i = 1; i <= m; i++){
for(j = 1; j <= n; j++)
a[i] += x[i][j] * y[j];

printf("%d\n",a[i]);
}

return 0;
}

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

typedef long long  ll;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    vector<int>v;
    cin>>n;
    while(n--)
    {
        int a;
        cin>>a;
        v.push_back(a);
    }
    int mx=*max_element(v.begin(),v.end());
    int mn=*min_element(v.begin(),v.end());
    int p=0;
    ll val=INT_MAX;
    for(int i=1;i<=100;i++)
    {
        ll sum=0;
        for(auto x: v)
        {
            sum+=((x-i)*(x-i));
        }
        val=min(val,sum);
    }
    cout<<val<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    int N, K, Q;
    cin >> N >> K >> Q;
    int A[Q];
    REP(i, Q) cin >> A[i];

    int mp[N];
    REP(i, N) mp[i] = Q;
    REP(i, Q) {
        mp[A[i] - 1]--;
    }
    int c = 0;
    REP(i, N) {
        if (K - mp[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
import java.util.*;
import java.math.BigDecimal;

public class Main {
  public static void main(String[] args) {
    int N;
    List<Integer> vList = new ArrayList<>();
    try(Scanner sc = new Scanner(System.in)) {
      N = sc.nextInt();
      for(int i = 0; i < N; i++) {
        vList.add(sc.nextInt());
      }
    }
    Collections.sort(vList);
    int[] v = new int[N];
    for(int i = 0; i < N; i++) {
      v[i] = vList.get(i);
    }
    double answer = solve(v);
    System.out.println(answer);
  }
  
  private static double solve(int[] v) {
    int n = v.length;
    if ( n == 2 ) {
      return ((double)v[0]+(double)v[1])/2;
    }
    int[] v0 = new int[n-1];
    System.arraycopy(v, 0, v0, 0, n-1);
    return (solve(v0)+(double)v[n-1])/2;
  }

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, result;
  while(1) {
    cin >> n >> x;
    if (n == 0 && x == 0) break;
    result = 0;
    for (int i = 1; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        for (int k = j + 1; k <= n; k++) {
          if (i + j + k == x) result++;
        }
      }
    }
    cout << result << endl;
  }
}


Measured memory_bytes: 3056
#include "bits/stdc++.h"

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;


int main()
{
	int64_t a, b, c, k;
	int64_t ans  =0;
	cin >> a >> b >> c >> k;

	if (a > k)
	{
		cout << k << endl;
		return 0;
	}
	else
	{
		ans = a;
		k -= a;
		if (b > k)
		{
			
		}
		else
		{
			k -= b;
			if (c > k)
			{
				ans -= k;
			}
			else
			{
				ans -= c;
			}
		}
		
	}

	cout << ans << endl;

	return 0;
	
}

Measured memory_bytes: 3624
import math
 
ans = []
 
while True:
    if int(input()) == 0:
        break
    data = list(map(int, input().strip().split()))
    ave_data = sum(data) / len(data)
    ans += [math.sqrt(sum([(i - ave_data) ** 2 for i in data]) / len(data))]
     
print('\n'.join(map(str, ans)))

Measured memory_bytes: 7800
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;
const ll mod=9982453;

int main(){
    int n;cin>>n;
    vll x(n),y(n);
    vll sum(n),diff(n);
    rep(i,n){
        cin>>x[i]>>y[i];
        sum[i]=x[i]+y[i];
        diff[i]=x[i]-y[i];
    }
    sort(all(sum));sort(all(diff));
    ll ans=max(sum[n-1]-sum[0],diff[n-1]-diff[0]);
    cout<<ans<<endl;
}

Measured memory_bytes: 9592
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

	vector<vector<bool>> v(M,vector<bool>(10));
	vector<int> p(M);

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

	int cnt = 0;
	for (int i = 0; i < (1 << N); i++) {
		bool f = 1;

		for (int j = 0; j < M; j++) {
			int c = 0;

			for (int k = 0; k < N; k++) {
				if (i & (1 << k)) {
					if (v[j][k]) c++;
				}
			}

			int n = c % 2;
			if (n != p[j]) f = 0;
		}

		if (f) cnt++;
	}

	cout << cnt << endl;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >=0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

typedef long long ll;
#define INF 1e9

int main(){
  int N, cntm = 0, cnti;
  cin >> N;
  vector<int> a(N), ans(1e5+2,0);
  REP(i, N){
    cin >> a[i];
    if(a[i] != 0){
      for(int j=-1; j < 2; j++){
        ans[a[i]+j]++;
      }
    }
    else{
      ans[0]++;
      ans[1]++;
    }
  }
  REP(i, 1e5+1){
    if(cntm < ans[i]){
      cnti = i;
      cntm = ans[i];

    }
  }
  cout << cntm << endl;

  
  return 0;
  
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main()
{
	int score,inning,change;
	int base[3];
	char event[8];
	scanf("%d",&inning);
	while (inning--) {
		change=3;
		score=0;
		memset(base,0,sizeof(base));
		while (change) {
			scanf("%s",event);
			if (strcmp(event,"OUT")==0) {
				change--;
			} else if (strcmp(event,"HOMERUN")==0) {
				score+=base[0]+base[1]+base[2]+1;
				memset(base,0,sizeof(base));
			} else if (strcmp(event,"HIT")==0) {
				score+=base[2];
				base[2]=base[1];
				base[1]=base[0];
				base[0]=1;
			}
		}
		printf("%d\n",score);
	}
	return 0;
}

Measured memory_bytes: 596
/**
  @date Time-stamp: <2019-05-23 13:08:30 tagashira>
  @file c.cpp
  @title C - Energy Drink Collector
  @brief https://atcoder.jp/contests/abc121/tasks/abc121_c
**/

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <sstream> // std::ostringstream
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  uint i;
  long unsigned int N, M;
  cin >> N >> M;
  vector<pair<long unsigned int, long unsigned int>> AB;

  pair<long unsigned int, long unsigned int> tmpP;
  for (i = 0; i < N; i++) {
    cin >> tmpP.first >> tmpP.second;
    AB.push_back(tmpP);
  }

  sort(AB.begin(), AB.end());

  long unsigned int ans = 0;
  for (i = 0; i < N && M > 0; i++) {
    ans += AB[i].first * min(M, AB[i].second);
    M -= min(M, AB[i].second);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2420
/* Bismillahirrahmanirrahim
   Semoga Dapet AC ya Allah
   Amin.................. :)
*/
#include<bits/stdc++.h>
#define forA for(int i=0; i<a; i++)
#define ll long long
#define F first
#define S second
using namespace std;

int main(){
	int a, cnt=0;
	cin >> a;
	int arr[a];
	int bar[a];
	int sum[a];
	forA{
		cin >> arr[i];
	}
	forA{
		cin >> bar[i];
	}
	forA{
		sum[i]=arr[i]-bar[i];
	}
	forA{
		if(sum[i]>0) cnt+=sum[i];
	}
	cout << cnt;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int E,Y;
  cin >> E >> Y;
  if(E==0){
      if(1868 <= Y && Y <= 1911){
          cout << "M" << Y-1868+1  << endl;
      }
      else if(1912 <= Y && Y <= 1925){
          cout << "T" << Y-1912+1 << endl;
      }
      else if(1926 <= Y && Y <= 1988){
          cout << "S" << Y-1926+1 << endl;
      }
      else if(1989 <= Y && Y <= 2016){
          cout << "H" << Y-1989+1 << endl;
      }
  }
  else if(E==1){
      cout << 1868+Y-1 << endl;
  }
  else if(E==2){
      cout << 1868+44+Y-1 << endl;
  }
  else if(E==3){
      cout << 1868+44+14+Y-1 << endl;
  }
  else if(E==4){
      cout << 1868+44+14+63+Y-1 << endl;
  }
}


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

int main(){
    int n,x;
    int l[100];
    cin >> n >> x;
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    int now = 0;
    int bound = 1;
    for(int i=0;i<n;i++){
        now += l[i];
        if(now > x){
            break;
        }else{
            bound++;
        }
    }
    cout << bound;
    return 0;
}

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

int main() {
	int a,b,i,j,n,cur=1;
	cin >> a >> b;
	n=0; j=b;
	while(j>0){
		j/=10; n++;
	}

	for(i=0; i<n; i++){
		cur*=10;
	}
	a=a*cur+b;
	for(i=1; i*i<=a; i++){
		if(i*i==a){
			cout << "Yes"; return 0;
		}
	}
	cout << "No";
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <bits/stdc++.h>
#define   int  long long 
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
using namespace std;

inline void solve(){
    int  n, ans = 0 ; 
    cin >> n ; 
    vi  a(n+1) ; 
    for (int i=1;i<=n;i++) cin >> a[i] ; 
    int sum = 0, xr = 0, cnt = 0 ; 
	for (int i=1;i<=n;i++){
		sum += a[i] ; 
		xr = xr^a[i] ; 
		if (xr == sum) cnt++ ; 
		else {
			int cur = cnt ; 
			while (sum != xr){
				sum -= a[i-cnt];
				xr ^= a[i-cnt] ;
				cnt--;
			}
			ans += cur * (cur+1) / 2 ; 
			ans -= cnt * (cnt+1) / 2 ; 
			cnt++; 
		}
	}
	ans += cnt * (cnt+1) / 2 ; 
	co (ans) ; 
}
signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 4840
#
import sys
import math
import numpy as np
import itertools

# 文字列を一文字ずつのリストに代入 test は['t', 'e', 's', 't']
m = list(input())

if m[2]==m[3] and m[4]==m[5]:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 21772
#include <stdio.h>
#include <string.h>

int main()
{
    int len,judge=0;
    char arr[10];
    scanf("%s",arr);
    len=strlen(arr);

    if(arr[0]=='h'&&len%2==0){   
        for(int i=0;i<=len-2;i=i+2){
            if(arr[i]!='h'||arr[i+1]!='i'){
                judge=1;
                break;
            }
        }
        if(judge==1) printf("No");
        else printf("Yes");
    }

    else printf("No");

    return 0;
}

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

int main(){
	string s,t;
	cin>>s>>t;
	rep(i,s.size()){
		rotate(s.begin(), s.begin() + 1, s.end());
		if(s==t){
			puts("Yes");
			return 0;
		}
	}
	puts("No");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <queue>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()


using namespace std;
const int MAXN = 1000005;
const int INF = 0x7f7f7f7f;
typedef long long ll;


int main() {
#ifndef ONLINE_JUDGE
    //freopen("../input.txt", "r", stdin);
    //freopen("../output.txt", "w", stdout);
#endif
    char x;
    cin >> x;
    if (x <= 'Z'){
        cout << 'A' << endl;
    } else {
        cout << 'a' << endl;
    }

    return 0;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	ll sum = 0;
	ll ans = 0;
	ll e = 1000000000+7;
	for (int i = 0; i < n; i++) {
		ans += (a[i] % e) * sum;
		ans %= e;
		sum += a[i] % e;
		sum %= e;
	}
	cout << ans << endl;
	return 0;
}

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

//J=0,O=1,I=2
int N;
int ary[1000010];

int joichec(int numJ,int numI,int& fla){
	int cntJ=0,cntJO=0,cntJOI=0;
	int cntI=0,cntOI=0,cntJOI2=0;
	for(int i=0;i<N;i++){
		switch(ary[i]){
			case 0:
				cntJ++;
				break;
			case 1:
				if(cntJ>0){
					cntJ--;
					cntJO++;
				}
				break;
			case 2:
				if(numJ>0){
					numJ--;
					cntJ++;
				}
				else{
					if(cntJO>0){
						cntJO--;
						cntJOI++;
					}
				}
				break;
		}
	}
	for(int i=N-1;i>=0;i--){
		switch(ary[i]){
			case 0:
				if(cntOI>0){
					cntOI--;
					cntJOI2++;
				}
				break;
			case 1:
				if(cntI>0){
					cntI--;
					cntOI++;
				}
				break;
			case 2:
				if(numI>0){
					numI--;
					cntI++;
				}
				else{
					if(cntOI>0){
						cntOI--;
						cntJOI2++;
					}
				}
				break;
		}
	}
	if(cntJO>cntOI) fla=-1;
	else if(cntJO<cntOI) fla=1;
	else fla=0;
	//cout<<cntJ<<" "<<cntJO<<" "<<cntJOI<<" "<<cntI<<" "<<cntOI<<" "<<cntJOI2<<endl;//debug
	return cntJOI;
}

int main(){
	int numofI=0;
	char tmp;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>tmp;
		switch(tmp){
			case 'J':
				ary[i]=0;
				break;
			case 'O':
				ary[i]=1;
				break;
			case 'I':
				ary[i]=2;
				numofI++;
				break;
		}
	}

	int lb=0,rb=numofI,mid,hog,piy,res=0;
	hog=0;
	for(int i=0;i<25;i++){
		mid=(lb+rb)/2;
		hog=joichec(mid,numofI-mid,piy);
		//cout<<"hog="<<hog<<" mid="<<mid<<" lb="<<lb<<" rb="<<rb<<endl;//debug
		if(numofI-mid-hog>0)lb=mid;
		else{
			rb=mid;
			res=max(res,hog);
		}
	}
	res=max(res,hog);
	/*
	cout<<hog<<endl;
	int hog=0,flaa;
	for(int i=0;i<=numofI;i++){
		hog=max(hog,joichec(i,numofI-i,flaa));
	}
	cout<<hog<<endl;
	*/
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 7000
#include <algorithm>
#include <iostream>
#include <list>
#include <map> //連想配列
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector> //動的配列

#define rep(i, N) for (int i = 0; i < N; i++)

using namespace std;
int main()
{
    int N,K,d,tmp;
    cin >> N >> K;
    int A[N];
    rep(i,N){
        A[i]=0;
    }

    rep(i,K){
        cin >> d;
        rep(j,d){
            cin >> tmp;
            A[tmp-1]++;
        }
    }
    tmp = 0;
    rep(i,N){
        //cout << A[i] << endl;
        if (A[i]==0){
            tmp++;
        }
    }
    cout << tmp << endl;
  return 0;
}


Measured memory_bytes: 3224
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define pi pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912

const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
int main(){
    int N; cin >> N;
    string s; int p[101];

    vector<pair<string,int>> vp;

    if(N == 1){
        int t;
        cin >> s >> t;
        cout << 1 << endl;
        return 0;
    }


    for(int i = 0; i < N; i++){
        cin >> s >> p[i];
        vp.push_back(make_pair(s,i+1));
    }


    sort(vp.begin(),vp.end());
    /*
    for(int i = 0; i < vp.size(); i++){
        cout << vp[i].first << endl;
    }
    */
    vector<pair<int,int>> w;
    for(int i = 0; i < N; i++){
        if(i == N-1){
            w.push_back(make_pair(p[vp[i].second-1], vp[i].second));
            sort(w.begin(),w.end());
            reverse(w.begin(),w.end());
            if(w.size()){
                for(int j = 0; j < w.size(); j++){
                    cout << w[j].second << endl;
                }
            } else cout << vp[i].second << endl;

        } else if(vp[i].first == vp[i+1].first){
            w.push_back(make_pair(p[vp[i].second-1], vp[i].second));
        } else if (w.size()){
            w.push_back(make_pair(p[vp[i].second-1], vp[i].second));
            sort(w.begin(),w.end());
            reverse(w.begin(),w.end());
            for(int j = 0; j < w.size(); j++){
                cout << w[j].second << endl;
            }
            w.clear();
        } else {
            cout << vp[i].second << endl;
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string S; cin >> S; 
	int N = S.size(); 
	string T = S; 
	reverse(T.begin(), T.end()); 
	int cnt = 0; 
	for(int i = 0; i < N; i++){
		if(S.at(i) != T.at(i)) cnt ++; 
	}
	cout << cnt / 2 << endl; 
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n[2];
	float f;
	scanf("%d %d", &n[0], &n[1]);
	printf("%d %d %f\n", n[0] / n[1], n[0] % n[1], (double)n[0] /n[1]);
	return 0;
}


Measured memory_bytes: 2148
A, B, K = map(int, input().split())
while K > 0:
    if A%2 == 1:
        A -= 1
    A /= 2
    B += A
    K -= 1
    if K == 0:
        break
    
    if B%2 == 1:
        B -= 1
    B /= 2
    A += B
    K -= 1
print(int(A), int(B))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    double a, b, C;
    cin >> a >> b >> C;
    double S, L, h;
    S = a * b * sin(C * M_PI / 180) / 2;
    L = a + b + sqrt(a*a + b*b - 2*a*b*cos(C * M_PI / 180));
    h = 2 * S / a;
    cout << fixed << setprecision(10);
    cout << S << endl;
    cout << L << endl;
    cout << h << endl;
    return 0;
}


Measured memory_bytes: 3564
package main

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

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

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

func newScanner(r io.Reader) *bufio.Scanner {
	return bufio.NewScanner(r)
}

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

func newSplitScanner(r io.Reader) *bufio.Scanner {
	sc := bufio.NewScanner(r)
	sc.Split(bufio.ScanWords)
	return sc
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	//	str := `
	//1 1 1
	//`
	//	var sc = newSplitScanner(strings.NewReader(str))

	var sc = newSplitScanner(os.Stdin)

	m := make(map[int]struct{})
	for i := 0; i < 3; i++ {
		m[nextInt(sc)] = struct{}{}
	}

	if len(m) == 2 {
		fmt.Println("Yes")
		return
	}
	fmt.Printf("No")
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
    string n;
    cin>>n;
    int ans=0;
    rep(i,n.size()) ans+=n[i]-'0';
    if(ans!=1) cout<<ans;
    else cout<<10;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << a << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {}

int main(void) {
  int a,b;cin>>a>>b;
  int res=ceil(((b-1)+0.0)/(a-1));
  pr(res);
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

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

int main(){
    int n, q, i, l, r, count = 0;
    string s;
    cin >> n >> q;
    int c[n] = {};
    cin >> s;
    for(i=1; i<n; i++){
        if(s[i-1] == 'A' && s[i] == 'C'){
            count++;
        }
        c[i] = count;
    }
    for(i=0; i<q; i++){
        cin >> l >> r;
        cout << c[r-1] - c[l-1] << '\n';
    }
    return 0;
}

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

int main(){
    int n,t,a;
    cin >> n >> t >> a;
    int h[n];
    for(int i = 0; i < n; i++) cin >> h[i];
    float min = t - h[0]*0.006,minat = 1;
    for(int i = 1; i < n; i++){
        float ave = t - h[i]*0.006;
        if(abs(a - min) > abs(a - ave)){
            min = ave;
            minat = i+1;
        }
    }
    cout << minat << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=10e9+7;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}

int main(void){
    ll A,B;
    cin>>A>>B;
    A--;
    B--;
    ll ans=B/A;
    if(B%A) ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll H , W , N;
	cin >> H >> W >> N;
	ll a,b;
	map<P,ll> count;
	ll ans[10];
	FOR(i,0,10)ans[i]=0;
	FOR(i,0,N){
		cin >> a >> b;
		a--;
		b--;
		FOR(i,max(a-2,0ll),min(a+1,H-2)){
			FOR(j,max(b-2,0ll),min(b+1,W-2)){
				ll k = count[{i,j}];
				count[{i,j}]++;
				ans[k]--;
				ans[k+1]++;
			}
		}
	}
	ans[0]+=(H-2)*(W-2);
	FOR(i,0,10){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 56576
N=int(input())

l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

smax=0

for i in range(N):
    S=sum(l1[0:i+1])+sum(l2[i:N+1])
    if smax<=S:
        smax=S

print(smax)

Measured memory_bytes: 3060
a=b=1
gets.to_i.times do
  c,d=gets.split.map &:to_i
  if a*d<=b*c
    b=d*((b-1)/d+1)
    #b=d*((b/d).ceil)
    a=b*c/d
  else
    a=c*((a-1)/c+1)
    #a=c*((a/c).ceil)
    b=a*d/c
  end
end
p (a+b).to_i

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

double a,b,c,d,e,f;
double max = -1.0,ab_w,cd_w,w;
cin >> a >> b >> c >> d >> e >> f;
for (double i = 0;i*100 <= f;i += a){
        //cout << i << endl;
        for (double j = 0;j*100 <= f-(i*100);j += b){
            //cout << j << endl;
            for (double k = 0;k <=f-(i*100)-(j*100);k += c){
                //cout << k << endl;
                for (double s = 0;s <= f-(i*100)-(j*100)-k;s += d){
                    //cout << s << endl;
                    w = 100*(k+s)/((i+j)*100+(k+s));
                    if(w > max && s + k <= e*(i+j) && w <100){
                        //cout << w << endl;
                        max = w;
                        ab_w = (i + j)*100 + (k+s);
                        cd_w = k + s;
                    }
                }
            }
        }
    
    
    }
    cout << ab_w << " " << cd_w << endl; 
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n = ir.nextInt();
		if (n % 2 == 0) {
			out.println(n / 2 - 1);
		} else {
			out.println((n - 1) / 2);
		}
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}

	static void tr(Object... o) {
		out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 23252
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    string S; 
    cin >> N >> S;
    int ans = 0;
    bool f = false;
    for (int i = 0; i < N;i++) {
        if (S[i] == 'o') {
            f = false; ans++;
        }
        else {
            if (f) break;
            f = true; ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3352
H, W, K = map(int, input().split())
#Ci,jを表す配列を作成する
c = []
for i in range(H):
    c.append(input())

ans = 0

# 各行のYes or Noに関して列のYes or Noの全通りを試す
# bit演算を行うことで全通りを簡単に試すことができる
for h in range((1 << H)):
    for w in range((1 << W)):
        black = 0
        # 各行の各列
        for i in range(H):
            for j in range(W):
                if ((h >> i) & 1) == 0 and ((w >> j) & 1) == 0 and c[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1

print(ans)

Measured memory_bytes: 9212
import sys

N, M = map(int, input().split())

hantei = 0
ctmp = []
for i in range(N):
    ctmp.append(-1)

for i in range(M):
    s, c = map(int, input().split())
    
    if ctmp[s - 1] == -1 or ctmp[s - 1] == c:
        ctmp[s - 1] = c
    else:
        hantei = 1

if M == 0:
    if N == 1:
        print('0')
    else:
        print(10 ** (N - 1))
    sys.exit(0)
if hantei == 1:
    print('-1')
    sys.exit(0)

if ctmp[0] == 0 and N != 1:
    print('-1')
    sys.exit(0)

result = 0
tmp = N - 1

for i in range(N):
    if ctmp[i] != -1:
        result += ctmp[i] * (10 ** tmp)
    else:
        if i == 0:
            result += 10 ** tmp
        else:
            result += 0
    tmp -= 1
print(result)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn =1e5+5;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	int cnt=0;
	for(int i=1;i<=n;i++)
    {
        string s;
        s=to_string(i);
        if(s.size()%2)
            cnt++;

    }
    cout<<cnt<<'\n';





}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  int n,m;
  cin >> n >> m;
  bool con[n][n];
  fill(con[0],con[n],false);
  REP(i,m){
    int a,b;
    cin >> a >> b;
    con[a-1][b-1] = true;
    con[b-1][a-1] = true;
  }
  int perm[n];
  REP(i,n){
    perm[i] = i;
  }
  ll ans = 0;
  do{
    bool res = true;
    REP(i,n-1){
      if(con[perm[i]][perm[i+1]]==false) res = false;
    }
    if(res) ans++;
  }while(next_permutation(perm+1,perm+n));
  cout << ans << endl;
  return 0;
}


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

    if(A>0 && A<10)
     {
       if(B>0 && B<10)
        cout<<A*B;
        else
      cout<<"-1";
     }
     else
      cout<<"-1";


  return 0;
}

Measured memory_bytes: 256