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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//型名省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define tll(n) array<long long,(int)(n)>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define vt(n) vector<array<long long,(int)(n)>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define Fi first
#define Se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define bitrep(i,s,n) for(long long i=(s);i<(1LL<<(n));i++)
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define lin(s) getline(cin,(s))
#define Ssort(v) sort((v).begin(),(v).end(),[](auto &left,auto &right){return left.second<right.second;})

//Yes,No
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
//YES.NO
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//累乗
template<typename t>
constexpr t mypow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
        }
    return x;
}
#define pow mypow

//chmin,chmax
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

//main関数
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s;
    rep(i,3){
        if(s[i]=='9')s[i]='1';
        else if(s[i]=='1')s[i]='9';
    }
    cout<<s<<endl;
}

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

int main() {
  
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  
  
  string s;
  
  cin >> s;
  
  
  int i = 0;
  int j = s.length() - 1;
  
  bool fail = false;
  
  int ans = 0 ;
  
  while ( i <= j ) {
    
    if ( s[i] == s[j] ) {
      i++;
      j--;
    }
    else {
      
      if ( s[i] == 'x' ) {
        i++;
        ans++;
      }
      else if ( s[j]  == 'x' ) {
        j--;
        ans++;
      }
      else {
        fail = true;
        break;
      }
      
    }
    
  }
  
  
  if ( fail ) cout << -1 << endl;
  else cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  int ans = 1;
  for (int i = 0; i < N - 1; i++) {
    if(data.at(i) < data.at(i + 1)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const ll mod = 1e9 + 7;

ll modpow(ll p,ll q){
    if(q == 0) return 1;
    if(q%2 == 0){
        ll x = modpow(p,q/2);
        return x*x%mod;
    }else{
        return modpow(p,q-1)*p%mod;
    }
}


int main(void){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll n,a,b,ans;
    cin >> n >> a >> b;
    ll cnt = n/(a+b);
    ll mo = n%(a+b);
    if(mo >= a){
        ans = (cnt+1)*a;
    }else{
        ans = cnt*a + mo;
    }

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

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3") 
#pragma GCC optimization ("unroll-loops")
 
// #include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
// const ll RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
// gp_hash_table<int, int> table;
 
#define ll  long long
#define vii vector< ll >
#define pb push_back
#define pii pair<ll,ll>
#define ppi pair<pii,ll>
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define ins insert
#define ld long double
#define lp(l,r) for(i=l;i<=r;++i)
 
#define lpj(l,r) for(j=l;j<=r;++j)
#define lpr(l,r) for(i=r;i>=l;--i)
#define lprj(l,r) for(j=r;j>=l;--j)
 
#define swap(a,b){ auto _t=a;a=b,b=_t;}
#define flush() cout.flush()
#define popcount __builtin_popcount
#define die() return 0;
#define sz() size() 


 
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define MD          1000000007
#define M 			200011
#define LN             14
#define fftmod      998244353
#define EPS         (double)1e-10
 
long long  md=MD;
ll inf=1e18;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
 
 
inline ll exp(ll a,ll b){if(a==0&&b==0)return 1ll;if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=(r%md)*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
inline ll poww(ll a,ll b){ll r=1LL;while(b>0){if(b&1)r=r*a;b/=2;a=a*a;}return (ll)r;}
 
using cd=complex<double>;
const double PI=acos(-1);
 
inline ll rand(ll l,ll r){
    return l+rng()%(r-l+1);
}


int main(){
 
     
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
 
   // ifstream fin("input.txt");ofstream fout("outut.txt");
    ll t,i,j,m,n,s,z,k,p;string s1,s2;ll q;ll x,y;
    cin>>n>>k;
    p=0;
    p+=(n/k)*(n/k)*(n/k);
    x=0;
    for(i=1;i<=n;++i)if(i%k==k/2)++x;
    if(k%2==0){
    	p=p+x*x*x;

    }
    cout<<p<<"\n";




    

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define  N 100007
ll a[N],dp[N];

int main()
{
    ll m,n,i,j;
    cin>>n;
    for(i=1;i<=n;i++)cin >>a[i];
    dp[0]=a[1];
    ll len=1;

    for(i=2;i<=n;i++)
    {
        if(a[i]> dp[len-1 ])dp[len++]=a[i];//cout<<i<<" "<<a[i]<<" "<<len<<endl,
        else
        {
            ll k=lower_bound(dp, dp+len, a[i])-dp;
           // cout<<i<<" "<<a[i]<<" -- "<<k<<endl;
            dp[k]=a[i];
        }
    }
    cout<<len<<endl;

}



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

int main()
{
  int a,i;
  cin >> a;
  char s[a],t[a];
  
  cin >>s;
  cin >>t;
  
  for(i=0;i<a;i++)
  {
  	printf("%c%c",s[i],t[i]);
  }
  return 0;

}


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

int n;
bool have()
{
  while(n>=7)
  {
    if(n%10==7)
      return true;
    n /= 10;
  }
  return false;
}

int main()
{
  cin>>n;
  if(have())
    cout<<"Yes\n";
  else cout<<"No\n";
  return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<cmath>

using namespace std;

int main()
{
	int a[100], b[100], c[100], n, satisfy = 0, t = 0, i = 0;
	cin >> n;
	for(i = 0; i < n; i++)
		cin >> a[i];
	for(i = 0; i < n; i++)
	{
		cin >> t;
		satisfy += t;
	}
	for(i = 0; i < n-1; i++)
		cin >> c[i];
	for(i = 0; i < n-1; i++)
	{
		if(a[i]+1 == a[i+1])
		{
			satisfy += c[a[i]-1];
		}
	}
	cout << satisfy << endl;
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int64_t H, N, sum = 0;
    cin >> H >> N;

    for (int i = 0; i < N; i++){
        int64_t a;
        cin >> a;
        sum += a;
    }
    if (sum >= H){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

int main() {
  ll H, W;
  cin >> H >> W;

  ll sum = H * W;
  if (sum % 3 == 0) {
    cout << 0 << endl;
    return 0;
  }
  ll z = sum / 3;
  vector<ll> arr1(3);
  vector<ll> arr2(3);
  ll h  = 1;
  ll w  = 1;
  ll mn = INT_MAX;
  while (h <= H || w <= W) {
    if (h <= H) {
      arr1[0] = W * h;
      ll s1   = sum - arr1[0];
      if (s1 % 2 == 0) {
        arr1[1] = (s1 / 2);
        arr1[2] = (s1 / 2);
      } else {
        ll h2   = H - h;
        ll w2   = W / 2;
        arr1[1] = s1 - (h2 * w2);
        arr1[2] = h2 * w2;
      }
      sort(arr1.begin(), arr1.end());
      mn = min(mn, arr1[2] - arr1[0]);
    }
    if (w <= W) {
      arr2[0] = H * w;
      ll s2   = sum - arr2[0];
      if (s2 % 2 == 0) {
        arr2[1] = (s2 / 2);
        arr2[2] = (s2 / 2);
      } else {
        ll h2   = H / 2;
        ll w2   = W - w;
        arr2[1] = s2 - (h2 * w2);
        arr2[2] = h2 * w2;
      }
      sort(arr2.begin(), arr2.end());
      mn = min(mn, arr2[2] - arr2[0]);
    }

    h++;
    w++;
  }
  cout << mn << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
//#include <iostream>//POJ
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <math.h>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
template<typename T> T vpop(vector<T> *v) {
	T res = v->back();
	v->pop_back();
	return res;
}
char vpop(string *v) {
	char res = v->back();
	v->pop_back();
	return res;
}
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
	dx8[8] = { 0,1,1,1,0,-1,-1,-1 },
	dy8[8] = { 1,1,0,-1,-1,-1,0,1 },
	dx4[4] = { 0,1,0,-1 },
	dy4[4] = { 1,0,-1,0 };

template<class T>inline bool maxi(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool mini(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

int main() {
	setc;

	lint n; cin >> n;
	string s;
	while(n!=0) {
		if (n % 2)s += '1';
		else s += '0';
		n = ceil((double)n / (double)-2);
	}
	if (s == "")s = "0";
	vrev(s);
	co(s);
	gc();
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索


int main(){
    map<string,int> mp;
    int n; cin >> n;
    rep(i,n){
        string s; cin >> s;
        mp[s]++;
    }
    int m; cin >> m;
    rep(i,m){
        string s; cin >> s;
        mp[s]--;
    }
    int ans=0;
    for(auto itr:mp){
        ans=max(ans,itr.se);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <numeric>
#include <cmath>
#include <iostream>
using i64 = long long;
using namespace std;

const int maxn = 4e2;
int n;
i64 a[maxn + 1];
i64 p[maxn + 1] = {0};
i64 dp[maxn + 1][maxn + 1] = {0};

int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    p[i] = p[i - 1] + a[i];
  }
  auto range = [](int i, int j) {
    return p[j] - p[i - 1];
  };

  for (int i = n; i >= 1; i--) {
    for (int j = i; j <= n; j++) {
      if (i == j) { dp[i][j] = 0; continue; }
      dp[i][j] = 1e18;
      for (int split = i + 1; split <= j; split++) {
        dp[i][j] = min(dp[i][j], 
          dp[i][split - 1] + dp[split][j] + range(i, j));
      }
    }
  }
  cout << dp[1][n] << '\n';
}


Measured memory_bytes: 1536
//水到家了
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    char a[100],b[100],c[100];
    ios::sync_with_stdio(false);
    scanf("%s%s%s",a,b,c);
    cout<<a[0]<<b[0]<<c[0];
}

Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

if n == k
  c = 0
elsif k == 0
  c = a.sort.inject(&:+)
else
  c = a.sort[0...-k].inject(&:+)
end
puts c.nil? ? 0 : c

Measured memory_bytes: 19312
import java.util.*;
public class Main {
	static int modNum = 1000000007;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		long power = 1;
		for(int i = 1;i <= a;i++){
			power = power * i;
			power = power % modNum;
		}
		System.out.println(power);
	}
}

Measured memory_bytes: 22996
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

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

	vi p(m);
	vs s(m);
	rep(i, m) {
		cin >> p[i] >> s[i];
		p[i]--;
	}

	int num = 0, pe = 0;
	vb check(n);
	vi penaru(n);
	rep(i, m) {
		if (check[p[i]]) continue;

		if (s[i] == "AC") {
			num++;
			pe += penaru[p[i]];
			check[p[i]] = true;
		}
		else if (s[i] == "WA") penaru[p[i]]++;
	}
	cout << num << " " << pe << endl;
}

Measured memory_bytes: 6528
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int A = in.Int();
            int B = in.Int();
            String S = in.next();

            int cnt = 0;
            int bcnt = 1;
            for (int i = 0; i < S.length(); i++) {
                char c = S.charAt(i);
                boolean pass = false;
                if (c == 'a') {
                    pass = cnt < A + B;
                } else if (c == 'b') {
                    pass = cnt < A + B && bcnt <= B;
                    bcnt++;
                }
                if (pass) {
                    cnt++;
                    out.println("Yes");
                } else {
                    out.println("No");
                }
            }
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 24300
#include<stdio.h>
int main()
	{
	int i, j, k;
	
	
	int a[4][3][10]; 
	

	
	
	for(i = 0; i < 4; i++)
	{
		for(j = 0; j < 3; j++)
		{
			for(k = 0; k < 10; k++)
			{
				a[i][j][k] = 0;
					
			}
		}	
	}
int n = 0;
scanf("%d", &n);
while(n--){
	int b, f, r, v;
	scanf("%d %d %d %d", &b, &f, &r, &v);
	a[b - 1][f -1 ][r - 1] += v; 
}	
	for(i = 0; i < 4; i++)
	{
		for(j = 0; j < 3; j++)
		{
			for(k = 0; k < 10; k++)
			{
			printf(" %d", a[i][j][k]);	
			}
			printf("\n");
		}	
		if(i != 3)
		{
		printf("####################\n");
	    }
		
	}

	
		
}


/*	printf(" %d", a[i][j][k]);
	if(i != 3)
		{
		printf("####################");
	    }
		printf("\n");
		*/	

 


Measured memory_bytes: 2708
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
using namespace std;
signed main(){
  int c=3;
	vector<vector<int>> a(3, vector<int>(c));
	REP(i,3){
		REP(j,3){
            int d;
            cin >> d;
			a[i][j] = d;
		}
	}
	REP(i,2){
		REP(j,2){
			if(a[i][j] - a[i+1][j] != a[i][j+1] - a[i+1][j+1])
			goto dame;
		}
	}
	REP(i,2){
		REP(j,2){
			if(a[i][j] - a[i][j+1] != a[i+1][j] - a[i+1][j+1])
			goto dame;
		}
	}
	cout << "Yes" << endl;
	goto owari;
	dame:
	cout << "No" << endl;
	owari:


    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	int[][] map;

	int w, h;

	// 遷移ベクトル
	int[] ax = { -1, 0, 1, 1, 1, 0, -1, -1 };
	int[] ay = { -1, -1, -1, 0, 1, 1, 1, 0 };

	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			w = sc.nextInt();
			h = sc.nextInt();

			// w=0かつh=0だと必ず0になる(bit演算の論理和)
			if ((w | h) == 0) {
				break;
			}

			map = new int[h][w];

			for (int j = 0; j < h; j++) {
				for (int i = 0; i < w; i++) {
					map[j][i] = sc.nextInt();
				}
			}

			int cnt = 0;

			for (int j = 0; j < h; j++) {
				for (int i = 0; i < w; i++) {
					if (map[j][i] == 1) {
						search(i, j);
						// System.out.println("i = " + i + ", j = " + j);
						// debug();
						cnt++;
					}
				}
			}

			System.out.println(cnt);

		}

	}

	public static void main(String[] args) {

		new Main().run();

	}

	public void search(int x, int y) {

		if (x < 0 || y < 0 || x >= w || y >= h || map[y][x] == 0) {
			return;
		}

		map[y][x] = 0;

		for (int i = 0; i < 8; i++) {
			int nx = x + ax[i];
			int ny = y + ay[i];
			search(nx, ny);
		}
	}

	public void debug() {
		// test
		System.out.println("---------------");
		for (int j = 0; j < h; j++) {
			for (int i = 0; i < w; i++) {
				System.out.print(map[j][i] + " ");
			}
			System.out.println();
		}
		System.out.println("---------------");
	}
}

Measured memory_bytes: 42372
import java.awt.geom.Point2D;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws java.io.IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (n != 0) {
            double x1 = sc.nextDouble();
            double y1 = sc.nextDouble();
            double x2 = sc.nextDouble();
            double y2 = sc.nextDouble();
            double x3 = sc.nextDouble();
            double y3 = sc.nextDouble();
            Triangle t = new Triangle(x1, y1, x2, y2, x3, y3);
            System.out.printf("%.3f %.3f %.3f\n", t.getCenterX(), t.getCenterY(),t.getR());
            n--;
        }

    }
}

class Triangle {
    Point2D.Double A;
    Point2D.Double B;
    Point2D.Double C;
    double a;
    double b;
    double c;
    double ang_a;
    double ang_b;
    double ang_c;
    double s2a;
    double s2b;
    double s2c;

    Triangle(double ax, double ay, double bx, double by, double cx, double cy) {
        A = new Point2D.Double(ax, ay);
        B = new Point2D.Double(bx, by);
        C = new Point2D.Double(cx, cy);

        c = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));
        a = Math.sqrt(Math.pow(cx - bx, 2) + Math.pow(cy - by, 2));
        b = Math.sqrt(Math.pow(ax - cx, 2) + Math.pow(ay - cy, 2));

        ang_a = Math.acos((b * b + c * c - a * a) / (2 * b * c));
        ang_b = Math.acos((a * a + c * c - b * b) / (2 * a * c));
        ang_c = Math.acos((b * b + a * a - c * c) / (2 * b * a));

        s2a = Math.sin(2.0 * ang_a);
        s2b = Math.sin(2.0 * ang_b);
        s2c = Math.sin(2.0 * ang_c);
    }

    double getCenterX() {
        double x = (A.x * s2a + B.x * s2b + C.x * s2c) / (s2a + s2b + s2c);
        return x;
    }

    double getCenterY() {
        double y = (A.y * s2a + B.y * s2b + C.y * s2c) / (s2a + s2b + s2c);
        return y;
    }

    double getR() {
        double r = a/Math.sin(ang_a)/2.0;
        return r;
    }
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
 
using namespace std; 
#define int long long
const int nax = 1e6 + 7;

int lpf[nax], mobius[nax]; 

void least_prime_factor() { 
	for (int i = 2; i < nax; i++) {
		if (!lpf[i]) {
      for (int j = i; j < nax; j += i) {
        if (!lpf[j]) {
          lpf[j] = i; 
        }
      }
    }
  }
  return;
} 
void mob() {
	for (int i = 1; i < nax; i++) { 
		if (i == 1) {
			mobius[i] = 1;
    }	else { 
			if (lpf[i / lpf[i]] == lpf[i]) {
        mobius[i] = 0;
      } else {
				mobius[i] = -1 * mobius[i / lpf[i]]; 
      }
    }
  }
  return;
} 
int gp(int a[], int n) {
	int maxi = 0; 
	int fre[nax] = {0}; 
	for (int i = 0; i < n; i++) { 
		fre[a[i]]++; 
		maxi = max(a[i], maxi); 
	} 
	least_prime_factor(); 
	mob(); 
	int ans = 0; 
  for (int i = 1; i <= maxi; i++) { 
		if (!mobius[i]) {
			continue; 
    }
		int temp = 0; 
		for (int j = i; j <= maxi; j += i) { 
      temp += fre[j]; 
    }
		ans += temp * (temp - 1) / 2 * mobius[i]; 
	} 
  return ans; 
} 
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int gcd = 0;
  for(int i = 0; i < n; i++) {
    gcd = __gcd(gcd, a[i]);
  }
  int pairs = gp(a, n);
  if(pairs==(n*(n-1))/2) {
    cout << "pairwise coprime\n";
    return 0;
  }
  if(gcd==1) {
    cout << "setwise coprime\n";
    return 0;
  }
  cout << "not coprime\n";
  return 0;
}


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

using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (int i = 1; i < (int)(n+1); i++)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
int main() {
const ll INF = 100100100100100100;

bool flag = false;

ll X,A,B;
cin >> X;

rep(i,1000){
  A=i-500;
  rep(j,1000){
    B=j-500;
    if(pow(A,5)-pow(B,5)==X){
      flag = true;
      break;
    }
  }
  if(flag){
    break;
  }
}
cout<<A<<" "<<B<<endl;
}


Measured memory_bytes: 4100
/*
    Problem 99
    https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_d
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    vector<ll> d(N), c(N);
    for (int i = 0; i < N; i++) cin >> d[i] >> c[i];
    ll digitNum = 0;
    ll digitSum = 0;
    for (int i = 0; i < N; i++) {
        digitNum += c[i];
        digitSum += c[i] * d[i];
    }
    cout << digitNum - 1 + (digitSum - 1) / 9 << '\n';
}


Measured memory_bytes: 3328
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct{
  int no;
  char city[12];
  int score;
}data;
data rest[100];

int c(const void* a,const void* b){
  if(strcmp(((data *)a)->city,((data *)b)->city)==0)
    return ((data *)b)->score-((data *)a)->score;
  return strcmp(((data *)a)->city,((data *)b)->city);
}

int main(){
  int n,i;
  scanf("%d",&n);
  for (i=0;i<n;i++){
    rest[i].no=i;
    scanf(" %s",(rest[i]).city);
    scanf(" %d",&((rest[i]).score));
  }
  //  printf("%s %d\n",(rest[i].city),(rest[i].score));
  qsort(rest,n,sizeof(data),c);
  for(i=0;i<n;i++){
    printf("%d\n",1+rest[i].no);
  }
  return 0;
}


Measured memory_bytes: 128
N=int(input())

for i in range(N//4,3501):
    for j in range(N//4,3501):
        if not 4*i*j-(i+j)*N<=0:
            if (i*j*N)%(4*i*j-(i+j)*N)==0:
                print(i,j,(i*j*N)//(4*i*j-(i+j)*N))
                exit()

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
	int N, D;
	int ans;
	cin >> N >> D;
	
	if (N % (D * 2 + 1) == 0) {
		ans = N / (D * 2 + 1);
	}
	else {
		ans = (N / (D * 2 + 1) + 1);
	}

	cout << ans << endl;

	return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	ld n = 0;
	cin >> n;

	rep(i, 50000){
		int res = (ld)i * 1.08L;
		if(res == n){
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(\n";
	return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

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

class UnionFind {
    vector<int> data;
public:
    UnionFind(int size = 0) {
        resize(size);
    }
    void resize(int size) {
        data.resize(size, -1);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y)
            return;
        if (data[y] < data[x])
            swap(x, y);
        data[x] += data[y];
        data[y] = x;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    int count() {
        int cnt = 0;
        for (int i = 0, n = data.size(); i < n; ++i) {
            if (i == root(i))
                cnt++;
        }
        return cnt;
    }
};

int main() {
    int n, m, a, b, ans = 0;
    cin >> n >> m;
    UnionFind uf(n + 1);
    while (m--) {
        cin >> a >> b;
        uf.unite(a, b);
    }
    for (int i = 0; i < n; ++i) {
        chmax(ans, uf.size(i + 1));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4028
loop do
    n = gets.to_i
    break if n == 0
    name = Array.new(n)
    c = Array.new(n)
    n.times do |i|
        c[i] = gets.split
        c[i][1...c[i].size] = c[i][1...c[i].size].map(&:to_i)
    end
    c.each do |cc|
        t = cc[2] + cc[3] + cc[4] 
        t += (cc[5] + cc[6]) * cc[9]
        v = cc[7] * cc[8] * cc[9]
        cc[10] = (v.to_f - cc[1].to_f)/t.to_f
    end
    puts c.sort { |a, b| (b[10] <=> a[10]).nonzero? || a[0] <=> b[0] }.map{|a| a[0]}
    puts "\#"
end

Measured memory_bytes: 6136
#include<bits/stdc++.h>
//#define int long long
#define loop(i, a, b) for(int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int MOD = 1e9 + 7, INF = 1e9;
using vi = vector <int>;
using vvi = vector <vi>;
//g++ -std==c++14
 
signed main(){
    string s;
    cin >> s;
    int ans = s.size();
    while(1){
        bool update = false;

        for(int i = s.size() - 1; i > 0; i--){
            if(s[i] == 'T' && s[i - 1] == 'S'){
                s.erase(i - 1, 2);
                update = true;
            }
        }

        if(!update)break;
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> P(M);
    vector<int> Y(M);
    for (int i = 0; i < M; ++i) {
        cin >> P[i];
        cin >> Y[i];
    }

    vector<pair<int, int>> ps(M);
    for (int i = 0; i < M; ++i) {
        ps[i] = (make_pair(Y[i], i));
    }
    sort(ps.begin(), ps.end(), [](const pair<int,int>& o1,const pair<int,int >& o2) {return o1.first<o2.first;});

    vector<int> index(M);
    vector<int> count(N + 1);
    for (int m = 0; m < M; ++m) {
        int i = ps[m].second;
//        cerr << i << endl;
        index[i] = ++count[P[i]];
    }

    for (int m = 0; m < M; ++m) {
        printf("%06d%06d\n", P[m], index[m]);
    }

    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
typedef long long int ll;
typedef pair <int, int> P;
typedef vector<Bint> vec;
typedef vector<vec> mat;
Bint MOD;
Bint L,A,B;
mat mul(mat A, mat B){
    mat C(A.size(), vec(B[0].size()));
    rep(i,0,A.size()){
        rep(k,0,B.size()){
            rep(j,0,B[0].size()){
                C[i][j]+=A[i][k]*B[k][j]%MOD;
                C[i][j]%=MOD;
            }
        }
    }
    return C;
}

mat pow(mat A, Bint n){
    mat B(A.size(), vec(A.size()));
    rep(i,0,A.size()){
        B[i][i]=1;
    }
    while(n>0){
        if(n&1) B=mul(B,A);
        A=mul(A,A);
        n>>=1;
    }
    return B;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>L>>A>>B>>MOD;
    Bint last=A+B*(L-1);
    Bint ans=0;
    bool X=true;
    while(X){
        int t;
        Bint ret=1;
        rep(i,0,19){
            if(A<ret){
                t=i;
                break;
            }
            else{
                ret*=10;
            }
        }
        Bint u=ret;
        Bint n=(u-A-1)/B;
        if(last<u){
            n=(last-A)/B;
            X=false;
        }
        mat a(3,vec(3,0));
        mat b(3, vec(1,0));
        a[0][0]=u%MOD; a[0][1]=1; a[0][2]=0;
        a[1][0]=0; a[1][1]=1; a[1][2]=B%MOD;
        a[2][0]=0; a[2][1]=0; a[2][2]=1;
        b[0][0]=ans; b[1][0]=A; b[2][0]=1;
        a=mul(pow(a,n+1), b);
        ans=a[0][0];
        A=A+B*(n+1);
    }
    cout <<ans<<"\n";
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (n, m) = get!(usize, usize);
    // 開けられる宝箱、値段
    let mut v: Vec<(usize, usize)> = Vec::new();
    for _ in 0..m {
        let (price, _l) = get!(usize, usize);
        let tv: Vec<usize> = get!([usize]).into_iter().map(|x| x - 1).collect();
        // eprintln!("tv: {:?}", tv);
        let mut t = 0;
        for j in 0..tv.len() {
            t |= 1 << tv[j];
        }
        v.push((t, price));
    }
    let mut dp = vec![1001001001; 1 << n];
    // eprintln!("dp.len(): {:13b}", dp.len());
    dp[0] = 0;
    for i in 0..(1 << n) {
        for j in 0..m {
            let now = i | v[j].0;
            // eprintln!("i: {}, j: {}, v[j]: {}", i, j, v[j].0);
            // eprintln!("now: {} {:08b}", now, now);
            dp[now] = std::cmp::min(dp[i] + v[j].1, dp[now]);
        }
    }
    // for i in 0..dp.len() {
    //     eprintln!("{:012b}: {}", i, dp[i]);
    // }
    let ans = dp.pop().unwrap();
    if ans == 1001001001 {
        println!("-1");
        return;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	aa := make([]int, n)
	im := IntMap{}

	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
		im.increment(aa[i])
	}

	sort.Ints(aa)

	ans := 0
	for i := n - 1; i >= 0; i-- {
		if im.get(aa[i]) == 0 {
			continue
		}
		im[aa[i]] = im.get(aa[i]) - 1
		for j := 30; j >= 0; j-- {
			p := 1<<uint(j) - aa[i]
			if im.get(p) == 0 {
				continue
			}
			im[p] = im.get(p) - 1
			ans++
			break
		}
	}

	fmt.Fprintln(writer, ans)
}

// IntMap ...
type IntMap map[int]int

func (m IntMap) get(key int) int {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}

func (m IntMap) increment(key int) {
	m[key] = m.get(key) + 1
}


Measured memory_bytes: 13312
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            long[] ans = new long[n + 1];

            for (int i = 1; i <= 100; i++) {
                for (int j = 1; j <= 100; j++) {
                    for (int k = 1; k <= 100; k++) {
                        int tmp = i * i + j * j + k * k + i * j + j * k + k * i;
                        if (tmp <= n) {
                            ans[tmp]++;
//                        System.out.printf("i=%d j=%d k=%d res=%d\n", i, j, k, tmp);
                        }
                    }
                }
            }
            // 出力
            for (int i = 1; i <= n; i++) {
                out.println(ans[i]);
            }

        }

    }
}



Measured memory_bytes: 36868
from math import log
n = int(input())
if n % 2 == 1 or n == 0:
    print(0)
else:
    m = n // 2
    total = 0
    for p in range(1, int(log(m, 5)) + 1):
        total += m // (5 ** p)
    print(total)

Measured memory_bytes: 38384
n = int(input())
a = list(map(int, input().split()))

b = [0] * n
c = []
for i in range(n-1, -1, -1):
    v = i + 1
    s = 0
    for j in range(1, 10**6):
        if v*j > n:
            break    
        s += b[v*j-1]
    if s % 2 != a[i]:
        b[i] = 1
        c.append(v)
print(len(c))
for i in reversed(c):
    print(i)

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

int main(){
  ll n;
  cin >> n;
  vector<ll> a(3*n);
  rep(i,3*n) cin >> a[i];
  sort(a.begin(),a.end(),greater<ll>());
  ll ans = 0;
  rep(i,n){
    ans += a[2*i + 1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main(void){
    long long N;
    cin >> N;
    vector<long long> v(N);
    vector<long long> c(N);

    for(long long i = 0; i < N; i++){
        cin >> v[i];
    }
    for(long long i = 0; i < N; i++){
        cin >> c[i];
    }
    long long ans = 0;
    for(long long i = 0; i < N; i++){
        long long def = v[i] - c[i];
        ans = def > 0 ? ans + def : ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int t_tairyoku,t_kougeki,a_tairyoku,a_kougeki;
  int i,k;
  scanf("%d %d %d %d",&t_tairyoku,&t_kougeki,&a_tairyoku,&a_kougeki);
  
  for(i=0;i<100;i++){
    a_tairyoku=a_tairyoku-t_kougeki;
    if(a_tairyoku<=0){
      k=1;
      break;
    }
    t_tairyoku=t_tairyoku-a_kougeki;
    if(t_tairyoku<=0){
      k=2;
      break;
    }
  }
  if(k==1)
    printf("Yes");
  else
    printf("No");
}

Measured memory_bytes: 1736
C=[list(map(int,input().split())) for _ in range(3)]
a=[0, C[1][0]-C[0][0], C[2][0]-C[0][0]]
b=[C[0][0], C[0][1], C[0][2]]
ans='Yes'
for i in range(3):
    for j in range(3):
        if C[i][j]!=a[i]+b[j]:
            ans='No'
print(ans)

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

int Abs(int a, int b){
  if(a > b)
    return a-b;
  else
    return b-a;
}

int main() {
 int N, M;
 cin >> N >> M;
 vector<vector<int>> stu(N,vector<int>(2));
 vector<vector<int>> point(M,vector<int>(2));
 
 for (int i =0; i < N; i++){
   for (int j = 0; j <2; j++)
     cin >> stu.at(i).at(j);
 }
 
 for (int i =0; i < M; i++){
   for (int j = 0; j <2; j++)
     cin >> point.at(i).at(j);
 }

 for (int i = 0; i < N; i++){
   int min_dis = 0;
   int answer = 1;
   for (int j = 0; j <M; j++){
     int dis = 0;
     dis = Abs(stu.at(i).at(0),point.at(j).at(0)) + Abs(stu.at(i).at(1),point.at(j).at(1));
     if(j == 0) min_dis = dis;
    else if (min_dis > dis){
      min_dis = dis;
      answer = j+1;
    }
   }
  cout << answer << endl; 
 } 
  
}

Measured memory_bytes: 256
while 1:
    r, c = map(int, raw_input().split())
    if r == 0: break
    old = [raw_input().split() for i in range(r)]
    old = map(list, zip(*old))
    new = [int("".join(lst),2) for lst in old]
    ans = 0
    for i in range(1<<r):
        ret = 0
        for j in new:
            cnt = bin(i^j).count('1')
            ret += cnt if cnt > r/2 else r-cnt
        ans = max(ans, ret)
    print ans

Measured memory_bytes: 10692
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  cin >> n>>m;
  int h[n];
  bool best[n];
  memset(best, true, sizeof(best));
  for(int i=0; i<n; i++) cin >> h[i];
  int a, b;

  for(int i=0; i<m; i++){
    cin >> a >> b;
    if(h[a-1] < h[b-1]) best[a-1] = false;
    if(h[a-1] > h[b-1]) best[b-1] = false;
    if(h[a-1] == h[b-1]) {best[a-1] = false;best[b-1] = false;}
  }

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

  return 0;
}


Measured memory_bytes: 3680
#include<stdio.h>
#define MAX 100000000
int S[MAX],n;

int binarysearch(int key){
  int left=0,right=n,mid;
  while(left<right){
    mid=(left+right)/2;
    if(key==S[mid])return 1;
    if(key>S[mid])left=mid+1;
    else if(key<S[mid])right=mid;
  }
  return 0;
}

int main(){
  int q,t;
  int i,cnt=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t);
    if(binarysearch(t))cnt++;
  }

  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 984
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

ll N, K;

bool check(ll x, vector<ll> &A) {
    ll cnt = 0;
    rep(i, N) { cnt += A[i] / x + !!(A[i] % x); }
    if(cnt <= K + N)
        return true;
    else
        return false;
}

int main() {
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll lb = 0, ub = INF;
    while(ub - lb > 1) {
        ll mid = (ub + lb) / 2;
        if(check(mid, A)) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    cout << ub << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vec A(N), B(N);
    REP(i,0,N) cin >> A[i];
    REP(i,0,N) cin >> B[i];

    ll sumA = 0, sumB = 0;
    REP(i,0,N) {
        sumA += A[i];
        sumB += B[i];
    }

    if(sumA < sumB) PR(-1);
    else {
        vec D(N, 0);
        ll cnt = 0, sum = 0;
        REP(i,0,N) {
            if(A[i] < B[i]) {
                sum += B[i] - A[i];
                ++cnt;
            }
            else D[i] = A[i] - B[i];
        }
        DESC(D);
        REP(i,0,N) {
            if(sum >= D[i]) {
                ++cnt;
                sum -= D[i];
            }
            else if(sum > 0){
                ++cnt;
                break;
            }
            else break;
        }
        PR(cnt);
    }

    return 0;
}

/*

A 2 3 5
B 3 4 1

D 1 1 0
E 0 0 4

*/

Measured memory_bytes: 5612
s = input()
s = list(reversed(s))
n = len(s)
dp1 = [0]*n
dp2 = [0]*n
counting = [0]*2019
counting[0] += 1
dp1[0] = 1
dp2[0] = int(s[0])
counting[dp2[0]] += 1
if n >= 2:
    for i in range(1,n):
        dp1[i] = (10*dp1[i-1]) % 2019
        dp2[i] = (int(s[i])*dp1[i]+dp2[i-1]) % 2019
        counting[dp2[i]] += 1
#print(counting)
sm = 0
for j in range(2019):
    sm += int(counting[j]*(counting[j]-1)/2)
print(sm)

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

int main(){
  int A,B,C,X;
  cin>>A>>B>>C>>X;
  int ans=0;
  
  for (int i =0;i<A+1;++i){
    for (int j =0;j<B+1;++j){
      for (int k =0;k<C+1;++k){
        if (i*500+j*100+k*50==X)++ans;
      }
    }
  }
  cout<<ans<<endl;
}
         


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

int main() {
	int n;
	cin >> n;
	if (n < 100)
		cout << min(n, 9);
	else if (n < 10000)
		cout << min(n - 90, 909);
	else
		cout << min(n - 9090, 90909);
	cout << endl;

}


Measured memory_bytes: 256