akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long int
mt19937 rng(std::chrono::duration_cast<std::chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=10000005;
#define M 1000000007
#define double long double
#define BINF 10000000000000
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
#define deb(x) cout << #x << " " << x << "\n";
const int LG = 22;



#undef int 
int main() {
#define int long long int
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0);
 


    char c;
    cin >> c;
    c++;
    cout << c;

    
return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a==b&&b==c?1:a==b||b==c||a==c?2:3)<<endl;
    
    return 0;
}



Measured memory_bytes: 256
//#include<studio.h>
#include<iostream>

using namespace std;
int main()
{
	int a, b;
	//scanf("%d %d", &a, &b);
	cin >> a >> b;
	int mense = a*b;int nagasa = 2 * (a + b);
//	printf("%d %d", &mense, &nagasa);
	cout << mense << " "<<nagasa<<endl;
	return 0;
}

Measured memory_bytes: 3088
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}
void flagfunc3(bool flag){cout<<(flag?"Yes\n":"No\n");}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  int a,b,cnt=0,res=0;
  rep(i,n){
    cin>>a>>b;
    if(a==b){
      cnt++;
    }else{
      cnt=0;
    }
    chmax(res,cnt);
  }
  flagfunc3(res>=3);
}


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

int main(){
    int A,B;
    cin>>A>>B;
    int ans=0;
    if((A>=1&&A<=9)&&(B>=1&&B<=9)){
        ans=A*B;
    }
    else{
        ans=-1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
import math
from functools import reduce
from operator import mul
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, sys.stdin.readline().split(' ')))
def In(): return int(sys.stdin.readline())
def InS(): return sys.stdin.readline()

N = InS()
if '7' in N:
    print('Yes')
else:
    print('No')


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

using namespace std;

const int INF = 10000000;
int RestTime[10][2], CarId[10][2], M, N, CurrentTime, RestNumberOfCars;
int CarStoppingTime[100];
queue<int> CarData;


int findParkingPosition(int currentTime){
	int pos, diff, tm;

	for (int i = 0; i < M; i++){
		if (RestTime[i][0] == 0 && RestTime[i][1] == 0) {
			return i;
		}
	}
	pos = -1;
	diff = INF;
	for (int i = 0; i < M; i++) {
		if (RestTime[i][0] != 0 && RestTime[i][1] != 0) {
			continue;
		}
		tm = (RestTime[i][0] == 0 ? RestTime[i][1] : RestTime[i][0]);
		if (tm > currentTime && (tm - currentTime) < diff) {
			diff = tm - currentTime;
			pos = i;
		}
	}
	if (pos != -1) {
		return pos;
	}

	for (int i = 0; i < M; i++){
		if (RestTime[i][0] != 0 && RestTime[i][1] != 0) {
			continue;
		}
		int tm = (RestTime[i][0] == 0 ? RestTime[i][1] : RestTime[i][0]);
		if (tm < currentTime && (currentTime - tm) < diff){
			diff = currentTime - tm;
			pos = i;
		}
	}
	return pos;
}

void Parking(int pos, int stoppingTime, int carId)
{
	if (RestTime[pos][0] != 0){
		RestTime[pos][1] = RestTime[pos][0];
		CarId[pos][1] = CarId[pos][0];
	}
	RestTime[pos][0] = stoppingTime;
	CarId[pos][0] = carId;
}

void checkLeaving(){
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < 2; j++) {
			if (j == 1 && RestTime[i][0] != 0) {
				break;
			}
			if (RestTime[i][j] == 0) {
				continue;
			}

			if (CurrentTime >= RestTime[i][j]) {
				cout << CarId[i][j] + 1;
				if (RestNumberOfCars != 1) {
					cout << " ";
				}
				RestTime[i][j] = 0;
				CarId[i][j] = 0;
				--RestNumberOfCars;
			}
		}
	}
}

