akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  string n;
  cin>>n;
  if(n[0]=='1')n[0]='9';
  else n[0]='1';
  if(n[1]=='1')n[1]='9';
  else n[1]='1';
  if(n[2]=='1')n[2]='9';
  else n[2]='1';
  cout(n);
  return 0;
}

Measured memory_bytes: 125568
n,m,q = map(int,input().split())
ans = 0
t = []
for _ in range(q):
    a,b,c,d = map(int,input().split())
    t += [(a,b,c,d)]

def score(l):
    ret = 0
    if len(l) == 0:
        for i in range(1, m+1):
            ret = max(ret, score([i]))
        return ret
    elif len(l) == n:
        for a,b,c,d in t:
            if l[b-1] -  l[a-1] == c:
                ret += d
        return ret
    else:
        for i in range(l[-1], m+1):
            ret = max(ret, score(l + [i]))
        return ret

print(score([]))

Measured memory_bytes: 9236
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int k, a, b;
	cin >> k >> a >> b;
	cout << (b / k - (a - 1) / k ? "OK" : "NG") << '\n';
}

Measured memory_bytes: 3668
"use strict";
function I(t, i) {
  (this._s = t.split("\n")), (this._c = 0), (this._l = 0), (this._f = i || Number);
}
(I.prototype.a = function(t) {
  var i = this._s[this._l];
  if (i) {
    var s = i.trim().split(" "),
      h = s[this._c];
    return this._c++, s.length === this._c && ((this._c = 0), this._l++), t ? t(h) : this._f(h);
  }
}),
  (I.prototype.l = function(t) {
    var i = this._s[this._l];
    if (i) return (this._c = 0), this._l++, i.split(" ").map(t || this._f);
  }),
  (module.exports = I);

function isOddDigit(num) {
  if (num < 10) return true; // 1
  if (num < 100) return false; // 2
  if (num < 1000) return true; // 3
  if (num < 10000) return false; // 4
  if (num < 100000) return true; // 5
  if (num < 1000000) return false; // 6
}

function main(input) {
  var o = new I(input);

  const N = o.a();

  let oddDigitCount = 0;
  for (let i = 1; i <= N; i++) {
    if (isOddDigit(i)) {
      oddDigitCount++;
    }
  }

  console.log(oddDigitCount);
}

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


Measured memory_bytes: 7500
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt(),k = scanner.nextInt();
		int result = k;
		for(int i=0;i<n-1;i++){
			result *= (k-1);
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 20820
def B():
    N = int(input())
    H = [int(i) for i in input().split()]
    if  not len(H) == N:
        exit()
    max_high = max(H)
    max_index = H.index(max_high)

    count = 0
    count += H.count(max_high)

    pmax = H[0]
    for i in range(max_index):
        if pmax <= H[i]:
            pmax = H[i]
            count += 1
        
    print(count)

if __name__ == '__main__':
    B()
    

Measured memory_bytes: 3060
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int main(){
    int n,m,tmp,ans;
    string j;
    set<int> ac;
    cin >> n>> m;
    int wa[n];
    ans = 0;
    rep(i,n+1){
        wa[i]=0;
    }

    rep(i,m){
        cin>>tmp>>j;
        if(j == "AC"){
            ac.insert(tmp);
            if(wa[tmp]!=-1){
                ans += wa[tmp];
                wa[tmp]=-1;
            }
        }else{
            if (wa[tmp]!=-1)
            {
                wa[tmp]++;
            }
        }
    }

    cout << ac.size() << " "<< ans; 
    return 0;
}

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

const double PI = 3.14159265359;
const int INF = (int)1e9;
const ll LINF = 1e18;
const int IMOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[5] = {0, 1, 0, -1};

using namespace std; 

int main(void)
{
    ll k,a,b;
    cin >> k >> a >> b;
    
    if(b-a > 2) {
        if(k < a+1) {
            cout << 1 + k << endl;
        } else {
            k -= a-1;
            ll ans = a + (b-a) * (k / 2);
            ans += k % 2;
            cout << ans << endl;
        }
    } else {
        cout << 1 + k << endl;
    }
    
    return 0;
}
/** atcoder **/



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

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    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: 3664
#include <bits/stdc++.h>
using namespace std;

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(long long N, std::vector<long long> a) {
  ll ret = 0;
  rep(i,N) ret += a[i]-1;
  cout << ret << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long N;
  std::cin >> N;
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    std::cin >> a[i];
  }
  solve(N, std::move(a));
  return 0;
}


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


