akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const lint inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n,k;cin>>n>>k;
  vector<int> x(n);
  rep(i,n){
      cin>>x[i];
  }
  vector<int> pulse,minus;
  pulse.push_back(0);
  ++k;
  rep(i,n){
      if(x[i]>=0)pulse.push_back(x[i]);
      else minus.push_back(x[i]);
  }
  reverse(ALL(minus));
  vector<lint> msm(n+5,0);
  vector<lint> psm(n+5,0);
  rep(i,minus.size()){
      msm[i+1]=minus[i];//+msm[i];
  }
  rep(i,pulse.size()){
      psm[i+1]=pulse[i];//+psm[i];
  }
  lint res=inf*inf;
  rep1(i,min((int)pulse.size(),k)){
      if(k-i>minus.size())continue;
      lint buf=2*psm[i]-msm[k-i];
      buf=min(buf,psm[i]-2*msm[k-i]);
      res=min(res,buf);
  }
  cout<<res<<"\n";
  return 0;
}

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#define IF_DEBUG 0
typedef long long ll;
typedef double db;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}

const int maxn = 100050;

int n, a[maxn], p[maxn], cnt, Ans;

int main()
{
	sf("%d",&n);
	fo(i,1,n) sf("%d",&a[i]);
	fo(i,1,n) if(a[i] == i) p[++cnt] = i;
	for(int i = 1; i <= cnt; ++ i)
	{
		int j = i + 1;
		while(j <= cnt && p[j]-1 == p[j-1]) ++ j;
		-- j;
		Ans += (j-i+1)/2+((j-i+1)%2==0?0:1);
		i = j;
	}
	assert(Ans>=0);
	pf("%d\n",Ans);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using  namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1e18+1

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

long long lmc(long long a,long long b){
	return a/gcd(a,b)*b;
}

int main(){
	long long n;
	long long t,a;
	cin>>n;
	long long nowt=1,nowa=1;
	REP(i,n){
		cin>>t>>a;
		while(nowt%t!=0)nowt++;
		while(nowa%a!=0)nowa++;
		long long ma=max(nowt/t*(t+a),nowa/a*(t+a));
		nowt=ma/(t+a)*t;nowa=ma/(t+a)*a;
	}
	cout<<nowt+nowa<<endl;
}
	
	

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

int main() {
    int n;
    cin >> n;
    if (n >= 1000) cout << "ABD" << endl;
    else cout << "ABC" <<endl;
}


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

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

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


const int mod = 1e9 + 7;

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, x;
    set<int> y;
    n = 3;
    string ans = "Yes";
    rep(i, n)
    {
        cin >> x;
        y.insert(x);
    }
    if (y.size() != 2)
        ans = "No";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>




typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)
#define sz(x) int(x.size())


template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;

const int inf=1001001001;

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<int>> G(n,vector<int>()); //indexがどこからきてるか
    vector<int> deg(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;a--;b--;
        G[b].push_back(a);
        deg[a]++;
        }
    vector<int> ans(n,-1);
    queue<int> q;
    
    //rep(i,n) cout<<"degree"<<i<<","<<deg[i]<<endl;
    
    rep(i,n){
        if (deg[i]==0){
            q.push(i);
            ans[i]=0;
            //cout<<i<<endl;
        }
    }
    
    while (q.size()){
        int v=q.front();q.pop();
        for (auto u:G[v]){
            //cout<<v<<","<<u<<endl;
            ans[u]=max(ans[u],ans[v]+1);
            deg[u]--;
            if (deg[u]==0) q.push(u);
        }
    }
    
    int res=0;
    rep(i,n){
        //cout<<ans[i]<<endl;
        res=max(res,ans[i]);
    }
        
    cout<<res<<endl;
    
    
    
    return 0;
}


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

struct StQuery
{
  StQuery() : m_nLeft(0), m_nRigt(0) { }

  int m_nLeft;
  int m_nRigt;
};

void fnInput(string& rsStr, vector<StQuery>& rvoQuery)
{
  int nStrSiz, nQuerySiz;
  cin >> nStrSiz >> nQuerySiz;
  rvoQuery.resize(nQuerySiz);

  cin >> rsStr;
  
  for (StQuery& roQuery : rvoQuery)
    cin >> roQuery.m_nLeft >> roQuery.m_nRigt;
}

