akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=1000000007;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
// mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());  put as first line of main
int a[30][30];
ll n;
ll dp[21][2100000];
ll f(ll i,ll mask)
{
    if(i==(n) && (mask==(powr(2,n) -1)) )
        return 1;
    else if(i==n)
        return 0;
    else if((mask==(powr(2,n) -1)))
        return 0;
    else
        {
    if(dp[i][mask]!=-1)
        return dp[i][mask];
    ll j;
    ll ans=0;
    for(j=0;j<n;j++)
    {
        if(a[i][j] && (!(mask&(1<<j))))
        {
            ans=(ans+f(i+1,(mask|(1<<j))))%hell;
        }
    }
    dp[i][mask]=ans;
    return ans;
        }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));
    ll i,j;
    cin>>n;
    for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
            cin>>a[i][j];
    }
    cout<<f(0,0);
    return 0;
}


Measured memory_bytes: 344832
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcd(long long a,long long b){return a*b / gcd(a,b) / gcd(a,b);}


int main()
{
	long double A,B;
	long double H,M;
	cin>>A>>B>>H>>M;
	//長針と短針の角度(rad)を求める
	long double rad = (M / 60 - (60 * H + M) / 720) * 2 * M_PI;
	
	//余弦定理で長さを求める
	long double result = sqrt(A * A + B * B - 2 * A * B * cos(rad));
	printf("%.20Lf\n",result);
}

Measured memory_bytes: 4168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

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

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int h, w, a, b;
    cin >> h >> w >> a >> b;

    int res[1001][1001];
    memset(res, 0, sizeof(res));

    for (int i = 0; i < h; i++)
    {
        if (i < b)
        {
            for (int j = 0; j < w; j++)
            {
                if (j < a || a * 2 <= j)
                    res[i][j] = 1;
            }

            continue;
        }

        if (i < 2 * b)
        {
            for (int j = 0; j < w; j++)
            {
                if (!(j < a || a * 2 <= j))
                    res[i][j] = 1;
            }

            continue;
        }

        for (int j = 0; j < w; j++)
        {
            if (j < a)
                res[i][j] = 1;
        }
    }

    REP(i, h)
    {
        REP(j, w)
        {
            cout << res[i][j];
        }

        cout << endl;
    }

    return 0;
}

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