int main() 
{
    int N;
    int a[100000];
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> a[i];

    bool res = false;
    int count = 1;

    int next = 1;

    while (1)
    {
        next = a[next-1];
        
        count++;
        if (next == 2) 
        {
            res = true;
            break;
        }     
        
        if (count == 100000)
            break;
    }

    if (res)
        cout << count-1;
    else
        cout << -1;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int n,i;
	scanf("%d",&n);
	int a[100];
	for(int i=0;i<n; i++){
			scanf("%d",&a[i]);
	}
	for(int i=0;i<n; i++){
		printf("%d",a[n-1-i]);
		if(i !=n-1){
			printf(" ");
	}
}

		printf("\n");
	

	return 0;
}

Measured memory_bytes: 2708
#include <stdio.h>
#include <math.h>

int main(void){
	long long int n;
	long long int ans=0;
	scanf("%lld", &n);
	
	if(n%2==1)	printf("0");
	else{
		for(int i=1; i <= (int)(log10l((long double)n/(long double)2.0)/log10l(5.0));i++){
			ans += (n-n%(long long int)(pow(5,i)*2) ) / (long long int)(pow(5,i)*2);
		}
      printf("%lld", ans);
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;


ll f(double a, double b, double x){
  ll res = (ll)(a*x/b) - (ll)a*(ll)(x/b);
  return res;
}

int main() {
  ll a,b;
  ll n;
  cin>>a>>b>>n;
  if( a == b){
    cout<<a-1<<endl;
  }
  else if(a<b){
    if(n<b){
      cout<<f(a,b,n)<<endl;
    }
    else if(n<=b){ cout<<f(a,b,n-1)<<endl;
    }
    else cout<<a-1<<endl;

  }
  else{
    ll ans =f(a,b,min(n,b-1));
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define pb push_back
typedef pair<ll,ll> pp;

ll mod = 1e9+7;
ll INF = 1e15;

ll powm(ll a , ll b , ll mod)
{
  ll res = 1;
  while(b)
  {
    if(b & 1)
    res = (res *a)%mod;
    a = (a*a)%mod;
    b>>1;
  }
  return res;
}
ll gcd(ll a , ll b);
ll power(ll x , ll y , ll m);

ll modInverse(ll a , ll m)
{
  ll g = gcd(a,m);
  if(g != 1)
  return 1;
  else
  return power(a,m-2,m);

}

ll power(ll x , ll y , ll m)
{
  if(y == 0)
  return 1;
  ll p = power(x , y/2 , m)%m;
  p = (p*p)%m;

  return (y%2 == 0) ? p : (x *p) % m;
}

ll gcd(ll a , ll b)
{
  if(a == 0)
  return b;
  return gcd(b%a , a);
}





void solve()
{
  ll n;
  cin>>n;
  set<string>s;
  string a;
  while(n--)
  {
    cin>>a;
    s.insert(a);
  }
  cout<<s.size()<<"\n";


}



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


Measured memory_bytes: 19256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e4+5;

int n, m;
int a[10];
vector<int> v={0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int cache[N][10];

int dp(int idx, int val)
{
	if(val==0)
		return 0;
	if(val<0 || idx==m+1)
		return -1e9;
	int &ans=cache[val][idx];
	if(ans!=-1)
		return ans;
	ans=max(dp(idx+1, val), 1 + dp(idx, val-v[a[idx]]));
	return ans;
}

int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		cin>>a[i];
	sort(a+1, a+m+1);
	int digits=dp(1, n);
	int rem=n;
	for(int i=1;i<=digits;i++)
	{	
		for(int j=m;j>=1;j--)
		{
			if(dp(1, rem-v[a[j]])==digits-i)
			{
				cout<<a[j];
				rem-=v[a[j]];
				break;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> s(m);
    for(int i = 0; i < m; i++)
    {
        int k;
        cin >> k;
        for(int j = 0; j < k; j++)
        {
            int a;
            cin >> a;
            s[i].push_back(--a);
        }
    }
    vector<int> p(m);
    for(int i = 0; i < m; i++)
    {
        cin >> p[i];
    }
    int ans = 0;
    for(int i = 0; i < (1<<n); i++)
    {
        bool flag = true;
        for(int j = 0; j < m; j++)
        {
            int tmp = 0;
            for(int k = 0; k < s[j].size(); k++)
            {
                int sw = s[j][k];
                if(i >> sw & 1) tmp++;
            }
            if(tmp % 2 != p[j]) flag = false;
        }
        if(flag) ans++;
    }
    cout << ans << endl;
}



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

void pri(int n, vector<int> &v) {
    for(int i=0;i<n;i++) {
        if(i) cout << " ";
        cout << v[i];
    }
    cout << "\n";
}

void insertion_sort(int n, vector<int> &v) {
    for(int i=0;i<n;i++) {
        for(int j=i-1;j>=0;j--) {
            if(v[j] > v[j+1])swap(v[j+1],v[j]);
        }
        pri(n,v);
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0;i<n;i++)cin >> v[i];
    insertion_sort(n,v);

    return 0;
}



Measured memory_bytes: 3064
function main(input){
  const lines = input.split('\n');
  const N = parseInt(lines.shift().split(' '));
  const ABC = lines.map(line => line.split(' ').map(x => parseInt(x)) );

//console.log(N);
//console.log(ABC);

  const DP = Array(3);
  DP[0] = Array(N).fill(Infinity);
  DP[1] = Array(N).fill(Infinity);
  DP[2] = Array(N).fill(Infinity);
  DP[0][0]=ABC[0][0];
  DP[1][0]=ABC[0][1];
  DP[2][0]=ABC[0][2];

  for(var i=1;i<N;i++){
    DP[0][i]=ABC[i][0] + Math.max(DP[1][i-1], DP[2][i-1]);
    DP[1][i]=ABC[i][1] + Math.max(DP[0][i-1], DP[2][i-1]);
    DP[2][i]=ABC[i][2] + Math.max(DP[0][i-1], DP[1][i-1]);
  }

//8+8+5+7+8+3+7
//8 16 21 28 36 39 46

//  console.log(DP);
  const result = Math.max(DP[0][N-1], DP[1][N-1], DP[2][N-1]);
  console.log(result);

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 58176
#include<bits/stdc++.h>
#define SIZE 55
 
using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
 
ll X[SIZE],Y[SIZE];
 
int main()
{
	int n;
	scanf("%d",&n);
	set <P> st;
	for(int i=0;i<n;i++)
	{
		scanf("%lld %lld",&X[i],&Y[i]);
		st.insert(P(X[i],Y[i]));
	}
	vector <P> vx;
	int ret=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(i==j) continue;
			P p=P(X[i]-X[j],Y[i]-Y[j]);
			int cnt=0;
			for(int k=0;k<n;k++)
			{
				P q=P(p.first+X[k],p.second+Y[k]);
				if(st.count(q)) cnt++;
			}
			ret=max(ret,cnt);
		}
	}
	printf("%d\n",n-ret);
	return 0;
}

Measured memory_bytes: 384
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,d=mp()
ans=0
for i in range(n):
    x,y=mp()
    if x**2+y**2<=d**2:
        ans+=1
print(ans)

Measured memory_bytes: 10468
//Pranet Verma
#include <bits/stdc++.h>
using namespace std;
int a[101];
int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    } 
    auto cost = [=](int v) {
        int c = 0;
        for (int i = 0; i < n; ++i) {
            c += (a[i] - v) * (a[i] - v);
        }
        return c;
    };
    int ans = 1e9;
    for (int i = -100; i <= 100; ++i) {
        ans = min(ans, cost(i));
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <list>

using namespace std;

int main(int argc, char const *argv[]) {
	unsigned int N, x_num;
	cin >> N;

	list<unsigned int> x;
	for(int i = 0; i<N; i++) {
		cin >> x_num;
		x.push_back(x_num);
	}

	list<unsigned int> tmp(x);
	x.sort();

	unsigned int counter = 0, one_before, one_after;
	for(auto itr = x.begin(); itr != x.end(); ++itr) {
		if(counter == N/2 - 1) {
			one_before = *itr;
			++itr;
			one_after = *itr;
			break;
		}
		counter++;
	}

	for(auto itr = tmp.begin(); itr != tmp.end(); ++itr) {
		if(*itr < one_before or *itr == one_before)
			cout << one_after << endl;
		else
			cout << one_before << endl;
	}


	return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

#ifdef OJ
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#else
#define debug(x)
#define debugv(x)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define sz(x) ((int)x.size())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return ;}while(0)

const int MOD = 1e9+7;
const int MAXN = 2e6+3;
const int INF = 1e9;

void solve() {
    int h,w,k; cin >> h >> w >> k;
    vector<string> s(h);
    fori(i,h) cin >> s[i];

    auto f = [&](int mh, int mw) {
        vector<string> q(h);
        fori(x,h) q[x] = s[x];
        fori(i,h) if((mh>>i) & 1) {
            fori(j,w) q[i][j] = '.';
        }
        fori(j,w) if((mw>>j) & 1) {
            fori(i,h) q[i][j] = '.';
        }
        int cnt = 0;
        fori(i,h) fori(j,w) cnt += q[i][j] == '#';
        return cnt;
    };

    int ans = 0;
    for(int mh = 0; mh < (1<<h); mh++) {
        for(int mw = 0; mw < (1<<w); mw++) { 
            if(f(mh,mw) == k) ans++;
        }
    }
    cout << ans << '\n';
} 

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int ntest = 1;
    //cin >> ntest;
    fori(test, ntest) {
        solve();
    }

    return 0;
}



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

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

    int g_flag = 0;
    int w_flag = 0;
    int p_flag = 0;
    int y_flag = 0;
    string str;
    for(int i = 0; i < n; i++){
        cin >> str;
        if(str == "P"){
            p_flag = 1;
        }
        else if(str == "W"){
            w_flag = 1;
        }
        else if(str == "G"){
            g_flag = 1;
        }
        else{
            y_flag = 1;
        }
    }

    int sum = p_flag + w_flag + g_flag + y_flag;
    if(sum == 3){
        cout << "Three" << endl;
    }
    else{
        cout << "Four" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <vector>

const int N = 26, D = 365;

using namespace std;
int main() {
    int d;
    cin >> d;
    vector<int> c(N);
    vector<vector<int>> s(D, vector<int>(N));
    for (int i = 0; i < N; ++i)
        cin >> c[i];
    for (int i = 0; i < d; ++i)
        for (int j = 0; j < N; ++j)
            cin >> s[i][j];
    vector<int> ans;
    double best = LLONG_MIN;
    for (int start = 0; start < N; ++start) {
        for (int second = 0; second < N; ++second) {
            double tot = s[0][start] + s[1][second];
            vector<int> last(N, 0), cans = {start + 1, second + 1};
            for (int i = 0; i < N; ++i) {
                if (i != start)
                    tot -= c[i];
                if (i != second) {
                    if (i == start)
                        tot -= c[i];
                    else
                        tot -= c[i] * 2;
                }
            }
            last[start] = 1;
            last[second] = 2;
            for (int i = 3; i <= d; ++i) {
                int maxt = 0;
                double maxg = LLONG_MIN;
                for (int j = 0; j < N; ++j) {
                    double gain = s[i - 1][j];
                    for (int k = 0; k < N; ++k)
                        if (k != j)
                            gain -= 1.2 * c[k] * (i - last[k]);
                    if (gain > maxg) {
                        maxg = gain;
                        maxt = j;
                    }
                }
                last[maxt] = i;
                cans.emplace_back(maxt + 1);
                tot += maxg;
            }
            if (tot > best) {
                best = tot;
                ans = cans;
            }
        }
    }
    for (int i : ans)
        cout << i << endl;
}


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

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

    ll sm = 0;
    for (int i=1; i<n+1; i++) {
        if (i%3 && i%5)
            sm += i;
    }
    cout << sm << "\n";
}


Measured memory_bytes: 3648
h,w=map(int,input().split())
pattern=[h//2+w//3+1,h//3+w//2+1,h,w]
if h%3==0 or w%3==0:
    pattern+=[0]
if h%2==0:
    pattern+=[h//2]
if w%2==0:
    pattern+=[w//2]
print(min(pattern))

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

//string型文字列をint型整数にして返す
int str_to_num(string s) {return atoi(s.c_str());}
//約数の総数を返す
int count_divisor(int n){int c[n/2] = {1}; int n_half = n/2; for(int i=2;i<n_half;i++){if(n%i==0){n /= i;c[i]+=1;i--;if(n>1) continue;else break;}  }int r = 1;for(int i=2;i<n_half;i++){r *= c[i];}return r;}
//各桁の数の和を返す
int dig_num(int n){return (n<10) ? n: dig_num(n/10) + n%10;}

int main(){
  int N; cin >> N;
  int p[N];
  REP(i,N){
    cin >> p[i];
  }
  
  int r = 0;
  for(int i=1;i<N-1;i++){
    if(p[i-1]<p[i]){
      if(p[i]<=p[i+1]){r++;}
    }else if(p[i+1]<p[i]){
      if(p[i]<=p[i-1]){r++;}
    }
  }
  
  cout << r << '\n';
}

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

using namespace std;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  
  char pre_ch = s[0];
  long long count = 0;
  long long tmp_count;
  bool seq = (s[0] == 'A');
  tmp_count = seq ? 1 : 0;
  for(int i = 1; i < n; i++){
    char ch = s[i];
    if(ch == 'A'){
      if(pre_ch != 'B')tmp_count++;
      else tmp_count = 1;
      seq = true;
    }else if(ch == 'B' && pre_ch == 'A'){
      seq = true;
    }else if(ch == 'C' && pre_ch == 'B' && seq){
      count += tmp_count;
    }else if(ch == 'B' && pre_ch == 'C' && seq){
      //pass
    }else{
      tmp_count = 0;
      seq = false;
    }
    pre_ch = ch;
  }
  
  cout << count << endl;
  
  return 0;
}


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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
#define ADD(a,b) a=((a)+(b))%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
char s[3535];
int rightmost[3535];

ll dp[3535][3535];

int sum1[3535];

int main(){
  scanf("%d%d",&n,&m);
  scanf("%s",s);
  REP(i,n)rightmost[i] = i;
  REP(i,m){
    int l,r;
    scanf("%d%d",&l,&r);
    --l;--r;
    CHMAX(rightmost[l],r);
  }
  sum1[0] = 0;
  REP(i,n)sum1[i+1] = sum1[i] + (int)(s[i]=='1');
  REP(i,n)CHMAX(rightmost[i+1],rightmost[i]);
  dp[0][sum1[rightmost[0]+1]] = 1;
  // REP(i,n+1)DEBUG(rightmost[i]);
  // REP(i,n+1)DEBUG(sum1[i]);
  // REP(i,n){
  //   DEBUG(sum1[rightmost[i+1]+1]);
  //   DEBUG(sum1[rightmost[i]+1]);
  //   DEBUG(sum1[rightmost[i+1]+1] - sum1[rightmost[i]+1]);
  // }
  REP(i,n)REP(j,n+1){
    // printf("[%d,%d] : %lld\n",i,j,dp[i][j]);
    int left = i;
    int free1 = j;
    int right = rightmost[i];
    int sz = right - i + 1;
    int nextright = rightmost[i+1];
    int add = sum1[nextright+1] - sum1[right+1];
    // choose 0
    if(sz-j > 0)ADD(dp[i+1][j-0+add], dp[i][j]);
    if(j>0)ADD(dp[i+1][j-1+add], dp[i][j]);
  }
  printf("%lld\n",dp[n][0]);
  return 0;
}


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

using namespace std;

const int N = 2222;
int n;
string c[N * 2];
int a[N * 2], p[N][2];
int f[2][N][2];

void upd(int &x, int y) {
  if (x == -1) x = y;
  else x = min(x, y);
}

int g[2][N * 2][N];

// sign:[1, ed), > val
int cnt(int sign, int ed, int val) {
  return g[sign][ed - 1][val + 1];
}


int main() {

  cin >> n;
  
  memset(g, 0x00, sizeof(g));

  for (int i = 1; i <= n * 2; ++i) {
    cin >> c[i] >> a[i];
    int sign = (c[i] == "W" ? 0: 1);
    p[a[i]][sign] = i;
    for (int j = i; j <= n * 2; ++j) {
      g[sign][j][a[i]]++;
    }
  }

  for (int sign = 0; sign < 2; ++sign) {
    for (int ed = 1; ed <= n * 2; ++ed) {
      for (int val = n - 1; val >= 1; --val) {
        g[sign][ed][val] += g[sign][ed][val + 1];
      }
    }
  }

  int x = 0, y = 1;

  memset(f[x], 0xff, sizeof(f[x]));

  f[x][1][0] = cnt(0, p[1][0], 1) + cnt(1, p[1][0], 0);
  f[x][1][1] = cnt(0, p[1][1], 0) + cnt(1, p[1][1], 1);

  for (int i = 2; i <= n * 2; ++i, swap(x, y)) {

    memset(f[y], 0xff, sizeof(f[y]));

    for (int j = 1; j <= n; ++j) {
      for (int k = 0; k < 2; ++k) {

        if (f[x][j][k] == -1) continue;

        int _j = (i - 1) - j;
        
        if (j + 1 <= n) upd(f[y][j + 1][k], f[x][j][k] + cnt(k, p[j + 1][k], j + 1) + cnt(k ^ 1, p[j + 1][k], _j));        

        if (_j + 1 <= n) upd(f[y][_j + 1][k ^ 1], f[x][j][k] + cnt(k, p[_j + 1][k ^ 1], j) + cnt(k ^ 1, p[_j + 1][k ^ 1], _j + 1));        
        
      

      }
    }

  }

  cout << min(f[x][n][0], f[x][n][1]) << endl;

  return 0;
}

Measured memory_bytes: 77696
N, X = map(int, input().split())

a = [1]
p = [1]
for i in range(N):
    a.append(2 * a[-1] + 3)
    p.append(2 * p[-1] + 1)


def f(n, x):
    if x == 1:
        if n == 0:
            return 1
        else:
            return 0
    elif x < a[n-1] + 2:
        return f(n-1, x-1)
    elif x == a[n-1] + 2:
        return p[n-1] + 1
    elif x < 2 * a[n-1] + 3:
        return f(n-1, x-a[n-1]-2) + p[n-1] + 1
    else:
        return p[n]

print(f(N, X))

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


/********************************************************************/
#define M1 1000000007
#define M2 998244353
#define ll long long
#define pll pair<ll,ll>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPR(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
/********************************************************************/
// const int mx = 1e7 + 5;
const double pi = 3.1415926535;
/********************************************************************/
//FAST IO//
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}


/********************************************************************/
int main() {
	FAST();
	ll a;
	double b;
	cin >> a >> b;
	if (a == 0 || b == 0)
		cout << 0;
	else {
		ll z = round( b * 100);
		ll ans = (a * z) / 100;
		cout << ans << endl;
	}
	return 0;
}

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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0)
#define int long long int
#define endl "\n"
#define N 200009
#define all(a) a.begin(), a.end()

int n;

int32_t main()
{
	IOS;
	cin>>n;

	cout<<(n*(n-1))/2<<endl;

}

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> v,vmin,vmax;
    rep(i,n){
        int a;
        cin >> a;
        v.push_back(a);
    }
    vector<int> org(n,0);
    vector<int> s = v;




    if(k < 1000){
    rep(j,k){
        v= s;
        s =org;
        vmin.clear();
        vmax.clear();
        rep(i,n){
            vmin.push_back(i-v[i]);
            vmax.push_back(i+v[i]);
        }

        vmin.push_back(1000000);
        vmax.push_back(1000000);
        sort(vmin.begin(),vmin.end());
        sort(vmax.begin(),vmax.end());
        // if(vmin[n-1]<0 &&vmax[n-1]>n-1 ){
        //     rep(i,n){
        //         s[i] += (n-1)* (k-j);
        //     }
        //     break;
        // }
        int value =0 ;
        int i = 0,mini = 0,maxi= 0;
        //i = max(0,vmin[0]);
        //s = org;
        while(i < n){
            if(i >= vmin[mini]){
                value++;
                mini++;
            }else if(i > vmax[maxi]){
                value --;
                maxi++;
            }else{
                s[i]=value;
                i++;
            }
            //cout << i  <<" " <<   value<< " " << mini << " " <<maxi << endl;
        }
    }
    }
    else{
        rep(i,n){
            s[i] = n;
        }
    }
    
    rep(i,n){
        cout << s[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 7612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N;
  ll K;
  int Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  vector<int> point(N);
  rep(i, Q) {
    cin >> A[i];
    point[A[i]-1]++;
  }
  rep(i, N) {
    if(K - Q + point[i] > 0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(void){
    string s;
    int n;
    cin >> n;
    cin >> s;
    
    int k = 0;
    for (int i = 0; i < s.size(); i++) {
        if (char(s[i]) == '.') k++;
    }
    
    int ans = k;
    for (int i = 0; i < s.size(); i++) {
        if (char(s[i]) == '.') k--;
        else k++;
        ans = min(k, ans);
        //cout << k << endl;
    }
    
    cout <<ans << endl;
    
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		long N = scn.nextInt();
		long[] arr = new long[(int) N];
		int zero = 0;
		for (int i = 0; i < N; i++) {
			arr[i] = scn.nextLong();
			if (arr[i] == 0) {
				zero++;
			}
		}
		if (zero != 0) {
			System.out.println(0);
		} else {
			long ans = 1;
			boolean check = true;
			for (int i = 0; i < N; i++) {
				if (checklong(ans, arr[i]) && ans * arr[i] <= 1000000000000000000L) {
					ans = ans * arr[i];
				} else {
					check = false;
					System.out.println(-1);
					break;
				}
			}
			if (check) {
				System.out.println(ans);
			}
		}
	}

	public static boolean checklong(long a, long b) {
		long c = a * b;
		if ((c / (a)) == b) {
			return true;
		}
		return false;
	}
}

Measured memory_bytes: 60968
#include <stdio.h>

int main(){
	int A,B,C;
	
	scanf("%d %d %d", &A, &B, &C);
	
	
	if (A == B && B == C){
		printf("No");
	}
	else if (A == B || A == C || B==C){
		printf("Yes");
	}
	else printf("No");
	
	return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        if(A + B >= 10){
            System.out.println("error");
        }else{
            System.out.println(A + B);
        }
	}
}

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

int main()
{   
    long long ans=0,i=0,j=0,a,b,x;
    cin>>a>>b>>x;
    
    ans=b/x-a/x;
    if(a%x==0)ans++;
    cout<<ans<<endl;
    

}

Measured memory_bytes: 256
/*
 *  Created on: 24-October-2019
 *      Author: ankur314
 */
#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define db double
#define ldb long double
#define vr vector
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb(n) push_back(n)
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007
#define INF 1000000005
 
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
 
using namespace std;

int dp[100005];
vector <int> g[100005];
bool vis[100005];
int ans;

int dfs(int u)
{
	vis[u] = true;
	int len = 0;
	int mx = 0;
	for(auto v : g[u])
	{
		if(!vis[v]) mx = max(mx,dfs(v));
		else mx = max(mx,dp[v]);
	}
	len = 1 + mx;
	ans = max(ans, len);
	return dp[u] = len;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n, m; cin>>n>>m;    
    fi(i,0,m)
    {
    	int x, y;
    	cin>>x>>y;
    	g[x].pb(y);
    }
    memset(dp, 0, sizeof(dp));
    memset(vis, false, sizeof(vis));
    ans = 0;
    fi(i,1,n+1)
    {
    	if(!vis[i])
    	{
    		dfs(i);
    		// cout<<i<<" "<<ans-1<<"\n";
    	}
    }
    cout<<ans-1;
    return 0;
}

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

int main() {
  int S;
  cin >> S;
  if (((S % 100 <= 12) && (S % 100 > 0)) && ((S / 100 <= 12) && (S / 100 > 0)))
    cout << "AMBIGUOUS";
  else if ((S / 100 <= 12) && (S / 100 > 0))
    cout << "MMYY";
  else if ((S % 100 <= 12) && (S % 100 > 0))
    cout << "YYMM";
  else 
    cout << "NA";
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import scipy as sp

def main():
    while True:
        try:
            il = [input() for i in range(3)]
            N = int(il[0])
            S = il[1]
            K = int(il[2])

            res = ''.join(['*' if s != S[K-1] else s for s in S])

            print(res)


        except:
            break

if __name__ == '__main__':
    main()


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

using namespace std;

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

Measured memory_bytes: 256
#include<stdio.h>
#define NIL (2e9+1)
#define N 2000000

int A[N];

int left(int i){
  return 2 * i;
}

int right(int i){
  return 2 * i + 1;
}

void maxHeapify(int i,int H){
  int l,r,largest,temp;
  l = left(i);
  r = right(i);
  if(l <= H && A[l] > A[i]){
    largest = l;
  }else{
    largest = i;
  }
  if(r <= H && A[r] > A[largest]){
    largest = r;
  }

  if(largest != i){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
    maxHeapify(largest,H);
  }
}

int main(){
  int H,i;
  scanf("%d",&H);

  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }

  for(i=H/2;i>=1;i--){
    maxHeapify(i,H);
  }

  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 3636
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll(x);cin >> (x);
#define stin(x) str(x);cin >> (x);
#define vllin(x,n) vll(x)(n);FOR(i,0,n-1){cin >> (x)[i];}
#define vllin2(a,b,n) vll(a)(n);vll(b)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vllin3(a,b,c,n) vll(a)(n);vll(b)(n);vll(c)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >> (x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vpl4in(x,n) vpl4(x)((n),mp(0,0));FOR(i,0,n-1){cin >> x[i].fi >> x[i].se;}
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define rFOR(i,b,a) for(ll i=a;i>=b;i--)
#define SORT(x) sort(x.be,x.en)
#define rSORT(x) sort(x.rbegin(),x.rend())
#define say(x) cout << (x);
#define sal(x) cout << (x) << endl;
#define says(x) cout << (x) << (' ');
#define sas cout << (' ');
#define sayR(x) cout << fixed << setprecision(10) << (x);
#define salR(x) cout << fixed << setprecision(10) << (x) << endl;
#define yn(a) cout << ((a) ? "yes" : "no") << endl;
#define Yn(a) cout << ((a) ? "Yes" : "No") << endl;
#define YN(a) cout << ((a) ? "YES" : "NO") << endl;
#define Imp(a) cout << ((a) ? "Possible" : "Impossible") << endl;
#define IMP(a) cout << ((a) ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll MOD = 1000000007;

vvll ds(501,vll(501,-1));
vvll d(501,vll(501,0));

ll solve(ll l,ll r){
    if(l<=r){
        if(ds[l][r]+1) return ds[l][r];
        return ds[l][r]=solve(l+1,r)+solve(l,r-1)-solve(l+1,r-1)+d[l][r];
    }else{
        return 0;
    }
}

signed main()
{
    llin(n);
    llin(m);
    llin(q);
    vllin2(l,r,m);
    vllin2(pl,pr,q);
    FOR(i,0,m-1){
        d[l[i]][r[i]]++;
    }
    FOR(i,0,q-1){
        sal(solve(pl[i],pr[i]))
    }
}

Measured memory_bytes: 9600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc165_b
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = double.Parse(Console.ReadLine());
            double a = 100; //銀行預金100円
            int answer = 0; //何年後にX円を上回る

            while (a < X)
            {
                a = Math.Truncate(a * 1.01);
                answer ++;
            }

            Console.WriteLine(answer);

            Console.Read();
        }
    }
}


Measured memory_bytes: 27568
mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))

#累積和のリストを作成
S = [0]*(N+1)
ans = 0
for i in range(N):
    S[i+1] = A[i] + S[i]%mod

#累積和って感じですね
for i in range(N):
    sum = S[N] - S[i + 1]
    if sum < 0:
        sum += mod
    ans += A[i] * sum

print(ans % mod)

Measured memory_bytes: 104780
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define inf 0x3f3f3f3f
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	for(int i=1;i<=5;i++){
		int x;
		cin >> x;
		if(x==0){
			cout << i << '\n';
		}
	}
}

Measured memory_bytes: 3576
#include<stdio.h>
int main()
{
  int h, w, i, j;

  while(1){
    scanf("%d%d", &h, &w);

    if(h == 0 && w == 0) break;

    for(i=1; i<=h; i++){
      for(j=1; j<=w; j++){

	if(i%2 == 0){
	  if(j%2 == 0) printf("#");
	  else printf(".");
	  
	}
	
	else{
	  if(j%2 == 0) printf(".");
	  else printf("#");
	}
      
      }
      
      printf("\n");
      
    }

    printf("\n");

  }

  return 0;

}

Measured memory_bytes: 572
a,b,c,d=map(int,input().split())

x=0
if c%b!=0:
    x=c//b+1
else:
    x=c//b

y=0
if a%d!=0:
    y=a//d+1
else:
    y=a//d

if x<=y:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9064
//BISMILLAHHIR RAHMANIR RAHIM
#include<bits/stdc++.h>
using namespace std;
typedef long long int            ll;
typedef unsigned long long int   ull;
#define min3(a,b,c)              min(a,min(b,c))
#define F                        first
#define S                        second
#define PB                       push_back
#define MP                       make_pair
#define PI                       2*acos(0.0)
int main()
{
    ll w,h,x,y;
    bool ok=false;
    cin>>w>>h>>x>>y;
    if(x+x==w && y+y==h){
        ok=true;
    }
    cout<<double(w)*double(h)/2.0<<" "<<ok<<endl;
    return 0;
}


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

using namespace std;

int main()
{  int n, a, b, c;
    cin >> n;
    if ((n <= 999) && (n >= 100))
    {
    a = n % 10;
    n = n - a;
    b = n / 100;
    n = n - (b * 100);
    c = n / 10;
    if ((a == 7) || (b == 7) || (c == 7))
        cout << "Yes";
    else
        cout << "No";
    }
}





Measured memory_bytes: 3596
import bisect
for e in iter(input,'0'):
 n=int(e)
 c=[sorted(int(input())for _ in[0]*n)]
 c+=[sorted(set(range(1,2*n+1))-set(c[0]))]
 t=f=0
 while 1:
  l=len(c[t])
  if l<1:break
  x=bisect.bisect(c[t],f)
  f=c[t].pop(x)if x<l else 0
  t^=1
 for i in[1,0]:print(len(c[i]))


Measured memory_bytes: 5652
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
#define ll long long 
#define jaldi_chal  ios_base::sync_with_stdio(0); cin.tie(0);
#define tr(c,i) for(auto i=(c).begin(); i != (c).end(); i++)
#define REP(i,k) for( ll i=0;i<k;i++)
#define REW(i,a,b) for(ll i=a;i<=b;i++)
#define M 1000000007
#define F first
#define dbg(x)  cout<<#x<<" " <<x<<endl;
#define S second
#define inf 1e10
#define endl "\n"


int main() {
jaldi_chal
ll n,m;
cin>>n>>m;
ll ans=0;
ans=(n*(n-1))/2+(m*(m-1))/2;
cout<<ans;


	return 0;
}

Measured memory_bytes: 256