void fnSubStrACCnt(string sStr, const vector<StQuery>& cnrvoQuery)
{
  vector<int> vnCumlSum(sStr.size() + 1);      // 累積和

  //累積和index 0 1 2 3 4 5 6 7 8
  //文字列位置   1 2 3 4 5 6 7 8
  //文字列       A C A C T A C G
  //文字列index  0 1 2 3 4 5 6 7
  for (int nBgn = 0; nBgn < vnCumlSum.size() - 1; nBgn++)
  {
    vnCumlSum[ nBgn + 2 ] = vnCumlSum[ nBgn + 1 ];
    if (sStr[nBgn] == 'A' && sStr[nBgn + 1] == 'C')
      vnCumlSum[ nBgn + 2 ]++;
  }

 for (int i = 0; i < cnrvoQuery.size(); i++)
  {
    cout << vnCumlSum[ cnrvoQuery[i].m_nRigt ] - vnCumlSum[ cnrvoQuery[i].m_nLeft ];
    cout << endl; 
  }
}
 
int main()
{
  string sStr;
  vector<StQuery> voQuery;

  fnInput(sStr, voQuery);
  fnSubStrACCnt(sStr, voQuery);

  return 0;
}

Measured memory_bytes: 4528
#include<bits/stdc++.h>
using namespace std;
struct edge{
int to,d;
};
using Graph=vector<vector<edge>>;
int main(){
int N;
  cin>>N;
  Graph G(N);
  for(int i=0;i<N-1;i++){
  int u,v,w;
    cin>>u>>v>>w;u--; v--;
    edge e={v,w};
    G[u].push_back(e);
    edge E={u,w};
    G[v].push_back(E);
  }queue<int>que;
  que.push(0);
  vector<int>color(N,-1);
  color.at(0)=0;
  while(!que.empty()){
  int v=que.front();
    que.pop();
    for(auto e:G[v]){
    if(color.at(e.to)!=-1)
      continue;
      else{
      if(color.at(v)==1){
      if(e.d%2==0)
        color.at(e.to)=1;
        else
          color.at(e.to)=0;
      }else{
      if(e.d%2==0)
        color.at(e.to)=0;
        else
          color.at(e.to)=1;
      } que.push(e.to);
      
      }
    
    }
  
  }for(int i=0;i<N;i++)
    cout<<color.at(i)<<endl;
   return 0;
}

Measured memory_bytes: 6784
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int>pii;
int main(){
    int n,m,h,k;
    while(scanf("%d%d%d%d",&n,&m,&h,&k),n){
        vector<int>V(n);
        vector<pii>stick(m);
        for(int i=0;i<n;i++)scanf("%d",&V[i]);
        for(int i=0;i<m;i++){
            int pos,y;
            scanf("%d%d",&pos,&y);
            pos--;
            stick[i]=pii(y,pos);
        }
        sort(stick.begin(),stick.end());
        for(int i=m-1;i>=0;i--){
            int pos=stick[i].second;
            swap(V[pos],V[pos+1]);
        }
        int sum=0,Min;
        for(int i=0;i<k;i++)sum+=V[i];
        vector<int>latte(n);
        for(int i=0;i<n;i++)latte[i]=i;
        Min=sum;
        for(int i=0;i<m;i++){
            int pos=stick[i].second;
            int a=latte[pos],b=latte[pos+1];
            swap(latte[pos],latte[pos+1]);
            if(b<a)swap(a,b);
            if(a<k&&b>=k){
                Min=min(Min,sum-V[a]+V[b]);
            }
        }
        printf("%d\n",Min);
    }
    return 0;
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    int n, m;
    string s;
    cin >> n >> m >> s;
    V<int> ans;
    for(int i = n, j; i > 0; i -= j) {
        for(j = min(m, i); s[i - j] == '1';)
            j--;
        if(j == 0) {
            cout << -1 << endl;
            return 0;
        }
        ans.push_back(j);
    }
    reverse(ALL(ans));
    for(int x : ans)
        cout << x << endl;

    return 0;
}

Measured memory_bytes: 1096
while 1:
    state = [input()]
    if state[0] == 0: exit()
    for i in xrange(4): state.append(input())
    set_state = set(state)
    if set_state == set([1, 2]): result = state
    elif set_state == set([2, 3]): result = map(lambda x:x -1, state)
    elif set_state == set([1, 3]): result = map(lambda x:x - 2 if x == 3 else x + 1, state)
    else: result = [3] * 5
    for i in result: print i

