akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int n,a1,a2,ans;
char s[200005];
int a[200005],d,v;
int fa[200005];
int di[200005],fac;

int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	n*=2;
	d=0;
	for(int i=1;i<=n;i++){
		if(s[i]=='W'){if(d==1) a[i]=1;else a[i]=0;}
		else{if(d==0) a[i]=1;else a[i]=0;}
		d^=a[i];
	}
	if(a[1]==0){
		printf("0\n");
		return 0;
	}
	fa[1]=1;
	for(int i=2;i<=n;i++){
		if(a[i]==0){
			if(fa[i-1]==2) fa[i]=1;
			else fa[i]=2;
		}
		else fa[i]=fa[i-1];
	}
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(fa[i]==1) a1++,di[++cnt]=n/2-a2;
		else a2++;
	}
	if(a1!=n/2){
		printf("0\n");
		return 0;
	}
	ans=1;
	sort(di+1,di+n/2+1);
	for(int i=1;i<=n/2;i++){
		if(di[i]<i){
			printf("0\n");
			return 0;
		}
		ans=1ll*ans*(di[i]-(i-1))%mod;
	}
	fac=1;
	for(int i=1;i<=n/2;i++) fac=1ll*fac*i%mod;
	printf("%d\n",1ll*ans*fac%mod);
	
	return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var A = input[0];
            var B = input[1];
            var sum = Math.Abs(A) + Math.Abs(B);
            if (sum % 2 != 0)
            {
                Console.WriteLine("IMPOSSIBLE");
                return;
            }

            Console.WriteLine(sum / 2);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
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;}

int main() {
    string S; cin >> S;
    int N = S.length();
    int gs = 0, ps = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'p') ps++;
        else gs++;
    }
    cout << (gs-ps)/2 << endl;
}


Measured memory_bytes: 512
import sys


def main():
    input = sys.stdin.buffer.readline
    n, m = map(int, input().split())
    demand = [tuple(map(int, input().split())) for _ in range(m)]
    demand.sort(key=lambda x: x[1])
    prev_cut = 0
    ans = 0
    for a, b in demand:
        if prev_cut < a:
            ans += 1
            prev_cut = b - 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 23932
#include <iostream>

using namespace std;

int main() {
	int H, W;
	
	while (cin >> H >> W && H || W) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				cout << "#";
			}
			cout << endl;		
		}
		cout << endl;
	}
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
int main (){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(c<a){
        swap(a,c);
        swap(b,d);
    }


    if(b<c){
        cout << 0 <<endl;
    }
    else{
        cout << min(b,d)-max(a,c) << endl;//重なりがある場合
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    long a,b,c,d;
    scanf("%ld %ld %ld %ld", &a, &b, &c, &d);
    long nAns = a*c;
    nAns = max(nAns, a*d);
    nAns = max(nAns, b*c);
    nAns = max(nAns, b*d);
    printf("%ld", nAns);
    
    return 0;
}


Measured memory_bytes: 3232
#include <stdio.h>
#include <math.h>
#include <iostream>

using namespace std;


long long solv(int N, int K) {
	long long count = 0;
	for(int b=K+1; b<= N; b++) { 
		// b = 1
		int d = N/ b;
		int range = (b - K);
		count += d * range;

		int last = d * b;
		int last_add = N - last - K + 1;
		if(K == 0)
			last_add--;
//		printf("%d %d %d %d %d %d\n", b, d, range, d*range, last, last_add);


		if (0 < last_add){
			count += last_add;

		}

	}

	return count;
}


int main(void) {
//	printf("7 = %d\n", solv(5, 2));
//	printf("100 = %d\n", solv(10, 0));
//	printf("287927211 = %d\n", solv(31415,9265));
//	return 0;

    int X;
    std::cin >> X;
    int Y;
    std::cin >> Y;

	cout << solv(X, Y) << endl;
	
    return 0;
}




Measured memory_bytes: 256
N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
res = 0
for i, a in enumerate(A):
    x -= a
    if x >= 0:
        res += 1
    else:
        break
else:
    if x > 0:
        res -= 1
print(res)



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

int main(){
	int A, B, C, D, S, T;
	cin >> A >> B >> C >> D;
	S = A * B;
	T = C * D;
	if(S >= T){
		cout << S;
	}
	else{
		cout << T;
	}
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,n,h,m,x,y;
	string	s;
	cin >> a >> b >> h >> m;
	double hh,mm,deg,ans;

	hh = (h*60+m) / 2.0;
	mm = m*6;

	deg = abs(hh-mm);
	if (deg > 180) deg = 360 - deg;
	//printf("%f\n",deg);

	deg = deg * (M_PI/180);
	//printf("%f\n",deg);
	ans = sqrt( a*a + b*b - 2*a*b*cos(deg));

	//vector<ll>	aa(n);
	//for(i=0;i<n;i++) cin >> aa[i];
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));
	printf("%.10f\n",ans);
	//cout << ans << endl;
	return 0;
}


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

