akhauriyash/Code-Regression huggingface dataset:
// abc165_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int N, M, Q;
vector<int> A;
vector<int> a, b, c, d;
ll ans = 0;

void dfs(){

    if (A.size() == N){
        ll tmp = 0;
        REP(i, Q){
            if (A[b[i]] - A[a[i]] == c[i]){
                tmp += d[i];
            }
        }
        ans = max(tmp, ans);
        return ;
    }

    int d = A.size() == 0 ? 1 : A.back();
    REPN(i, d, M+1){
        A.emplace_back(i);
        dfs();
        A.pop_back();
    }
}

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    cin >> N >> M >> Q;

    a.assign(Q, 0);
    b.assign(Q, 0);
    c.assign(Q, 0);
    d.assign(Q, 0);
    REP(i, Q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--; b[i]--;
    }

    dfs();
    print(ans);


    return 0;
}


Measured memory_bytes: 3664
#include<cstdio>
#include<string>
#include<vector>
#include<fstream>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<cwctype>
#include<algorithm>
#include<math.h>

using namespace std;


int data[10];

bool searchB (int a){
	vector<int >sea;

	for(int i=0;i<10;i++){
		if(a>>i & 1)sea.push_back(data[i]);
	}
	if(sea.size()>1){
	for(int i=0;i<sea.size()-1;i++){
		if(sea[i]>sea[i+1])return false;
	}
	}
	return true;
}

