akhauriyash/Code-Regression huggingface dataset:
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100100;
const long long MOD = 1000000007;
typedef pair<long long,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

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



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int H,W,K;cin >> H >> W >> K;
    vector<vector<char>> ban(H,vector<char>(W));
    for(int i = 0;i<H;i++)for(int j = 0;j<W;j++) cin >> ban.at(i).at(j);
    
    int ans = 0;
    for(int i = 0;i<(1<<H);i++){
        for(int j = 0;j<(1<<W);j++){
            bitset<6> BH(i);
            bitset<6> BW(j);
            int now = 0;
            for(int k = 0;k<H;k++){
                for(int l = 0;l<W;l++){
                    if(ban.at(k).at(l) == '#' && !BH.test(k) && !BW.test(l)) now++;
                }
            }
            if(now == K) ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map> 

using namespace std;
#define MAXN 100000
#define pb push_back
#define ll long long
#define I(x,y) (1ll*(x)*n+~-(y))
#define U(x) ((x)/n)
#define V(x) ((x)%n+1)
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
int fa[MAXN+5], n, c; vector<ll> q; vector<int> e[MAXN+5]; map<ll,int> g; inline int getf(int x){return x^fa[x] ? fa[x]=getf(fa[x]) : x;}
int main()
{
	n = read(), c = 1; for(rint i = 1; i <= n; fa[i] = i, i++); for(rint i = 1, u, v; i <= (n<<1)-2; u = read(), v = read(), e[u].pb(v), e[v].pb(u), ++g[I(v,u)], ++g[I(u,v)]==2 ? q.pb(I(u,v)),0 : 0, i++);
	for(rint i = 0, u, v, j, t; i < (int)q.size() && c < n; i++)
		if(u = getf(U(q[i])), v = getf(V(q[i])), e[v].size()<e[u].size()?u^=v^=u^=v:0, g[q[i]]==2&&u^v)
			for(++c, fa[u] = v, j = 0; j < (int)e[u].size(); t = e[u][j], e[v].pb(t), e[t].pb(v), g[I(t,v)] += g[I(t,u)], (g[I(v,t)]+=g[I(u,t)])==2 ? q.pb(I(v,t)),0 : 0, j++); puts(c^n?"NO":"YES"); return 0;
}

Measured memory_bytes: 146516
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-10

using namespace std;

typedef long long ll;

int n;
double x[5];
double y[5];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}

		double k = (x[1] - x[0])*(y[3] - y[2])-(x[3] - x[2])*(y[1] - y[0]);
		if (fabs(k)< EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll X, Y, A, B, C; cin >> X >> Y >> A >> B >> C;
  ll p[A]; rep(i,A) cin >> p[i]; sort(p,p+A,greater<ll>());
  ll q[B]; rep(i,B) cin >> q[i]; sort(q,q+B,greater<ll>());
  ll r[C]; rep(i,C) cin >> r[i]; sort(r,r+C,greater<ll>());
  vector<ll> s;
  rep(i,X) s.push_back(p[i]);
  rep(i,Y) s.push_back(q[i]);
  rep(i,C) s.push_back(r[i]);
  sort(all(s),greater<ll>());

  ll result = 0; rep(i,X+Y) result += s[i];
  cout << result << endl;
  return 0;
}

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

using namespace std;

int main()
{
    int mark[1002];
    memset(mark,0,sizeof(0));
    for(int i=1;i<=9;i++)
    {
        for(int j=i;j<=9;j++)
        {
            mark[i*j]=1;
        }
    }
    int n;
    cin>>n;
    if(mark[n]==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


    return 0;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){

int a,b;//変数を宣言

cin>>a>>b;//外部入力から変数を2つ読み込む

//面積・空白スペース・周の長さ・改行を出力
cout<<a*b<<" "<<2*(a+b)<<endl;

return 0;
}


Measured memory_bytes: 3028
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);

		// 整数nを取得
		int n = scanner.nextInt();
		// System.out.print(" ");

		for (int i = 1; i <= n; i++ ) {
		// 3の倍数
		if (i % 3 == 0) {
			System.out.print(" " + i);
		// 3を含む数字
		} else if (String.valueOf(i).contains("3")) {
			System.out.print(" " + i);
		}
		}
                System.out.println();
	}
}



Measured memory_bytes: 29084
#include<stdio.h>
int main(){
  long long a=1,b=1,c=1,n,i,M=1e9+7;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    a=(a*10)%M;
    b=(b* 9)%M;
    c=(c* 8)%M;
  }
  printf("%lld\n",(a+2*(M-b)+c)%M);
  return 0;
}
  


