akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define int ll
#define For(a, b, c) for(int a = b; a <= c; ++a)
#define Ford(a, b, c) for(int a = b; a >= c; --a)
#define All(a, b) for(auto &a : b)
#define Rep(a, b, c) for(int a = b; a < c; ++a)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define all(a) a.begin(),a.end()
#define reset(a, b) memset(a, b, sizeof(a))
#define bit(x, i) (x >> (i - 1) & 1ll)
#define onbit(x, i) (x | (1ll << (i - 1)))
#define offbit(x, i) (x & ~(1ll << (i - 1)))
#define bitone(i) __builtin_popcountll(i)
#define bitl(i) __builtin_clz(i)
#define bitr(i) __builtin_ctz(i)
#define vll vector<ll>
/********************************************************

Digvijay Bahadur Singh
MNNIT

*********************************************************/


const int MOD=998244353;
const int N = 1e6+100;
/********************************************************************/
                 /* GRAPH*/
//vector<vector<ll>> g;
//vector<bool> vis1,vis2;
/*******************************************************************/
ll power(ll a,ll b)
{
   ll ans =1;
   while(b>0){
   if(b&1) ans = (ans%MOD * a%MOD)%MOD;
   a = (a%MOD * a%MOD)%MOD;
   b=b>>1;
   }
   return ans%MOD;
}


signed main(){
  ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
  
  
  ll T=1;
 //cin>>T;
  
   // T=1;
    
    while(T--)
  {
     int n;
     cin>>n;
     map<int,int> mp;
     int a[n];
     for(int i=0;i<n;i++)
     {
       cin>>a[i];
       mp[a[i]]++;
     }
     int ans=0;
     for(auto i:mp)
     {
         int temp = i.second;
         ans+=(temp)*(temp-1)/2;
     }
     for(int i=0;i<n;i++)
     {
       int temp2=ans;
       int temp3 = mp[a[i]]*(mp[a[i]]-1)/2;
       temp2-=temp3;
       mp[a[i]]--;
       int temp4 = mp[a[i]]*(mp[a[i]]-1)/2;
       temp2+=temp4;
       
       cout<<temp2<<"\n";
       mp[a[i]]++;
     }
    
       
   
  

   
 


      

  }

  
}


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

#define OUT(x)  cerr << #x << " = " << x << endl;
#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define piii    pair<int, pair<int, int>>

int main() {
        int x, a, b;
        scanf("%d%d%d", &x, &a, &b);
        cout << (abs(b - x) > abs(a - x) ? "A" : "B")  << endl;
        return 0;
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

void f(ll N, ll now, string &S){
	if(N==0){
		cout << S << endl;
		return;
	}

	string T = S;
	REP(i, now){
		string X = T+char('a'+i);
		f(N-1, now, X);
	}
	string X = T+char('a'+now);
	f(N-1, now+1, X);
	return;
}

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

    ll N;
    cin >> N;
    string S = "";
    f(N, 0, S);

    return 0;
}

Measured memory_bytes: 1536
n = gets
a = gets.split.map(&:to_i)

count = 0
flag = true

while flag
  a.each_with_index do |v, i|
    if v%2 == 0
      a[i] = a[i]/2
    else
      flag = false
    end
  end
    if flag == true
      count +=1
    end
end

puts count 