Measured memory_bytes: 6352
/*
尾根(Ridge)
<問題>
JOI カルデラは景観の良さが多くの登山家に愛される美しい地形である．
特に，尾根と呼ばれる場所からの景観は絶景である．
JOI カルデラの土地は南北 H キロメートル，東西 W キロメートルの長方形である．
南北，東西に 1 キロメートルごとに JOI カルデラの土地を分け，これら H×W 個の領域を区域と呼ぶ． 
すべての区域において，その中では標高は等しい．また，異なる区域の標高は異なる．
ある区域に雨が降ると，雨水はその区域に東西南北に隣り合う最大で 4 つの区域のうち，
標高がその区域より低いような区域のすべてに流れる．そのような区域がない場合，雨水はその区域に溜まる．
他の区域から流れてきた雨水についても同様である． JOI カルデラの外側は，
外輪山の急峻な崖に囲まれているため，雨水が JOI カルデラの外に流れ出すことはない．
ある区域について，その区域のみに雨が降った場合，
最終的に複数の区域に雨水が溜まるとき，その区域を尾根と呼ぶ．
絶景をこよなく愛する登山家たちのために，尾根の区域がいくつあるかを求めるプログラムを作成せよ．
<入力>
入力は 1 + H 行からなる．
1 行目には 2 個の整数 H, W (1 ≦ H ≦ 1000, 1 ≦ W ≦ 1000) が
空白を区切りとして書かれており，JOI カルデラが南北に H キロメートル，東西に W キロメートルにわたることを表す．
続く H 行にはそれぞれ W 個の整数が空白を区切りとして書かれており，標高の情報を表す．
 H 行のうちの i 行目の j 番目 (1 ≦ i ≦ H, 1 ≦ j ≦ W) の
 整数 Mi,j (1 ≦ Mi,j ≦ H×W) は，JOI カルデラの北から i 行目，
 西から j 列目の区域の標高を表す． (i,j) ≠ (k,l) なら，Mi,j ≠ Mk,l を満たす．
<出力>
尾根の区域の個数を 1 行で出力せよ．
*/
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;
int map[1002][1002];
int dat[1002][1002];
int x[1000001],y[1000001];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(void)
{
    int mx,my;
	cin>>mx>>my;
	for(int i=0;i<mx+2;i++){
		for(int j=0;j<my+2;j++){
			map[i][j]=1000000000,dat[i][j]=0;
		}
	}
	for(int i=0;i<mx;i++){
		for(int j=0;j<my;j++){
			cin>>map[i+1][j+1];
		}
	}
	for(int i=1;i<=mx;i++){
		for(int j=1;j<=my;j++)
		{
			x[map[i][j]]=i,y[map[i][j]]=j;
		}
	}
	int c;
	for(int i=1;i<=mx*my;i++){
		int r=0;
		for(int j=0;j<4;j++){
			int a=x[i]+dx[j],b=y[i]+dy[j];
			if(map[a][b]<i)
			{
				if(r==0)r=dat[a][b];
				else if(r!=dat[a][b])r=-1;
			}
		}
		if(r==0)dat[x[i]][y[i]]=i;
		else dat[x[i]][y[i]]=r;
		if(r==-1)c++;
	}
	cout<<c<<endl;
	return 0;
}


Measured memory_bytes: 18764
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, ii> iii;
int MOD = 10;
const ld E = 1e-9;
#define null NULL
#define ms(x) memset(x, 0, sizeof(x))
#ifndef LOCAL
#define endl "\n"
#endif
#ifndef LONG_LONG_MAX
#define LONG_LONG_MAX LLONG_MAX
#endif
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _read(x) freopen(x, "r", stdin)
#define _write(x) freopen(x, "w", stdout)
#define files(x) _read(x ".in"); _write(x ".out")
#define filesdatsol(x) _read(x ".DAT"); _write(x ".SOL")
#define output _write("output.txt")
#define input _read("input.txt")
#define prev time_prev
#ifndef M_PI
#define M_PI acos(-1)
#endif
#define remove tipa_remove
#define next tipa_next
#define left tipa_left
#define right tipa_right
#define mod % MOD
#define y1 hello_world
unsigned char ccc;
bool _minus = false;
template<typename T>
inline T sqr(T t) {
	return (t * t);
}
inline void read(ll &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n')
			break;
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
}
inline bool read(int &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n') {
			if (ccc == '\n')
				return true;
			break;
		}
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
	return false;
}
char wwww[19];
int kkkk;
inline void write(ll y) {
	long long x = y;
	kkkk = 0;
	if (x < 0) {
		putchar('-');
		x *= -1;
	}
	if (!x)
		++kkkk, wwww[kkkk] = '0';
	else
		while (x) {
			++kkkk;
			wwww[kkkk] = char(x % 10 + '0');
			x /= 10;
		}
	for (int i = kkkk; i >= 1; --i)
		putchar(wwww[i]);
}
#ifdef LOCAL
#define DEBUG
#endif
#ifdef DEBUG
#define dbg if(1)
#else
#define dbg if(0)
#endif