int main(){

	int n=0;
	cin>>n;

	for(int i=0;i<n;i++){
		

	for(int j=0;j<10;j++){
		cin>>data[j];
	}
	bool suc=false;
	for(int i=0;i<1024;i++){
		if(searchB(i) && searchB(~i)){
			cout<<"YES"<<endl;
			suc=true;
			break;
		}
	}
	if(!suc)cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <stdio.h>
int main(void){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		int sum=a+b;
		int digit=1;
		while(sum>9){
			sum/=10;
			digit++;
		}
		printf("%d\n",digit);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <vector>
#include <stdint.h>
#include <algorithm>
#include <set>
#include <map>
#include <array>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <string>
#include <assert.h>
#include <iterator>
#include <cstdint>
#include <cinttypes>
#include <string.h>
#include <random>
#include <numeric>
#include <tuple>


using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::min;
using std::abs;
using std::max;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define pb push_back
#define eb emplace_back


int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    // code here.
    int cnt[3] = {0, 0, 0};
    for (char ch: input<string>())
        cnt[ch - 'a'] += 1;

    int mn = min(cnt[0], min(cnt[1], cnt[2]));
    int mx = max(cnt[0], max(cnt[1], cnt[2]));

    if (mx > mn + 1)
        cout << "NO\n";
    else
        cout << "YES\n";
    
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << 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; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	char a, b;
	cin >> a >> b;
	if (a < b) dump("<");
	if (a > b) dump(">");
	if (a == b) dump("=");
}


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

int main() {
	int n;
	cin>>n;
	int d[n];
	int c[101];
	for(int i=0;i<=100;i++){
		c[i]=0;
	}
	for(int i=0;i<n;i++){
		cin>>d[i];
		c[d[i]]=1;
	}
	int ans=0;
	for(int i=0;i<=100;i++){
		if(c[i]) ans++;
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
N , L = map(int,input().split())
apple = []
for i in range(1,N+1):
    apple.append(L+i-1)
for j in range(N):
    if apple[j] == 0:
        print(sum(apple))
        break
    elif apple[-1] < 0:
        print(sum(apple) - apple[-1])
        break
    elif apple[0] > 0:
        print(sum(apple)-apple[0])
        break


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

signed main() {
  int n,i;
  i = 1;
  while(true){
    cin >> n;
    if(n==0) break;
    cout << "Case " << i++ << ": " << n << endl;
    if(cin.eof()) break;
  }
  return 0;
}


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n),b(n);
  rep(i,0,n){
    cin>>a[i]>>b[i];
    if(a[i]!=b[i])judge=false;
  }
  if(judge){
    cout<<0<<endl;
    return 0;
  }
  res=0,buf=INF;
  rep(i,0,n){
    res+=a[i];
    if(a[i]>b[i])chmin(buf,b[i]);
  }
  cout<<res-buf<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
        int main()
{
        int  x;
        cin>>x;
        int  h=x/3600;
        int  m=(x/60)%60;
        int  s=x%60;
        cout<<h<<":"<<m<<":"<<s<<endl;
        return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define IO std::ios::sync_with_stdio(false),cin.tie(0)

using namespace std;

int main() {
	int cnt = 0;
	int l, r, d;
	cin >> l >> r >> d;
	for(int i = l ;i <= r; i++) 
		if(i % d == 0) cnt++;
		
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <fstream>
#include <string>
#include <bitset>
#include <stack>
#include <map>

using namespace std;

int d;

int is_int_dist(vector<int> a, vector<int> b) {
	long double distance = 0.0;
	for (int i = 0; i < d; i++) distance += pow(a[i] - b[i], 2);
	distance = sqrtl(distance);
	return floor(distance) == ceil(distance);
}

int main() {
	int n;
	vector<vector<int>> points;
	cin >> n >> d;
	for (int i = 0; i < n; i++) {
		vector<int> point;
		for (int j = 0; j < d; j++) {
			int tmp;
			cin >> tmp;
			point.push_back(tmp);
		}
		points.push_back(point);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ans += is_int_dist(points[i], points[j]);
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int D;
	scanf("%d", &D);
	int c[26], s[D][26], last[26], ans[D];
	for (int i = 0; i < 26; ++i) scanf("%d", &c[i]);
	for (int i = 0; i < D; ++i) {
		for (int j = 0; j < 26; ++j) scanf("%d", &s[i][j]);
	}
	int bst = 0, ok = 0;
	for (int h = 0; h < 13; ++h) {
		fill_n(last, 26, -1);
		int sav = 0;
		for (int i = 0; i < D; ++i) {
			int x = 0, opt = 0;
			for (int j = 0; j < 26; ++j) {
				if (c[j] * (i - last[j] + h) + s[i][j] > x) x = c[j] * (i - last[j] + h) + s[i][j], opt = j;
			}
			sav += c[opt] * (i - last[opt]);
			last[opt] = i;
		}
		if (sav > bst) bst = sav, ok = h;
	}
	for (int i = 0; i < D; ++i) {
		int x = 0, opt = 0;
		for (int j = 0; j < 26; ++j) {
			if (c[j] * (i - last[j] + ok) + s[i][j] > x) x = c[j] * (i - last[j] + ok) + s[i][j], opt = j;
		}
		last[opt] = i;
		ans[i] = opt;
	}
	for (int i = 0; i < D; ++i) printf("%d\n", ans[i] + 1);
	return 0;
}

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

int main() {
	int M, D;
	cin >> M >> D;
	if (D < 22) {
		cout << 0 << endl;
	}
	else {
		int ans = 0;
		for (int i = 22; i <= D; i++) {
			int d1 = i / 10;
			int d2 = i % 10;
			if (d2 < 2) continue;
			if (d1 * d2 <= M) ans++;
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

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

	string s;
	cin >> s;
	
	int ans1 = 0, ans2 = 0;
	
	for(int i = 0; i < s.length(); i++) {
		if(i & 1) {
			if(s[i] != '0') ans1++;
			if(s[i] != '1') ans2++;
		}
		else {
			if(s[i] != '1') ans1++;
			if(s[i] != '0') ans2++;
		}
	}

	cout << min(ans1, ans2);

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod1 1000000007
#define ff first
#define ss second
#define INF 1e9
#define INFLL 1e18
typedef long long int ll;
// #define intLL unsigned long long int//used when x<2^64-1 && x>0
#define int long long//used when x<2^63-1
int fact[200005];
int power(int a, int b)
{
    int res=1;
    while(b)
    {
        if(b&1)
        {
            res*=a;
            res%=mod1;
        }
        a*=a;
        a%=mod1;
        b/=2;
    }
    return res;
}
int add(int a, int b)
{
    return (0LL+a+b)%mod1;
}
int sub(int a, int b)
{
    return add(a, mod1-b);
}
int mul(int a, int b)
{
    return (1LL*a*b)%mod1;
}
int inv(int x)
{
    return power(x, mod1-2);
}
int nCr(int n, int r)
{
    return mul(fact[n], inv(mul(fact[r], fact[n-r])));
}
int cmp(const pair<int, int> &a, const pair<int, int> &b)
{
    return (a.ff>b.ff);
}
int32_t main()
{

    IOS;
    int k;
    cin>>k;
    queue<int> Q;
    for(int i=1;i<=9;i++)
        Q.push(i);
    int ans;
    for(int i=0;i<k;i++)
    {
        ans=Q.front();
        Q.pop();
        if(ans%10!=0)
            Q.push(ans*10+ans%10-1);
        Q.push(ans*10+ans%10);
        if(ans%10!=9)
            Q.push(ans*10+ans%10+1);
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 1792
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    ll N,M;
    cin >> N>>M;
    cout <<(N*(N-1)+M*(M-1))/2<< endl;
    return 0;    
}

Measured memory_bytes: 256
import heapq
n, m = (int(i) for i in input().split())
h = []
for v in input().split():
    v = -int(v)
    heapq.heappush(h, v)

for i in range(m):
    v = - heapq.heappop(h)
    heapq.heappush(h, -int(v / 2))

print(-sum(h))

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

int read(){
    int x=0;bool f=0;char c=getchar();
    while(c<'0'||c>'9') f|=c=='-',c=getchar();
    while(c>='0'&&c<='9') x=x*10+(c^48),c=getchar();
    return f?-x:x;
}

#define MAXN 200000
int N;
long long K;
int A[MAXN+5],F[MAXN+5];

bool Check(long long expt){
    long long Sum=0;
    for(int i=1;i<=N;i++){
        if((long long)A[i]*F[i]>expt)
            Sum+=((long long)A[i]*F[i]-expt+F[i]-1)/F[i];
    }
    return Sum<=K;
}

int main(){
    N=read();
    scanf("%lld",&K);
    for(int i=1;i<=N;i++)
        A[i]=read();
    for(int i=1;i<=N;i++)
        F[i]=read();
    sort(A+1,A+N+1);
    sort(F+1,F+N+1,greater<int>());
//    for_each(A+1,A+N+1,[=](int x){printf("%d ",x);});
//    puts("");
//    for_each(F+1,F+N+1,[=](int x){printf("%d ",x);});
//    puts("");
    long long Left=0,Right=(long long)A[N]*F[1]+1;
    while(Left+1<Right){
        long long Mid=(Left+Right)>>1;
        if(Check(Mid))
            Right=Mid;
        else
            Left=Mid;
    }
    printf("%lld",Check(Left)?Left:Right);
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <ctype.h>

int
main (
  int   argc,
  char *argv[ ]
  )
{
  for ( ; ; )
  {
    const int ch = getchar ( );

    putchar ( islower ( ch ) ? toupper ( ch )
            : isupper ( ch ) ? tolower ( ch )
            : ch );

    if ( ch == '\n' ) break ;
  }

  return ( 0 );
}

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

int main(void)
{
	int N;
	int W, H;
	int x, y;
	int S, T;
	int field[101][101];
	int i, j;
	int max, cnt;
	
	while (1){
		scanf("%d", &N);
		if (N == 0){
			break;
		}
		
		scanf("%d%d", &W, &H);
		
		memset(field, 0, sizeof(field));
		for (i = 0; i < N; i++){
			scanf("%d%d", &x, &y);
			field[y][x]++;
		}

		scanf("%d%d", &S, &T);

		for (y = 1; y <= H; y++){
			for (x = 1; x <= W; x++){
				field[y][x] += field[y][x - 1];
//printf("[%d]", field[y][x]);
			}
//printf("\n");
		}
		
		max = 0;
		for (y = 1; y <= H - T + 1; y++){
			for (x = 1; x <= W - S + 1; x++){
				cnt = 0;
				for (i = y; i <= y + T - 1; i++){
					cnt += (field[i][x + S - 1] - field[i][x - 1]);
				}
				if (max < cnt){
					max = cnt;
				}
//printf("<%d, %d=%d>", x, y, cnt);
			}
		}
		
		printf("%d\n", max);
	}
	return (0);
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#define PB push_back
using namespace std;
typedef unsigned long long int ll;
typedef vector <int> vi;
int main()
{
	long double D,T,S;
	scanf("%Lf %Lf %Lf",&D,&T,&S);
	if(D/S <= T)printf("Yes");
	else printf("No");
    return 0;
}


Measured memory_bytes: 3876
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	set<char> data;
	string s;

	cin >> s;
	char a = s[0];
	char b = s[1];
	char c = s[2];

	data.insert(a);
	data.insert(b);
	data.insert(c);

	int ans = data.size();
	//cout << ans << endl;

	if (data.size() == 3)cout << "Yes" << endl;
	else cout << "No" << endl;

}

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

int main() {
  long long a,b,k,aa,bb;
  cin >> a >> b >> k;
  if(a-k <= 0){
    aa = 0;
    if(b-(k-a) <= 0){
      bb = 0;
    }
    else{
      bb = b-(k-a);
    }
  }
  else{
    aa = a-k;
    bb = b;
  }
  cout << aa << " " << bb << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int a,b;
  char op;
  for( ; ; )
    {
  scanf("%d %c %d",&a,&op,&b);
  
  switch(op){
  case '+':
    printf("%d\n",a+b);
    break;
  case '-':
    printf("%d\n",a-b);
    break;
  case '*':
    printf("%d\n",a*b);
    break;
  case '/':
    printf("%d\n",a/b);
    break;
  }
  if (op=='?'){break;}
    }
    return 0;
}

Measured memory_bytes: 600
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        ++$this->pointer;

        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int) $this->next();
    }

    public function nextDouble()
    {
        return (float) $this->next();
    }
}

$sc = new Scanner();
$n = $sc->nextInt();
$array = [];

for($i=1;$i<$n+1;$i++){
    $array[$i] = $sc->nextInt();
}   

asort($array);
$flag = false;

foreach($array as $key=>$value){
    if($flag){
        echo " ";
    }
    echo $key;
    $flag = true;
}

echo PHP_EOL;

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

int main()
{
	long long n,tmp,sum=0,ans=0;
	map<long long,int> m;
	cin >> n;
	m[0]++;
	for(int i=0;i<n;i++){
		cin >> tmp;
		sum+=tmp;
		ans+=m[sum];
		m[sum]++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12800
n = gets.to_i
a = gets.split.map &:to_i

cnt = 0
n.times do |i|
  mini = i
  i.upto(n - 1) do |j|
    mini = j if a[j] < a[mini]
  end
  if i != mini
    cnt += 1
    a[i], a[mini] = a[mini], a[i]
  end
end

puts a.join(" ")
puts cnt


Measured memory_bytes: 6868
x=input().split()
n=int(x[0])
m=int(x[1])
p=[]
ref=[]
for k in range(m):
  x=input().split()
  p.append(int(x[0]))
  ref.append(x[1])
first=[-1]*(n+1)
penal=[0]*(n+1)
for k in range(m):
  if first[p[k]]!=-1:
    continue
  prob=p[k]  
  if ref[k]=='AC':
    first[prob]=k
  else:
    penal[prob]+=1
pb=0
pen=0
for k in range(n+1):
  if first[k]!=-1:
    pb+=1
    pen+=penal[k]
print(pb,pen)    
  
    

Measured memory_bytes: 18120
a = int(input())
b = int(input()) 
c = int(input()) 
d = int(input()) 
e = int(input()) 

if a%10!=0:
	a0 = a + ( 10 - a%10 )
else:
	a0 = a


if b%10!=0:
	b0 = b + ( 10 - b%10 )
else:
	b0 = b  
    
if c%10!=0:
	c0 = c + ( 10 - c%10 )
else:
	c0 = c
  
if d%10!=0:
	d0 = d + ( 10 - d%10 )
else:
	d0 = d
  
  
if e%10!=0:
	e0 = e + ( 10 - e%10 )
else:
	e0 = e


if a%10 != 0:
    a1 = 10 - a%10
else:
  	a1 = 0
    
if b%10 != 0:
    b1 = 10 - b%10
else:
  	b1 = 0
    
if c%10 != 0:
    c1 = 10 - c%10
else:
  	c1 = 0
    
if d%10 != 0:
    d1 = 10 - d%10
else:
  	d1 = 0
    
if e%10 != 0:
    e1 = 10 - e%10
else:
  	e1 = 0

l = max([a1, b1, c1, d1, e1])
	

print(a0+b0+c0+d0+e0-l)

Measured memory_bytes: 3064
#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
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
  string S;
  cin >> S;
  ll a = 0;
  ll s = S.size();
  rep(i,s){
    if(S[i] == 'A'){
    a = i;
      break;
    }
  }
  ll z = 0;
  for(int i = s - 1;i >=0;i--){
    if(S[i] == 'Z'){
    z = i;
    break;
    }
  }
  cout << z - a + 1 << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
	int a,b,c,d,e;
	
	scanf("%d",&a);
	scanf("%d",&b);
	if(a>b){
		a=b;
	}
	scanf("%d",&c);
	if(a>c){
		a=c;
	}
	scanf("%d",&d);
	scanf("%d",&e);
	if(d>e){
		d=e;
	}
	printf("%d\n",a+d-50);
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>

using namespace std;

int main() {
  int64_t N, K;
  cin >> N >> K;
  vector<int> A(N);
  copy_n(istream_iterator<int>(cin), N, A.begin());

  vector<int> reached(N, -1);
  int64_t i = 0;
  int64_t cnt = 0;
  reached[0] = 0;
  do {
    ++cnt;
    i = A[i] - 1;
    if (reached[i] != -1) break;
    reached[i] = cnt;
  } while (cnt < K);
  if (cnt < K) {
    int64_t L = (K - reached[i]) % (cnt - reached[i]);
    for (int64_t j = 0; j < L; ++j) {
      i = A[i] - 1;
    }
  }
  cout << (i + 1) << endl;
  return 0;
}


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

int main()
{
    int n;
    cin >> n;

    int ret = 100000;
    for(int i=0; i<n; ++i){
        (ret /= 100) *= 105;
        if(ret % 1000 > 0){
            ret /= 1000;
            ++ ret;
            ret *= 1000;
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 0
h,w=map(int,input().split())
li=[]
for i in range(h):
    li.append(str(input()))
for i in range(h):
    for j in range(w):
        if li[i][j]=="#":
            jud=0
            if j>0 and li[i][j-1]=="#":
                jud+=1
            if j<w-1 and li[i][j+1]=="#":
                jud+=1
            if i>0 and li[i-1][j]=="#":
                jud+=1
            if i<h-1 and  li[i+1][j]=="#":
                jud+=1         
            if jud==0:
                print("No")
                exit()
print("Yes")                
    

Measured memory_bytes: 3064
K, S = map(int, input().split())


OK = 0
for x in range(K+1):
    if(0<=S-x & S-x<=2*K): # 計算の成立条件
        if(S-x<=K): # yとzの和がk以下
            OK += S-x+1
        else: # yとzの和がk以上
            OK += (K-((S-x)-K))+1
print(OK)

Measured memory_bytes: 2940
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

// N, E, S, W
const int dx[4] = { 1, 0, -1, 0};
const int dy[4] = { 0, 1, 0, -1};

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;

//==============================================
const LL MOD = 1000000007;
LL m, n;

LL solve() {
	LL r = 1;

	while (n != 0) {
		if (n & 1) r = (r * m) % MOD;
		m = (m * m) % MOD;
		n >>= 1;
	}

	return r;
}

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

	cin >> m >> n;
	cout << solve() << "\n";
	return 0;
}

Measured memory_bytes: 3184
function Main(input) {
    input = input.split('\n');
    var lines = input[0].split('').map(Number);
    var r = 0;
    lines.forEach(l => {
        if (l === 1) {
            r++
        }
    })
    console.log(r);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
int lowbit(int x) {return x&-x;}
int n;
void work() {
    for(int i=2;i+1<=n;i+=2)
	{
	    cout<<i+n+1<<' '<<i<<'\n';
	    cout<<i<<' '<<1<<'\n';
	    cout<<1<<' '<<i+1<<'\n';
	    cout<<i+1<<' '<<i+n<<'\n';
	}
    cout<<n+1<<' '<<n+2<<'\n';
    if(!(n&1))
	{
	    int x=1;
	    while(x+x<=n) x<<=1;
	    cout<<(x+1)<<' '<<n<<'\n';
	    cout<<(x^n)<<' '<<n+n<<'\n';
	}
}
int main()
{
    cin>>n;
    if(lowbit(n)==n) cout<<"No"<<'\n';
    else
	{
	    cout<<"Yes"<<'\n';
	    work();
	}
    return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<cassert>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	double R;
	cin >> R;
	double ans = 2 * R * PI;
	printf("%.10f", ans);
}


Measured memory_bytes: 3784
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_INPUT_SIZE  1024

int
main(int argc, char* argv[])
{
    char input[MAX_INPUT_SIZE];

    fgets(input, sizeof(input), stdin);
    
    char *tok  = strtok(input, " ");
    int width  = atoi(tok);
    int height = atoi(strtok(NULL, ""));

    int area   = width * height;
    int length = width * 2 + height * 2;

    printf("%d %d\n", area, length);

    return 0;
}

Measured memory_bytes: 956
arr=[0]*4
for _ in range(int(input())):
    s=input()
    if s=='AC':
        arr[0]+=1
    elif s=='WA':
        arr[1]+=1
    elif s=='TLE':
        arr[2]+=1
    else:
        arr[3]+=1
print("AC x",arr[0])
print("WA x",arr[1])
print("TLE x",arr[2])
print("RE x",arr[3])

Measured memory_bytes: 9092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

void solve(){
    ll d,t,s;
    cin>>d>>t>>s;
   if(t*s >= d)
    cout<<"Yes"<<'\n';
    else
    {
        cout<<"No\n";
    }
    
}
int main(){
    IOS;
    int tt;
    tt = 1;
    // cin>>tt;
    while(tt--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n; string a,b,c;
    cin>>n>>a>>b>>c;
    int ans=0;
    rep(i,n){
        if(a[i]!=b[i]){
            ans++;
        }
        if(b[i]!=c[i]){
            ans++;
            if(c[i]==a[i]){
                ans--;
            }
        }
    }
    cout<<ans<<endl;
}


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

int main(){
  int n;  cin >> n;
  string ans = "Yes";
  int nowh = 0, noww = 0, nowt = 0;
  while(n--){
    int t, w, h;  cin >> t >> w >> h;
    int s = t - nowt - abs(w-noww) - abs(h-nowh);
    if(s >= 0 && s%2 == 0)
      noww = w, nowh = h, nowt = t;
    else
      ans = "No";
  }

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


Measured memory_bytes: 3580
#include <stdio.h>
int main(void)
{
    long long a,b,c,d,max;
    scanf("%lld",&a);
    scanf("%lld",&b);
    scanf("%lld",&c);
    scanf("%lld",&d);
    max=a*c;
    if ((max)<(a*d))
        max=a*d;
    if ((max)<(b*c))
        max=b*c;
    if ((max)<(b*d))
        max=b*d;
    printf("%lld",max);
    return 0;
}

Measured memory_bytes: 1732
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    string  S[1000];
    int poi[1000];
    int moto[1000];
    int N;
    cin>>N;
    for(int i=1;i<=N;i++){
        cin>>S[i]>>poi[i];
        moto[i]=i;
    }
    for(int i=1;i<N;i++){
        for(int j=1;j<N;j++){
            if(S[j]>S[j+1]||(S[j]==S[j+1]&&poi[j]<poi[j+1])){
                swap(S[j],S[j+1]);
                swap(poi[j],poi[j+1]);
                swap(moto[j],moto[j+1]);
            }
        }
    }
    for(int i=1;i<=N;i++){
        cout<<moto[i]<<endl;
    }
    return 0;
}


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

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            double X = double.Parse(Console.ReadLine());
            double yokin = 100;

            int counter = 0;

            while(yokin < X)
            {
                double risi = Math.Floor(yokin * 0.01);
                yokin += risi;
                ++counter;

                if(yokin >= X)
                {
                    Console.WriteLine(counter);
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 27560
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <tuple>
using ll = long long;
using namespace std;
vector<int> v;
int main(void)
{
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i)
    {
        int a;
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i = 0; i < N; ++i)
    {
        if (i == N - 1)
            ans += v[i] / 2;
        else
            ans += v[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#dの正解
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=list(input())

score={'r':P,'s':R,'p':S}

ans=0
for i in range(K):
  ans += score[T[i]]

for i in range(K,N):
  if T[i-K] == T[i]:
    T[i] = '*' #god hands
  else:
    ans += score[T[i]]

print(ans)



Measured memory_bytes: 4084
module WeightedGraph
  (* 辺の重み *)
  (Weight : sig
    type t
    val zero : t
    val ( + ) : t -> t -> t
    val compare : t -> t -> int
  end)
  (* 辺の重みを優先度としたヒープの実装 *)
  (Heap : sig
    type t
    type elt (* 頂点に相当 *)
    type key = Weight.t (* 辺の重みに相当 *)
    (* ヒープが空ならNoneを，
       そうでなければ重みが最小となるbindingを一つ返す
       返したbindingはヒープから削除される *)
    val take_min_binding : t -> (key * elt) option
    (* ヒープにbindingを追加する
       既に同じ頂点についてのbindingが追加されていたら，
       重みが小さい方だけを残しても良いし，何も考えずに追加してもよい．
       前者の実装ならプリム法の実装が時間計算量O((V + E) log V)，
       空間計算量O(V)に改善する *)
    val add : t -> key -> elt -> unit
  end)
  (* 頂点を添字，辺の重みを要素とした配列の実装 *)
  (Array : sig
    type t
    type key = Heap.elt
    type elt = Heap.key
    val get : t -> key -> elt
    val set : t -> key -> elt -> unit
  end)
: sig
  type weight = Array.elt
  type vertex = Array.key

  (* プリム法で最小全域木を求める *)
  val minimum_spanning_tree :
    (* 空なヒープ *)
    Heap.t ->
    (* 全ての頂点について無限大で初期化された配列 *)
    Array.t ->
    (* 最小全域木を求めたいグラフの，ある頂点から伸びる辺に対してのイテレータ *)
    (vertex -> (vertex -> weight -> unit) -> unit) ->
    (* 頂点の一つ（これは必ず最小全域木に含まれる） *)
    vertex ->
    (* 最小全域木に含まれる辺の重みの総和 *)
    weight
end
= struct
  type weight = Array.elt
  type vertex = Array.key

  let minimum_spanning_tree q d es s =
    let rec prim acc u =
      Array.set d u Weight.zero;
      es u (fun v w ->
        if 0 < Weight.compare (Array.get d v) w then
          (Array.set d v w; Heap.add q w v));
      prim' acc
    and prim' acc =
      match Heap.take_min_binding q with
      | None -> acc
      | Some (w, u) ->
          if 0 < Weight.compare w (Array.get d u)
          then prim' acc
          else prim (Weight.( + ) acc w) u in
    prim Weight.zero s
end

module Int = struct
  type t = int
  let zero = 0
  let ( + ) = ( + )
  let compare = compare
end

module IntMap = Map.Make (Int)

module G = WeightedGraph (Int)
  (struct
    type t = int list IntMap.t ref
    type key = int
    type elt = int
    let take_min_binding q =
      match IntMap.min_binding !q with
      | exception Not_found -> None
      | (w, [v]) -> q := IntMap.remove w !q; Some (w, v)
      | (w, v :: vs) -> q := IntMap.add w vs !q; Some (w, v)
    let add q w v =
      q := IntMap.add w (v :: try IntMap.find w !q with Not_found -> []) !q
  end)
  (struct
    type t = int array
    type key = int
    type elt = int
    let get = Array.get
    let set = Array.set
  end)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let xys = Array.init n @@ fun _ ->
    Scanf.scanf "%d %d\n" @@ fun x y -> [| x; y |] in
  let es = Array.make n [] in
  let is = Array.init n @@ fun i -> i in
  for d = 0 to 1 do
    Array.sort (fun i j -> compare xys.(i).(d) xys.(j).(d)) is;
    for j = 0 to n - 2 do
      let i = is.(j) in
      let i' = is.(j + 1) in
      let c = min (abs (xys.(i).(0) - xys.(i').(0))) (abs (xys.(i).(1) - xys.(i').(1))) in
      es.(i) <- (i', c) :: es.(i);
      es.(i') <- (i, c) :: es.(i')
    done
  done;
  Printf.printf "%d\n" @@
  G.minimum_spanning_tree (ref IntMap.empty) (Array.make n max_int)
    (fun i f -> List.iter (fun (j, w) -> f j w) es.(i)) 0


Measured memory_bytes: 41216
a=int(input())
seqS=input().split(" ")
num=[]
for q in seqS:
    num.append(int(q))
contador=0

#primeiro
#if num[0] > num[1]:
    #contador+=1

for i in range(1,len(num)-1):
    if num[i-1] > num[i] and num[i] > num[i+1] or num[i-1] < num[i] and num[i] < num[i+1]:
        contador+=1

#ultimo
#if num[-1] > num[-2]:
    #contador+=1
print(contador)


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


int main()
{
    int n,m;
    std::vector<long long> a;
    std::vector<long long> b;
    std::cin>>n;
    for(int i = 0; i < n; i++)
    {
        int hoge;
        std::cin>>hoge;
        a.push_back(hoge);
    }
    std::cin>>m;
    for(int i = 0; i < m; i++)
    {
        int hoge;
        std::cin>>hoge;
        b.push_back(hoge);
    }
    int check = 0;
    for(int i = 0; i < m; i++)
    {
        if (binary_search(a.begin(),a.end(), b[i])){check++;}
    }
    if(check==m)
    {
        std::cout<<1<<std::endl;
    }else
    {
        std::cout<<0<<std::endl;
    }
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, tmp;
	ll res = 0;
	vector<int> v,c;
	cin >> n;
	for ( int i = 0 ; i < n ; i++ ){
		cin >> tmp;
		v.push_back(tmp);
	}

	for ( int i = 0 ; i < n ; i++ ){
		cin >> tmp;
		c.push_back(tmp);
	}

	for ( int i = 0 ; i < n ; i++ ){
		res += v[i] > c[i] ? v[i] - c[i] : 0;
	}

	cout << res << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <queue>

using namespace std; using ll=long long; using ld=long double; using P=pair<ll,ll>; const int INF=1e9; const ll LINF=1e18;

int main(){
  int n; cin>>n;
  ll an=1; for(int i=0;i<n;i++) an*=3;
  ll h=1;
  for(int i=0;i<n;i++) {
    int a; cin>>a;
    if (a%2==0) h*=2;
  }
  an-=h;
  cout<<an<<endl;
}

Measured memory_bytes: 256
/* be name khoda */

#define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

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

const ll maxn = 200010;

ll n, A[maxn], k;

ll poww(ll a, ll b) {
    ll r = 1;
    while (b) {
        if (b & 1) Mul(r, a);
        Mul(a, a);
        b >>= 1;
    }
    return r;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    // ifstream cin(".in");

    cin >> n >> k;
    fori (i, n) cin >> A[i];
    sort(A, A + n, [](ll a, ll b) {return abs(a) > abs(b);});
    ll ans = 1;
    ll t = 0;
    fori (i, k) Mul(ans, A[i] + MOD), t += A[i] < 0;
    if (t % 2 && k < n) {
        bool flag = true;
        fori (i, n) if (A[i] > 0) flag = false;
        if (flag) {
            reverse(A, A + n);
            ans = 1;
            fori (i, k) Mul(ans, A[i] + MOD);
        } else {
            ll pos1 = INF, neg1 = INF, pos2 = -INF, neg2 = -INF;
            fori (i, k) {
                if (A[i] < 0) smin(neg1, -A[i]);
                else smin(pos1, A[i]);
            }
            forifrom (i, k, n) {
                if (A[i] < 0) smax(neg2, -A[i]);
                else smax(pos2, A[i]);
            }
            if (pos1 < INF && neg2 > -INF && neg2 * neg1 > pos2 * pos1) {
                ans = ans * (MOD - neg2) % MOD * poww(pos1, MOD - 2) % MOD;
            } else if (neg1 < INF && pos2 > -INF) {
                ans = ans * pos2 % MOD * poww(MOD - neg1, MOD - 2) % MOD;
            }
        }
    }
    cout << ans << '\n';

}


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

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

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == ',') { cout << " "; }
		else { cout << s[i]; }
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "../benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353

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

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	int n,q;
	ll m;
	cin>>n>>m>>q;
	vector<pii> dif;
	UF uf(n);
	rep(i,q){
		int a,b,c;
		cin>>a>>b>>c;
		if(c){
			dif.eb(a,b);
		}else{
			uf.unite(a,b);
		}
	}
	auto yes=[]{ cout<<"Yes"<<endl; exit(0);};
	auto no=[]{ cout<<"No"<<endl; exit(0);};
	for(pii p:dif)if(uf.findSet(p.X,p.Y)) no();
	ll cc=0;
	rep(i,n)if(uf.root(i)==i) ++cc;
	if(dif.size() && cc<=2) no();
	ll mn=(dif.size()?n:n-1);
	ll mx=n-cc+(cc*(cc-1)/2);
	if(mn<=m && m<=mx){
		yes();
	}else{
		no();
	}
  return 0;
}


Measured memory_bytes: 1784