int main(){
    int n;
    std::cin >> n;
    //右端が早いものからとる
    std::vector<std::pair<int,int>> a(n); //right left
    for(int i = 0; i < n; i++){
        std::cin >> a[i].first >> a[i].second;
        int tmp = a[i].first + a[i].second;
        a[i].second = a[i].first -  a[i].second;
        a[i].first = tmp;
    }
    std::sort(a.begin(),a.end());
    std::reverse(a.begin(),a.end());
    int cnt = 0;
    int cur = a.back().first;
    a.pop_back();
    cnt++;
    for(int i = 0; i < n; i++){
        if(a.back().second >= cur){
            cnt++;
            cur = a.back().first;
        }
        a.pop_back();
    }
    std::cout << cnt  << std::endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#define inf 0x3f3f3f3f
#define LL long long

using namespace std;

int main()
{
    string str;
    while(cin>>str)
    {
        cout<<"2018";
        for(int i=4;i<10;i++)
        {
            cout<<str[i];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
// Daniel Grzegorzewski
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

const int N = (int)1e5 + 3;

int n, res[N];
string s;

int main() {
  init_ios();
  cin >> s;
  n = s.size();
  s = "!" + s;
  int nxtL = 1, prvR = 1;
  for (int i = 1; i <= n; ++i) {
    if (s[i] == 'R') {
      prvR = i;
      nxtL = max(nxtL, i+1);
      while (s[nxtL] != 'L')
        ++nxtL;
      int dis = nxtL-i;
      if (dis%2 == 0)
        ++res[nxtL];
      else
        ++res[nxtL-1];
    }
    else {
      int dis = i-prvR;
      if (dis%2 == 0)
        ++res[prvR];
      else
        ++res[prvR+1];
    }
  }
  for (int i = 1; i <= n; ++i)
    cout<<res[i]<<" ";
  cout<<"\n";
}

Measured memory_bytes: 1004
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        long res = k * (long)Math.pow(k-1, n - 1);
        System.out.println(res);
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<stack>
#include<string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#define fast(); ios_base::sync_with_stdio(0);cin.tie(0);
#define rep(i, n) for(int i= 0; i < n; ++i)
using namespace std;

int main() {
	int a, b, c, k; cin >> a >> b >> c >> k;
	if (k <= a) {
		cout << k << endl;
	}
	else if (k <= (a + b)) {
		cout << a << endl;
	}
	else {
		cout << a - (k - a - b) << endl;
	}
	return 0;
}


Measured memory_bytes: 3580
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

def max(a,b)
  return a>b ? a : b
end
n,w=get_i
vw=array(n,1)
n.times do|i|
  vw[i]=get_i
end
vw.sort!{|x,y| x[1]<=>y[1]}
dp=array(w+1,n+1,0)
n.times do|i|
  for j in 0..w
    if j-vw[i][1]<0
      dp[i+1][j]=dp[i][j]
    else
      dp[i+1][j]=max(dp[i][j],dp[i][j-vw[i][1]]+vw[i][0])
    end
  end
end
puts dp[n][w]


Measured memory_bytes: 14764
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    int n = sc.nextInt();
    double sum = 0;
    double maker = 0;

    for(int i = 0 ; i < n ; i++){
        list.add(sc.nextDouble());
    }

    Collections.sort(list);
    maker = (list.get(0) + list.get(1) ) / 2;

    if(list.size() <= 2){
        System.out.println(maker);
    }else{
        for(int i = 2 ; i < n; i++){
            maker = (maker + list.get(i)) / 2;
        }
        System.out.println(maker);
    }
    






    
    
    







}
}

Measured memory_bytes: 37436
#include <iostream>

using namespace std;

int h[5][4][11];

int
main(int argc, const char *argv[])
{
    int n;
    int b, f, r, v;
    cin >> n;
    while (n--) {
        cin >> b >> f >> r >> v;
        h[b][f][r] += v;
    }
    for (int i = 1; i != 5; ++i) {
        if (i - 1) {
            for (int k = 1; k != 21; ++k) cout << '#';
            cout << endl;
        }
        for (int j = 1; j != 4; ++j) {
            for (int r = 1; r != 11; ++r) {
                cout << ' ' << h[i][j][r];
            }
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

int main(){
    int n;
    cin >> n;
    int x[n];
    int y[n];

    vector<int> index(n);
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        index[i] = i;
    }

    double all_length = 0;
    do{
        double length = 0;
        for(int i = 0; i < n-1; i++){
            double a = (x[index[i+1]]-x[index[i]])*(x[index[i+1]]-x[index[i]]);
            double b = (y[index[i+1]]-y[index[i]])*(y[index[i+1]]-y[index[i]]);
            length += sqrt(a+b);
        }
     
        all_length += length;
    }while(next_permutation(index.begin(), index.end()));


    double z = 1;

    for(int i = 1; i <= n; i++){
        z = z *(double) i;
    }


    printf("%.10f\n", all_length/z);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define int long long
signed main(){
    int n;
    cin >> n;
    vector<pair<int,pair<int,int> > >v(2*n);
    ll sm_x=0;
    ll sm_y = 0;
    for(int i=0;i<n;i++){
        int x,y;
        cin >> x >> y;
        v[2*i] =MP(x,MP(i,0));
        v[2*i+1] = MP(y,MP(i,1));
        sm_x += x;
        sm_y += y;
    }
    sort(v.begin(),v.end());
    vector<bool>p(n),q(n);
    ll ans = 0;
    for(int i=0;i<2*n;i++){
        if(i<n){
            ans += v[i].first;
            if(v[i].second.second==0){
                p[v[i].second.first] = 1;
                
            }else{
                q[v[i].second.first] = 1;
            }
        }else{
            bool flag = 0;
            for(int j=0;j<n;j++){
                if(p[j]&&q[j]){
                    flag = 1;
                }
            }
            if(flag)break;
            
            if(v[i].second.first!=v[i-1].second.first){
                ans += v[i].first;
                ans -=v[i-1].first;
            }else{
                int tmp = v[i].first - v[i-2].first;
                tmp = min(tmp,v[i+1].first-v[i-1].first);
                ans += tmp;
            }
            break;
            
        }
        
    }
    cout << min(ans,min(sm_x,sm_y)) << endl;
    return 0;
}

Measured memory_bytes: 4992
import sys
input = sys.stdin.readline

N = int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9+7

decided = [False for _ in range(N)]
H = [0 for _ in range(N)]

pre = -1
for i, t in enumerate(T):
    if t != pre:
        decided[i] = True
    H[i] = t
    pre = t

ok = True
pre = -1
for i in reversed(range(N)):
    a = A[i]
    if a != pre:
        if decided[i] and H[i] != a:
            ok = False
            break
        decided[i] = True
    elif decided[i]:
        if H[i] > a:
            ok = False
            break
    if not decided[i]:
        H[i] = min(H[i], a)
    pre = a

if ok:
    ans = 1
    for i in range(N):
        if not decided[i]:
            ans = ans * H[i] % mod
    print(ans)
else:
    print(0)

Measured memory_bytes: 19248
import sys
k=int(input())

now=1
cnt=1
mae=0
if k%2==0:
  print(-1)
  sys.exit()


for i in range(2*10**6):
  now=(10*mae+7)%k
  if now%k==0:
    print(i+1)
    sys.exit()
  else:
    mae=now%k

print(-1)
  


Measured memory_bytes: 9064
#include<cstdio>
#include<algorithm>
#define RI register int
#define CI const int&
using namespace std;
const int N=100005;
int n,a[N],m,v,p; long long sum[N];
inline bool cmp(CI x,CI y)
{
	return x>y;
}
int main()
{
	RI i; for (scanf("%d%d%d%d",&n,&m,&v,&p),i=1;i<=n;++i) scanf("%d",&a[i]);
	for (sort(a+1,a+n+1,cmp),i=1;i<=n;++i) sum[i]=sum[i-1]+a[i];
	for (i=p+1;i<=n;++i)
	{
		int dlt=max(0,v-(p+n-i)); long long tot=sum[i-1]-sum[p-1];
		if (a[i]+m<a[p]||1LL*(i-p)*(a[i]+m)+1-tot<=1LL*dlt*m) return printf("%d",i-1),0;
	}
	return printf("%d",n),0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define F(i, x, y) for (int i = (x); i <= (y); ++i)
#define Fr(i, x, y) for (int i = (x); i < (y); ++i)
using namespace std;
typedef long long ll;

const int N = 100 + 5; 

// dp[i][j][k]: 前 i 个，pick j, sum = k
 
int n, W, w[N], v[N];
ll dp[N][N][N * 3];
int main() {
	ios::sync_with_stdio(0);
	cin >> n >> W;
	for (int i = 1; i <= n; ++i) cin >> w[i] >> v[i];
	int basis = w[1];
	for (int i = 1; i <= n; ++i) w[i] -= basis;
	memset (dp, 0xf3, sizeof(dp));
	dp[0][0][0] = 0;
	for (int i = 1; i <= n; ++i) 
		for (int j = 0; j <= i; ++j) 
			for (int sum = 0; sum <= 3 * i; ++sum) {
				dp[i][j][sum] = max(dp[i - 1][j][sum], dp[i][j][sum - 1]);
				if (sum >= w[i] && j) dp[i][j][sum] = max(dp[i][j][sum], dp[i - 1][j - 1][sum - w[i]] + v[i]);
			}
				
	ll res = 0;
	for (int num = 0; num <= n; ++num) {
		if ((ll)num * basis > W) break;
		res = max(res, dp[n][num][min(W - num * basis, 3 * n)]);
	}
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 30728
#include <stdio.h>

main(void){

char s[4];

scanf("%s",&s);
int cnt=0;
for(int i=0;i<3;i++){

	if(s[i]==s[i+1]){
		cnt++;
	}
}
if(cnt>0){

	printf("Bad");
}else{
	printf("Good");
}
}

Measured memory_bytes: 128
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = new Array(N);
  for(var i = 0; i < N; i++){
    list[i] = nextIntArray();
  }
  for(var i = 0; i < N - 2; i++){
    var c1 = list[i][0] == list[i][1];
    var c2 = list[i + 1][0] == list[i + 1][1];
    var c3 = list[i + 2][0] == list[i + 2][1];
    if(c1 && c2 && c3){
      myout("Yes");
      return;
    }
  }
  myout("No");
}

Measured memory_bytes: 30168
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
  string s;
  cin >> s;
  cout << "2018/01/" << s[8] << s[9];
}


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


void solve(long long N){
    ll sum = 0;
    rep(i, N)
        sum += i;
    cout << sum << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main(int argc, char const *argv[])
{
	int a,b;

	cin >> a >> b;
	if(a == b){
		cout << "Draw" << endl;
	}
	else if(a==1){
		cout << "Alice" << endl;
	}
	else if(b==1){
		cout << "Bob" << endl;
	}
	else if(a > b){
		cout << "Alice" << endl;
	}
	else if(b > a){
		cout << "Bob" << endl; 
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<cmath>
#include<set>
#include<stack>
#include<cstdio>
#include<sstream>
#include<vector>
#include<bitset>
#include<algorithm>

using namespace std;
#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define gc(x)  scanf(" %c",&x);
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define ll long long
const ll mod =  998244353;
const int N = 1e5;
const int M = 2e6 + 1005;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(c != a){
        cout<<1;
    }
    else cout<<0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	long long int a,b,c,k;
	scanf("%lld %lld %lld %lld",&a,&b,&c,&k);
	if(k<=a){
		printf("%lld",k);
	}else if(k<=a+b){
		printf("%lld",a);
	}else{
		printf("%lld",a-(k-a-b));
	}
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
       int N, K;
       cin >> N >> K;
        vector<int> vec(N);
       rep(i, K) {
           int d;
           cin >> d;
           rep(j, d) {
               int t;
               cin >> t;
               vec.at(t - 1)--;
           }
       }

        int cnt = 0;
       for(auto n : vec) {
           if(n == 0) cnt++;
       }

       cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using ld = long double;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
const long double pi = (acos(-1));
#define pb push_back

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる

//ここから
int main(){
    ll N;
    cin>>N;
    vl even(N/2);
    vl A(N);
    rep(i,N){
        cin>>A[i];
        if(i%2==1){
            even[i/2]=A[i];
        }
    }
    sort(all(even));
    sort(all(A));
    even.pb(-1);
    ll E=0;
    ll Ans=0;
    rep(i,N){
        if(A[i]==even[E]){
            E++;
            if(i%2==0){
                Ans++;
            }
        }
    }
    cout<<Ans<<endl;
}


Measured memory_bytes: 1920
let modulo = 1000000007
let (+@) a b = (a+b) mod modulo
let ( *@ ) a b = (a*b) mod modulo
let rec (^@) a n =
  if n = 0 then 1
  else if n mod 2 = 1 then a *@ (a ^@ (n-1))
  else let h = a ^@ (n/2) in h *@ h

let arr_of_str s = Array.init (String.length s) (fun i -> s.[i])

let idx = function 'A' -> 0 | 'B' -> 1 | 'C' -> 2 | _ -> 3

let () =
  Scanf.scanf "%s" @@ fun s ->
  let n = String.length s in
  let s = Array.map idx @@ arr_of_str s in

  let sl = Array.init 4 (fun _ -> Array.make n 0) in
  let sr = Array.init 4 (fun _ -> Array.make n 0) in

  Array.iteri (fun i v -> sl.(v).(i) <- 1; sr.(v).(i) <- 1) s;
  Array.iter (fun a -> for i = 1 to n-1 do a.(i) <- a.(i) + a.(i-1) done) sl;
  Array.iter (fun a -> for i = n-2 downto 0 do a.(i) <- a.(i) + a.(i+1) done) sr;

  s |> Array.mapi (fun i c ->
    if c mod 2 = 1 && i mod (n-1) <> 0 then begin
      let la = sl.(0).(i-1) in
      let lq = sl.(3).(i-1) in
      let rc = sr.(2).(i+1) in
      let rq = sr.(3).(i+1) in
      let vl = ((3 ^@ lq) *@ la +@ (3 ^@ (lq-1)) *@ lq) in
      let vr = ((3 ^@ rq) *@ rc +@ (3 ^@ (rq-1)) *@ rq) in
      (vl*vr)
    end else 0)
  |> Array.fold_left (+@) 0 |> Printf.printf "%d\n"

Measured memory_bytes: 9088
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,k,s=1;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
    	if(k>s)s+=s;
    	else s+=k;
    }
    cout<<s<<endl;
    return 0;
}

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

if n == 0
  if a[0] == 1
    puts 1
  else
    puts -1
  end
  exit
end

if a[0] != 0
  puts -1
  exit
end

# x = [1]
# result = 1
# 1.upto(n-1) do |i|
#   nodes = a[i] + (a[i+1]+1) /2
#   if nodes > 2 * (x[i-1] - a[i-1])
#     puts -1
#     exit
#   end
#   x.push(nodes)
#   result += nodes
# end
# 
# if a[n] > 2 * (x[n-1] - a[n-1])
#   puts -1
#   exit
# end
# 
# result += a[n]
# puts result

max = 2**n
if a[n] > max
  puts -1
  exit
end

x = Array.new(n+1)
x[n] = a[n]
x[0] = 1

(n-1).downto(1) do |i|
  max = max / 2
  _max = max - (a[i-1] * 2)
  if a[i] == 0
    if x[i+1] < _max
      x[i] = x[i+1]
      next
    else
      x[i] = _max
    end
  elsif a[i] + x[i+1] > _max
    if a[i] > _max
      puts -1
      exit
    end
    x[i] = _max
  else
    x[i] = x[i+1] + a[i]
  end
end

warn x.inspect
result = 1
1.upto(n-1) do |i|
  if x[i] > (x[i-1] - a[i-1]) * 2
    x[i] = (x[i-1] - a[i-1]) * 2
  end
  result += x[i]
end

if x[n] > (x[n-1] - a[n-1]) * 2
  puts -1
  exit
end
result += x[n]
warn x.inspect
puts result

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

#define FOR(i, a, b) for (int i = (a); i < static_cast<int>(b); i++)
#define FORR(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) FOR (i, 0, n)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
template <typename T>
void print(const vector<vector<T>> matrix);
template <typename T>
void print(const vector<T> vec);
template <typename Arg>
void print(const Arg arg);
template <typename Head, typename... Args>
void print(const Head head, const Args... args);
template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
using ll = long long;

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

    int n, k;
    cin >> n >> k;
    vector<ll> vec(n);
    rep (i, n)
        cin >> vec[i];

    vector<ll> sum;
    sum.pb(0);
    rep (i, n)
        sum.pb(sum[sum.size() - 1] + vec[i]);

    vector<ll> li;
    rep (i, n)
        FOR (j, i + 1, n + 1)
            li.pb(sum[j] - sum[i]);
    sort(all(li), greater<ll>());

    vector<vector<int>> table(li.size(), vector<int>(42));

    rep (i, li.size()) {
        ll n = li[i];
        for (int j = 41; j >= 0; j--) {
            ll div = 1LL << j;
            if (n >= div) {
                table[i][j] = 1;
                n -= div;
            } else
                table[i][j] = 0;
        }
    }

    vector<int> stock;
    for (int i = 0; i < li.size(); i++) {
        stock.pb(i);
    }

    for (int i = 41; i >= 0; i--) {
        vector<int> next_stock;
        repall (j, stock)
            if (table[j][i] == 1) next_stock.pb(j);

        if (next_stock.size() >= k) {
            stock = next_stock;
        }
    }

    ll ans = 0;
    rep (i, k) {
        if (i == 0)
            ans = li[stock[i]];
        else
            ans &= li[stock[i]];
    }
    print(ans);

    return 0;
}

//---------------------------------------------
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}


Measured memory_bytes: 106104
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

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

	bool judge = false;
	if (A == B && A != C) {
		judge = true;
	}
	if (A == C && A != B) {
		judge = true;
	}
	if (B == C && A != B) {
		judge = true;
	}

	if (judge) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
} 

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep2(i, m, n) for (int i = m; i < n; ++i)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// vvi data(n, vi(m));
using vll = vector<long long>;
using vvll = vector<vll>;

long long pow(int x, int y) {
  int res = 1;
  rep(i, y) {
    res *= x;
  }
  return res;
}

int main() {
  int n, a;
  cin >> n >> a;
  cout << n * n - a << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target ("avx")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(10)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int calcScore(vector<int> &plan, vector<int> &c, vector<vector<int>> &s) {
	int D = 365;
	int score = 0;
	vector<int> last(26, -1);
	for (int i = 0; i < D; i++) {
		score += s[i][plan[i]];
		last[plan[i]] = i;
		for (int j = 0; j < 26; j++) {
			score -= c[j] * (i - last[j]);
		}
	}
	return score;
}

int main() {
	int D;
	cin >> D;
	vector<int> c(26);
	for (int i = 0; i < 26; i++)cin >> c[i];
	vector<vector<int>> s(365,vector<int>(26,0));
	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++)cin >> s[i][j];
	}
	
	vector<int> plan(365, 0);
	for (int i = 0; i < 365; i++) {
		int mi = 0, m = -1;
		for (int j = 0; j < 26; j++) {
			if (m < s[i][j]) {
				mi = j;
				m = s[i][j];
			}
			plan[i] = j;
		}
	}
	int sc = calcScore(plan, c, s);

	for (int n = 0; n < 200000; n++) {
		if (rand() % 10 < 3) {
			int i = rand() % 365, j = rand() % 26, old = plan[i];
			plan[i] = j;
			int nsc = calcScore(plan, c, s);
			if (nsc > sc) {
				sc = nsc;
			}
			else {
				plan[i] = old;
			}
		}
		else {
			int k = rand() % 5;
			int i = rand() % (365 - k), j = i + k;
			swap(plan[i], plan[j]);
			int nsc = calcScore(plan, c, s);
			if (nsc > sc) {
				sc = nsc;
			}
			else {
				swap(plan[i], plan[j]);
			}
		}
	}

	for (int i = 0; i < 365; i++) {
		cout << plan[i] + 1 << endl;
	}
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define simplify ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;


int32_t main() {

    simplify
    int t;
    cin>>t;
    map<string,int>mp;
    while(t--){
        string s;
        cin>>s;
        mp[s]++;
    }

    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;


    

    return 0;
}



Measured memory_bytes: 3664
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
const long double pie = 3.141592653589793238;
//
//
                void solve(){
                        ll n;
                        cin>>n;
                        vector<ll> store(n+1,0);
                        rep(i,0,n-1){
                                ll x;
                                cin>>x;
                                store[x]++;
                        }
                        for(int i=1; i<=n;i++)
                                cout<<store[i]<<" ";
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //cout<<"Case #"<<i<<": ";
                                solve();
                         }
        return 0; 
}         
 

Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
#define int long long
long long x;
map<int,int> pw5;
signed main() {
	cin >> x;
	for(int i = 0;i <= 1000;++i)
		pw5[i*i*i*i*i] = i;
	for(int i = 0;i <= 1000;++i)
		if(pw5[abs(i*i*i*i*i-x)]) {
			cout << i << ' ' << pw5[abs(i*i*i*i*i-x)] * (i*i*i*i*i < x ? -1 : 1) << endl;
			return 0;
		} 
	return 0;
}


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

int main(){
      int n;cin >> n;
      double ans = 0;
      for(int i = 0;i < n;i++){
            int t;cin >> t;
            ans += 1.0 / t;
      }
      printf("%.6f", 1.0 / ans);
}

Measured memory_bytes: 256
let inf = max_int
let rec for_fold a b f v = if a >= b then v else for_fold (a+1) b f (f v a)
let for_fold_min a b f = for_fold a b (fun x y -> min x (f y)) inf

let () =
  Scanf.scanf "%d %d" @@ fun n k ->
  let c = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun x y -> x, y)) in
  Array.sort compare c;

  let xs = Array.map fst c in Array.sort (-) xs;
  let ys = Array.map snd c in Array.sort (-) ys;

  for_fold_min 0 n (fun i ->
    let ly = ys.(i) in
    for_fold_min i n (fun j ->
      let uy = ys.(j) in
      for_fold_min 0 n (fun h ->
        let lx = xs.(h) in

        let m, ux = Array.fold_left (fun (s, tx) (x, y) ->
          if ly <= y && y <= uy && lx <= x then
            (s+1, if s < k then x else tx)
          else
            (s, tx)) (0, -1) c
        in

        if m >= k then
          ((ux-lx)*(uy-ly))
        else
          inf)))
  |> Printf.printf "%d\n"



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

