akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 1e6 + 10;
char S[MAXN];
long long s = 1, cnt[26];

int main() {
	register int i;
	scanf("%s", S + 1); int N = strlen(S + 1);
	for(i = 1; i <= N; ++i)
		s += i - ++cnt[S[i] - 'a'];
	printf("%lld\n", s);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
const int mod=924844033,maxn=524288,_g=5;
int n,m,i,j,inv[maxn+5],w[maxn+5],sz[maxn+5],a[maxn+5],b[maxn+5],fac[maxn+5],fi[maxn+5],rev[maxn+5];
vector<int> bi[maxn+5];
int c(int x,int y)
{
	return 1ll*fac[x]*fi[y]%mod*fi[x-y]%mod;
}
int qp(int x,int y)
{
	int z=1;
	while(y){
		if(y&1){
			z=1ll*x*z%mod;
		}
		x=1ll*x*x%mod;
		y/=2;
	}
	return z;
}
void init()
{
	int i;
	fac[0]=fac[1]=fi[0]=fi[1]=1;
	inv[1]=1;w[0]=1;w[1]=qp(_g,(mod-1)/maxn);
	fz(i,2,maxn){
		fac[i]=1ll*fac[i-1]*i%mod;
		w[i]=1ll*w[i-1]*w[1]%mod;
		inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fi[i]=1ll*fi[i-1]*inv[i]%mod;
	}
	if(w[0]!=w[maxn]) exit(-1);
}
int getrev(int x)
{
	int len=1,i;
	while(len<=x){
		len*=2;
	}
	fz0k(i,len){
		rev[i]=rev[i/2]/2+((i&1)*(len/2)); 
	}
	return len;
}
void ntt(int *a,int len,int op)
{
	int i,j,k;
	fz0k(i,len) if(rev[i]<i) swap(a[i],a[rev[i]]);
	for(i=1;i<len;i<<=1){
		int ys=maxn/i/2;
		for(j=0;j<len;j+=i+i){
			int t=(op==1?0:maxn);
			fz0k(k,i){
				int x=a[j+k],y=1ll*a[j+k+i]*w[t]%mod;
				a[j+k]=x+y;if(a[j+k]>=mod) a[j+k]-=mod;
				a[j+k+i]=x-y;if(a[j+k+i]<0) a[j+k+i]+=mod;
				t+=op*ys;
			}
		}
	}
	if(op==-1) fz0k(i,len){
		a[i]=1ll*a[i]*inv[len]%mod;
	}
}
void dfs(int x,int fa)
{
	sz[x]=1;
	ff(bi[x],it){
		if(*it==fa) continue;
		dfs(*it,x);
		sz[x]+=sz[*it];
		a[sz[*it]]++;
	}
	a[n-sz[x]]++;
}
int main()
{
	init();
	scanf("%d",&n);
	fz1(i,n-1){
		int x,y;
		scanf("%d%d",&x,&y);
		bi[x].push_back(y);
		bi[y].push_back(x);
	}
	dfs(1,0);
	a[0]=0;
	fz0g(i,n){
		a[i]=1ll*a[i]*fac[i]%mod;
		b[i]=fi[n-i];
	}
	int len=getrev(2+n+n);
	ntt(a,len,1);ntt(b,len,1);
	fz0k(i,maxn) a[i]=1ll*a[i]*b[i]%mod;
	ntt(a,len,-1);
	fz1(i,n){
		printf("%d\n",((1ll*c(n,i)*n-1ll*fi[i]*a[i+n])%mod+mod)%mod);
	}
	return 0;
}

Measured memory_bytes: 45056
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n, b;
    cin >> n;

    int ans = 0;
    int cur = 1 << 30;
    for (int i = 1; i < n; i++) {
        cin >> b;
        ans += min(b, cur);
        cur = b;
    }

    cout << ans + b << "\n";
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
class SST{
	public:
	int n;
	vi a,b;
	SST(int size){
		n=pow(2,ceil(log2(size)));
		a=b=vi(2*n-1);
	}
	void range_add(int l,int r,int z){//[l,r)+=z
		range_add(0,0,n,l,r,z);
	}
	void range_add(int i,int il,int ir,int l,int r,int z){//[l,r)
		if(l<=il&&ir<=r){
			a[i]+=z;
			b[i]+=z;
		}else if(ir<=l||r<=il){
			
		}else{
			range_add(2*i+1,il,(il+ir)/2,l,r,z);
			range_add(2*i+2,(il+ir)/2,ir,l,r,z);
			b[i]=a[i]+max(b[2*i+1],b[2*i+2]);//max
		}
	}
	int range_max(int l,int r){
		return range_max(0,0,n,l,r);
	}
	int range_max(int i,int il,int ir,int l,int r){
		if(l<=il&&ir<=r){
			return b[i];
		}else if(ir<=l||r<=il){
			return 0;
		}else{
			return a[i]+max(
				range_max(2*i+1,il,(il+ir)/2,l,r),
				range_max(2*i+2,(il+ir)/2,ir,l,r));
		}
	}
	void open(){
		rep(i,a.size())cout<<" "<<a[i];cout<<endl;
		rep(i,b.size())cout<<" "<<b[i];cout<<endl;
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	vvp in(m);
	rep(i,n){
		int a,b;cin>>a>>b;
		in[b-a].pb({a,b});
	}
	int s=n;
	SST sst(m);
	rep(i,m){
		int co=s;
		for(int j=i+1;j<=m;j+=i+1){
			co+=sst.range_max(j-1,j);
		}
		cout<<co<<endl;
		s-=in[i].size();
		rep(j,in[i].size())
			sst.range_add(in[i][j].first-1,in[i][j].second,1);
	}
}







Measured memory_bytes: 9728
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	int n;
	bool p[10001]={false};
	
	p[2]=true;
	
	for(int i=3;i<=10000;i+=2){
		bool f=false;
		for(int j=3;j<=sqrt(i);j++){
			if(i%j==0){
				f=true;
				break;
			}
		}
		if(!f)
			p[i]=true;
	}
	
	while(cin>>n){
		int count=0;
		for(int i=1;i<=n;i++){
			if(p[i]&&p[n+1-i])
				count++;
		}
		
		cout<<count<<endl;
	}
	
	
	
}

Measured memory_bytes: 1176
#define _USE_MATH_DEFINES
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <math.h>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>

using namespace std;

const int INF=1000000000;

int a,b,h;

int main(){

 cin>>a>>b>>h;

 cout<<(a+b)*h/2<<endl;

 return 0;

}

Measured memory_bytes: 256
using System.Collections.Generic;
using static System.Console;

class Program {
	static void Main() {
		var N = NextInt();
		var A = NextInt();
		var B = NextInt();

		var ans = 0;

		for (var i = 1; i <= N; i++) {
			var tmp = SumOfDigits(i);
			if (A <= tmp && tmp <= B) {
				ans += i;
			}
		}
		WriteLine(ans);
	}

	static int SumOfDigits(int n) {
		var result = 0;
		for (; n != 0; n /= 10) {
			result += n % 10;
		}
		return result;
	}

	static int NextInt() {
		return int.Parse(NextString());
	}

	static string NextString() {
		var result = new List<char>();
		while (true) {
			int next = Read();
			if (next < 0)
				break;
			var nextChar = (char)next;
			if (!char.IsWhiteSpace(nextChar))
				result.Add(nextChar);
			else if (nextChar != '\r')
				break;
		}
		return string.Join("", result);
	}
}

Measured memory_bytes: 13268
#include <iostream>
using namespace std;
int y1, y2, m1, m2, d1, d2, ans;
bool isOld1 = false;
int main() {
  cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
  if (y1 < y2) {
    isOld1 = true;
  } else if (y1 == y2) {
    if (m1 < m2) {
      isOld1 = true;
    } else if (m1 == m2) {
      if (d1 < d2) {
        isOld1 = true;
      } else if (d1 == d2) {
        cout << '0' << '\n';
        return 0;
      }
    }
  }

  if (isOld1) {
    int tmp;
    tmp = y1;
    y1 = y2;
    y2 = tmp;
    tmp = m1;
    m1 = m2;
    m2 = tmp;
    tmp = d1;
    d1 = d2;
    d2 = tmp;
  }

  ans = y1 - y2;
  if ((m2 - m1) < 0 || (m2 - m1) == 0 && (d2 - d1) < 0) {
    ans++;
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  int n;
  cin>>n;
  ll ara[n+5];
  for(int i=1;i<=n;i++)cin>>ara[i];
  ll lcm=1;
  for(int i=1;i<=n;i++)
  {
    ll g=__gcd(lcm,ara[i]);
  	lcm=(lcm/g)*ara[i];
  }
  cout<<lcm<<endl;
}

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

if 8 >= N >= 1:
  print(N)
elif 99 >= N >= 9:
  print(9)
elif 999 >= N >= 100:
  print(N - 90)
elif 9999 >= N >= 1000:
  print(909)
elif 99999 >= N >= 10000:
  print(N - 9090)
elif N == 100000:
  print(90909)

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong a,b;
	cin >> a >> b;
	string ans;

	if(0 < a)
		ans = "Positive";
	else if(a < 0 && 0 < b)
		ans = "Zero";
	else if(a == 0 || b == 0)
		ans = "Zero";
	else if(abs(a-b)%2 == 0)
		ans = "Negative";
	else
		ans = "Positive";

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913};
// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)

unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap){
  unsigned count = 0;
  for(unsigned i = gap; i < n; i++){
    unsigned v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}

void shell_sort(unsigned a[], unsigned n){
  unsigned gap_num = 0;
  while(gaps[++gap_num] < n);
  gap_num--;

  unsigned count = 0;
  for(int i = gap_num; i >= 0; i--) count += insertion_sort(a,n,gaps[i]);

  std::cout << (gap_num+1) << '\n';

  for(int i = gap_num; i; i--) std::cout << gaps[i] << ' ';
  std::cout << gaps[0] << '\n';

  std::cout << count << '\n';
}

int main(){
  std::ios::sync_with_stdio(false);
  unsigned n;
  std::cin >> n;
  auto a = new unsigned[n];
  for(unsigned i = 0; i < n; i++) std::cin >> a[i];
  shell_sort(a,n);
  for(unsigned i = 0; i < n; i++) std::cout << a[i] << '\n';
  delete[](a);
}

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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int k;
    string s;
    cin >> k >> s;
    if(s.size() <= k) {
        cout << s << endl;
    } else {
        rep(i, k) {
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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


Measured memory_bytes: 3624
/*A - ∴ (Therefore)*/

#include <bits/stdc++.h>
using namespace std;

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int num;
	cin >> num;

	int n = num % 10;

	if(n == 2 or n == 4 or n == 5 or n == 7 or n == 9)
		cout << "hon";
	else if(n == 0 or n == 1 or n == 6 or n == 8)
		cout << "pon";
	else
		cout << "bon";

	return 0;
}

Measured memory_bytes: 3572
S = input()
T = input()

xS = S[::-1]
xT = T[::-1]

point = -1

for i in range(len(xS) - len(xT) + 1):
    for j in range(len(T)):
        if xS[i + j] == xT[j] or xS[i + j] == "?":
            if j == len(xT) - 1:
                point = i
                break
            continue
        else:
            break
    if point != -1:
        break


xS = list(xS)
for i in range(len(xT)):
    xS[i + point] = xT[i]

for i in range(len(S)):
    if xS[i] == "?":
        xS[i] = "a"

xS = xS[::-1]
if point != -1:
    print("".join(xS))
else:
    print("UNRESTORABLE")













Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int N, M, Q;
int dp[510][510];
int main(){
    cin >> N >> M >> Q;
    for(int i = 0; i < M; i++){
        int L, R;
        cin >> L >> R;
        dp[L][R]++;
    }
    for(int i = N; i > 0; i--){
        for(int j = 1; j <= N; j++){
            dp[i - 1][j] += dp[i][j];
        }
    }

    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            dp[i][j + 1] += dp[i][j];
        }
    }

    for(int i = 0; i < Q; i++){
        int p, q;
        cin >> p >> q;
        cout << dp[p][q] << endl;
    }
    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define ll long long 
#define P pair<int,int>
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
const ll INF = 100100100100;
/*
dp[i][j]
文字列sのi文字目までと
文字列tのj文字目までの
最長共通文字列の長さ
*/
int main(){
    string s,t;
    cin >> s >> t;
    int sn = s.size(), tn = t.size();
    vector<vector<int>> dp(sn+1,vector<int>(tn+1));
    for(int i=1;i<=sn;i++){
        for(int j=1;j<=tn;j++){
            dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            if(s[i-1]==t[j-1]) dp[i][j] = dp[i-1][j-1]+1;
        }
    }
    int N = dp[sn][tn];
    string ans;
    while(sn>0 && tn>0){
        if(dp[sn][tn]==dp[sn-1][tn]) sn--;
        else if(dp[sn][tn]==dp[sn][tn-1]) tn--;
        else{
            ans = s[sn-1] + ans;
            sn--; tn--;
        }

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


Measured memory_bytes: 35584
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int p[6];
int q[6];

double fanc(double a){
	double x = 0.0;
	repp(i,0,6){
		x += max(p[i] * a / 100.0 , q[i] * (1.0-a) / 100.0);
	}
	return x;
}

double TS(double a , double b , int t){
	if(t == 100) return (a+b) / 2.0;
	double c = (b-a) / 3.0;
	return fanc(a+c) < fanc(b-c) ? TS(a,b-c,t+1) : TS(a+c,b,t+1);
}

int main(){
	repp(i,0,6){
		scanf("%d" , p + i);
	}
	repp(i,0,6){
		scanf("%d" , q + i);
	}
	printf("%.13f\n" , fanc(TS(0.0,1.0,0)));
	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s; i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int n, i; cin >> n >> i;
    cout << n - i + 1 << "\n";
    return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	N := nextInt()
	as := make([]int, N)
	for i := 0; i < N; i++ {
		as[i] = nextInt()
	}

	sort.Sort(sort.Reverse(sort.IntSlice(as)))

	var before int
	var ans []int
	for _, a := range as {
		if a == before {
			ans = append(ans, a)
			if len(ans) == 2 {
				break
			}
			before = 0
			continue
		}
		before = a
	}
	if len(ans) == 2 {
		fmt.Println(ans[0] * ans[1])
		return
	}
	fmt.Println(0)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 3072
#include<cstdio>
char s[100001];
using ll=long long;
constexpr ll p=1e9+7;
ll dp[100001][13];
int main(){
    scanf("%s",s);
    dp[0][0]=1;
    for(int i=1;i<13;i++)dp[0][i]=0;
    int i=0;
    for(;s[i]!='\0';i++){
        if(s[i]=='?'){
            for(int j=0;j<13;j++){
                for(int k=0;k<10;k++){
                    dp[i+1][(10*j+k)%13]+=dp[i][j];
                }
            }
        }else{
            for(int j=0;j<13;j++){
                dp[i+1][(10*j+s[i]-'0')%13]+=dp[i][j];
            }
        }
        for(int j=0;j<13;j++){
            dp[i+1][j]%=p;
        }
    }
    printf("%lld\n",dp[i][5]);
    return 0;
}

Measured memory_bytes: 10368
def calculate_hp(n,x):
  minimum_hp = 0
  xlist = [int(s) for s in x]
  for n in range(min(xlist), max(xlist)):
    total_hp = 0
    for i in xlist:
      hp = (i-n) ** 2
      total_hp+=hp
    if minimum_hp == 0 or minimum_hp > total_hp :
      minimum_hp = total_hp
  return minimum_hp

def main():
  n = int(input())
  x = input().split()
  minimum_hp=calculate_hp(n, x)
  print(str(minimum_hp))

main()

Measured memory_bytes: 3060
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define lets_go ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
const int N = 2e6 + 10;
const int IM = 1e15 + 37;
const double PI = 3.1415926535897932384;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " " ; cout << endl;}
void PVV(vii v) {for (int i = 0 ; i < v.size() ; i++) cout << v[i].fe << " " << v[i].se << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
inline void PP(int n) { cout << n << " ";}
inline void PP(int n, int m) { cout << n << " " << m << endl;}
inline void PP(int n, int m, int q) {  cout << n << " " << m << " " << q << endl;}
inline void PP(int n, int m, int q, int u) {  cout << n << " " << m << " " << q << " " << u << endl;}
inline void op() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
// <=================================================================================================================================
// <=================================================================================================================================


int a[N], b[N];


signed  main() {
    //op();
    lets_go
    int i, j, x, y, u, l;
    //int t; cin >> t; while (t--)
    {
        i = j = x = y = u = l = 0;

        int n, m, k;
        cin >> n >> m >> k;
        //PP(n,m,k);
        for (i = 1; i <= n; i++) {
            cin >> a[i];
            a[i] += a[i - 1];
        }
        //PA(a,n,1);
        for (i = 1; i <= m; i++) {
            cin >> b[i];
            b[i] += b[i - 1];
        }
        //PA(b,m,1);
        int ans = 0;
        for (i = 0; i <= m; i++) {
            j = b[i]; //PP(j);
            j = k - b[i];
            if (j < 0)
                continue;
            x = 0, y = n;
            l = 0;
            while (x <= y) {
                u = x + (y - x) / 2;
                if (a[u] <= j) {
                    l = u;
                    x = u + 1;
                }
                else
                    y = u - 1;
            }

            ans = max(ans, l + i);
        }
        PT(ans);


        /* */

    }
    return 0;

}


Measured memory_bytes: 6764
s = list(input())
ans = 0
acgt = ["A","C","G","T"]
for i in range(len(s)):
    if s[i] in acgt:
        temp = 1
        j = 1
        while len(s) > i + j and s[i + j] in acgt:
            temp += 1
            j += 1
        ans = max(temp, ans)

print(ans)

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

using namespace std;
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef std::vector<bool> vb;
typedef std::vector<std::vector<bool>> vvb;
#define INF 1999999999
#define MODA 1000000007
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define rep1(i,n) for (long long i = 1; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define errvn1(x) cerr << #x <<" "<< x << endl;
#define errvn2(x, y) cerr << #x <<" "<< x <<" "<< #y <<" "<< y << endl;
#define errvn3(x, y, z) cerr << #x <<":"<< x <<" "<< #y <<":"<< y <<" "<< #z <<":"<< z << endl;
#define errvn4(x, y, z, a) cerr << #x <<":"<< x <<" "<< #y <<":"<< y <<" "<< #z <<":"<< z <<" "<< #a <<":"<< a << endl;
#define errop2(x, y) cerr << x <<" "<< y << endl;
#define errop3(x, y, z) cerr << x <<" "<< y <<" "<< z << endl;
#define errop4(x, y, z, a) cerr << x <<" "<< y <<" "<< z <<" "<< a << endl;

template <typename T = long long>
struct UnionFind {
  vector<T> data;
  UnionFind(T sz) {
    data.assign(sz, -1);
  }
  bool unite(T x, T y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
  T find(T k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
  T size(T k) {
    return (-data[find(k)]);
  }
};


int main() {
  ll N, M;
  cin >> N >> M;
  vll A(M), B(M);
  rep(i, M) cin >> A[i] >> B[i];
  rep(i, M) {
    A[i]--;
    B[i]--;
  }

  UnionFind uni(N);
  rep(i,M) {
    uni.unite(A[i], B[i]);
  }
  ll cnt = 0;
  rep(i,N){
    cerr << uni.find(i) << endl;
    if (uni.find(i) == i) cnt++;
  }
  cout << cnt-1 << endl;

  return 0;
}


Measured memory_bytes: 5556
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string ans;
	cin>>ans;
	for(int i=0;i<ans.size();i++){
		if(ans[i]==','){
			cout<<' ';
		}else{
      cout<<ans[i];
		}
	}
	cout<<endl;
}

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

int main(){
	int N;
	int W;
	cin>>N>>W;
	int v[N]; 
	int w[N];
	int DP[N+1][W+1];
	for(int i=0;i<N;i++){
		cin>>v[i]>>w[i];
	}
	for(int i=0;i<=W;i++){
		DP[0][i]=0;
	}
	for(int i=1;i<=N;i++){
		for(int j=0;j<=W;j++){
			if(j<w[i-1]){
				DP[i][j]=DP[i-1][j];
			}else{
				if(DP[i-1][j]>DP[i][j-w[i-1]]+v[i-1]){
					DP[i][j]=DP[i-1][j];
				}else{
					DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
				}
			}
		}
	}
	
	cout<<DP[N][W]<<endl;
	return 0;
}

Measured memory_bytes: 7020
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

//===

//=== xorshift
uint32_t xorshift32() {
    static uint32_t s = 1710;
    s = s ^ (s << 13);
    s = s ^ (s >> 17);
    s = s ^ ( s << 5);
    return s;
}
//===
template<typename T, typename Compare = less<T> >
struct MeldableHeap {
    struct Node {
        T dat;
        Node *l, *r;

        Node (T dat): dat(dat), l(nullptr), r(nullptr) {};
    };

    Node *root;
    Compare cmp;

    MeldableHeap (Compare cmp = Compare()): root(nullptr), cmp(cmp) {};

    Node *meld(Node *h1, Node *h2) {
        if (h1 == nullptr) return h2;
        else if (h2 == nullptr) return h1;

        if (cmp(h2->dat, h1->dat)) swap(h1, h2);
        
        if (xorshift32() & 1) h1->l = meld(h1->l, h2);
        else h1->r = meld(h1->r, h2);

        return h1;
    };

    void push(T dat) {
        Node *u = new Node(dat);
        root = meld(root, u);
    };

    T top() { return root->dat; };
    
    T pop() {
        T ret = top();
        Node *rm = root;
        root = meld(root->l, root->r);
        delete rm;
        
        return ret;
    };

    void merge_with(MeldableHeap &h) {
        root = meld(root, h);
        h.root = nullptr;
    };

    bool empty() { return root == nullptr; };
};
// MinHeap<T> = MeldableHeap<T, less<T>>
// MaxHeap<T> = MeldableHeap<T, greater<T>>
//===

int ABC141D() {
    llong n, m;
    llong a;
    MeldableHeap<llong, greater<llong> > h;

    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> a;
        h.push(a);
    }

    for (int i = 0; i < m; i++) {
        a = h.pop() / 2;
        h.push(a);
    }

    llong sum = 0;
    while (!h.empty()) {
        sum += h.pop();
    }

    cout << sum << endl;
    
    return 0;
}

int main() {
    return ABC141D();
}


Measured memory_bytes: 3328
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	char b; cin >> b;
	if (b == 'A') cout << "T" << endl;
	else if (b == 'T') cout << "A" << endl;
	else if (b == 'C') cout << "G" << endl;
	else cout << "C" << endl;
	return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const string p = "POSSIBLE";
const string im = "IMPOSSIBLE";
int N, K;
vector<int> A(100010);

int GCD(int a, int b) {
    if(a == 0) {
        return b;
    }else if(b == 0) {
        return a;
    }else {
        int r, temp;
        if(a < b) {
            temp = a;
            a = b;
            b = temp;
        }

        r = a % b;
        while(r != 0) {
            a = b;
            b = r;
            r = a % b;
        }
        return b;
    }
}
int main() {
    cin >> N >> K;
    int max = 0;
    for(int i = 0; i < N; ++i) {
        cin >> A.at(i);
        if(A.at(i) > max) max = A.at(i);
    }

    int g = A.at(0);

    for(int i = 1; i < N; ++i) {
        g = GCD(g, A.at(i));
    }

    int flag = 0;
    if(K % g != 0) flag = 1;
    if(K > max) flag = 1;

    if(flag == 0) {
        cout << p << endl;
    }else {
        cout << im << endl;
    }


}

Measured memory_bytes: 640
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

void b_trained(void) {
	int n;
	int a[100010];
	int cnt = 0;
	int next_button = 1;
	int now_button = 1;
	bool find = false;

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

	for (int i = 1; i <= n; i++) {
		now_button = next_button;
		if (now_button == 2) {
			find = true;
			break;
		}
		next_button = a[now_button];
		cnt++;
	}

	if (!find) cnt = -1;
	cout << cnt << endl;
}

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

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

int main()
{
	while (1)
	{
		int n; cin >> n;
		if (n == 0) return 0;

		int f = 1;
		int l = 0, r = 0;
		int ans = 0;

		rep(i, 0, n)
		{
			string s; cin >> s;

			if (s == "lu")
				l = 1;
			else if (s == "ru")
				r = 1;
			else if (s == "ld")
				l = 0;
			else if (s == "rd")
				r = 0;

			if (f == l && f == r)
			{
				ans++;
				f = (f + 1) % 2;
			}
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<ll> P(A);
  rep(i, A) cin >> P[i];
  vector<ll> Q(B);
  rep(i, B) cin >> Q[i];
  vector<ll> R(C);
  rep(i, C) cin >> R[i];
  sort(P.begin(), P.end(), greater<ll>());
  sort(Q.begin(), Q.end(), greater<ll>());
  rep(i, X) R.push_back(P[i]);
  rep(i, Y) R.push_back(Q[i]);
  sort(R.begin(), R.end(), greater<ll>());
  ll ans = 0;
  rep(i, X+Y) ans += R[i];
  // ll ans = accumulate(R.begin(), R.begin() + X + Y, 0);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 7800
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;
	static boolean debug = false;

	static void solve() {
		int[] a = ir.nextIntArray(3);
		out.println((a[0] - a[1] + 1) * (a[0] - a[2] + 1));
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}

	static void tr(Object... o) {
		if (debug)
			out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

using namespace std;
//#define int long long
using ll = long long;
const int MX = 1e6;
const ll inf = 1e13;
const int mod = 1e9+7;
struct UnionFind {
vector<int> d;
UnionFind(int n): d(n, -1) {}
int root(int x) {
if(d[x] < 0) return x;
return d[x] = root(d[x]);
}
bool unite(int x, int y) {
x = root(x); y = root(y);
if(x == y) return false;
if(d[x] > d[y]) swap(x, y);
d[x] += d[y];
d[y] = x;
return true;
}
bool same(int x, int y) {return (root(x) == root(y));}
int size(int x) {return -d[root(x)];}
};
signed main() {
    int n,m;
    cin >>n>>m;
    UnionFind t(n);
    if(m==0) {
        cout << 1 << endl;
        return 0;
    }
    rep(i,m) {
        int x,y;
        x--; y--;
        cin >> x >> y;
        t.unite(x,y);
    }
    int ans = 0;
    rep(i,n) {
        ans = max(t.size(i),ans);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4024
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])

arr=sorted(list(map(int, arr_data[1])))

print(arr[-1:][0]-arr[0])



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);
//bool can;
const ll N=1000005;
std::vector<ll> visited;
ll ans;
ll k;
const ll MOD=1000000007;
ll fact[N], invfact[N];

ll Power(ll base , ll e)
{
    if(e == 0) return 1;
    ll ans = base; e--;
    while(e)
	{
        if(e & 1) ans = (((ans%MOD) * (base%MOD)) %MOD+MOD)%MOD;
        base = (((base%MOD) * (base%MOD)) %MOD+MOD)%MOD;
        e >>= 1;
	}
	return (ans+MOD) %MOD;
}


ll gcd(ll a,ll b)
{
if(a==0) return b;
else return gcd(a%b,b);
}

    ll modinv(ll k)
    {
        return Power(k, MOD-2);
    }

    void precompute()
    {
        fact[0]=fact[1]=1;
        for(ll i=2;i<N;i++)
        {
            fact[i]=fact[i-1]*i;
            fact[i]%=MOD;
        }
        invfact[N-1]=modinv(fact[N-1]);
        for(ll i=N-2;i>=0;i--)
        {
            invfact[i]=invfact[i+1]*(i+1);
            invfact[i]%=MOD;
        }
    }

    ll nCr(ll x, ll y)
    {
        if(y>x)
            return 0;
        ll num=fact[x];
        num*=invfact[y];
        num%=MOD;
        num*=invfact[x-y];
        num%=MOD;
        return num;
    }


std::vector<ll> adj[100005];
void fu(ll node,ll res){
	ll cnt=0;
	if(res==0) cnt=1;
	else cnt=2;
	ans=((ans%MOD)*(nCr(k-res,1)%MOD))%MOD;
	visited[node]=1;
	for(auto kk:adj[node]){
		if(!visited[kk]) fu(kk,cnt++);
	}

}

int main(){
	ll n;
	
	cin>>n>>k;
	ans=1;
	//can=true;
	precompute();
	visited.resize(n+1,0);
	
	ll aa,bb;
	
	
	fo(i,n-1){
		cin>>aa>>bb;
		adj[aa].pb(bb);
		adj[bb].pb(aa);


	}
	fu(1,0);
	cout<<ans<<endl;


}

Measured memory_bytes: 24448
#include <iostream>

int main()
{
    int x = 0;
    int y = 0;
    
    for( int i = 1; i <= 3000; ++i )
    {
        // input
        std::cin >> x;
        std::cin >> y;
        
        if( 0 == x && 0 == y )
        {
            break;
        }
        
        if( x < 0 || x > 10000 || y < 0 || y > 10000 )
        {
            std::cout << " Error : out of range!" << std::endl;
            return -1;
        }
        
        if( x < y )
        {
            std::cout << x << " " << y <<std::endl;
        }
        else
        {
            std::cout << y << " " << x <<std::endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3008
n,k = map(int,input().split())
hl = []
for _ in range(n):
    hl.append(int(input()))
hl.sort()

ans = 10**9
for i in range(n-k+1):
    diff = hl[i+k-1] - hl[i]
    ans = min(ans,diff)
print(ans)


Measured memory_bytes: 13268
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// How to use 「map」
/*
  - 宣言
    map<{key_type}, {value_type}> salary;
  - 要素の挿入
    salary["Alice"] = 1000;
  - 要素の取得 O(logn)
    salary.at("Alice");
  - 要素の削除
    salary.erase("Alice");
  - キー検索
    salary.find("Alice"); -> true
    salary.find("Bob");   -> false
  - イテレーション
    for(auto& [key, value] : salary) {...}
 */
// -------------------------------------


// How to use 「lower_bound」, 「upper_bound」
/*
  vector<int> a = {1, 2, 3, 4, 5};
  auto iter1 = lower_bound(all(a), 3);  <- 第二引数「以上」の最小イテレータが返る
  auto iter2 = upper_bound(all(a), 3);  <- 第二引数「より大きい」最小のイテレータが返る
 */
// -------------------------------------


// How to use 「struct sort」
/*
  struct Person {
    string name;
    int age;

    Person(string _name, int _age) {
      name = _name;
      age = _age;
    }

    bool operator<(const Person &another) const {
      return age < another.age;
    }
  };

  vector<Person> people;
  people.pb(Person("Alice", 20));
  people.pb(Person("Bob", 19));
  people.pb(Person("John", 40));
  people.pb(Person("Chris", 30));
  sort(all(people));
 */
 // -------------------------------------

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



int main() {
  int r;
  cin >> r;
  cout << 3 * r * r << endl;

  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>

using namespace std;

int main() {
    
    int n, h;
    cin >> n >> h;
    
    vector<int> a(n, 0), b(n, 0);
    for (int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
    int maxa = *max_element(a.begin(), a.end());
    sort(b.begin(), b.end(), greater<int>());
    
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (maxa > b[i]) break;
        h -= b[i];
        ans++;
        if (h <= 0) break;
    }
    if (h > 0)
        ans += (h + maxa - 1) / maxa;
    
    cout << ans << endl;

}

Measured memory_bytes: 1152
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	String A, B;
	long[] pow = {(long)1, (long)1e1, (long)1e2, (long)1e3, (long)1e4, (long)1e5, (long)1e6, (long)1e7, (long)1e8, (long)1e9};
	
	void run() {
		Scanner sc = new Scanner(System.in);
		A = sc.next(); B = sc.next();
		int k = sc.nextInt();
		for(int i=0;i<A.length() - B.length()+1;i++) B = "0" + B;
		A = "0" + A; B = "0" + B;
		A = new StringBuilder(A).reverse().toString();
		B = new StringBuilder(B).reverse().toString();
//		debug(A, B);
		System.out.println(dfs(0, k, 0));
	}
	
	long dfs(int i, int k, int b) {
		if(A.length() == i) return 0;
		long t = 0;
		int an = A.charAt(i) - '0', bn = B.charAt(i) - '0';
		
		if( an - b >= bn) {
			long v = an - b - bn;
			t = dfs(i+1, k, 0) + v * pow[i];
		}
		else {
			long v = an - b + 10 - bn;
			t = dfs(i+1, k, 1);
			if(k > 0) t = max(t, dfs(i+1, k-1, 0));
			t += v * pow[i];
		}
		
		return t;
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

using namespace std;

void solve(int a, int b) {
  cout << ((a * b % 2) ? "Odd" : "Even") << endl;
}

int main(){
  // int 3E4
  // long 2E9
  // long long 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a, b;
  cin >> a >> b;
  solve(a, b);
  return 0;
}


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

int n,m,q;

int c[505][505];
int f[505][505];

inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<='0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}

inline void start(){
	for(int i = 1;i <= n;++i){
		f[i][i] = c[i][i];
	}
	for(int i = 1;i <= n-1;++i){
		f[i][i+1] = c[i][i+1] + f[i+1][i+1] + f[i][i];
	}
	for(int k = 2;k <= n-1;++k){
		for(int i = 1;i <= n - k;++i){
			f[i][i+k] = c[i][i+k] + f[i][i+k-1] + f[i+1][i+k] - f[i+1][i+k-1];
		}
	}
	return;
}

int main(){
	ios::sync_with_stdio(false);
	n = read(),m = read(),q = read();
	
	int l,r;
	for(int i = 1;i <= m;++i){
		l = read(),r = read();
		c[l][r]++;
	}
	
	start();
	
	for(int i = 1;i <= q;++i){
		l = read(),r = read();
		printf("%d\n",f[l][r]);
	}
	
	return 0;
}

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

class Cmondai
{
    static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(x => decimal.Parse(x)).ToArray();
        var A = line[0];
        var B = line[1];
        var C = line[2];
        var D = line[3];
        var E = line[4];
        var F = line[5];

        var waterAmax = F / (A * 100);

        decimal max = -1;
        decimal maxSugarWater =0;
        decimal maxSugar = 0;
        for (int i = 0; i <= waterAmax; ++i)
        {
            var bCount = (F - (A * i * 100)) / (B * 100);
            for (int j = 0; j <= bCount; ++j)
            {
                if (i == 0 && j == 0) continue;
                if (F < (A * i + B * j) * 100) break;
                var cCount = (F - (A * i * 100 + B * j * 100)) / C;
                for (int k = 0; k < cCount; ++k)
                {
                    if (F < (A * i + B * j) * 100 + C * k) break;
                    var dCount = (F - ((A * i * 100 + B * j * 100) + C)) / D;
                    for (int l = 0; l < dCount; ++l)
                    {
                        if (F < (A * i + B * j) * 100 + C * k + D * l) break;
                        if ((C * k + D * l) <= (i*A + j*B) * E)
                        {
                            var sugarWater = (A * i)*100 + (B * j)*100 + C * k + D * l;
                            var sugar = C * k + D * l;
                            var concentration = sugar == 0 ? 0 : sugar / sugarWater * 100;
                            if (max < concentration)
                            {
                                max = concentration;
                                maxSugarWater = sugarWater;
                                maxSugar = sugar;
                            }
                        }
                    }

                }
            }
        }
        Console.WriteLine($"{maxSugarWater} {maxSugar}");
    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) x.size()
#define MNTO(a,b) a = min(a,(__typeof__(a))(b))
#define MXTO(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define debug(x) cerr<<#x<<" is "<<x<<endl
using namespace std;

// #define int ll

const int maxn = 1e5+5;
const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"No\n"; exit(0);}


main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    ll x; cin>>x;
    ll re = 0;
    FOR(i,1, sqrt(x)){
    	if (x%i==0){
    		ll m = (x/i)-1;
    		if (x/m == x%m) {
    			re+=m;
    		}
    	}
    }
    cout<<re<<endl;
}

Measured memory_bytes: 256