Measured memory_bytes: 1788
#include<stdio.h>
int main()
{
    int H,A,ans1,ans2;
    scanf("%d%d", &H, &A);
    ans1 = H%A;
    ans2 = H/A;
    if(ans1==0){
    printf("%d", ans2);
    }else{
        printf("%d", ans2+1);
    }
    return 0;

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    ll N,P;
    cin >> N >> P;
    if(N == 1){
        cout << P << endl;
    }else if(N >= 50){
        cout << 1 << endl;
    }else{
        ll ans = 1;
        for(int i=2; i<=1000000; i++){
            bool flag = true;
            ll tmp = P;
            REP(j,N){
                if(0 != tmp%i){
                    flag = false;
                    break;
                }
                tmp /= i;
            }
            if(flag){
                chmax(ans,i);
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3588
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	cin >> N;
	vector< int > P(N);
	rep(i, N) cin >> P[i];
	vector< int > A(N), B(N);
	rep(i, N) A[i] = 30000 * (i + 1);
	rep(i, N) B[i] = 30000 * (N - i);
	rep(i, N) {
		int p = P[i] - 1;
		A[p] += i;
	}
	cout << A;
	cout << B;
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cassert>
#define REP(i,l,n) for(int i=l;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define MAX 100000
char pre[MAX],post[MAX],ans;
int n,m;
using namespace std;
int main() {
  while(1){
    cin >> n;
    if(n==0) return 0;
    rep(i,n){
      cin >> pre[i];
      cin >> post[i];
    }
    cin >> m;
    rep(i,m){
      cin >> ans;
      rep(j,n){
        if(pre[j] == ans){
          ans = post[j];
          break;
        }
      }
      cout << ans;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;

#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define mod 1000000007
ll n;
int main() {
	fastIO
	cin >> n;
	vector<int> dp(3);
	// dp[i] is the total cost such that we did activity on the last considered day
	for (int day = 0; day < n; ++day) {
		vector<int>new_dp(3, 0);
		vector<int> c(3);
		for (int i = 0; i < 3; ++i)
			cin >> c[i];
		for (int  i = 0; i < 3; ++i) {
			for (int j = 0; j < 3; ++j) {
				if (i != j) {
					new_dp[j] = max(new_dp[j], dp[i] + c[j]);
				}
			}
		}
		dp = new_dp;
	}
	cout << max({dp[0], dp[1], dp[2]});
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>

#include <cmath>

#define int long long

using namespace std;

signed main() {
  string s, t;
  cin >> s >> t;

  int ans = 0;

  for (int i = 0; i < 3; i++) {
    if (s[i] == t[i]) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for (int i = 0; i < H; i++)
        cin >> S[i];
    vector<vector<int>> U(H, vector<int>(W)), 
                        D(H, vector<int>(W)), 
                        L(H, vector<int>(W)), 
                        R(H, vector<int>(W));

    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++)
        if (S[i][j] == '.') U[i][j] = i ? U[i-1][j] + 1 : 1;

    for (int i = H - 1; i >= 0; i--) for (int j = W - 1; j >= 0; j--)
        if (S[i][j] == '.') D[i][j] = i != H - 1 ? D[i+1][j] + 1 : 1;

    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++)
        if (S[i][j] == '.') L[i][j] = j ? L[i][j-1] + 1 : 1;

    for (int i = H - 1; i >= 0; i--) for (int j = W - 1; j >= 0; j--)
        if (S[i][j] == '.') R[i][j] = j != W - 1 ? R[i][j+1] + 1 : 1;

    int max = 0;
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) {
        int tmp = U[i][j] + D[i][j] + L[i][j] + R[i][j] - 3;
        if (tmp > max) max = tmp;
    }
    cout << max << endl;
}

Measured memory_bytes: 67200
from functools import lru_cache


def check(s):
    bads = ["AGC", "ACG", "GAC"] + ["AG{}C".format(_s) for _s in "ACGT"
                                   ] + ["A{}GC".format(_s) for _s in "ACGT"]
    return not any(map(lambda x: x in s, bads))


def solve(string):
    n = int(string)

    @lru_cache(n * 4**3)
    def dfs(pos, last3):
        if pos == n:
            return 1
        ans = 0
        for _s in "ACGT":
            ans += dfs(pos + 1, last3[1:] + _s) if check(last3 + _s) else 0
        return ans % (10**9 + 7)

    return str(dfs(0, "TTT"))


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 6216
from collections import Counter
n=int(input())
d=Counter(map(int,input().split()))
m=int(input())
t=Counter(map(int,input().split()))

for i in t.keys():
  if not i in d:
    print("NO")
    break
  elif d[i]<t[i]:
    print("NO")
    break
else:
  print("YES")

Measured memory_bytes: 67672
#include <cstdio>
#include <iostream>
#include <cmath>

using namespace std;
double rad(int p){
	double rad=(acos(-1.0)*p)/180.0;
	return rad;
}

int main()
{
	int a,b,C;
	double S,L,h;
	cin>>a>>b>>C;
	S=0.5*a*b*sin(rad(C));
	L=a+b+(sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(rad(C))));
	h=b*sin(rad(C));

	printf("%lf %lf %lf\n",S,L,h);
	return 0;
}

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

long long d[500009], ans[500009], x[500009];

int main() {
	int N, D; scanf("%d%d",&N,&D);
	for(int i=1; i<=N; i++) {
		x[i] = D;
		scanf("%lld",&d[i]);
		D = min(x[i], max(D - d[i], d[i] - D));
	}
	long long l = 0, r = 5LL * 1e14;
	while(l <= r) {
		long long m = l+r >> 1, n = m;
		for(int i=1; i<=N; i++) {
			if(n >= d[i]) n = max(n - d[i], d[i] >> 1);
			else n = min(n, d[i] >> 1);
		}
		if(n != 0) r = m-1;
		else {
			l = m+1;
			n = m;
			for(int i=1; i<=N; i++) {
				ans[i] = n;
				if(n >= d[i]) n = max(n - d[i], d[i] >> 1);
				else n = min(n, d[i] >> 1);
			}
		}
	}
	int Q; scanf("%d",&Q);
	while(Q--) {
		int q; scanf("%d",&q);
		if(ans[q+1] < x[q]) puts("YES");
		else puts("NO");
	}
	return 0;
}

Measured memory_bytes: 13696
n = list(input())
op = ['+', '-']
for i in range(8):
    bin_i = bin(i).replace('0b', '').zfill(3)
    
    tmp = int(n[0])
    for j in range(3):
        if bin_i[j] == '0':
            tmp = tmp + int(n[j+1])
        else:
            tmp = tmp - int(n[j+1])
    if tmp == 7:
        ans = n[0] + op[int(bin_i[0])] + n[1] + op[int(bin_i[1])] + n[2] + op[int(bin_i[2])] + n[3]
        print(ans+'=7')
        break

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

using namespace std;

typedef long long ll;

const int N = (int)1e6 + 5;

void scans(string &s) {
  char b[N];
  scanf("%s", &b);
  s = b;
  return;
}

int main() {
  int n;
  scanf("%d", &n);
  string s;
  scans(s);
  int x = 0;
  int ret = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'I')
      ++x;
    else
      x--;
    ret = max(ret, x);
  }
  printf("%d", ret);
  return 0;
}


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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char> > mat(h+2, vector<char>(w+2, '#'));
    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            cin >> mat[i][j];
        }
    }
    for(int i=0; i<=h+1; i++){
        for(int j=0; j<=w+1; j++){
            cout << mat[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] // 2
        else:
            break
            
    else:
        count += 1
        continue
        
    break
    
print(count)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int MOD = 1000000007;
const int INF = 2000000000;
const long double PI = acosl(-1);
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int L;
    cin >> L;

    LD ans = pow(L/3.0,3);
    pa;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc159/abc159_c && sh test.sh
cd ~/Desktop/Programming/AtCoder/contest/abc159/abc159_c && sh etest.sh
cd ~/Desktop/Programming/AtCoder/contest/abc159/abc159_c && sh submit.sh
*/


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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    ll n; cin >> n;
    ll ans = 1000000000000;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) ans = min(ans, i + (n / i) - 2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int len = s.length();
    if (len <= n)
        cout << s;
    else
    {
        for (int i = 0; i < n; ++i)
            cout << s[i];
        cout << "...";
    }
}

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

#define N 100000

int main(void){
    ios::sync_with_stdio(false);
    vector<bool> prime(N+1,true);
    prime[0]=prime[1]=false;
    for (size_t i = 2; i*i <= N; i++)
    {
        if (prime[i])
        {
            for (size_t j = 2; i*j <= N; j++)
            {
                prime[i*j]=false;
            }
        }
    }
    vector<int> likeCnt(N);
    for (size_t i = 1; i <= N; i++)
    {
        likeCnt[i]=likeCnt[i-1]+(i%2==1&&prime[i]&&prime[(i+1)/2]);
    }
    /**************************************/
    int q;
    cin >> q;
    int l,r;
    for (size_t i = 0; i < q; i++)
    {
        cin >> l >> r;
        cout << likeCnt[r] - likeCnt[l-1] << "\n";
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<string>

int main() {
    int n;
    std::cin >> n;
    std::vector<std::vector<int>> a(2, std::vector<int>(n));
    for(int i = 0; i < 2; i++) {
        for (int j = 0; j < n; j++) {
            std::cin >> a[i][j];
        }
    }

    int max = -1;
    int sum;
    for (int i = 0; i < n; i++)
    {
        sum = 0;
        for (int k = 0; k <= i; k++) {
            sum += a[0][k];
        }

        for (int j = i; j < n; j++) {
            sum += a[1][j];
        }

        max = std::max(sum, max);
    }

    std::cout << max << "\n";
}

Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#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())
#define mp1(a,b,c) P1(a,P(b,c))

const ll INF=1000000000000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

struct UF{
	int par[200010];
	void init(){
		rep(i,200010){
			par[i] = i;
		}
	}
	int find(int x){
		if(par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	bool same(int x,int y){
		return find(x) == find(y);
	}
	void unit(int x,int y){
		if(same(x,y))return;
		x = find(x);
		y = find(y);
		if(x > y){
			par[x] = y;
		}
		else {
			par[y] = x;
		}
	}
}uf;

ll R,C,N;
vector<P> G[200010];
ll x[200010];

P solve(int v){
	P ret = P(INF,INF);
	if(v <= R)ret.fr = x[v];
	else ret.sc = x[v];
	rep(i,G[v].size()){
		P ed = G[v][i];
		if(x[ed.fr] != -INF){
			if(x[ed.fr]+x[v] != ed.sc)return P(-INF,-INF);
		}
		else {
			x[ed.fr] = ed.sc-x[v];
			P p = solve(ed.fr);
			ret.fr = min ( ret.fr , p.fr );
			ret.sc = min ( ret.sc , p.sc );
		}
	}
	return ret;
}

int main(){
	static ll r[100010],c[100010],a[100010];
	scanf("%lld%lld%lld",&R,&C,&N);
	rep(i,N){
		scanf("%lld%lld%lld",&r[i],&c[i],&a[i]);
	}
	
	uf.init();
	rep(i,N){
		G[r[i]].pb(P(R+c[i],a[i]));
		G[R+c[i]].pb(P(r[i],a[i]));
		uf.unit(r[i],R+c[i]);
	}
	
	bool t = true;
	rep(i,200010)x[i] = -INF;
	rep1(i,R+C){
		if(uf.find(i) == i){
			x[i] = 0;
			P p = solve(i);
			t &= ((p.fr+p.sc) >= 0);
		}
	}
	
	if(t)puts("Yes");
	else puts("No");
}
	


Measured memory_bytes: 21120
using System;
using System.Collections.Generic;
using System.Linq;

namespace CF
{
    class Program
    {
        static void Main(string[] args)
        {
            //22222
            // 11111
            // 11111
            //  var c = long.Parse(Console.ReadLine());
            var d = Console.ReadLine();
            if (d[2] == d[3] && d[4] == d[5])
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
            
        }
    }
}


Measured memory_bytes: 11092
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"
 
using namespace std;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  if (K < A) cout << K << endl;
  else if (A <= K & K <= A+B) cout << A << endl;
  else cout << A - (K - (A+B)) << endl;
}

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

int ans[100] = {0};

int main()
{
    int N, M;
    cin >> N >> M;

    for (int i = 0; i < M; i++)
    {
        int a, b;
        cin >> a >> b;
        ans[a]++;
        ans[b]++;
    }
    for (int i = 1; i <= N; i++)
    {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  
  cin>> N >> M;
  
  vector<int> n(N);
  
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    
    n.at(a-1)++;
    n.at(b-1)++;
    
  }
  
  for(int i=0;i<N;i++){
    cout<<n[i]<<endl;
  }
  
}

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

int main(){
    int N,K;
    cin >> N >> K;
    int a=K;
    int ans=1;

    while(true){
        if(a>=N) break;
        ans++;
        a *=K;
    }
    
    if (a==N) ans++;
    cout << ans;
    return 0;
}

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

class Main {
   public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] vset = new int[n];
      int[] cset = new int[n];
      int i,j;
      int sum = 0;
      int cost = 0;
      for (i = 0; i < n; i++) {
         vset[i] = sc.nextInt();
      }
      for (i=0; i<n; i++) {
         cset[i] = sc.nextInt();
      }
      for (i=0; i<n; i++) {
         cost = vset[i] - cset[i];
         if (cost > 0) {
            sum = sum + cost;
         } else {
            continue;
         }
      }
      System.out.println(sum);
   }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll a,b,c,x,y,m;
    cin>>x>>y>>a>>b>>c;
    if(x+y>a+b+c || x>a+c || y>b+c)
    {
        cout<<0<<endl;
        return 0;
    }
    vector<ll>v,sum;
    stack<ll>p,q,r;
    for(ll i=0; i<a; i++)
    {
        cin>>m;
        v.push_back(m);
    }
    sort(v.begin(),v.end());
    for(ll i=0; i<a; i++)
    {
        p.push(v[i]);
    }
    v.clear();
    for(ll i=0; i<b; i++)
    {
        cin>>m;
        v.push_back(m);
    }
    sort(v.begin(),v.end());
    for(ll i=0; i<b; i++)
    {
        q.push(v[i]);
    }
    v.clear();
    for(ll i=0; i<c; i++)
    {
        cin>>m;
        v.push_back(m);
    }
    sort(v.begin(),v.end());
    for(ll i=0; i<c; i++)
    {
        r.push(v[i]);
    }
    v.clear();
    for(ll i=0; i<x; i++)
    {
        sum.push_back(p.top());
        p.pop();
    }
    for(ll i=0; i<y; i++)
    {
        sum.push_back(q.top());
        q.pop();
    }
    while(!r.empty())
    {
        sum.push_back(r.top());
        r.pop();
    }
    sort(sum.begin(),sum.end());
    m=0;
    for(ll i=sum.size()-1;i>=sum.size()-x-y;i--)
    {
        m+=sum[i];
    }
    cout<<m<<endl;
    return 0;
}


Measured memory_bytes: 9716
N = int(input())
ans = 0
fail = 0
for i in range(N):
  a,b = input().split()
  if a == b:
    ans +=1
    
    if ans ==3:
      print('Yes')
    else:
      fail +=1
  else:
      ans = 0
      fail+=1
      
      
      
if fail == N:
  print('No')



Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;

int main() {

    int N,M;
    cin >> N>>M;
   /* vector<int>A(N);
    for (int i = 0; i < N; i++) { cin >> A.at(i); }
    */
  if(N>M){for(int i=0;i<N;i++){cout<<M;}}
   else if(M>N){for(int i=0;i<M;i++){cout<<N;}}
else{for(int i=0;i<N;i++){cout<<min(M,N);}}
    
    cout<<endl;
}
    

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	N, X, M := nextInt(), nextInt(), nextInt()
	A := make([]bool, M)
	B := make([]int, 0)
	x := X
	y := -1
	for {
		if A[x] {
			y = x
			break
		}
		B = append(B, x)
		A[x] = true
		x = (x * x) % M
	}
	b_ind := -1
	for j, b := range B {
		if b == y {
			b_ind = j
			break
		}
	}
	total := 0
	if N < b_ind {
		for i := 0; i < N; i++ {
			total += B[i]
		}
	} else {
		for i := 0; i < b_ind; i++ {
			total += B[i]
		}
		ring_len := len(B) - b_ind
		ring_count := 0
		for i := b_ind; i < len(B); i++ {
			ring_count += B[i]
		}
		total += ring_count * ((N - b_ind) / ring_len)

		rem := (N - b_ind) % ring_len
		for i := 0; i < rem; i++ {
			total += B[b_ind+i]
		}
	}
	fmt.Println(total)
}


Measured memory_bytes: 4280
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = 2000000000;
// const ll MOD = 1000000007;

int N;
vector<int> H;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  H.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }

  int ans = 0;
  int m = 0;
  for (int i = 0; i < N; i++) {
    if (H[i] >= m) {
      ans++;
      m = H[i];
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int n,m,x,y;
    cin>>n>>m;
    int a1[n+1]={0};
	int a2[n+1]={0};
	bool chk=false;
	loop(i,0,m){
		cin>>x>>y;
		if(x==1) a1[y]=1;
		if(y==n) a2[x]=1;
		if(a1[x] && a2[x])
            chk = true;
		if(a1[y] && a2[y])
		 chk =true;
	}
    if(chk)
    cout<<"POSSIBLE";
	else
	cout<<"IMPOSSIBLE";
    return 0;
}


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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> a(H + 2, vector<char>(W + 2));
    rep(i, H + 2) {
        rep(j, W + 2) {
            a[i][j] = '#';
        }
    }
    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            cin >> a[i][j];
        }
    }
    rep(i, H + 2) {
        rep(j, W + 2) {
            cout << a[i][j];
        }
        cout << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
n,q=map(int,input().split())
s=input()
list_ac=[0]
number=0
for i in range(0,n):
    if s[i:i+2]=='AC':
        number=number+1
        list_ac.append(number)
    else:
        list_ac.append(number)
list_ac.pop(-1)
for i in range(0,q):
    l,r=map(int,input().split())
    print(list_ac[r-1]-list_ac[l-1])


Measured memory_bytes: 6100
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int H,W,d;
	cin>>H>>W>>d;
	
	int K = 500;
	
	vector<string> S(2000,string(2000,'.'));
	
	for(int i=0;i<2000;i++){
		for(int j=0;j<2000;j++){
			int a = ((i%(2*d))<d);
			int b = ((j%(2*d))<d);
			
			if(a==0&&b==0)S[i][j]='R';
			else if(a==0&&b==1)S[i][j]='G';
			else if(a==1&&b==0)S[i][j]='Y';
			else S[i][j]='B';
		}
	}
	
	vector<string> ans(H,string(W,'.'));
	
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			ans[i][j] = S[i-j+K][i+j+K];
		}
	}
	
	for(int i=0;i<H;i++)cout<<ans[i]<<endl;

	return 0;
}


