akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 400010;

int n, m;
int h[N], e[M], w[M], ne[M], idx;
int q[M];
int dist[N];
bool st[N];

void add(int a, int b, int c)
{
	e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx ++ ;
}

bool bfs(int u)
{
	int hh = 0, tt = -1;
	q[ ++ tt] = u;
	dist[u] = 0;
	st[u] = true;
	
	while (hh <= tt)
	{
		int t = q[hh ++ ];
		
		for (int i = h[t]; ~i; i = ne[i])
		{
			int j = e[i];
			if (!st[j])
			{
				q[ ++ tt] = j;
				st[j] = true;
				dist[j] = dist[t] + w[i];
			}
			else if (dist[j] != dist[t] + w[i]) return false;
		}
	}
	return true;
}

int main()
{
	memset(h, -1, sizeof h);
	scanf("%d%d", &n, &m);
	
	for (int i = 0; i < m; i ++ )
	{
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		add(a, b, c), add(b, a, -c);
	}
	
	for (int i = 1; i <= n; i ++ )
		if (!st[i] && !bfs(i))
		{
			puts("No");
			return 0;
		}
	puts("Yes");
    return 0;
}

Measured memory_bytes: 9636
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ll long long

const int N = 1e5;
const int inf = 1e9;
const int mod = 1e9 + 7;

struct point {
  int x, y;
} s, e;
string ans;

int main() {
  #ifdef wws
      freopen("in", "r", stdin);
  #endif
  cin >> s.x >> s.y;
  cin >> e.x >> e.y;
  for (int i = 0;i < e.y - s.y;i++) ans += 'U';
  for (int i = 0;i < e.x - s.x;i++) ans += 'R';
  for (int i = 0;i < e.y - s.y;i++) ans += 'D';
  for (int i = 0;i < e.x - s.x;i++) ans += 'L';
  ans += 'L';
  for (int i = 0;i <= e.y - s.y;i++) ans += 'U';
  for (int i = 0;i <= e.x - s.x;i++) ans += 'R';
  ans += 'D';
  ans += 'R';
  for (int i = 0;i <= e.y - s.y;i++) ans += 'D';
  for (int i = 0;i <= e.x - s.x;i++) ans += 'L';
  ans += 'U';
  cout << ans << endl;
  //cout << ans.size() << endl;
  return 0;
}

Measured memory_bytes: 384
#include <utility>
#include <sstream>
#include <cstdio>
#include <string>
#include <set>
#include <iostream>
using namespace std;
char s[1002][1002];
int dp[1002][1002][3];
int main(){
	
	int m,n,k;
	scanf("%d%d%d",&m,&n,&k);

	for(int i = 0;i < m;i++){
		scanf("%s",s[i]);
	}
	for(int i = 1;i <= m;i++){
		for(int j = 1;j <= n;j++){
			for(int l = 0;l < 3;l++){
				dp[i][j][l] = dp[i-1][j][l] + dp[i][j-1][l] - dp[i-1][j-1][l];
			}
			switch(s[i-1][j-1]){
				case 'J':
					dp[i][j][0]++;
					break;
				case 'O':
					dp[i][j][1]++;
					break;
				case 'I':
					dp[i][j][2]++;
					break;
			}
		}
	}
	while(k--){
		int a,b,c,d;

		scanf("%d%d%d%d",&a,&b,&c,&d);
		int ans[3];
		for(int i = 0;i < 3;i++){
			ans[i] = dp[c][d][i] + dp[a-1][b-1][i] - dp[a-1][d][i] - dp[c][b-1][i];
		}
		printf("%d %d %d\n",ans[0],ans[1],ans[2]);

	}

	return 0;

}


Measured memory_bytes: 13916
/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int long long  //comment it out when MLE
# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//# define m 163577857
//# define MOD 163577857
# define pi acos(-1)
# define fi first
# define se second
#define REP(i,n) for (int i = 1; i <= n; i++)
const ll mod = 1000000007;
const int K = 2;
//typedef vector<vector<int> > matrix;
int add(int a, int b,int mod) {
    a%=mod;
    b%=mod;
	a += b;
	if (a >= mod) a -= mod;
	if(a<0)
    {
        a += mod;
        a %= mod;
    }
	return a;
}

int mul(ll a, int b,int mod) {
    a%=mod;
    b%=mod;
	a *= b;
	return a % mod;
}
int po(int a,int b,int mod)
{
    if(b==0)
        return 1;
    if(b%2==0)
        return po(mul(a,a,mod),b/2,mod);
    return mul(a,po(mul(a,a,mod),(b-1)/2,mod),mod);
}


ll fact[1000003];
ll inv[1000003];