int main() {
	sync;
	srand(time(NULL));
	cout.precision(10);
	cout << fixed;
#ifdef LOCAL
	input;
#else

#endif

	int n;
	cin >> n;

	vector<int> vec(n);
	vector<int> e(13);
	e[0] += 2;
	e[12] += 1;
	for(int i = 0; i < n; i++){
		cin >> vec[i];
		int d = vec[i];
		if(d > 12){
			d = 24 - d;
		}
		e[d]++;
	}

	for(int i = 0; i <= 12; i++){
		if(e[i] > 2){
			cout << 0 << endl;
			return 0;
		}
	}
	if(n > 12){
		cout << 1 << endl;
		return 0;
	}
	int ans = 0;
	for(int mask = 0; mask < (1 << n); mask++){
		vector<int> v;
		v.push_back(0);
		for(int j = 0; j < n; j++){
			if(mask & (1 << j)){
				v.push_back(24 - vec[j]);
			}else{
				v.push_back(vec[j]);
			}
		}
		sort(v.begin(), v.end());
		int res = 24;
		for(int i = 0; i < (int) v.size(); i++){
			int r = abs(v[i] - v[(i + 1) % v.size()]);
			res = min(res, min(r, 24 - r));
		}
		ans = max(ans, res);
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
s=input()
n=len(s)
ans=0
k=pow(2,n-1)
i=0
while i<k:
    m=i
    sum=int(s[n-1])
    x=10
    p=n-2
    while p>-1:
        if m%2==0:
            sum+=int(s[p])*x
            x*=10
        else:
            sum+=int(s[p])
            x=10
        m=m//2
        p-=1
    ans+=sum
    i+=1
print(ans)


Measured memory_bytes: 3064
#coding:utf-8
a,b = map(int,input().split())

if a > 0 and b > 0:
    print('Positive')
elif a < 0 and b > 0:
    print('Zero')
elif a < 0 and b < 0 and (b-a+1) % 2 == 0:
    print('Positive')
else:
    print('Negative')

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

int main()
{
    string str;
    // getline(cin, str);

    array<int, 26> arr{};

    // for (long unsigned int i = 0; i < str.length(); i++) {
    //     if ('a' <= str[i] && str[i] <= 'z') {
    //         arr[str[i] - 'a']++;
    //     } else if ('A' <= str[i] && str[i] <= 'Z') {
    //         arr[str[i] - 'A']++;
    //     }
    // }

    while (getline(cin, str))
    {
        for (long unsigned int i = 0; i < str.length(); i++)
        {
            if ('a' <= str[i] && str[i] <= 'z')
            {
                arr[str[i] - 'a']++;
            }
            else if ('A' <= str[i] && str[i] <= 'Z')
            {
                arr[str[i] - 'A']++;
            }
        }
    }

    for (int i = 0; i < 26; i++)
    {
        cout << static_cast<char>('a' + i) << " : " << arr[i] << endl;
    }
    return 0;
}


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

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

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=1e9+7;
const int N=2e5+5;

int main(){
    string S; cin >> S;
    cout << S[0] << S[1] << S[2] << endl;
    return 0;
}


Measured memory_bytes: 3624
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}


fn f(s: &Vec<i32>) -> bool{

    


    return true;
}

use std::iter::Iterator;
use std::cmp;


fn main() {
    input! {
        r : i32,
    }

    println!("{}", 3 * r * r);


}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
int main()
{   int n;
    scanf("%d",&n);
    char s[20001];
    scanf("%s",s);
    int l=strlen(s);
    for(int i=0;i<l;i++){
        printf("%c",(s[i]-'A'+n)%26+'A');
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

typedef long long ll;

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>
#define PLL pair<ll, ll>
#define VI vector<int>
#define VII vector<VI>

using namespace std;


const int INF = 1e9;
const int mru = 1, mu = 1 << 1, ml = 1 << 2, mld = 1 << 3;

int ToBit(int a, int b, int c, int d) {
	return a + (b << 1) + (c << 2) + (d << 3);
}

int H, W;
int stl[1005][1005], dp[1005][1005][1<<4];
int main() {
	cin >> H >> W;
	rep(i, H) rep(j, W) {
		char c;
		cin >> c;
		stl[i + 1][j + 1] = (c == '.') ? 0 : (c - '0');
	}

	rep(i, H) rep(j, W) rep(k, 1<<4) dp[i+1][j+1][k] = INF;
	dp[1][1][0] = 0;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			for (int bit = 0; bit < (1 << 4); bit++) {
				if (dp[i][j][bit] == INF) continue;
				bool isru = bit & mru;
				bool isu = bit & mu;
				bool isl = bit & ml;
				bool isld = bit & mld;

				int vu = (isu ? 0 : stl[i - 1][j]);
				int vl = (isl ? 0 : stl[i][j-1]);
				int vd = stl[i+1][j];
				int vr = stl[i][j+1];

				int nbit, nco;
				if (i < H) {
					nco = vd + vr + vu;
					nbit = ToBit(1, 1, isld, 0);
					dp[i + 1][j][nbit] = min(dp[i + 1][j][nbit], dp[i][j][bit] + nco);

					nco = vd + vr + vl;
					nbit = ToBit(1, 1, isld, 0);
					dp[i + 1][j][nbit] = min(dp[i + 1][j][nbit], dp[i][j][bit] + nco);

					nco = vd + vu + vl;
					nbit = ToBit(0, 1, isld, 0);
					dp[i + 1][j][nbit] = min(dp[i + 1][j][nbit], dp[i][j][bit] + nco);
				}
				if (j < W) {
					nco = vr + vu + vl;
					nbit = ToBit(0, isru, 1, 0);
					dp[i][j+1][nbit] = min(dp[i][j+1][nbit], dp[i][j][bit] + nco);

					nco = vr + vu + vd;
					nbit = ToBit(0, isru, 1, 1);
					dp[i][j + 1][nbit] = min(dp[i][j + 1][nbit], dp[i][j][bit] + nco);

					nco = vr + vl + vd;
					nbit = ToBit(0, isru, 1, 1);
					dp[i][j + 1][nbit] = min(dp[i][j + 1][nbit], dp[i][j][bit] + nco);
				}
			}
		}
	}
	int ans = INF;
	rep(i, 1 << 4) ans = min(ans, dp[H][W][i]);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 69828
H, W, N = map(int, input().split())
Ans = [0] * 10
Ans[0] = (H-2)*(W-2)
from collections import defaultdict
G = defaultdict(int)
for i in range(N):
    a, b = map(int, input().split())
    for j in range(-1, 2):
        for k in range(-1, 2):
            if 1 < a+j < H and 1 < b+k < W:
                G[(a+j, b+k)] += 1
for k, v in G.items():
     if 1 < k[0] < H and 1 < k[1] < W:
        Ans[v] += 1
        Ans[0] -= 1
for a in Ans:
    print(a)


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

int main(void)
{
    int k;
    string s;
    cin >> k >> s;

    if(s.size() <= k){
        cout << s << endl;
    }else{
        rep(i, k){
            cout << s.at(i);
        }
        cout << "..." << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll N, K, x;
  cin >> N >> K;
  set<ll> s;
  for (auto i = 0; i < 10; i++) s.insert(i);
  for (auto i = 0; i < K; i++) {
    cin >> x;
    s.erase(x);
  }

  while (true) {
    x = N;
    ll digit = 1;
    while (x > 0) {
//      cout << "N=" << N << " x=" << x << " digit=" << digit << endl;
      if (s.find(x % 10) == s.end()) {
        N = (x+1) * digit;
        break;
      }
      digit *= 10;
      x /= 10;
    }
    if (x == 0) break;
  }

  cout << N << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int t=1;
	//cin >> t;
	while(t--){
		string s;
      int maxi=0,count=0,i=0;
      cin >> s;
      for(i=0;i<3;i++){
      	if(s[i]=='R'){count++;}
        else{count=0;}
        maxi = max(maxi,count);
      }
      cout << maxi << endl;
	}
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++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 irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n;cin>>n;
  vs s(n);
  rep(i,n){
    cin>>s[i];
  }
  int m;cin>>m;
  vs t(m);
  rep(i,m)cin>>t[i];
  
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  
  int b=0;
  int ans=0;
  while(b<n){
    int tmp=1;
    while(b<n-1){
      if(s[b]==s[b+1]){
        b++;
        tmp++;
      }else{
        break;
      }
    }
    rep(i,m){
      if(s[b]==t[i])tmp--;
    }
    if(ans<tmp)ans=tmp;
    b++;
  }
  cout(ans);
  return 0;
}

Measured memory_bytes: 256
import math

n, d = (int(x) for x in input().split())

ans = 0

for i in range(n):
    query = list(map(int, input().split()))

    # print(query[0])
    # print(query[1])

    # print(query[0] * query[0])
    # print(query[1] * query[1])

    # print('root')
    # print(math.sqrt(query[0] * query[0] + query[1] * query[1]))

    root = math.sqrt(query[0] * query[0] + query[1] * query[1])

    if root <= d :
        ans += 1

print(ans) 



Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<62)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin>>n;
    vl d(n);
    cin>>d;
    ll sum=0;
    rep(i,n){
        range(j,i+1,n){
            sum+=d[i]*d[j];
        }
    }
    
    puta(sum);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
using namespace std;
int main(void){
  int n;
  long long res=0,calc0=2,calc1=1;
  cin >> n;
  if(n!=1){
    for(int i=2;i<=n;i++){
      res=calc0+calc1;
      calc0=calc1;
      calc1=res;
    }
    cout << res << "\n";
  }
  else{
    cout << calc1 << "\n";
  }
  return 0;
}


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

using namespace std;

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

    #ifndef ONLINE_JUDGE
//        freopen("in.txt", "r", stdin);
//        freopen("out.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    string s; cin>>s;
    bool coffe = s.size() >= 5 && (s[2] == s[3]) && (s[4] == s[5]);
    cout<<(coffe ? "Yes\n" : "No");

    return 0;
}


Measured memory_bytes: 256
from queue import deque
k = int(input())
que = deque(range(1,10))

for _ in range(k):
    x = que.popleft()
    if not x % 10 == 0:
        # 123: 10*123 + 123 % 10 = 1233
        que.append(10*x+(x%10)-1)
    que.append(10*x+(x%10))
    if not x %10 == 9:
        que.append(10*x+(x%10)+1)
print(x)

Measured memory_bytes: 18840
n=list(map(int, input().split()))
a=[]
b=[]
for case in n:
    if len(a)==0:
        a.append(case)
    elif case==a[0]:
        a.append(case)
    else:
        b.append(case)
if len(a)<len(b):
    print(a[0])
else:
    print(b[0])

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

//def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

    ll n, k;
    cin >> n >> k;
    ll ans = n % k;
    if (ans > k / 2) {
        ans = k - ans;
    }

    out(ans);

    return 0;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
ll mod_div(ll a,ll b){
  ll tmp=MOD-2,c=b,ret=1;
  while(tmp>0){
    if(tmp&1){
      ret*=c;ret%=MOD;
    }
    c*=c;c%=MOD;tmp>>=1;
  }
  return a*ret%MOD;
}
 
#define MAX_K 200100
vector<ll> kaijo(MAX_K);
ll combination(ll n, ll r){
  if(n<r||n<0||r<0)
    return 0;
  if(kaijo[0]!=1){
    kaijo[0]=1;
    for(ll i=1;i<MAX_K;i++)kaijo[i]=(kaijo[i-1]*i)%MOD;
  }
  ll ret=kaijo[n];
  long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
  return mod_div(ret,tmp);
}

void modadd(ll &a, ll b){
  a+=b;
  a%=MOD;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vector<ll>prime;
  prime.pb(2);
  for(int i=3;i<=sqrt(m);i+=2){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++)
      if(i%j==0)flag=false;
    if(flag)prime.pb(i);
  }
  ll num=m;
  ll cnt[prime.size()+10]={};
  for(int i=0;i<prime.size();i++){
    while(num%prime[i]==0){
      cnt[i]++;
      num/=prime[i];
    }
  }
  //cout<<num<<endl;
  if(num>1)cnt[prime.size()]++;
  ll ans=1;
  for(int i=0;i<=prime.size();i++){
    // if(cnt[i])cout<<prime[i]<<" "<<cnt[i]<<endl;
    ans*=combination(cnt[i]+n-1,cnt[i]);
    ans%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}

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

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
		if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}