Measured memory_bytes: 1732
#include<iostream>
#include<string>
using namespace std;
 
int main(){
	int sx,sy,tx,ty;
	cin>>sx>>sy>>tx>>ty;
	int dx=abs(tx-sx);
	int dy=abs(ty-sy);
	string s;
	string t;
	string u;
	string v;
	for(int i=0;i<dx;i++){
		s+='R';
		u+='L';
	}
	for(int i=0;i<dy;i++){
		t+='U';
		v+='D';
	}
	string ans=s+t+u+v+'D'+s+'R'+t+'U'+'L'+'U'+u+'L'+v+'D'+'R';
	cout<<ans<<endl;
}

Measured memory_bytes: 384
/****************************
    > File Name: c.cpp
    > Author: caoyu01
  	> Mail: yalecyu@gmail.com 
    > Created Time: 2016年09月11日 星期日 20时22分56秒
*****************************/
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define cle(x) memset(x,0,sizeof(x))
#define rep(i,x) for(int i=0;i<x;i++)
const int N = 1000+10;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
string s;
int n;
int main()
{
#ifndef ONLINE_JUDGE
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
#endif
	while(cin>>s)
	{
		n=s.size();
		ll sum=0;
		string ans="";
		rep(i,(1<<(n-1)))
		{
			ans="";
			int now=0;
			ans+=s[now++];
			rep(j,n-1)
			{
				if((1<<j)&i){
					ans+='*';
				}
				ans+=s[now++];
			}
			ll tmp=0;
			int len=ans.size();
			for(int j=0;j<len;j++){
				if(ans[j]=='*'){
					sum+=tmp;
					tmp=0;
				}
				else tmp=tmp*10+(ll)(ans[j]-'0');
			}
			sum+=tmp;
		}
		cout<<sum<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

int main() {
	ll h, w, k;
	cin >> h >> w >> k;
	vector<vector<bool>> grid(h);
	vector<bool> existSt(h);
	vector<vector<ll>> ans(h);
	ll minrow = INT64_MAX;

	for (ll i = 0; i < h; i++) {
		grid[i].resize(w);
		ans[i].resize(w);
		string str;
		cin >> str;
		for (ll j = 0; j < w; j++) {
			if (str[j] == '#') {
				grid[i][j] = true;
				if (minrow > i) {
					minrow = i;
				}
				existSt[i] = true;
			}
		}

	}
	ll nowNo = 1;
	for (ll i = minrow; i < h; i++) {
		if (existSt[i] == false) {
			for (ll j = 0; j < w; j++) {
				ans[i][j] = ans[i - 1][j];
			}
		}
		else {
			bool discoverOne = false;
			for (ll j = 0; j < w; j++) {
				if (grid[i][j] == true) {
					if (discoverOne) {
						nowNo++;
					}
					else {
						discoverOne = true;
					}
				}
				ans[i][j] = nowNo;
			}
			nowNo++;
		}
	}
	for (ll i = 0; i < minrow; i++) {
		for (ll j = 0; j < w; j++) {
			if (j != 0) {
				cout << " ";
			}
			cout << ans[minrow][j];
		}
		cout << endl;
	}
	for (ll i = minrow; i < h; i++) {
		for (ll j = 0; j < w; j++) {
			if (j != 0) {
				cout << " ";
			}
			cout << ans[i][j];
		}
		cout << endl;
	}
}


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

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

int main()
{
    int n;
    cin >> n;
    vector<pair<long long int, long long int>> v;
    for (int i = 1; i <= n; i++)
    {
        long long int x, l;
        cin >> x >> l;
        v.push_back(make_pair(x + l, x - l));
    }
    long long int s = -(1e+10 + 3), ans = 0;
    sort(v.begin(), v.end());
    for (auto it : v)
    {
        // cout << it.second << " " << it.first << endl;

        if (it.second >= s)
        {
            s = it.first;
            ans++;
        }
    }
    cout << ans;
}

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

const int LIM = 100001;
int N, a, cnt[LIM];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a;
        if (a) cnt[a-1]++;
        cnt[a]++; cnt[a+1]++;
    }
    cout << *max_element(cnt, cnt + LIM) << endl;
}

Measured memory_bytes: 640
n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))
zz = 0
for i in range(n):
    o = 0
    q = list(map(int,input().split()))

    for j in range(m):
        o += b[j] * q[j]

    if(o+c > 0):
        zz += 1

print(zz)

Measured memory_bytes: 3060
def cal(h1,w1,h2,w2):
    S1=h1*w1
    S2=h2*w2
    if S1>=S2:
        return S1
    else:
        return S2