void fact0()
{
	int i,j;
	fact[0]=1;
	for(i=1;i<=200000;i++)
	{
		fact[i]=i*fact[i-1]%mod;
	}
	inv[0]=1;
	inv[1]=1;
	ll p=mod;
	for (i=2; i<=200000; i++)
		inv[i] = (p - (p/i) * inv[p%i] % p) % p;

	for(i=2;i<=200000;i++)
	{
		inv[i]*=inv[i-1];
		inv[i]%=mod;
	}
}
 int n,m,x;
 int co[20],ar[20][20];
 bool ch=false;


signed main()
{
    gok
   //fact0();


 cin>>n>>m>>x;

for(int i=0;i<n;i++)
{
    cin>>co[i];
    for(int j=0;j<m;j++)
        cin>>ar[i][j];
}
int an=1e18;
for(int i=1;i<(1<<n);i++)
{
    int fr[m]={0};
    int cc=0;
    for(int j=0;j<n;j++)
    {
        if(i&(1<<j))
        {
            for(int k=0;k<m;k++)
            {
                fr[k] += ar[j][k];
            }
            cc += co[j];
        }
    }
    bool chh=true;
    for(int k=0;k<m;k++)
    {
        if(fr[k]<x)
            chh=false;
    }
    if(chh)
    {
        ch=true;
        an = min(an,cc);
    }
}
if(ch)
    cout<<an;
else
    cout<<-1;





















 return 0;
}


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

int a[20], n, res;
const int INF = 1000001;

int abs(int va) {
    return va < 0 ? -va : va;
}

void dfs(int i, int a_sum, int b_sum) {
    if (i==n) {
        res = min(abs(a_sum - b_sum), res);
    } else {
        dfs(i+1, a_sum+a[i], b_sum);
        dfs(i+1, a_sum, b_sum+a[i]);
    }
}

int main() {
    while (cin >> n && n) {
        for (int i=0; i<n; i++) {
            cin >> a[i];
        }
        res = INF;
        dfs(0, 0, 0);
        cout << res << endl;
    }
}

Measured memory_bytes: 1160
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
ll inf = (1LL << 50);

//bool operator< (pint a, pint b) {
	//return a.second < b.second;

//}



ll gcd(ll a, ll b) {

	if (b == 0)
		return a;

	return gcd(b, a % b);


}

ll max(ll a, ll b) {
	if (a < b) {
		return b;
	}
	else
		return a;

}

ll min(ll a, ll b) {
	if (a < b)
		return a;

	return b;
}




pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

vector<pint> list;


bool compare(pint l, pint r) {

	return l.second < r.second;
}