#define rb(a,b,c) for(int a=b;a<=c;++a)
int ap[1000000+20],n,a[200000+20];
int main(){

    cin>>n;
    rb(i,1,n) {
        cin>>a[i];

    }
    sort(a+1,a+1+n);
    rb(i,1,n){
        if(a[i]==a[i-1]){
            ap[a[i]]=1;
        }
    }
    int res=0;
    rb(i,1,n){
        if(!ap[a[i]])
            res++;
        if(a[i]!=a[i-1]){
            for(int j=2*a[i];j<=1000000;j+=a[i]){
                ap[j]=1;
            }
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 8280
#include<iostream>
#include<map>
using namespace std;
int main() {
	int N, M;
	cin >> N >> M;
	map<int, int>mp;
	for (int i = 0;i < N;++i) {
		int a;
		cin >> a;
		while (a) {
			--a;
			int b;
			cin >> b;
			++mp[b];
			
		}
	}
	int ans = 0;
	for (auto p : mp) {
		int c = p.second;
		if (c == N) {
			++ans;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n;
    cin >> n;
    bool flag = true;
    for(int i = 0;i < n;i++)
    {
        int a;
        cin >> a;
        if(a % 2 == 0)
        {
            if(a % 3 != 0 && a % 5 != 0)
            {
                flag = false;
            }
        }
    }
    if(flag)
    {
        cout << "APPROVED\n";
    }
    else
    {
        cout << "DENIED\n";
    }
    
    return 0;
}

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

#define ll long long int
#define ff(i,a,b) for(ll i = a; i < b; i++)
#define bf(i,b,a) for(ll i = b-1; i >= a; i--)
#define itf(i,a) for(auto i = a.begin(); i != a.end(); i++)
#define itfr(i,a) for(auto i = a.rbegin(); i != a.rend(); i++)
#define MII map<ll,ll> 
#define MCI map<char,ll>
#define MSI map<string,ll>
#define VI vector<ll> 
#define VC vector<char> 
#define VS vector<string> 
#define MP make_pair
#define tc ll t; cin>>t; while(t--)
#define DISPV(v) itf(i,v) cout << *i << ' ';
#define DISPM(m) itf(i,m) cout << i->first << ' ' << i->second << endl;

const int MOD = int(1e9) + 7;

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    char c;
    cin >> c;
    if(c >= 'a' && c <= 'z')
        cout << "a\n";
    else
    {
        cout << "A\n";
    }
    
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll A,B,C,K;
	cin>>A>>B>>C>>K;
	if(K%2==0){
		cout<<A-B<<endl;
	}
	else{
		cout<<B-A<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
int32_t main()
{
   IOS;
	ll n,cnt=0,i,t,d;
	cin>>n;
	ll a[n];
	for(i=0;i<n;i++)
    {
        cin>>a[i];
    }

    for(i=1;i<n-1;i++)
    {

      if(((a[i]<a[(i-1)]&&a[i]>a[(i+1)]))||(a[i]>a[(i-1)]&&a[i]<a[(i+1)]))
      {
          cnt++;
      }

    }
cout<<cnt;


        return 0;
}



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

struct edge{ int to,cost ;};
vector<edge> G[100000];

typedef pair<int,int> p;
typedef pair<p,int> toshi;

vector<toshi> cityx(100000);
vector<toshi> cityy(100000);

int N;

//vector<ll> mincost(100000);
vector<bool> used(100000);
ll INF=1000000000000;

typedef pair<ll,int> lp;
priority_queue<lp,vector<lp>,greater<lp> > mincost;

ll prim(){
  for(int i=0;i<N;i++){
    //mincost[i]=INF;
    used[i]=false;
  }
  lp c_0(0,0);
  mincost.push(c_0);
  //mincost[0]=0;
  ll res=0;
  while(true){
    //int v=-1;
    if(mincost.size()==0) break;
    lp v_ = mincost.top();
    mincost.pop();
    bool fin=false;
    while(used[v_.second]){
      v_=mincost.top();
      mincost.pop();
      if(mincost.size()==0) {fin=true;break;}
    }
    if(fin){
      break;
    }
    /*
    for(int u=0;u<N;u++){
      if(!used[u] && (v==-1 || mincost[u]<mincost[v])) v=u;
    }
    if(v==-1) break;
    */
   
    used[v_.second]=true;
    res+=v_.first;
    vector<edge> edges = G[v_.second];
    for(auto e:edges){
      int u = e.to;
      int c = e.cost;
      lp ee(e.cost,e.to);
      mincost.push(ee);
      //mincost[u]=min(mincost[u],(ll)c);
    }
  }
  return res;
}

int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    int x,y;
    cin >> x >> y;
    p xy(x,y);
    p yx(y,x);
    toshi toshix(xy,i);
    toshi toshiy(yx,i);
    cityx.at(i)=toshix;
    cityy.at(i)=toshiy;
  }
  sort(cityx.begin(),cityx.begin()+N);
  sort(cityy.begin(),cityy.begin()+N);
  for(int i=0;i<N-1;i++){
    toshi a=cityx.at(i);
    toshi b=cityx.at(i+1);
    p zahyou1=a.first;
    p zahyou2=b.first;
    int city_num1=a.second;
    int city_num2=b.second;
    int sub_x=abs(zahyou1.first-zahyou2.first);
    int sub_y=abs(zahyou1.second-zahyou2.second);
    int co = min(sub_x,sub_y);
    edge e={city_num2,co};
    edge e2={city_num1,co};
    G[city_num1].push_back(e);
    G[city_num2].push_back(e2);
  }
  for(int i=0;i<N-1;i++){
    toshi a=cityy.at(i);
    toshi b=cityy.at(i+1);
    p zahyou1=a.first;
    p zahyou2=b.first;
    int city_num1=a.second;
    int city_num2=b.second;
    int sub_x=abs(zahyou1.first-zahyou2.first);
    int sub_y=abs(zahyou1.second-zahyou2.second);
    int co = min(sub_x,sub_y);
    edge e={city_num2,co};
    edge e2={city_num1,co};
    G[city_num1].push_back(e);
    G[city_num2].push_back(e2);
  }
  ll res = prim();
  cout << res << endl;
}

Measured memory_bytes: 16752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,m;
  string s,t;
  cin >> n >> m >> s >> t;
  ll l=n*m/__gcd(n,m);
  for(ll i=0;i<n;i++) {
    if(i*m%n==0&&s[i]!=t[i*m/n]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << l << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 998244353
#define rep(i,n) for(int i=0;i<(int)(n);++i)

vector<string> s;
int h,w;
bool ok;

bool check(vector<pair<int,int> > &v){
    // for(auto x:v){
    //     cerr << x.first <<" " << x.second << endl;
    // }
    vector<bool>flag(w);
    rep(i,w){
        rep(j,w){
            if(i==j||flag[i]||flag[j])continue;
            bool ook = 1;
            for(auto x:v){
                int a = x.first;
                int b = x.second;
                if(s[a][i]!=s[b][j])ook = false;
                if(s[a][j]!=s[b][i])ook = false;
            }
            if(ook){
                flag[i]= true;
                flag[j]= true;
            }
        }
    }
    int cc = 0;
    int id = 0;
    rep(i,w){
        if(!flag[i]){
            cc++;
            id = i;
        }
    }
    if(cc>=2){
        return false;
    }
    bool ook = 1;
    if(cc==1){
        for(auto x:v){
            int a = x.first;
            int b = x.second;
            if(s[a][id]!=s[b][id])ook = false;
            
        }
    }
    return ook;
}

void dfs(int id,int cnt,vector<bool>&flag,vector<pair<int,int> > &v){
    if(cnt==0){
        if(check(v)){
            ok = true;
        }
    }else if(cnt==1){
        v.push_back(MP(id,id));
        if(check(v)){
            ok = true;
        }
        v.pop_back();
    }else{
        for(int i=id+1;i<h;i++){
            if(flag[i])continue;
            flag[i] = true;
            v.push_back(MP(id,i));
            flag[id] = true;
            int iid = id;
            if(cnt==2){
                dfs(id,0,flag,v);
            }else{
                while(flag[id]){
                    id++;
                }
                dfs(id,cnt-2,flag,v);
            }
            v.pop_back();
            flag[i]=false;
            flag[id] = false;
            id = iid;
        }
        if(cnt%2==1){
            v.push_back(MP(id,id));
            flag[id] = true;
            int iid = id;

            while(flag[id]){
                id++;
            }
            dfs(id,cnt-1,flag,v);
            v.pop_back();
            flag[id] = false;
            id = iid;
        }
    }
}

int main(){
    cin >> h >> w;
    s.resize(h);
    rep(i,h)cin >> s[i];
    vector<pair<int,int> > v;
    vector<bool>flag(h);
    dfs(0,h,flag,v);
    if(ok){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main()
{
	int A[10000];
	
	int a = 1;
	
	for (int i = 0; a != 0; i++) 
	{
		cin >> a;
		A[i] = a;
	}
	
	for (int i = 0; A[i] != 0; i++){
		cout << "Case " << i + 1 << ": " << A[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3144
# 数値→アルファベット
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)


N=int(input())
print(num2alpha(N).lower())

Measured memory_bytes: 9168
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  vector<int> m(s.size()-2);
  for(int i=0;i<s.size()-2;i++){
    int a=(s[i]-'0')*100+(s[i+1]-'0')*10+s[i+2]-'0';
    int b=abs(a-753);
    m[i]=min(1000,b);
  }
  sort(m.begin(),m.end());
  cout<<m[0]<<endl;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    vector<char> R,B;
    int ans = 0;

    // 0:red, 1:blue
    rep (i, S.size()) {
      if (S[i] == '0') {
        if (B.size() > 0) {
          B.pop_back();
          ans++;
        }
        else
          R.push_back('0');
      }
      else if (S[i] = '1') {
        if (R.size() > 0) {
          R.pop_back();
          ans++;
        }
        else
          B.push_back('1');
      }
    }

    cout << ans * 2 << endl;

}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
map<string,int>p; 
string s;
int main(){
cin>>s;
p["SUN"]=7;
p["MON"]=6;
p["TUE"]=5;
p["WED"]=4;
p["THU"]=3;
p["FRI"]=2;
p["SAT"]=1;
cout<<p[s];
return 0;
}


Measured memory_bytes: 256
while True:
    li = input().split(' ')
    if li[1] == '?':
        break;
    elif li[1] == '+':
        print(int(li[0])+int(li[2]))
    elif li[1] == '-':
        print(int(li[0])-int(li[2]))
    elif li[1] == '*':
        print(int(li[0])*int(li[2]))
    elif li[1] == '/':
        print(int(li[0])//int(li[2]))


Measured memory_bytes: 5600
n, m = map(int,input().split())
s = []
c = []
for i in range(m):
    ss, cc = map(int,input().split())
    s.append(ss)
    c.append(cc)
for i in range(10**(n-1) if n != 1 else 0, 10**n):
    ans = str(i)
    for j in range(m):
        if ans[s[j]-1] != str(c[j]):
            break
    else:
        print(ans)
        exit()
else:
    print(-1)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main() {
    int a;
    int b;
    cin >> a >> b;
    if (a != b) {
        if (a > b) {
            cout << "a > b" << endl;
        } else {
            cout << "a < b" << endl;
        }
    }else {
        cout << "a == b" << endl;
    }
return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define pii pair<int, int>;
#define ss second
#define ff first
#define all(x) ((x).begin(), (x).end())

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;
const ll oo = 1 << 31;

vector<int> adj[10];
int n, m;

int dfs(int v, string path){
    path += to_string(v);
    if (path.size() == n) return 1;
    int ans = 0;

    for (auto x: adj[v]){
        if (path.find(to_string(x)) == string::npos){
            ans += dfs(x, path);
        }
    }
    return ans;
}


int main(){
    ios_base::sync_with_stdio(false);
    cin >> n >> m;

    for (int i=0; i<m; i++){
        int a, b;
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    cout << dfs(1, "") << endl;
    return 0;
}

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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var first = false;
            for (int i = 0; i < N; i++)
            {
                var a = ReadInt();
                if (a % 2 != 0) first = true;
            }

            Console.WriteLine(first ? "first" : "second");
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 15184
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long h=sc.nextLong();
        HashMap<Long,Long> map=new HashMap<>();
        long res = dfs(h,map);
        System.out.println(res);
    }

    public static long dfs(long h,HashMap<Long,Long> map)
    {
        long ans=1;
        if(h<=1)return ans;
        if(map.get(h)!=null)return map.get(h);
        long cur=dfs(h/2,map);
        ans+=2*cur;
        map.put(h,ans);
        return ans;
    }
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;

int main()
{
    int n, k;
    ll sum = 0;
    cin >> n >> k;
    vector <int> a(n, 0);
    for (int i  = 0; i < n; i++) {
        cin >> a[i];
    }
    //cout << sum << endl;
    sort(a.begin(), a.end());
    for (int i = 0; i < max(n-k, 0); i++) {
        sum += a[i];
    }
    cout << sum << endl;


    return 0;
}



Measured memory_bytes: 1024
// 2020-09-28 21:40:09
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
// using namespace atcoder;

// clang-format on
void answer() {
  string s;
  cin >> s;
  int n = s.size();
  s = "$" + s;
  bool ok = true;
  ok &= s[1] == '1';
  ok &= s[n] == '0';
  REPC(i, 1, n - 1) ok &= (s[i] == s[n - i]);
  if (!ok) {
    cout << -1 << '\n';
    return;
  }
  queue<int> que;
  REPC(i, 1, n - 1) if (s[i] == '1') que.push(i);
  que.push(n);
  REPC(i, 1, n - 1) {
    if (i == que.front()) que.pop();
    cout << i << ' ' << que.front() << '\n';
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3880
#include<bits/stdc++.h>
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 a[3][3];
  rep(i, 3) cin >> a[i][0] >> a[i][1] >> a[i][2];
  
  int n;
  cin >> n;

  vector<int> b(n);
  rep(i, n) cin >> b[i]; 
  
  rep(i, n){
    rep(l, 3){
      rep(m, 3){
        if(b[i]==a[l][m]) a[l][m]=0;
      }
    }
  }
  
  string ans="No";
  rep(i, 3){
    if(a[i][0]==0 && a[i][1]==0 && a[i][2]==0) ans="Yes";
    if(a[0][i]==0 && a[1][i]==0 && a[2][i]==0) ans="Yes";
  } 
  if(a[1][1]==0){
    if(a[2][0]==0 && a[2][0]==0) ans="Yes";
    if(a[0][0]==0 && a[2][2]==0) ans="Yes";
  }
  
  
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define ll long long int
#define pb push_back

int L[3009][3009];  

ll lcs(string,string,ll,ll);
void lcs_print(string,string,ll,ll,ll);

int main() 
{
    string s,t;
    ll i,j,m,n,l;
    getline(cin,s);
    getline(cin,t);
    m=s.length();
    n=t.length();
    l=lcs(s,t,m,n);
    lcs_print(s,t,m,n,l);
    return 0;
}

ll lcs(string X,string Y,ll m,ll n)
{
    
    ll i, j;  
      

    for (i = 0; i <= m; i++)  
    {  
        for (j = 0; j <= n; j++)  
        {  
        if (i == 0 || j == 0)  
            L[i][j] = 0;  
      
        else if (X[i - 1] == Y[j - 1])  
            L[i][j] = L[i - 1][j - 1] + 1;  
      
        else
            L[i][j] = max(L[i - 1][j], L[i][j - 1]);  
        }  
    }  
          

    return L[m][n];  
}

void lcs_print(string s,string t,ll m,ll n,ll l)
{
    ll i,j,k;
    char a[l+2];
    a[l]='\0';
    i=m;
    j=n;
    k=l;
    while(1)
    {
        if(k==0 || i==0 || j==0)
            break;
        else if(s[i-1]==t[j-1])
        {
            a[k-1]=s[i-1];
            i--;
            j--;
            k--;
        }
        else
        {
            if(L[i][j-1]>L[i-1][j])
                j--;
            else
                i--;
        }
    }
    for(i=0;i<l;i++)
        cout<<a[i];
    cout<<endl;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  cin >> n >> k;
  vector<long int> h(n);
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  long int sum = 0;
  if(n <= k){
    cout << 0 << endl;
  }
  else{
    for(int i = 0; i < n-k; i++){
      sum+=h[i];
    }
    cout << sum << endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<ld> vld;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); ++i)
#define ALL(v) (v).begin(), (v).end()
#define endl "\n"

ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "YES" << endl;}
void no(){ cout << "NO" << endl;}

//-----------------------------------------

//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);


  ll a, b, c;
  cin >> a >> b >> c;

  cout << (b + min(c, a + b + 1)) << endl;


  return 0;
}



Measured memory_bytes: 3584
#include<bits/stdc++.h>
#include<algorithm>
#include <assert.h>
using namespace std;
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define ll long long 
#define sum(a,b) a=a+b
#define repn(a,b,c) for(int a = b ; a>=c ; a--)
#define mem(a,b) memset(a,b,sizeof(a))

string s;
ll d;
int mod = 1e9 + 7;
ll memo[10001][101][2];

ll dp(ll pos ,ll sum , bool limit){

	if(pos >= s.size()){
		return sum == 0;
	}


	if(memo[pos][sum][limit]!=-1){
		return memo[pos][sum][limit];
	}

	ll num = (int)s[pos]-'0';

	if(limit == true){
		num = 9;
	}

	ll ans = 0;

	rep(i,0,num){
		if(i == (s[pos]-'0')){
			ans = ans + dp(pos+1,(sum + i)% d ,limit);
		}else{
			ans = ans + dp(pos+1,(sum+i)%d , true);
			
		}

		ans=ans%mod;
	}


	return memo[pos][sum][limit] = ans;

}


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

	mem(memo,-1);

	cin>>s>>d;

	ll ans = dp(0,0,0) % mod;
	ans -= 1;
	if(ans < 0) ans += mod;
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 17024
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 
ll x[100010], v[100010];
ll sumR[100010];
ll sumL[100010];
ll maxL[100010];
ll maxR[100010];
int main() {
  // 095d
  ll n; ll c; cin >> n >> c;
  // vll x(n+4), v(n+4);
  rep(i,n) cin >> x[i+1] >> v[i+1];
  x[n+1] = c; 
  v[n+1] = 0;
  x[0] = v[0] = 0;
  // vll maxR(n+4), maxL(n+4), sumR(n+4), sumL(n+4);
  rep(i, n+1) {
    sumR[i+1] = sumR[i] + v[i+1]-(x[i+1]-x[i]);
    maxR[i+1] = max(maxR[i], sumR[i+1]);
  }
  for (int i=n; i>=0; i--) {
    sumL[i] = sumL[i+1] + v[i]-(x[i+1]-x[i]);
    maxL[i] = max(maxL[i+1], sumL[i]);
  }
  ll ans = 0;
  for (int i=n+1; i>=0; i--) {
    ll cal = sumL[i] - (c-x[i]);
    cal += maxR[i-1];
    chmax(ans, cal);
  }
  rep(i, n+1) {
    ll cal = sumR[i] - x[i];
    cal += maxL[i+1];
    chmax(ans, cal);
  } 
  // ll ans =0;
  // for (int i = 0; i <= n; i++) {
	// 	sumR[i + 1] = sumR[i] + v[i + 1] - (x[i + 1] - x[i]);
	// 	maxR[i + 1] = max(maxR[i], sumR[i + 1]);
	// }
	// for (int i = n; i >= 0; i--) {
	// 	sumL[i] = sumL[i + 1] + v[i] - (x[i + 1] - x[i]);
	// 	maxL[i] = max(maxL[i + 1], sumL[i]);
	// }
	// for (int i = n + 1; i >= 0; i--) {
	// 	ll kcal = sumL[i] - (c - x[i]);
	// 	kcal += maxR[i - 1];
	// 	ans = max(ans, kcal);
	// 	//cout << ans << endl;
	// }
	// for (int i = 0; i <= n; i++) {
	// 	ll kcal = sumR[i] - x[i];
	// 	kcal += maxL[i + 1];
	// 	ans = max(ans, kcal);
	// 	//cout << ans << endl;
	// }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 8452
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  double ans_m, ans_s, mx = -1;
  REP(i, f / (100 * a) + 1) {
    REP(j, (f - (i * 100 * a)) / (100 * b) + 1) {
      REP(k, (f - i * 100 * a - j * 100 * b) / c + 1) {
        REP(l, (f - i * 100 * a - j * 100 * b - k * c) / d + 1) {
          double w = i * 100 * a + j * 100 * b, s = k * c + l * d;
          if (s > w * e / 100 || w + s > f) continue;
          double tmp = 100 * s / (w + s);
          if (tmp > mx) {
            mx = tmp;
            ans_m = w + s;
            ans_s = s;
          }
        }
      }
    }
  }
  cout << ans_m << " " << ans_s << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)

cnt = {}
for i in range(n):
    if a[i] not in cnt:
        cnt[a[i]] = 0
    cnt[a[i]] += 1
    
ans = 0
for i in range(n):
    tmp = cnt[a[i]]
    if a[i] - 1 in cnt:
        tmp += cnt[a[i] - 1]
    if a[i] + 1 in cnt:
        tmp += cnt[a[i] + 1]
    ans = max(ans, tmp)
print(ans)
    

Measured memory_bytes: 56556
#include<bits/stdc++.h>
using namespace std;
bitset<2000007>f;
int n , x , sum;
int main () {
	cin >> n;
	f[0] = 1;
   for(int i =  1 ; i <= n ; i ++){
   	scanf("%d" , &x);
   	f |= f << x;
   	sum += x;
   }
   for(int i = (sum + 1) >> 1 ; i <= sum ; i ++){
   	if(f[i]){
   		cout << i << endl;
   		return 0;
	   }
   }
   return 0;	
}

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

int dp[100010];
vector <int> adia[100010];
bool activ[100010];
int ans;
int best_ans(0);
int g[100010];
bool schimbat[100010];

void dfs(int nod, int tata)
{
    int nr_fii_prosti = 0;
    g[nod] = activ[nod];
    for (auto i : adia[nod]) {
        if (i != tata) {
            dfs(i, nod);
            g[nod] += g[i];
            if (g[i])
                ans += 2;
            else
                nr_fii_prosti++;
        }
    }
    if (g[nod] == 0)
        return;

    int grad = adia[nod].size() - nr_fii_prosti;
    grad &= 1;
    bool schimb = grad ^ activ[nod];
    ans += schimb;
    schimbat[nod] = schimb;
}

void dfs2(int nod, int tata)
{
    for (auto i : adia[nod])
        if (i != tata && g[i])
            dfs2(i, nod);

    int best1(-1e9), best2(-1e9);

    for (auto i : adia[nod]) {
        if (i == tata || g[i] == 0)
            continue;
        if (dp[i] > best1)
            best2 = best1, best1 = dp[i];
        else if (dp[i] > best2)
            best2 = dp[i];
    }

    dp[nod] = best1 + 1 + (schimbat[nod] ? 1 : -1);

    best_ans = max(best_ans, dp[nod]);

    best_ans = max(best_ans, dp[nod] + best2);

    dp[nod] = max(dp[nod], 0); /// incep in nod
}

int main()
{
    int n;
    cin >> n;
    int a, b;
    for (int i(1); i < n; i++) {
        cin >> a >> b;
        adia[a].push_back(b);
        adia[b].push_back(a);
    }

    int root = 0;

    for (int i(1); i <= n; i++) {
        char c;
        cin >> c;
        if (c == 'W')
            activ[i] = 1, root = i;
    }

    if (!root) {
        cout << 0;
        return 0;
    }

    dfs(root, 0);
    dfs2(root, 0);

    cout << ans - best_ans << '\n';
    return 0;
}


Measured memory_bytes: 14464
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <set>
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

int main() {
    ll x;
    cin >> x;
    int a = 0, b;
    for(int i = 0; i < 121; i++) {
        for(int j = -120; j< 121; j++) {
            ll tmp = pow(i, 5) - pow(j, 5);
            if(tmp == x) {
                a = i;
                b = j;
                break;
            }
        }
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 4044
#include <iostream>
#include <stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<deque>
#include<queue>
#include<vector>
using namespace std;
#define ll long long
const ll mod = 1e9+7;
const ll N = 3e5+7;
ll a[N];
ll e[64];
ll poww(ll a,ll b)
{
	ll cnt = 1;
	for(int i=0; i<b; i++)
		cnt = cnt * a;
	return cnt;
}
void check(ll x)
{
	int idx = 0;
	while(x)
	{
		if(x&1) e[idx]++;
		x>>=1;
		idx++;
	}
}

int main()
{
	std::ios::sync_with_stdio(false);
	memset(e, 0, sizeof(e));
	ll n;
	cin>>n;
	ll sum = 0;
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
		check(a[i]);
	}
	for(int i=0;i<n;i++)
	{
		ll x = a[i];
		for(int j=0;j<61;j++)
		{
			//if((1LL<<j) > x) break;
			//cout<<e[j]<<" ";
			if( x&(1LL<<j) )
			{
				sum = (sum + ( (n - i - e[j] ) * ( (1LL<<j) % mod ) ) % mod ) % mod;
				e[j]-- ;
			}
			else
			{
				sum = (sum + ( (e[j]) * ( (1LL<<j) % mod ) ) % mod ) % mod;
			}
			//cout<<sum<<endl;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;
int main() {
    int c1, c5, c10, c50, c100, c500;
    cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;

    int val = c1 + 5*c5 + 10*c10 + 50*c50 + 100*c100 + 500*c500;
    if (val >= 1000) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
const ll mod = 998244353;
 
#define mp make_pair
#define pb push_back
#define lb lower_bound

ll binpow(ll a, ll n) {
	if (n == 0)
		return 1;
	if (n % 2 != 0) return binpow(a, n-1)*a; else {
		ll b = binpow(a, n/2);
		return b*b;
	}
}

ll gcd(ll a, ll b) {
	while(b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

void solve() {
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl; else cout << "No" << endl;
}
 
int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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


Measured memory_bytes: 256
def main():
    N = input()
    n = int(N[-1])
    if n in [2, 4, 5, 7, 9]:
        print('hon')
    elif n in [0, 1, 6, 8]:
        print('pon')
    else:
        print('bon')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
// Written By NewbieChd
#include <cstdio>
#include <cctype>
#include <algorithm>
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; }
inline int read() {
    register int f = 0;
    bool b = 1;
    char c;
    while (!isdigit(c = getChar()))
        if (c == 45)
            b = 0;
    do
        f = f * 10 + (c ^ 48);
    while (isdigit(c = getChar()));
    return b ? f : ~f + 1;
}

const int maxN = 100003;

int main() {
    int a = read(), b = read(), c = read();
    printf("%d\n", min(a * b, c));
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
LL w[10];
int main(){
    LCIN(H);LCIN(W);LCIN(N);
    V<pair<LL,LL>> vec;
    REP(a,N){
        LCIN(b);LCIN(c);
        vec.pb(make_pair(b-1,c-1));
    }
    map<pair<int,int>,int> mp;
    int dx[]={1,1,1,0,-1,-1,-1,0,0};
    int dy[]={1,0,-1,-1,-1,0,1,1,0};
    REP(a,N){
        for(int b = 0;b < 9;b++){
            if(vec.at(a).second+dx[b] >=1&&vec.at(a).second+dx[b] < W-1&&vec.at(a).first + dy[b] >= 1&&dy[b]+vec.at(a).first < H-1){
                if(mp.find(make_pair(vec.at(a).first + dy[b],vec.at(a).second+dx[b])) == mp.end()){
                    mp[make_pair(vec.at(a).first + dy[b],vec.at(a).second+dx[b])]=1;
                }else{
                    mp[make_pair(vec.at(a).first + dy[b],vec.at(a).second+dx[b])]++;
                }
            }
        }
    }
    LL sum = 0;
    FOREACH(a,mp){
       // cout<<a.second <<" "<<a.first.first<<" "<<a.first.second<<endl;
       w[a.second]++;
    }
    for(int a = 0;a < 10;a++){
        sum += w[a];
    }
    w[0]=(H-2)*(W-2)-sum;
    for(int a = 0;a < 10;a++){
        COUT(w[a]);
    }
    return 0;
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int x;
	cin >> x;

	if(x >= 30) {
		coY();
	} else {
		coN();
	}
}


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;
using System.Numerics;

namespace ABC169C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            var A = decimal.Parse(s[0]);
            var B = decimal.Parse(s[1]);

            decimal ans = (A * B);
            ans = Math.Floor(ans);
            Console.WriteLine(ans);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            string[,] map2 = new string[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0.ToString();
                    else if (i == 0) map2[i, j] = (j - 1).ToString();
                    else if (j == 0) map2[i, j] = (i - 1).ToString();
                    else map2[i, j] = map[i - 1, j - 1].ToString();
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j].Last());
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D<T>(T[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 27564
// Never let them see you bleed...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;

const int maxn = 410, inf = 1e9 + 10;

vector<pii> ed;
bitset<maxn> bs[maxn], tmp;
bool bad[maxn];

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

    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
	int a, b;
	cin >> a >> b;
	ed.PB({a, b});
    }
    reverse(ed.begin(), ed.end());
    for(int i = 1; i <= n; i++){
	bs[i][i] = 1;
	for(pii p : ed){
	    if(bs[i][p.F] && bs[i][p.S]){
		bad[i] = 1;
	    }
	    else if(bs[i][p.F]){
		bs[i][p.S] = 1;
	    }
	    else if(bs[i][p.S]){
		bs[i][p.F] = 1;
	    }
	}
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
	for(int j = i+1; j <= n; j++){
	    if(bad[i] || bad[j])
		continue;
	    tmp = bs[i] & bs[j];
	    ans+= (tmp.any() ? 0 : 1);
	}
    }
    return cout << ans << endl, 0;
}


Measured memory_bytes: 1528
H,W=map(int,input().split())
hlen = list(map(int,input().split()))
wlen =	list(map(int,input().split()))
hlen.sort(reverse=True)
wlen.sort(reverse=True)
hlen.append(0)
wlen.append(0)

m = H*W
count = 1
h=0
w=0
for num in range(1,H*W+1)[::-1]:
	if hlen[h] == num and wlen[w] == num:
		count *= 1
		h += 1
		w += 1
	elif hlen[h] == num:
		count *= w
		h += 1
	elif wlen[w] == num:
		count *= h
		w += 1
	else:
		count *= h*w - (m-num)
	#print(num,flagh,flagw,count)
	count %= (10**9+7)
print(count)

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

long long binom(long long n, long long r) {
    if (n-r < r) r = n-r;
    long long ret = 1;
    vector<bool> div(r+1, true);
    div[0] = div[1] = false;
    for (int i = n; i > n-r; i--) {
        ret *= i; assert(0 <= ret);
        for (long long d = 2; d <= r; d++) if (div[d]) {
            if (ret % d == 0) { ret /= d; div[d] = false; }
        }
    }
    return ret;
}

template<class T>
vector<pair<T, long long>> count_element (const vector<T> &a) {
    map<T, long long> mp;
    vector<pair<T, long long>> ret;
    for (auto &e : a) mp[e]++;
    for (const auto &e : mp) ret.emplace_back(e);
    sort(ret.begin(), ret.end());
    reverse(ret.begin(), ret.end());
    return ret;
}

void solve (const vector<long long> &v, long long a) {
    double sum = 0;
    for (long long i = 0; i < a; i++) sum += v[i];
    sum /= (double)a;
    cout << fixed << setprecision(20) << sum << '\n';
}

int main() {
    long long n, a, b;
    cin >> n >> a >> b;
    vector<long long> v(n);
    for (auto &e : v) cin >> e;
    
    sort(v.begin(), v.end(), greater<long>());
    
    vector<pair<long long, long long>> c = count_element(v);
    
    long long cnt = 0;
    long long ans = 0;
    for (const auto &e : c) {
        if (cnt + e.second < a) {
            cnt += e.second;
            continue;
        } else {
            if (cnt != 0) ans = binom(e.second, a - cnt);
            else {
                for (long long i = a; i <= min(e.second, b); i++) {
                    ans += binom(e.second, i);
                }
            }
            break;
        }
    }
    
    solve(v, a);
    cout << ans << '\n';
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  double r,i,s,x;
  scanf("%lf",&r);
  s=3.141592653589*r*r;
  x=2*3.141592653589*r;
  printf("%.8lf %.8lf\n",s,x);
  return 0;
}




Measured memory_bytes: 2104
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_086_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(7).
    01 INP2   PIC X(6).
    01 num    PIC 9(6).
    01 a      PIC X(3).
    01 b      PIC X(3).
    01 i      PIC 9(6).
    01 ans    PIC X(18).
    01 flg    PIC 9(1) VALUE 0.
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO a b.

    STRING
    a(1:FUNCTION STORED-CHAR-LENGTH(a))
    b(1:FUNCTION STORED-CHAR-LENGTH(b))
    INTO INP2.

    MOVE INP2 TO num.

    PERFORM VARYING i FROM 2 BY 1 UNTIL num < i
        IF num < i * i THEN
            EXIT PERFORM
        ELSE
            IF num = i * i THEN
                MOVE 1 TO flg
            END-IF
        END-IF
    END-PERFORM.

    IF flg = 1 THEN
        DISPLAY "Yes"
    ELSE
        DISPLAY "No"
    END-IF.

    STOP RUN.


Measured memory_bytes: 384