h1,w1,h2,w2=map(int,input().split(" "))
print(cal(h1,w1,h2,w2))

Measured memory_bytes: 2940
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	ii := make([]int, n)
	skip := -1
	for i := 0; i < n+1; i++ {
		a := getNextInt(scanner) - 1
		if ii[a] > 0 {
			skip = i + 2 - ii[a]
			break
		}
		ii[a] = i + 1
	}

	cm := Com{}
	cm.init(n + 1)
	for i := 0; i < n+1; i++ {
		ans := cm.calc(n+1, i+1)
		if n+1-skip >= i {
			ans -= cm.calc(n+1-skip, i)
			ans = ((ans % cm.mod) + cm.mod) % cm.mod
		}

		fmt.Fprintln(writer, ans)
	}
	writer.Flush()
}

// Com ...
type Com struct {
	facs, invs []int64
	mod        int64
}

func (cm *Com) init(n int) {
	cm.facs = make([]int64, n+1)
	cm.invs = make([]int64, n+1)

	cm.facs[0] = 1
	cm.mod = int64(1e9 + 7)
	for i := 1; i <= n; i++ {
		cm.facs[i] = (cm.facs[i-1] * int64(i)) % cm.mod
	}
	cm.invs[n] = cm.inv(cm.facs[n])
	for i := n - 1; i >= 0; i-- {
		cm.invs[i] = cm.invs[i+1] * int64(i+1) % cm.mod
	}
}

func (cm *Com) inv(n int64) int64 {
	var ii [32]int64
	ii[0] = n
	for i := 1; i < 31; i++ {
		ii[i] = (ii[i-1] * ii[i-1]) % cm.mod
	}
	var ans int64
	ans = 1
	m := cm.mod - 2
	for i := 30; i >= 0; i-- {
		for m >= 1<<uint(i) {
			ans = (ans * ii[i]) % cm.mod
			m -= 1 << uint(i)
		}
	}

	return ans
}

func (cm *Com) calc(n, k int) int64 {
	ans := cm.facs[n] * cm.invs[k]
	ans %= cm.mod
	ans = ans * cm.invs[n-k]
	ans %= cm.mod
	return ans
}


Measured memory_bytes: 5632
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))

V = [0] + V + [0]

# 0.前処理
# N+2個の条件をつくる
left = [0]
right = [0]

for i in range(N):
    left.append(right[i])
    right.append(left[-1]+T[i])
    
left.append(right[-1])
right.append(right[-1])

INF = float("inf")
vel = [INF]*(2*right[-1]+1)

# 1.各ステップでの許容測度の最大値の最小値を求める
for t in range(2*right[-1]+1):
    for i in range(N+2):
        if (t/2) < left[i]:
            vel[t] = min(vel[t], -(t/2)+(V[i]+left[i]))
        elif left[i] <= (t/2) and (t/2) <= right[i]:
            vel[t] = min(vel[t], V[i])
        elif (t/2) > right[i]:
            vel[t] = min(vel[t], (t/2)+(V[i]-right[i]))
            

# 2.面積を求める
ans = 0
for t in range(2*right[-1]):
    ans += (1/2)*0.5*(vel[t]+vel[t+1])
    
print(ans)

Measured memory_bytes: 43868
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>

using namespace std;

void show(vector<int> &v, string s = "") {
	if (s.size() > 0) {
		cout << s << endl;
	}
	for (auto e : v) {
		cout << e << " ";
	}
	cout << endl;
}