int main(){
	int c[3][3];
	cin >> c[0][0] >> c[0][1] >> c[0][2];
	cin >> c[1][0] >> c[1][1] >> c[1][2];
	cin >> c[2][0] >> c[2][1] >> c[2][2];
	int maxi=0;
	for(int i=0;i<3;i++) for(int j=0;j<3;j++) maxi =max(maxi,c[i][j]);
	int a[3];
	int b[3];
	int row1 = c[0][0] + c[0][1] + c[0][2];
	int row2 = c[1][0] + c[1][1] + c[1][2];
	int row3 = c[2][0] + c[2][1] + c[2][2];
	
	int col1 = c[0][0] + c[1][0] + c[2][0];
	int col2 = c[0][1] + c[1][1] + c[2][1];
	int col3 = c[0][2] + c[1][2] + c[2][2];
	
	for(a[0] = 0;a[0]<=maxi;a[0]++){
		for(b[0]=0;b[0]<=maxi;b[0]++){
			a[1] = a[0]-(row1-row2)/3;
			a[2] = a[0]-(row1-row3)/3;
			b[1] = b[0]-(col1-col2)/3;
			b[2] = b[0]-(col1-col3)/3;
			if(a[1]<0 || a[2]<0 || b[1]<0 || b[2]<0) continue;
			//cout << endl;
			//cout << a[0] << " " << a[1] << " " << a[2] << endl;
			//cout << b[0] << " " << b[1] << " " << b[2] << endl;
			for(int k=0;k<3;k++){
				for(int r=0;r<3;r++){
					if(c[k][r] != a[k]+b[r]) goto stop; 
					}
				}
			cout<<"Yes";
			return 0;
			stop: continue;
		}
	}
	cout << "No";
	
	
	
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int n,a[101],i,j,m;
  scanf("%d",&n);
  for(i=0; i<n; i++) scanf("%d",&a[i]);
  int cnt=0;
  for(i=0; i<n; i++) {
    m=i;
    for(j=i+1; j<n; j++) {
      if(a[j]<a[m]) m=j;
    }
    if(a[i]>a[m]) {
      int tmp=a[i];
      a[i]=a[m];
      a[m]=tmp;
      cnt++;
    }
  }
  for(i=0; i<n; i++) {
    if(i) printf(" ");
    printf("%d",a[i]);
  }
  printf("\n%d\n",cnt);
  return 0;
}



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

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define ALL(v) v.begin(), v.end()