int main(){
	int cnt, nowId, pos;
	
	while (cin >> M >> N, M) {
		for (int i = 0; i < N; i++) {
			cin >> CarStoppingTime[i];
		}
		memset(RestTime, 0, sizeof(RestTime));
		memset(CarId, 0, sizeof(CarId));

		cnt = 0;
		RestNumberOfCars = N;
		CurrentTime = 0;
		while (RestNumberOfCars > 0) {
			checkLeaving();
			if (cnt < N && CurrentTime % 10 == 0) {
				CarData.push(cnt++);
			}
			while (!CarData.empty())
			{
				nowId = CarData.front();
				pos = findParkingPosition(CurrentTime + CarStoppingTime[nowId]);
				if (pos == -1) {
					break;
				}
				Parking(pos, CurrentTime + CarStoppingTime[nowId], nowId);
				CarData.pop();
			}
			++CurrentTime;
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int a,b,k,ans;
    cin>>a>>b;
    if(a==b)
        return cout<<0<<endl,0;
    k = (b*b)-(a*a);
    k/=2*(b-a);

    if(abs(a-k)==abs(b-k))
        return cout<<k<<endl,0;
    else return cout<<"IMPOSSIBLE"<<endl,0;

    return 0;
}



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

int deg[10];
int occ[10];

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

	for (int i = 0; i < 6; ++i) {
		int x;
		cin >> x;
		++deg[x];
	}
	for (int i = 0; i < 10; ++i)
		++occ[deg[i]];

	cout << (occ[1] == 2 ? "YES" : "NO");
	return 0;
}


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

using namespace std;
typedef long long ll;

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

  string s;cin>>s;
  int len=s.length();
  int l=-1,r=-1;
  //bool flag=false;
  for(int i=0;i<len-1;i++){
      if(s[i]==s[i+1]) {l=i+1;r=l+1;}
  }
  for(int i=0;i<len-2;i++){
      if(s[i]==s[i+2]) {l=i+1;r=l+2;}
  }
  cout<<l<<" "<<r<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, X;
    cin >> N >> X;

    vector<int> L(N);

    // 数直線上を N+1 回跳ねるボールがあり、1 回目は 座標 D1=0, i 回目は 座標 Di=Di−1+Li−1(2≤i≤N+1) で跳ねます。
    for (int i = 0; i < N; ++i)
    {
        cin >> L[i];
    }

    int ball = 0;
    int cnt = 1;
    for (int i = 0; i < N; ++i)
    {
        ball += L[i];
        if(ball <= X){
            cnt++;
        }else{
            break;
        }
    }

    cout << cnt;

    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> X(N);
  vector<int> C(N);
  for(int i=0;i<N;i++){
    cin >> X[i];
  }
  for(int i=0;i<N;i++){
    cin >> C[i];
  }

  vector<int> S(N);
  for(int i=0;i<N;i++){
    S[i] = X[i] - C[i];
  }

  int sum = 0;
  for(int i=0;i<N;i++){
    if(S[i] > 0){
      sum += S[i];
    }
  }

  cout << sum << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <bitset>

typedef long long ll;
const int maxn = 400;
const ll mo = 1e9 + 7;

int n, a[maxn], b[maxn];
ll p[maxn][maxn / 3 + 1], cnt[maxn][maxn], dp[maxn][maxn][maxn / 3 + 1];
std::bitset<maxn> ina[maxn], inb[maxn];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
	}
	for(int i = 1; i <= n; ++i) {
		scanf("%d", b + i);
	}
	for(int i = 1; i <= n; ++i) {
		ina[i] = ina[i - 1];
		ina[i].set(a[i]);
	}
	for(int i = 1; i <= n; ++i) {
		inb[i] = inb[i - 1];
		inb[i].set(b[i]);
	}
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= n; ++j) {
			if(!ina[i][b[j]] && !inb[j][a[i]]) {
				cnt[i][j] = (ina[i] | inb[j]).count();
			}
			// fprintf(stderr, "%d %d %lld\n", i, j, cnt[i][j]);
		}
	}
	p[0][0] = 1;
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= n / 3; ++j) {
			p[i][j] = p[i - 1][j - 1] + p[i - 1][j] * (ll)(3ll * j - (i - 1ll)) % mo;
			p[i][j] %= mo;
		}
	}
	dp[0][0][0] = 1;
	for(int i = 0; i <= n; ++i) {
		for(int j = 0; j <= n; ++j) {
			if(!i && !j) {
				continue;
			}
			for(int k = 0; k <= n / 3; ++k) {
				dp[i][j][k] = ((i ? dp[i - 1][j][k] : 0) + (j ? dp[i][j - 1][k] : 0)
					+ (i && j ? mo - dp[i - 1][j - 1][k] : 0)) % mo;
				if(i && j && k && cnt[i][j]) {
					ll t = n - (n / 3ll - k) * 3ll - cnt[i][j];
					dp[i][j][k] += dp[i - 1][j - 1][k - 1] * t % mo;
					dp[i][j][k] %= mo;
				}
				// fprintf(stderr, "%d %d %d %lld\n", i, j, k, dp[i][j][k]);
			}
		}
	}
	// fprintf(stderr, "%lld\n", p[n][n / 3]);
	printf("%lld\n", dp[n][n][n / 3] * p[n][n / 3] % mo);
	return 0;
}


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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