typedef pair<LL, LL> pii;

const int N = 1e6 + 100;
int a[N];
int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i ++) scanf("%d", &a[i]);
	int cur = 1;
	LL ans = 0;
	for(int i = 1; i <= n; i ++) {
		ans += (a[i] - 1) / cur;
		if(cur == 1 || cur == a[i]) cur ++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
import math
while 1:
    a,d,n = list(map(int,input().split()))
    if n ==0: break
    count =0
    i =0
    while 1:
         a_i = a + i*d
         flag =1
         for j in range(2,int(math.sqrt(a_i)) +1):
             if a_i % j==0:
                 flag =0
                 break
         if flag ==1 and a_i !=1:count = count+1
         i= i + 1
         if count == n :
             print(a_i)
             break

Measured memory_bytes: 5660
import itertools
H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]

ANS = [['#'] * W for _ in range(H)]
nxt = [-1,0,1]
for r in range(H):
  for c in range(W):
    cnt = 0
    if S[r][c] == '#':
      continue
    for x,y in itertools.product(nxt,repeat=2):
      if x == 0 and y == 0:
        continue
      if not 0 <= r+x < H:
        continue
      if not 0 <= c+y < W:
        continue
      if S[r+x][c+y] == '#':
        cnt += 1
    ANS[r][c] = cnt

