akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto N = RD;
	auto A = RDA;

	A.sort!"a > b"();
	long ans = A.front;
	foreach (i; 0..N-2)
	{
		auto x = i / 2;
		ans += A[1+x];
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 11780
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define Y "Yes"
#define N "No"
#define ll long long
#define pi pair<int, int>
#define ppi pair<pi, pi>
using namespace std;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int h, w;
	cin >> h >> w;
	char p[h][w];
	for (int i = 0; i < w + 2; i++)
		cout << '#';
	cout << '\n';
	for (int i = 0; i < h; i++) {
		cout << '#';
		for (int j = 0; j < w; j++) {
			cin >> p[i][j];
			cout << p[i][j];
		}
		cout << "#\n";
	}
	for (int i = 0; i < w + 2; i++)
		cout << '#';
}

Measured memory_bytes: 256
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@jit
def main(n ,m ,x, a):
  ans = 0
  right = (x > a).sum()
  left = (x < a).sum()
  return min(right, left)
  
n, m, x = map(int, readline().split())
a = np.array(readline().split(), np.int64)
print(main(n, m, x, a))

Measured memory_bytes: 113468
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	s := sc.Text()
	sc.Scan()
	t := sc.Text()

	for i := 0; i < len(s); i++ {
		s = s[1:] + s[:1]
		if s == t {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<deque>
using namespace std;

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

int main() {
	int n, a[200005];
	deque<int> dq;
	cin >> n;
	REP(i, n) {
		cin >> a[i];
	}

	if (n % 2 == 0) {
		for(int i=0;i<n;i+=2) {
			dq.push_back(a[i]);
			dq.push_front(a[i + 1]);
		}
	}
	else {
		for (int i = 0;i < n - 1;i += 2) {
			dq.push_front(a[i]);
			dq.push_back(a[i+1]);
		}
		dq.push_front(a[n - 1]);
	}

	REP(i, n) {
		if (i > 0) cout << " ";
		cout << dq[i];
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    double a[n];
    for(int i=0;i<n;i++)
     cin>>a[i];

    vector<vector<double>>dp(n+1,vector<double>(n+1,0.0));
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
     for(int j=0;j<=n;j++)
     {
         if(j==0)
          dp[i][j]=(1-a[i-1])*dp[i-1][j];
         else
          dp[i][j]=a[i-1]*dp[i-1][j-1]+(1-a[i-1])*dp[i-1][j];
     }
  double res=0.0;
  for(int i=n/2+1;i<=n;i++)
   res+=dp[n][i];
  cout<<fixed<<setprecision(10)<<res<<endl;
    
    
}

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

int main()
{
	int64_t n;
	string s;
	cin >> n >> s;

	int64_t ans = 1;
	for (int64_t i = 1; i < n; i++)
	{
		if (s[i - 1] != s[i])
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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


int main()
{
	string s;
	int n,len;
	cin>>n>>s;
	len=s.size();
	for(int i=0;i<len;i++)
	{
		s[i]=s[i]+n;
		while(s[i]>90)
		{
			s[i]-=26;
		}
	}
	cout<<s;
	return 0;
 } 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		long X = Long.parseLong(sc.next());

		long yokin = 100;
		int counter = 0;
		while (!(yokin >= X)) {
			yokin *= 1.01;
			counter++;
		}

		System.out.println(counter);
	}
}

Measured memory_bytes: 35696
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int const mxn=4444;
int n,m;
int a[mxn],b[mxn],c[mxn],d[mxn],e[mxn],f[mxn];
bool vis[mxn][mxn],up[mxn][mxn],dw[mxn][mxn],le[mxn][mxn],ri[mxn][mxn]; //blockage

int const dx[]={-1,0,1,0};
int const dy[]={0,-1,0,1};
vi xx={-MOD,MOD}, yy={-MOD,MOD};

void bfs(int x, int y){
	queue<ii>q;
	q.emplace(x,y);
	vis[x][y]=1;
	while(!q.empty()){
		x = q.front().fi;
		y = q.front().se;
		q.pop();
		for(int i=0; i<4; i++){
			if(i==0&&le[x][y])continue;
			if(i==1&&dw[x][y])continue;
			if(i==2&&ri[x][y])continue;
			if(i==3&&up[x][y])continue;
			int X = x+dx[i];
			int Y = y+dy[i];
			if(X<0||X>=(int)xx.size()-1)continue;
			if(Y<0||Y>=(int)yy.size()-1)continue;
			if(vis[X][Y])continue;
			vis[X][Y]=1;
			q.emplace(X,Y);
		}
	}
	return;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	cin >> n >> m;
	memset(vis,0,sizeof(vis));
	memset(up,0,sizeof(up));
	memset(dw,0,sizeof(dw));
	memset(le,0,sizeof(le));
	memset(ri,0,sizeof(ri));
	for(int i=0; i<n; i++){
		cin >> a[i] >> b[i] >> c[i];
		xx.pb(a[i]);
		xx.pb(b[i]);
		yy.pb(c[i]);
	}
	for(int i=0; i<m; i++){
		cin >> d[i] >> e[i] >> f[i];
		xx.pb(d[i]);
		yy.pb(e[i]);
		yy.pb(f[i]);
	}
	sort(all(xx));
	xx.erase(unique(all(xx)),xx.end());
	sort(all(yy));
	yy.erase(unique(all(yy)),yy.end());
	//setting up blockage
	for(int i=0; i<n; i++){
		int x1 = lower_bound(all(xx),a[i])-xx.begin();
		int x2 = lower_bound(all(xx),b[i])-xx.begin();
		int y = lower_bound(all(yy),c[i])-yy.begin();
		// at y x1 --- x2
		for(int j=x1; j<x2; j++){
			up[j][y-1]=1;
			dw[j][y]=1;
		}
	}
	for(int i=0; i<m; i++){
		int x = lower_bound(all(xx),d[i])-xx.begin();
		int y1 = lower_bound(all(yy),e[i])-yy.begin();
		int y2 = lower_bound(all(yy),f[i])-yy.begin();
		/* at x
			y1
			|
			|
			|
			y2
		*/
		for(int j=y1; j<y2; j++){
			ri[x-1][j]=1;
			le[x][j]=1;
		}
	}
	int x = lower_bound(all(xx),0)-xx.begin()-1; 
	int y = lower_bound(all(yy),0)-yy.begin()-1; 
	bfs(x,y);
	if(vis[0][0]||vis[xx.size()-1][yy.size()-1]){
		cout << "INF" << endl;
		return 0;
	}
	ll ans = 0LL;
	for(int i=0; i<(int)xx.size()-1; i++)
		for(int j=0; j<(int)yy.size()-1; j++)
			if(vis[i][j])
				ans += ll(xx[i+1]-xx[i])*(yy[j+1]-yy[j]);
	cout << ans << endl;
}	


Measured memory_bytes: 100196
#import pysnooper
import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy

setrecursionlimit(10**6)

n=int(stdin.readline().rstrip())
a=[int(i) for i in stdin.readline().rstrip().split()]
cnt=0
for i in range(n):
    cnt+=1/a[i]
print(1/cnt)

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

#define ll long long
#define forr(i,n) for(ll i=0;i<n;i++)
#define f(i,a,b) for(ll i=a;i<b;i++)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())

ll power(ll a,ll b){ll r=1;while(b--)r*=a;return r;}
const ll INF=1e17L+5;

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

    string s1,s2,s="";cin>>s1>>s2;
    int n1=s1.size(),n2=s2.size();
    vector<vector<int>> dp(n1+1,vector<int>(n2+1,0));
    f(i,0,n1+1)dp[i][0]=i;
    f(i,0,n2+1)dp[0][i]=i;
    f(i,1,n1+1){
        f(j,1,n2+1){
            if(s1[i-1]==s2[j-1]){dp[i][j]=dp[i-1][j-1];}
            else dp[i][j]=min(dp[i-1][j],dp[i][j-1])+1;
        }
    }int i=n1,j=n2;
    while(i>0 && j>0){
        if(s1[i-1]==s2[j-1]){s+=s1[i-1];i--;j--;}
        else if(dp[i][j]==dp[i-1][j]+1)i--;
        else j--;

    }
    rev(s);
    cs(s);

  }


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll V[100];

ll C[101][101];
void comb_table(int N){
    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= i; j++){
            if(j == 0 || j == i)
                C[i][j] = 1LL;
            else
                C[i][j] = C[i-1][j-1] + C[i-1][j];
        }
    }
}