struct mint {
    long long x;
    mint(long long 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 {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(long long 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 {
        mint res(*this);
        return res/=a;
    }
};

vector<ll> ff{1,2,3,5,8,13,21};
mint f(ll n){
    return mint(ff[n]);
}

int main(void){
    ll H,W,K; cin >> H >> W >> K;
    mint dp[H+1][W]; REP(i,H+1)REP(j,W) dp[i][j] = 0;
    dp[0][0] = 1;
    REP(i,H){
        REP(j,W-1){
            ll n1 = max(0,j-1), n2 = max((ll)0,W-1-(j+2));
            dp[i+1][j] += dp[i][j+1]*f(n1)*f(n2);
        }
        REP(j,W){
            ll n1 = max(0,j-1), n2 = max((ll)0,W-1-(j+1));
            dp[i+1][j] += dp[i][j]*f(n1)*f(n2);
        }
        REP(j,W-1){
            ll n1 = max(0,j-1), n2 = max((ll)0,W-1-(j+2));
            dp[i+1][j+1] += dp[i][j]*f(n1)*f(n2);
        }
    }
    cout << dp[H][K-1].x << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using ll=long long;
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> a(3*100000);

    for(int i=0;i<3*n;++i)
    {
        scanf("%d",&a[i]);
    }
    sort(a.begin(),a.end(),greater<int>());

    ll ans=0LL;
    for(int i=1;i<2*n;i+=2)
    {
        ans+=a[i];
    }

    cout<<ans<<"\n";


}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define dub long double
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
#define ROF(i, b, a) for (int i=(b); i>(a); --i)
#define CASET int _T; cin >> _T; FOR(caset, 0, _T)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vvi vector<vi>
#define vvb vector<vb>
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define mii map<int,int>
#define vpii vector<pii>
#define vt3i vector<t3i>
#define sq(x) (x)*(x)
#define inv(x) powa(x, MOD-2)
 
long long INF = 1LL<<60;
long long MOD = 1e9+7;
 
template <typename A, typename B> istream &operator>>(istream &is, pair<A, B> &pr) {is >> pr.first >> pr.second; return is;}
template <typename A> istream &operator>>(istream &is, vector<A> &v) {for (auto &x : v) is >> x; return is;}
ostream &operator<<(ostream &os, char &c) {os << (char)c; return os;}
ostream &operator<<(ostream &os, const char s[]) {os << (string)s; return os;}
ostream &operator<<(ostream &os, string &s) {for (char &c : s) os << (char)c; return os;}
template <typename A, typename B> ostream &operator<<(ostream &os, pair<A, B> &pr) {os << '(' << pr.first << ", " << pr.second << ')'; return os;}
ostream &operator<<(ostream &os, vb &v) {
    bool first = true;
    os << '[';
    for (const bool &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
template <class C> ostream &operator<<(ostream &os, C &v) {
    bool first = true;
    os << '[';
    for (auto &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}
bool mini(int &a, int b) { return b < a ? a = b, 1 : 0; }
bool maxi(int &a, int b) { return b > a ? a = b, 1 : 0; }

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

    vi temp(4);
    cin >> temp;
    int n;
    cin >> n;
    vt3i circles(n);
    FOR(i, 0, n) {
        int a, b, c;
        cin >> a >> b >> c;
        circles[i] = make_tuple(a, b, c);
    }
    circles.emplace_back(temp[0], temp[1], 0);
    circles.emplace_back(temp[2], temp[3], 0);
    n += 2;

    vector<vector<dub>> dist(n, vector<dub>(n));
    FOR(i, 0, n) FOR(j, 0, n) {
        int dx = get<0>(circles[i]) - get<0>(circles[j]);
        int dy = get<1>(circles[i]) - get<1>(circles[j]);
        dist[i][j] = dist[j][i] = max(0.0L, sqrtl(dx*dx + dy*dy) - get<2>(circles[i]) - get<2>(circles[j]));
    }

    priority_queue<pair<dub, int>> q;
    q.emplace(0, n-2);
    vector<dub> shortest(n, INF);
    shortest[n-2] = 0;
    vb seen(n);
    while (q.size()) {
        int cur = q.top().second;
        q.pop();
        if (seen[cur]) continue;
        seen[cur] = true;

        FOR(i, 0, n) {
            dub alt = shortest[cur] + dist[cur][i];
            if (alt < shortest[i]) {
                shortest[i] = alt;
                q.emplace(-alt, i);
            }
        }
    }
    cout << setprecision(10) << shortest.back();
}

Measured memory_bytes: 26092
Imports System.Collections.Generic
Public Class Program
  Shared Sub Main()
    Dim nm() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine().Split(" "), AddressOf Integer.Parse)
    Dim n As Integer = nm(0)
    Dim m As Integer = nm(1)
    Dim all As Integer() = Nothing
    For i As Integer = 0 To n - 1
      Dim ka() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine().Split(" "), AddressOf Integer.Parse)
      Dim k As Integer = ka(0)
      Dim a(0 To k - 1) As Integer
      Array.Copy(ka, 1, a, 0, k)
      If i = 0 Then
        all = a
      Else
        all = Array.FindAll(Of Integer)(all, AddressOf DirectCast(a, IList(Of Integer)).Contains)
      End If
    Next
    Console.WriteLine(all.Length())
  End Sub
End Class

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline LL Read()
{
	LL x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 2205;

int n, ans, p_cnt, p[MAXN];
map <LL, bool> b;
map <LL, int> a;
bool v[MAXN];

inline void Init(int n)
{
	for (int i = 2; i <= n; i ++)
	{
		if (!v[i])
			p[++ p_cnt] = i;
		for (int j = 1; i * p[j] <= n; j ++)
		{
			v[i * p[j]] = 1;
			if (i % p[j] == 0)
				break;
		}
	}
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	Init(2200);
	n = Read();
	for (int i = 1; i <= n; i ++)
	{
		LL x = Read();
		for (int j = 1; 1LL * p[j] * p[j] * p[j] <= x; j ++)
			while (x % (1LL * p[j] * p[j] * p[j]) == 0)
				x /= 1LL * p[j] * p[j] * p[j];
		a[x] ++;
	}
	if (a.find(1) != a.end())
		a.erase(1), ans = 1;
	for (auto i : a)
	{
		LL x = i.xx, y = 1, z;
		if (b[x])
			continue;
		for (int j = 1; 1LL * p[j] * p[j] * p[j] <= x; j ++)
			if (x % p[j] == 0)
			{
				if (x % (p[j] * p[j]) == 0)
					x /= p[j] * p[j], y *= p[j];
				else
					x /= p[j], y *= p[j] * p[j];
			}
		z = sqrt(x);
		if (z * z == x)
			y *= z;
		else
			y *= x * x;
		if (a.find(y) == a.end())
			ans += i.yy;
		else
			ans += max(i.yy, a[y]), b[y] = 1;
	}
	return printf("%d\n", ans), 0;
}


Measured memory_bytes: 12800
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

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


int main() {

  string alfabet = ab + ab;

  int n;
  string s;
  cin >> n >> s;

  rep(i, s.length()) {
    cout << alfabet[s[i]-'A'+n];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
// package app;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        long N = sc.nextLong();
        String text = sc.next();

        int cnt = 0;
        for (int i = 0; i < N; i++) {
            if(text.indexOf("ABC", i) == i) {
                cnt++;
            }
        }

        System.out.println(cnt);
    }
}

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

using namespace std;

map<int,int> mp;

int main(){	
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i < 101; i++){
		for (int j = 1; j < 101; j++){
			for (int k = 1; k < 101; k++){
				mp[i*i + j*j + k*k + i*k + i*j + j*k]+=1;				
			}	
		}
	} 	
	for (int i = 1; i <= n;i++){
		cout << mp[i] << "\n";
	}
	return 0;
}

Measured memory_bytes: 5456
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main(){
    int N,K,h[100000],dp[100000]={0},i,k;
    scanf("%d%d",&N,&K);
    for(i=1;i<N;i++){
        dp[i]=1e9;
    }
    for(i=0;i<N;i++){
        scanf("%d",h+i);
    }
    for(i=0;i<N;i++){
        for(k=0;k<K;k++){
            if(i+k+1<N){dp[i+k+1]=min(dp[i+k+1],dp[i]+abs(h[i+k+1]-h[i]));}
        }
    }
    printf("%d\n",dp[N-1]);
    return 0;
}


Measured memory_bytes: 896
n = int(input())
ary = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i == n-1 and i+1 == ary[i]:
        ans += 1
    elif i+1 == ary[i]:
        a = ary[i]
        b = ary[i+1]
        ary[i] = b
        ary[i+1] = a
        ans += 1
    else:continue
print(ans)

Measured memory_bytes: 14008
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    String S ="";
    int[][] A = new int[3][3]; //3*3行列
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        A[i][j] = sc.nextInt();
      }
    }
    
