akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

ll N;
ll a[1111], b[1111];

int main() {
   cin >> N;
   rep (i, N) {
      cin >> a[i] >> b[i];
   }

   ll x = 1, y = 1;
   ll n = 1;
   repp (i, 0, N) {
      if (i == 0) {
         n = 1;
      } else {
         n = max((a[i-1]*n + a[i]-1) / a[i], (b[i-1]*n + b[i]-1) / b[i]);
      }
      x = a[i] * n;
      y = b[i] * n;
   }
   cout << x + y << endl;

   return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG

using namespace std;

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

int n, a[N], b[N], mx;

int main()
{
    speed;
    /// Author: Dilshod--Imomov
    #ifdef DEBUGd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG
    cin >> n;
    for ( int i = 1; i <= n; i++ ) cin >> a[i];
    a[n + 1] = b[n + 1] = -1;
    for ( int i = n; i > 0; i-- ) {
        if ( a[i] >= a[i + 1] ) {
            b[i] = b[i + 1] + 1;
        }
        else {
            b[i] = 0;
        }
        mx = max( mx, b[i] );
    }
    cout << mx;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N; cin >> N;
    vector<ll> a(N), b(N), c(N);
    for(int i=0; i<N; ++i) cin >> a[i];
    for(int i=0; i<N; ++i) cin >> b[i];
    for(int i=0; i<N; ++i) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll ans = 0;
    for(int i=0; i<N; ++i){
        ll ctr = b[i];
        ll top = lower_bound(a.begin(), a.end(), ctr) - a.begin();
        ll btm = c.end() - upper_bound(c.begin(), c.end(), ctr);
        ans += top*btm;
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 2560
#include <stdio.h>

void selectionSort(int [],int);

int count=0;

int main(){
  int i,A[100],n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
selectionSort(A,n);

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

return 0;
}


void selectionSort(int A[],int N){
  int i,minj,j,t;
  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]){
        minj=j;
      }
    }
  if(i!=minj){
    t=A[i];
    A[i]=A[minj];
    A[minj]=t;
    count++;
  }
 }
}

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