int main(){
    ll N, A, B;
    cin >> N >> A >> B;
    REP(i,N){
        ll v;
        cin >> v;
        V[i] = v;
    }
    sort(V, V+N, greater<ll>());

    double ans1 = 0.0;
    REP(i,A){
        ans1 += V[i];
    }
    ans1 /= A;
    printf("%.25lf\n", ans1);

    comb_table(N);

    ll ans2 = 0;
    if(V[0] == V[A-1]){
        ll v = V[0];
        sort(V, V+N);
        int num = upper_bound(V,V+N,v) - lower_bound(V,V+N,v);
        for(int i = A; i <= B; i++){
            ans2 += C[num][i];
        }
    }
    else{
        ll v = V[A-1];
        sort(V, V+N);
        int num = upper_bound(V,V+N,v) - lower_bound(V,V+N,v);
        int num2 = upper_bound(V+N-A,V+N,v) - lower_bound(V+N-A,V+N,v);
        ans2 += C[num][num2];
    }
    cout << ans2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
const int MOD = 1e9 + 7;
const int INF = 1e18;

void solve(){
 int n;
 cin >> n;
 vector<int> v;
 bool ok = false;
 for (int i = 1; i <= 9; i++){
  for (int j = i; j <= 9; j++){
	  if (i * j == n){
		ok = true;
		break;  
	  }  
	}	 
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();	
}


Measured memory_bytes: 256
// God put a smile upon your face <3

#include <bits/stdc++.h>`

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

#define mod 958585860497

#define base 2001487

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

map < ll, ll > freq;
string str;

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> str)
    {
		freq.clear();

		reverse(str.begin(),str.end());

		ll x = 1;
		ll num = 0;
		ans = 0;

		freq[0] = 1;

		for(auto it: str)
		{
			num += (it - '0') * x;

			num %= 2019;

			ans += freq[num];

			freq[num]++;

			x = (x * 10) % 2019;
		}

		cout << ans << '\n';
    }


}





