akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;

typedef long long ll;
ll s, n, cnt;
string a;
int main()
{
	ll i, t;
	cin >> a;
	for (i =0; i < a.size(); i++) {
		if (a[i] == 'A') {
			cnt++;
		} else if (a[i] == 'B') {
			if (a[i + 1] == 'C') {s += cnt; i++;}
			else cnt = 0;
		} else cnt = 0;
	}
	cout << s << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N; cin>>N;
	set<string> t;
	rep(i,N){
		string p; cin>>p;
		t.insert(p);
	}
	cout<<t.size()<<endl;
	return 0;
}

Measured memory_bytes: 19180
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n 		    = Integer.parseInt(scanner.nextLine());
		String[] temp   = scanner.nextLine().split(" ");
		int tmp         = 0;
		int count       = 0;
		int min         = Integer.parseInt(temp[0]);
		for(int i = 1; i < n ; i++) {

			tmp = Integer.parseInt(temp[i]);

			if(tmp == Math.min(min, tmp)) {

				count++;
				min = tmp;

			}		}

			System.out.println(count + 1);
	}
}

Measured memory_bytes: 62000
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        string S = Console.ReadLine();
        int[] ans = new int[S.Length];
        int right = 0, left = 0;
        //左からループ
        for (int i = 0; i < S.Length - 1; i++)
        {
            //人数カウント
            if (S[i] == 'R' && S[i + 1] == 'R') { ans[i] = 0; right++; }
            //Rで流れてきた分＋RLマスにもともといた人1人分
            if (S[i] == 'R' && S[i + 1] == 'L')
            {
                ans[i] = right / 2 + 1;
                ans[i + 1] = right / 2 + right % 2 + 1;
                right = 0;
            }
        }

        for (int i = S.Length - 1; i > 0; i--)
        {
            if (S[i - 1] == 'L' && S[i] == 'L') { ans[i] += 0; left++; }
            //Lで流れてきた分＋RLマスにもともといた人1人分
            if (S[i - 1] == 'R' && S[i] == 'L')
            {
                ans[i - 1] += left / 2 + left % 2;
                ans[i] += left / 2;
                left = 0;
            }
        }
        Console.WriteLine(string.Join(" ", ans));
    }
}

Measured memory_bytes: 15200
import sys

def solve():
    N, A, B = map(int, input().split())
    if (B - A) % 2 == 0: print((B - A) // 2)
    else:
        left = A + (B - A) // 2
        right = N - B + 1 + (B - A) // 2
        print(min(left, right))

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>


using namespace std;

int main(){
    int N,M,C;
    cin >> N >> M >> C;
    vector<int> B(M);
    vector<vector<int>> A(N,vector<int>(M));
    for (int i = 0; i < M; i++)
    {
        cin >> B[i];
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            cin >> A[i][j];
        }
        
    }

    int ans = 0;
    int tmp = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < M; j++)
        {
            tmp += A[i][j]*B[j];
        }
        
        if (0<tmp+C)
        {
            ans++;
            
        }
        tmp=0;
    }
    
    cout << ans << endl;

    
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define pi acos(-1)
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

lli n, K;
lli a[107];
lli cache[N];

lli dp(lli k) {

    if(k < a[1]) {
        return 0;
    }

    lli &ans = cache[k];

    if(ans != -1)
        return ans ;

    ans = 0;
    for(int i =  1;  i <= n; i ++) {
        if(k - a[i] < 0)
            break ;
        ans |= (dp(k - a[i]) == 0);
    }

    return ans;
}