for i in range(H):
  print("".join(map(str,ANS[i])))

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
typedef long long ll;
using namespace std;
int main() {
    ll n = 0, a = 0, b = 0;
    cin >> n >> a >> b;
    if(a == b) {
        cout << 0 << endl;
        return 0;
    }
    ll sa = min(a, b);
    ll sb = max(a, b);
    ll res = min(sb - 1, n - sa);
    ll d = sb - sa - 1;
    if(d % 2 == 1) {
        res = min(res, (d + 1) / 2);
    } else {
        if(sa - 1 < n - sb) {
            // to left
            ll l = sa - 1;
            ll s1 = 1;
            ll s2 = sb - l;
            ll d1 = s2 - s1;
            res = min(res, l + (d1 + 1) / 2);
        } else {
            // to right
            ll r = n - sb;
            ll s1 = sa + (n - sb);
            ll s2 = n;
            ll d2 = s2 - s1;
            res = min(res, r + (d2 + 1) / 2);
        }
    }
    
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>a>>b;
    Cout((a-1)*(b-1));
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
ll n,m,x,y,z;
int main(){
    cin>>n>>m>>x>>y;
    lol(i,n){
	cin>>z;
	x=max(x,z);
    }
    lol(i,m){
	cin>>z;
	y=min(y,z);
    }
    cout<<(x>=y?"War":"No War")<<endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)

	x := make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i])
	}
	y := make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&y[i])
	}

	pn := 3
	for p := 1; p <= pn; p++ {
		var d float64
		for i := 0; i < n; i++ {
			d += math.Abs(math.Pow((x[i] - y[i]), float64(p)))
		}
		d = math.Pow(d, 1/float64(p))
		fmt.Println(d)
	}

	var d float64
	for i := 0; i < n; i++ {
		di := math.Abs(x[i] - y[i])
		if d < di {
			d = di
		}
	}
	fmt.Println(d)

}




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

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