Measured memory_bytes: 3744
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


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

unordered_map<ll,ll> c;

int main(){
    ll n,k;cin>>n>>k;
    ll a[n];
    ll sum[n];
    ll mo[n];
    rep(i,0,n-1){
        cin>>a[i];
        if(i==0){
            sum[i]=a[i];
        }else{
            sum[i]=sum[i-1]+a[i];
        }
        mo[i]=(sum[i]-i)%k;
        //cout<<mo[i]<<' ';
    }
    //cout<<endl;
    ll ans=0;
    
    
    if(k>=n){
        rep(i,0,n-1){
            ans+=c[mo[i]];
            c[mo[i]]++;
            if(mo[i]==1 && i<=k-2){
                ans++;
            }
        }
        
    }else{
        rep(i,0,k-1){
            ans+=c[mo[i]];
            c[mo[i]]++;
            if(mo[i]==1 && i<=k-2){
                ans++;
            }
        }
        //cout<<ans<<endl;
        rep(i,k,n-1){
            c[mo[i-k]]--;
            ans+=c[mo[i]];
            c[mo[i]]++;
        }
        
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}


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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define all(A) A.begin(), A.end()
#define sz(A) (int)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 2e5;

void solve () {
	int l, r, d;
	cin >> l >> r >> d;
	cout << r / d - (l - 1) / d << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
  #endif
	int t = 1;
	while (t--) {
		solve();
	}
 	return 0;
}

Measured memory_bytes: 3608
#include <iostream>

using namespace std;

int main(void) {
	int k, s, x, y, z, ans = 0;
	cin >> k >> s;
	for (x = 0; x <= k; x++) {
		for (y = 0; y <= k; y++) {
			z = s - x - y;
			if (0 <= z && z <= k)
				ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int l[1100], r[1100];
  for(int i=0; i<n; i++){
    cin >> l[i] >> r[i];
  }
  int sum=0;
  for(int i=0; i<n; i++){
    sum += r[i] - l[i] + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int i,j,k,A[100],N,v;
  scanf("%d ",&N);
  for(i = 0; i < N;i++)
  scanf("%d ",&A[i]);

  for(i = 0; i<N; i++){

 v = A[i];
 j = i-1;
  while(j >= 0 && A[j] >= v)
{
  A[j+1] = A[j];
  j=j-1;
  }
  A[j+1] = v;
  
  for(k = 0; k<N; k++){
  printf("%d", A[k]);
  if(k < N-1)
  printf(" ");
  }
  printf("\n");
}

  return 0;
}
  

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

#define F first 
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 60;

int n, cnt[N];
LL m, a[N];

int main()
{
	scanf("%d%lld", &n, &m);
	for (int i = 0; i < n; i ++ )
	{
		scanf("%lld", &a[i]);
		for (int j = 0; j < M; j ++ ) cnt[j] += (a[i] >> j) & 1;
	}
	
	int maxa = -1;
	for (int i = M - 1; i >= 0; i -- )
		if ((m >> i) & 1)
		{
			if (n - cnt[i] > cnt[i]) cnt[i] = n - cnt[i];
			else
			{
				maxa = i;
				break;
			}
		}
	
	for (int i = maxa - 1; i >= 0; i -- )
		if (n - cnt[i] > cnt[i])
			cnt[i] = n - cnt[i];
	
	LL res = 0;
	for (int i = 0; i < M; i ++ )
		res += (LL)cnt[i] * (1LL << i);
	printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    vector<int> vec(n);
    int ans;
 
    for(int i=0; i<n; i++){
        cin >> vec.at(i);
    }
 
    sort(vec.begin(), vec.end());
 
    double maxd = vec.at(n-1);
    for(int i=0; i<n-1; i++){
        double diff = abs((double)vec.at(n-1)/2 - vec.at(i));
        if(diff < maxd){
            maxd = diff;
            ans = vec.at(i);
        }
    }
 
    cout << vec.at(n-1) << " " << ans << endl;
 
    return 0;
}

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

double f(double n) {
  return (n+1) / 2;
}

int main() {
  cout << fixed << setprecision(10);
  double n, k; cin >> n >> k;
  vector<double> p(n);
  rep(i,n) cin >> p[i];

  double sum = 0, ans = 0;
  int j = 0, c = 0;
  rep(i,n-k+1) {
    while(c != k) {
      sum += f(p[j]);
      c++; j++;
    }
    ans = max(ans, sum);
    sum -= f(p[i]); c--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4848
from functools import reduce
from operator import mul


def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    elif n < r:
        return 0
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


def factorize(n):
    """
    nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す
    e.g.
    >>> factorize(20)
    [(2, 2), (5, 1)]
    """
    b = 2
    fct = []
    while b * b <= n:
        cnt = 0
        while n % b == 0:
            cnt += 1
            n //= b
        if cnt > 0:
            fct.append((b, cnt))
        b += 1
    if n > 1:
        fct.append((n, 1))
    return fct


MOD = 10 ** 9 + 7
N, M = map(int, input().split())

# M = 2^9 * 5^7 とすると
# 9個のボールとN-1個の仕切りを並べ替える場合の数　* 7個のボールとN-1個の仕切りを並べ替える場合の数
# = 9+N-1_C_9 * 7+N-1_C_7
# で考えられるはず

ans = 1
for fct, e in factorize(M):
    c = cmb(e + N - 1, e) % MOD
    ans = (ans * c) % MOD
print(ans)


Measured memory_bytes: 3572
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
MOD = 10 ** 9 + 7

prime_factories = [0] * (n+1)
for i in range(2, n+1):
    j = 2
    while j ** 2 <= i:
        ext = 0
        while i % j == 0:
            ext += 1
            i //= j
        if ext:
            prime_factories[j] += ext
        j += 1
    if i != 1:
        prime_factories[i] += 1
ans = 1
# 合成数のnumは0、num+1=1の乗算は計算結果に影響しない
for num in prime_factories:
    ans = (ans * (num + 1)) % MOD
print(ans)


Measured memory_bytes: 67944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
 
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値
 
ll dp[MX][MX];
inline void chmax(ll& a, ll b) {
  a = max(a, b);
}
 
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define PB push_back
 
 
int main(){
   char s;
   cin >> s;

   if (isupper(s))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a" << endl;
   }

   return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
char input[20];
long long totalsum = 0;
int len,cross[20],num[20];

void fuck(int lvl)
{
	if(lvl == len)
	{
		long long sum = num[0];
		int i;
		for(i=1;i<=len;i++)
		{
			if(cross[i] == 0)
			{
				sum *= 10;
				sum += num[i];
			}
			else if(cross[i] == 1)
			{
				totalsum += sum;
				sum = 0;
				if(i!=len)
				{
					sum += num[i];
				}
			}
		}
		return;
	}
	
	cross[lvl] = 1;
	fuck(lvl+1);
	
	cross[lvl] = 0;
	fuck(lvl+1);
	
	return;
}

int main()
{
	int i,j,k;
	
	scanf("%s",input);
	len = strlen(input);
	cross[len] = 1;
	for(i=0;i<len;i++)
	{
		num[i] = input[i] - '0';
	}
	fuck(1);
	
	

	printf("%lld\n",totalsum);
	
}

Measured memory_bytes: 3760
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int t = sc.nextInt();
		
		if(X - t >= 0) {
			System.out.println(X - t);
		} else {
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <map>
#include <set>
#include <string>
#include<string.h>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
string s;
int main(){
    cin>>s;
    //string t="FESTIVAL";
    int len=s.length();
    cout<<s.substr(0,len-8)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
ll gcd(ll x,ll y){
    if (y == 0) return x;
    return gcd(y, x%y);
}
int main(void){
    ll n;cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll res=a[0];
    rep(i,n) res=gcd(res,a[i]);
    cout<<res<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    int N, M; cin>>N>>M;

    vector<vector<ll>> dp(M+1, vector<ll>(1<<N, INF));
    dp[0][0] = 0;
    for(int i=0; i<M; i++){
        int a, b; cin>>a>>b;
        int mask = 0;
        REP(i, b){
            int c; cin>>c;
            c--;
            mask |= (1<<c);
        }
        for(int b=0; b<(1<<N); b++){
            if(dp[i][b]==INF) continue;
            dp[i+1][b] = min(dp[i+1][b], dp[i][b]);
            dp[i+1][b | mask] = min(dp[i+1][b | mask], dp[i][b] + a);
        }
    }
    if(dp[M][(1<<N)-1]==INF) cout << -1 << endl;
    else cout << dp[M][(1<<N)-1] << endl;
    return 0;
}

Measured memory_bytes: 32384
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

const int INF = 6e9;

int n, m;
int d[110][110];

void init(int n){
    rep(i, 0, n){
        rep(j, 0, n){
            d[i][j] = INF;
            if(i == j) d[i][j] = 0;
        }
    }
}

void warshall_floyd(){
    rep(k, 0, n){
        rep(i, 0, n){
            rep(j, 0, n){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

signed main(){
    cin >> n >> m;
    init(n);
    rep(i, 0, m){
        int a, b, c;
        cin >> a >> b >> c;
        d[a][b] = c;    
    }
    warshall_floyd();
    rep(i, 0, n){
        if(d[i][i] != 0){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    rep(i, 0, n){
        rep(j, 0, n){
            if(j != 0) cout << " ";
            if(d[i][j] >= 3e9) cout << "INF";
            else cout << d[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define ls i<<1
#define rs ls | 1
#define mid ((ll+rr)>>1)
#define pii pair<int,int>
#define MP make_pair
typedef long long LL;
const long long INF = 1e18+1LL;
const double pi = acos(-1.0);
const int N = 50+10, M = 1e3+20,inf = 2e9;

int main()
{
    int n;
    LL a,b,x,y;
    scanf("%d%lld%lld%lld%lld",&n,&a,&b,&x,&y);
    LL da=a,xiao=a;
    n--;
    while(n--){
        if(a<b){
            da+=y;
            xiao+=x;
            a=(da+xiao)/2;
        }
        else{
            da-=x;
            xiao-=y;
            a=(da+xiao)/2;
        }
        //printf("%lld %lld ***\n",xiao,da);
    }
    if(xiao<=b&&b<=da){
        printf("YES\n");
    }
    else printf("NO\n");
}


Measured memory_bytes: 256
N = int(input())
Dic = dict()
for i in range(N):
    A,B = map(int,input().split())
    if B not in Dic:
        Dic[B] = A
    else:
        Dic[B] += A
Deadlines = sorted(Dic)
Time = 0
for Deadline in Deadlines:
    if Time+Dic[Deadline] <= Deadline:
        Time += Dic[Deadline]
    else:
        Ans = 'No'
try:
    if Ans =='No':
        print(Ans)
except:
    print('Yes')


Measured memory_bytes: 34144
//https://blog.csdn.net/hesorchen
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define endl "\n"
#define lowbit(a) (a & (-a))
#define INF 0x3f3f3f3f
#define MAX 1010
#define mod 1000000007
#define PI 3.1415926

int p[100100];
int t[100010], ct = 1;
int f(int l, int r, int k)
{
    int res = -1;
    while (l <= r)
    {
        int mid = (l + r) >> 1;
        if (t[mid] >= k)
            l = mid + 1;
        else
        {
            res = mid;
            r = mid - 1;
        }
    }
    return res;
}
int main()
{
    // fill(t, t + 100000, -1);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> p[i];
    for (int i = 1; i <= n; i++)
    {
        int temp = f(1, ct - 1, p[i]);
        if (temp == -1)
        {
            // // t[ct++] = p[i];
            // for (int j = ct; j >= 2; j--)
            //     t[j] = t[j - 1];
            t[ct++] = p[i];
            // ct++;

            // sort(t + 1, t + ct);
        }
        else
            t[temp] = p[i];
    }
    cout << ct - 1 << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int n = stdIn.nextInt();
			if(n == 0)
			{
				break;
			}
			List<Integer> list = new ArrayList<Integer>();
			for(int i = 0; i < n; ++i)
			{
				int sum = 0;
				for(int j = 0; j < 5; ++j)
				{
					int a = stdIn.nextInt();
					sum += a;
				}
				list.add(sum);
			}
			Collections.sort(list);
			System.out.println(list.get(n - 1) + " " + list.get(0));
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

const ll MOD = 1000000007;
const ll INF = 10000000;

int n;

int main(void){
    int d, n;
    cin >> d >> n;

    if (d == 0){
        if (n != 100)cout << n << endl;
        else cout << n + 1 << endl;
    }
    else if (d == 1){
        if (n != 100) cout << n * 100 << endl;
        else cout << (n + 1) * 100 << endl;
    }
    else{
        if (n != 100) cout << n * 10000 << endl;
        else  cout << (n + 1) * 10000 << endl;
    }


}

Measured memory_bytes: 256
import math

num = list(map(int,input().split()))

a = num[0]
b = num[1]
h_rad = num[2]*30+0.5*num[3]
m_rad = num[3]*6
rad=0
if h_rad<m_rad:
    rad=m_rad-h_rad
else:
    rad=h_rad-m_rad

ans = math.sqrt(a*a + b*b - 2*a*b*math.cos(math.pi*rad/180))
print(ans)

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

#pragma GCC optimize("O3")
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define endl "\n"
#define gc getchar_unlocked
typedef long long ll;
typedef long double ld;
const double PI=acos(-1.0);
const int mod = 1000000007;




int main()
{
    FASTIO
	
	   int n;
	   cin>>n;
	   int a[2*n];
	   for(int i=0;i<2*n;i++)
	   cin>>a[i];
	   sort(a,a+2*n);
	   int sum=0;
	   for(int i=0;i<n;i++)
	   {
	       sum+=a[2*i];
	   }
	   cout<<sum<<endl;

	return 0;
}




Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
#define int long long
using ll = long long;
using namespace std;
const int INF = 1LL << 50;
using P       = pair<int, int>;

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

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} SETUP;

signed main() {
    int n;
    cin >> n;
    vector<int> vs(n);
    rep(i, 0, n) {
        cin >> vs[i];
    }
    vector<int> cs(n);
    rep(i, 0, n) {
        cin >> cs[i];
    }

    int ans = 0;
    for (int bit = 0; bit < pow(2, n); bit++) { // 全組み合わせは2^n (bit < (1 << N) と書くことも可能)
        int x = 0, y = 0;
        for (int j = 0; j < n; j++) {
            if ((1 & bit >> j) == 1) {
                x += vs[j];
                y += cs[j];
            }
        }

        chmax(ans, x - y);
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<stdio.h>

using namespace std;
int main() {
	char a[5];
	int t = 0;
	for (int i = 0; i < 4; i++) {
		scanf("%c", &a[i]);
		if (a[i] == '2')t++;
	}
	cout << t << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

int c[201];

int main()
{

    int n;
    while (cin >> n, n != 0) {
        memset(c, 0, sizeof(c));

        vector<int> t, h;

        for (int i = 0; i < n; ++i) {
            int a; cin >> a;
            c[a] = 1;
        }

        for (int i = 1; i <= n*2; ++i) {
            if (c[i]) {
                t.push_back(i);
            } else {
                h.push_back(i);
            }
        }

        sort(t.rbegin(), t.rend());
        sort(h.rbegin(), h.rend());

        int f = 1;
        int card = 0;

        while (!t.empty() && !h.empty()) {
            if (f) {
                int idx = t.size();
                while (idx--) {
                    if (card < t[idx]) {
                        card = t[idx];
                        t.erase(t.begin() + idx);
                        break;
                    }
                }
                if (idx == -1) card = 0;
                f = 0;
            } else {
                int idx = h.size();
                while (idx--) {
                    if (card < h[idx]) {
                        card = h[idx];
                        h.erase(h.begin() + idx);
                        break;
                    } 
                }
                if (idx == -1) card = 0;
                f = 1;
            }
        }

        printf("%d\n%d\n", h.size(), t.size());
    }
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}	
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
const int MAXN=110;
int n;
int a[MAXN];
int ans=0;
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i) cin>>a[i];
    for(int i=1;i<=n;++i)
    for(int j=i+1;j<=n;++j)
    for(int k=j+1;k<=n;++k)
    if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])
    if(a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[j]+a[k]>a[i]) ++ans;
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3648
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

/*--------switch header--------*/
#define ALGORITHM   1
#define CASSERT     1
#define CMATH       1
#define DEQUE       1
#define FUNCTIONAL  1
#define IOMANIP     1
#define IOSTREAM    1
#define LIST        1
#define MAP         1
#define QUEUE       1
#define SET         1
#define STRING      1
#define UTILITY     1
#define VECTOR      1
#define VEC_DEBUG   1

using namespace std;

#pragma region headers
#if VEC_DEBUG
#define _GLIBCXX_DEBUG
#endif
#if ALGORITHM
#include <algorithm>
#endif
#if CASSERT
#include <cassert>
#endif
#if CMATH
#include <cmath>
#endif
#if DEQUE
#include <deque>
#endif
#if FUNCTIONAL
#include <functional>
#endif
#if IOMANIP
#include <iomanip>
#endif
#if IOSTREAM
#include <iostream>
#endif
#if LIST
#include <list>
#endif
#if MAP
#include <map>
#endif
#if QUEUE
#include <queue>
#endif
#if SET
#include <set>
#endif
#if STRING
#include <string>
#endif
#if UTILITY
#include <utility>
#endif
#if VECTOR
#include <vector>
#endif
#pragma endregion


/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define ALL(x)          (x).begin(), (x).end()
#define rALL(x)         (x).rbegin(), (x).rend()
#define REP(i, n)       for(int i = 0; (i) < (n); (i)++)
#define rREP(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define FOR(i, a, b)    for(int i = (a); (i) < (b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n, h, w; cin >> n >> h >> w;
    if(h == n && w != n){
        cout << n-w+1 << endl;
        return 0;
    }
    if(w == n && h != n){
        cout << n-h+1 << endl;
        return 0;
    }
    if(h == n && w == n){
        cout << 1 << endl;
        return 0;
    }
    else cout << (n-h+1) * (n-w+1) << endl;
return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 10;

char s[N];

int main() {
#ifdef ACM_LOCAL
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#endif
    scanf("%s", s + 1);
    int n = strlen(s + 1), ans = 0, now = 0;
    for (int i = 1; i <= n; i++) {
        if (s[i] == 'R') {
            now++;
            ans = max(ans, now);
        }
        else now = 0;
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 3824
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 0;										/* デバッグプリント 提出時は0 */
int main()
{
	int		i,j,k,N;
	long long ans=0;
	int		h[10000],w[10000];

	N = 0;
	while(1) {
		scanf("%d %d", &h[N], &w[N]);
		if ((h[N]==0)&&(w[N]==0)) break;
		N++;
	}
	for(k=0;k<N;k++) {
		for(i=0;i<h[k];i++) {
			for(j=0;j<w[k];j++) {
				if ((i==0)||(i==h[k]-1)||(j==0)||(j==w[k]-1)) printf("#");
				else printf(".");
			}
			ENTER;
		}
		ENTER;
	}


	return 0;
}



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

int main(){

  int i,j,n,*r;
  int max,min;
  
  scanf("%d",&n);

  r=(int*)malloc(sizeof(int)*n);
  
  for(i = 0;i < n;i ++)
    {
      scanf("%d",&r[i]);
    }
  

  min = r[0];

  max = r[1]-r[0];

  for(i = 1;i < n;i ++)
    {
      if(max < r[i]-r[0])
	{
	  max = r[i] - r[0];
	}
    }
 
  for(i = 1;i < n-1;i ++)
    {
      if(r[i] < min)
	{
	  min = r[i];
	  for(j = i+1;j < n;j ++)
	    {
	      if(max < r[j]-r[i])max = r[j]-r[i];
	    }
	}
    }
 
  printf("%d\n",max);
  return 0;
}

Measured memory_bytes: 1380
// C++ implementation of the above approach
#include<bits/stdc++.h>
using namespace std;

void CountTriangles(int A[],int n){


    sort(A, A+n);


	int count = 0;

	for( int i = n-1; i >= 1; i--){
		int l = 0, r = i-1;
		while( l < r){
			if( A[l] + A[r] > A[i]){

				count += r - l ;

				r--;
			}
			else

				l++;
		}
	}
	cout<<count;
}
int main(){

        int n;
    cin>>n;
	int A[n];
	 for (int i = 0; i < n; i++)
        cin>>A[i];


	CountTriangles(A,n);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
int h, w, n;
map<int, indexed_set> crd;
set<pair<int, int>> cov;
long long cnt[10];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> h >> w >> n;
	for(int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		crd[a].insert(b);
	}
	for(auto &i : crd)
		for(auto &j : i.second)
			for(int k = i.first - 2; k <= i.first; k++)
				for(int l = j - 2; l <= j; l++)
					if(k > 0 && k < h - 1 && l > 0 && l < w - 1 && cov.find({k, l}) == cov.end()){
						int sum = 0;
						for(int m = k; m <= k + 2; m++)
							sum += crd[m].order_of_key(l + 3) - crd[m].order_of_key(l);
						cnt[sum]++;
						cov.insert({k, l});
					}
	long long sum = 0;
	for(int i = 1; i <= 9; i++) sum += cnt[i];
	cout << (long long)(h - 2) * (w - 2) - sum << "\n";
	for(int i = 1; i <= 9; i++) cout << cnt[i] << "\n";
	return 0;
}

Measured memory_bytes: 109568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_165_WeLoveGolf
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long n = long.Parse(Console.ReadLine());

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long A = inputLongArray[0];
            long B = inputLongArray[1];

            // 回答
            for (long i = A; i <= B; i++)
            {
                if (i % n == 0)
                {
                    Console.WriteLine("OK");
                    break;
                }else if (i == B)
                {
                    Console.WriteLine("NG");
                }
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27884
#include<stdio.h>
#ifdef DEBUG
#include<conio.h>
#endif // DEBUG

int main () {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif // DEBUG

    int a, b;
    scanf("%d %d", &a, &b);
    while (a != 0 || b != 0)
    {
        if(a > b)
            printf("%d %d\n", b, a);
        else
            printf("%d %d\n", a, b);
         scanf("%d %d", &a, &b);
    }

#ifdef DEBUG
    getch();
#endif // DEBUG
    return 0;
}




Measured memory_bytes: 2024
def main(n,m,sc):
    r = [-1]*n
    lst = get_unique_list(sc)
    for i in lst:
        x,y = i
        if r[x-1] == -1:
            r[x-1] = y
        elif r[x-1] != y:
            return "-1"
    if n != 1 and r[0] == 0:
        return "-1"
    elif r[0] == -1:
        res = "1" if n != 1 else "0"
    else:
        res = str(r[0])
    for i in range(1,len(r)):
        res = res + (str(r[i]) if r[i] != -1 else "0")
    return res

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
    
n,m = list(map(int, input().split()))
sc = [list(map(int, input().split())) for _ in range(m)]
print(main(n,m,sc))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  int r; cin >> r;
  cout << 3*r*r << endl;
  return 0;
}

Measured memory_bytes: 3556
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int x = fs.nextInt();
        System.out.println(n*x);
        
        
  }
  public static int calcMin(int[] array) {

    int intMin = array[0];

    for (int i = 1; i < array.length; i++ ) {
        if(intMin > array[i]) {
            intMin = array[i];
        }
    }
    return intMin;
}
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte(){
        if(ptr < buflen){
            return true;
        }else{
            ptr = 0;
            try{
                buflen = in.read(buffer);
            }catch(IOException e){
                e.printStackTrace();
            }
            if(buflen <=0){
                return false;
            }
        }
        return true;
    }

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

    private static boolean isPrintableChar(int c){
        return 33<=c && c<=126;
    }
    public boolean hasNext(){
        while(hasNextByte() && !isPrintableChar(buffer[ptr]))ptr++;
        return hasNextByte();
    }

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

    public long nextLong(){
        if(!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if(b == '-'){
            minus = true;
            b = readByte();
        }
        if(b < '0' || '9' < b){
            throw new NumberFormatException();
        }
        while(true){
            if('0' <= b && b<='9'){
                n*=10;
                n+=b-'0';
            }else if(b==-1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt(){
        long nl = nextLong();
        if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDoutble(){return Double.parseDouble(next());}
}


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

int main() {
    string s, t;
    cin >> s >> t;

    int ans = 0;
    for(int i = 0; i < 3; i++) {
        if(s[i] == t[i]) ans++;
    }

    cout << ans << endl;
    
    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  vector<ll> f(26);
  int n;
  string s;
  cin>>n>>s;
  rep(i,n) {
    f[s[i]-'a']++;
  }
  ll ans=1;
  const ll p=1e9+7;
  rep(i,26) {
    ans*=f[i]+1;
    ans%=p;
  }
  cout << (ans +(p-1))%p << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main (void){
    int a=0;
    long long ans=0;
    cin>>a;
    for(int i=1;i<=a;i++){
        if(i%3!=0&&i%5!=0)ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>  // ver1.8
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
#define PAI 3.14159265358979
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  int n,k;
  cin>>n>>k;
  cout << n%k<< endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <string>
using namespace std;

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

int main(){
    int n;
    cin >> n;
    for(int i=0; i < n; i++){
        string ans;
        string p, q;
        cin >> p >> q;
        if(p.size() < q.size()) swap(p, q);
        int diff = p.size()-q.size();
        for(int i=0; i < diff; i++){
            q = '0' + q;
        }
        p = '0' + p; q = '0' + q;
        int up = 0;
        for(int i=p.size()-1; 0 <= i || up != 0; i--){
            int m = atoi(p.substr(i,1).c_str()) + atoi(q.substr(i, 1).c_str());
            ans = IntToString((m+up)%10) + ans;
            up = (m+up)/10;
        }
        if(ans[0] == '0') ans = ans.substr(1, ans.size()-1);

        if(80 < ans.size()) cout << "overflow" << endl;
        else cout << ans << endl;
    }
}

Measured memory_bytes: 1240
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(a: int, b: int):
    N = b-a-1
    print(N*(N+1)//2 - a)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060