    int N = sc.nextInt(); //b => 3*3行列 => 1
    for (int i = 0; i < N; i++) {
      int b = sc.nextInt();
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
          if(b == A[j][k]) {
            A[j][k] = 0;
          }
        }
      }
    }
    
    // (0,0)|(0,1)|(0,2)
    // (1,0)|(1,1)|(1,2)
    // (2,0)|(2,1)|(2,2)
    
    if(A[0][0]==0 && A[0][1]==0 && A[0][2]==0){
      S="Yes";
    } else if(A[1][0]==0 && A[1][1]==0 && A[1][2]==0){
      S="Yes";
    } else if(A[2][0]==0 && A[2][1]==0 && A[2][2]==0){
      S="Yes";
    } else if(A[0][0]==0 && A[1][0]==0 && A[2][0]==0){
      S="Yes";
    } else if(A[0][1]==0 && A[1][1]==0 && A[2][1]==0){
      S="Yes";
    } else if(A[0][2]==0 && A[1][2]==0 && A[2][2]==0){
      S="Yes";
    } else if(A[0][0]==0 && A[1][1]==0 && A[2][2]==0){
      S="Yes";
    } else if(A[0][2]==0 && A[1][1]==0 && A[2][0]==0){
      S="Yes";
    } else {
      S="No";
    }
    System.out.println(S);
  }
}

