akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std ;

int main()
{
  int A[3] ;
  for(int i=0;i<3;i++) cin>>A[i] ;
  
  for(int i=0;i<2;i++){
    for(int j=i+1;j<3;j++){
      if(A[i]>A[j]){
        int tmp=A[i] ;
        A[i]=A[j] ;
        A[j]=tmp ;
      }
    }
  }
  
  int task=0 ;
  for(int i=1;i<3;i++) task+=(A[i]-A[i-1]>0?A[i]-A[i-1]:A[i-1]-A[i]) ;
  
  cout<<task<<endl ;
  return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
const int mod = 1000000007;
//const int mod = 998244353;
 

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);
 
// M * (M-1)^(N-1-K) * N-1 C K
int main(int argc, const char * argv[]) {
    
    vector<ll> X(5);
    cin >> X[0] >> X[1] >> X[2] >> X[3] >> X[4];
    for(ll i=0;i<5;i++){
        if(X[i]==0){
            cout << i + 1 << endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 6204
#include<bits/stdc++.h>
#define ll long long int
#define N 1e6
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef unsigned long long int  uint64;
int dP[100005]= {0};
bool vis[100005] = {false};
vector<vector<int>> gV(100005+1);
void dfs(int i)
{

if(vis[i] == true)
{
	return;
}

	vis[i] = true;
	FOR(j, 0, gV[i].size(), 1){
		int nei = gV[i][j];

		if(!vis[nei]){
			dfs(nei);
		}
		dP[i] = max(dP[i], dP[nei]+1);
}
}

int main(){

    	ios_base::sync_with_stdio(false); cin.tie(0);
    	int n, m;
    	cin>> n>> m;
    	FOR(i, 0, m, 1){
    		int x, y;
    		cin>> x>> y;
    		gV[x].PB(y);
    	}

    	FOR(i, 1, n+1, 1){
    		if(!vis[i]){
    			dfs(i);

    		}
    	}
    	int max = INT_MIN;

    	FOR(i, 1, n+1, 1){
    		if(dP[i]> max)
        {
    			max = dP[i];
    		}

    	}
    	cout<< max<< endl;

    		}


Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
/*
void solve(){
  ll n; cin >> n;
  vector<ll> prime;
  FOR(i,2,(1000006)){
    bool flg = true;
    
    if(flg) prime.push_back(i);
  }
}
*/
/*
void solve(){
  int n; cin >> n; int ans =0;
  if(n<10) {cout << n; return;}
  priority_queue<
      int,                // 要素の型はint
      std::vector<int>,   // 内部コンテナはstd::vector (デフォルトのまま)
      std::greater<int>   // 昇順 (デフォルトはstd::less<T>)
    > qb, qa;
  FOR(i,1,10000000){
    string s = std::to_string(i);
    bool flg=true;
    FOR(j,0,s.size()-1){
      if(abs(s[j]-s[j+1])>1) {flg=false; break;}
    }
    if(flg) ans++;
    if(ans==n) {cout << i; return;}
  }
  cout << ans << endl;
}*/
/*
void solve(){
  int n, k, c; cin >> n >> k >> c;
  string s; cin >> s;
}*/
template <class T> std::vector<T> divisors(const T &n) {
  std::vector<T> ret;
  T i = static_cast<T>(1);
  while (i * i < n) {
    if (n % i == static_cast<T>(0)) {
      ret.push_back(i);
      ret.push_back(n / i);
    }
    ++i;
  }
  if (i * i == n) {
    ret.push_back(i);
  }
  std::sort(ret.begin(), ret.end());
  ret.shrink_to_fit();
  return std::move(ret);
}


template<class T> struct prime{
  T N;
  vector<T> v;
  void init(const T &n){
    N = n;
    T i = static_cast<T>(2);
    while(true);
  }
};


void solve(){
  ll n; cin >> n;
  size_t ans = 0;
  for (const ll k : divisors(n)) {
    if (k == 1)
      continue;
    ll m = n;
    while (m % k == 0) {
      m /= k;
    }
    if (m % k == 1) {
      ans += 1;
    }
  }
  ans += divisors(n - 1).size();
  std::cout << ans - 1 << std::endl;
}

void solve2(){
  int n, k, c; cin >> n >> k >> c;
  string s; cin >> s;
  vector<int> L(k+5), R(k+5);
  int cnt = 0, bf=-987654321;
  FOR(i,0,n){
    if(s[i]=='o' && (i-bf)>c) {bf = i; L[cnt] = i; cnt++;}
    if(cnt==k) break;
  }
  bf = 987654321; cnt = k-1;
  IFOR(i,0,n){
    if(s[i]=='o' && (bf-i)>c) {bf = i; R[cnt] = i; cnt--;}
    if(cnt==-1) break;
  }
  FOR(i,0,k){
    if(L[i]==R[i]) cout << (L[i]+1) << endl;
  }
}

int main(){
  //solve();
  solve2();
  return 0;
}

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

using namespace std;

int main()
{
  int w, h;
  while(cin >> w >> h, w || h){
    int s[33][33], c[4];
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++) cin >> s[i][j];
    }
    for(int i = 0; i < 4; i++) cin >> c[i];
    const int inf = (1 << 25);
    int a[4][33][33];
    int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
    fill(a[0][0], a[4][0], inf);
    typedef pair<int, int> P;
    typedef pair<P, P> PP;
    priority_queue<PP, vector<PP>, greater<PP> > que;
    que.push(PP(P(0, 0), P(0, 0)));
    a[0][0][0] = 0;
    while(!que.empty()){
      PP p = que.top(); que.pop();
      int l = p.first.first, d = p.first.second;
      int x = p.second.first, y = p.second.second;
      if(x == w-1 && y == h-1){
	cout << l << endl;
	break;
      }
      for(int i = 0; i < 4; i++){
	int nd = (d+i) % 4, nx = x + dx[nd], ny = y + dy[nd], nl = l + (i == s[y][x] ? 0 : c[i]);
	if(nx < 0 || w <= nx || ny < 0 || h <= ny) continue;
	if(nl < a[nd][ny][nx]){
	  que.push(PP(P(nl, nd), P(nx, ny)));
	  a[nd][ny][nx] = nl;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1332
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()
 
 
int main() {
  int N, A;
  cin >> N >> A;
  if(N % 500 <= A) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    template <bool nl>
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { final(); }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
        template <bool f = nl>
        auto final() -> std::enable_if_t<f> { cout << '\n'; }
        template <bool f = nl>
        auto final() -> std::enable_if_t<!f> {}
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy<true> operator,(T&& val)
    {
        cout << val;
        return {};
    }
    proxy<false> noreturn() { return {}; }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
    }
};

void prog()
{
    input in;
    output out;

    uint64_t W, H, x, y;
    in >> W, H, x, y;

    out, W *H / 2., (2 * x == W && 2 * y == H) ? 1 : 0;
}

int main()
{
    prog();
    return 0;
}


Measured memory_bytes: 256
nums = list(map(int, input().split()))
K, X = nums[0], nums[1]


for i in list(range(1, K))[::-1]:
    print(X-i, end='')
    print(' ', end='')

print(X, end=' ')
for i in range(1, K):
    print(X+i, end='')
    print(' ', end='')
print()


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

public class Main {
    BufferedReader rd;

    Main() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        int n = pint();
        out(n/3);
    }

    private int pint() throws IOException {
        return pint(rd.readLine());
    }

    private int pint(String s) {
        return Integer.parseInt(s);
    }

    private static void out(Object x) {
        System.out.println(x);
    }

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


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll x;
  cin >> x;
  ll mny=100;
  ll y=0;
  while(mny<x) {
    mny+=mny/100;
    y++;
  }
  cout << y << endl;
}

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

int main()
{
  int a;
  int b;
  int avg;
  double mod;
  
  cin >> a >> b;
  avg = (a + b) / 2;
  mod = (a + b) / 2.0 - avg;
  if(mod > 0)
  {
    avg += 1;
  }
  cout << avg << endl;
}


Measured memory_bytes: 3568
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>
#include<string.h>
#include<stdio.h>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;

//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N;
  string S;
  cin >> N;
  cin >> S;
  int result = 0;

  for(int i = 0 ; i <= S.length() - 3; i++){
  	if(S[i] == 'A'){
  		if(S[i+1] == 'B'){
  			if(S[i+2] == 'C'){
  				result++;
  			}
  		}
  	}
  }


cout << result << endl;
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int H, W;
	int i, j;

	while (1) {
		scanf("%d%d", &H, &W);
		if (H == 0 && W == 0) break;

		for (i = 0; i < H; i++) {
			for (j = 0; j < W; j++) {
				if(i==0||i==H-1||j==0||j==W-1)printf("#");
				else printf(".");
			}printf("\n");
		}printf("\n");
	}
		return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(){
  int N;
  cin >> N;

  vector<string> S(N);
  rep(i,N){
    cin >> S.at(i);
  }

  sort(S.begin(), S.end());
  S.push_back(" ");

  int max_count = 1;
  int count = 1;
  bool same = false;
  string last = S.at(0);
  vector<string> ans;

  for(int i=1; i<N+1; i++){
    if(S.at(i)==last){
      count ++;
    }else{
      if(count > max_count){
        ans = vector<string>(1, last);
        max_count = count;
      }else if(count == max_count){
        ans.push_back(last);
        max_count = count;
      }
      last = S.at(i);
      count = 1;
    }
  }

  rep(i, ans.size()){
    cout << ans.at(i) << endl;
  }

}

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

int noa(int n) {
  int res = 1;
  for (int i = 1; i <= n; i++) {
    res += i;
  }
  return res;
}

int main(int argc, char **argv)
{
  int n;
  while (cin >> n) {
    if (!n)
      break;
    cout << noa(n) << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> A;
int N,M;
int P[100001],Y[100001];
int K[100001];
signed main() {
    cin >> N >> M;
    vector<A>vec[100001];
    for(int i = 0; i < M; i++) {
        cin >> P[i] >> Y[i];
        vec[P[i]].push_back(A(Y[i], i));
    }
    for(int i = 1; i <= N; i++) {
        sort(vec[i].begin(),vec[i].end());
    }
    for(int i = 1; i <= N; i++) {
        for(int j = 0; j < vec[i].size(); j++) {
            K[vec[i][j].second] = j;
        }
    }
    for(int i = 0; i < M; i++) {
        printf("%06d" "%06d\n",P[i],K[i]+1);
    }
}


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

const int INF = 1001001001;

int main(){
  // 入力
  int H, N;
  cin >> H >> N;
  vector<pair<int, int>> magic(N);
  
  for(int i = 0; i < N; i++){
  	cin >> magic.at(i).first >> magic.at(i).second;
  }

  //最大火力を把握
  int max_a = 0;
  for(int i =0; i < N; i++){
    if(max_a < magic.at(i).first)
      max_a = magic.at(i).first;
  }

  //DPテーブル
  vector<int> dp(H+1, INF);

  //DP初期条件
  dp[0] = 0;

  //DPループ
  for(int i= 0; i < N; i++){
    for(int j = 0; j < H; j++){
      int nj = min(j+magic.at(i).first, H);
      dp[nj] = min(dp[nj], dp[j]+magic.at(i).second);
    }
  }

  cout << dp[H] << endl;
}
 



Measured memory_bytes: 256
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
int main() {
    int n;
    cin>>n;
    rep(i,n)
        cout<<"ACL";
	cout<<endl;
    return 0;
}


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

int main() {
  vector<int> ans(3);
  for(int i = 0; i<3 ;i++){
    cin >> ans.at(i);
  }
  int k;
  cin >> k;
  sort(ans.begin(), ans.end());
  for(int i=0 ; i<k;i++){
    ans.at(2) = 2*ans.at(2);
  }
  int x;
  for(int i=0;i<3;i++){
    x += ans.at(i);
  }
  
  cout << x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k;
	cin >> n >> k;
	priority_queue<long long> h;
	for(int i=0; i<n; ++i){
		int tmp; cin >> tmp;
		h.push(tmp);
	}
	k = min(k,n);
	for(int i=0; i<k; ++i){
		h.pop();
	}
	long long ans=0;
	while(!h.empty()){
		ans += h.top();
		h.pop();
	}
	cout << ans << endl;
}

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

using namespace std;

int main()
{
    int a[3];
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    int opre=0;
    while(a[0]!=a[1]||a[1]!=a[2]||a[0]!=a[2]){
        while(a[1]<a[2]&&a[0]<a[2]){
            a[1]++;
            a[0]++;
            opre++;
        }
        if(a[0]==a[2]==a[1])break;
        if(a[0]!=a[2]){
                while(a[0]<a[2]){
                    a[0]+=2;
                    opre++;
                }
        }else if(a[1]!=a[2]){
            while(a[1]<a[2]){
                    a[1]+=2;
                    opre++;
            }
        }
        sort(a,a+3);

    }
    printf("%d",opre);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n, k, r, s, p,score=0,point[100000];
    string t;
    cin >> n >> k;
    cin >> r >> s >> p;
    cin >> t;
    for (int i = 0; i < n; i++) {
        if (i < k) {
            if (t[i] == 'r') {
                point[i] = p;
            }
            else if (t[i] == 'p') {
                point[i] = s;
            }
            else {
                point[i] = r;
            }
        }
        else {
            if (t[i - k] != t[i]) {
                if (t[i] == 'r') {
                    point[i] = p;
                }
                else if (t[i] == 'p') {
                    point[i] = s;
                }
                else {
                    point[i] = r;
                }
            }
            else if (point[i - k] == 0) {
                if (t[i] == 'r') {
                    point[i] = p;
                }
                else if (t[i] == 'p') {
                    point[i] = s;
                }
                else {
                    point[i] = r;
                }
            }
            else {
                point[i] = 0;
            }
        }
    }
    for (int j = 0; j < n; j++) {
        score += point[j];
    }
    cout << score << endl;
    return 0;
}

Measured memory_bytes: 896
import Data.List

dfs :: Int -> Int -> [Int] -> [Int] -> (Bool, [Int])
dfs gn r cs ds
  | r < 1 = (True, ds ++ cs)
  | null cs = (False, ds)
  | otherwise = dfs gn r' cs' ds'
  where
    c = head cs
    r' = r - (c `div` gn)
    cs' = tail cs
    ds' = ds ++ [c `mod` gn]

solve (l1:l2)
  | result' && sum cs'' == 0 = "Yes"
  | otherwise = "No"
  where
    (h:w:_) = map read $ words l1
    cs = map length $ group $ sort $ concat l2
    g4 = (h `div` 2) * (w `div` 2)
    g2
      | odd h && odd w = (h `div` 2) + (w `div` 2)
      | odd h && even w = w `div` 2
      | even h && odd w = h `div` 2
      | otherwise = 0
    g1 = if odd h && odd w then 1 else 0
    step (result, cs') (gn, r)
      | result = dfs gn r cs' []
      | otherwise = (False, [])
    (result', cs'') = foldl' step (dfs 4 g4 cs []) [(2, g2), (1, g1)]

main = getContents >>= putStrLn.solve.lines


Measured memory_bytes: 2428
//19/01/2020
#include<bits/stdc++.h>

using namespace std;

#define debug printf("Debug\n");
#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define p_b(x) push_back(x)
#define m_p(x) make_pair(x,y)

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};
vector<ll>v;


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

    if(a<b){
        for(ll i=1;i<=b;i++) cout<<a;
        cout<<endl;
    }
    else{
        for(ll i=1;i<=a;i++) cout<<b;
        cout<<endl;
    }



    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ffor( i,a,b) for(int i=a;i<b;i++)
#define ll long long
int main()
{
    ll w,n;
    cin>>n>>w;
    ll wt[n],v[n];
    ffor(i,0,n)
    {
        cin>>wt[i]>>v[i];
    }
    ll dp[n+1][w+1];
    ffor(i,0,n+1)
    {
        ffor(j,0,w+1)
        {
         if(i==0||j==0)
         {
             dp[i][j]=0;
         }   
         else if(wt[i-1]<=j)
         {
            dp[i][j]=max(dp[i-1][j],v[i-1]+dp[i-1][j-wt[i-1]]);
         }
         else
         {
             dp[i][j]=dp[i-1][j];
         }
        }
    }
    cout<<dp[n][w];
}

Measured memory_bytes: 79104
import sys
from collections import deque

s = sys.stdin.readline().rstrip()
Q = int(sys.stdin.readline().rstrip())
Q = [sys.stdin.readline().split() for _ in range(Q)]

def main():
    res = deque(s)
    flag = 0
    cnt = 0
    for q in Q:
        if q[0] == '1':
            flag ^= 1
            cnt += 1
        else:
            f, c = q[1:]
            f = int(f) - 1
            if flag ^ f:
                res.append(c)
            else:
                res.appendleft(c)
    
    res = ''.join(list(res))
    if cnt & 1:
        res = res[::-1]
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 44660
#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"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;


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

	cin >> L >> R;
	L--;
	long long int ans = 0;
	for (int i = 1; i <= 40; i++) {
		long long int box = 1LL << i;
		long long int num = R / box;
		num *= 1LL << (i - 1);
		long long int amari = R % box;
		num -= max(0LL, amari - (1LL << (i - 1)) + 1);
		if (num & 1)ans ^= 1LL << (i - 1);
	}
	R = L;
	for (int i = 1; i <= 40; i++) {
		long long int box = 1LL << i;
		long long int num = R / box;
		num *= 1LL << (i - 1);
		long long int amari = R % box;
		num -= max(0LL, amari - (1LL << (i - 1)) + 1);
		if (num & 1)ans ^= 1LL << (i - 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n,a,b=map(int,input().split())
mod=10**9+7
def C(n,k,mod):
    k=min(k,n-k)
    comb=1
    for i in range(k):
        temp=(n-i)*pow(i+1,mod-2,mod)
        comb=comb*temp%mod

    return comb

ans=pow(2,n,mod)-1-C(n,a,mod)-C(n,b,mod)
print(ans%mod)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
vvi E(222222);
vi dist(222222,llINF);
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  for(int i=0;i<m;i++){
    ll a,b;cin>>a>>b;
    E[--a].pb(--b);
    E[b].pb(a);
  }
  queue<pair<ll,ll>>que;
  que.push(mp(0,0));
  while(!que.empty()){
    ll now=que.front().F;
    ll di=que.front().S;
    que.pop();
    for(auto a:E[now]){
      if(dist[a]>di+1){
	dist[a]=di+1;
	que.push(mp(a,di+1));
      }
    }
  }
  if(dist[n-1]==2)cout<<"POSSIBLE"<<endl;
  else cout<<"IMPOSSIBLE"<<endl;
  return 0;
}


Measured memory_bytes: 16744
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
    while (true) {
        int a, b;
        char op;
        cin >> a >> op >> b;
        int ans;
        if (op == '?')return 0;
        else if (op == '+')ans = a + b;
        else if (op == '-')ans = a - b;
        else if (op == '*')ans = a * b;
        else if (op == '/')ans = a / b;

        cout << ans << endl;
    }
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 vector<ll> vec(3);
  for(ll i=0;i<3;i++) {
cin>>vec[i];
  }
  sort(all(vec));
  cout<<vec[0]+vec[1]<<endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
/* テンプレートここまで */

int main() {
  ll K;
  cin >> K;
  ll N = 50;

  ll x = K%N;
  ll y = K/N;

  cout << N << endl;
  REP(i, N+1){
    if(i == N-x){
      if(x == 0) cout << endl;
      continue;
    }
    cout << y+i;
    if(i == N) cout << endl;
    else cout << " ";
  }
  return 0;

}


Measured memory_bytes: 256
import math
a,b,h,m = list(map(int,input().split()))

h_deg = (h*30) + (m*0.5)
m_deg = m*6

subst = abs(h_deg-m_deg)
c = math.sqrt(a**2 + b**2 -(2*a*b*math.cos(math.radians(subst))))
print(c)

Measured memory_bytes: 9508
#include <algorithm>
#include <iostream>
#include <vector>

bool doesFirstWin(const std::vector<int> &candidates, const int first) {
  std::vector<int> win_lose(first + 1, -1);
  const int min_value = *std::min_element(candidates.begin(), candidates.end());

  for (int i = 0; i <= first; ++i) {
    win_lose[i] = 0;
    if (i >= min_value) {
      for (const auto &candi : candidates) {
        const int rest = i - candi;
        if ((rest >= 0) && (win_lose[rest] == 0)) {
          win_lose[i] = 1;
          break;
        }
      }
    }
  }
  return win_lose[first];
}

int main() {
  int n, k;
  std::cin >> n >> k;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  std::cout << (doesFirstWin(a, k) ? "First" : "Second") << std::endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>

typedef long long i64;

const int N = 100000 + 10;

int n, a[N];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  i64 ans = 1LL << 60, cur = 0, sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += a[i];
    int t = (i & 1) ? 1 : -1;
    i64 temp = std::max(t * (t - sum), 0LL);
    cur += temp;
    if (temp) sum = t;
  }
  ans = std::min(ans, cur);
  cur = sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += a[i];
    int t = (i & 1) ? -1 : 1;
    i64 temp = std::max(t * (t - sum), 0LL);
    cur += temp;
    if (temp) sum = t;
  }
  ans = std::min(ans, cur);
  printf("%lld\n", ans);
  return 0;
}


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

int my_gcd(int a, int b) {
    if (a % b == 0) {
        return b;
    }
    return my_gcd(b, a % b);
}

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

    long long int ans = 0;
    for (int i = 0; i < K; i++) {
        for (int j = 0; j < K; j++) {
            for (int l = 0; l < K; l++) {
                ans += my_gcd(i + 1, my_gcd(j + 1, l + 1));
            }
        }
    }

    cout << ans << endl;
}

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

typedef long long ll;
const int MAX_N = 100000;
const ll MOD = 1e+9 + 7;

int main() {
  int N, M;
  std::set<int> a;
  std::cin >> N >> M;
  for(int i = 0; i < M; ++i) {
    int tmp;
    std::cin >> tmp;
    a.insert(tmp);
  }

  static ll dp[MAX_N + 1] = {};
  dp[0] = 1;
  for(int i = 0; i < N; ++i) {
    if(i + 1 <= N and a.find(i + 1) == a.end()) {
      dp[i + 1] += dp[i];
      dp[i + 1] %= MOD;
    }
    if(i + 2 <= N and a.find(i + 2) == a.end()) {
      dp[i + 2] += dp[i];
      dp[i + 2] %= MOD;
    }
  }
  std::cout << dp[N] << std::endl;
}


Measured memory_bytes: 4992
#include <iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;

int main(){
  int x,ans;
  cin >> x;
  
  if(x>=400 && x<=599){ans=8;}
  else if(x>=600 && x<=799){ans=7;}
  else if(x>=800 && x<=999){ans=6;}
  else if(x>=1000 && x<=1199){ans=5;}
  else if(x>=1200 && x<=1399){ans=4;}
  else if(x>=1400 && x<=1599){ans=3;}
  else if(x>=1600 && x<=1799){ans=2;}
  else if(x>=1800 && x<=1999){ans=1;}
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3592
str = input()

A = (int(str.split()[0]))
B = (int(str.split()[1]))

X = A + B
Y = A - B
Z = A * B
E = 0
if (X < Y) :
	if (Y < Z) :
		E = Z
	else :
		E = Y
else :
	if (X < Z) :
		E = Z
	else :
		E = X
print("{}".format(E))


Measured memory_bytes: 3060
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;
const ll INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int cnt = 0;
  rep(i, n) cin >> a[i];

  rep(i, n) {
    if (i != n - 1 && a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      cnt++;
    } else if (i == n - 1 && a[n - 1] == n) {
      swap(a[n - 1], a[n - 2]);
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}


Measured memory_bytes: 3788
//#pragma GCC optimize(2)
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#define rush() int T;cin>>T;while(T--)
#define go(a) while(cin>>a)
#define ms(a,b) memset(a,b,sizeof a)
#define E 1e-8
using namespace std;
typedef long long ll;
inline bool read(ll &num)
{char in;bool IsN=false;
in=getchar();if(in==EOF) return false;while(in!='-'&&(in<'0'||in>'9')) in=getchar();if(in=='-'){ IsN=true;num=0;}else num=in-'0';while(in=getchar(),in>='0'&&in<='9'){num*=10,num+=in-'0';}if(IsN) num=-num;return true;}
const int N=300+5;

    ll n,m,t,_;
    int i,j,k;
    ll a[N];
    ll p[N][N];
    bool flag;

int main()
{
    for(;read(n);){
        for(i=1;i<=n;i++){
            for(j=1;j<=n;j++){
                read(p[i][j]);
                p[j][i]=p[i][j];
            }
        }

        ll ans=0;
        for(i=1;i<=n;i++){
            for(j=1;j<=n;j++){
                flag=1;
                for(k=1;k<=n;k++){
                    if(i==j || j==k || k==i) continue;

                    if(p[i][j]>p[i][k]+p[k][j]){
                        puts("-1");
                        return 0;
                    }
                    else
                    if(p[i][j]==p[i][k]+p[k][j])
                        flag=0;
                }

                if(flag) ans+=p[i][j];
            }
        }

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

Measured memory_bytes: 1024
using System;

class Program {
    static void Main(string[] args) {
        //入力
        string str = Console.ReadLine();

        //カウンタ
        int ans = 0;

        //一文字ずつ判定
        for (int i = 0; i < str.Length; i++) {
            if (str[i] =='2') {
                ans++;
            }
        }

        //出力
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}


void solve()
{
	int n, m;
	cin >> n >> m;
	int L = 0, R = n + 1;
	for(int i = 0; i < m; ++i){
		int l, r;
		cin >> l >> r;
		R = min(R, r);
		L = max(L, l);
	}
	cout << max(0, R - L + 1);
	
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
	

	int a,b,c;
	cin >> a>>b>>c;
	
	set<int> S;
	S.insert(a);

	S.insert(b);
	S.insert(c);
	
	cout << S.size()<< endl;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	string s;
	cin >> s;
	
	if( s.size() == 2 ){
		if( s[0] == s[1] ){
			cout << "1 2" << endl;
		}
		else
			cout << "-1 -1" << endl;
		ret 0;
	}

	int n = s.size();
	rep(i,2,n){
		char a,b,c;
		a = s[i-2];
		b = s[i-1];
		c = s[i];
		if( a == b || b == c || c == a ){
			cout << i-1 << " " << i+1 << endl;
			ret 0;
		}
	}
	
	cout << -1 << " " << -1 << endl;

	ret 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();

		if(x==y) {
			System.out.println(x);
		}else if(x>y){
			System.out.println(divisor(x,y));
		}else {
			System.out.println(divisor(y,x));
		}

	}

	public static int divisor(int x,int y) {
		int temp=0;

		temp = x%y;
		if(temp==0) {
			return y;
		}
		return divisor(y,temp);
	}
}



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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  int n,m;
  cin >> n >> m;
  if(n==m){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
 
  return 0;

}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define lli long long int
#define pb(a) push_back(a)
#define forr(a,n) for(lli i=a;i<n;i++)
#define forrr(j,a,n) for(lli j=a;j<n;j++)
#define all(x) x.begin(),x.end()
#define pi2  1.57079632679489661923
using namespace std;
void print(lli a[],lli n){
forr(0,n){cout<<a[i]<<" ";}
cout<<"\n";
}
lli power(lli x){
lli u=0;
while(x%2==0){
    u++;
    x=x/2;
}
return u;
}

lli powM(lli x,lli y,lli m)
{
    lli ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
int powm(lli a, lli b) {
	lli res = 1;
	while (b) {
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b >>= 1;
	}
	return res;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}
/*
vector <lli> adj[100001];
lli vis[100001]={0};
void dfs(lli a){
    vis[a]=1;
    forr(0,adj[a].size()){
    if(vis[adj[a][i]]){continue;}
    else{
        dfs(adj[a][i]);
    }
    }
}
lli level[100001];
void bfs(lli a){
queue <lli> q;
vis[a]=1;
level[a]=0;
q.push(a);
while(!q.empty()){
    lli p=q.front();
    q.pop();
    forr(0,adj[p].size()){
    if(vis[adj[p][i]]==0){
        level[adj[p][i]]=level[p]+1;
        q.push(adj[p][i]);
        vis[adj[p][i]]=1;
    }
    }

}

}

vector <pair<lli,lli> > dj[100001];
lli dist[100001];
vector<lli> ans[100001];
void dijkstra(lli a){
dist[a]=0;
ans[a].pb(a);
multiset<pair<lli,lli> > s;
s.insert({0,a});
while(s.size()!=0){
    lli x=(*s.begin()).second;
    s.erase(s.begin());
    if(vis[x]){continue;}
    vis[x]=1;
    forr(0,dj[x].size()){
    lli e=dj[x][i].first;
    lli we=dj[x][i].second;
    if(dist[x]+we<dist[e]){
        dist[e]=dist[x]+we;
        ans[e].clear();
        ans[e].pb(x);
        s.insert({dist[e],e});
    }
    }
}

}
*/
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
   cout.tie(0);
   // freopen("outpu.txt","w",stdout);
int t1=1;
//cin>>t1;
lli M =1e9+7;
while(t1--){
lli n;
cin>>n;
lli a[n+1]={0};
forr(1,sqrt(n)+1){
forrr(j,1,sqrt(n)+1){
forrr(k,1,sqrt(n)+1){
lli u=i*i+j*j+k*k+i*j+i*k+j*k;
if(u<=n){a[u]++;}
}
}
}
forr(1,n+1){
cout<<a[i]<<"\n";
}
}
     return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<string>> sub(n);
    rep(i, m) {
        int p;
        string s;
        cin >> p >> s;
        sub.at(p-1).push_back(s);
    }

    int ac = 0;
    int wa = 0;
    for (vector<string> res : sub) {
        if (res.size() == 0)
            continue;

        rep(i, res.size()) {
            if (res.at(i) == "AC") {
                ac++;
                wa += i;
                break;
            }
        }
    }

    cout << ac << " " << wa << endl;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
//     for(int i=0; i<N;i++){
//     }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int pb[101];
    int id[101], new_time[101];
    int N,M;
    cin>>N;
    for(int i=0; i<N;i++) cin>>pb[i];
    cin>>M;

    for(int i=0; i<M;i++){

      cin>>id[i]>>new_time[i];
    }

    for(int i=0; i<M;i++){

      int sum=0;

      for(int j=0; j<N;j++){
        if((id[i]-1)!=j){
          sum+=pb[j];
        }else{
          sum+=new_time[i];
        }
      }
      cout<<sum<<endl;

    }


    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var s = parseInt(input[0]);
  a = [s];
  for(var i=1;i>0;i++){

    if(a[i-1]%2==0){
      b=a[i-1]/2;
    if(a.indexOf(b)!=-1){
      var ans=i+1;
      break;
    }
      a.push(a[i-1]/2);
    }else{
      b=a[i-1]*3+1;
    if(a.indexOf(b)!=-1){
      var ans=i+1;
      break;
    }
      a.push(a[i-1]*3+1)
    }
  }

  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    long long X;
    cin >> X;
    long long now = 100;
    int answer = 0;
    while (now < X) {
        answer++;
        now += now / 100;
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3576
def main():
    a,b,k=map(int,input().split())

    if a<=k:
        k-=a
        a=0
    else:
        print(str(a-k) + ' ' + str(b))
        return

    if b <=k:
        b=0
    else:
        print(str(a)+' ' +str(b-k))
        return
    


    print(str(a) + ' ' + str(b))
if __name__=='__main__':
    main()


Measured memory_bytes: 3060
# coding: utf-8
# Your code here!
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += gcd(i, gcd(j, k))
print(ans)

Measured memory_bytes: 75844
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int n = tmp[0], x = tmp[1];
	int[] a = ReadIntArray();
	Array.Sort(a);

	int ans = 0;
	for (int i = 0; i < n; i++)
	{
	    if (x >= a[i])
	    {
		ans++;
		x -= a[i];
	    }
	    else
	    {
		x = 0;
	    }
	}

	if (x > 0) ans--;

	WriteLine(ans);
    }
}


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

int main()
{
  int64_t N, ans = 0;
  cin >> N;
  for (int x = 1; x <= sqrt(N); x++)
  {
    if (N % x == 0)
    {
      int64_t a = (N / x) - 1;
      if (a != 0 && N / a == N % a)
        ans += a;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.io.*;
//import java.util.stream.IntStream;
import java.nio.charset.Charset;


public class Main {
    static int[][] T;
    static int INFTY = Integer.MAX_VALUE;
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
      //  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


     //   try{

            int n = sc.nextInt();
            int m = sc.nextInt();

            // T[i][j] i番目までの効果を使ってj円を作る最小枚数
            T = new int[m + 1][n + 1];
            Arrays.fill(T[0],INFTY);

            int[] c = new int[m + 1];
            for (int i = 1; i < c.length; i++) {
                c[i] = sc.nextInt();
            }

            for (int i = 1; i<=m; i++) {
                // c[i]より小さい部分は前のi-1番目までの数字を使ったものと同じ。nより大きい数字が含まれる場合はnまでで切る
                int end = Math.min(c[i], n + 1);
                for(int j=1;j<end;j++){
                    T[i][j] = T[i-1][j];
                }
                for(int j = c[i];j<=n;j++){
                    T[i][j] = Math.min(T[i-1][j], T[i][j-c[i]] + 1);
                }
            }

            System.out.println(T[m][n]);



    }

}



Measured memory_bytes: 31288
#include<bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef long double ld;

void faster(){
  	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
	cout.tie(NULL);
}

const int MAXN = 5e1 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

ll n, A, B;

int main(){
	faster();

	cin >> n >> A >> B;

	cout << max((B * (n - 1) + A) - (A * (n - 1) + B) + 1, 0ll);

	return 0;
}

Measured memory_bytes: 256
input = readlines()

n = input.shift.chomp.to_i
list = input.shift.chomp.split("\s").map{|x| x.to_i}

sum = 0
list.each_with_index do |l1, i1|
  list.each_with_index do |l2, i2|
    next if i1 >= i2
    sum += l1 * l2
  end
end

puts sum

Measured memory_bytes: 14316