int main() {
	int n, m, q;

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

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

	vector<int> order;
	map<int, int> num_pos;
	vector<int> num_used(m, false);

	vector<int> n_fixed(m+1, 0);
	n_fixed[0] = n;

	for (int i = 0; i < q; i++) {
// printf("a[%d] = %d\n", i, a[i]);

		if (!num_used[a[i]]) {
			num_used[a[i]] = true;

			num_pos[a[i]] = order.size();
			order.emplace_back(a[i]);

			n_fixed[order.size()]++;
			n_fixed[order.size()-1]--;
// show(n_fixed, "n_fixed");
			continue;
		}

		int pos = num_pos[a[i]];
// printf("pos %d\n", pos);
		if (n_fixed[pos] > 0) {
			n_fixed[pos]--;
			n_fixed[pos+1]++;
		}
// show(n_fixed, "n_fixed");
	}

	// show(order, "order");
	// show(n_fixed, "n_fixed");

	for (int i = 0; i < m; i++) {
		if (!num_used[i]) {
			order.emplace_back(i);
		}
	}
// show(order, "order");

	auto it = find_if(n_fixed.begin(), n_fixed.end(),
	                  [](const int &a) {return a > 0;});
	int min_fix = it - n_fixed.begin();
// printf("min_fix %d\n", min_fix);

	bool ok = true;
	for (int i = min_fix; i < order.size() - 1; i++) {
		if (order[i] > order[i+1]) {
			ok = false;
			break;
		}
	}

	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 6520
#include<iostream>
using namespace std;
int main(){
	int n;
	int a,b,sum=0;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++){
		int num=0,m=i;
		while(m){
			num+=(m%10);
			m/=10;
		}
		if(num<=b&&num>=a) sum+=i;
		num=0;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
D, X = map(int, input().split())
A = [0]*N
for i in range(N):
    A[i] = int(input())
ans = 0
for j in range(N):
    for k in range(0, D+1):
        if k*A[j]+1 <= D:
            ans += 1
        else:
            break
print(ans+X)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef vector<int> vi;
const int mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    map<int,vi> comb;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        comb[a].push_back(b);
        comb[b].push_back(a);
    }
    bool ans=false;
    for(int i=0;i<comb[1].size();i++){
        for(int j=0;j<comb[comb[1][i]].size();j++){
            if(comb[comb[1][i]][j]==n)  ans=true;
        }
    }
    cout << (ans?"POSSIBLE":"IMPOSSIBLE") << endl;
    return 0;
}

Measured memory_bytes: 22896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll cost[2010100] = {0};
ll cost2[2010100] = {0};
vector<ll> edge, edge2;
struct N {
  ll v, d;
};
ll M = 1000000;
ll INF = 1001010100101010;
bool operator<(const N &l, const N &r) { return l.d > r.d; }
int main() {
  for (int i = 1; i < 10000; i++) {
    ll ne = i * (i + 1) * (i + 2) / 6;
    if (ne > M)
      break;
    edge.push_back(ne);
    if (ne % 2 == 1)
      edge2.push_back(ne);
  }

  priority_queue<N> q, q2;
  for (auto &j : edge)
    q.push(N{j, 1});
  for (auto &j : edge2)
    q2.push(N{j, 1});
  for (int i = 0; i < M; i++)
    cost[i] = cost2[i] = INF;

  while (q.size()) {
    N now = q.top();
    q.pop();
    if (cost[now.v] < now.d)
      continue;
    cost[now.v] = now.d;
    for (auto &j : edge) {
      ll next = now.v + j;
      if (cost[next] < INF || next > M)
        continue;
      cost[next] = now.d + 1;
      q.push(N{next, now.d + 1});
    }
  }

  while (q2.size()) {
    N now = q2.top();
    q2.pop();
    if (cost2[now.v] < now.d)
      continue;
    cost2[now.v] = now.d;
    for (auto &j : edge2) {
      ll next = now.v + j;
      if (cost2[next] < INF || next > M)
        continue;
      cost2[next] = now.d + 1;
      q2.push(N{next, now.d + 1});
    }
  }

  while (true) {
    ll n;
    cin >> n;
    if (n == 0)
      break;
    cout << cost[n] << " " << cost2[n] << endl;
  }
  return 0;
}


Measured memory_bytes: 56788
# coding: utf-8

n = int(input().rstrip())

numbers = list(map(int, input().rstrip().split(" ")))

start = 0
ans = 0
for i in range(1,n):
    if numbers[i] <= numbers[i-1]:
        ans = max(ans, i - start)
    else:
        start = i

print(ans)

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

#pragma GCC optimize(2)

#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define per(i, r, l) for (int i = (r); i >= (l); --i)
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;

int gi() {
	int f = 1, x = 0;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = (x << 1) + (x << 3) + ch - '0';
		ch = getchar();
	}
	return f * x;
}

const int N = 111111;
int n, k, s, a[N]; 
int main() {
	n = gi(), k = gi(), s = gi();
	
	for (int i = 1; i <= k; i++) cout << s << " ";
	for (int i = 1; i <= n - k; i++) {
		if (s == 1000000000) cout << 999999999 << " ";
		else cout << 1000000000 << " ";
	}
	cout << endl; 
  return 0;
}


Measured memory_bytes: 1280
N, M, Q = map(int,input().split())
A = []
for _ in range(Q):
    a = list(map(int,input().split()))
    A.append(a)
import itertools
m=[]
for i in range(1,M+1):
    m.append(i)
list_ = list(itertools.combinations_with_replacement(m,N))
answers = []
for l in list_:
    ans = 0
    for a in A:
        if l[a[1]-1]-l[a[0]-1] == a[2]:
            ans += a[3]
    answers.append(ans)
print(max(answers))

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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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;
}

