akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		if(a*b > c*d){
			System.out.println(a*b);
		} else {
			System.out.println(c*d);
		}
	}
}




Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
int main()
{
	ll summ,i,j;
	ll dp[2001] = {0};
	
	cin>>summ;
	
	dp[0] = 1;
	for(i = 3;i <= summ;i++)
	{
		for(j = 3;j <= i;j++)
		{
			dp[i] = (dp[i] + dp[i-j])%M;
		}
	}
	cout<<dp[summ];
	return 0;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <unordered_map>
typedef long long lld;
const int MAXN = 2e5+5;
std::unordered_map<int,int> cnt;
int A[MAXN];
int N;

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A[i]);
  }
  cnt.reserve(N);
  lld ret = 0LL;
  for (int i = 1; i <= N; ++i) {
    int key = i - A[i];
    if (cnt.count(key)) {
      ret += cnt.at(key);
    }
    ++cnt[A[i] + i];
  }
  printf("%lld\n", ret);
  return 0;
}

Measured memory_bytes: 11536
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;
int main(void){
    int n;
    cin >> n;
    int A[n];
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    
    vector<int> G;
    
    int i=0;
    while(true){
        i++;
        if((pow(3,i)-1)/2<=n){
            G.push_back((pow(3,i)-1)/2);
        }else{
            break;
        }
    }
    cout << G.size() << endl;
    
    int cnt=0;
    for(int j=G.size()-1;j>=0;j--){
        if(j!=0){
            cout << G[j] << " ";
        }else{
            cout << G[j] << endl;
        }
        for(int k=G[j];k<n;k++){
            int v = A[k];
            int l = k - G[j];
            while(l>=0 and A[l] > v){
                A[l+G[j]] = A[l];
                l = l-G[j];
                cnt++;
            }
            A[l+G[j]] = v;
        }
    }
    cout << cnt << endl;
    
    for(int j=0;j<n;j++){
        cout << A[j] << endl;
    }
    
}



Measured memory_bytes: 7156
import bisect
import operator
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

P, Q, R = list(map(int, sys.stdin.readline().split()))

print(P + Q + R - max(P, Q, R))


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    double a_angle = 2 * acos(-1) * ((double)h + (double)m / (double)60) / (double) 12;
    double b_angle = 2 * acos(-1) * (double)m / (double)60;

    cout << fixed << setprecision(20) << sqrt(a * a + b * b - 2 * a * b * cos(abs(a_angle - b_angle))) << endl;
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n, m;
  cin >> n >> m;
  vll a(n);
  rep(i,n) cin >> a[i];
  vll v(n);
  ll sum = 0LL;
  rep(i,n) {
    sum += a[i];
    sum %= m;
    v[i] = sum;
  }
  map<ll,ll> mp;
  rep(i,n) mp[v[i]]++;
  mp[0LL]++;
  ll ans = 0LL;
  for(auto p : mp) {
    ll k = p.second;
    ans += k*(k-1)/2;
  }
  cout << ans << endl;
  return 0;
}

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

// macros
#define overload_rep(_1, _2 ,_3 ,name, ...) name
#define re_p(i, n) for(int i = 0; i < (n); ++i)
#define r_ep(i, x, y) for(int i = (x); i <= (y); ++i)
#define rep(...) overload_rep(__VA_ARGS__, r_ep, re_p)(__VA_ARGS__)
#define all(a) a.begin(), a.end()
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif

// functions
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; }
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
    cerr << ' ' << head;
    debug_cerr(tail...);
}
template<typename T>
vector<T> make_v(size_t a, T b){ return vector<T>(a, b); }
template<typename... Ts>
auto make_v(size_t a, Ts... ts){
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

// cin/cout setup
struct IoSetup{
    IoSetup(){
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} iosetup;

// libraries

// declarations
int N, K;
int A[5000];
int sum[5001];
bitset<5000> dp1[5000], dp2[5000];

// solve
int main(){

    cin >> N >> K;
    rep(i, N)cin >> A[i];

    dp1[0][0] = 1;
    rep(i, N - 1)dp1[i + 1] = dp1[i] | (dp1[i] << A[i]);
    dp2[N - 1][0] = 1;
    for(int i = N - 1; i > 0; i--)dp2[i - 1] = dp2[i] | (dp2[i] << A[i]);

    int ans = 0;
    rep(i, N){
        memset(sum, 0, sizeof(sum));
        rep(j, K){
            if(dp1[i][j])sum[j + 1]++;
            sum[j + 1] += sum[j];
        }
        rep(j, K){
            if(dp2[i][j]){
                int lb = max(0, K - j - A[i]);
                int ub = K - j;
                if(lb >= ub)continue;
                if(sum[ub] - sum[lb] > 0){
                    ans++;
                    j = K;
                    break;
                }
            }
        }
    }

    cout << N - ans << '\n';
    return 0;

}


Measured memory_bytes: 6528
import sys
import copy
from collections import deque
import collections
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

cnt = 0
for i in range(n):
    if (i+1)%2==1:
        if a[i]%2==1:
            cnt += 1

print(cnt)

Measured memory_bytes: 68240
#include <iostream>

using namespace std;

int main(void) {
	int n; cin >> n;
	int res = 0;
	for (int i = 0; i < n; i++) {
		int tmp; cin >> tmp;
		if (i + 1 != tmp) res++;
	}

	if (res <= 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def mi():
    return map(int, input().split())

def main():
    A, B, K = mi()
    cnt = 0
    for i in range(min(A, B), 0, -1):
        if A%i == 0 and B%i == 0:
            cnt += 1
            if cnt == K:
                print(i)
                return

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}

void solve(){
	string s;
	cin>>s;
	if(s=="Sunny")cout<<"Cloudy";
	else if(s=="Cloudy")cout<<"Rainy";
	else cout<<"Sunny";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 764
#include<cstdio>
#include<algorithm>
char buf[1000010];
int main() {
  scanf("%s", buf);
  int a0 = 0, a1 = 1, b0 = 0, b1 = -1;
  int c0 = a0-b0, c1 = a0-b1, c2 = a1-b0, c3 = a1-b1;
  for(char *p = buf; *p; p++) {
    if(*p=='0')      { --a0; --a1; --b0; --b1; }
    else if(*p=='1') { ++a0; ++a1; ++b0; ++b1; }
    else             { --a0; --a1; ++b0; ++b1; }
    if(a0 < 0) a0 += 2;
    if(a1 < 0) a1 += 2;
    if(b0 > 0) b0 -= 2; 
    if(b1 > 0) b1 -= 2; 
    if(c0 < a0-b0) c0 = a0-b0;
    if(c1 < a0-b1) c1 = a0-b1;
    if(c2 < a1-b0) c2 = a1-b0;
    if(c3 < a1-b1) c3 = a1-b1;
  }
  if(c0 > c1) c0 = c1;
  if(c2 > c3) c2 = c3;
  if(c0 > c2) c0 = c2;
  printf("%d\n", c0);
  return 0;
}


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

int main(){
    string s;
    cin >> s;
    bool flag=true;
    for(int i=0; i<3; i++){
        if(s[i]==s[i+1])flag=false;
    }
    if(flag)cout << "Good" << endl;
    else cout << "Bad" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import collections 


def solve(N: int, X: int, Y: int):
    seen = [[False] * N] * N
    X -= 1
    Y -= 1
    cnt = []
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            if seen[i][j]:
                continue
            seen[j][i] = True
            cnt.append(min(abs(j - i), abs(X - i) + 1 + abs(j - Y)))
    counter = collections.Counter(cnt)
    keys = counter.keys()
    for i in range(N):
        if i == 0:
            continue
        if i not in keys:
            print(0)
            continue
        print(counter[i])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 67856
#include<stdio.h>

int calclateIntegral(int d){
  int integral=0, i, width=d;
  while(width<600){
    integral += d*width*width;
    width += d;
  }
  return integral;
}

int main(){
  int d;
  while(scanf("%d", &d) != EOF){
    printf("%d\n", calclateIntegral(d));
  }
  return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<stdlib.h>
int main() {
	int i, j, k, f = 0, n, t, m, a, b, q;
	int v[55];
	int c[55];
	scanf("%d", &n);
	for (i = 0;i < n;i++) {
		scanf("%d", &v[i]);
	}
	for (i = 0;i < n;i++) {
		scanf("%d", &c[i]);
	}
	q = 0;

	for (i = 0;i < n;i++) {
		if (v[i] - c[i] > 0) {
			q = q + v[i] - c[i];
		}
	}


	printf("%d",q);


	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 5, M = 1e9 + 7;
int main()
{
    ll n, x;
    cin >> n;
    for (ll i = 1; i * i <= n; i++)
        if (n % i == 0)
            x = i;
    cout << x + n / x - 2;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Text;

namespace Kyoupro
{
    class Plactice
    {
        static void Main()
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());

            if(A + B == 5)
            {
                Console.WriteLine(1);
            }else if(A + B == 4)
            {
                Console.WriteLine(2);
            }else if(A + B == 3)
            {
                Console.WriteLine(3);
            }
        }
    }
}

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

int main() {
  int n;
  cin >> n;
  bool ans = false;
  if (n % 10 == 7) ans = true;
  if (n / 10 % 10 == 7) ans = true;
  if (n / 100 % 10 == 7) ans = true;
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3624
import Control.Monad
isRt :: [Int] -> String
isRt (a:b:c:_) | a^2 + b^2 == c^2 = "YES"
               | b^2 + c^2 == a^2 = "YES"
               | c^2 + a^2 == b^2 = "YES"
               | otherwise        = "NO"
main = getLine >>= \n -> replicateM (read n) getLine
        >>= return . map (isRt .(map read) . words) >>= mapM_ putStrLn

Measured memory_bytes: 4504
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef string str;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<int, int> pii;
typedef vector<pii> vpii ;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  double d ;
  cin >> d ;
  cout << SP(10) << 2*d*M_PI <<endl ;
  
  
  
  return 0 ;
}



Measured memory_bytes: 3800
#include <iostream>
#include <vector>

int main() {
  size_t N, M, Q;
  std::cin >> N >> M >> Q;

  std::vector<std::vector<size_t>> Table(N+1, std::vector<size_t>(N+1, 0));

  for (size_t i=0; i<M; i++) {
    size_t L, R;
    std::cin >> L >> R;

    for (size_t r=R; r<N+1; r++) {
      Table[L][r]++;
    }
  }

  for (size_t i=0; i<Q; i++) {
    size_t p, q;
    std::cin >> p >> q;

    size_t ans = 0;

    for (size_t l=p; l<q+1; l++) {
      ans += Table[l][q];
    }

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

  return 0;
}


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

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

    int n;
    cin >> n;
    vector<int> x(n), y(n);

    for(int i = 0; i < n; ++i){
        int xx, yy;
        cin >> xx >> yy;
        x[i] = xx + yy;
        y[i] = xx - yy;
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    cout << max(x.back()-x.front(), y.back()-y.front()) << endl;
    
    return 0;
}

Measured memory_bytes: 4680
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  while(1){
    int n,a,t[1000],h[1000],b[1000]={};
    int c=0,d=0,ba=0,ta=0,ha=0;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>a;
      b[a]++;
    }
    for(int i=1;i<=n*2;i++){
      if(b[i]==0){
        h[c]=i;
        c++;
      }else{
        t[d]=i;
        d++;
      }
    }
    while(1){
      int f=0;
      for(int i=0;i<n;i++){
        if(t[i]>ba){
          ba=t[i];
          t[i]=0;
          f++;
          ta++;
          break;
        }
      }
      if(f==0)ba=0;
      if(ta==n)break;
      f=0;
      for(int i=0;i<n;i++){
        if(h[i]>ba){
          ba=h[i];
          h[i]=0;
          f++;
          ha++;
          break;
        }
      }
      if(f==0)ba=0;
      if(ha==n)break;
    }
    printf("%d\n%d\n",n-ha,n-ta);
  }
  return 0;
}

Measured memory_bytes: 3164
n = int(input())
c = []
for i in range(n):
    x, l = map(int, input().split())
    c.append([x, l])

c.sort(key=lambda x:x[0])

for i in range(n):
    a = c[i][0] - c[i][1]
    b = c[i][0] + c[i][1]
    c[i][0] = a
    c[i][1] = b

p = c[0][1]
cnt = 0
for i in range(1, n):
    if p > c[i][0]:
        cnt += 1
        if p > c[i][1]:
            p = c[i][1]
    else:
        p = c[i][1]
            
    
print(n-cnt)


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

int main()
{
	int N, M;
	cin >> N >> M;
	priority_queue<long long> que;
	for( int i = 0; i < N; i++ ) {
		long long A;
		cin >> A;
		que.push( A );
	}

	for( int i = 0; i < M; i++ ) {
		long long A = que.top();
		que.pop();
		que.push( A / 2 );
	}
	long long ans = 0;
	while( !que.empty() ) {
		long long A = que.top();
		que.pop();
		ans += A;
	}

	cout << ans << endl;
}


Measured memory_bytes: 4252
H, W, K = map(int, input().split())
M = [[1 if c == "#" else 0 for c in input()] for _ in range(H)]

ans = 0
for hselection in range(1 << H):
    for wselection in range(1 << W):
        count = 0
        for h in range(H):
            if hselection & (1 << h):
                continue
            for w in range(W):
                if wselection & (1 << w):
                    continue
                count += M[h][w]
        if count == K:
            ans += 1
print(ans)

Measured memory_bytes: 9112
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

ll powmod(ll a,ll n,ll m) {
    if(n == 0)
        return 1;

    if(n % 2 ==0){
        ll r = powmod(a,n/2,m);
        return r*r % m;
    }

    return a*powmod(a,n-1,m)%m;
}

ll factmod(ll a,ll b,ll m) {
  if(a<b)return 0;
  ll s=1;
  while(a>=b){
    s = s*a % m;
    a -= 1;
  }
  return s;
}

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

ll combmod(ll a,ll b,ll m){
  if(b==0)return 1;
  ll c=factmod(a,a-b+1,m);
  ll d=modinv(factmod(b,1,m),m);
  ll e=(c*d)%m;
  return e;
}

void modsum(ll &a,ll b,ll m){
  a+=b;
  a%=m;
}

void modsub(ll &a,ll b,ll m){
  a-=b;
  a+=m;
  a%=m;
}

void modmul(ll &a,ll b,ll m){
  a*=b;
  a%=m;
}

void modquo(ll &a,ll b,ll m){
  a*=modinv(b,m);
  a%=m;
}

ll kumi(ll a){
  if(a<=0)return 1;
  if(a==1)return 2;
  if(a==2)return 3;
  if(a==3)return 5;
  if(a==4)return 8;
  if(a==5)return 13;
  if(a==6)return 21;
  if(a==7)return 34;
  return -1;
}

int main(){

  ll h,w,k;
  cin >> h >> w >> k;
  mat dp(h+1,vec(w+1,0));
  dp[0][1]=1;

  for(ll i=1;i<=h;i++){
    if(w>=2)dp[i][1]=dp[i-1][1]*kumi(w-2)+dp[i-1][2]*kumi(w-3);
    else dp[i][1]=dp[i-1][1];

    dp[i][1]%=mod;

    for(ll j=2;j<w;j++){
      dp[i][j]=dp[i-1][j-1]*kumi(j-3)*kumi(w-1-j)+dp[i-1][j]*kumi(j-2)*kumi(w-1-j)+dp[i-1][j+1]*kumi(j-2)*kumi(w-2-j);
      dp[i][j]%=mod;
    }

    if(w>=2){
      dp[i][w]=dp[i-1][w]*kumi(w-2)+dp[i-1][w-1]*kumi(w-3);
      dp[i][w]%=mod;
    }
  }

  cout << dp[h][k] << endl;

}

Measured memory_bytes: 3632
A,B,K=map(int,input().split())

small=[n for n in range(A,min(A+K,B+1))]

large=[n for n in range(max(A+K,B-K+1),B+1)]

ans_set=set(small+large)
ans=list(ans_set)
ans.sort()
ans_str=list(map(str,ans))

print(' '.join(ans_str))


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String[] s = stdR.readLine().split(" ");
        int A = Integer.parseInt(s[0]);
        int count = 0;
        for(int i = 1 ; i <= A ; i++) {
            if(i % 2 == 1)count++;
        }
        System.out.println((double) count / A);
    }
}


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


int main() {
    int a,b;
    cin>>a>>b;

    if(a >= 13) cout<<b<<endl;
    else if(a >= 6 && a <= 12) cout<<b/2<<endl;
    else cout<<0<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int main() {
    int N;
    cin >> N;
    vector<P> vec(N);
    for(int i = 0;i < N;i++) {
        int A;
        cin >> A;
        vec.at(i) = P(A,i);
    }
    sort(vec.begin(),vec.end());
    int A = 0;
    int B = 0;
    for(int i = 0;i < N;i++) {
        if(i % 2 == 0) {
            if(vec.at(i).second % 2 == 1) {
                A++;
            }
        }
        else {
            if(vec.at(i).second % 2 == 0) {
                B++;
            }
        }
    }
    cout << A << endl;
}

Measured memory_bytes: 1152
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<functional>
#include<time.h>
#include<iomanip>
#include<cassert>
#include<bitset>
#include<sstream>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)

int main() {
	int n ;
	cin >> n;
	int cnt = 0;
	for (int i = 1; i < n; i++) {
		int x = n - i;
		int cnthoge = 0;
		for (int j = 1; j * j < x; j++) {
			if (x % j == 0)cnthoge += 2;
		}
		if (sqrt(x) == (int)sqrt(x))cnthoge++;
		cnt += cnthoge;
	}
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vector<int> w(n);
  int su = 0;
  for(int i=0;i<n;++i) {
    cin >> w[i];
    su += w[i];
  }
  if(n == 1) {
    cout << su << endl;
    return 0;
  }
  int s1 = 0;
  for(int i=0;i<n;++i) {
    if(s1 + w[i] > su - s1 - w[i]) {
      cout << min(abs(s1 - (su - s1)), abs((s1 + w[i]) - (su - s1 - w[i]))) << endl;
      return 0;
    }
    s1 += w[i];
  }
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

MAX = 0
A_map = {}
for i in range(N):
    num = A[i]
    A_map[num] = A_map.get(num,0) + 1
    MAX = max(MAX, A_map[num])

if MAX>=2:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 35156
import std.stdio ,std.conv , std.string;

void main(){
	auto input = readLine!size_t();
	
	solve(input[0],input[1]).writeln();
}
auto solve( size_t x, size_t y ) {
	if( x < y ){
		return 0;
	} else {
		return x-y;
	}
}
unittest{
	assert(1);
}
T[] readLine( T )(){
	T[] ret;
	foreach( val ; readln().chomp().split() ){
		ret ~= to!T(val);
	}
	return ret;
}


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

int main(){
	int n, k, ans = 0;
	cin >> n >> k;
	int l[51] = {};
	for (int i = 0; i < n; i++) cin >> l[i];
	sort(l, l + n, greater<int>());
	for (int i = 0; i < k; i++) ans += l[i];
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long a,b;
  cin>>a>>b;
  if(2*a>=b)cout<<b/2<<endl;
  else{
    long long kotae=a;
    b-=2*a;
    kotae+=b/4;
    cout<<kotae<<endl;
  } 
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,d,m,M;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    M=(a>c ? a :c);
    m=(b>d ? d :b);
    if(m-M>0)
    printf("%d",m-M);
    else
        printf("0");
    return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9+7;


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

    int sum = 0, tmp = 0;
    V<int> v;
    for(int i = 1; i <= n; i++){
        sum += i;
        v.push_back(i);
        if(n <= sum){
            tmp = sum - n;
            break;
        }
    }

    for(int i = 0; i < (int)v.size(); i++){
        if(v[i] == tmp) continue;
        cout << v[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3696
n = gets.chomp.to_i
s = gets.chomp

result = s.count('R') * s.count('G') * s.count('B')

for i in 0...n-2 do
    for j in i+1...n-1 do
        if j*2-i >= n then
            break
        elsif s[i] != s[j] and s[j] != s[j*2-i] and s[j*2-i] != s[i] then 
            result -= 1
        end
    end
end

puts result

Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int Abs(int n){
    if(n<0)return -n;
    else return n;
}

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

    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int MAX=0,pos=0;
    for(int i=0;i<n;i++){
        if(Abs(MAX)<Abs(a[i])){
            MAX=a[i];
            pos=i;
        }
    }
    cout<<2*n-1<<endl;
    for(int i=0;i<n;i++)cout<<pos+1<<" "<<i+1<<endl;
    if(MAX>0){
        for(int i=0;i<n-1;i++)cout<<i+1<<" "<<i+2<<endl;
    }
    else{
        for(int i=n-2;i>=0;i--)cout<<i+2<<" "<<i+1<<endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); ++ i)
#define per(i,a,b) for(int i = (a); i >= (b); -- i)
#define pb push_back
#define VI vector<int>
#define VVI vector<VI>
#define Pii pair<int,int>
#define Pll pair<ll,ll>
#define Pli pair<ll,int>
#define fi first
#define se second
#define Ppi pair<Pii,int>
#define VII vector<Pii>

using namespace std;

typedef long long ll;
typedef int (*funI_I) (int);
typedef int (*funI_II) (int, int);

constexpr int N = 4000100;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    VI vis(10,0);
    vis[a] = vis[b] = vis[c] = 1;
    int num =0;
    rep(i,0,9)num+=vis[i];
    if(num == 2) cout << "Yes\n";
    else cout << "No\n";
}


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

using namespace std;

using ll = long long;

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

    int h, w;

    cin >> h >> w;
    vector<string> m(h);
    for (int i = 0; i < h; ++i) cin >> m[i];

    const int dx[4] = {-1, 0, 1, 0};
    const int dy[4] = {0, 1, 0, -1};

    bool flag = true;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (m[i][j] == '.') continue;

            int cnt = 0;
            for (int d = 0; d < 4; ++d) {
                int nx = j + dx[d], ny = i + dy[d];
                if (nx < 0 || w <= nx || ny < 0 || h <= ny)
                    continue;
                if (m[ny][nx] == '#') ++cnt;
            }

            if (cnt == 0) flag = false;
        }
    }

    if (flag) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


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

using namespace std;

int main() {
  long long N;
  cin >> N;
  long long ans1 = 0;
  {
    auto check = [&](long long i) {
      auto n = N;
      while (n % i == 0) n /= i;
      if (n % i == 1) ans1++;
    };
    for (long long i = 2; i * i <= N; i++) {
      if (N % i == 0) {
        check(i);
        if (N / i != i) check(N / i);
      }
    }
    check(N);
  }
  long long ans2 = 1;
  {
    auto n = N - 1;
    for (long long i = 2; i * i <= N - 1; i++) {
      int cnt = 0;
      while (n % i == 0) {
        n /= i;
        cnt++;
      }
      ans2 *= cnt + 1;
    }
    if (n > 1) ans2 *= 2;
    ans2--;
  }
  cout << ans1 + ans2 << endl;

  return 0;
}
/* vim:set fdm=marker: */


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

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1156
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
 
 
int main() {
    long long N, A, B;
    cin >> N >> A >> B;
 
    long long X = N / (A + B);
    long long Y = A * X;
    long long Z = min(N % (A + B), A);
    
   
    cout << Y + Z << endl;
   
    
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	vector<vector<int>> s(d, vector<int>(n));
	rep(i, n) cin >> c[i];
	rep(i, d) rep(j, n) cin >> s[i][j];
	vector<int> t(d), last(n);
	
	
	vector<int> nex(d);
	// 貪欲
	ll ans = 0;
	rep(i, d) {
		ll mx = -1001001001;
		int now = 0;
		
		rep(j, n) {
			ll tmp = ans;
			tmp += s[i][j];
			rep(k, n) {
				if(j == k) continue;
				tmp -= c[k] * (i+1-last[k]);
			}
			if(mx < tmp) {
				nex[i] = now+1;
				mx = tmp;
				now = j;
			}
		}
		ans = mx;
		last[now] = i+1;
		t[i] = now+1;
	}
	int cnt = 0;
	while(1) {
		// 局所探索法
		cnt++;
		if(cnt > 200000) break;
		vector<int> old = t;
		const int CH = rand()%33 + 1; // CH箇所変える
		rep(i, CH) {
			// int nd = rand()%d;
			// int nq = rand()%n + 1;
			// t[nd] = nq;
			int nd = rand()%d;
			t[nd] = nex[nd];
		}
		
		// 点数の再計算
		vector<int> nlast(n);
		ll now = 0;
		rep(i, d) {
			now += s[i][t[i]];
			nlast[t[i]-1] = i+1;
			rep(j, n) {
				now -= c[j] * (i+1-nlast[j-1]);
			}
		}
		
		// 良くなれば更新
		if(now > ans) {
			ans = now;
		} else {
			t = old;
		}
	}
	
	rep(i, d) printf("%d\n", t[i]);
	return 0;
}

Measured memory_bytes: 3784
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long li;
#define yn(i) ((i)?"Yay!":":(")
#define MOD 1000000007
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
li inv(li a){
  // unordered_map 必須
  static unordered_map<li,li> f;
  f[1]=1;
  a%=MOD;
  if(f.find(a)!=f.end())return f[a];
  return f[a]=MOD-MOD/a*inv(MOD%a)%MOD;
}
li fact(li a){
  // vector,repa 必須
  static vector<li> f(1,1);

  if(f.size()>a)return f[a];
  if(df)print(a,"!");
  int n=f.size();
  repa(i,n,a+1){
    f.push_back(f[i-1]*i%MOD);
    if(df)print(i,a+1,f[i]);
  }
  return f[a];
}

int main(){
  int n,x; cin >>n >>x;
  vector<int> s(n); rep(i,n) cin >>s[i];
  sort(s.begin(),s.end());
  vector<vector<li>> dp(n,vector<li>(x+1,0));
  rep(j,x+1) dp[0][j]=j%s[0];
  repa(i,1,n){
    rep(j,x+1){
      dp[i][j]=(dp[i-1][j%s[i]]+i*dp[i-1][j]%MOD)%MOD;
    }
  }
  print(dp[n-1][x]);
}


Measured memory_bytes: 157824
#include <iostream>
#include <vector>
#include <stdio.h>
#include <string>

using namespace std;

typedef vector<int> vi;

string s;
int num = 0, res = 0;

int main()
{
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'g')
        {
            if (num == 0)
            {
                ++num;
            }
            else
            {
                ++res;
                --num;
            }
        }
        else
        {
            if (num == 0)
            {
                ++num;
                --res;
            }
            else
            {
                --num;
            }
        }
    }
    printf("%d",res);
    return 0;
}


Measured memory_bytes: 632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n,tot,s[N];
ll a[N],sum,p[60];
void add(ll x)
{
    for(int i=0;i<tot;i++)
        if(1ll<<s[i]&x)
    {
        if(p[i]) x^=p[i];
        else {p[i]=x;break;}
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]),sum^=a[i];
    for(int i=59;i>=0;i--) if(!(1ll<<i&sum)) s[tot++]=i;
    for(int i=1;i<=n;i++) add(a[i]);
    ll ans=0;
    for(int i=0;i<tot;i++)
        if(!(1ll<<s[i]&ans)) ans^=p[i];
    printf("%lld\n",ans+(sum^ans));
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b=0;
    scanf("%d %d",&a,&b);
    int t=0;
    int h=1;
    for(t=0;h<b;t++){
        h--;
        h=h+a;
    }
    printf("%d",t);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;

int main(void)
{
	int X; cin >> X;
	if (X == 2) {
		cout << 2 << endl;
		return 0;
	}
	bool prime = true;
	while (true) {
		rep(i, 2, sqrt(X) + 1) {
			if (X%i == 0) {
				X++;
				prime = false;
				break;
			}
		}
		if (prime) {
			cout << X << endl;
			break;
		}
		else prime = true;
	}


	return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

const ll MOD = 1000000007;
const long double EPS = 1e-10;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n, ans = 0;
    cin >> n;
    vector<int> a(n+1);
    map<int, int> mp;
    rep(n){
        cin >> a[i+1];
        mp[a[i+1]] = i+1;
    }
    /*
    int prev = mp[(n+1)/2];
    if(n % 2 == 0 && mp[n/2+1] < mp[n/2] && ){
        ans++;
        prev = 0;
    }

    
    for(int i=(n+1)/2-1;i>=1;i--){
        if(prev < mp[i]){
            ans++;
            prev = 0;
        }else{
            prev = mp[i];
        }
    }

    prev = mp[n/2+1];
    for(int i=n/2+2;i<=n;i++){
        if(mp[i] < prev){
            ans++;
            prev = n+1;
        }else{
            prev = mp[i];
        }
    }
    */

    int tmp = 1, tmp_max = 1;
    reppp(i, 2, n+1){
        if(mp[i-1] < mp[i]){
            tmp++;
            tmp_max = max(tmp, tmp_max);
        }else{
            tmp = 1;
        }
   }
   cout << n-tmp_max << endl;
}

Measured memory_bytes: 10496
#include<stdio.h>
int main()
{
	char a,b;
	scanf("%c %c",&a,&b);
	if(a=='H'&&b=='H')
	{
	printf("H");
	}	
	else if(a=='H'&&b=='D')
	{
		printf("D");
	}
	else if(a=='D'&&b=='H')
	{
		printf("D");
	}
	else if(a=='D'&&b=='D')
	{
		printf("H");
	}
	return 0;
}

Measured memory_bytes: 128
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B, K] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    for i in range(K):
        if A+ i >= B - K + 1:
            break;
        if A + i >= A and A + i <= B:
            print A + i

    for i in range(K):
        #if B - (K - i) + 1 >= A + K - 1:
        if B - (K - i) + 1 >= A and B - (K - i) + 1 <= B:
            print B - (K - i) + 1

if __name__ == '__main__':
    main()

Measured memory_bytes: 2692
from itertools import accumulate
n,m,k = map(int, input().split())
a = list(map(int,input().split()))[::-1]
b = list(map(int,input().split()))

l = [0] + a + b
acc = list(accumulate(l))

# print(acc)

ans = 0
l = 0
for r in range(1, n+m+1):
    while acc[r] - acc[l] > k:
        l += 1
    # print(l,r)
    if l <= n and r >= n:
        ans = max(ans,r-l)
    # print(ans)
print(ans)

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

#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979;



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

    ll n,m;
    cin >> n >> m;

    priority_queue<ll> p;
    for (ll i = 0;i < n;i++){
        ll x;
        cin >> x;
        p.push(x);
    }

    rep(i,m){
        ll x = p.top();
        p.pop();
        x /= 2;
        p.push(x);
    }

    ll ans = 0;
    while (!p.empty()){
        ans += p.top();
        p.pop();
    }

    cout << ans << endl;

}