int N, D;
vvi X;

int main() {
    cin >> N >> D;
    REP (i, N) {
        X.PB(vi(D));
        REP (d, D) cin >> X[i][d];
    }

    int ans = 0;
    REP (i, N) FOR (j, i+1, N) {
        ll sum = 0;
        REP (d, D) {
            ll x = X[i][d] - X[j][d];
            sum += x*x;
        }
        ll k = 0;
        while (k*k < sum) k++;
        if (k*k == sum) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int X,Y,AX,AY;cin >> X>>Y>>AX>>AY;
    for(int a = 0;a < AY-Y;a++)cout<<"U";
    for(int a = 0;a < AX-X;a++)cout<<"R";
    for(int a = 0;a < AY-Y;a++)cout<<"D";
    for(int a = 0;a < AX-X;a++)cout<<"L";
    cout<<"L";
    for(int a = 0;a < AY-Y+1;a++)cout<<"U";
    for(int a = 0;a < AX-X+1;a++)cout<<"R";
    cout<<"D";
    cout<<"R";
    for(int a = 0;a < AY-Y+1;a++)cout<<"D";
    for(int a = 0;a < AX-X+1;a++)cout<<"L";
    cout<<"U";
    cout<<flush;
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize(\"Ofast,no-stack-protector\")
//#pragma GCC target(\"sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx\")
//#pragma GCC target(\"avx,tune=native\")
// Neil

#include<bits/stdc++.h>

using namespace std;

typedef complex<double> base;
typedef long double ld;
typedef long long ll;

#define endl "\n"
#define pb push_back
#define pii pair<int,int>
#define pll pair< ll , ll >
#define vi vector<int>
#define vvi vector< vi >
const int MAXN=(int)(2e5+5);
const ll MOD=(ll)(1e9+7);
int t;
ll arr[100];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n, a;
    cin>>n>>a;
    int nx = n*a;
    ll dp[n+1][2*nx+1];
    for(int i=0;i<n;i++){
        cin>>arr[i];
        arr[i]-=a;
    }
    memset(dp, 0, sizeof(dp));
    dp[0][nx]=1ll;
    for(int i=1;i<=n;i++){
        //cout<<i<<endl;
        for(int j=0;j<=2*nx;j++){
            //cout<<j<<endl;
            dp[i][j] = dp[i-1][j];
            if((j-arr[i-1])>=0 and (j-arr[i-1])<=2*nx)
                dp[i][j] += dp[i-1][j-arr[i-1]];
        }
    }
    cout<<dp[n][nx] - 1ll<<endl;
    return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
#define ff          first
#define ss          second
#define ll         	long long int
#define pb          push_back
#define ar 			array
#define mp 			make_pair
#define f(i,n)   	for(ll i =0;i<n;i++)
#define inf 		INT_MAX
#define pll 		pair<ll,ll>
const ll INF = 1e18;
void init(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE 
		freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#endif
}

bool checkp2(ll n){
	return n && (n-1);
}

ll power(ll x , ll n){
	ll po = 1;
	while(n){
		if(n & 1){
			po *= x;
		}
		n = n>>1;
		x = x * x;
	}
	return po;
}

bool isPrime(ll x){
	if(x < 2)
		return 0;
	for(ll y = 2; y * y <= x; y++){
		if(x % y == 0){
			return 0;
		}
	}
	return true;
}
void solve(){

	ll N;
	cin>>N;
	vector<ll> vec(N+1 , 0);

	for(ll x = 1; x<=100; x++){
		for(ll y = 1; y<=100; y++){
			for(ll z = 1; z<=100; z++){
				ll kk = (x+y)*(x+y) + (y+z)*(y+z) + (x+z)*(x+z);
				kk = kk /2;
				if(kk <= N){
					vec[kk]++;
				}
			}
		}
	}

	for(ll i = 1;i<=N;i++){
		cout<<vec[i]<<endl;
	}

	
}
int main(){
	
	init();
	ll t = 1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}

}

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

int main(){
  string S;
  cin >> S;
  
  int zero = 0, one = 0;
  for(int i = 0;i < S.size();i++){
    if(S.at(i) == '0') zero++;
    if(S.at(i) == '1') one++;
  }
  
  cout << min(zero, one) * 2 << endl;
  
  return 0;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main() {
    int n;cin >> n;
    vector<int> p(n);
    rep(i,n)cin >> p[i];
    int ans = 0;
    for(int i=0;i<=n-2-1;i++){
        if(max({p[i],p[i+1],p[i+2]}) != p[i+1] &&
            min({p[i],p[i+1],p[i+2]}) != p[i+1])
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <cmath>		// circle math ( sin, con, sinh
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep3(i, a, n) for(int i = (int)(a); i < (int)(n); i++)
#define ll long long

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






int main() {
  string s,t; // 変数の宣言
  cin >> s>>t; // 標準入力
  int n=s.length();
  int m=t.length();
  int dp[n+1][m+1]={};

  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      if(s[i]==t[j]){
	dp[i+1][j+1]=dp[i][j] + 1;
      }
      else{
	dp[i+1][j+1]=max(dp[i+1][j], dp[i][j+1]);
      }
    }
  }

  //make the string
  string result ="";

  while(n>0 && m>0){
    if(dp[n][m]==dp[n-1][m]){
      n--;
      continue;
    }
    if(dp[n][m]==dp[n][m-1]){
      m--;
      continue;
    }
    result= s[n-1]+result;
    n--;
    m--;
  }


  
  cout << result << endl; // 標準出力
}


Measured memory_bytes: 38652
N = int(input())
W = list(map(int,input().split()))

S1 = 0
S = sum(W)
absmin = S

for i in range(N):
    S1 += W[i]
    if(abs(S-2*S1) < absmin):
        absmin = abs(S-2*S1)
   
print(absmin)

Measured memory_bytes: 38256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
const int M=100010;
using ll=long long;

int main(){
	string s;
	int n,x;cin>>n>>x;
	ll ans=0,pre=0;
	int a;
	rep(i,n){
		cin>>a;
		if(a+pre<=x)pre=a;
		else{
			ans+=a+pre-x;
			pre=x-pre;
		}
	}
	cout<<ans<<endl;
}

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

const ll MOD=1000000007;

ll abs1(ll a){
  if(a>=0)return a;
  else return -a;
}

ll gcd1(ll a,ll b){
  if(a==0 && b==0)return 0;
  ll n;
  while(a%b!=0){
    n=a%b;
    a=b;
    b=n;
  }
  return b;
}

ll solveLinear(ll n,ll m,ll c){
  if(n==0 && m==0)return 0;
  ll a[100],b[100];
  a[0]=n;b[0]=m;
  int i=1;
  while(b[i-1]!=0){
    a[i]=b[i-1];
    b[i]=a[i-1]%b[i-1];
    i++;
  }
  n=i;
  if(c%a[n-1]!=0){
    return 0;
  }
  ll x=c/a[n-1],y=0;
  for(i=1;i<n;i++){
    ll cnt=x;
    x=y;
    y=cnt-(a[n-i-1]/b[n-i-1])*y;
  }
  return x;
}

ll modRev(ll a,ll p){
  ll n=solveLinear(a,p,1);
  n=n%p;
  if(n<0)return n+p;
  return n;
}

int main(){
  int i,j,k,l,cnt=0;
  int n;
  cin>>n;
  int f[n+1][6][3];
  for(i=1;i<=n;i++){
    for(j=1;j<=5;j++){
      for(k=1;k<=2;k++){
        cin>>f[i][j][k];
      }
    }
  }
  int ma=-MOD;
  int p[n+1][11],c[n+1];
  for(i=1;i<=n;i++)for(j=0;j<=10;j++)cin>>p[i][j];
  int q[6][3];
  for(i=1;i<=1023;i++){
    cnt=0;
    for(j=0;j<5;j++){
      for(k=0;k<=1;k++){
        q[j+1][k+1]=(i/(int)round(pow(2,j+5*k)))%2;
      }
    }
    for(j=1;j<=n;j++)c[j]=0;
    for(l=1;l<=n;l++){
      for(j=1;j<=5;j++){
        for(k=1;k<=2;k++){
          if(f[l][j][k]==1 && q[j][k]==1)c[l]++;
        }
      }
    }
    for(j=1;j<=n;j++)cnt+=p[j][c[j]];
    ma=max(ma,cnt);
  }
  cout<<ma<<endl;
}

Measured memory_bytes: 256
// Dmitry _kun_ Sayutin (2019)

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::tuple;
using std::make_tuple;
using std::get;

using std::min;
using std::abs;
using std::max;
using std::swap;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    // code here
    int a, b, c;
    cin >> a >> b >> c;

    cout << (a == b and b == c ? "Yes\n" : "No\n");
    
    return 0;
}


Measured memory_bytes: 256