Measured memory_bytes: 35696
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef unsigned long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vl v0(62);  // v0[j] : jビット目が0の数の個数
    vl v1(62);  // v1[j] : jビット目が1の数の個数
    rep(i, n) {
        rep(j, 62) {
            if( a[i] & (1ull<<j) ) {
                v1[j]++;
            }
            else {
                v0[j]++;
            }
        }
    }

    ll ans = 0;
    rep(i, 62) {
        if(v0[i] == 0 || v1[i] == 0) {
            continue;
        }
        ll p = 1;
        rep(j, i) {
            p *= 2;
            p %= mod;
        }
        ll x = v0[i]*v1[i]%mod;
        ans += x*p;
        ans %= mod;
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 2560
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
	string s1,s2;
	cin>>s1>>s2;
	ll ans = 0;
	rep(i,0,3){
		if(s1[i]==s2[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll n;  cin >> n;
  list<ll> l;
  if(n%2 == 0){
  rep0(i,n){
    ll a;  cin >> a;
    if(i%2 ==1){
      l.push_front(a);
    }else{
      l.push_back(a);
    }
  }
}else{
  rep0(i,n){
    ll a;  cin >> a;
    if(i%2 == 0){
      l.push_front(a);
    }else{
      l.push_back(a);
    }
  }
}
  for(auto x:l){
    cout << x << " ";
  }
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N, M;
  cin >> N >> M;
  string S;
  cin >> S;

  reverse(S.begin(), S.end());

  vector<ll> ok;
  ok.push_back(-INF);
  for (ll i = 0; i < N + 1; i++)
  {
    if (S.at(i) == '0')
    {
      ok.push_back(i);
      //cerr << i << endl;
    }
  }
  ok.push_back(INF);

  vector<ll> ans;
  ll tmp = 0;
  while (tmp < N)
  {
    auto itr = upper_bound(ok.begin(), ok.end(), tmp + M);
    itr--;
    ll next = *itr;
    //cerr << tmp << " " << M << " " << next << endl;
    if (next <= tmp)
      FINALANS(-1);
    
    ans.push_back(next - tmp);
    tmp = next;
  }

  reverse(ans.begin(), ans.end());
  for (ll i = 0; i < ans.size(); i++)
  {
    cout << ans.at(i) << ((i == ans.size() - 1) ? '\n' : ' ');
  }
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, t; cin >> n >> t;
	vi v(n);
	rep(i, n) cin >> v[i];
	
	ll ans = 0;
	rep(i, n){
		ll l = v[i], r = v[i] + t;
		for(; i < n - 1 && v[i + 1] <= r; i++) r = v[i + 1] + t;
		ans += r - l;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  vector<set<int> > v(26);
  int n; cin >> n;
  string s; cin >> s;
  rep(i,n){
    v[s[i]-'a'].insert(i);
  }
  int q; cin >> q;
  vector<int> ans(0);
  rep(i,q){
    int p; cin >> p;
    if(p==1){
      int j; cin >> j; j--;
      char c; cin >> c;
      v[s[j]-'a'].erase(j);
      s[j]=c;
      v[s[j]-'a'].insert(j);
    }
    else{
      int a,b; cin >> a >> b; a--; b--;
      int cnt=0;
      rep(j,26){
        if(v[j].lower_bound(a)==v[j].end()) continue;
        if(*v[j].lower_bound(a)<=b) cnt++;
      }
      ans.push_back(cnt);
    }
  }
  rep(i,ans.size()){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 25880
#include <bits/stdc++.h>
#define uint unsigned long long
#define ll long long
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9
using namespace std;
const db pi = acos(-1.0);
inline int read()
{
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}
int as[1010], bs[1010];
int main() 
{
    int n; 
    n = read();
    rep(i, 0, n - 1)
    	as[i] = read(), bs[i] = read();
    ll a = as[0];
    ll b = bs[0];
    rep(i, 1, n - 1) 
    {
        ll d = max(a / as[i], b / bs[i]);
        while (not (a <= as[i] * d and b <= bs[i] * d)) d += 1;
        a = as[i] * d;
        b = bs[i] * d;
    }
    cout << a + b << endl;
    return 0;
}


Measured memory_bytes: 256
W,H,N=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for _ in range(N):
  x=list(map(int,input().split()))
  if x[2]==1:
    a.append(x)
  elif x[2]==2:
    b.append(x)
  elif x[2]==3:
    c.append(x)
  else:
    d.append(x)
a.sort()
b.sort()
c.sort(key=lambda x:x[1])
d.sort(key=lambda x:x[1])
ans=W*H
e,f=W,H
if len(a)!=0:
  if len(b)!=0:
    if b[0][0]<a[-1][0]:
      print(0)
      exit()
    e=b[0][0]-a[-1][0]
  else:
    e-=a[-1][0]
else:
  if len(b)!=0:
    e=b[0][0]
if len(c)!=0:
  if len(d)!=0:
    if d[0][1]<c[-1][1]:
      print(0)
      exit()
    f=d[0][1]-c[-1][1]
  else:
    f-=c[-1][1]
else:
  if len(d)!=0:
    f=d[0][1]
print(e*f)

Measured memory_bytes: 9236
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int long long
#define all(v) v.begin() , v.end()
#define pb push_back
#define endl '\n' 
template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

int a , b ;
string s ; 

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> a >> b >> s ;
	for ( int i = 0 ; i < a + b + 1 ; ++ i ) {
		if ( i == a )
			if ( s [ i ] != '-' )
				return cout << "No\n" , 0 ;
		if ( i != a )
			if ( ! ( s [ i ] >= '0' && s [ i ] <= '9' )  )
			     return cout << "No\n" , 0 ; 
	}
	cout << "Yes\n" ; 
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
 
  int N;
  long long A, ans=1;
  
  cin >> N;
  
  for(int i=1; i<=N; i++){
  	cin >> A; 
    
    if(A==0){ ans=0;
             break;
    }
    
    if(A>1000000000000000000/ans)ans = -1;
    if(ans!=-1)ans*=A;
    if(ans<0) ans = -1;
  
  }
  
  cout <<ans;
    
  return 0;
  
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int N,C;
    int s[114514],t[114514],c[114514];
    int imos[114514]={};
    int Ans=-INF;
    vector<pair<int,int>> ST[32];
    cin >> N >> C;
    REP(i,N){
        cin >> s[i] >> t[i] >> c[i];
        c[i]--;
        ST[c[i]].push_back({s[i],t[i]});
    }
    REP(i,C){
        int k=ST[i].size();
        if(k==0)continue;
        sort(ST[i].begin(),ST[i].end());
        imos[ST[i][0].first]++;
        REP(j,k-1){
            if(ST[i][j].second!=ST[i][j+1].first){
                imos[ST[i][j].second+1]--;
                imos[ST[i][j+1].first]++;
            }
        }
        imos[ST[i][k-1].second+1]--;
    }
    REP(i,104514){
        imos[i+1]+=imos[i];
    }
    REP(i,104514){
        Ans=max(Ans,imos[i]);
    }
    cout << Ans << endl;
    return 0;
}



Measured memory_bytes: 6144
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[][] arr = new int[n][2];
        int[] dp = new int[h+10001];

        
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            arr[i][0] = a[i];
            arr[i][1] = b[i];
        }
        
        for(int i = 0; i < h+1; i++){
            dp[i] = Integer.MAX_VALUE;
        }
        
        for(int i = 0; i < n; i++){
            for(int j = 0; j<arr[i][0]; j++){
                dp[j] = Math.min(dp[j], arr[i][1]);
            }
            for (int j = arr[i][0]; j<h+1; j++){
                dp[j] = Math.min(dp[j], dp[j-arr[i][0]] + arr[i][1]);
            }
        }
        
        System.out.println(dp[h-1]);
    }
}


Measured memory_bytes: 26172
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#define endl '\n';
#define all(v) ((v).begin()), ((v).end())
#define sz(s)               (int)s.size()
#define Ceil(x,y)             ((x+y-1)/y)
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define vi                    vector<int>
#define pii                 pair<int,int>
#define fx(n)           fixed<<setprecision(n)
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define forr(i, n) for (int i = 0; i < int(n); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef double dl;
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 1e7 + 5, MOD = 1e9 + 7;
using namespace std;
void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); }
int main()
{
	fast();
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	ll ans=0;
	for(int i=0;i<n;i++)
        cin>>v[i];
    sort(all(v));
    for(int i=0;i<k;i++)
        ans+=v[i];
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<long> data(1001);
  long a;
  for(int i = 0; i < N; i++){
    cin >> a;
    data.at(a)++;
  }
  long ans = 0;
  for(int i = 1000; i >= 1; i--){
    if(data.at(i) == 0)continue;
    for(int j = i; j >= 1; j--){
      if(data.at(j) == 0)continue;
      for(int k = min(j, i + j - 1); k >= max(1, i - j + 1) ; k--){
        if(i == j && j == k){
          ans += data.at(k) * (data.at(k) - 1) * (data.at(k) - 2) / 6;
        } else if(i == j || j == k || k == i){
          if(i == j)ans += data.at(i) * (data.at(i) - 1) * data.at(k) / 2;
          else if(j == k)ans += data.at(j) * (data.at(j) - 1) * data.at(i) / 2;
          else if(k == i)ans += data.at(k) * (data.at(k) - 1) * data.at(j) / 2;
        } else {
          ans += data.at(i) * data.at(j) * data.at(k);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

int main(){
  string s;
  cin >> s;
  ll ans=0;
  int temp=0;
  int cnt=0;
  while(temp<s.size()){
    cnt=0;
    while((temp<s.size() && s[temp]=='A') || (temp<s.size()-1 && s[temp]=='B' && s[temp+1]=='C')){
      if(temp<s.size() && s[temp]=='A'){
        cnt++;
        temp++;
      }
      else if(temp<s.size()-1 && s[temp]=='B' && s[temp+1]=='C'){
        ans+=cnt;
        temp+=2;
      }
    }
    temp++;
  }
  cout << ans << endl;
return 0;}

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

N,A,B=map(int,input().split())
H=[int(input()) for i in range(N)]

MAX=max(H)//B+1
MIN=min(H)//A

SA=A-B

while MAX!=MIN:
    
    x=(MAX+MIN)//2
    REST=[]

    for h in H:
        if h-B*x>0:
            REST.append(h-B*x)

    ANS=0
    #print(MAX,MIN,x,ANS)
    for r in REST:
        ANS+=-(-r//SA)

        if ANS>x:
            MIN=x+1
            break
    else:
        MAX=x

print(MAX)

Measured memory_bytes: 11116
#include <bits/stdc++.h>
using namespace std;
 
long long dd(long long x,long long y,long long z){
  return max(max(x,y),z)-min(min(x,y),z);
}

int main() {
 long long H,W;
  cin >> H >>W;
  long long ans=0;
  if(H%3!=0&&W%3!=0){
    long long a,b;
    a=H/3;
    b=W/2;
    ans=dd(a*W,b*(H-a),(W-b)*(H-a));
    a++;
    ans=min(ans,dd(a*W,b*(H-a),(W-b)*(H-a)));
    a--;b++;
    ans=min(ans,dd(a*W,b*(H-a),(W-b)*(H-a)));
    a++;
    ans=min(ans,dd(a*W,b*(H-a),(W-b)*(H-a)));
    swap(H,W);
    a=H/3;
    b=W/2;
    ans=min(ans,dd(a*W,b*(H-a),(W-b)*(H-a)));
    a++;
    ans=min(ans,dd(a*W,b*(H-a),(W-b)*(H-a)));
    a--;b++;
    ans=min(ans,dd(a*W,b*(H-a),(W-b)*(H-a)));
    a++;
    ans=min(ans,dd(a*W,b*(H-a),(W-b)*(H-a)));
    ans=min(min(H,ans),W);
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
int main(){
    int n,a,b,c;
    int ans=INF;
    int now=0;
    int cnt[3]={-1,-1,-1};
    int legth[3]={0,0,0};
    int bind[3]={0,0,0};
    bool id[2];
    cin >>n>>a>>b>>c;
    vector<int>l(n,0);
    rep(i,n){
        cin>>l[i];
    }
    for(int bit=0;bit<(1<<(n*2));bit++){
        for(int i=0;i<3;i++){
            legth[i]=0;
            bind[i]=0;
        }
        for(int i=0;i<n;i++){
            id[0]=  (bit & (1 << (i * 2))) ;
            id[1]= (bit & (1 << (1+ i * 2)));
          //  clog << ((int)id[0] * 2 +(int) id[1])<<" " ;
            switch (id[0] * 2 + id[1])
            {
            case 1:
                legth[0] += l[i];
                bind[0]++;
                break;
            case 2:
                legth[1] += l[i];
                bind[1]++;
                break;
            case 3:
                legth[2] += l[i];
                bind[2]++;
                break;
            }
            
        }
        if (bind[0] && bind[1] && bind[2])
        {
            chmin(ans, abs(a - legth[0]) + abs(b - legth[1]) + abs(c - legth[2]) + (bind[0] +bind[1]+bind[2]- 3) * 10 );
          //  clog << " " << legth[0] << "  " << legth[1] << "  " << legth[2] << "   " << bind[0] << " " << bind[1] << " " << bind[2] << "   " << ans ;
           // clog << " " << (abs(a - legth[0]) + abs(b - legth[1]) + abs(c - legth[2]) + (bind[0] + bind[1] + bind[2] - 3) * 10);
        }
     //   clog << endl;
      
    }
    cout<<ans<<endl;
}

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

using namespace std;

int main()
{
    int n=0;
    string s;
    cin>>s;
    for(string::iterator i=s.begin()+1;i<s.end();i++,n++)
        ;
    cout<<*s.begin()<<n-1<<*(s.end()-1)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
inline int newline() { putchar('\n'); return 0; }

int main() {
    string first, second;
    cin(first);
    cin(second);

    ll firstCount, secondCount;
    cin(firstCount);
    cin(secondCount);


    string temp;
    cin(temp);

    temp == first ? firstCount-- : secondCount--;
    printf("%lld %lld\n", firstCount, secondCount);
    return 0;
}

Measured memory_bytes: 256
n,a,b,c,d=map(int,input().split())
s=["#"]+list(input())
if c<d:
    for now,goal in [(b,d),(a,c)]:
        while now < goal:
            if s[now+1]==".":
                now+=1
            elif now < n-1 and s[now+2]==".":
                now+=2
            else:
                print("No")
                exit()
    print("Yes")
else:
    for now,goal in [(b,d),(a,c)]:
        while now < goal:
            if now < n-1 and s[now+2]==".":
                now+=2
            elif s[now+1]==".":
                now+=1
            else:
                print("No")
                exit()
    for i in range(b-1,d):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            break
    else:
        print("No")

Measured memory_bytes: 6204
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using BigInt = long long;
#define ALL(a)  (a).begin(),(a).end()
const long long INF = 1LL << 60;
const int MOD = 1000000007;

int main(){
    long long X;
    cin >> X;
    long long money = 100;
    for(int i = 1; i < INF; i++){
        money *= 1.01;
        if (money >= X){
            cout << i << endl;
            break;
        }
    }
}

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

int main(){
  int a,b,k;
  cin >> a >> b >>k;

  int p=0;
  int ans;
  for(int i=min(a,b);i>=1;i--) {
    if(a%i==0&&b%i==0){
      p++;
    }
    if(p==k){
      ans =i;
      p++;
    }
  }


cout << ans <<endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d', $s);
$a[] = str_split($s);
$p = $a[0];

if($s <= 10){
  echo 1000 - $s;
}elseif($p[1] == 0 && $p[2] == 0 && $p[3] == 0 && $p[4] == 0){
  echo "0";
}else{
  $m = substr($s, -3);
  echo 1000 - $m;
}

Measured memory_bytes: 16132
package main

import "fmt"

func main(){
	var S string
	var ans int
	fmt.Scan(&S)
	for i:=0; i < len(S) / 2; i++ {
		if S[i:i+1] != S[len(S)-i-1:len(S)-i] {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll a[200010];
ll b[200010];

int main(){
    int n, k;
    cin >> n >> k;
    rep(i, n) cin >> a[i];

    rep(j, k){
        memset(b, 0, sizeof(b));
        rep(i, n){
            b[max((ll)0, ll(i-a[i]))]++;
            b[min((ll)n, ll(i+a[i]+1))]--;
        }
        rep(i, n) b[i+1] += b[i];
        ll mn = LINF;
        rep(i, n) {
            a[i] = b[i];
            mn = min(mn, b[i]);
        }
        if (mn == n) break;
    }

    rep(i, n) cout << a[i] << " ";
    cout << endl;

    return 0;
}


Measured memory_bytes: 6740
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int N = 100100;
int a[N];
int n;

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		a[i] = (i + 1 == x);
	}
	int l = 0;
	int ans = 0;
	while(l < n) {
		if (a[l]) {
			ans++;
			l += 2;
		} else
			l++;
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 123456;
const int MOD = (int)1e9 + 7;
char s[MAXN];
int digit[MAXN];
LL dp[MAXN][2];

int dfs(int pos, int f) {
    if (pos == -1) return 1;
    if (dp[pos][f] != -1) return dp[pos][f];
    int up = 1;
    if (f) up = digit[pos];
    LL sum = 0;
    for (int i = 0; i <= up; i++) {
        int nf = f;
        if (f && i < digit[pos]) nf = 0;
        if (i == 1) sum = (sum + dfs(pos - 1, nf) * 2) % MOD;
        if (i == 0) sum = (sum + dfs(pos - 1, nf)) % MOD;
    }
    //printf("pos = %d f = %d dp = %lld\n", pos, f, sum);
    return dp[pos][f] = sum;
}



int main() {
    scanf("%s", s);
    int N = strlen(s);
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < N; i++) {
        if (s[i] == '1') digit[N - 1 - i] = 1;
    }
    printf("%d\n", dfs(N - 1, 1));
    return 0;
}


Measured memory_bytes: 10496