Measured memory_bytes: 4200
#include <stdio.h>
#define N 1000
 
void swap(int *a, int *b)
{
	int	temp;

	temp=*a;
	*a=*b;
	*b=temp;
	
}
 
void BubbleSort(int A[],int B[], int n)
{
  int i,j,t;
  for(i=0;i<n;i++){
    for(j=n-1;i<j;j--){
      if (A[j]>A[j-1]){
        
        swap(&A[j],&A[j-1]);
        
        swap(&B[j],&B[j-1]);
       }
    }
  }
}
 
int main()
{
  int i=0,j,n,k;
  int num,ans;
  int Nu[N],An[N];
  
  while(scanf("%d,%d",&num,&ans)){
    if ((num==0) && (ans==0))
      break;
    Nu[i]=num;
    An[i++]=ans;
  }
  
  BubbleSort(An,Nu,i);
  
  while(scanf("%d",&n)!=EOF){
	int result=1;
	for (j=0;j<i;j++){
      if (Nu[j]==n) break;
	}
    int temp=An[0];
    for (k=1;k<=j;k++)
      if (An[k]!=temp){
        temp=An[k];
        result++;
      }
    printf("%d\n",result);
  }
 
  return 0;
}

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

int main() {
	// your code goes here
	int n, w;
	cin >> n >> w;
	long long int a[n], v[n];
	for (int i = 0; i < n; ++i)
		cin >> a[i] >> v[i];
	long long int dp[n + 1][w + 1];
	for (int i = 0; i <= w; ++i)
		dp[0][i] = 0;
	for (int i = 0; i <= n; ++i)
		dp[i][0] = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= w; ++j) {
			if (a[i - 1] <= j) {
				dp[i][j] = max(dp[i - 1][j - a[i - 1]] + v[i - 1], dp[i- 1][j]);
			}
			else {
				dp[i][j] = dp[i- 1][j];
			}
		}
	}
	cout << dp[n][w];
	return 0;
}

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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}
unsigned long long d;
long long n, ans, x, y;
int main(){
    n = read(), d = read();
    d = d * d;
    for (int i = 1; i <= n; i++){
        x = read(), y = read();
        unsigned long long a = x * x + y * y;
        if (d >= a)
            ans++;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main(){
    int n;
    cin >> n;
    if(n<1000){
        cout << "ABC" << endl;
    }else{
        cout << "ABD" << endl;
    }

    return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> imos(1e5 + 3);
  while (n--) {
    int a, b;
    cin >> a >> b;
    imos[a] += 1;
    imos[b + 1] -= 1;
  }
  int res = 0;
  for (int i = 0; i + 1 < (int)imos.size(); ++i) {
    imos[i + 1] += imos[i];
    if (imos[i] + 1 >= i) {
      res = max(res, i - 1);
    }
  }
  cout << res << '\n';
}



Measured memory_bytes: 3364
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
signed main()
{
    int k;
    cin>>k;
  set<int> s;
  set<int>::iterator it;
  if(k<=9)
  {
  cout<<k<<endl;
  return 0;
  }
  for(int i=1;i<=9;i++)
  {
      s.insert(i);
  }
  k=k-9;
  while(k--)
  {
      it=s.begin();

      int r=*it;
      int p=r%10;
      if(p!=0 && p!=9)
      {

         if(s.find(r*10+(p-1))==s.end())
         {

             s.insert(r*10+(p-1));
         }
         else if(s.find(r*10+(p))==s.end())
         {
             s.insert(r*10+(p));
         }
         else
         {
             s.insert(r*10+(p+1));
             s.erase(it);
         }

      }
      else if(p==9)
      {
          if(s.find(r*10+(p-1))==s.end())
         {
             s.insert(r*10+(p-1));
         }
         else
         {
             s.insert(r*10+(p));
             s.erase(it);
         }

      }
      else
      {
          if(s.find(r*10+(p))==s.end())
         {
             s.insert(r*10+(p));
         }
         else
         {
             s.insert(r*10+(p+1));
             s.erase(it);
         }
      }
  }

  it=s.end();
  it--;
  cout<<*it<<endl;
}


Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{

    int a,b;
    cin >> a >> b;
    ll ans = 0;
    if(a<=b)
    {
        for(int i=0; i<b; ++i)
        {
            ans *= 10;
            ans += a;
        }
    }
    else
    {
        for(int i=0; i<a; ++i)
        {
            ans *= 10;
            ans += b;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
fin = sys.stdin.readline
from collections import deque
N = int(fin())
info_list = [[int(elem) for elem in fin().split(' ')] for _ in range(N)]
assert len(info_list[0]) == 3

for cx in range(101):
    for cy in range(101):
        H = None
        queue = deque(info_list)
        while queue:
            x, y, h = queue.popleft()
            if H is None and h != 0:
                H = abs(x - cx) + abs(y - cy) + h
                queue.append([x, y, h])
                continue
            elif H is None and h == 0:
                queue.append([x, y, h])
                continue
            elif H is not None:
                if h != max(H - abs(x - cx) - abs(y - cy), 0):
                    queue.append([x, y, h])
                    break
        if len(queue) != 0:
            continue
        else:
            print("{} {} {}".format(cx, cy, H))
            exit(0)

Measured memory_bytes: 3444
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>
#include <cwchar>
#include <cwctype>
using namespace std;
#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
typedef long long ll;
const ll inf = 0x3f3f3f3f3f3f3f3f;
#define ull unsigned long long
const int maxn = 1e6+10;
const ll mod=1e9+7;
#define MAXN 40100
ll gcd(ll T, ll b) { return b == 0 ? T : gcd(b, T % b); }
ll lcm(ll T, ll b) { return T / gcd(T, b) * b; }
ll mul(ll a,ll b, ll c) {
    ll ans = 0;
    while(b) {
        if(b&1) {
            ans= (ans+a)%c;
            b--;
        }
        b>>=1;
        a=(a+a)%c;
    }
    return ans;
}
 
ll powmod(ll a,ll b,ll c) {
    ll ans = 1;
    while(b) {
        if(b&1) {
            ans = mul(ans,a,c);
            b--;
        }
        b>>=1;
        a=mul(a,a,c);
    }
    return ans ;
}
 
ll exgcd(ll a,ll b,ll &x,ll &y) {
    if(b==0)
    {
        x=1;y=0;
        return a; 
    }
    ll r=exgcd(b,a%b,x,y);
    ll temp=y;
    y=x-(a/b)*y;
    x=temp;
    return r;
}

const ll INF = 0x3f3f3f3f3f3f3f3f;


int main() {
    ll d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d) {
        cout<<"Yes\n";
    }
    else {
        cout<<"No\n";
    }
    return 0;
}






Measured memory_bytes: 3552
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline

H, W = map(int, readline().split())
S = [list(readline()) for i in range(H)]


def bfs(grid, start):
    distance = [[-1] * W for _ in range(H)]
    queue = deque([start])
    distance[start[0]][start[1]] = 0
    while queue:
        x, y = queue.popleft()

        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            new_y, new_x = y + j, x + i
            if 0 <= new_y < W and 0 <= new_x < H:
                if grid[new_x][new_y] == '.' and distance[new_x][new_y] == -1:
                    distance[new_x][new_y] = distance[x][y] + 1
                    queue.append((new_x, new_y))
        if not queue:
            return distance[x][y]


answer = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue

        tmp = bfs(S, (i, j))
        if tmp > answer:
            answer = tmp

print(answer)


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

int main()
{
    int ans = 0;
    vector<int> a(3);
    cin >> a.at(0) >> a.at(1) >> a.at(2);
    sort(a.begin(), a.end());
    cout << a.at(2) - a.at(0) << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<deque>
using namespace std;
const int INF=1000000009;
int d[100005];
int main()
{
	int n;
	cin>>n;
	deque <int> q;
	q.push_back(1);
	for(int i=0;i<100005;i++)
	    d[i]=INF;   
	d[1]=0;
	while(q.size())
	{
		int u=q.front();
		q.pop_front();
		int f=(u*10)%n;
		if(d[f]>d[u])
		{
			q.push_front(f);
		    d[f]=d[u];
		}    
		int z=(u+1)%n;
		if(d[z]>d[u]+1)
		{
			q.push_back(z);
		    d[z]=d[u]+1;
		}    
	}
	cout<<d[0]+1;
	return 0;
}

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

int main() {
	int N;
  	int A;
  	cin >> N;
    int MAX = 1000000; //とりあえず適当にMAXを100万回とする
  	for(int i = 0; i < N; i++){
        int wattakaisu = 0;
     	cin >>  A;
      	while(A % 2 == 0){
        	A /= 2; //読み込んだ数字Aが、もし2で割れる場合は2で割って
            wattakaisu += 1; //wattakaisuを1増やす
        }
        //読み込んだ数字Aはwattakaisu回、2で割ることが出来た
        if(MAX > wattakaisu){
          //もし読み込んだ数字AのwattakaisuがMAX回より少なかったら
          //MAXをwattakaisuに置き換える
        	MAX = wattakaisu; 
        }
    }
    //N個のAを全て2で割って調べた結果、一番少なかったwattakaisuがMAXになる
    cout << MAX << endl; 
}

Measured memory_bytes: 256