long long fac[MAX_N], finv[MAX_N], inv[MAX_N];
// テーブルを作る前処理 from: https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// factorial
long long fact(int n) {
    if (n == 1) return fac[n] = 1;
    if (fac[n]) return fac[n];
    return fac[n] = (fact(n - 1) * n) % MOD;
}

long long modpow(long long m, long long p) {
    if (p == 0) return 1;
    if (p % 2)
        return m * modpow(m, p - 1) % MOD;
    else {
        long res = modpow(m, p / 2);
        return res * res % MOD;
    }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int d, n;
    cin >> d >> n;
    int cnt = 0, num = 0;
    int D = modpow(100, d);
    while (cnt < n) {
        if (num % D == 0 and num % (D * 100) != 0)
            cnt++;

        num++;
    }

    out(num - 1);
}


Measured memory_bytes: 256
#include <stdbool.h>
#include <stdio.h>
int main() {
    int h, w;
    bool isEnable = true;
    char f[51][51];
    scanf("%d%d", &h, &w);
    for (int i = 0; i < h; i++) {
        scanf("%s", &f[i]);
    }
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            if (f[y][x] == '#') {
                if (y + 1 != h && f[y + 1][x] == '.' && y != 0 &&
                    f[y - 1][x] == '.' && x + 1 != w && f[y][x + 1] == '.' &&
                    x != 0 && f[y][x - 1] == '.')
                    isEnable = false;
            }
        }
    }
    if (isEnable)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

const int MAXI = 1e9;

