akhauriyash/Code-Regression huggingface dataset:
N,M = map(int,input().split())
H = list(map(int,input().split()))
glaph = [[] for _ in range(N)]

for i in range(M):
  A,B = map(int,input().split())
  A -= 1
  B -= 1
  glaph[A].append(B)
  glaph[B].append(A)
  
ans = 0
for j in range(N):
  check = True
  for k in glaph[j]:
    if H[j] <= H[k]:
      check = False
      break
  if check:
    ans += 1
    
print(ans)

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

int main() {
	string str;
  cin >> str;
  if((str[2] == str[3]) && (str[4] == str[5])) {
		cout << "Yes" << endl;
	}	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 1000000007
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
long long go_back[300000] = {};
int union_find(int now) {
	if (now <= -1) return -1;
	if (go_back[now] == now) return now;
	return go_back[now] = union_find(go_back[now]);
}
int main() {
	iostream::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<pair<long long, long long>> next;
	REP(i, n) {
		long long a, b;
		cin >> a >> b;
		next.push_back(make_pair(b, a));
	}
	sort(next.begin(), next.end());
	for (int i = 0; i < m; ++i) {
		go_back[i] = i;
	}
	long long ans = 0;
	for (int i = next.size() - 1; i >= 0; --i) {
		long long geko = union_find(m - next[i].second);
		if (geko != -1) {
			ans += next[i].first;
			go_back[geko] = geko - 1;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2672
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll c[10005],deg[10005],val[10005],res;
void dfs(ll i,ll p,vector<vector<ll>> &v){
    for(ll j=0;j<v[i].size();j++)
    if(v[i][j]!=p){
        res+=min(val[i],val[v[i][j]]);
        dfs(v[i][j],i,v);
    }
}
void bfs(ll n,vector<vector<ll>> &v){
    set<ll> s;
    vector<ll> vis(n+1,0);
    ll k=1;
    for(ll i=1;i<=n;i++)
    if(deg[i]==1){
        s.insert(i);
        deg[i]--;
    }
    while(!s.empty()){
        set<ll> temp,jok;
        for(auto it=s.begin();it!=s.end();it++)
        vis[*it]=1;
        for(auto it=s.begin();it!=s.end();it++){
            ll i=(*it);
            for(ll j=0;j<v[i].size();j++)
            if(!vis[v[i][j]]){
                deg[v[i][j]]--;
                if(deg[v[i][j]]==1)
                temp.insert(v[i][j]);
                else if(deg[v[i][j]]==0){
                    temp.erase(v[i][j]);
                    jok.insert(v[i][j]);
                }
            }
            val[i]=c[k++];
        }
        for(auto it=jok.begin();it!=jok.end();it++)
        val[*it]=c[k++];
        s=temp;
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vector<vector<ll>> v(n+1);
    for(ll i=0;i<n-1;i++){
        ll a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    for(ll i=1;i<=n;i++)
    cin>>c[i];
    sort(c,c+n+1);
    bfs(n,v);
    dfs(1,0,v);
    cout<<res<<endl;
    for(ll i=1;i<=n;i++)
    cout<<val[i]<<" ";
}


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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
// #define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl

int main(){
	ll N,M;cin>>N>>M;
	// ote(N);ote(M);
	vector<pair<ll,ll>> AB;
	rp(i,N){
		ll a,b; cin>>a>>b;
		// cout<<a<<","<<b<<"\n";
		AB.emplace_back(a,b);
	}

	// for(auto e:AB){cout<<e.first<<","<<e.second<<"\n";}

	sort(AB.begin(), AB.end());

	// for(auto e:AB){cout<<e.first<<","<<e.second<<"\n";}

	ll yen = 0;
	rp(i,N){
		ll a,b; tie(a,b)=AB[i];
		// cout<<a<<","<<b<<"\n";
		ll c = min(M,b);
		yen += c*a;
		M-=c;
		if(M<=0)break;
	}
	ote(yen);
}


Measured memory_bytes: 2420
<?php

fscanf(STDIN, "%d", $str);
//$retsu = explode(" ", fgets(STDIN));

$arr = str_split($str);

if($arr[0] == $arr[1]){
  echo "Bad";
}elseif($arr[1] == $arr[2]) {
    echo "Bad";
}elseif ($arr[2] == $arr[3]) {
      echo "Bad";
}else{
  echo "Good";
}

Measured memory_bytes: 4728
n = int(raw_input())
i = 1
print "",
for i in range(1,n+1):
    x = i
    if x%3 == 0:
        print "%d" %i ,
    elif x%10 == 3:
        print "%d" %i ,
    else:
        while x != 0:
            x = x/10
            if x % 10 == 3:
                print "%d" %i ,
                break

Measured memory_bytes: 6436
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i=0;i<N;i++)  cin >> a[i];
  sort(a,a+N);
  reverse(a,a+N);
  
  int A=0,B=0;
  for (int i=0;i<(N+1)/2;i++) {
    A += a[2*i];
  }
  for (int i=0;i<N/2;i++) {
    B += a[2*i+1];
  }
  
  cout << A-B << endl;
}

Measured memory_bytes: 256
// DP

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

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

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

// 無限大の値
  const long long INF = 1LL << 60;

// DP テーブル
  long long dp[100010];

// DP テーブル全体を初期化 (最小化問題なので INF に初期化)
  for (int i = 0; i < 100010; ++i) dp[i] = INF;

// 初期条件
  dp[0] = 0;
  int power;

// ループ
  for (int i = 1; i <= n; i++) {
      power = 1;
      while(power <= i){
        chmin( dp[i], dp[i-power]+1 );
        power *= 6;
      }
      power = 1;
      while(power <= i){
        chmin( dp[i], dp[i-power]+1 );
        power *= 9;
      }
  }

// 解を得て出力
  cout << dp[n] << endl;
  
}

Measured memory_bytes: 4404
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<tuple>
#include<cassert>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

const int mod = pow(10, 9) + 7;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)   cin >> a[i];
    sort(a.begin(), a.end());

    for(int i = 1; i < n; ++i){
        if(a[i] == a[i - 1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
//const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main(){
    int x; cin >> x;
    reps(a,-5000,5000)reps(b,-5000,5000){
        if(a*a*a*a*a - b*b*b*b*b == x){
            cout << a << " " << b << endl;
            return 0;
        }
    }
}

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

using namespace std;
typedef long long int ll;

int dh[4] = {1,0,-1,0};
int dw[4] = {0,1,0,-1};

int main()
{
   int N,W;
   cin >> N >> W;
   vector<int>v(N),w(N);
   for(int i = 0; i < N; i++) cin >> v[i] >> w[i];
   vector<vector<int>>dp(N+1,vector<int>(W+1,0));
   for(int i = 0; i <= W; i++) dp[0][i] = 0;
   for(int i = 0; i < N; i++)
   {
       for(int j = 0; j <= W; j++)
       {
           if(j - w[i] >= 0) dp[i+1][j] = max(dp[i][j-w[i]] + v[i],dp[i][j]);
           else dp[i+1][j] = dp[i][j];
       }
   }
   cout << dp[N][W] << endl;
}


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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILE_WR freopen("../input.txt", "r", stdin);\
	freopen("../output.txt", "w", stdout);
#define deb(x)	cout << #x << " " << x << endl;
#define ll long long int

int main() {

	
	IOS

	int n;
	cin >> n;

	cout << ((n/500) * 1000 + ((n%500)/5) * 5) << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll N = 1e6 +9;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf= 1e14;
ll mod = 1e9+7;
ll powm(ll a, ll b) { ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main() {   
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
     
     ll t = 1;
     // cin>>t;
 
     while(t--){
          ll a,b;cin>>a>>b;
          ll g= __gcd(a,b);
          ll ans = (a*b)/g;
          cout<<ans;
     }
}         

Measured memory_bytes: 256
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

A,B = II()

import fractions
f = fractions.gcd(A,B)
f2 = A*B//f  
print(f2)

Measured memory_bytes: 66028
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int INF = 1000000007;

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

  int N, K;
  cin >> N >> K;
  int A[N];
  int ans = 0;
  rep(i, N){
    cin >> A[i];
    if(A[i] >= K) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
n = int(input())
s = str(input())
w = 0
e = s[1:n].count("E")
m = w + e
for i in range(n-1):
  if s[i] == "W":
    w = w + 1
  if s[i+1] == "E":
    e = e - 1
  if w + e < m:
    m = w + e
print(m)

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

// Bubble sort
int bubbleSort(int A[], int N) {
    int sw = 0;
    bool flag = true;
    for (int i = 0; flag; i++) { 
        flag = false;
        for (int j = N-1; j >= i+1; j--) {
            if (A[j] < A[j-1]) {
                swap(A[j], A[j-1]);
                flag = true;
                sw++;
            }
        }
    }
    return sw;
}

int main() {
    int A[100], N, sw;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    
    sw = bubbleSort(A, N);
    
    for (int i = 0; i < N; i++) {
        if (i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
    
    return 0;
}



Measured memory_bytes: 3072
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
li=[a,b,c,d,e]
li=sorted(li,key=lambda x:10 if x%10==0 else x%10)
print(li[0]+sum(map(lambda x:x+((10-x%10)if x%10 else 0),li[1:])))

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

vector<vector<long long>> dp;
vector<long long> w,v;

int main(void){
    long long sumV = 0,W;
    int N;
    cin >> N >> W;
    w = v = vector<long long>(N);
    
    for(int i=0;i<N;i++){
        cin >> w[i] >> v[i];
        sumV += v[i];
    }

    dp = vector<vector<long long>>(N+2,vector<long long>(sumV+2,10000000000));
    dp[0][0] = 0;
    for(int i=0;i<N;i++){
        for(long long vi=0;vi<=sumV;vi++){
            if(vi >= v[i]){
                dp[i+1][vi] = min(dp[i][vi],dp[i][vi-v[i]] + w[i]);
            }else{
                dp[i+1][vi] = dp[i][vi];
            }
        }
    }
    long long ans;
   
    for(long long vi = 0;vi<=sumV;vi++){
        if(dp[N][vi] <= W){
            ans = vi;
        }
    }
    

    cout << ans << endl;
    return 0;

}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    string s;cin >> s;
    ll ans = 0;
    ll cnt = 0;
    bool f = false;
    REP(i, s.size()) {
        if(s[i] == 'A') {
            if(f) cnt = 0;
            cnt++;
            f = false;
        }
        if(s[i] == 'B') {
            if(f) cnt = 0;
            f = true;
        }
        if(s[i] == 'C') {
            if(f) ans += cnt;
            else cnt = 0;
            f = false;
        }
    }
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 720
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

  static final int N = 100000;
  static final int K = 50000;
  static int n, k;
  static int w[], t[];

  public static boolean check_load(int limit) {
    int i, j;

    for (i=0; i<n; i++)
      if (limit < w[i]) return false;

    Arrays.fill(t, 0);
    i = j = 0;
    while (i<n && j<k) {
      if (t[j] + w[i] < limit) 
        t[j] += w[i++];
      else if (t[j] + w[i] == limit)
        t[j++] += w[i++];
      else
        j++;
    }

    return (i==n) ? true : false;
  }

  public static void main(String[] args) {
    int i;
    Scanner sc = new Scanner(System.in); 
    n = Integer.parseInt(sc.next());
    w = new int[n];
    k = Integer.parseInt(sc.next());
    t = new int[k];
    for (i=0; i<n; i++)
      w[i] = Integer.parseInt(sc.next());

    int l = 0, u = 0;
    for (i=0; i<n; i++) u += w[i];
    while (u-l > 1) {
      int m = (l+u)/2;
      if (check_load(m))
        u = m;
      else
        l = m;
    }
    System.out.println(u);
  }
}

Measured memory_bytes: 67996
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;

int main(){
  int k,a,b;cin >> k >> a >> b;
  for(int i=a;i<=b;++i){
    if(i%k == 0){cout << "OK" << endl;return 0;}
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <unordered_map>

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

using namespace std;

int main()
{
  int n;
  int l[10];
  cin >> n;
  REP(i, n)
  {
    cin >> l[i];
  }

  sort(l, l + n);
  int sum = 0;
  REP(i, n - 1)
  {
    sum += l[i];
  }

  if (l[n - 1] < sum)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1e9 + 7;




int main() {

	int a, b;
	cin >> a >> b;
	cout << a * b << endl;


}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
    using namespace std;
    #define el "\n"
    #define ll long long
    #define ull unsigned long long long
    #define pb push_back
    #define mp make_pair
    #define X first
    #define Y second
    #define M 1000000007
    #define all(v) v.begin(), v.end()
    int main() {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      ll a;
      cin>>a;
      string s;
      cin>>s;
      if(a<3200)cout<<"red"<<el;
      else cout<<s<<el;
      return 0;
    }


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    double v[100];
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }
    sort(v, v + N);
    double ans = v[0];
    for(int i = 1; i < N; i++){
        ans = (ans + v[i]) / 2;
    }
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

#[allow(dead_code)]
fn ext_gcd(a: i64, b: i64) -> (i64, i64, i64) {
    if b == 0 {
        (a, 1, 0)
    } else {
        let (g, x, y) = ext_gcd(b, a % b);
        (g, y, x - (a / b) * y)
    }
}
#[allow(dead_code)]
fn mod_inverse(n: u64, modulo: u64) -> u64 {
    let (_, inv, _) = ext_gcd(n as i64, modulo as i64);
    ((inv + modulo as i64) as u64 % modulo) % modulo
}
#[allow(dead_code)]
fn mod_factor(n: u64, modulo: u64) -> u64 {
    let mut fact = 1;
    for i in 1..=n {
        fact = fact * i % modulo;
    }
    fact
}
#[allow(dead_code)]
fn mod_combination(n: u64, r: u64, modulo: u64) -> u64 {
    if n < r {
        return 0;
    }
    let a1 = mod_factor(n, modulo);
    dbg!(a1);
    let a2 = mod_factor(r, modulo);
    let a3 = mod_factor(n - r, modulo);
    a1 * mod_inverse(a2 * a3 % modulo, modulo) % modulo
}

fn main() {
    input! {
        x: i64,
        y: i64,
    }
    if (2 * x - y) % 3 != 0 {
        println!("0")
    } else {
        let p = (2 * x - y) / 3;
        let m = (2 * y - x) / 3;

        if (p < 0) || (m < 0) {
            println!("0")
        } else {
            let ret = mod_combination((p + m) as u64, m as u64, 1000000007);
            println!("{}", ret);
        }
    }
}


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

#define int long long
#define ld long double

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i>b;i--)

#define pb push_back
#define mp make_pair
#define all(A) A.begin(),A.end()
#define allr(A) A.rbegin(),A.rend()
#define precise(i) fixed << setprecision(i)
#define fi first
#define se second

#define err() cout<<"\n==================================\n";
#define errA(A) for(auto i:A) cout<<i<<" "; cout<<"\n";
#define err1(a) cout<<#a<<" "<<a<<"\n";
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<"\n";
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<"\n";
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<"\n";

const int logN = 20;
const int M = 1000000007;
const int INF = 1e12;
#define PI 3.14159265;
const int N = 200005;

#define Pii pair<int,int>
#define Vi vector<int>
#define Vpii vector<Pii>

void solve()
{
       int n;
       cin>>n;
       if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9)
       {
              cout<<"hon";
       }
       else if(n%10==0 || n%10==1 || n%10==6 || n%10==8)
       {
              cout<<"pon";
       }
       else
       {
              cout<<"bon";
       }
}

int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)
    {
           solve();
    }
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(int i=0;i<p;i++)
#define ll long long

using namespace std;

int main(){

 ll int X,Y;
 cin >> X >> Y;

 if (Y%2!=0){
	 cout << "No";
	 return 0;
 }
 else{
	for(int i=0;i<=X;i++){
		if(i*4+(X-i)*2 == Y){
			cout << "Yes";
			return 0;
		}
		else{}
	}
 }
 cout << "No";












	return 0;

}



Measured memory_bytes: 3632
n,m=map(int,input().split())
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append((b, a))
l.sort()
ans=0
last=0
for b,a in l:
    if a>=last:
        ans+=1
        last=b
print(ans)

Measured memory_bytes: 17008
#include "iostream"
#include <math.h>
using namespace std;
 
int main(){
 
  int x,y,X;
  
  int N=100;
  
  cin >> X;
  
  while(1){

  for(int i=-1*N; i<=N; i++){
   for(int j=-1*N; j<=N; j++){
    
     if(pow(i,5)-pow(j,5) == X){
       x=i;
       y=j;
      break; 
     }
     
 
   	}
    
     	if(pow(x,5)-pow(y,5) == X){
	    	 break; 
    	 }
  	}
  
    
   if(pow(x,5)-pow(y,5) == X){
	     break; 
     }
    else N*=10;
    
  }
  cout << x << " " << y;
  
  return 0;
}

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

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

        if( (N / 100 == 7) || (N % 100) / 10 == 7 || (N % 10) == 7)
        {
                cout << "Yes" << endl;
        }
        else
        {
                cout << "No" << endl;
        }

        return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
void end_check_num(int i, int n);
void include3(int i,int x,int n)
{
	if (x % 10 == 3)
	{
		cout << " " << i;
		end_check_num(i, n);
		return;
	}
	x /= 10;
	if (x)
	{
		include3(i,x,n);
	}
	end_check_num(i, n);
}
void check_num(int i,int n)
{
	int x = i;
	if (x % 3 == 0)
	{
		cout << " " << i;
		end_check_num(i,n);
		return;
	}
	include3(i, x, n);
	
}

void end_check_num(int i, int n)
{
	if (++i <= n)
	{
		check_num(i,n);
		return;
	}
	cout << endl;
	exit(0);
}

int main()
{
	int n;
	cin >> n;
	int i = 1;
	check_num(i, n);
	cout << endl;
	return 0;
}

Measured memory_bytes: 3572
s=input()
n=len(s)
for i in range(n):
    if s[i]!=s[n-1-i]:
        print("No")
        exit()
harf=int((n-1)/2)
for i in range(harf):
    if s[i]!=s[harf-1-i]:
        print("No")
        exit()
print("Yes")

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

int n;
char s[1000][1000];
int lv[1000];
int f(int k,int l){
	char c=s[k][l];
	if('0'<=c&&c<='9')return c-'0';
	int r=(c=='+'?0:1);
	for(int i=k+1;i<n;i++){
		if(lv[i]==l+1)
			r=(c=='+'?
				r+f(i,l+1):
				r*f(i,l+1));
		if(lv[i]<=l)break;
	}
	return r;
}
int main(){
	while(scanf("%d",&n),n){
		for(int i=0;i<n;i++){
			scanf(" %s",s[i]);
			for(lv[i]=0;s[i][lv[i]]=='.';lv[i]++);
		}
		printf("%d\n",f(0,0));
	}
	return 0;
}


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

typedef long long ll;

const int mod = 1000000007;
const int Maxn = 2000005;

int fac[Maxn], inv[Maxn];

int toPower(int a, int p)
{
    int res = 1;
    while (p) {
        if (p & 1) res = ll(res) * a % mod;
        p >>= 1; a = ll(a) * a % mod;
    }
    return res;
}

int Inv(int x) { return toPower(x, mod - 2); }

int C(int n, int k)
{
    if (n < 0 || k < 0 || k > n) return 0;
    return ll(fac[n]) * inv[k] % mod * inv[n - k] % mod;
}

int Solve(int r, int c)
{
    int res = 0;
    for (int i = 0; i <= r; i++)
        res = (res + C(i + c + 1, i + 1)) % mod;
    return res;
}

int main()
{
    fac[0] = inv[0] = 1;
    for (int i = 1; i < Maxn; i++) {
        fac[i] = ll(i) * fac[i - 1] % mod;
        inv[i] = Inv(fac[i]);
    }
    int r1, c1, r2, c2; scanf("%d %d %d %d", &r1, &c1, &r2, &c2);
    int res = Solve(r2, c2);
    res = (res - Solve(r1 - 1, c2) + mod) % mod;
    res = (res - Solve(r2, c1 - 1) + mod) % mod;
    res = (res + Solve(r1 - 1, c1 - 1)) % mod;
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 15872
#include <cstdio>
#include <algorithm>
using namespace std;

long long pi[233333][2],pp[233333][2],pk[233333];

bool bj(int a,int b)
{
	return pi[a][0]<pi[b][0];
}

int main()
{
	long long n,d,at; scanf("%lld%lld%lld",&n,&d,&at); d=d*2;
	for(int i=1; i<=n; i++)
	{
		scanf("%lld%lld",&pi[i][0],&pi[i][1]);
		pk[i]=i;
	}
	sort(pk+1,pk+1+n,bj);
	long long p=0,k=1,sum=0;
	for(int i=1; i<=n; i++)
	{
		long long a=pk[i];
		while(k<=pp[0][0]&&pp[k][0]<pi[a][0])
		{
			p-=pp[k][1]; k++;
		}
		if(p*at<pi[a][1])
		{
			pp[0][0]++; long long xx;
			pp[pp[0][0]][0]=pi[a][0]+d;
			if((pi[a][1]-p*at)%at==0) pp[pp[0][0]][1]=(pi[a][1]-p*at)/at;
			else pp[pp[0][0]][1]=(pi[a][1]-p*at)/at+1;
			p+=pp[pp[0][0]][1]; sum+=pp[pp[0][0]][1];
		}
	}
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 8448
fn read<T: std::str::FromStr>() -> Vec<T>
where
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut b = String::new();
    std::io::stdin().read_line(&mut b).unwrap();
    b.split_whitespace()
        .map(|x| x.trim().parse::<T>().unwrap())
        .collect()
}

fn main() {
    let input = read::<u64>();
    let (a, b, t) = (input[0], input[1], input[2]);
    println!("{}", t / a * b);

}



Measured memory_bytes: 4352
S = input().rstrip()
a,b,c = 0,0,0
for i in range(3):
  if S[i] == "a":
    a += 1
  elif S[i] == "b":
    b += 1
  else:
    c += 1
print("Yes" if a == 1 and b == 1 and c == 1 else "No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 3e18+7
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i,N) cin >> A[i];


    bool flg = true;
    int ans = 0;
    for(int i=0;i<N;i++){
        while(i+1<N && A[i]==A[i+1]) ++i;

        if(i+1<N && A[i]<A[i+1]){
            while(i+1 < N && A[i] <= A[i+1]) ++i;
        }
        else if(i+1 < N && A[i] > A[i+1]){
            while(i+1 < N && A[i] >= A[i+1]) ++i;
        }
        ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#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 <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    vector<int> ans(n, m);
    for(int i=0; i<(n+2)/2; ++i)
        ans[i] = 0;

    cout << ans[0];
    for(int i=1; i<n; ++i)
        cout << ' ' << ans[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#include <climits>

#define DEBUG if(false)

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  int sum = 0;
  for(int i = 0; i < N; i++){
    cin >> a[i];
    sum += a[i] -1;
  }

  cout << sum;

  return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    s = input()

    R, G, B = [], [], []
    for i in range(n):
        if s[i] == 'R':
            R.append(i + 1)
        elif s[i] == 'G':
            G.append(i + 1)
        else:
            B.append(i + 1)

    lb = len(B)
    RB, GB, SB = set(R), set(G), set(B)
    ans = 0

    for i in R:
        for j in G:
            ans += lb
            if j + (j - i) in SB:
                ans -= 1

    for i in G:
        for j in B:
            if j + (j - i) in RB:
                ans -= 1

    for i in B:
        for j in R:
            if j + (j - i) in GB:
                ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


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

int a,b;
string s,u,t;

int main(){
	cin>>s>>t;
	cin>>a>>b;
	cin>>u;
	if(u == s){
		a--;
	}else{
		b--;
	}
	cout<<a<<" "<<b;
}


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

using namespace std;
#define ll long long
const int N = 2e3 + 2, MOD = 924844033;
int dp[N][N][2][2], F[N][N], fac[N] = {1};

int sum(int a, int b) {return a + b - (a + b >= MOD ? MOD : 0);}
int mul(ll  a, ll  b) {return a * b % MOD;}
int DP(int i, int j) {
    if (i < 0 || j < 0) return 0;
    int res = 0;
    for (int t = 0; t < 4; t++) res = sum(res, dp[i][j][t&1][(t>>1)&1]);
    return res;
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    for (int i = 1; i < N; i++) fac[i] = mul(fac[i - 1], i);
    int n, k; cin >> n >> k;
    dp[1][0][0][0] = dp[2][0][0][0] = dp[2][1][0][1] = dp[2][1][1][0] = dp[2][2][1][1] = 1;
    int m = (n + k - 1) / k;
    for (int i = 3; i <= m; i++) {
        dp[i][0][0][0] = 1;
        for (int j = 1; j <= i; j++) {
            dp[i][j][0][1] = sum(dp[i - 1][j - 1][0][0], dp[i - 1][j - 1][0][1]);
            dp[i][j][1][0] = sum(dp[i - 1][j - 1][0][0], dp[i - 1][j - 1][1][0]);
            dp[i][j][1][1] = DP(i - 2, j - 2);
            dp[i][j][0][0] = DP(i - 1, j);
        }
    }
    F[0][0] = 1;
    for (int i = 1; i <= k; i++) {
        int len = (n + k - i) / k;
        for (int j = 0; j <= len; j++)
            for (int s = j; s <= n; s++) F[i][s] = sum(F[i][s], mul(DP(len, j), F[i - 1][s - j]));
    }
    int ans = 0;
    for (int s = 0; s <= n; s++) {
        if (s&1) ans = sum(ans, MOD - mul(F[k][s], fac[n - s]));
        else ans = sum(ans, mul(F[k][s], fac[n - s]));
    }
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 42384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

int main(){
    ll n,a[100010],ans=0;
    cin>>n;
    fr(i,n) cin>>a[i];
    P b[100010];
    fr(i,n) b[i]=mp(a[i],i);
    sort(b,b+n);
    fr(i,n) if((i+b[i].sd)%2) ans++;
    cout<<ans/2<<endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	ll A, B; cin >> A >> B;
	int ans = 1;
	ll C = A, D = B;
	for (ll i = 2; i*i <= C && i*i <= D; i++) {
		if (A%i == 0 && B%i == 0) ans++;
		while (A%i == 0) A /= i;
		while (B%i == 0) B /= i;
	}
	if (A == B && A != 1) ans++;
	cout << ans << endl;

	return 0;
}

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

typedef long long ll;

int c(char x) {
  if (x == 'N') return 0;
  if (x == 'W') return 1;
  if (x == 'S') return 2;
  return 3;
}

int main() {
  string S;
  cin >> S;
  int cnt[4];
  fill(cnt, cnt+4, 0);
  for (auto x : S) {
    cnt[c(x)]++;
  }
  for (auto i = 0; i < 4; i++) {
    if (cnt[i] == 0 && cnt[(i+2)%4] > 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

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

int v, dp[5001];
const int m[] = {200, 300, 500, 1000, 1200, 1500};
const int p[] = {380, 550, 850, 1520, 1870, 2244};
const int INF = 10000000;

/*
  @ツ残ツづィツづ個重ツつウ
*/

int dfs(int w) {
  if (w <= 0) return 0;
  if (dp[w] >= 0) return dp[w];
  int res = INF;
  rep(i,6) {
    res = min(res, dfs(w-m[i]) + p[i]);
  }
  return dp[w] = res;
}

void solve() {
  cout<<dp[v]<<endl;
}

int main (int argc, char const* argv[]) {
  rep(i,5001) dp[i] = INF;
  
  dp[0] = 0;/*
  rep(z,6) for(int i=0;i+m[z]<5001;i++) {
    dp[i+m[z]] = min(dp[i+m[z]], dp[i] + p[z]);
  }*/
  rep(i,5001) rep(z,6) {
    if (i+m[z] >= 5001) continue;
    dp[i+m[z]] = min(dp[i+m[z]], dp[i] + p[z]);
  }

  while (cin>>v, v) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            decimal iD = decimal.Parse(sS[1]);
            List<ClsPos> lstPos = new List<ClsPos>();
            for (int i = 0; i < iN; i++)
            {
                sS = System.Console.ReadLine().Trim().Split(' ');
                ClsPos oneUsr = new ClsPos();
                oneUsr.iX = int.Parse(sS[0]);
                oneUsr.iY = int.Parse(sS[1]);
                //Boolean bEx = false;
                //for (int j = 0; j < lstPos.Count; j++)
                //{
                //    if (lstPos[j].iX == oneUsr.iX && lstPos[j].iY == oneUsr.iY) { lstPos[j].iC += 1; bEx = true; break; }
                //}
                //if (!bEx) { lstPos.Add(oneUsr); }
                lstPos.Add(oneUsr);
            }
            //// Debug入力
            //int iN = 200000;
            //decimal iD = 10;
            //List<ClsPos> lstPos = new List<ClsPos>();
            //for (int i = 0; i < iN; i++)
            //{
            //    ClsPos oneUsr = new ClsPos();
            //    oneUsr.iX = 1;
            //    oneUsr.iY = 1;
            //    lstPos.Add(oneUsr);
            //}

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = 0;
            for (int i = 0; i < lstPos.Count; i++)
            {
                decimal iDn = (decimal)Math.Sqrt(Math.Pow(lstPos[i].iX, 2) + Math.Pow(lstPos[i].iY, 2)); 
                if (iDn <= iD) { iOut += 1; }
            }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

        // 座標
        private class ClsPos
        {
            public int iX { get; set; } = 0;
            public int iY { get; set; } = 0;
        }

}


Measured memory_bytes: 53268
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

D,T,S = LI()

if S*T >= D:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 65464
#include<iostream>
#include "algorithm"
#include "bits/stdc++.h"
using namespace std ;
#define ll long long
int t;
ll a[200500];
int main(){
    cin>>t;
    for(int i=0;i<t;i++)
        scanf("%lld",&a[i]);
    sort(a,a+t);
    ll sum=a[t-1];
    int n=t-2;
    for(int i=t-2;i>=0;i--){
        if(n>=2) {
            sum += 2 * a[i];
            n-=2;
        }else if(n==1){
            sum+=a[i];
            n--;
        }
        if(n==0)
            break;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 5228
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <cassert>
using namespace std;

#define sz(a) int((a).size())
#define rep(i, s, n)  for(int i = s; i <= (n); ++i)
#define rev(i, n, s)  for(int i = (n); i >= s; --i)
#define fore(x, a) for(auto &&x : a)
typedef long long ll;
const int mod = 1000000007;
const int N = 100005;

int a[N];
int main() {
#ifdef loc
  if(!freopen((string(FOLDER) + "inp.txt").c_str(), "r", stdin)) {
    assert(0);
  }
  freopen((string(FOLDER) + "out.txt").c_str(), "w", stdout);
#endif
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  rep(i, 1, n) {
    cin >> a[i];
  }
  int ans = 0;
  for(int i=1; i<=n; ) {
    ans++; int start = a[i];
    while (i <= n && a[i] == start) i++;
    if (i > n) break;
    if (a[i] > start) {
      while (i <= n && a[i] >= a[i - 1]) i++;
    }
    else {
      while (i <= n && a[i] <= a[i - 1]) i++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  	int a,b,c,i,j;
  
	cin >> a >> b >> c;
  	cin >> i;
  
  for(j = 0; j < i; j++){
  	if(b >= c ){
    	c = c*2;
    }
  	else if(a >= b){
    	b = b*2;
    }
  	else{
    	//cout << "Yes" << endl;
      	break;
    }
  }
  if(a < b && b < c){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
   
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
string a, b;
int main() {
    cin >> a >> b;
    string c = a + b;
    int n = atoi(c.c_str());
    for(int i = 1; i < 1000; ++i) {
        if(i*i == n) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        if(a % 2 == 1 && i % 2 == 0) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
  std::vector<int> V(26,0);
  string W;
  std::cin >> W;
  for (size_t i = 0; i < W.size(); i++) {
    ++V[W[i]-97];
  }
  for (size_t i = 0; i < 26; i++) {
    if(V[i]%2==1){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}


Measured memory_bytes: 256
while True:
    a, b = map(int, raw_input().split())
    if a == b == 0: break
    ex = [0, a+b]
    for i in range(1, 5):
        a, b = map(int, raw_input().split())
        if ex[1] < a+b:
            ex = [i, a+b]
    else:
        if ex[0] == 0:
            print 'A', ex[1]
        elif ex[0] == 1:
            print 'B', ex[1]
        elif ex[0] == 2:
            print 'C', ex[1]
        elif ex[0] == 3:
            print 'D', ex[1]
        else:
            print 'E', ex[1] 

Measured memory_bytes: 4224
#include<stdio.h>
int N;int cnt=0;
void dfs(long long num,unsigned char flag357);
int main(){
	scanf("%d",&N);
	dfs(0,0);
	printf("%d\n",cnt);
	return 0;
}

void dfs(long long num,unsigned char flag357){
	if(num<=N){
		if(flag357==07)
			cnt++;
		dfs(num*10+3,flag357|01);
		dfs(num*10+5,flag357|02);
		dfs(num*10+7,flag357|04);
	}
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

int a,b,t;

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> a >> b >> t;

  cout << (t/a)*b << endl;


  return 0;
}


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

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

  int x[11][50];

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

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int norm = 0;
      for (int k = 0; k < d; k++) {
        int diff = abs(x[i][k] - x[j][k]);
        norm += diff * diff;
      }

      bool flag = false;
      for (int k = 0; k <= norm; k++) {
        if (k * k == norm) {
          flag = true;
        }
      }
      if (flag) {
        ans++;
      }
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    if(s[n-1]=='s'){
        cout<<s<<"es"<<endl;
    }else{
        cout<<s<<"s"<<endl;
    }
    return(0);
    }

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


// debug stream of pair, vector
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }


// debug stream of set, map
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



const int MAX = 2500;      // 素数判定する最大の数
bool IsPrime[MAX];
vector<int> Era(int n = MAX) {
    vector<int> res;
    IsPrime[0] = false; IsPrime[1] = false;
    for (int i = 2; i < n; ++i) IsPrime[i] = true;
    for (int i = 2; i < n; ++i) {
        if (IsPrime[i]) {
            res.push_back(i);
            for (int j = i*2; j < n; j += i) IsPrime[j] = false;
        }
    }
    return res;
}

int N;
vector<long long> a;
vector<int> prs;

long long calc(long long n) {
    long long res = 1;
    for (auto p : prs) {
        int num = 0;
        while (n % p == 0) ++num, n /= p;
        if (num == 0) continue;
        else if (num == 1) res *= p * p;
        else res *= p;
    }
    
    //COUT(res);
    
    long long left = 1, right = 1000000;
    while (right - left > 1) {
        long long mid = (left + right) / 2;
        if (mid * mid > n) right = mid;
        else left = mid;
    }
    
    //COUT(left);
    
    if (left * left == n) {
        res *= left;
        return res;
    }
    else {
        if (n > 1000000) return -1;
        res *= n * n;
        if (res > 10000000000LL) return -1;
        return res;
    }
}

long long solve() {
    int res = 0;
    prs = Era();
    map<long long, int> ma;
    for (int i = 0; i < N; ++i) {
        long long tmp = 1;
        for (auto p : prs) {
            int num = 0;
            while (a[i] % p == 0) ++num, a[i] /= p;
            num %= 3;
            for (int j = 0; j < num; ++j) tmp *= p;
        }
        tmp *= a[i];
        
        if (tmp == 1) res = 1;
        else ma[tmp]++;
    }
    
    //COUT(ma);
    
    
    for (auto it = ma.begin(); it != ma.end(); ++it) {
        long long val = it->first;
        long long aite = calc(val);
        
        //cout << val << ": " << aite << "(" << it->second << ", " << ma[aite] << ")" << endl;

        int tmp = max(it->second, ma[aite]);
        it->second = ma[aite] = 0;
        res += tmp;
    }
    return res;
}

int main() {
    while (cin >> N) {
        a.resize(N);
        for (int i = 0; i < N; ++i) cin >> a[i];
        cout << solve() << endl;
    }
}

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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  const int mx1 = 1000000;
  int mx = mx1;
  int ans = 0;
  for (int a = 1; a <= mx1; a++) {
    for (int b = mx; b > 0; b--) {
      if ((long long)a * b < n) {
        ans += b;
        mx = b;
        break;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3652