akhauriyash/Code-Regression huggingface dataset:
#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;
int main(){
  vector<int> a(3,0);
  int n;
  cin>>n;
  vector<int> ans(n,0);
  rep(i,n){
    cin>>a[0]>>a[1]>>a[2];
    sort(all(a));
    if(a[2]*a[2]==a[1]*a[1]+a[0]*a[0])ans[i]++;
  }
  rep(i,n){
    if(ans[i]!=0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 3016
#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
#ifdef __DEBUG__
    void debug_out() { cerr << endl; } 
    template <typename Head, typename... Tail>
    void debug_out(Head H, Tail... T) {cerr << " " << H; debug_out(T...);}
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 
#endif

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,Q;
vector<int> A;
inline void input(){
    fast_io();
    cin >> N >> Q;
    A = fetch_vec<int>(N);
}

int op(int a, int b){return max(a,b);};
int e(){return -1;}
int target;
bool f(int v) { return v < target; }

inline int solve(){
    atcoder::segtree<int,op,e> sg(A);
    for (int i = 0; i < Q; i++)
    {
        int type,a,b;
        cin >> type >> a >> b;
        if(type==1){
            a--;
            sg.set(a,b);
        }
        else if(type==2){
            a--;
            cout << sg.prod(a,b) << "\n";
        }
        else{
            target = b;
            a--;
            int j = sg.max_right<f>(a)+1;
            cout << j << "\n";
        }

    }
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 6100
/*;

THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define r(i, s, l) for (int i = s; i < l; i++)
#define mod 1000000007
#define int long long
#define INT_BITS 32
#define ld long double
#define pp pair<int,int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

signed main()
{


    int n;
    cin>>n;
    vector<int> a(n);
    int flag=0;
    r(i,0,n)
    {
       cin>>a[i];
       if(a[i]==0)
       flag=1;
    }
    if(flag)
    {
       cout<<0;
       return 0;
    }

    int prod=1;
    r(i,0,n)
    {

        if(prod>1000000000000000000/a[i])
        {
           cout<<-1;
           return 0;
        }
        else
        prod= prod*a[i];
    }
    cout<<prod;
	return 0;
}


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<int> A(N), B(N), C(N); cin >> A >> B >> C;
        vector<pii> Bl(2 * N), Br(2 * N);
        rep(i, N) {
            Bl[i] = make_pair(A[i], 1);
            Br[i] = make_pair(C[i], 1);
            Bl[i + N] = make_pair(B[i], -i);
            Br[i + N] = make_pair(B[i], -i);            
        }
        sort(all(Bl)); reverse(all(Bl));
        sort(all(Br));

        queue<pii> Aq, Bq;
        set<int> Ain, Bin;
        ll As = 0, Bs = 0;
        rep(i, N) {
            As += Bl[i].first;
            Bs += Br[i].first;
            if(Bl[i].second <= 0) Ain.insert(-Bl[i].second);
            if(Br[i].second <= 0) Bin.insert(-Br[i].second);
            Aq.push(Bl[i + N]);
            Bq.push(Br[i + N]);
        }
       
        ll ans = -(1LL << 60);
        vector<ll> Ass(N + 1), Bss(N + 1);
        rep(i, N) {
            Ass[N - i] = As;
            Bss[N - i] = Bs;
            if(Ain.count(N - i - 1)) {
                As -= B[N - i - 1];
                while(Aq.front().second <= 0 and -Aq.front().second > N - i - 1) Aq.pop();
                if(Aq.front().second <= 0) Ain.insert(Aq.front().second * -1);
                As += Aq.front().first; Aq.pop();                                         
            }
            if(Bin.count(i)) {
                Bs -= B[i];
                while(Bq.front().second <= 0 and -Bq.front().second < i) Bq.pop();
                if(Bq.front().second <= 0) Bin.insert(Bq.front().second * -1);
                Bs += Bq.front().first; Bq.pop();
            }
        }
        Ass[0] = As;
        Bss[0] = Bs;
        // debug(Ass); debug(Bss);
        rep(i, N + 1) set_max(ans, Ass[i] - Bss[N - i]);
        
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 17152
#pragma region template
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N, Q;
  cin >> N >> Q;
  dsu d(N);
  while(Q--){
    int t, u, v;
    cin >> t >> u >> v;
    if(t == 0){
      d.merge(u, v);
    }else{
      print(d.same(u, v));
    }
  }
}


Measured memory_bytes: 3944
#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define MAX 201
using namespace std;
int N,K;
double T,U,V,L;
double D[MAX];

int main()
{
  while(cin >> N >> K >> T >> U >> V >> L)
    {
      rep(i,N)cin >> D[i];
      int cnt = 0;
      double boost = 0;
      double tm = 0;
      int index = 0;

      rep(t,L)
	{
	  if(index < N && D[index] == t)
	    {
	      if(cnt < K)
		{
		  cnt++;
		}
	      else 
		{
		  boost = V*T;
		}	  
	      index++;    
	    }

	  if(boost == 0 && cnt > 0)
	    {
	      cnt--;
	      boost = V*T;
	    }


	  if(boost == 0)tm += 1.0/U;
	  else
	    {
	      tm += 1.0/V;
	      boost--;
	    }



	}      
      cout << setiosflags(ios::fixed) << setprecision(9) << tm << endl;
    }
  return 0;
}

Measured memory_bytes: 1288
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;
const int mod = 1e9+7;

int n;
long long dp[N][2];
vector < int > adj[N];

void mul_self(long long & a , long long b){
    a *= b;
    a %= mod;
}
//no. of ways at node u , when u is black or white
void dfs(int u , int p){
    if(adj[u].size() == 1 && u != 1){
        dp[u][1] = 1;
        dp[u][0] = 1;
        return;
    }
    dp[u][1] = dp[u][0] = 1;
    for(auto v : adj[u]){
        if(v == p)
            continue;
        dfs(v , u);
        mul_self(dp[u][1] , dp[v][0]);
        mul_self(dp[u][0] , (dp[v][0] + dp[v][1])%mod);
    }
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i < n; i++){
        int u , v;
        scanf("%d%d" , &u , &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    if(n == 1){
        puts("2");
        return 0;
    }
    dfs(1 , 0);
    printf("%lld\n" , (dp[1][0] + dp[1][1])%mod );
}


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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	if (n<=999)
	{
		printf("ABC\n", n);
	}
	else
	{
		printf("ABD\n", n-999);
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define INF 1e9 + 5
using namespace std;

int n;
int tab[1000000];
int dp[1000000];
int main(){
	cin >> n;
    
    for(int i = 1; i < n + 5; i++){
        dp[i] = INF;
    }
	for(int i = 0; i < n; i++){
		cin >> tab[i];
	}
    
    //cout<<dp[10];
	for(int i = 0; i < n; i++){
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(tab[i] - tab[i + 1]));
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(tab[i] - tab[i + 2]));
	}
	cout << dp[n - 1];

}


Measured memory_bytes: 4736
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
int main(){
    string s;
    cin >> s;
    int a = 0, b = 0;
    for(int i = 0; i < (int) s.size(); i++){
        if(i & 1){
            a += s[i] == '0';
            b += s[i] == '1';
        }else{
            a += s[i] == '1';
            b += s[i] == '0';
        }
    }
    cout << min(a, b) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>    
using namespace std;
#define ll long long 
#define pi pair<ll,ll>
#define pd pair<ld,ld>
#define pb push_back
#define inf 1e16
#define mod 998244353
#define en '\n'
#define ld long double
#define ff first
#define ss second
#define ull unsigned long long 
ll pw(ll b, ll r, ll md){
	ll ans = 1;
	while(r){
		if(r&1)ans = (ans*b)%md;
		b = (b*b)%md;
		r>>=1;
	}
	return ans;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n,m;cin>>n>>m;
	ll arr[n];for(int i = 0 ; i < n;  i ++ )cin>>arr[i];
	sort(arr,arr+n,greater<ll>());
	ll tot = 0 ; 
	for(int i = 0 ; i < n ; i++ )tot+=arr[i];
	bool flag = false;
	for(int i = 0 ; i < m ; i ++ ){
		if(arr[i]*4*m < tot){
			flag = true;
			break;
		}
	}
	if(flag)cout<<"No"<<en;
	else cout<<"Yes"<<en;
	return 0 ; 
}

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

int main() {
  int k,a,b;
  cin >> k >> a >> b;
  bool ans=false;
  
  for(int i=a; i<=b; i++){
    if(i%k==0){
      ans=true;
      break;
    }
  }
  
  if(ans){
    cout << "OK" << endl;
  }
  else{
    cout << "NG" << endl;
  }
}


Measured memory_bytes: 3516
/*
auhtor:hbohra98
chandigarh univeristy
*/
#include<bits/stdc++.h>
#define ll long int
#define pb push_back
#define VP vector < pair < ll , ll > >
#define VI vector< ll >
#define VS vector< string >
#define mk make_pair

using namespace std;
int main(){
ll a,b,c;
cin>>a>>b>>c;
ll p=a-b;
if(p-c>=0)cout<<0;
else 
  cout<<abs(p-c);


}

Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
ans=0
x=1#連続して隣り合っている数
for i in range(N-1):
    if i!=(N-2):
        if a[i]==a[i+1]:
            x+=1
        else:
            ans+=(x//2)
            x=1#xをリセット
    else:
        if a[i]==a[i+1]:
            x+=1
        ans+=(x//2)
print(ans)

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int a,b,c;
    int k;
    Scd3(a,b,c);
    Scd(k);

    printf( "%d\n", a+b+c+((max(max(a,b),c))<<k)-max(a,max(b,c)) );

    return 0;
}



Measured memory_bytes: 256
#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(){
  string S;
  cin>>S;
  sort(all(S));
  string T="abcdefghijklmnopqrstuvwxyz";
  for(ll i=0;i<26;i++) {
    bool a=true;
    for(auto x:S) {
     if(x==T[i]) {
       a=false;
     }
    }
    if(a) {
      cout<<T[i]<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}

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

int h, w;
int a[1010][1010];
int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

queue<pair<int, int>> q;
vector<pair<int, int>> n;

int main()
{
  cin >> h >> w;
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      char c;
      cin >> c;
      if (c == '.') c = '0' - 1;
      a[i][j] = c - '0';
    }
  }

  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      if (a[i][j] != -1) continue;
      for (int k = 0; k < 8; k++){
        int x = j + dx[k];
        int y = i + dy[k];
        if (x < 0 || w <= x || y < 0 || h <= y) continue;
        if (a[y][x] <= 0) continue;
        a[y][x]--;
        if (a[y][x] == 0) n.push_back(make_pair(y, x));
      }
    }
  }

  int cnt = 0;
  while (n.size()){
    cnt++;
    for (auto v : n){
      q.push(v);
    }
    n.clear();
    while (!q.empty()){
      auto v = q.front(); q.pop();
      int i = v.first, j = v.second;
      a[i][j]--;
      for (int k = 0; k < 8; k++){
        int x = j + dx[k];
        int y = i + dy[k];
        if (x < 0 || w <= x || y < 0 || h <= y) continue;
        if (a[y][x] <= 0) continue;
        a[y][x]--;
        if (a[y][x] == 0) n.push_back(make_pair(y, x));
      }
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 7044
#!/usr/bin/perl

while (<>) {
    @c = split /\s/, $_;
}

$total = 0;
foreach (sort {$a <=> $b} @c) {
    $total += $_;
    $memo{$total}++;
}

$half = $total / 2;
if (defined $memo{$half}) {
    print "Yes\n";
} else {
    print "No\n";
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

typedef struct {
	vector <int> to;
	int cost;
	bool is_visited;
} edge;
int main( void ){
	int N; cin >> N;
	string S; cin >> S;
	ll r = 0, g = 0, b = 0;
	rep( i, 0, N ){
		if (S[i] == 'R')
			r++;
		else if(S[i] == 'G')
			g++;
		else
			b++;
	}
	ll sum = r*g*b;
	ll sub = 0;
	rep(i,0,N){
		rep(j,i+1, N){
			ll k = 2*j-i;
			if (S[i] == S[j] || S[j] == S[k] || S[i] == S[k] || k >= N)
				continue;
			sub++;
		}
	}
	cout << sum - sub << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


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

#define NMAX 201
#define INF 2000000000

using namespace std;

int matrix[11][11];
int n, d;

double EuclidDist(int pointA[], int pointB[])
{
    double sum = 0;
    for(int i = 0; i < d; i++)
        sum += (pointA[i] - pointB[i]) * (pointA[i] - pointB[i]);
    return sum;
}

int main()
{
    cin >> n >> d;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < d; j++)
            cin >> matrix[i][j];
    int cntr = 0;
    for(int i = 0; i < n; i++)
        for(int j = i + 1; j < n; j++)
        {
            double dist = EuclidDist(matrix[i], matrix[j]);
            if(sqrt(dist) == int(sqrt(dist)))
                cntr++;
        }
    cout << cntr;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long M = long.Parse(str[1]);
		long ans = 0;
		while(N>=1){
			N /= M;
			ans++;
		}
		Console.WriteLine(ans);
	}
}


Measured memory_bytes: 13140
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = input().split()

lis = ["_", "H", "D"]

if a == "H":
	print(b)
else:
	print(lis[lis.index(b)*-1])


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


def pow(a, b, mod=10 ** 9 + 7):
    if b == 0:
        return 1
    elif b == 1:
        return a
    elif b % 2 == 0:
        return (pow(a, b // 2) ** 2) % mod
    else:
        return (a * pow(a, b // 2) ** 2) % mod


def inv(x, mod=10 ** 9 + 7):
    return pow(x, mod - 2, mod=mod)


def factorize(x):
    ans = {}
    v = 2
    while v * v <= x:
        if x % v == 0:
            ans[v] = 0
            while x % v == 0:
                x //= v
                ans[v] += 1
        v += 1
    if x != 1:
        ans[x] = 1
    return ans


def merge(d, c):
    for k, v in c.items():
        if k not in d:
            d[k] = v
        d[k] = max(d[k], v)


tmp = {}
for v in A:
    merge(tmp, factorize(v))
t = 1
mod = 10 ** 9 + 7
for k, v in tmp.items():
    t *= k ** v
    t %= mod
ans = 0
for a in A:
    ans += t * inv(a)
print(ans % mod)


Measured memory_bytes: 4596
#include<stdio.h>

int main(){
  int H,i,parentkey,leftkey,rightkey;
  scanf("%d",&H);
  int A[H];
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }
  for(i=1;i<=H;i++){
    if(i==1){
      leftkey=A[left(i)];
      rightkey=A[right(i)];
      printf("node %d: key = %d, left key = %d, right key = %d, \n",i,A[i],leftkey,rightkey);
    }
    else {
      parentkey=parent(i);
      leftkey=left(i);
      rightkey=right(i);
      if(leftkey<H){
	printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d, \n",i,A[i],A[parentkey],A[leftkey],A[rightkey]);
      }
      else if(leftkey==H){
	printf("node %d: key = %d, parent key = %d, left key = %d, \n",i,A[i],A[parentkey],A[leftkey]);
      }
      else
	  printf("node %d: key = %d, parent key = %d, \n",i,A[i],A[parentkey]);
    }
  }

  return 0;
}

parent(i){
  return i/2;
}

left(i){
  return 2*i;
}

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



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

int read();
int n;
int p[300005], lst[2];

bool sol(int l, int r) {
    for (int i = l; i <= r; ++i)
        if (p[i] < l || p[i] > r) return 0;
    lst[0] = lst[1] = 0;
    for (int i = l; i <= r; i += 2) {
        int t = p[i] > i;
        if (p[i] < lst[t]) return 0;
        lst[t] = p[i];
    }
    return 1;
}
int main() {
    n = read();
    for (int i = 1; i <= n; ++i) p[i] = read();
    for (int i = 1; i + 2 <= n; ++i)
        if (p[i] != i && p[i + 1] != i + 1 && p[i + 2] != i + 2)
            return puts("No"), 0;
    int l = 1, r;
    while (1) {
        while (l <= n && p[l] == l) l++;
        if (l > n) break;
        r = l;
        while (r + 2 <= n && p[r + 1] == r + 1 && p[r + 2] != r + 2) r += 2;
        if (!sol(l, r)) return puts("No"), 0;
        l = r + 1;
    }
    puts("Yes");
    return 0;
}

const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
int read() {
    int x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> B(N - 1);
  for (int i = 0; i < N - 1; i++) {
    cin >> B[i];
  }
  int res = B[0] + B[N - 2];
  for (int i = 0; i < N - 2; i++) {
    res += min(B[i], B[i + 1]);
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import java.util.Stack;


public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception addd) {
					addd.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception addd) {
				addd.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	
	public static FastReader sc = new FastReader();
 
	static int mod = (int) (998244353);
	static List<Integer>[] edges ;
	static long[][] dp;
	
	final static int MAX = Integer.MAX_VALUE/10 ;

	public static void main(String[] args) {
		  
		int n = sc.nextInt();
		int[] a = new int[n+1];
		Map<Integer,Integer> map = new HashMap<>();
		for(int i=1;i<=n;++i) {
			a[i] = sc.nextInt();
			map.put(a[i], map.getOrDefault(a[i], 0)+1);
		}
		long ans = 0;
		for(int key : map.keySet()) {
			long x = map.get(key);
			ans+=(x*(x-1))/2;
		}
		//out.println(ans);
		for(int i=1;i<=n;++i) {
			int key = map.get(a[i]);
			long temp = ans;
			temp-=(key*(key-1))/2;
			temp+=((key-1)*(key-2))/2;
			out.println(temp);
		}
	out.close();
}
}
	


Measured memory_bytes: 59572
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

// rep(i, 100) { cout << i << endl; } => 0 1 2 ... 99
#define rep(i, n) for(int i = 0, i##_len = (n); i < (int)n; i++)

// std::sort(all(v));
#define all(x) (x).begin(), (x).end()

// long long int
using ll = long long;

// utility to cast return value of size function to int
#define SZ(x) ((int)(x).size())

// VS defines "_DEBUG" macro when debug configuration.
#if _DEBUG
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define dump(x)
#define debug(x)
#endif

// update max
template<class T>bool chmax(T & prov, const T & cur)
{
	if (cur > prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

// update min
template<class T>bool chmin(T & prov, const T & cur)
{
	if (cur < prov)
	{
		prov = cur;
		return true;
	}
	return false;
}

int main()
{
	int N;
	cin >> N;
	switch (N % 10)
	{
	case 3:
		cout << "bon" << endl;
		break;
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		cout << "hon" << endl;
		break;
	default:
		cout << "pon" << endl;
		break;
	}
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<stack>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(n) n.begin(),n.end()
#define SIZE 2048

struct P{
  int x,y;
  P(int x1, int y1){x=x1,y=y1;}
};

bool board[SIZE][SIZE];

int compress(vector<int> &x1, vector<int> &x2, int W){
  vector<int> xs;
  unsigned int size = x1.size();
  for(int i=0; i<size; i++){
    for(int d=-1; d<=1; d++){
      int tx1 = x1[i] + d, tx2 = x2[i] + d;
      if(0<=tx1 && tx1 <=W) xs.push_back(tx1);
      if(0<=tx2 && tx2 <=W) xs.push_back(tx2);
    }
  }
  sort(all(xs));
  xs.erase(unique(all(xs)), xs.end());
  int end = 0;

  for(int i=0; i<size; i++){
    x1[i] = find(all(xs), x1[i]) - xs.begin();
    x2[i] = find(all(xs), x2[i]) - xs.begin();
    if(end<x2[i])
      end = x2[i];
  }
  return xs.size()-1;
}

void compress2(vector<int> &x1, vector<int> &x2, vector<int> &y1, vector<int> &y2, int &W, int &H){
  vector<int> xs, ys;
  unsigned int size = x1.size();
  for(int i=0; i<size; i++){
    for(int d=-1; d<=1; d++){
      int tx1 = x1[i] + d, tx2 = x2[i] + d, ty1 = y1[i] + d, ty2 = y2[i] + d;
      if(0<=tx1 && tx1 <=W) xs.push_back(tx1);
      if(0<=tx2 && tx2 <=W) xs.push_back(tx2);
      if(0<=ty1 && ty1 <=H) ys.push_back(ty1);
      if(0<=ty2 && ty2 <=H) ys.push_back(ty2);
    }
  }
  sort(all(xs)); sort(all(ys));
  xs.erase(unique(all(xs)), xs.end()); ys.erase(unique(all(ys)), ys.end());
  
  memset(board,0,sizeof(board));

  for(int i=0; i<size; i++){
    x1[i] = find(all(xs), x1[i]) - xs.begin();
    x2[i] = find(all(xs), x2[i]) - xs.begin();
    y1[i] = find(all(ys), y1[i]) - ys.begin();
    y2[i] = find(all(ys), y2[i]) - ys.begin();
    for(int y=y1[i]; y<y2[i]; y++){
      memset(board[y]+x1[i], 1, x2[i]-x1[i]);
    }
  }
  
  W = xs.size()-1; H = ys.size()-1;
}

void dfs(bool Map[SIZE][SIZE], P start, int W, int H){
  static const int dx[] = {0, 0, -1, 1}, dy[] = {1, -1, 0, 0};
  stack<P> st;
  st.push(start);
  while(st.size()){
    P s = st.top();
    st.pop();
    rep(i, 4){
      P t = P(s.x+dx[i], s.y+dy[i]);
      if(t.y>=0 && t.x>=0 && t.y<H && t.x<W && Map[t.y][t.x]==false){
	Map[t.y][t.x]=true;
	st.push(t);
      }
    }
  }
}

int main(){
  int W,H,N;
  while(cin>>W>>H, W|H){
    cin>>N;    
    vector<int> x1, x2, y1, y2;
    rep(i,N){
      int a, b, c, d;
      cin>>a>>b>>c>>d;
      x1.push_back(a);y1.push_back(b);
      x2.push_back(c);y2.push_back(d);
    }

    compress2(x1,x2,y1,y2,W,H);

    /*
    W = compress(x1, x2, W);
    H = compress(y1, y2, H);
    memset(board, 0, sizeof(board));
    rep(i, N){
      for(int y=y1[i]; y<y2[i]; y++){
	memset(board[y]+x1[i], 1, x2[i]-x1[i]);
      }
    }
    */

    int count = 0;
    rep(y, H){
      rep(x, W){
	if(board[y][x]!=true){
	  count++;
	  dfs(board, P(x, y), W, H);
	}
      }
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 7640
#include <cstdio>

int main(void)
{
    int a, b, c;
    int count = 0;
    scanf("%d %d %d", &a, &b, &c);

    for (int i=a; i<=b; i++) {
        if (c % i == 0)
            count++;
    }

    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 2740
n,A,B,C=map(int,input().split())
L=[int(input()) for i in range(n)]
r=10**5
def dsf(i,a,b,c,p):
    global r
    if i==n:
        if a!=0 and b!=0 and c!=0:
            p+=abs(A-a)+abs(B-b)+abs(C-c)-30
            r=min(r,p)
        return
    dsf(i+1,a+L[i],b,c,p+10)
    dsf(i+1,a,b+L[i],c,p+10)
    dsf(i+1,a,b,c+L[i],p+10)
    dsf(i+1,a,b,c,p)
dsf(0,0,0,0,0)
print(r)

Measured memory_bytes: 3064
s=input()
s1=int(s[0:2])
s2=int(s[2:4])
if (s1>=1 and s1<=12) and (s2>=1 and s2<=12):
    print("AMBIGUOUS")
elif (s1>=1 and s1<=12) or (s2>=1 and s2<=12):
    if (s1>=1 and s1<=12):
        print("MMYY")
    else:
        print("YYMM")

else:
    print("NA")


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

using namespace std;

const int MAXN=128;
const int MAXK=100000+100;
int a[MAXN];
bool dp[MAXK][2];
int n,k;

int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=k;i++){
		for(int j=1;j<=n;j++){
			if(a[j]<=i){
				if(!dp[i-a[j]][0]) dp[i][1]=1;
				if(!dp[i-a[j]][1]) dp[i][0]=1;
			}
		}
	}
	if(dp[k][0]) cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	return 0;
}


Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	if (x+y)%3 != 0 {
		fmt.Println(0)
		return
	}

	k := (x + y) / 3
	for i := 0; i <= k; i++ {
		j := k - i
		a := i*2 + j
		b := i + 2*j
		if a == x && b == y {
			ans := comb(k, j)
			fmt.Println(ans)
			return
		}
	}
	fmt.Println(0)
}

const mod int = 1e9 + 7

func comb(n, r int) int {
	nu := 1
	for i := 0; i < r; i++ {
		nu = mul(nu, n-i)
	}

	de := 1
	for i := 1; i <= r; i++ {
		de = mul(de, i)
	}

	return div(nu, de)
}

func pow(n, k int) int {
	if k == 0 {
		return 1
	} else if k%2 == 1 {
		return pow(n, k-1) * n % mod
	} else {
		t := pow(n, k/2)
		return t * t % mod
	}
}

func add(a, b int) int {
	return (a + b) % mod
}

func sub(a, b int) int {
	return (a + mod - b) % mod
}

func mul(a, b int) int {
	return a % mod * b % mod % mod
}

func div(a, b int) int {
	return mul(a, pow(b, mod-2))
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, K, S; cin >> N >> K >> S;
    vector<ll> a;
    rep(i, K){
        a.push_back(S);
    }
    rep(i, N-K){
        if(S+1 > 1000000000){
            a.push_back(S-1);
        }else{
            a.push_back(S+1);
        }
    }

    rep(i, N){
        cout << a[i];
        if(i != N-1) cout << " ";
        else cout << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 6388
import java.util.Scanner;

public 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 K = sc.nextInt();
		int sum = 0;

		if (A >= B && A >= C) {
			sum = countUp(A, K) + B + C;
		} else if (B >= A && B >= C) {
			sum = countUp(B, K) + A + C;
		} else {
			sum = countUp(C, K) + A + B;
		}
		System.out.println(sum);
	}

	public static int countUp(int baseCount, int roopCount) {
		for (int i = 1; i <= roopCount ; i++) {
			baseCount = baseCount*2;
		}
		return baseCount;
	}
}


Measured memory_bytes: 21844
use proconio::input;
use std::cmp::{max, min};

const MAX_L: usize = 100_000;
const BASE_SIZE: usize = 3 << 8;

fn main() {
    input! {
        n: usize,
        vw: [(u32, u32); n],
        q: usize,
        vl: [(usize, usize); q],
    }
    let dp = make_dp(&vw);
    for vlq in vl {
        println!("{}", calc(&vw, vlq.0 - 1, vlq.1, &dp));
    }
}

fn make_dp(vw: &Vec<(u32, u32)>) -> Vec<Vec<u32>> {
    let mut dp = Vec::<Vec<u32>>::new();

    dp.push(
        (0..=MAX_L)
        .map(|i| if i < (vw[0].1 as usize) { 0 } else { vw[0].0 })
        .collect()
    );

    let n = min(vw.len(), BASE_SIZE - 1);
    for c in 1..n {
        let p = (c - 1) / 2;
        dp.push(
            (0..=MAX_L)
            .map(|i| {
                let w = vw[c].1 as usize;
                let v = if i < w { 0 } else { dp[p][i - w] + vw[c].0 };
                max(dp[p][i], v)
            })
            .collect()
        );
    }

    dp
}

fn calc(
    vw: &Vec<(u32, u32)>,
    u: usize, 
    l: usize,
    dp: &Vec<Vec<u32>>
) -> u32 {
    if u < dp.len() {
        dp[u][l]
    } else {
        let p = (u - 1) / 2;
        let w = vw[u].1 as usize;
        let pv1 = calc(vw, p, l, dp);
        let pv2 = if l < w { 0 } else { calc(vw, p, l - w, dp) + vw[u].0 };
        max(pv1, pv2)
    }
}


Measured memory_bytes: 310624
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(),b=sc.nextInt(),x=sc.nextInt();
        System.out.println(a<=x&&x<=a+b?"YES":"NO");
    }
}


Measured memory_bytes: 21076
fun main(args: Array<String>){
    val N = readLine()!!.toInt()
    val (T, A) = readLine()!!.split(" ").map{it.toInt()}
    val H = readLine()!!.split(" ").map{it.toInt()}

    val a = H.mapIndexed { index, i ->
        val t = T- 0.006 * i
//        距離を求めている
        Pair(index+1, Math.abs(A-t))
    }.sortedBy { it.second }

    println(a.first().first)


}

Measured memory_bytes: 37820
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int ans=0;
  for(int i=1; i<=n; i++){
    int m=i,cnt=0;
    while(m!=0){
      m/=10;
      cnt++;
    }
    if(cnt%2==1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int powi(int b, int e) {
    int a = 1;
    while (e != 0) {
        a *= b;
        --e;
    }
    return a;
}

int main(void)
{
    int n, k;
    scanf("%d %d", &n, &k);
    printf("%d\n", k * powi(k - 1, n - 1));
    return 0;
}


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

flag = 0
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 and A[i] % 5 != 0:
             flag = 1
            
if flag == 1:
    print('DENIED')
else:
    print('APPROVED')

Measured memory_bytes: 3060
using System;
using System.Linq;

namespace ABC138B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = double.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray();

            var ans = 0.0;
            for (var i = 0; i < N; i++)
            {
                ans += 1 / A[i];
            }

            Console.WriteLine(1 / ans);
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define DEBUG 0
using namespace std;
const double pi=acos(-1);
const double eps=1e-6;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+100;

void solve()
{ 
	ll x,y;
	cin>>x>>y;
	if(x<=1&&y<=1){
		printf("Brown\n");
		return ;
	}
	if(x<y)swap(x,y);
	if(x-y>=2)printf("Alice\n");
	else printf("Brown\n");         
}
int main()
{
	//freopen("D://data.txt","r",stdin);
	//freopen("D://out.txt","w",stdout);
	//IOS;
	solve();
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;                                             ;;
	;;         ;;            ;;;;;;;;;       ;;    ;;
	;;        ;; ;;        ;;                ;;    ;;
	;;       ;;   ;;       ;;                ;;    ;;
	;;      ;;;;;;;;;      ;;                ;;    ;;
	;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
const int N=405, INF=1e9;
using namespace std;
int n, ans = 0, c[N][4];
map<array<int, 4>, int> mp;
vector< array<int, 4> > rottn;
int match(array<int, 4> x, array<int, 4> y)
{
    int ret = 0;
    for(int i = 0; i < 4; i++)
    {
        array<int, 4> tmp;
        for(int j = 0; j < 4; j++)
        {
            tmp[j] = y[(j+i)%4];
        }
        if(tmp==x) ret++;
    }
    return ret;
}
void print(array<int, 4> a)
{
    cout << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << endl;
}
signed main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 4; j++)
        {
            cin >> c[i][j];
        }
    }
    for(int i = 0; i < n; i++)
    {
        for(auto opp: rottn)
        {
            vector< array<int, 4> > prevo;
            array<int, 4> ori[4];
            ori[0] = {opp[1], opp[0], c[i][1], c[i][0]};
            ori[1] = {opp[3], opp[2], c[i][3], c[i][2]};
            ori[2] = {opp[0], opp[3], c[i][2], c[i][1]};
            ori[3] = {opp[2], opp[1], c[i][0], c[i][3]};
            int cnt = 1;
            prevo.pb(opp);
            for(int j = 0; j < 4; j++)
            {
                int tmpsum = mp[ori[j]];
                for(auto prev: prevo) tmpsum -= match(ori[j], prev);
                prevo.pb(ori[j]);
                cnt*=tmpsum;
            }
            ans += cnt;
        }
        for(int j = 0; j < 4; j++)
        {
            array<int, 4> tbp;
            for(int k = 0; k < 4; k++)
            {
                tbp[k] = c[i][(j+k)%4];
            }
            rottn.pb(tbp);
            mp[tbp]++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 120192
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double x = sc.nextDouble();
        double theta;
        final double PI = Math.PI;

        if (x > a * a * b / 2) {
            theta = Math.atan(2 * (a * a * b - x) / (a * a* a));
        } else {
            theta = Math.atan((a * b * b) / (2 * x));
        }

        theta = theta * 180 / PI;
        System.out.println(theta);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

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

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

Measured memory_bytes: 22996
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[m];
        int[] d = new int[m];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < m; i++) {
            c[i] = sc.nextInt();
            d[i] = sc.nextInt();
        }
        int tmp;
        int output = 0;
        for (int i = 0; i < n; i++) {
            tmp = Integer.MAX_VALUE;
            for (int j = 0; j < m; j++) {
                if (tmp > Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j])) {
                    tmp = Math.min(tmp, Math.abs(a[i] - c[j]) + Math.abs(b[i] - d[j]));
                    output = j + 1;
                }
            }
            System.out.println(output);
        }
    }
}


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

Measured memory_bytes: 3636
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

T = int(sys.stdin.readline())
ABCD = [list(map(int, sys.stdin.readline().split())) for _ in range(T)]


def solve(A, B, C, D):
    if B > D:
        return False
    if A < B:
        return False
    if C >= B:
        return True
    # C < B <= D
    # A から D を無限に足してったとき、mod B が C より大きくなったらだめ
    p = gcd(D, B)  # p ごとの値しか取らない
    if p < B - C:
        return False
    if (B - A - 1) % p < B - C - 1:
        return False
    return True


ans = []
for a, b, c, d in ABCD:
    ans.append('Yes' if solve(a, b, c, d) else 'No')
print(*ans, sep='\n')


Measured memory_bytes: 13668