using namespace std;

int main(void){
    ll N, left=1,right;
    ll status[100000];
    cin>>N;
    right=N+1;
    MEMSET(status, 0);
    cout<<0<<endl<<flush;
    string s;
    cin>>s;
    if(s=="Vacant") return 0;
    if(s=="Male") status[1]=1;
    else status[1]=2;
    status[N+1]=status[1];
    while(true){
        ll next=(right-left)/2;
        //cout<<right<<sp<<left<<sp<<next<<endl<<flush;
        if(right-left<=1){
            cout<<right-1<<endl<<flush;
            cin>>s;
            if(s=="Vacant") return 0;
            cout<<left-1<<endl<<flush;
            cin>>s;
            if(s=="Vacant") return 0;
        }
        
        cout<<left+next-1<<endl<<flush;
        cin>>s;
        if(s=="Vacant") return 0;
        if(s=="Male") status[left+next]=1;
        else status[left+next]=2;
        if(next%2==0){
            if(status[left+next]==status[left])
                left+=next;
            else right=left+next;
        }
        else{
            if(status[left+next]==status[left])
                    right=left+next;
            else left+=next;
        }
        
    }
    return 0;
}

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

int main() {
	int n,d;
	cin>>n>>d;
	int cnt=0;
	for(int i=0;i<n;i++){
		long long x,y;
		cin>>x>>y;
		int dis=0;
		if(sqrt(x*x+y*y)<=d) cnt++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 3684
def solve(a, b, c, x, y):
    i = div(x, 2)
    j = div(y, 2)
    m = a * i + b * j

    for k in range(1, max(x, y) + 1):
        i = div(x - k, 2)
        j = div(y - k, 2)
        m = min(m, a * i + b * j + c * k)
    
    return m


def div(x, y):
    if x <= 0:
        return 0

    n, r = divmod(x, y)
    if r != 0:
        return n + 1
    else:
        return n


def main():
    a, b, c, x, y = map(int, input().split())
    print(solve(a, b, c, x * 2, y * 2))

main()

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        ll L = 1000000000ll;
        ll S;
        cin >> S;

        ll x1 = 1, y1 = 0;
        ll x2 = 0, y2 = L;
        ll x3 = S / L + 1, y3 = S % L;
        if (S == 1000000000000000000ll) {
            x1 = 0, y1 = 0;
            x2 = L, y2 = 0;
            x3 = 0, y3 = L;
        }

        cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;


    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if ((a == b && b == c) || (a != b && b != c && c != a)) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	long long int a[210000],k,b,c,n,i,sum=1,temp;

scanf("%lld%lld",&n,&k);
	for(i=1;i<=n;i++){
scanf("%lld",&a[i]);

	}
  for(i=1;i<=k;i++){
  sum=sum*a[i];
  }
  temp=sum;
  
  for(i=k+1;i<=n;i++){
  sum=sum/a[i-k]*a[i];
    //printf("%lld %lld\n",sum, temp);
    if(a[i]>a[i-k]){
    printf("Yes\n");
    }
    else{
    printf("No\n");
    }
    temp=sum;
  }
	
return 0;
}


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

int main(){
  int n; cin >> n;
  char S[30005];
  scanf("%s", S);
  
  int ans = 0;
  rep(i,1000){
    int A = i / 100;
    int B = i / 10 % 10;
    int C = i % 10;
    bool a = false;
    bool b = false;
    rep(j,n){
      if (a){
        if (b){
          if (S[j] - '0' == C){
            ans++;
            break;
          }
        } else if (S[j] - '0' == B) b = true;
      } else if (S[j] - '0' == A) a = true;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] arr = br.readLine().split(" ");
        int A = Integer.parseInt(arr[0]);
        int B = Integer.parseInt(arr[1]);

        if (A == B) {
            out.println(A + B);
        } else {
            out.println(2 * Math.max(A, B) - 1);
        }
        out.close();
    }
}


Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		String str = s.nextLine();
		String[] l = str.split(" ");
		long N = Long.parseLong(l[0]);
		long P = Long.parseLong(l[1]);
		long tempP = P;
		long startP = Math.round(Math.pow(P, 1.0/N))+1;
		for (long j = startP; j > 0; j--) {
			tempP = P;
			if (Math.floorMod(tempP, Math.round(Math.pow(j, N))) == 0L) {
				System.out.println(j);
				return;
			}
		}
	}
}