void solve()
{

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

    memset(cache, -1, sizeof cache);

    lli ans = dp(K);
    if(ans == 1)
        cout<<"First";
    else
        cout<<"Second";

    cout<<'\n';
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
complex<double>sz,ez;
double mnx[55],mny[55],mxx[55],mxy[55],h[55];

typedef complex<double> pt;
typedef pair<pt,pt> L;
typedef vector<P> poly;
const double EPS = 1e-9;
#define x real()
#define y imag()

bool eq(double a,double b){
  return (-EPS < a-b && a-b < EPS);
}
double dot(pt a,pt b){
	return (conj(a)*b).x;
}
double cross(pt a,pt b){
	return (conj(a)*b).y;
}
int ccw(pt a,pt b,pt c){
	b -= a; c -= a;
	if(cross(b,c) > EPS) return 1; // counter clockwise
	if(cross(b,c) < -EPS) return -1; // clockwise
	if(dot(b,c) < -EPS) return 2; //c-a-b
	if(norm(b) < norm(c)) return -2; //a-b-c
	return 0; //a-c-b
}
//線分a-b とc の距離
double dist_lp(pt a,pt b,pt c){
	//senbun a-b to c no dist
	if(dot(a-b,c-b) <= 0.0) return abs(c-b);
	if(dot(b-a,c-a) <= 0.0) return abs(c-a);
	return abs(cross(b-a,c-a)) / abs(b-a);
}
//線分が交わる?
bool intersect(pt a,pt b,pt c,pt d){
	return (ccw(a,b,c)*ccw(a,b,d) <= 0 && ccw(c,d,a)*ccw(c,d,b) <= 0);
}
//線分a-b と 線分c-d の距離
double min_dist_ll(pt a,pt b,pt c,pt d){
	if(intersect(a,b,c,d) == true) return 0.0;
	double ret = 1e18;
	ret = min(ret,dist_lp(a,b,c));
	ret = min(ret,dist_lp(a,b,d));
	ret = min(ret,dist_lp(c,d,a));
	ret = min(ret,dist_lp(c,d,b));
	return ret;
}

int main(){
	while(1){
		scanf("%d",&n);
		if(n == 0) return 0;
		double sa,sb,ea,eb;
		scanf("%lf%lf%lf%lf",&sa,&sb,&ea,&eb);
		sz = complex<double>(sa,sb);
		ez = complex<double>(ea,eb);
		for(int i=0;i<n;i++){
			scanf("%lf%lf%lf%lf%lf",&mnx[i],&mny[i],&mxx[i],&mxy[i],&h[i]);
		}
		double lb = 0.0,ub = 100000.0;
		rep(i,114){
			double mid = (lb+ub)/2;
			rep(i,n){
				double mn = 1e18;
				mn = min(mn, min_dist_ll(sz,ez,pt(mnx[i],mny[i]),pt(mnx[i],mxy[i])));
				mn = min(mn, min_dist_ll(sz,ez,pt(mxx[i],mny[i]),pt(mxx[i],mxy[i])));
				mn = min(mn, min_dist_ll(sz,ez,pt(mxx[i],mny[i]),pt(mnx[i],mny[i])));
				mn = min(mn, min_dist_ll(sz,ez,pt(mxx[i],mxy[i]),pt(mnx[i],mxy[i])));
				if(mnx[i] <= sz.x && sz.x <= mxx[i] && mny[i] <= sz.y && sz.y <= mxy[i]) mn = 0.0;
				double r;
				if(mid <= h[i]){
					r = mid;
				}
				else{
					r = sqrt(mid*mid-(mid-h[i])*(mid-h[i]));
				}
				if(mn < r){
					goto fail;
				}
			}
			lb = mid; continue;
			fail:; ub = mid;
		}
		printf("%.12f\n",lb);
	}
}


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

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

#define x first
#define y second
#define pb push_back

using namespace std;

typedef long long ll;

const int MAXN = 110;

int N, A[MAXN];

int main(void) {
  ios_base::sync_with_stdio(false);
  cin >> N;
  REP(i, N) cin >> A[i];

  int ans = 1e9;
  FOR(fix, -100, 101) {
    int tmp = 0;
    REP(i, N) tmp += (fix - A[i]) * (fix - A[i]);
    ans = min(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
  vector<vector<int>> A(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  
  vector<vector<bool>> V(3,vector<bool>(3,false));
  for(int i=0;i<N;i++){
    int b;
    cin >> b;
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(A[j][k]==b) V[j][k] = true;
      }
    }
  }
  
  for(int i=0;i<3;i++){
    int cnt = 0;
    for(int j=0;j<3;j++){
      if(V[i][j]) cnt++;
    }
    if(cnt==3){
      cout << "Yes" << endl;
      return 0;
    }
  }
  for(int i=0;i<3;i++){
    int cnt = 0;
    for(int j=0;j<3;j++){
      if(V[j][i]) cnt++;
    }
    if(cnt==3){
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(V[0][0]&&V[1][1]&&V[2][2]){
    cout << "Yes" << endl;
    return 0;
  }
  if(V[0][2]&&V[1][1]&&V[2][0]){
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

template<typename T>
struct DiameterForVertex {
    vector<T> ws, dp;
    vector<vector<int>> g;
    DiameterForVertex(int n) : ws(n), dp(n), g(n) { }
    void add_edge(int u, int v) {
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }
    void dfs(int u, int p, int &s) {
        if (p < 0) dp[u] = T(0);
        dp[u] += ws[u];
        if (dp[s] < dp[u]) s = u;
        for (int v: g[u]) if (v != p) {
            dp[v] = dp[u];
            dfs(v, u, s);
        }
    }
    T build(vector<T> vs) {
        ws = vs;
        int s = 0;
        dfs(s, -1, s);
        dfs(s, -1, s);
        return dp[s];
    }
};

int main() {
    int n; cin >> n;
    DiameterForVertex<int> g(n);
    vector<int> deg(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b; cin >> a >> b; a--, b--;
        g.add_edge(a, b);
        deg[a]++, deg[b]++;
    }
    string s; cin >> s;
    int cnt_w = count(begin(s), end(s), 'W');
    if (cnt_w <= 1) return !(cout << cnt_w << endl);
    int ans = (n - 1) * 2;
    queue<int> que;
    vector<bool> alive(n, true);
    for (int u = 0; u < n; u++) {
        if (deg[u] == 1 && s[u] == 'B') {
            que.emplace(u);
            alive[u] = false;
        }
    }
    while (!que.empty()) {
        int u = que.front(); que.pop();
        ans -= 2;
        for (int v: g.g[u]) if (alive[v]) {
            deg[v]--;
            if (deg[v] == 1 && s[v] == 'B') {
                que.emplace(v);
                alive[v] = false;
            }
        }
    }
    vector<int> vs(n);
    for (int u = 0; u < n; u++) if (alive[u]) {
        vs[u] = deg[u] + (s[u] == 'W');
        vs[u] %= 2;
        ans += vs[u];
    }
    cout << ans - g.build(vs) * 2 << endl;
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr int MOD = 1000000007;

using namespace std;


signed main() {
  int N, p;
  string s;
  cin >> N;

  vector<tuple<string, int, int>> vec;
  REP(i, N){
    cin >> s >> p;
    vec.emplace_back(s, -p, i+1);
  }
  sort(vec.begin(), vec.end());

  REP(i, N) cout << get<2>(vec[i]) << endl;

  return 0;
}

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

class AIZU0026{
   public static int[,] Paper = new int[10,10];
   public static bool subsist(int x,int y) { return x>=0&&x<10&&y>=0&&y<10; }
   public static void Stain(int x,int y) { if (subsist(x,y)) Paper[x,y]++; }

   public static void Spot(int x,int y,int v) {
      Stain(x,y);
      int[,,] adja = {
       { { 1,0 },{ 0,1 },{ -1,0 },{ 0,-1 } },
       { { 1,1 },{ -1,1 },{ -1,-1 },{ 1,-1 } },
       { { 2,0 },{ 0,2 },{ -2,0 },{ 0,-2 } } };
      for (int j = 0; j<v; j++)
         for (int i = 0; i<4; i++)
            Stain(x+adja[j,i,0],y+adja[j,i,1]);
   }
   public static void Main(string[] args) {
      for (int i = 0; i<10; i++)
         for (int j = 0; j<10; j++)
            Paper[j,i]=0;

      string s;string[] ss=new string[0];
      Func<int,int> par = i => int.Parse(ss[i]);
      while (true) {
         s=Console.ReadLine();
         if (string.IsNullOrEmpty(s)) break;
         ss=s.Split(',');
         Spot(par(0),par(1),par(2));
      }
      List<int> H = new List<int>();
      foreach (int p in Paper) H.Add(p);
      int virgin = H.Count(i=>i==0);
      int max = H.Max();
      Console.WriteLine(virgin);
      Console.WriteLine(max);
   }
}

Measured memory_bytes: 9568
s=input()
n=len(s)
from collections import Counter
#print(s,n)
cc=Counter()
cc[0]+=1
num=0
tenpow=1
ans=0
for i in range(n-1,-1,-1):
    num=tenpow*(int(s[i]))+num
    num%=2019
    tenpow=10*tenpow
    tenpow%=2019
    ans+=cc[num]
    cc[num]+=1
print(ans)


Measured memory_bytes: 9480
S = io.read()
a, b, c, d = 0, 0, 0, 0

for i=1, #S do
    if i%2==0 then
        a = a + 1
        if S:sub(i,i)=="0" then
        b = b + 1
        end
    elseif i%2==1 then
        c = c + 1
        if S:sub(i,i)=="1" then
            d = d + 1
        end
    end
end
print(math.min(b+d, a+c-(b+d)))

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

int main()
{
    int N,Max=0,num=0;
    string s;

    cin>>N;

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

    for(int i=0; i<N; i++)
    {
        if(s[i]=='I')
            num++;
        else if(s[i]=='D')
            num--;

        if(num>Max)
            Max=num;
    }

    cout << Max << endl;

    return 0;
}


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

int main()
{
	int n;
	cin >> n;
	vector<long long> a(n);
	long long x = 0, y = 0;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		y += a[i];
	}
	long long  ans = 1e11;
	for (int i = 0; i < n-1; i++) {
		y -= a[i];
		x += a[i];
		ans = min(abs(x - y), ans);
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int x,y,z;
    cin >> x >> y >> z;
    swap(x,y);
    swap(x,z);
    cout << x << ' ' << y << ' ' << z << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#define bitpar __builtin_parity
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
	return powmod(a, MOD-2);
}
int main()
{
	int n, m; cin>>n>>m;
	int a[16];
	for(int i=0; i<m; i++) cin>>a[i];
	ll f[100000];
	f[0]=1;
	for(ll i=1; i<=(1ll<<n); i++) f[i]=f[i-1]*i%MOD;
	if(m==0){
		cout<<f[1<<n]<<endl;
		return 0;
	}
	ll invf[100000];
	invf[1<<n]=inv(f[1<<n]);
	for(ll i=(1ll<<n)-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
	ll dp[16][16][1<<16]={};
	for(int i=0; i<m; i++){
		for(int j=0; j<n; j++){
			int x=(1<<n)-a[i], y=(1<<j)-1;
			if(x>=y) dp[i][j][1<<j]=f[x]*invf[x-y]%MOD*(1ll<<j)%MOD;
		}
	}
	for(int i=m-2; i>=0; i--){
		for(int j=0; j<(1<<n); j++){
			for(int d=0; d<n; d++){
				if((j&(1<<d))==0) continue;
				dp[i][d][j]+=dp[i+1][d][j];
				dp[i][d][j]%=MOD;
				int j1=j^(1<<d);
				int x=(1<<n)-a[i]-j1, y=(1<<d)-1;
				if(x<y) continue;
				for(int e=0; e<n; e++){
					if((j1&(1<<e))==0) continue;
					dp[i][d][j]+=dp[i+1][e][j1]*f[x]%MOD*invf[x-y]%MOD*(1ll<<d)%MOD;
					dp[i][d][j]%=MOD;
				}
			}
		}
	}
	ll ans=f[1<<n];
	for(int j=0; j<n; j++){
		for(int k=0; k<(1<<n); k++){
			if((k&(1<<j))==0) continue;
			if(bitpar(k)){
				ans-=dp[0][j][k]*(1ll<<n)%MOD*f[(1<<n)-k-1]%MOD;
				ans=(ans+MOD)%MOD;
			}else{
				ans+=dp[0][j][k]*(1ll<<n)%MOD*f[(1<<n)-k-1]%MOD;
				ans%=MOD;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 132864
#include<cmath>
#include<cstdio>
#include<vector>

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

using namespace std;

const double EPS=1e-8;

template<class T>
struct point{
	T x,y;
	point operator+(const point &a)const{ return (point){x+a.x,y+a.y}; }
	point operator-(const point &a)const{ return (point){x-a.x,y-a.y}; }
};

template<class T>
point<T> operator*(T c,const point<T> &a){ return (point<T>){c*a.x,c*a.y}; }

template<class T>
T cross(const point<T> &a,const point<T> &b){ return a.x*b.y-a.y*b.x; }

template<class T>
struct line{ point<T> a,b; };

template<class T>
struct polygon:vector< point<T> >{
	polygon(){}
	polygon(int n):vector< point<T> >(n){}
};

template<class T>
T area2(const polygon<T> &G){
	int n=G.size();
	T a=0;
	rep(i,n) a+=cross(G[i],G[(i+1)%n]);
	return abs(a);
}

template<class T>
line<double> perp_bisector(const point<T> &a,const point<T> &b){
	return (line<double>){(point<double>){(a.x-a.y+b.x+b.y)/2.0,(a.y+a.x+b.y-b.x)/2.0},
						  (point<double>){(a.x+a.y+b.x-b.y)/2.0,(a.y-a.x+b.y+b.x)/2.0}};
}

enum {CCW=1,CW=-1,ON=0};
int ccw(const point<double> &a,const point<double> &b,const point<double> &c){
	double rdir=cross(b-a,c-a);
	if(rdir> EPS) return CCW;
	if(rdir<-EPS) return CW;
	return ON;
}

point<double> get_intersect(const line<double> &L1,const line<double> &L2){
	double a1=cross(L1.b-L1.a,L2.b-L2.a);
	double a2=cross(L1.b-L1.a,L1.b-L2.a);
	if(abs(a1)<EPS) return L1.a;
	return L2.a+a2/a1*(L2.b-L2.a);
}

template<class T>
polygon<double> convex_cut(const polygon<T> &G,const line<T> &L){
	int n=G.size();
	polygon<double> H;
	rep(i,n){
		int d1=ccw(L.a,L.b,G[i]);
		int d2=ccw(L.a,L.b,G[(i+1)%n]);
		if(d1!=CW) H.push_back(G[i]);
		if(d1==CCW && d2==CW || d1==CW && d2==CCW){
			H.push_back(get_intersect(L,(line<T>){G[i],G[(i+1)%n]}));
		}
	}
	return H;
}

int main(){
	for(int n,m;scanf("%d%d",&n,&m),n;){
		polygon<double> G(n);
		rep(i,n) scanf("%lf%lf",&G[i].x,&G[i].y);
		point<double> P[10];
		rep(i,m) scanf("%lf%lf",&P[i].x,&P[i].y);

		rep(i,m){
			polygon<double> Vor=G;
			rep(j,m) if(j!=i) Vor=convex_cut(Vor,perp_bisector(P[i],P[j]));
			printf("%.9f\n",area2(Vor)/2);
		}
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

  
public class Main {
	
	
  public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  
	  
	  
		  long a=Integer.parseInt(sc.next());
		  long  b=Integer.parseInt(sc.next());
		  long d=a/b;
		  long r=a%b;
		  double f=(double)a/(double)b;
		  System.out.print(d +" "+ r +" ");
		  System.out.printf("%.5f\n",f);
  }
}

Measured memory_bytes: 17336
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
long double sum, ssum;
ll a[(int)2e5+10], n;
long double t[((int)2e5+10) << 2];
void build(int v = 1, int tl = 1, int tr = n) {
	if(tl == tr) t[v] = (long double)(a[tl] * (a[tl] + 1) / 2) / (long double)a[tl];
	else {
		int tm = tl + tr >> 1;
		build(v << 1, tl, tm);
		build(v << 1 | 1, tm + 1, tr);
		t[v] = t[v << 1] + t[v << 1 | 1];
	}
}
long double get(int l, int r, int v = 1, int tl = 1, int tr = n) {
	if(l <= tl && tr <= r) return t[v];
	if(l > tr || r < tl) return 0.0;
	int tm = tl + tr >> 1;
	return get(l, r, v << 1, tl, tm) + get(l, r, v << 1 | 1, tm + 1, tr);
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	freopen("firesafe.in", "r", stdin);
//	freopen("firesafe.out", "w", stdout);
	int k;
	cin >> n >> k;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	build();
	long double ans = -1e18;
	for(int i = 1; i <= n; ++i) {
		if(i + k - 1 > n) break;
		ans = max(ans, get(i, i + k - 1));
	}
	cout << fixed << setprecision(15) << ans;
	return 0;
}

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

using namespace std;
vector<int> dsu;

int parent(int a){
    if(dsu[a] == a) return a;
    return dsu[a] = parent(dsu[a]);
}


void join(int a, int b){
    int pa = parent(a);
    int pb = parent(b);
    dsu[pa] = pb;
}

int main(){
    int n, m, a, b;
    scanf("%d %d", &n, &m);
    vector<int> p(n);
    dsu = vector<int>(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &p[i]);
        p[i]--;
    }

    for(int i = 0; i < n; i++) dsu[i] = i;
    for(int i = 0; i < m; i++){
        scanf("%d %d", &a, &b);
        --a; --b;
        join(a,b);
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += parent(p[i]) == parent(i); 
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a>b){
		printf("a > b\n");
	}
	else if(a==b){
		printf("a == b\n");
	}
	else{
		printf("a < b\n");
	}
	return 0;
}

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

int main(){
    
    ll A, B, C;
    cin >> A >> B >> C;
    for(ll i = 1; ;i++){
        if(A * i % B == C){
            cout << "YES" << endl;
            return 0;
        }
        if(i > 1 && (A * i % B == A % B))break;
    }

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

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007;

void main() {
    int n, m;
    scan(n, m);
    auto s = readln.split.to!(int[]);
    auto t = readln.split.to!(int[]);

    auto ans = solve(n, m, s, t);

    writeln(ans);
}


long solve(int n, int m, int[] s, int[] t) {
    auto dp = new long[][](n + 1, m + 1);
    foreach (i ; 0 .. n + 1) {
        dp[i][0] = 1;
    }
    foreach (j ; 0 .. m + 1) {
        dp[0][j] = 1;
    }

    foreach (i ; 1 .. n + 1) {
        foreach (j ; 1 .. m + 1) {
            (dp[i][j] += dp[i - 1][j]) %= mod;
            (dp[i][j] += dp[i][j - 1]) %= mod;

            if (s[i - 1] != t[j - 1]) {
                (dp[i][j] += mod - dp[i - 1][j - 1]) %= mod;
            }
        }
    }

    return dp[n][m];
}




















int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {
    writeln(b ? "Yes" : "No");
}

void YES(bool b) {
    writeln(b ? "YES" : "NO");
}

T[] readArr(T)() {
    return readln.split.to!(T[]);
}

T[] readArrByLines(T)(int n) {
    return iota(n).map!(i => readln.chomp.to!T).array;
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 33916
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
  int n, m, X, Y;
  cin >> n >> m >> X >> Y;
  vector<int> x(n+1);
  vector<int> y(m+1);
  x.at(0) = X;
  y.at(0) = Y;
  for(int i = 1; i <= n; ++i) {
    cin >> x.at(i);
  }
  for(int i = 1; i <= m; ++i) {
    cin >> y.at(i);
  }
  if(*max_element(x.begin(), x.end()) < *min_element(y.begin(), y.end())){
    cout << "No War" << endl;
  }
  else {
    cout << "War" << endl;
  }
}

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

using namespace std;

int main() {
    string s;
    cin >> s;
    int cnts[26];
    memset(cnts, 0, sizeof(cnts));

    for (int i = 0; i < s.size(); ++i) {
        cnts[s[i] - 'a']++;
    }
    for (int i = 0; i < 26; ++i) {
        if(cnts[i] == 0){
            cout << char('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 512
import java.io.ObjectInputStream.GetField;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int ans = solve();
		System.out.println(ans);
	}
	
	private static int solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<Integer, Integer> a = new HashMap<>();
		
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (a.containsKey(x)) {
				a.put(x, a.get(x) + 1);
			} else {
				a.put(x, 1);
			}
		}
		
		int max = 0;
		
		for (int i : a.keySet()) {
			int tmp = 0;
			tmp += a.containsKey(i - 1)? a.get(i - 1) : 0;
			tmp += a.get(i);
			tmp += a.containsKey(i + 1)? a.get(i + 1) : 0;
			max = Math.max(max, tmp);
		}
		
		return max;
	}
}

Measured memory_bytes: 61964
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  map<char,char> m,n;
  cin>>s>>t;
  for(int i=0;i<s.length();i++){
    if(!m[t[i]])m[t[i]]=s[i];
    else if(m[t[i]]!=s[i]){cout<<"No";return 0;}
    if(!n[s[i]])n[s[i]]=t[i];
    else if(n[s[i]]!=t[i]){cout<<"No";return 0;}
  }
  cout<<"Yes";
  return 0;
}


Measured memory_bytes: 776
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e5 + 10;
int a[maxn];
set<int> se;
map<int, vector<int>> tag;
map<int, int> sz;
ll res[maxn];
int n;
void solve() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        se.insert(a[i]);
        sz[a[i] ]++;
        tag[a[i] ].pb(i + 1);
    }
    while(se.size() > 1) {
        int t = *se.rbegin();
        se.erase(t);
        int nt = *se.rbegin();
        int mi = tag[t][0];
        for (int x : tag[t]) {
            mi = min(mi, x);
        }
        tag[nt].pb(mi);
        res[mi] += 1ll * (t - nt) * sz[t];
        sz[nt] += sz[t];
    }
    int t = *se.begin();
    int mi = tag[t][0];
    for (int x : tag[t]) mi = min(mi, x);
    res[mi] += 1ll * t * sz[t];
    for (int i = 1; i <= n; i++)
        cout << res[i] << endl;
}
int main() {
   // freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 22528
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Edge
{
public:
    int to, cost;
    Edge(){};
    Edge(int to0, int cost0){to = to0; cost = cost0;}
};

void shortestPath(const vector<vector<Edge> >& edges, int start, vector<int>& dist)
{
    dist.assign(edges.size(), INT_MAX);
    dist[start] = 0;
    priority_queue<pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > > q;
    q.push(make_pair(0, start));

    while(!q.empty()){
        pair<int, int> p = q.top();
        q.pop();
        int v = p.second;
        if(dist[v] < p.first)
            continue;
        for(unsigned i=0; i<edges[v].size(); ++i){
            Edge e = edges[v][i];
            if(dist[v] + e.cost < dist[e.to]){
                dist[e.to] = dist[v] + e.cost;
                q.push(make_pair(dist[e.to], e.to));
            }
        }
    }

    replace(dist.begin(), dist.end(), INT_MAX, -1);
}

void shortestPath(const vector<vector<Edge> >& edges, vector<vector<int> >& dist)
{
    dist.resize(edges.size());
    for(unsigned i=0; i<edges.size(); ++i)
        shortestPath(edges, i, dist[i]);
}

int main()
{
    for(;;){
        int n, m;
        cin >> n >> m;
        if(n == 0)
            return 0;

        vector<vector<Edge> > cost(m+1);
        vector<vector<Edge> > time(m+1);
        for(int i=0; i<n; ++i){
            int a, b, x, y;
            cin >> a >> b >> x >> y;
            cost[a].push_back(Edge(b, x));
            cost[b].push_back(Edge(a, x));
            time[a].push_back(Edge(b, y));
            time[b].push_back(Edge(a, y));
        }

        vector<vector<int> > minCost, minTime;
        shortestPath(cost, minCost);
        shortestPath(time, minTime);

        int k;
        cin >> k;
        for(int i=0; i<k; ++i){
            int p, q, r;
            cin >> p >> q >> r;
            if(r == 0)
                cout << minCost[p][q] << endl;
            else
                cout << minTime[p][q] << endl;
        }
    }
}

Measured memory_bytes: 1104
// abc.071 C - Make a Rectangle

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

int main( void ) {
    int n;
    cin >> n;
    vector<int> base( n );
    for( int i = 0; i < n; i++ ) {
        cin >> base.at( i );
    }

    //すべての棒を降順にソート
    sort( base.begin(), base.end(), greater<int>() );
/*    for( int i = 0; i < n; i++ ) cout << base.at( i ) << " ";
    cout << endl << endl;
*/
    int cnt = 0;
    long long h = 0, w = 0, ans;
    for( int i = 0; i < n; i++ ) {
        int temp = base.at( i );
        cnt      = 0;
        for( int j = i ; j < n; j++ ) {
            if( temp == base.at( j ) )
                cnt++;
            else
                break;
        }
        if( cnt >= 2 &&h == 0 ) {
            h = base.at( i );
            if( cnt >= 4 &&w == 0 ) {
                w = base.at( i );
                ans = h * w;
                cout << ans << endl;
                return 0;
            }
        }

        if( cnt >= 2 && w== 0 && h > base.at(i)) {
            w = base.at( i );
            ans = h * w;
            cout << ans << endl;
            return 0;
        }
    }
    ans = h * w;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC154E solver = new ABC154E();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC154E {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String N = in.next();
            int K = in.Int();

            int len = N.length();
            int[][][][] dp = new int[len][10][2][K + 1];
            int c0 = N.charAt(0) - '0';
            for (int i = 0; i <= c0; i++) {
                int k = i == 0 ? 0 : 1;
                int u = i < c0 ? 1 : 0;
                dp[0][i][u][k]++;
            }
            for (int i = 1; i < len; i++) {
                int b = N.charAt(i - 1) - '0';
                int c = N.charAt(i) - '0';
                // 上限
                for (int j = 0; j <= c; j++) {
                    int l = j == c ? 0 : 1;
                    int k = j == 0 ? 0 : 1;
                    for (int n = 0; n <= K; n++) {
                        if (n + k > K) continue;
                        dp[i][j][l][n + k] += dp[i - 1][b][0][n];
                    }
                }
                // 未満
                for (int j = 0; j < 10; j++) {
                    int k = j == 0 ? 0 : 1;
                    for (int n = 0; n <= K; n++) {
                        if (n + k > K) continue;
                        for (int l = 0; l < 10; l++) {
//                        dp[i][j][1][n + k] += dp[i - 1][l][0][n];
                            dp[i][j][1][n + k] += dp[i - 1][l][1][n];
                        }
                    }
                }
            }

            int ans = 0;
            for (int i = 0; i < 10; i++) {
                ans += dp[len - 1][i][0][K];
                ans += dp[len - 1][i][1][K];
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>

using namespace std;

int main ()
{
	string s;cin >> s;
	string res;
	for (char c : s)
	{
		if (c == '0') res+=c;
		if (c == '1') res+=c;
		if (c == 'B' && res.size() > 0) res.erase(res.size()-1);
	}
	cout << res;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int x[100];
    for( int i = 0; i < n; i++ )
    {
        cin >> x[i];
    }
    
    long long sum = 0;
    long long min = 50000000000000000;
    long long ans = 0;
    
    for( int z = 0; z <= 100; z++ )
    {
        sum = 0;
        for( int j = 0; j < n; j++ )
        {
            sum = sum + int(pow((x[j]-z),2));
        }

        if(sum < min)
        {
            min = sum;
        }
    }
    
    cout << min << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<utility>
#include<map>

/*
数字から先頭と末尾の辞書型を取る
ex. 129 -> (1, 9)
ex. 91 -> (9, 1)
これのペアの個数を調べ上げることで求める
ex. (1, 9) = 2個, (9, 1) = 1個ならば2 * 1 = 2個ある
*/

// <tail, head>
typedef std::pair<int, int> p;

p num2p(int x){
    int x_tail = x % 10;
    int x_head = 0;
    while(x){
        x_head = x;
        x = x / 10;
    }

    return p(x_tail, x_head);
}

int main(){
    int N;
    scanf("%d%*c", &N);
    std::map<p, int> frequency;
    for(int i = 1; i <= N; i++){
        p tailhead = num2p(i);
        frequency[tailhead]++; // 存在しないものが来た場合その型の初期値が出る ex. intなら0
    }

    int sum = 0;
    for(int i = 1; i <= N; i++){
        p tailhead = num2p(i);
        p q(tailhead.second, tailhead.first); // 先頭末尾の異なるもの
        sum += frequency[q];
    }

    printf("%d\n", sum);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

struct Card
{
    char type;
    int value;
    bool operator==(const Card &card) const; //メンバ変数の値を変えない
    bool operator<(const Card &card) const;
};

bool Card::operator==(const Card &card) const
{
    return card.type == type && card.value == value; //this->type
}

bool Card::operator<(const Card &card)const
{
    return value < card.value;
}

void print_card(vector<Card> &C)
{
    for (std::vector<int>::size_type i = 0; i < C.size() - 1; i++)
    {
        cout << C.at(i).type << C.at(i).value << ' ';
    }
    cout << C.back().type << C.back().value << endl;
}

void BubbleSort(vector<Card> &C)
{
    for (std::vector<int>::size_type i = 0; i < C.size(); i++)
    {
        for (std::vector<int>::size_type j = C.size() - 1; j > i; j--)
        {
            if (C.at(j).value < C.at(j - 1).value)
            {
                swap(C.at(j), C.at(j - 1));
            }
        }
    }
}
void SelectionSort(vector<Card> &C)
{
    for (std::vector<int>::size_type i = 0; i < C.size(); i++)
    {
        std::vector<int>::size_type minj = i;
        for (std::vector<int>::size_type j = i; j < C.size(); j++)
        {
            if (C.at(j)< C.at(minj))
            {
                minj = j;
            }
        }
        swap(C.at(i), C.at(minj));
    }
}
int main()
{
    int N;
    cin >> N;

    vector<Card> C(N);

    for (int i = 0; i < N; i++)
    {
        cin >> C.at(i).type >> C.at(i).value;
    }

    vector<Card> Cb(N), Cs(N);
    Cb = C;
    Cs = C;

    BubbleSort(Cb);
    SelectionSort(Cs);

    print_card(Cb);
    cout << "Stable" << endl;

    print_card(Cs);
    if (Cb == Cs)
    {
        cout << "Stable" << endl;
    }
    else
    {
        cout << "Not stable" << endl;
    }
}


Measured memory_bytes: 3148
import math
from collections import Counter

s = int(input())

def primes(n) :
    ps = [2]
    for i in range(3, n+1) :
        for p in ps :
            if i%p == 0 :
                break
        else :
            ps.append(i)
    return ps

def factorint(n) :
    ps = primes(n)
    l = []
    while n != 1 :
        for p in ps :
            if n%p == 0 :
                n //= p
                l.append(p)
                break
    return Counter(l)

a = math.ceil(math.sqrt(s))
print(0, 0, a, 1, a**2-s, a)

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

int main(){
    int ans=0,sum=0;

    int n;
    cin >>n;
    map<string,int> dic;

    for (int i = 0; i < n; i++){
        string op1,op2;
        cin >>op1>>op2;

        if(op1=="insert"){
            dic[op2]++;
        }else{

            if(dic.find(op2)!=dic.end()){
                cout << "yes" << '\n';
            }else{
                cout << "no" << '\n';
            }
        }
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout << ans << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}



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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>
#define Graph vector<vector<int>>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO = "No";

ll digit_sum(ll n) {
    ll res = 0;
    while (n > 0) {
        res += n % 10;
        n /= 10;
    }
    return res;
}

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

    ll ans = 0;

    for(ll i = 0; i < N.size(); i++){
        ll digit = stoll(N.substr(i,1));
        ans += digit;
        ans = ans % 9;
    }

    if (ans == 0) {
    cout << "Yes" << endl;
    }

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


Measured memory_bytes: 3736
import java.util.Scanner;

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

		Scanner input = new Scanner(System.in);

		String S = input.next();
		String T = input.next();

		input.close();

		if(S.length() + 1 == T.length() & T.startsWith(S)) {

			System.out.println("Yes");

		}else {

			System.out.println("No");

		}
	}
}


Measured memory_bytes: 35624
#include<stdio.h>
int N, K, H[100000], min, i, j;

int f;
char c;
int nextInt();
int med3(int x, int y, int z);
void quickSort(int a[], int left, int right);
void sort(int a[], int size);

int main(){
	N = nextInt();
	K = nextInt();
	for(i=0; i<N; i++){
		H[i] = nextInt();
	}
	sort(H, N);
	min = H[N-1] - H[1];
	for(i=K; i<=N; i++){
		j = H[i-1] - H[i-K];
		if(j<min){min=j;}
	}
	printf("%d\n", min);
}

int nextInt(){
	f=0;
	c = getchar();
	while((c<'0')||('9'<c)){
		c=getchar();
	}
	while((c>='0')&&(c<='9')){
		f=f*10+(c-'0');
		c=getchar();
	}
	return f;
}

int med3(int x, int y, int z){
	if(x < y){
		if (y < z){return y;}else if(z < x){return x;}else{return z;}
	} else {
		if (z < y){return y;}else if(x < z){return x;}else{return z;}
	}
}

void quickSort(int a[], int left, int right){
	if(left >= right){return;}
	int pivot = a[left+(right-left)/2];
	int l=left, r=right;
	while(1){
		while (a[l] < pivot){l++;}
		while (pivot < a[r]){r--;}
		if(l>=r){break;}
		int t=a[l]; a[l]=a[r]; a[r]=t;
		l++; r--;
	}
	quickSort(a, left, l-1);
	quickSort(a, r+1, right);
}

void sort(int a[], int size){
	quickSort(a, 0, size-1);
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define X first
#define Y second
typedef long long ll;
using namespace std;

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

int n;
string s;

int main () {

	cin >> n >> s;
	for (int i = 0; i < s.size(); i++) {
		int br = s[i]-'A';
		br += n;
		br %= 26;
		cout << (char)(br+'A');
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define int long long int
#define MOD 1000000007
#define pb push_back
#define cin1(n) (cin >> n)
#define cin2(a,b) (cin >> a >> b)
#define cin3(a,b,c) (cin >> a >> b >> c)
#define cout(n) (cout << n << endl)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define fr first 
#define sc second 
#define EPS (1e-10)

using namespace std;

typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef vector<pair<int,int>> vpii;
typedef vector<string> vs;
typedef vector<vector<string>> vss;
typedef pair<int,int> pii;

int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
int n,m;
int a,b;
int p,q;



signed main() {
	cin1(n);

	vector<int> num(100002,0);
	int max = 0;
	for (int i = 0; i < n; i++) {
		int a,b; cin2(a,b);
		num[a]++;
		num[b+1]--;
		if (max < b) max = b;
	}
	
	int sum = 0;
	int ans = 0;

	for (int i = 0; i <= max; i++) {
		sum += num[i];	
		if (sum + 1 >= i) ans = i - 1;
	}
	
	cout(ans);

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p.at(i);
  vector<double> a(n+1,0);
  rep(i,n){
    a.at(i+1)=a.at(i)+(p.at(i)+1)/2.0;
  }
  double ans = 0;
  for(int i=0;i+k<=n;i++){
    ans = max(ans,a.at(i+k)-a.at(i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
n=int(input())
p=list(map(int,input().split()))
ans=0

for i in range(1,n-1):
  if p[i]!=min(p[i-1],p[i],p[i+1]) and (p[i]<=p[i-1] or p[i]<=p[i+1]):
    ans+=1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

int main(){
    unordered_set<char> S;
    string s;
    cin >> s;
    for range(i,s.size()){
        S.insert(s[i]);
    }
    for range(moji,'a','z'+1){
        if (S.find(char(moji))==S.end()){
            cout << char(moji) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Set<String> set = new HashSet<String>();
        for(int i = 0; i < N; i++){
        	set.add(sc.next());
        }
        sc.close();
        System.out.println(set.size());
    }
}

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

typedef long long ll;

int main(){
    int n, m;
    cin >> n >> m;
    map<ll, ll> ab;
    
    for(int i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        if(ab.count(a)==1){
            ab[a]+=b;
        }
        else ab.insert(make_pair(a, b));
    }
    
    
    ll cnt=0, ans=0;
    for(auto i = ab.begin(); i != ab.end(); i++)
    {
        ll x = i->first, y = i->second;
        cnt+=y;
        ans += x*y;
        if(cnt==m) break;
        else if(cnt>m){
            ans-= x*(cnt-m);
            break;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6528