namespace ConsoleApp1
{
    static class ARemainingBalls
    {
        static void Main(string[] args)
        {
            var st = Console.ReadLine().Split(' ').ToList();
            var s = st[0];
            var t = st[1];
            var ab = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            var a = ab[0];
            var b = ab[1];
            var u = Console.ReadLine();

            Console.WriteLine(s == u ? $"{--a} {b}" : $"{a} {--b}");
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}




int main(){

  ll H,W,K;
  cin >> H >> W >> K;
  vector<string> s(H);
  FOR(i,0,H) cin >> s[i];

  ll bl = 0,ans = 0;
  FOR(i,0,H)FOR(j,0,W) bl += s[i][j]=='#';

  FOR(i,0,1<<H){
    FOR(j,0,1<<W){

      ll cnt = 0;
      FOR(k,0,H)FOR(l,0,W){
        if( ((i&(1<<k)) || (j&(1<<l))) && s[k][l]=='#'){
          cnt++;
        }
      }
      if(bl - cnt == K)ans++;

    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define ll long long
#define fm_t  ll t;cin>>t;while(t--)
#define fr(i,a,b) for( ll i=a;i<b;i++)
#define fr1(i,n,a) for( ll i=n-1;i>=a;i--)
#define sz(x) (ll)(x).size()
#define all(v)  (v).begin(), (v).end()
#define Sort(x) sort(x.begin(),x.end())
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
const ll mod = 998244353;
#define Mod 1000000007

#define inf 1e18
#define ld long double
#define pll pair<ll, ll> 
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll >
#define pi pair<ll, ll>
#define ppi pair<pair<ll, ll>, ll>
#define ump unordered_map<ll,ll>
#define pri priority_queue< pair<ll,ll> , vector< pair<ll,ll> >, greater< pair<ll,ll> > >
void ingraph(vl graph[], ll m){ll x, y;fr(i,0,m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}

#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)

//setprecision(10)
//greater<int>()
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}


ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll modinv(ll a){
    return modpower(a,mod-2);
}   
     
int main()
{
      
  fast;
  ll n;
  cin>>n;

  ll dp[n][3];
  memset(dp,0,sizeof(dp));
  ll v[n][3];
  fr(i,0,n)
  cin>>v[i][0]>>v[i][1]>>v[i][2];
  dp[0][0]=v[0][0];
  dp[0][1]=v[0][1];
  dp[0][2]=v[0][2];
  //cout<<endl;
  for(ll i=1;i<n;i++)
  {
    for(ll j=0;j<3;j++)
    {
      dp[i][j]=max(dp[i][j],dp[i-1][(j+1)%3]+v[i][j]);
      dp[i][j]=max(dp[i][j],dp[i-1][(j+2)%3]+v[i][j]);
     // cout<<dp[i][j]<<" ";
    }
   // cout<<endl;

  }
  //cout<<dp[n-1][0]<<endl;
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
    
//cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  bool frag=true;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(a.at(i)%2==0){
      if(a.at(i)%3!=0&&a.at(i)%5!=0){
        frag=false;
      }
    }
  }
  if(frag==true){
    cout << "APPROVED" << endl;
  }else{
    cout << "DENIED" << endl;
  }
}

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n - 1; i++) {
    int zero = a[i] / 2;
    a[i] -= 2 * zero;
    ans += zero;
    int one = min(a[i], a[i + 1]);
    a[i] -= one;
    a[i + 1] -= one;
    ans += one;
  }
  ans += a[n - 1] / 2;
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 640
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  // const int64_t L = static_cast<int64_t>(T.length());
  map<int64_t, int64_t> counts;
  for (int64_t i = 0; i < N; ++i) {
    int64_t a;
    cin >> a;
    if (counts.find(a) == counts.end()) {
      counts[a] = 1;
    } else {
      ++counts[a];
    }
  }
  auto begin = counts.begin();
  auto middle = counts.begin();
  ++middle;
  auto end = counts.end();
  --end;
  int64_t result = N;
  while (begin != middle && middle != end) {
    if (begin->second < 2) {
      ++begin;
      if (begin == middle) {
        ++middle;
      }
    } else if (end->second < 2) {
      --end;
      if (middle == end) {
        --middle;
      }
    } else {
      --begin->second;
      --end->second;
      result -= 2;
    }
  }
  while (begin->second >= 3) {
    begin->second -= 2;
    result -= 2;
  }
  while (end->second >= 3) {
    end->second -= 2;
    result -= 2;
  }
  if (begin->second > 1 || end->second > 1) {
    result -= 2;
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 9832
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
ans=0
word={}
for i in range(n):
  if s[i] not in word.keys():
    word[s[i]]=0
  word[s[i]]+=1
for i in range(m):
  if t[i] not in word.keys():
    word[t[i]]=0
  word[t[i]]-=1
for i in word.keys():
  if ans < word[i]:
    ans=word[i]
print(ans)

Measured memory_bytes: 3064
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007
#define int long long

typedef pair<int, int> pint;
typedef long long ll;

int solve(int n, int x)
{
    if (n == 0)
    {
        return 1;
    }
    if (x == 1)
    {
        return 0;
    }
    else if (x <= (1ull << (n + 1)) - 2)
    {
        return solve(n - 1, x - 1);
    }
    else if (x == (1ull << (n + 1)) - 1)
    {
        return (1ull << n);
    }
    else if (x <= (1ull << (n + 2)) - 4)
    {
        return (1ull << n) + solve(n - 1, x - (1ull << (n + 1)) + 1);
    }
    else
    {
        return (1ull << (n + 1)) - 1;
    }
}

signed main()
{
    int N, X;
    cin >> N >> X;
    cout << solve(N, X) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

constexpr array<int, 100> A = {1, 1,  1, 2, 1,  2, 1, 5, 2, 2, 1,
                               5, 1,  2, 1, 14, 1, 5, 1, 5, 2, 2,
                               1, 15, 2, 2, 5,  4, 1, 4, 1, 51};

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

    int k;
    cin >> k;

    cout << A[k - 1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=1e9+7;
const int MAX=300010;



signed main(){
    ll h,w;cin>>h>>w;
    ll ch,dh,cw,dw;cin>>ch>>dh>>cw>>dw;
    ch--;
    dh--;
    cw--;
    dw--;
    vector<string>s(h);
    rep(i,h)cin>>s[i];
    deque<pll>q;
    vector<vector<ll> >d(h,vector<ll>(w,inf));
    vector<vector<vector<ll> > >used(h,vector<vector<ll> >(w,vector<ll>(2)));
    q.push_front(mp(ch,dh));
    d[ch][dh]=0;
    used[ch][dh][0]=1;
    while(!q.empty()){
        pll k=q.front();
        ll x=k.fi;
        ll y=k.se;
        q.pop_front();
        rep(i,5){
            rep(j,5){
                ll nx=x-2+i;
                ll ny=y-2+j;
                if(nx<0||nx>=h||ny<0||ny>=w)continue;
                if(s[nx][ny]=='#')continue;
                if(nx==x&&ny==y)continue;
                if(abs(nx-x)+abs(ny-y)==1){
                    if(!used[nx][ny][0]){
                        q.push_front(mp(nx,ny));
                        used[nx][ny][0]=1;
                    }
                    d[nx][ny]=min(d[x][y],d[nx][ny]);
                }else{
                    if(!used[nx][ny][1]){
                        q.push_back(mp(nx,ny));
                        used[nx][ny][1]=1;
                    }
                    d[nx][ny]=min(d[nx][ny],d[x][y]+1);
                }
            }
        }
    }
    if(d[cw][dw]!=inf)cout<<d[cw][dw]<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 68332
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    int solve(vector<int>& A) {
        const long long MOD = 1e9 + 7;
        int N = *max_element(A.begin(), A.end());
        N += 10;

        vector<long long> invs(N + 1, 1);
        for (int i = 2; i <= N; ++i) {
            invs[i] = (MOD - MOD / i) * invs[MOD % i] % MOD;
            assert(i * invs[i] % MOD == 1);
        } 
        vector<int> smallestPrimeFactors(N + 1, 1);
        smallestPrimeFactors[0] = 1;
        vector<int> primes;
        primes.reserve(N);
        for (int i = 2; i <= N; ++i) {
            if (smallestPrimeFactors[i] == 1) {
                primes.push_back(i);
                smallestPrimeFactors[i] = i;
            }
            for (auto p : primes) {
                long long t = p * 1LL * i;
                if (t > N) {
                    break;
                }
                smallestPrimeFactors[t] = p;
                if (i % p == 0) {
                    break;
                }
            }
        }

        map<int,int> cnts;
        for (auto x : A) {
            while (x > 1) {
                int p = smallestPrimeFactors[x];
                int cnt = 0;
                while (x % p == 0) {
                    x /= p;
                    ++cnt;
                }
                cnts[p] = max(cnts[p], cnt);
            }
        }
        long long LCM = 1;
        for (auto& p : cnts) {
            int x = p.first;
            int cnt = p.second;
            for (int i = 0; i < cnt; ++i) {
                LCM = LCM * x % MOD;
            }
        }
        // cout << "LCM " << LCM << endl;
        long long res = 0;
        for (auto x : A) {
            // cout << x << " " << invs[x] << endl;
            res += LCM * invs[x] % MOD;
        }
        res %= MOD;
        return res;
    }
};

int main(int argc, char** argv) {
    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];
    }
    Solution sol;
    cout << sol.solve(A) << '\n';
    return 0;
}

Measured memory_bytes: 14720
#include <stdio.h>

#define LIMIT 5000

void InputNumber(int* number, int limitLow, int limitHigh);
int GetDivisor(int* pArr, int number);

int main(void) {
    int a;
    int b;
    int c;
    int arr[LIMIT];
    int size;
    int i;
    int count = 0;

    InputNumber(&a, 1, 10000);
    do {
        InputNumber(&b, 1, 10000);
    } while (b < a);
    InputNumber(&c, 1, 10000);

    size = GetDivisor(arr, c);
    for (i = 0; i < size; i++) {
        int curNumber = arr[i];
        if (curNumber >= a && curNumber <= b) {
            count++;
        }
    }

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

void InputNumber(int* number, int limitLow, int limitHigh) {
    int x;
    do {
        scanf("%d", &x);
    } while (x < limitLow || x > limitHigh);
    *number = x;
}

int GetDivisor(int* pArr, int number) {
    int retCount = 0;

    if (number == 1) {
        *pArr++ = 1;
        *pArr = '\0';
        retCount = 1;
    } else {
    	int idx;
		for (idx = 1; idx <= number / 2; idx++) {
			if (number % idx == 0) {
				*pArr = idx;
				pArr++;
				retCount++;
			}
		}

		if ((*pArr == idx) == 0) {
			*pArr++ = number;
			retCount++;
		}
		*pArr = '\0';
    }

    return retCount;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n, m;
    scanf("%lld %lld",&n,&m);
    m=m/2;
    if(m<=n)printf("%lld\n",m);
    else printf("%lld\n",n+(m-n)/2);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define all(x)	x.begin(),x.end()
#define fileopen freopen("input.txt", "rt", stdin);
#define fileclose freopen("output.txt", "wt", stdout);
#define Fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hash visited.max_load_factor(0.25);visited.reserve(512)

using namespace std;

int main()
{
    Fio;
    
    ll a,b,c,k;
    ll k_temp;
    cin>>a>>b>>c>>k;
    if(k<=a)
    {
        cout<<k;
    }
    if(k>a)
    {
        k_temp=k;
        k=k-a;
        if(k<=b)
        {
            cout<<a;
           
        }
        else
        {
            k=k-b;
            cout<<a-k;
        }
        
    }


    
  


    
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll n ; cin >> n ;
	for(int i=1;i<=n;i++){
		ll cnt = 0 ;
		for(int a=1;a*a<=i;a++){
			for(int b=1;b*b<=i;b++){
				if(b*b+a*a>=i) break ;
				for(int c=1;c*c<=i;c++){
					if(a*a+b*b+c*c>=i) break ;
					if(a*a+b*b+c*c+a*b+b*c+c*a==i) cnt++ ;
					else if(a*a+b*b+c*c+a*b+b*c+c*a>i) break ;
				}
			}
		}
		cout << cnt << endl ;
	}
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) 1e9
#define endl "\n"
#define tt ll testcase; cin>>testcase; while(testcase--)
 
int main(){
	fast;
	ll n;
	cin>>n;
	double ans = 2*((double)n)*(3.14159);
	printf("%.3lf", ans);
}

Measured memory_bytes: 3776
k = int(input())
s = 7
num = 1
res = True
if k == 2:
    print(-1)
else:
    for i in range(k):
        s %= k
        if s == 0:
            res = False
            print(num)
            break
        num += 1
        s *= 10
        s += 7
    if res:
        print(-1)

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define F first
#define S second

const int MAXN = 2e5 + 10;

int n;
ll a[MAXN], pt[MAXN];
map<ll, int> mp;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	ll ans = 0;
	mp[0]++;
	for (int i = 0; i < n; i++){
		cin >> a[i], pt[i+1] = pt[i] + a[i];
		ans += mp[pt[i+1]]++;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int n,k;
  cin>>n>>k;
  int p[1000] = {0};
  for (int i=0; i<n; i++){
    int a;
    cin>>a;
    p[a-1]+=1;
  }
  int score=0;
  int index=0;
  for (int i=0;i<1000;i++){
    if(p[i]!=0){
      for(int j=0;j<p[i];j++){
        score+=i+1;
        index+=1;
        if (index==k) break;
      }
    }
    if(index==k) break;
  }
  cout<<score<<endl;
  return 0;
}

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

using namespace std;

int n;
char s[300005];
int d1[300005];
int d2[300005];
int main()
{
    scanf("%d", &n);
    scanf("%s", s + 1);
    for(int i = 1; i <= n ; ++i) d1[i] = d1[i - 1] + (s[i] == 'W');
    for(int i = n; i >= 1 ; --i) d2[i] = d2[i + 1] + (s[i] == 'E');
    int Sol = n - 1;
    for(int i = 1; i <= n ; ++i){
        Sol = min(Sol, d1[i - 1] + d2[i + 1]);
    }
    printf("%d", Sol);

    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <cmath>

using namespace std;

bool isPrime(int n) {
    int last = sqrt(n);
    for (int i = 2; i <= last; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    int array[n];
    for (int i = 0; i < n; i++) {
        cin >> array[i];
    }

    int count = 0;

    for (int i = 0; i < n; i++) {
        if (isPrime(array[i])) {
            count++;
        }
    }
    cout << count << "\n";
}

Measured memory_bytes: 3104
s = gets.chomp
t = gets.chomp
n = s.length
flg = 0
for i in 0...n
	if(s == t)then
		flg = 1
		break
	end
	s << s[0]
	s.slice!(0)
end
if(flg == 1)then
	puts "Yes"
else
	puts "No"
end


Measured memory_bytes: 1788
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main(){
    int n;
    while(~scanf("%d",&n)){
        char s1[200];
        char s2[200];
        char s[200];
        scanf("%s",s1);
        scanf("%s",s2);
        int i,j;
        for(i=0;i<n;i++){
            for(j=i;j<n;j++){
                s[j-i]=s1[j];
            }
            s[j-i]='\0';
            int len=strlen(s);
            for(j=0;j<len;j++){
                if(s[j]!=s2[j]){
                    break;
                }
            }
            if(j==len)
                break;
        }
        int h=i*2+(n-i);
        cout<<h<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
class dice init =
  let rot_n (x1,x2,x3,x4,x5,x6) = (x2,x6,x3,x4,x1,x5) and
      rot_e (x1,x2,x3,x4,x5,x6) = (x4,x2,x1,x6,x5,x3) in
  let rot_s l = rot_n l |> rot_n |> rot_n and
      rot_w l = rot_e l |> rot_e |> rot_e in
  let all_init =
    let rec rotate d list = function
        0 -> list
      | i -> rotate (rot_e d) (d::list) (i-1) in
    let rotate2 n l = rotate n l 4 in
    rotate2 init []
    |> rotate2 (rot_e init |> rot_s)
    |> rotate2 (rot_w init |> rot_s)
    |> rotate2 (rot_n init)
    |> rotate2 (rot_s init)
    |> rotate2 (rot_n init |> rot_n) in
object (self: 'self)
  val mutable faces:int*int*int*int*int*int = init
  val all:'a list = all_init

  method get_face = faces
  method get_all = all
  method equals (other:'self) = self#contains other#get_face
  method contains fc =
    let rec find l = match l with
        [] -> false
      | (x1,x2,x3,x4,x5,x6)::tl -> if (x1,x2,x3,x4,x5,x6) = fc then true else find tl
    in find all
end;;

let split_int s = Str.split (Str.regexp_string " ") s |> List.map int_of_string;;
let () =
  let f n = (n 0,n 1,n 2,n 3,n 4,n 5) in
  let nth s = split_int s |> List.nth in
  let d1 = new dice (read_line () |> nth |> f) and
      d2 = new dice (read_line () |> nth |> f) in
  if d1#equals(d2) then print_endline "Yes"
  else print_endline "No"
;;

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

int main()
{
    int a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(i==a){
            if(s[i]!='-')
                return cout<<"No",0;}
        else
        {
            if(isdigit(s[i])==0)return cout<<"No",0;
        }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
from __future__ import division, print_function
from sys import stdin
while True:
    n, x = (int(s) for s in stdin.readline().split())
    if n == 0 and x == 0:
        break
    n += 1
    cnt = 0
    for a in range(1, n):
        if a >= x:
            break
        for b in range(a+1, n):
            ab = a + b
            if ab >= x:
                break
            for c in range(b+1, n):
                abc = ab + c
                if abc == x:
                    cnt += 1
                    break
                if abc > x:
                    break
    print(cnt)

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

int main(){
    int cnt[26];
    char c;
    for(int i=0;i<26;i++){
        cnt[i]=0;
    }
    while(scanf("%c",&c)!=EOF){
        if(isupper(c)){
            cnt[static_cast<int>(c)-65]+=1;
        }else if(islower(c)){
            cnt[static_cast<int>(c)-97]+=1;
        }
    }
    for(int i=0;i<26;i++){
        printf("%c : %d\n",static_cast<char>(i+97),cnt[i]);
    }
    return 0;
}


Measured memory_bytes: 3128
#include<iostream>
#include<string>

using namespace std;

int main()
{
	int N;
	double x;
	string u;

	double ans = 0;

	cin >> N;

	for(int i=0;i<N;i++)
	{
		cin >> x >> u;

		if(u == "JPY")
		{
			ans += x;
		}
		else if(u == "BTC")
		{
			ans += (x * 380000.0);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
if M==1: print(1);exit()
if N==1: print(M); exit()
ans = 1
for i in range(2,int(M**(1/2)+2)):
    if M%i==0:
        p = M//i
        if p <=M/N:
            ans = max(p,ans) 
        if i<=M/N:
            ans = max(ans,i)
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm> // sort
#include <iomanip>
#include <queue>
#include <map>
#include <bits/stdc++.h>

using namespace std;

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll INF = 1000000000000000000LL;
typedef pair<int,int> pint;

const int MOD = 1000000007;

ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b; //あまりが0ならそれが、最大公約数
}

int main(){

#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll n,k;
    cin >> n >> k;
    vector <ll> a(n);
    ll iMax = 0;
    string res;
    
    REP(i,n)
    {
        cin >> a[i];
        iMax = max(iMax, a[i]);
    }

    ll g = a[0];
    REP(i,n)
    {
        g = gcd(g,a[i]);
    }

    // kはgで割り切れて、max以下であればよい
    if(k % g == 0 && iMax >= k)
    {
        res = "POSSIBLE";
    }
    else
    {
        res = "IMPOSSIBLE";
    }
    
    cout << res << endl;

    return 0;     
}



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

int main() {
    int N, W;
    cin >> N >> W;
    int w[N], v[N];
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }
    int v_sum = accumulate(v, v + N, 0);
    long weights[v_sum + 1];
    weights[0] = 0;
    for (int i = 1; i <= v_sum; i++) {
        weights[i] = W + 1;
    }
    for (int i = 0; i < N; i++) {
        for (int j = v_sum - v[i]; j >= 0; j--) {
            weights[v[i] + j] = min(weights[j] + w[i], weights[v[i] + j]);
        }
    }
    int ans = 0;
    for (int i = 0; i <= v_sum; i++) {
        if (weights[i] <= W)
            ans = i;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1024
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

int main(void){
	int n;
	cin >> n;
	for(int j=0; j<n; ++j){
		int len[3];
		for(int i=0; i<3; ++i){
			cin >> len[i];
		}

		sort(len, len+3);

		if(len[0]*len[0] + len[1]*len[1] == len[2]*len[2]){
			cout << "YES"<< endl;
		} else {
			cout << "NO" << endl;
		}
	}



	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int A, B, C; cin >> A >> B >> C;
  if(B < A) swap(A, B);
  if(A < C && C < B) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main() {
	int x, h;
	while(scanf("%d%d", &x, &h), x||h){
		// sqrt(x^2+4*h^2)*x+x^2
		printf("%f\n", sqrt(x*x+4*h*h)*x+x*x);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void){
    // Your code here!
    int time = 0;
    int hour = 0;
    int minute = 0;
    int second =0;
    
    scanf("%d", &time);
    
    hour = time/3600;
    
    //minute = second%3600;
    minute = time%3600;
    minute = minute/60;
    
    second = time%60; 
    
    printf("%d:%d:%d\n", hour,minute,second);
}



Measured memory_bytes: 2144
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        String S = sc.next();
        int a = 0;
        for(int i=0;i<3;i++)a += S.charAt(i)=='A'?1:0;
        int b = 3-a;
        System.out.println(a==0||b==0 ? "No":"Yes");
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 22740
/* 
                     ... .
               xdM*"""*+"9M
            xM"             "M
          MP"                 "M
        ,M/|,                 \`4
      n"   /|/.          .\  \\``4
     d)    <~!-'        \^`\  `   n
     M"                           \
     M.          !: uu<            ;
     M@ @        !$$$$!:           r
       h?M  <.`.`t$$$$X".( /< xh   >
        "M <`:x~NX$$$$Ub>*cXW !X   L
         M `X!@k:$$$$$$$r $$$Lr    M
         M   '9$$$$$$$$$$$$$F"     4
         ~    ?$$$x$$$$$$$$P        M
        h      !$$$d%m@$$"f          L
        *        #$$$$$)$:>           ":,
         x      ` `#$R!$\!  :            "\._
          h   < < !..!JR  ~<<             -n.`\
       ..x**  < 'ouk!!$f~  <<   ...         ^*.;
   ....( !! << \NdC*$@$><~  << !!!:!!<.       "M
  xJ"<!!<!~<<<dNeRV$$$R    <<< !!!!!!:<:       `M
  M%<!!!! <<~:`(3$$$R?<<<<<<~< !!?!:<<<<<       M
  M<<!!!!' :<<:x$$$!!<<<<<<<<.!~:~<<<<<<<   k   M
 n!<<<!   <<<~<$$$?~ '<<<<<<:'.!`<<<<<~ ~  :|  /
 M<<<<   '  ~ <$$R?.  `<~   <'!<<< <<<< ~  ;/ z
 "<<<<<  : < <  M#!    <<   <<   <<<<<<h> / v'
  <<<<<>< <~<<   .uoN :<<<  <<  <<<<<<<:eVa
  <<<<<< '<<<    !$$$$<<<<<   :<<<<<<<<<<' )
  <<<<<` < <~     R$$$N      <<<<<<<<<<<<e~
  <<< <   `        $$$$$.    ~``~<<<<<< x"
  k<<<<            `$$$$$b   :<<<<`<<<<MC
  M<<<<             "$$$$$!<< :<`~<<!<d""
  f<<<<:             #$$$$!<<<<~<:<<<<M
 P<<<:<<~  :          #$$?~ <<   <`<<tM
 <<<<~:~`<<<<::        "`   `<     ~MJ>
 :<< ~:<<<<<::.                  ..<$f
 M  <<<<<<:!XN$$$bu.        ..uo$#3$!4M
  x  <<~  !!#$$$$$$$$$eiL.d$$$#\Le$!!XP
  '.       !!!!??#$$$$$$$$$$$****#?XMr
    `-.            ```~""!!!!!!XXnHC
       `-'\               '"*xd
*/

#include <bits/stdc++.h>
using namespace std;

int main(){
  int i1=-1,j1=-1;
  string s;
  cin >> s;
  bool unbalanced=false;
  for (int i = 1; i < s.length(); ++i)
  {
    if (unbalanced)
    {
      break;
    }
    if (s[i]==s[i-1])
    {
      i1=i-1;
      j1=i;
      unbalanced=true;
    }
    if (i>1){
      if (s[i]==s[i-2]){
        i1=i-2;
        j1=i;
        unbalanced=true;
      }
    }
  }
  if (i1==-1) cout << -1 << " " << -1;
  else cout << i1+1 << " " << j1+1;
  return 0;
}

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

using namespace std;
using ll = long long;

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

	int n;
	cin >> n;
	vector<int> a(n);
	for (auto &el : a) {
		cin >> el;
	}

	a.push_back(0);
	n++;

	ll money = 1000;
	int since = 0;
	for (int i = 1; i < n; i++) {
		if (a[i] >= a[i - 1]) {
			continue;
		}
		ll cnt = money / a[since];
		money += cnt * (a[i - 1] - a[since]);
		since = i;
	}

	cout << money;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <set>

using namespace std;
typedef long long lint;

string solve(const vector<int>& A) {
    const int N = A.size();
    lint sum = 0;
    for (int i = 0; i < N; i++) {
        sum += A[i];
    }
    lint unit = 0;
    for (int i = 0; i < N; i++) {
        unit += i+1;
    }
    if (sum % unit != 0) return "NO";
    lint num = sum / unit;
    for (int i = 0; i < N; i++) {
        if (num > A[i]) return "NO";
    }
    lint cnt = 0;
    for (int i = 0; i < N; i++) {
        int ni = (i+1) % N;
        lint diff = (A[i] + num) - A[ni];
        if (diff % N != 0) return "NO";
        cnt += diff / N;
    }
    return (cnt == num) ? "YES" : "NO";
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    cout << solve(A) << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric> // accumulate
#include <queue>
#include <string>
#include <cmath> // sqrt
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, k;
    cin >> n >> k;
    vector<pair <ll, ll> > posx(n), posy(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        posx[i] = make_pair(x, y);
        posy[i] = make_pair(y, x);
    }
    sort(posx.begin(), posx.end());
    sort(posy.begin(), posy.end());

    ll ans = 1e20;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            for (int l = 0; l < n; l++) {
                for (int m = l; m < n; m++) {
                    ll xmin = posx[i].first;
                    ll xmax = posx[j].first;
                    ll ymin = posy[l].first;
                    ll ymax = posy[m].first;
                    ll count = 0;
                    for (int t = 0; t < n; t++) {
                        if (xmin <= posx[t].first && posx[t].first <= xmax && ymin <= posx[t].second && posx[t].second <= ymax) {
                            count += 1;
                        }
                    }
                    if (count >= k) {
                        ans = min(ans, (xmax-xmin) * (ymax-ymin));
                    }
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    vint H(N);
    rep(i, N) cin >> H[i];
    unordered_map<int, set<int>> graph;
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        graph[a].insert(H[b - 1]);
        graph[b].insert(H[a - 1]);
    }

    ll ans = 0;
    REP(i, 1, N + 1) {
        if (graph[i].size() == 0) {
            ans++;
            continue;
        }
        if (graph[i].lower_bound(H[i - 1]) == graph[i].end()) ans++;

    }


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

Measured memory_bytes: 21832
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int[] a = new int[n];
        long[] n_1_N = new long[n+1];
        for(int i=0; i<=n; i++){
            n_1_N[i]=0;
        }
        
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
            n_1_N[a[i]]++;
        }
        
        long combi_sum = 0;
        for(int i=1; i<=n; i++){
            long tmp = n_1_N[i];
            if(tmp > 1) combi_sum += tmp*(tmp-1);
        }
        combi_sum /=2;
        
        for(int i=0; i<n; i++){
            long tmp = n_1_N[a[i]];
            if(tmp > 1){
                tmp--;
                System.out.println(combi_sum-tmp);
            }else{
                System.out.println(combi_sum);
            }
        }
        
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 75884
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "strings"
)

func main() {
  var n,m int = Next2Ints()
  initlz(n)
  for i:=0;i<m;i++ {
    var x,y,_ int = Next3Ints()
    unite(x-1,y-1)
  }
  set := make(map[int]struct{})
  for i:=0;i<n;i++ {
    set[find(i)] = struct{}{}
  }
  fmt.Println(len(set))
}

var par,rank []int
func initlz(n int) {
  par = make([]int,n)
  rank = make([]int,n)
  for i:=0;i<n;i++ {
    par[i] = i
  }
}
func find(i int) int {
  if par[i] == i { return i }
  par[i] = find(par[i])
  return par[i]
}
func same(i,j int) bool {
  return find(i) == find(j)
}
func unite(i,j int) {
  i = find(i)
  j = find(j)
  if i == j { return }
  if rank[i] < rank[j] {
    par[i] = j
  } else {
    par[j] = i
    if rank[i] == rank[j] { rank[i]++ }
  }
}

var reader = bufio.NewReaderSize(os.Stdin,1000000)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func Next2Ints() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}
func Next3Ints() (int,int,int) {
  var x,y,z int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  z,_ = strconv.Atoi(s[2])
  return x,y,z
}

Measured memory_bytes: 7808
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
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;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;



int main(){
  int N; cin >> N;
  vector<int> bits;
  rep(i, 21){
    if((1<<i)&N){
      bits.push_back(i);
    }
  }
  reverse(bits.begin(), bits.end());
  int V = bits[0]+1;
  int E = 2*bits[0]+bits.size()-1;
  cout << V << " " << E << endl;
  rep(i, V-1){
    cout << i+1 << " " << i+2 << " " << 0 <<endl;
    cout <<  i+1 << " " << i+2 << " " << (1<<i) << endl;
  }
  int cost = (1<<(V-1));
  rep(i, bits.size()-1){
    cout << bits[i+1]+1 << " " << V << " " << cost << endl;
    cost+=(1<<bits[i+1]);
  }  
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
using namespace std;

using ll = long long;
using ii = pair<ll, ll>;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n;
    cin >> n;
    int a[n];
    rep(i, n) {
        cin >> a[i];
        a[i] /= 400;
    }

    map<int, int> m;
    rep(i, n) {
        if (m[a[i]] == 0) {
            m[a[i]] = 1;
        } else {
            m[a[i]] += 1;
        }
    }

    int ans_min = 0;
    int ans_over = 0;
    for (auto iter = m.begin(); iter != m.end(); iter++) {
        if (iter->first < 8) {
            ans_min++;
        } else {
            ans_over += iter->second;
        }
    }

    int ans_max = ans_over + ans_min;

    if (ans_min == 0) {
        ans_min = 1;
    }

    cout << ans_min << " " << ans_max << endl;

    return 0;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MEM 1000005
#define sanic ios_base::sync_with_stdio(0)
using namespace std;
long long n,m;
main()
{
    sanic;
    cin >> n >> m;
    if(n==1) cout << 1;
    else if(m==1) cout << 1;
    else if(m%2)cout << m*(n/2)+(n%2)*(m/2+1);
    else cout << (m*n/2);
}


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

class Program
{
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
		bool flag = false;

		for (int x = 0; x <= input[0]; x++)
		{
			if (flag) break;
			for (int y = 0; y <= input[0] - x; y++)
			{
				var a = (1000 * x) + (5000 * y) + (10000 * (input[0] - x - y));
				if (a == input[1])
				{
					Console.WriteLine((input[0] - x - y).ToString() + " " + y.ToString() + " " + x.ToString());
					flag = true;
					break;
				}
				else if (a < input[1])
				{
					break;
				}
			}
		}

		if (!flag)
		{
			Console.WriteLine("-1 -1 -1");
		}
	}
}

Measured memory_bytes: 13396
#include <stdio.h>

int main(void)
{
	int a, b;
	scanf("%d", &a);
	scanf("%d", &b);
	int n = a + b + 1;
	char s[n];
	scanf("%s", s);
	for(int i = 0; i < n; i++) {
		if(i == a) {
			if(s[i] != '-') {
				printf("No\n");
				return 0;
			}
		} else {
			if(s[i] < '0' || '9' < s[i]) {
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128