int main() {
	int n, k, s;
	cin >> n >> k >> s;

	vector<int> ans;
	if (s == MAXI) {
		ans.assign(n, 1);
		for (int i = 0; i < k; i++) {
			ans[i] = MAXI;
		}
	}else {
		ans.assign(n, s);
		for (int i = k; i < n; i++) {
			ans[i] = MAXI;
		}
	}

	for (int i = 0; i < n; i++) {
		if (i > 0) {
			cout << " ";
		}
		cout << ans[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 1664
class Residents:

    def __init__(self):
        self.official_house = []

        for b in range(4):
            self.official_house.append([])
            for f in range(3):
                self.official_house[b].append([])
                for r in range(10):
                    self.official_house[b][f].append(0)

    def move_in(self, building, floor, room, num):
        building -= 1
        floor -= 1
        room -= 1
        if self.official_house[building][floor][room] + num > 9:
            self.official_house[building][floor][room] = 9 
        else:
            self.official_house[building][floor][room] += num 

    def move_out(self, building, floor, room, num):
        building -= 1
        floor -= 1
        room -= 1
        if self.official_house[building][floor][room] < num:
            self.official_house[building][floor][room] = 0 
        else:
            self.official_house[building][floor][room] -= num 

    def show(self, building, floor, room):
        building -= 1
        floor -= 1
        room -= 1
        return self.official_house[building][floor][room]

    def output(self):
        result = ''
        for b in range(4):
            if b > 0:
                result += '#' * 20 + '\n'
            for f in range(3):
                for r in range(10):
                    result += ' ' + str(self.official_house[b][f][r])
                result += '\n'

        return result

if __name__ == '__main__':

    residents = Residents()
    rows = int(input())

    for i in range(rows):
        (b, f, r, num) = [int(i) for i in input().split(' ')]
        if num > 0:
            residents.move_in(b, f, r, num)
        else:
            residents.move_out(b, f, r, num * -1)

    print(residents.output(), end='')

Measured memory_bytes: 7840
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace __gnu_pbds;
using namespace std;
/*
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
*/
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piiii pair<pii,pii>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST int testcase;cin>>testcase;while(testcase--)
#define all(x) (x).begin(),(x).end()
#define mset0(x) memset((x), 0, sizeof((x)));
#define mset1(x) memset((x), -1, sizeof((x)));
#define endl "\n"
#define plll pair<ll,pll>
#define logg2 0.30102999566398119521373889472449L

typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
bool isone=true;
pii convert(string s){
    int n=s.size();
    ull a=0,b=1;
    int a1=0,b1=0,a2=0,b2=0;
    int i=0;
    for(i;i<n;i++){
        if(s[i]=='.') break;
        a=a*10+(s[i]-'0');
    }
    i++;
    for(i;i<n;i++){
        a=a*10+(s[i]-'0');
        b*=10;
    }
    ull g=__gcd(a,b);
    a/=g;b/=g;
   // cout<<s<<" "<<a<<" "<<b<<endl;
    while(a%2==0){
        a/=2;
        a1++;
    }
    while(b%2==0){
        b/=2;
        a2++;
    }
    while(a%5==0){
        a/=5;
        b1++;
    }
    while(b%5==0){
        b/=5;
        b2++;
    }
    //cout<<s<<" "<<a<<" "<<b<<endl;
    return(pii(a1-a2,b1-b2)); //(2^p,5^q) (p,q)
}
void solve(){
    ll n,ans=0;
    cin>>n;
    string s;
    pii p;
    map<pii,ll> mp;
    while(n--){
        cin>>s;
        p=convert(s);
        mp[p]++;
    }
    for(auto pp1:mp){
        for(auto pp2:mp){
            if(pp1.first.first+pp2.first.first>=0 && pp1.first.second+pp2.first.second>=0){
                if(pp1<pp2) ans+=pp1.second*pp2.second;
                else if(pp1==pp2) ans+=(pp1.second*(pp1.second-1))/2;
            }
        }

    }
    cout<<ans;
    return;
}
int main(){
    IO

    solve();


    return(0);
}


Measured memory_bytes: 3668
//dp(i,j) -> no of ways to distribute j candies to first i children
/*
dp(n,k) = dp(n-1,k) + dp(n-1,k-1) + dp(n-1,k-2) + ...... + dp(n-1,k-an)
dp(i,j) = dp(i-1,j-x) for x from [0,ai]
base case:-
dp(1,j) = {
              1 , j<=a1
              0 , j>a1
          }
dp(i,k-1) = dp(i,k) - dp(i-1,k) + dp(i-1,k-1-ai)

dp(i,j+1) = dp(i,j) + dp(i-1,j+1) - dp(i,j-ai) ->main formula 
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
int solve(int *a , int n , int k){
   ll dp[n+2][k+2];
   for(int j=0 ; j<=k ; j++){
       if(j <= a[1]) dp[1][j] = 1;
       else dp[1][j] = 0;
   }

   for(int i=2 ; i<=n ; i++){
       for(int j=0 ; j<=k ; j++){
           if(j == 0) {
               dp[i][j] = dp[i-1][j];
           }else{
               dp[i][j] = (mod + dp[i-1][j] + dp[i][j-1] - ((j-1-a[i] >=0 )? dp[i-1][j-a[i]-1] : 0))%mod;
           }
       }
   }
   return dp[n][k];
}
int main() {
    int n , k;
    cin>>n>>k;
    int a[n+1];
    for(int i=1 ; i<=n ; i++){  
        cin>>a[i];
    }
    cout<<solve(a , n , k);
    return 0;
}


Measured memory_bytes: 78976
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}

//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i, no){
  switch(no){
    case 0: return i;
    case 1: return parseInt(i);
    case 2: return i.split(" ");
    case 3: return i.split("\n");
    case 4: return i.split(" ").map((a)=>Number(a));
    case 5: return i.split("\n").map((a)=>Number(a));
    case 6: return i.split("");
    case 7: return i.split("").map((a)=>Number(a));
  }}
function Main(input) {
  input = myconv(input, 3);
  const N = myconv(input[0], 1);
  const D = myconv(input[1], 4)[0];
  const X = myconv(input[1], 4)[1];
  var ans = 0;
  input.shift();
  input.shift();
  input = input.map((a)=>Number(a));
  for(var i = 0; i < N; i++){
    var tmp = 1;
    while (tmp <= D){
      ans++;
      tmp += input[i];
    }
  }
  console.log(ans + X);
}
Main(myin());

Measured memory_bytes: 30472
#include <bits/stdc++.h>
#define ll long long
int main()
{
    ll n;
    std::vector<ll> A;
    ll ans = 0;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        ll temp = 0;
        std::cin >> temp;
        A.push_back(temp);
    }

    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0 && A[i] % 2 == 1) {
            ++ans;
        }
    }

    std::cout << ans << std::endl;
}

Measured memory_bytes: 3596
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 20:57:43 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

N = int(input())
S = [input() for _ in range(N)]
#A = list(map(int,input().split()))

s = set(S)
print(len(s))

Measured memory_bytes: 35584
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;


int main(){
  while(true){
    string str;
    int m;
    cin >> str >> m;
    if(str.at(0) == '-') return 0;
    for(int i = 0; i < m; i++){
      int x;
      cin >> x;
      str = str.substr(x, str.size() - x) + str.substr(0, x);
    }
    cout << str << endl;
  }
}


Measured memory_bytes: 3176
//package atcoder.dpContest;

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
//        try {
//            FastScanner in = new FastScanner(new FileInputStream("src/input.in"));
//            PrintWriter out = new PrintWriter(new FileOutputStream("src/output.out"));

        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(1, in, out);

//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }

    private static void solve(int q, FastScanner in, PrintWriter out) {
        for (int qq = 0; qq < q; qq++) {
            int h = in.nextInt(), w = in.nextInt();
            char[][] grid = new char[h][w];
            for(int i = 0; i < h; i++) {
                grid[i] = in.next().toCharArray();
            }
            int mod = (int)1e9 + 7;
            long[][] dp = new long[h][w];
            for(int i = 0; i < w && grid[0][i] == '.'; i++) {
                dp[0][i] = 1;
            }
            for(int i = 0; i < h && grid[i][0] == '.'; i++) {
                dp[i][0] = 1;
            }
            for(int i = 1; i < h; i++) {
                for(int j = 1; j < w; j++) {
                    if(grid[i][j] == '.') {
                        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
                    }
                }
            }
            out.println(dp[h - 1][w - 1]);
        }
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

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

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}




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




int main() {
   #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
 ios_base::sync_with_stdio(0);
 cin.tie(0);
 cout.tie(0);
 ll n,x; cin>>n>>x; 
 ll count=0;
 vector<ll> v(n);
 for(int i=0;i<n;i++) cin>>v[i];
  for(int j=1;j<n;j++){
     if((v[j]+v[j-1])>x){
      ll t=(v[j]+v[j-1])-x;
      v[j]-=t;
      count+=t;
      if(v[j]<0) v[j]=0;
     }
  }
  cout<<count<<endl;

  return 0;
}


Measured memory_bytes: 4004
#include<stdio.h>




int main()
{
 int N;
  scanf("%d", &N);
  
  int i=0;
  int H[N];
int c[N];
  
  int count = 0;
int num[N];
  int j=0;
  int max = 0;
  for(i=0;i<N;i++){
	scanf("%d", &H[i]);
  }
  /*
  if(max(H,N) == min(H,N)){
    printf("%d",N-1);
    return 0;
  }*/
    
	
   for(i=0;i<N-1;i++){
     if(H[i] >= H[i+1]){
		c[i] = 1;
     }else{
		c[i] = 0;
     }
   }
c[N-1] = 0;

for(i=0;i<N;i++){
 // printf("c%d\n",c[i]);
 	if(c[i] == 0){
		num[count] = i;
     //printf("num:%d\n",num[count]);
      count++;
    // printf("count%d",count);
    }
}
  max = num[0];
  //printf("max test%d",max);
     for(i=count-1;i>0;i--){
      // printf("num-:%d\n",(num[i]-num[i-1]));
		if(max < (num[i]-num[i-1])){
			max = num[i] -num[i-1]-1;
        }
     }
  
 	printf("%d",max);
    return 0;
}

Measured memory_bytes: 1280
program main
  implicit none
  integer :: i
  character(4) :: s, res
  read (*, *) s
  res = "Good"
  do i = 1, 3
    if (s(i:i) == s(i + 1:i + 1)) then
      res = "Bad"
    end if
  end do

  write (*, "(a)") trim(res)
end program main


Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < ll(n); ++i)	
//setprecision(16)

void outi(int x) { cout << x << endl; }
void outl(ll x) { cout << x << endl; }
void outs(string x) { cout << x << endl; }
ll max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
ll min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}
//---------------------------------------------------------------