Measured memory_bytes: 23764
import itertools
c = [list(map(int, input().split())) for _ in range(3)]

ans = True

for a, b in itertools.combinations(range(3), 2):
    x = c[0][a] - c[0][b]
    for j in range(1, 3):
        if x != c[j][a] - c[j][b]:
            ans = False

for a, b in itertools.combinations(range(3), 2):
    x = c[a][0] - c[b][0]
    for j in range(1, 3):
        if x != c[a][j] - c[b][j]:
            ans = False

if ans:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
using namespace std;

struct Status {
  int t; // [minute]
  string name;
};

int getTime( string s ) {
  int m = ( s[ 0 ] - '0' ) * 600 + ( s[ 1 ] - '0' ) * 60;
  m += ( ( s[ 3 ] - '0' ) * 10 + s[ 4 ] - '0' );
  return m;
}

int main () {
  int n, t;
  int prevArr;
  vector<Status> v;
  cin >> n >> t;
  for( int i = 0; i < n; i++ ) {
    string dt, dep, at, arr;
    cin >> dt >> dep >> at >> arr;
    if( i != 0 ) {
      int tt = getTime( dt ) - prevArr;
      if( tt >= t ) {
        Status s;
        s.t = tt;
        s.name = dep;
        v.push_back( s );       
      }
    }
    prevArr = getTime( at );
  }
  int len = v.size();
  cout << len << endl;
  for( int i = 0; i < len; i++ ) {
    cout << v[ i ].name << " " << v[ i ].t << endl;
  } 
  return EXIT_SUCCESS;
}

Measured memory_bytes: 1220
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val squared = LazyList.from(0)
    .map(i => i * i)
    .takeWhile(_ <= 10 * 10 * 200)
    .toIndexedSeq
  val N, D = sc.nextInt()
  val pairs = List.fill(N)(List.fill(D)(sc.nextInt())).combinations(2)
  val count = pairs.count { case Seq(r, l) =>
    val squaredDistance = r.zip(l).map { case (y, z) => (y - z) * (y - z) }.sum
    squared.contains(squaredDistance)
  }
  println(count)
}


Measured memory_bytes: 55972