int main() {
	ll N, H;
	ll a, b;
	ll m = 0;
	cin >> N >> H;

	rep(i, N) {
		cin >> a >> b;

		list.push_back({ a, b });
		
		m = max(a, m);
	}


	

	sort(list.begin(), list.end(), compare);

	

	

	ll nturn = 0;

	
		for (int i = list.size() - 1; i >= 0; i--) {
			if (list[i].second >= m) {
				H -= list[i].second;
				nturn += 1;
			}
		
			if (H <= 0 || list[i].second < m)
				break;



		}
	

	if (H > 0) {

		nturn += H / m;

		if (H % m != 0)
			nturn += 1;

	}

	cout << nturn << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

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

const int mod = 1e9 + 7;

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

  ll mx = 0;
  rep(i, n) mx = max(mx, a[i]);
  int l = 0;
  while (mx > 0) {
    mx /= 2;
    ++l;
  }

  vector<ll> d(l, 0);
  rep(i, n) {
    rep(j, l) { d[j] += a[i] >> j & 1; }
  }

  ll ans = 0;
  rep(i, l) {
    ll x = 1;
    rep(j, i) {
      x *= 2;
      x %= mod;
    }
    ans += (d[i] * (n - d[i]) % mod) * x % mod;
    ans %= mod;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
double pi=3.141592653589793;

const int MOD = 1000000007;

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

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

ll N,M;
vector<ll>A(106);

void batten(ll i,ll k){
	if(i==N)return;
	if((A[i]%k)>(A[i+1]%k)){
		swap(A[i],A[i+1]);
		batten(i+1,k);
		return;
	}else{
		batten(i+1,k);
		return;
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll N;
	cin>>N;
	vector<ll>A(N);
	vector<ll>sum(N+1,0);
	for(int i=0;i<N;i++){
		cin>>A[i];
		sum[i+1]=sum[i]+A[i];
	}
	
	sort(sum.begin(),sum.end());
	sum.push_back(INF);
	ll num=1;
	ll ans=0;
	for(int i=0;i<=N;i++){
		if(sum[i]==sum[i+1])num++;
		else{
			if(num>=2)ans+=num*(num-1)/2;
			num=1;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 6016
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int vis[N];
vector<int>e[N],p1,p2;
deque<int>dq;
int main()
{
	int n,m,a,b,res,k;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&a,&b);
		e[a].push_back(b);
		e[b].push_back(a);
	}
	int r=1;
	vis[r]=1;
	dq.push_back(r);
	do
	{
		res=0;
		k=dq.front();
		vis[k]=1;
		p1.push_back(k);
		for(int i=0;i<e[k].size();i++)
		{
			if(!vis[e[k][i]])
			{
				dq.push_front(e[k][i]);
				res=1;
				break;
			}
		}
	}while(res);
	do
	{
		res=0;
		k=dq.back();
		vis[k]=1;
		p2.push_back(k);
		for(int i=0;i<e[k].size();i++)
		{
			if(!vis[e[k][i]])
			{
				dq.push_back(e[k][i]);
				res=1;
				break;
			}
		}
	}while(res);
	printf("%d\n",p1.size()+p2.size()-1);
	for(int i=p1.size()-1;i>=0;i--)
		printf("%d ",p1[i]);
	for(int i=1;i<p2.size();i++)
		printf("%d ",p2[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 7544
import sys
input = sys.stdin.readline
n = int(input())
a = tuple(map(int,input().split()))

dp = [[0]*n for i in range(n)]
if n %2 == 0:
    for i in range(n):
        dp[i][i] = -a[i]
else:
    for i in range(n):
        dp[i][i] = a[i]

for i in range(1,n):
    for j in range(n-i):
        if (n-i)%2 == 1:
            dp[j][i+j] = max(dp[j][i+j-1]+a[i+j],dp[j+1][i+j]+a[j])
        else:
            dp[j][i+j] = min(dp[j][i+j-1]-a[i+j],dp[j+1][i+j]-a[j])
print(dp[0][n-1])

Measured memory_bytes: 114908
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	string X;
	void ans() {
		cin >> X;
		string st;
		st.push_back(X[0]);
		FOR(i, 1, X.size()) {
			if (st.empty()) st.push_back(X[i]);
			else {
				char s = *(--st.end());
				if (s == 'S' && X[i] == 'T') st.pop_back();
				else st.push_back(X[i]);
			}
		}
		cout << st.size() << "\n";
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	question q;
	q.ans();
	
	return 0;
}



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

int gcd(int n, int m){
	if(m == 0){
		return n;
	}
	if(n < m){
		return gcd(m, n);
	}
	return gcd(m, n%m);
}

int main(){
	int i , j;
	cin >> i >> j;
	cout << gcd(i, j) << endl;
}


Measured memory_bytes: 3124
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#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()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int64 gcd(int64 a, int64 b) {
    return b != 0 ? gcd(b, a % b) : a;
}

int64 lcm(int64 a, int64 b) {
		return a / gcd(a, b) * b;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int h,n; cin >> h >> n;
		vector<int64> dp(h + 1, INF);
		dp[0] = 0;
		for (int i = 0; i < n; ++i) {
				int a, b; cin >> a >> b;
				for (int j = 0; j < h; ++j) {
				//モンスターのhpをj減らした状態でaの魔法を使う、使わないで遷移する
				//オーバーキルする(hを超える)場合はhに遷移し、それ以上魔法を使わないので、コストを加算しない
					int nj = min(j + a, h);
					//いずれかのコストの最小値を格納する
					//dp[nj] -> 魔法を使わない場合
					//dp[j] + b ->モンスターのhpをj減らした状態でaの魔法を使った場合
					dp[nj] = min(dp[nj], dp[j] + b);
				}
		}
		cout << dp[h] << endl;
		return;
}

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



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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int n = s.size();
    vector<char> c_map(256, -1);
    REP(i, n) {
        if(c_map[s[i]] < 0) c_map[s[i]] = t[i];
        else if(c_map[s[i]] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    set<char> c_set;
    REP(i, c_map.size()) {
        if(c_map[i] < 0) continue;
        if(c_set.count(c_map[i]) > 0) {
            cout << "No" << endl;
            return 0;
        }
        c_set.insert(c_map[i]);
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 916
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N, X, T; cin >> N >> X >> T;
    cout << (N + X - 1) / X * T << endl;
    return 0;
}


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

int main(){
    int N;
    string S;
    cin >> N >> S;
    vector<int> cnt(26,0);
    for(int i=0; i<N; i++) cnt[S[i]-'a']++;

    ll mod = 1e9+7;
    ll ans = 1;
    for(int i=0; i<26; i++){
        if(cnt[i]==1) ans*=2;
    }
    ans = ans%mod;
    for(int i=0; i<26; i++){
        if(cnt[i]>1){
            ans*=(cnt[i]+1);
            ans = ans%mod;
        }
    }
    ans = ans - 1;
    if(ans<0) ans += mod;
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VII;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int M, T, P, R;

struct Score {
	Score() {
		count = 0;
		time = 0;
	}
	int team;
	int count;
	int time;

	bool operator < (const Score& right) const {
		if (count != right.count) {
			return count > right.count;
		}
		if (time != right.time) {
			return time < right.time;
		}
		return team > right.team;
	}
};

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	while (1) {
		cin >> M >> T >> P >> R;
		if (M == 0 && T == 0 && P == 0 && R == 0) break;
		vector<Score> score(T);
		VII pena(T, VI(P, 0));
		rep (i, T) {
			score[i].team = i;
		}
		rep (i, R) {
			int m, t, p, f;
			cin >> m >> t >> p >> f;
			if (f != 0) {
				pena[t - 1][p - 1] += 20;
			} else {
				score[t - 1].count++;
				score[t - 1].time += m + pena[t - 1][p - 1];
			}
		}
		sort(all(score));
		rep (i, score.size()) {
			if (i != 0) {
				cout << (score[i - 1].count == score[i].count && score[i - 1].time == score[i].time? '=' : ',');
			}
			cout << score[i].team + 1;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i, n) for (int i=0; i < n; i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define all(x) (x).begin(), (x).end()
#define v(T) vector<T>
#define vv(T) vector<v(T)>
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

int main()
{
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    rep(i, k){
        vi c(n, 0);
        rep(j, n){
            int l = max(0, j-a[j]);
            int r = min(n, j+a[j]+1);
            c[l]++;
            if (r<n) c[r]--;
        }
        rep(i, n-1) c[i+1] += c[i];
        a = c;
        bool flag = 1;
        rep(i, n) flag = flag && (a[i]==n);
        if (flag) break;
    }
    rep(i, n-1) cout << a[i] << " ";
    cout << a.back() << endl;
    return 0;
}

Measured memory_bytes: 4832
import math

n, m = map(int, input().split(" "))
hL = list(map(int, input().split(" ")))
hML = [True for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split(" "))
    if hL[a - 1] <= hL[b - 1]:
        hML[a - 1] = False
    if hL[b - 1] <= hL[a - 1]:
        hML[b - 1] = False

ans = 0
for b in hML:
    if b: ans += 1

print(ans)

Measured memory_bytes: 19984
#include <iostream>

int main(void)
{
    while(true) {
        int h, w;
        std::cin >> h >> w;
	if(h == 0 && w == 0) { break; }
        for(int i_h = 0; i_h < h; i_h++) {
            for(int i_w = 0; i_w < w; i_w++) {
                std::cout << "#";
            }
            std::cout << std::endl;
        }
        std::cout << std::endl;
    }
}

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

int main()
{
    cin.sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); 
    
  
string a,b; 
ll n;
cin>>n; 
cin>>a>>b; 
for(ll i=0;i<n;i++) 
  cout<<a[i]<<b[i];
 return 0;
}


Measured memory_bytes: 256
N,X = map(int, input().split())
List = [int(x) for x in input().split()]
 
import math
List.append(X)
List.sort()
 
distance = []
for i in range(N):
    distance.append(List[i+1]-List[i])
 
d_min = min(distance)
 
num_list = []
 
c = 1
while c <= math.sqrt(d_min):
    if d_min%c == 0:
        num_list.append(c)
    c += 1
 
num_list2 = [0]*len(num_list)
for i in range(len(num_list)):
    num_list2[len(num_list)-i-1] = int(d_min/num_list[i])
 
num_list = num_list + num_list2

num_list.append(d_min)

j = len(num_list)-1

while j >= 0:
    c2 = 0
    for k in range(len(distance)):
        if distance[k]%num_list[j] == 0:
            c2 += 1
    if c2 == len(distance):
        ans = num_list[j]
        j = 0
    j -= 1
 
print(ans)

Measured memory_bytes: 14100
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long n, x, y, i, j, k;
	cin >> n >> x >> y;

	vector<long long> ans(n, 0);
	vector<vector<int>> adj(n + 1);
	for (i = 1; i < n; i++) {
		adj[i].push_back(i + 1);
		adj[i + 1].push_back(i);
	}
	adj[x].push_back(y);
	adj[y].push_back(x);
	

	for (i = 1; i <= n; i++) {
		vector<int> dist(n + 1, -1);
		queue<int> q;
		q.push(i);
		dist[i] = 0;
		while (!q.empty()) {
			long long id = q.front();
			q.pop();
			for (auto p : adj[id]) {
				if (dist[p] == -1) {
					dist[p] = dist[id] + 1;
					q.push(p);
				}
			}			
		}

		for (j = i + 1; j <= n; j++) ans[dist[j]]++;
	}

	for (i = 1; i <= n - 1; i++) cout << ans[i] << "\n";

	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<set>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#define Max zhi5968
typedef long long ll;
using namespace std;

int main ()
{
	ll a,b,k,t;
	scanf("%lld %lld %lld",&k,&a,&b);
	if(k<=a)
	{
		cout<<"1"<<endl;
		return 0;
	}
	if(a<=b)
		printf("-1\n");
	else
	{
		t=(k-a)/(a-b);
		if((k-a)%(a-b)!=0)
			t++;
		printf("%lld\n",2*t+1);
	}
	return 0;
}

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

int main(){
  int N; cin >> N;
  long long H; cin >> H;
  long long A[100010],B[100010];
  
  for(int i=0;i<N;i++)
    cin >> A[i] >> B[i];
  sort(A,A+N,greater<long long>());
  sort(B,B+N,greater<long long>());
  long long sum = 0;
  long long cnt = 0;
  for(int i=0;i<N;i++){
    if(A[0]>B[i]) continue;
    sum += B[i]; cnt++;  
    if(sum >= H){cout << i+1 << endl; break;}
  }
  if(sum >= H);
  else if((H-sum)%A[0] == 0)cout << (H-sum)/A[0]+cnt << endl;
  else{cout << (H-sum)/A[0]+1+cnt << endl;
      }
}
    
  

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(){
    int a, b, c, d;
    long area1, area2;
    cin >> a >> b >> c >> d;

    area1 = a * b;
    area2 = c * d;

    cout << (area1 >= area2 ? area1 : area2) << endl;
    return 0;
}


Measured memory_bytes: 256
MOD = 1000000007

n , m = map(int,input().split())

count = [-1 for i in range(n+1)]
for i in range(m):
    count[int(input())] = 0

for i in range(1,n+1):
    if count[i] == 0:
        continue
    
    if i == 1:
        count[i] = 1 
    elif i == 2:
        count[i] = count[i-1] + 1
    else:
        count[i] = (count[i-1] + count[i-2]) % MOD

print(count[n])


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

int main(){
  int a,b;
  int wa,sa,se;
  cin >> a >> b;
  wa = a + b;
  sa = a - b;
  se = a * b;
  if(wa > sa){
    if(wa > se){
	  cout << wa << '\n';
    }else{
      cout << se << '\n';
    }
  }else{
    if(sa > se){
      cout << sa << '\n';
    }else{
      cout << se << '\n';
     }
  }
      return 0;
}


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

#define int long long

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int H, W, N;
    cin >> H >> W >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)cin >> a[i];
    int color[H][W] = {0};
    int ai = 0;
    for (int ci = 0; ci < H; ci ++) {
        if (ci %2 == 0) {
            for (int ri = 0; ri < W; ri ++) {
                color[ci][ri] = ai;
                a[ai] --;
                if (a[ai] <= 0) ai ++;
            }
        } else {
            for (int ri = W - 1; ri >= 0; ri--) {
                color[ci][ri] = ai;
                a[ai] --;
                if (a[ai] <= 0) ai ++;
            }
        }
    }
    for (int ci = 0; ci < H; ci++) {
        for (int ri = 0; ri < W; ri++) {
            cout << color[ci][ri] + 1 << " ";
        }
        cout << endl;
    }
    return 0;
}


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

using namespace std;
 
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++)
{
    cin >> a.at(i);
}

int count = 0;

while (true)
{
    bool exist_odd = false;

    for (int i = 0; i < N; i++)
    {
        if (a.at(i) % 2 != 0)
        {
            exist_odd = true;
        }
    }   
    
    if (exist_odd == true)
    {
        break;
    }
    
    for (int i = 0; i < N; i++)
    {
        a.at(i) = a.at(i)/2;
    }
    count = count + 1;
}   
cout << count << endl;

}

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


int main(){
    int n; cin >> n;
    vector<int> value;
    int six = 1;
    while(six <= n){
        value.push_back(six);
        six *= 6;
    }
    int nine = 9;
    while(nine <= n){
        value.push_back(nine);
        nine *= 9;
    }
    queue<pair<int, int>> q; // pair<最小回数，値>
    q.push(make_pair(0,0));
    vector<bool> isVisited(n+1,false);
    pair<int,int> now;
    while(!q.empty()){
        now = q.front();
        q.pop();
        if(now.second == n){
            cout << now.first << endl;
            return 0;
        }
        if(isVisited[now.second]) continue;
        isVisited[now.second] = true;
        rep(i, value.size()){
            if(now.second + value[i] <= n){
                q.push(make_pair(now.first+1, now.second+value[i]));
            }
        }
    }
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>

using namespace std;

int main(void){
  int copy,n;
  cin >>n;
  for(int i=1;i<=n;i++){
	  if(i%3==0){
		cout << " " << i;
		continue; 
	  }
	  copy=i;
	  while(1){
		  if (copy%10==3){
			  cout << " " << i;
			  break;
		  }
		  copy/=10;
		  if(copy!=0)
			  continue;
		  else
			  break;
	  }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int n;
  cin >> n;
  int arr[n][3];
  for(int i = 0; i < n; i++) cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
  int dp[n][3];
  dp[0][0] = arr[0][0];
  dp[0][1] = arr[0][1];
  dp[0][2] = arr[0][2];
  for(int i = 1; i < n; i++)
  {
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + arr[i][0];
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + arr[i][1];
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + arr[i][2];
  }
  cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]))<<endl;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <vector>
#include <cstdlib>


using namespace std;

vector<int> nn;

int main(){
	int a,self;
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<n - 1;i++){
		scanf("%d",&self);
		nn.push_back(a);
		a+=self;
	}
	nn.push_back(a);
	int ans = 0;
	int loc = 0;
	for(int i=0;i<m;i++){
		scanf("%d",&self);
		ans += abs(nn[loc] - nn[loc + self]);
		ans %= 100000;
		loc += self;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cerr << #v << " = "; array_out(v , __VA_ARGS__ );} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////////////

void solve(){
  ini(N);
  vl v(N); in(v);
  ll sum = 0;
  each(x,v) sum += x;
  ll ans = infLL;
  ll cur = 0;
  for(auto it = v.begin(); it != v.end();it++){
    if(it + 1 == v.end()) break;
    cur += *it;
    amin(ans , abs(sum - 2 * cur));
  }
  out(ans);
}

Measured memory_bytes: 1792
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y, ll z){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2,z);
        if(y%2==0)
         return (p*p)%z;
        else
        return (x*((p*p)%z))%z;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
ll po(ll x)
{
    ll c=0;
    while(x>0)
    {
        x=x&(x-1);
        c++;
    }
    return c;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    for(int i=0;i<n-k;i++)
    {
        if(a[i]<a[i+k])
        {
            cout<<"Yes";
        }
        else
        cout<<"No";
        cout<<"\n";
    }}
    
    

Measured memory_bytes: 5216
#include <cstdio>

int main()
{
	int n, x;
	int j,k;
	scanf("%d", &n);
	int a[n], buff;
	for(int i = 0; i < n; i++){
		scanf("%d", &x);
		a[i] = x;
	}

	long min, max, sum = 0;

	for(int i = 0; i < n; i++){
		sum += a[i];
	}

	while (1){
		k = 1;
		for(j = 0; j < n - 1; j++){
			if (a[j] <= a[j + 1]) k *= 1;
			else k *= 0;
		}
		if (k) break;

		for(j = 0; j < n - 1; j++){
			if (a[j] >= a[j + 1]){
				buff = a[j];
				a[j] = a[j + 1];
				a[j + 1] = buff;
			}
		}
	}

	min = a[0];
	max = a[n - 1];

	printf("%ld %ld %ld\n", min, max, sum);
	return 0;
}

Measured memory_bytes: 1064
using System;
using System.Linq;

namespace Program
{
    class A
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            if (30 <= n)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

int w,h;
int n;
pii pts[125252];
int x[125252], y[125252];
int main(){
  scanf("%d%d%d",&w,&h,&n);
  REP(i,n)scanf("%d%d",x+i,y+i);
  if(n==1){
    puts("0");
    printf("%d %d\n",x[0],y[0]);
    return 0;
  }
  REP(i,n)pts[i] = pii(x[i], y[i]);
  sort(x,x+n);sort(y,y+n);
  pair<ll,pii> ans = make_pair(1ll<<60, pii(-1, -1));

  set<pii> S;
  REP(i,3)REP(j,3){
    int xid = (n-1)/2 + (i-1);
    int yid = (n-1)/2 + (j-1);
    if(xid<0 || yid<0 || xid>=n || yid>=n)continue;
    S.insert(pii(x[xid], y[yid]));
  }
  map<pii, ll> M;
  for(pii P : S){
    int cx = P.first;
    int cy = P.second;
    ll sum = 0ll;
    REP(i,n){
      sum += (ll)abs(x[i]-cx) + (ll)abs(y[i]-cy);
    }
    M[P] = sum;
  }
  REP(i,n){
    for(pii P : S){
      ll sum = M[P];
      int cx = P.first;
      int cy = P.second;
      sum *= 2ll;
      sum -= (ll)abs(pts[i].first-cx) + (ll)abs(pts[i].second-cy);
      ans = min(ans, make_pair(sum, pii(cx,cy)));
    }
  }
  printf("%lld\n%d %d\n",ans.first,ans.second.first,ans.second.second);
  return 0;
}



Measured memory_bytes: 4868
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string W;
  cin >> W;
  if (W=="Sunny"){
    cout << "Cloudy" << endl;
  } else if (W=="Cloudy"){
    cout << "Rainy" << endl;
  } else if (W=="Rainy") {
    cout << "Sunny" << endl;
  }
}

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

int main()
{
  long long int a,b,k,x1;
  cin>>a>>b>>k;
  x1=min(a,k);
  a-=x1;
  k-=x1;
  x1=min(b,k);
  b-=x1;
  //k-=x1;
  cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <algorithm>  
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr(i,a,b) for(long long int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;
/*vector<ll>g[1000001];
ll vis[1000005]={0};
ll l[1000001];
ll m[1000001];*/
/*queue<ll>q ;
void bfs(ll s)
{
       vis[s]=1;
       q.push(s);
       ll curr=q.front(); vis[curr]=1;
       while(!q.empty())
       {
              curr=q.front(); q.pop(); // vis[curr]=1;
              for(ll i=0;i<g[curr].size();i++)
              {
                     ll child=g[curr][i];
                     if(vis[child]==0) 
                     { 
                            q.push(child); 
                            vis[child]=1;
                     }
              }
       }
}
void dfs(ll curr,map<ll,ll>pehli)
{
       vis[curr]=1;
       if(pehli[l[curr]]==0)
       {
              m[curr]=-1;
              pehli[l[curr]]=curr;
       }
       else 
       {
              m[curr]=pehli[l[curr]];
              pehli[l[curr]]=curr;
       }
       for(ll i=0;i<g[curr].size();i++)
       {
              ll child=g[curr][i];
              if(vis[child]==0)
              {
                     dfs(child,pehli);
              }
       }
       
}*/
signed main() 
{
    fast
    double d,s;
    double t;
    cin>>d>>t>>s;
    double ti=d/s;
    if(ti<=t) cout<<"Yes";
    else cout<<"No";
}

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

int main() {
	int N;  cin >> N;
	vector<ll> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A.begin(), A.end());
	vector<ll> L;
	for (int i = N - 1; i >= 0; i--) {
		if (i >= 1 && A[i] == A[i - 1]) {
			L.push_back(A[i]);
			i--;
		}
	}
	if (L.size() < 2) {
		cout << 0 << endl;
		return 0;
	}

	cout << L[0] * L[1] << endl;
}


Measured memory_bytes: 1660
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<cctype>
using namespace std;

void sout(string* a, string* b) {
	if (*a > * b) {
		string c = *a;
		*a = *b;
		*b = c;
	}
}
int combination(int n, int k) {
	if (n > k && k > 0) {
		return (combination(n - 1, k) + combination(n - 1, k - 1));
	}
	else
		return 1;
}
int main() {
	int n, k;
	cin >> n >> k;
	cout << n - k + 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,n,x;
	a=100000;
	cin >> n;
	for(x=0;x<n;x++){
		a+=a/20;
		a+=999;
		a/=1000;
		a*=1000;
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#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 <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
// #include <boost/foreach.hpp>
// #include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
//#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};
typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
template<typename T> 
void print(vector<T> v){
    for(int i=0;i<v.size();i++){
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
}
int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    else return gcd(b,a%b);
}

struct Edge{
    int to,cost;
};

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

}







    


/*
*/

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
const int INF = 1000000;
int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  rep(i, A) cin >> a[i];
  rep(i, B) cin >> b[i];

  int ans = INF;
  vector<pair<P, int>> C(M);
  rep(j, M) {
    int x, y, c;
    cin >> x >> y >> c;
    x--, y--;
    ans = min(ans, a[x] + b[y] - c);
  }
  sort(all(a)), sort(all(b));
  ans = min(ans, a[0] + b[0]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
class Dice {
private:
  int dice[6];
  int tmp;
 public:
  Dice(int a, int b, int c, int d, int e, int f) {
	dice[0] = a;
	dice[1] = b;
	dice[2] = c;
	dice[3] = d;
	dice[4] = e;
	dice[5] = f;
  }
  void move(char ch) {
	if(ch == 'N') {
	  moveN();
	}
	else if(ch == 'E') {
	  moveE();
	}
	else if(ch == 'S') {
	  moveS();
	}
	else {
	  moveW();
	}
  }
  void moveN() {
	tmp = dice[0];
	dice[0] = dice[1];
	dice[1] = dice[5];
	dice[5] = dice[4];
	dice[4] = tmp;
  }
  void moveS() {
	tmp = dice[0];
	dice[0] = dice[4];
	dice[4] = dice[5];
	dice[5] = dice[1];
	dice[1] = tmp;
  }
  void moveE() {
	tmp = dice[0];
	dice[0] = dice[3];
	dice[3] = dice[5];
	dice[5] = dice[2];
	dice[2] = tmp;
  }
  void moveW() {
	tmp = dice[0];
	dice[0] = dice[2];
	dice[2] = dice[5];
	dice[5] = dice[3];
	dice[3] = tmp;
  }
  int top() {
	return dice[0];
  }
};
/*
void print(Dice d1) {
    for(int i = 0; i < 6; ++i) {
	  cout << "i:" << i << endl;
	  cout << "\tdice:" << d1.dice[i] << endl;
	}
}
*/
int main() {
  char ch;
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  Dice d1(a, b, c, d, e, f);

  while(cin >> ch) {
	d1.move(ch);
	//	print(d1);
  }
  cout << d1.top() << endl;

  return 0;
}

Measured memory_bytes: 3080
h, w = map(int, input().split())
n = int(input())
a = [int(i) for i in input().split()]
c = [[0] * w for _ in range(h)]
i, j = 0, 0
d = 1
k = 1
for ai in a:
    for _ in range(ai):
        c[j][i] = k
        if i == 0 and d == -1:
            j += 1
            d = 1
        elif i == w - 1 and d == 1:
            j += 1
            d = -1
        else:
            i += d
    k += 1
[print(*e) for e in c]

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VLL a(n);
  rep(i,n) cin >> a[i];
  VLL r(n,0),l(n,0);
  l[0] = a[0];
  FOR(i,1,n){
    l[i] = max<ll>(a[i],l[i-1]);
  }
  r[n-1] = a[n-1];
  for(int i = n-2; i >= 0; i --){
    r[i] = max<ll>(a[i],r[i+1]);
  }
  rep(i,n) {
    ll ans = 0;
    if(i > 0) ans = max(l[i-1],ans);
    if(i < n-1) ans = max(ans,r[i+1]);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 6272
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
// ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
ll powMod(ll x, ll k, ll m) {//x^k (mod n)
	if (k == 0)     return 1;
	if (k % 2 == 0) return powMod(x*x % m, k/2, m);
	else            return x*powMod(x, k-1, m) % m;
}
int N,M;
vi PP;

int invmap[114514];
map<int,int> mm;
vi datas;

int main(){
	cin>>N>>M;
	priority_queue<ll> pq;
	rep(i,N){
		ll x;
		cin>>x;
		pq.push(x);
	}

	while(M--){
		ll x=pq.top();
		pq.pop();
		x/=2;
		pq.push(x);
	}
	ll ans=0;
	while(!pq.empty()){
		ll x=pq.top();
		pq.pop();
		ans+=x;
	}
	cout<<ans<<endl;

}



Measured memory_bytes: 1400
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;

const int LOSE = 1;
const int BACK = 2;

int n, t;
vector<int> board;
vector<vector<double> > memo;

double dfs(int pos = 0, int turn = 0) {
	if(pos == n)
		return 1.0;

	if(turn >= t)
		return 0.0;

	if(memo[pos][turn] >= 0.0)
		return memo[pos][turn];

	double res = 0.0;
	for(int i = 1; i <= 6; ++i) {
		int next_pos = n - abs(n - (pos + i));
		int next_turn = turn + 1;

		if(board[next_pos] == LOSE)
			++next_turn;

		else if(board[next_pos] == BACK)
			next_pos = 0;

		res += dfs(next_pos, next_turn) / 6.0;
	}

	return memo[pos][turn] = res;
}

int main() {
	for(int l, b; scanf("%d %d %d %d", &n, &t, &l, &b), n;) {
		board.clear();
		board.resize(n + 1, 0);
		for(int i = 0; i < l; ++i) {
			int lose;
			scanf("%d", &lose);
			board[lose] = LOSE;
		}

		for(int i = 0; i < b; ++i) {
			int back;
			scanf("%d", &back);
			board[back] = BACK;
		}

		memo.clear();
		memo.resize(n, vector<double>(t, -1.0));
		printf("%.10lf\n", dfs());
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1184
N = int(input())
A = list(map(int, input().split()))

A.sort()
S = sum(A)

if A[0] >= 0:
    print(S - A[0] * 2)
    tmp = A[0]
    for i in range(1, N - 1):
        print(tmp, A[i])
        tmp -= A[i]
    print(A[-1], tmp)

elif A[-1] <= 0:
    print(-S + A[-1] * 2)
    tmp = A[-1]
    for i in range(1, N):
        print(tmp, A[~i])
        tmp -= A[~i]

else:
    op = []
    tmp1 = A[-1]
    i = 1
    while A[i] < 0:
        op.append((tmp1, A[i]))
        tmp1 -= A[i]
        i += 1
    tmp2 = A[0]
    i = 1
    while A[~i] >= 0:
        op.append((tmp2, A[~i]))
        tmp2 -= A[~i]
        i += 1
    print(tmp1 - tmp2)
    for x, y in op:
        print(x, y)
    print(tmp1, tmp2)

Measured memory_bytes: 93888
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string ns;
  getline(cin,ns);
  int l=ns.length();
  char p= ns.at(l-1);
  if(p=='s')
  {
    ns=ns+"es";
    cout<< ns<< endl;
  }
  else if(p!='s')
  {
    ns=ns+'s';
    cout<< ns<< endl;
  }
}


Measured memory_bytes: 3556