int main() {
	int n;
	int w[110];
	cin >> n;
	rep(i, n) cin >> w[i];

	int sum = 0;
	rep(i, n) {
		cin >> w[i];
		sum += w[i];
	}

	int mini = sum;
	int prefix_sum = 0;

	rep(i, n) {
		prefix_sum += w[i];
		mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
	}

	cout << mini << endl;
}

Measured memory_bytes: 256
import sys
f = sys.stdin

blood_types = ('A', 'B', 'AB', 'O')
blood_count = {type:0 for type in blood_types}
for line in f:
    id, blood_type = line.strip().split(',')
    blood_count[blood_type]  += 1

for blood_type in blood_types:
    print(blood_count[blood_type])

Measured memory_bytes: 6724
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    ba = []
    ca = []
    bc = []
    cc = []
    for _ in range(N):
        s = input().strip()
        b = (s[0] == "B")
        a = (s[-1] == "A")
        if b and a:
            ba.append(s)
        elif not b and a:
            ca.append(s)
        elif b and not a:
            bc.append(s)
        else:
            cc.append(s)
    S = ""
    if ca:
        S += ca.pop()
    for s in ba:
        S += s
    if bc:
        S += bc.pop()
    while ca or bc:
        if ca:
            S += ca.pop()
        if bc:
            S += bc.pop()
    for s in cc:
        S += s
    print(S.count("AB"))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int main() {
    
    int n;
    string s;
    cin >> n >> s;
    if (n%2 != 0){
        cout << "No" << endl;
    }else{
        if(s.substr(0, n/2) == s.substr(n/2, n/2)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

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

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

dp = [0] * N

for i in range(M):
    a,b = map(int, input().split())

    if height[a-1] < height[b-1]:
        dp[a-1] += 1
    elif height[b-1] < height[a-1]:
        dp[b-1] += 1
    else:
        dp[a-1] += 1
        dp[b-1] += 1
        

ans = 0
for i in dp:
    if i == 0:
        ans += 1

print(ans) 

Measured memory_bytes: 20192
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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 (a > b) {
      a = b;
      return 1;
   }
   return 0;
}

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int N;
int X[110];
int main()
{
   cout << fixed << setprecision(10);
   cin >> N;
   REP(i, N) {
      cin >> X[i];
   }
   int min = 10000000, power;
   REP(i, 100) {
      power = 0;
      REP(j, N) {
         power += (X[j] - i) * (X[j] - i);
      }
      if (power < min) {
         min = power;
      }
   }
   cout << min << endl;
   return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
        int H,W;
    while(1){
            cin>>H>>W;
        if(H==0&&W==0)break;
        for(int a=1;a<=H;a++){
            for(int b=1;b<=W;b++){
            if(b==1){
                cout<<"#";
                }else if(b==W){
                    cout<<"#";
                }else if(a==1){
                    cout<<"#";
                }else if(a==H){
                    cout<<"#";
                }
                else {cout<<".";}
        }
    cout<<endl;   
    }cout<<endl;
}
return 0;
}



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

using namespace std;

int main()
{
    int n , m;
    cin >> n >> m ;
    char arr[n+1][m+1];
    for(int i = 1 ; i <=n ; i++)
    {
        for(int j = 1 ; j <=m ;j++)
        {
            cin >> arr[i][j];
        }
    }
    int r=0 , c=0;
    vector<int>dontCout,dont;
    for(int i = 1 ; i <=n ; i++)
    {
        r=0;
        for(int j = 1 ; j <=m ;j++)
        {
            if(arr[i][j]=='.')
                r++;
        }
        if(r==m)
        {
            dontCout.push_back(i);
        }
    }
    for(int i = 1 ; i <=m ; i++)
    {
        r=0;
        for(int j = 1 ; j <=n ;j++)
        {
            if(arr[j][i]=='.')
                r++;
        }
        if(r==n)
        {
            dont.push_back(i);
        }
    }
    int x=0 , y=0;
    for(int i = 1 ; i <=n ; i++)
    {
        if( binary_search(dontCout.begin(),dontCout.end(),i) )
        {
            continue;
        }
        for(int j = 1 ; j <=m;j++)
        {
            if(binary_search(dont.begin(),dont.end(),j))
                continue;
            cout << arr[i][j];
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){

  int W;
  int H;
  int x;
  int y;
  int r;

  cin >> W >> H >> x >> y >> r ;

  if(0<x && x<=(W-r) && 0<y && y<=(H-r)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
return 0;
}



Measured memory_bytes: 3092
let ans s =
  let n = String.length s in
  let rec count i ret =
    if i = n then ret
    else if s.[i] = 'p' then count (i+1) (ret+1)
    else count (i+1) ret in
  let p = count 0 0
  in n/2 - p;;

Scanf.scanf "%s" (fun s -> print_int (ans s))


Measured memory_bytes: 2688
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
int p[1100000];
pair<int,int>dp[1100000];
int main(){
	int a;scanf("%d",&a);
	printf("Christmas");
	for(int i=0;i<25-a;i++)printf(" Eve");
		printf("\n");
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll a, b;
    cin >> a >> b;
    if (b % 2 == 1)cout << "No" << endl;
    else if (b > a * 4)cout << "No" << endl;
    else if (b < a * 2)cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 3628
function main()
	N,M,Q=map(x->parse(Int,x),split(readline()))
	A=zeros(Int,Q)
	B=zeros(Int,Q)
	C=zeros(Int,Q)
	D=zeros(Int,Q)
	for i=1:Q
		A[i],B[i],C[i],D[i]=map(x->parse(Int,x),split(readline()))
	end
	ar=zeros(Int,N)
	function dfs(id)
		if id==N+1
			now=0
			for i=1:Q
				if ar[B[i]]-ar[A[i]]==C[i]
					now+=D[i]
				end
			end
			now
		else
			MIN=id==1 ? 1 : ar[id-1]
			now=0
			for K=MIN:M
				ar[id]=K
				now=max(now,dfs(id+1))
			end
			now
		end
	end
	println(dfs(1))
end
main()


Measured memory_bytes: 173608