Measured memory_bytes: 7812
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 1e5+50;
const int inf = 1e9;

bool vis[200];

int main()
{
   // freopen("in", "r", stdin);
    int n;
    scanf("%d", &n);
    int cnt = 0;
    mst(vis);
    for (int i = 0; i < n; ++i)
    {
        char s[5];
        scanf("%s", s);
        if (!vis[s[0]]) cnt++;
        vis[s[0]] = true;
    }
    if (cnt == 3) printf("Three\n");
    else printf("Four\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    int N, K;
    cin>>N>>K;
    vector<int> l;
    rep(i, N){
        int in;
        cin>>in;
        l.push_back(in);
    }
    sort(all(l));
    ll count=0;
    rep(i, K){
        ll th=N-1-i;
        count+=l[th];
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar[4] = {{0,1},{0,-1},{1,0},{-1,0}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int n;cin>>n;
  bool ok = true;
  for(int i = 0; n > i; i++){
    int t;cin>>t;
    if(!(t%2)){
      if(t%3==0 || t%5==0){

      }else{
        cout << "DENIED" << endl;
        return 0;
      }
    }
    
  }
  cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    map<string,int>memo;
    int N;
    int ans=0;
    cin >>N;
    REP(i,N){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        memo[s]++;
    }
    for(auto it=memo.begin();it!=memo.end();it++){
        int d=it->second;
        ans +=d*(d-1)/2;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    deque<int>q;
    q.push_front(1);
    int check[n]={};
    vector<int>cost(n,100);
    cost[1]=1;
    while(*q.begin()!=0){
        int x=*q.begin();
        q.pop_front();
        check[x]=1;
        //cout<<x<<" "<<cost[x]<<endl;
        if(check[x*10%n]==0){
            q.push_front(x*10%n);
            cost[x*10%n]=min(cost[x*10%n],cost[x]);
        }
        if(check[(x+1)%n]==0){
            q.push_back((x+1)%n);
            cost[(x+1)%n]=min(cost[(x+1)%n],cost[x]+1);
        }
    }
    cout<<cost[0]<<endl;
    return 0;
}

Measured memory_bytes: 4332
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int K;
  cin >> K;
  int L,i=1;
  int ans=-1;
  if(K%7==0) L=9*K/7;
    else L=9*K;
  if(L%2!=0 && L%5!=0){
    int m=10%L;
    if(m==1) ans=1;
    else{
      do{
        m=m*10%L;
        i++;
      }while(m!=1);
      ans=i;
    }
  }
  cout << ans <<endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,count=0;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {
        string s=to_string(i);
        int n=s.length();
        if(s[0]==s[n-1] && s[1]==s[n-2])
        {
            count++;
        }
        
    }
    cout<<count<<"\n";
    return 0;
}

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

#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define test ll t; cin>>t; while(t--)
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
#define ll long long
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define PI 3.1415926535897932384626
#define inf 1e18
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define MOD 1000000007

int main()
{
    speed;
   	ll n,ctr=0;
   	cin>>n;
   	map<string,ll> str;  
   	forn(j,n)
   	{
   		string s;
   		cin>>s;
   		sort(all(s));
   		ctr+=str[s];
   		++str[s];
   	}
   	cout<<ctr<<endl;
    return 0;
}


Measured memory_bytes: 11264
# coding: utf-8
def calc_balance(balance, cost, num):
    now_balance = balance
    if ((now_balance - (cost * num)) >= 0):
        now_balance -= (cost * num)
    return now_balance


if __name__ == '__main__':

    a = {'coins': input(), 'value': 500}
    b = {'coins': input(), 'value': 100}
    c = {'coins': input(), 'value': 50}
    x = int(input())

    count = 0

    for i in range(0, int(c['coins']) + 1):
        balance_c = calc_balance(x, c['value'], i)
        if (balance_c == 0):
            count += 1
            break

        for j in range(0, int(b['coins']) + 1):
            balance_b = calc_balance(balance_c, b['value'], j)
            if (balance_b == 0):
                count += 1
                break

            for k in range(0, int(a['coins']) + 1):
                balance_a = calc_balance(balance_b, a['value'], k)
                if (balance_a == 0):
                    count += 1
                    break

    print(count)

Measured memory_bytes: 3064
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
ans=c
k=0
for i in range(n):
    a=list(map(int,input().split()))
    for _ in range(m):
        ans+=b[_]*a[_]
    if ans>0:
        k+=1
    ans=c
print(k)

Measured memory_bytes: 3060
#include <stdio.h>
int main(void) {
    char in[201], tmp[201];
    int m, n, i, j;
    while (1) {
        scanf("%200s ", in);
        if (in[0] == '-')
            break;
        scanf("%d ", &m);
        while (m--) {
            scanf("%d ", &n);
            for (i = 0; in[i+n] != '\0'; i++) {
                tmp[i] = in[i+n];
            }
            for (j = 0; j < n; j++) {
                tmp[i+j] = in[j];
            }
            tmp[i+j] = '\0';
            for (i = 0; tmp[i] != '\0'; i++) {
                in[i] = tmp[i];
            }
        }
        puts(in);
    }
    return 0;
}


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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n;
  cin >> n;

  vll ans(n + 1);

  REP(x, 10000) {
    REP(y, 10000) {
      REP(z, 10000) {
        ll v = x * x + y * y + z * z;
        v += x * y + y * z + z * x;
        if (v > n) {
          break;
        }
        ans[v]++;
      }
    }
  }

  REP(i, n + 1) {
    cout << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  string s;
  cin >> s;
  int l = s.size();
  vint dp(13);
  dp[0] = 1;
  int mul = 1;
  rrep(i,l-1,0){
    vint ndp(13);
    if(s[i] == '?'){
      rep(s,0,10){
        rep(j,0,13){
          ndp[(j + mul*s)%13] += dp[j];
          ndp[(j + mul*s)%13] %= MOD;
        }
      }
    }
    else{
      int m = s[i] - '0'; 
      rep(j,0,13){
        ndp[(j + mul*m)%13] += dp[j];
        ndp[(j + mul*m)%13] %= MOD;
      }
    }
    dp = ndp;
    mul *= 10;
    mul %= 13;
  }
  cout << dp[5] << endl;
}

Measured memory_bytes: 512
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.container.rbtree;
import std.range;
import std.stdio;
import std.string;
import std.traits;

struct Input
{
	int n, m, k;
	Pair[] friends;
    Pair[] blocks;
}
struct Pair
{
    int p1, p2;
}
struct Person
{
    int suggestions = -1;
    int[] friends;
    int[] blocks;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		auto ar = readln().strip().split().map!(to!int).array();
		n = ar[0];
		m = ar[1];
		k = ar[2];
        foreach (i; 0..m)
        {
            ar = readln().strip().split().map!(to!int).array();
            Pair p = {ar[0], ar[1]};
            friends ~= p;
        }
        foreach (i; 0..k)
        {
            ar = readln().strip().split().map!(to!int).array();
            Pair p = {ar[0], ar[1]};
            blocks ~= p;
        }
	}
}

auto main2(Input* input)
{
	with (input)
	{
        Person[] persons;
        persons.length = 100001;
        foreach (friend; friends)
        {
            persons[friend.p1].friends ~= friend.p2;
            persons[friend.p2].friends ~= friend.p1;
        }
        foreach (block; blocks)
        {
            persons[block.p1].blocks ~= block.p2;
            persons[block.p2].blocks ~= block.p1;
        }

        for (int i = 1; i <= n; i++)
        {
            if (persons[i].suggestions != -1)
                continue;

            auto group = redBlackTree!int([]);

            void walkGroup(int i)
            {
                if (i !in group)
                {
                    group.insert(i);
                }
                else
                    return;
                foreach (friend; persons[i].friends)
                {
                    walkGroup(friend);
                }
            }

            walkGroup(i);

            foreach (g; group)
            {
                persons[g].suggestions = cast(int)group.length - 1;//自分を除く
                persons[g].suggestions = persons[g].suggestions - cast(int)persons[g].friends.length;
                foreach (block; persons[g].blocks)
                {
                    if (block in group)
                        persons[g].suggestions = persons[g].suggestions - 1;
                }
            }
        }

        for (int i = 1; i <= n; i++)
        {
            writef("%d ", persons[i].suggestions);
        }
	}
}


alias retType = ReturnType!main2;

void printResult(T)(T result)
{
	static if (isFloatingPoint!T) writefln("%f", result);
	else writeln(result);
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	alias retType = ReturnType!main2;
	static if (is(retType == void))
		main2(&input);
	else
	{
		auto result = main2(&input);
		printResult(result);
	}
}


Measured memory_bytes: 21244
#include <stdio.h>

int main() {

  int n,c;
  int a[101] = {0};
  int d,i,j;
  int flag;


  scanf("%d",&n);

  c = 0;

  for(i = 0;i<n;i++) {

    scanf("%d" ,&a[i]);

  }

  flag = 1;

  while(flag) { 
    flag = 0;

    for(j=n-1;j>=1;j--) {
      
      if(a[j] < a[j-1]) {
	d = a[j];
	a[j] = a[j-1];
	a[j-1] = d;
	c++;
	flag = 1;
      } 
    }
    
  }

  for(i=0;i<n;i++) {
    printf("%d",a[i]);
    if(i != n-1) printf(" ");

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

  return 0;

}




Measured memory_bytes: 2028
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#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
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =998244353;
const int maxn = 300005;
#define endl '\n'
#define ld long double
#define int ll
#define all(x) (x).begin(),(x).end()
int32_t main()
{ 
  IOS

  int a, b, c ,d;
  cin >> a >> b >> c >> d;
  int ans = max(a*c, a*d);
  ans = max(ans, max(b*c, b*d));
  cout << ans << endl;

      
    
} 



Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;

int Ep(int a, int x){
  if(x == 1) return a;
  int num = Ep(a, x/2);
  if(x%2) return (ll)num *num %MOD *a %MOD;
  else return (ll)num *num %MOD;
}

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> d(k+1);
  for(int i=k; i>0; --i){
    int num = k/i;
    num = Ep(num,n);
    for(int j=i*2; j<=k; j+=i){
      num -= d[j];
      if(num < 0) num += MOD;
    }
    d[i] = num;
  }
  int ans = 0;
  for(int i=1; i<=k; ++i){
    ans += (ll)i * d[i] %MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
    ll N; cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A.at(i);
    vector<ll> B(N);
    rep(i, N) cin >> B.at(i);
    vector<ll> d(N);

    ll ans = 0;
    rep(i, N) d.at(i) = A.at(i) - B.at(i);
    sort(d.begin(), d.end());

    ll m = 0;
    rep(i, N) if(d.at(i)<0){
        m += d.at(i)*(-1ll);
        ans++;
    }

    int i = N-1;
    while(m>0){
        if(d.at(i)>0) m -= d.at(i);
        ans++;
        i--;
        if(i==0) break;
    }

    if(m>0) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 2560