akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<string>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
//#include<chrono>
//#include<time.h>
//#include<windows.h>
using namespace std;
 
//#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
#define YESNO(x) puts((x)?"YES":"NO")
#define CLEAR(x) (x).clear();(x).shrink_to_fit();
struct edge {int /*from,*/to,cost;};

signed main(){
    string s;
    cin >> s;
    int ans = -1;
    char tmp = 'S';
    REP(i,LEN(s)){if(s[i]!=tmp)ans++;tmp=s[i];}
    printf("%d\n",ans);

    return 0;
}


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

int sum(int x){
  int wa = 0;
  while(x>0){
    wa += x%10;
    x /= 10;
  }
  return wa;
}

int main(){
  int N;
  cin >> N;
  int ans = sum(1)+sum(N-1);
  for(int i=1;i<=N/2+1;i++){
    ans = min(sum(i)+sum(N-i),ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
#include <chrono> 
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#define mod 1000000007
#define mod2 998244353
#define int long long
#define endl "\n"
#define p_b push_back
#define m_p make_pair
#define fastIO ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
using namespace std::chrono; 

template <class T> 
using _ost = tree<
		T, 
		null_type, 
		less_equal<T>, 
		rb_tree_tag, 
        tree_order_statistics_node_update>;

char alphabet[26] = {'a','b','c','d','e','f','g','h','i',
       'j','k','l','m','n','o','p','q','r','s','t','u','v',
       'w','x','y','z'};

// rectangle intersection
// x5 = max(x1, x3);
// y5 = max(y1, y3);
// x6 = min(x2, x4);
// y6 = min(y2, y4); 

// const int mx = 20005;

// char get_next(char c) {
// 	for(int i=0; i<25; i++) if(c == alphabet[i]) return alphabet[i+1];
// 	return 'a';
// }

int32_t main() {
 	fastIO;
	int tc;
	// cin >> tc;
	tc = 1;
	while(tc--) {
		int a, b, c;
		int k;
		cin >> a >> b >> c >> k;
		int cnt = 0;
		while(b <= a) {
			b *= 2;
			cnt++;
		}
		while(c <= b) {
			c *= 2;
			cnt++;
		}
		if(cnt <= k) cout << "Yes" << endl;
		else cout << "No" << endl;
    }     
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n = in();
    int two = 0;
    int one = 0;
    int zero = 0;
    rep(i, n)
    {
        int x = in();
        if (x % 4 == 0)
            ++two;
        else if (x % 2 == 0)
            ++one;
        else
            ++zero;
    }
    if (one == 0)
        --zero;
    if (two >= zero)
        Yes;
    else
        No;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 2147483647
#define MOD 1000000007
using namespace std;
typedef pair<int,int> pii;
long long n,ck,a,b,arr[101010],cnt[101010];
long long lcm,m,ans;
long long gcd(long long p,long long q)
{
	if(q==0) return p;
	return gcd(q,p%q);
}
int main()
{
	scanf("%lld %lld",&n,&m);
	for(int i=0;i<n;i++) 
	{
		scanf("%lld",&arr[i]); 
		long long im=arr[i];
		while(im%2==0)
		{
			im/=2; cnt[i]++;
		} if(i&&cnt[i]!=cnt[i-1]) ck=1;
	} if(ck)
	{
		puts("0"); return 0;
	}
	lcm=arr[0];
	for(int i=1;i<n;i++)
	{
		long long imsi=gcd(arr[i],lcm); lcm=lcm/imsi*arr[i];
		if(lcm>2*m)
		{
			ck=1; break;
		}
	} if(ck) 
	{
		puts("0"); return 0;
	}
	ans=m/lcm; m%=lcm; if(m>=lcm/2) ans++;
	printf("%lld",ans);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define print(i) std::cout << (i) << '\n'
inline long long ceildiv(long long a, long long  b) { return (a+b-1)/b; }
typedef pair<long long,long long> P;
const long long inf = 10e7;
//int |x|<=2*10**9     long |x|<= 9*10**18
typedef pair<int,string> PP;
#define ll long long
int main(){
string s,t;cin>>s>>t;int S=s.size(),T=t.size();
vector<vector <int>> dp(S+1,vector<int> (T+1,0));
rep(i,S){rep(j,T){if (s.at(i)==t.at(j)){dp.at(i+1).at(j+1)=dp.at(i).at(j)+1;}
else{dp.at(i+1).at(j+1)=max({dp.at(i).at(j+1),dp.at(i+1).at(j)});}}
}
string rewsna="";
while (T>0&&S>0 ){
if (t[T-1]==s[S-1]){rewsna+=s[S-1];S--;T--;}
else if (T>=1&&dp[S][T]==dp[S][T-1]){T--;}
else{S--;}}
reverse(all(rewsna));
print(rewsna);
}

Measured memory_bytes: 35584
N = int(input())
H = list(map(int, input().split()))
Max = 0
length = 0
for i in range(N - 1):
    if H[i] >= H[i + 1]:
        length = length + 1
    else:
        if length > Max:
            Max = length
        length = 0
if length > Max:
    Max = length
print(Max)


Measured memory_bytes: 15020
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    ma=10**6
    tot=0
    for a in A:
        if a<=ma:
            tot+=1
            ma=a
    print(tot)




if __name__ == "__main__":
    main()

Measured memory_bytes: 104168
#include <iostream>
using namespace std;
int k;
int cnt[102];
void print(int kj){
    for(int i=0;i<kj-1;i++){
        cout<<cnt[i]<<' ';
    }
    cout<<cnt[kj-1]<<'\n';
}
int main(){
    cin>>k;
    for (int i=0;i<k;++i){
        cin>>cnt[i];
    }
    print(k);
    for (int j=1;j<k;++j){
        int key = cnt[j];
        int idx = j-1;
        while(idx>=0 && key<cnt[idx]){
            cnt[idx+1]=cnt[idx];
            idx--;
        }
        cnt[idx+1]=key;
        print(k);
    }
    return 0;
}

Measured memory_bytes: 3068
#include <iostream>
#include <algorithm>

#define MAX 100000
using namespace std;

int a[MAX];

int main() {
    int N;
    cin>>N;
    for (int i=0;i<N;i++) cin>>a[i];
    sort(a,a+N);
    int t=0;//total you can merge
    long long sz = 0;
    for (int i=0;i<N;i++) {
        t = (a[i] <= 2*sz) ? t+1 : 1;
        sz+=a[i];
    }
    cout<<t<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
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<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string K;
    int D;
    cin >> K >> D;
    ll dp[10005][2][105];
    Fill(dp, 0);
    dp[0][0][0] = 1;
    rep(i,0,SZ(K)){
        int dmax = chartoint(K[i]);
        rep(j,0,2){
            rep(k,0,D){
                reps(d,0,j? 9 : dmax){
                    dp[i+1][j || (d<dmax)][(k+d)%D] = (dp[i+1][j || (d<dmax)][(k+d)%D] + dp[i][j][k]) % MOD;
                }
            }
        }
    }

    cout << (dp[SZ(K)][0][0] + dp[SZ(K)][1][0] - 1 + MOD) % MOD << endl;
    return 0;
}


Measured memory_bytes: 20096
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mx 100005
ll broken[mx] = {0};
ll dp[mx] = {0};
#define mod 1000000007
int main()
{	
	ios_base::sync_with_stdio(0);
	ll n,m,a;
	cin>>n;
	cin>>m;
	for(int i=1; i<=m; i++){
		cin>>a;
		broken[a] = 1;
	}
	dp[0] = 1;
	for(int i=1; i<=n; i++){
		ll total = 0;
		if(i-1>=0 && broken[i-1]==0) total+=dp[i-1];
		if(i-2>=0 && broken[i-2]==0) total+=dp[i-2];
		dp[i] = total%mod;
	}
	cout<<dp[n]<<endl;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define PI 3.1415926535897932384626433832795
#define ll long long
#define MP make_pair
#define IN insert
#define PB push_back
#define fr first
#define se second
#define sf scanf
#define pf printf
#define debug(x) cout<<"---------"<<x<<endl;
#define LEN(a) sizeof(a)/sizeof(a[0])
#define MEM(arr,k) memset(arr,k,sizeof arr)
#define input freopen("input","r",stdin)
#define output freopen("output","w",stdout)


int X8[] = {0, 1, 0, -1, 1, -1, 1, -1};
int Y8[] = {1, 0, -1, 0, 1, -1, -1, 1};
int X4[]={+1,-1,+0,+0};
int Y4[]={+0,+0,+1,-1};

using namespace std;

int main()
{

		int a,b;
		cin>>a>>b;
		cout<<((a*(a-1))/2) + ((b*(b-1))/2)<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>

#define INF INT64_C(1145141919810931)

int N, M;
int a[2048], b[2048];
int64_t c[2048];

int64_t max[2048];

int main(void) {
	int i, j;
	int64_t asumikana, horieyui;
	if (scanf("%d%d", &N, &M) != 2) return 1;
	for (i = 0; i < M; i++) {
		if (scanf("%d%d%" SCNd64, &a[i], &b[i], &c[i]) != 3) return 1;
	}
	for (i = 0; i <= N; i++) max[i] = -INF;
	max[1] = 0;
	for (i = 0; i < N; i++) {
		for (j = 0; j < M; j++) {
			if (max[a[j]] + c[j] > max[b[j]]) max[b[j]] = max[a[j]] + c[j];
		}
	}
	asumikana = max[N];
	for (i = 0; i < N; i++) {
		for (j = 0; j < M; j++) {
			if (max[a[j]] + c[j] > max[b[j]]) max[b[j]] = max[a[j]] + c[j];
		}
	}
	horieyui = max[N];
	if (asumikana == horieyui) {
		printf("%" PRId64 "\n", asumikana);
	} else {
		puts("inf");
	}
	return 0;
}


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

int main(){
    int ans=0, n, i, j;
    cin >> n;
    int d[n];
    for (i=0; i<n; i++) {
        cin >> d[i];
        if (i>0) {
            for (j=0; j < i; j++) {
                ans += d[i] * d[j];
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

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

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

    ll k,a,b;
    cin >> k >> a >> b;
    if (b-a <= 2){
        cout << k+1 << endl;
    }
    else{
        if (k <= a-1){
            cout << k+1 << endl;
        }
        else{
            ll x = (k+1-a)/2;
            ll ans = (b-a)*x +a;
            if ((k+1-a)%2 == 1){
                ans++;
            }
            cout << ans << endl;
        }

    }
}

Measured memory_bytes: 3616
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy" << endl;
    if (s == "Cloudy") cout << "Rainy" << endl;
    if (s == "Rainy") cout << "Sunny" << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; 
bool complare(int a,int b);
int main()
{
	char blue[105][105],red[105][105];
	int max = 0,cnt;
	int i,n,m,j;
	scanf("%d",&n);
	for(i = 0;i < n; i++)
		scanf("%s",blue[i]);
		scanf("%d",&m);
		for(i = 0;i < m; i++)
			scanf("%s",red[i]);
			for(i = 0;i < n; i++)
			{
				cnt = 0;
				for(j = 0;j < n; j++)
				{
					if(strcmp(blue[i],blue[j]) == 0)
						cnt++;
				}
				for(j = 0;j < m; j++)
				{
					if(strcmp(blue[i],red[j]) == 0)
						cnt--;
				}
				if(max < cnt)
					max = cnt;
			}
			printf("%d\n",max);
			return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int count=0;
  int max=0;
  cin>>N;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin>>d.at(i);
  }
  sort(d.begin(), d.end());
  for(int i=0;i<N;i++){
    if(max<d.at(i)){
      max=d.at(i);
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
int main() {
    int x, i;
    for(i = 1;; ++i) {
        scanf("%d", &x);
        if(x == 0) {
            break;
        }
        else {
            printf("Case %d: %d\n", i, x);
        }
    }
    return 0;
}


Measured memory_bytes: 2572
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a,b = map(int,input().split())

a_pf = prime_factorize(a)
b_pf = prime_factorize(b)

pfs = set(a_pf)
pfs &= set(b_pf)
pfs.add(1)
print(len(pfs))

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    int n;
    bool ans=true;
    scanf("%d",&n);
    char w[n][15];
    for (int i=0; i<n; i++){
        scanf("%s",w[i]);
    }
    for (int i=0; i<n-1; i++){
        if (w[i][strlen(w[i])-1]!=w[i+1][0]){
            ans=false;
        }
    }
    for (int i=0; i<n; i++){
        for (int j=0; j<n; j++){
            if (i!=j && strcmp(w[i],w[j])==0){
                ans=false;
            }
        }
    }
    if (ans==true){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
	return 0 ;
}


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

int main() {
  string A;
  cin >> A;
  bool N=false,E=false,W=false,S=false;
  for(int i=0;i<A.size();i++){
    if(A.at(i)=='N'){
      N=true;
    }
    else if(A.at(i)=='E'){
      E=true;
    }
    else if(A.at(i)=='W'){
      W=true;
    }
    else{
      S=true;
    }
  }
  if((N && E && W && S) || (!N && E && W && !S) || (N && !E && !W && S)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
    
    
  

Measured memory_bytes: 3584
#include<iostream>
#define r(i,n) for(int i=0;i<n;i++)
#include<vector>
using namespace std;

vector<int> G;
long long coun;
int a[1000000];

void insertionsort(int a[], int n, int g)
{
	int j, v, i;
	for(i=g;i<n;i++)
	{
		v = a[i];
		j = i - g;
		while (j >= 0 && a[j] > v)
		{
			a[j + g] = a[j];
			j-=g;
			coun++;
		}
		a[j + g] = v;
	}
}

void shellSort(int a[], int n)    //最大程度的把数组弄整齐以提高插入排序的效率
{
	for (int h = 1;;)
	{
		if (h > n)break;
		G.push_back(h);
		h = 3 * h + 1;
	}
	for (int i = G.size() - 1; i >= 0; i--)
	{
		insertionsort(a, n, G[i]);
	}
}

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

	coun = 0;
	shellSort(a, n);

	cout << G.size() << endl;
	for (int i = G.size() - 1; i >= 0; i--)
	{
		if (i != G.size() - 1)cout << " ";
		cout << G[i];
	}

	cout << endl << coun << endl;
	r(i, n)
		cout<<a[i] << endl;
	return 0;
}


Measured memory_bytes: 6908
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    rep(i, n - 2)
    {
        if (s.substr(i, 3) == "ABC")
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
li = [None] * n
for i in range(n):
    x, l = map(int, input().split())
    li[i] = (x - l, x + l)
li.sort(key=lambda x: x[1])
f = -float('inf')
ans = 0
for p, q in li:
    if p >= f:
        ans += 1
        f = q
print(ans)


Measured memory_bytes: 53592
#include <stdio.h>
int main(void){
    // Your code here!
    char S[100];
    scanf("%s",S);
    
    int i;
    int jud=0;
    for(i=0;i<100;i++){
        if((i+1)%2==1){
            if(S[i]=='L'){
                jud=1;
            }
        }else{
            if(S[i]=='R'){
                jud=1;
            }
        }
    }
    
    if(jud==1){
        printf("No");
    }else{
        printf("Yes");
    }
    
    return 0;
}


Measured memory_bytes: 128
<?php
  	fscanf(STDIN, "%d %d", $N, $K);
	$sunukes = array();
	
	for ($i=0;$i<$K;$i++) {
      	fscanf(STDIN, "%d", $sweetNumber);
      	$sweets = explode(" ", trim(fgets(STDIN)));
      	foreach ($sweets as $sweet) {
        	$sunukes[$sweet][] = $sweetNumber;
        }
    }
	$treatCount = 0;

	foreach ($sunukes as $sunuke) {
     	if (count($sunuke) == 0) {
          	$treatCount++;
        } 
    }

	print($N - count($sunukes));
	

Measured memory_bytes: 16808
use v5.18;
use warnings;
use Math::BigInt;
use List::Util 'reduce';

my ($n, $e, $f);
{
    my $in = <STDIN>;
    ($n, $e, $f) = split(" ", $in);
}
my $MOD = 10 ** 9 + 7;

sub combination
{
    my ($n, $k) = @_;
    my $c = reduce {$a * $b % $MOD} (($n-$k+1)..$n);
    my $d = reduce {$a * $b % $MOD} (1..$k);
    
    $c * Math::BigInt->new($d)->bmodinv($MOD) % $MOD;
}
my $ans = Math::BigInt->new(2)->bmodpow($n, $MOD) - 1;
$ans += $MOD - combination($n, $e);
$ans += $MOD - combination($n, $f);
print ($ans % $MOD), "\n";

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



int main() {
  ll N,M;
  cin>>N>>M;
  vector<ll> H(N);
  rep(i,N)
  {
    cin>>H.at(i);
  }
  vector<vector<ll>> road(M,vector<ll>(2));
  rep(i,M)
  {
    rep(j,2)
    {
      cin>>road.at(i).at(j);
    }
  }
  vector<ll> takai(N);
  rep(i,M)
  {
    ll A=road.at(i).at(0)-1,B=road.at(i).at(1)-1;
    if(H.at(A)>=H.at(B))
    {
      takai.at(B)=1;
    }
    if(H.at(A)<=H.at(B))
    {
      takai.at(A)=1;
    }
  }
  ll ans=0;
  rep(i,N)
  {
    if(takai.at(i)==0)
    {
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
 int K, A, B;
  cin >> K >> A >> B;
  int n = A % K;
    if(n == 0){
    cout << "OK" << endl;}
  else if (K - n + A <= B){
  	cout << "OK" << endl;
  }else{
  	cout << "NG" << endl;
  }
}

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

int main() {
  int a, b, c;
  std::cin >> a;
  if (a == 1) {
    std::cout << "Hello World" << std::endl;
  } else {
    std::cin >> b >> c;
    std::cout << b + c << std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
from collections import deque


def nearlist(N, LIST):
    NEAR = [set() for _ in range(N)]
    for a, b in LIST:
        NEAR[a - 1].add(b - 1)
        NEAR[b - 1].add(a - 1)
    return NEAR


def bfs(NEAR, S, N):  # 幅優先探索  # キュー
    PATH = [-1 for _ in range(N)]
    PATH[S] = 's'
    frag, que = set([S]), deque([S])

    while len(que) > 0:
        q = que.popleft()
        for i in NEAR[q]:
            if i in frag:
                continue
            PATH[i] = q
            que.append(i), frag.add(i)
    return PATH


n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

near = nearlist(n, ab)
path = bfs(near, 0, n)

print('Yes')
for i in range(1, n):
    print(path[i] + 1)


Measured memory_bytes: 156772
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    set<string> st;
    rep(i,n){
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;

}


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

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


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

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

    int p[5];
    for (int i = 0; i < n; i++) {
        p[i] = i;
    }

    int r = 1 << 30;
    do {
        int t = 0;
        for (int i = 0; i < n; i++) {
            t = (t + 9) / 10 * 10;
            t += a[p[i]];
        }
        r = min(r, t);
    } while (next_permutation(p, p + 5));

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
ch, cw = map(lambda x: int(x) - 1, input().split())
dh, dw = map(lambda x: int(x) - 1, input().split())
s = [input() for _ in range(h)]
vis = [[False] * w for _ in range(h)]
a = [[0] * w for _ in range(h)]
def bfsA(x, y, ai):
    q = deque()
    vis[x][y] = True
    a[x][y] = ai
    q.append((x, y))
    while q:
        u, v = q.popleft()
        for du, dv in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
            uu = u + du
            vv = v + dv
            if 0 <= uu < h and 0 <= vv < w and not vis[uu][vv] and s[uu][vv] == '.':
                vis[uu][vv] = True
                a[uu][vv] = ai
                q.append((uu, vv))
c = 0
for x in range(h):
    for y in range(w):
        if vis[x][y] or s[x][y] == '#':
            continue
        c += 1
        bfsA(x, y, c)
e = [[] for _ in range(c + 3)]
for x in range(h):
    for y in range(w):
        if not vis[x][y] or s[x][y] == '#':
            continue
        for dx in range(-2, 3):
            for dy in range(-2, 3):
                xx = x + dx
                yy = y + dy
                if 0 <= xx < h and 0 <= yy < w and vis[xx][yy] and s[xx][yy] == '.':
                    e[a[x][y]].append(a[xx][yy])
                    e[a[xx][yy]].append(a[x][y])
vis = [False] * (c + 3)
d = [h * w * 2] * (c + 3)
def bfsB(st):
    q = deque()
    vis[st] = True
    d[st] = 0
    q.append(st)
    while q:
        u = q.popleft()
        for v in e[u]:
            if not vis[v]:
                vis[v] = True
                d[v] = d[u] + 1
                q.append(v)
bfsB(a[ch][cw])
if d[a[dh][dw]] < h * w * 2:
    print(d[a[dh][dw]])
else:
    print(-1)

Measured memory_bytes: 221644
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
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;
  vector<ll> L ; 

  rep(i,N+1){
    if(i==0) L.pb(2);
    else if(i==1) L.pb(1);

    else  L.pb(L[i-1]+L[i-2]);
  }
  
  cout << L[L.size()-1] << endl;
  //cout << fixed << setprecision(16) << ans << endl;
  
  return 0;
}


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

ll x = 1e9 + 7; 

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> pr;
  int sum = 0;
  rep(i,n) {
    int a;
    cin >> a;
    sum += a;
    pr.push(a);
  }
  rep(i,m) {
    if (pr.top() < (double)sum/(4*m)) {
      cout << "No" << endl;
      return 0;
    }
    pr.pop();
  }
  cout << "Yes" << endl;
  return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;cin >> n;
	string str;cin >> str;
	int a = 0;
	REP(i, n){
		if(str[i] == 'R')a++;
		else a--;
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int main(){

  int n,a[200000],t1,t2;
  vector <int> so;
  map <int,int>	basho;
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i],so.push_back(a[i]);
  sort(so.begin(),so.end());
  for(int i=0;i<n;i++) basho[so[i]]=i;
  t1=so[n/2-1];
  t2=so[n/2];
  for(int i=0;i<n;i++){
    if(basho[a[i]]>n/2-1) cout<<t1<<endl;
    else cout<<t2<<endl;
  }

  return 0;
}

Measured memory_bytes: 13300
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

const string paint[3][5] = 
{
    { /* 小 */
        "..#..",
        ".###.",
        "..#..",
        ".....",
        "....."
    },
    { /* 中 */
        "..###",
        "..###",
        "..###",
        ".....",
        "....."
    },
    { /* 大 */
        "..#..",
        ".###.",
        "#####",
        ".###.",
        "..#.."
    }
};

const int dy[3] = {1, 1, 2};
const int dx[3] = {0, 1, 0};

bool solve(vector<vector<int> >& s, int n, int y, int x)
{
    if(x == 15){
        ++ y;
        x = 5;
        if(y == 15)
            return n == 0;
    }

    if(s[y][x] == 0)
        return solve(s, n, y, x+1);
    if(n == 0)
        return false;

    for(int k=0; k<3; ++k){
        bool ok = true;
        for(int i=0; i<5; ++i){
            for(int j=0; j<5; ++j){
                if(paint[k][i][j] == '#' && s[y+i][x+j-2] == 0)
                    ok = false;
            }
        }
        if(!ok)
            continue;

        for(int i=0; i<5; ++i){
            for(int j=0; j<5; ++j){
                if(paint[k][i][j] == '#')
                    -- s[y+i][x+j-2];
            }
        }

        if(solve(s, n-1, y, x)){
            cout << (x - 5 + dx[k]) << ' ' << (y - 5 + dy[k]) << ' ' << (k + 1) << endl;
            return true;
        }

        for(int i=0; i<5; ++i){
            for(int j=0; j<5; ++j){
                if(paint[k][i][j] == '#')
                    ++ s[y+i][x+j-2];
            }
        }
    }

    return false;
}

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

    vector<vector<int> > s(20, vector<int>(20));
    for(int i=5; i<15; ++i){
        for(int j=5; j<15; ++j){
            cin >> s[i][j];
        }
    }

    solve(s, n, 5, 5);

    return 0;
}

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

using namespace std;

int main()
{
    int i,j,k;
    int n;
    cin>>n;
    int an=1;
    k=1;
    for(i=0;i<n;i++){
        cin>>j;
        if (j%2==0){
        k*=2;
        }else{
         k*=1;
        }
        an*=3;
    }
    cout<<an-k;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define int long long int
#define mii map<int, int>
#define vi vector<int>
#define fi(i, a, n)             \
    for (int i = 0; i < n; i++) \
    {                           \
        cin >> a[i];            \
    }
#define fo(i, a, n)             \
    for (int i = 0; i < n; i++) \
    {                           \
        cout << a[i] << " ";    \
    }
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define mk(arr, n, type) type *arr = new type[n];
#define pw(b, p) pow(b, p) + 0.1
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define lbrk printf("\n")

using namespace std; //_S_A_R_T_H_A_k_//
/// JAI SHREE RAM!!! ;{'*' <_l_> '*' };
/// Saare jahan se acha hindustan humara .....
/// JAI HIND DOSTON //-__ -//
void lcsBU(string s1,string s2,int n,int m){
    int dp[n+1][m+1] = {0};
    for (int  i = 0; i <= n; i++)
    {
        for (int  j = 0; j <= m; j++)
        {
             if(i==0 || j == 0)
            {
                dp[i][j] = 0;
                continue;
            }
 
           if(s1[i-1]==s2[j-1]){
              /// v.push_back(s1[i-1]);
               dp[i][j] = 1 + dp[i-1][j-1];
           }
           else
           {
               dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
           }
        }        
        }
    //    return dp[s1.size()][s2.size()];
    int i = n;
    int j = m;
    string res;
    while (i>0 and j>0)
    {
        if(dp[i][j]==dp[i][j-1]){
            j--;
        }
        else if (dp[i][j]==dp[i-1][j])
        {
            i--;
        }
        else{
         res = s1[i-1]+res;   
         i--;
        j--;
        }
    }
    cout<<res<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    string s1, s2;
    cin>>s1>>s2;
 int n =s1.length();
 int m = s2.length();
   lcsBU(s1,s2,n,m);
}

Measured memory_bytes: 70656
N, K = map(int, input().split())
S = input()

o = []
l = [0]

prev = '1'
for s in S:
	if s == '1':
		if prev == '0':
			l.append(1)
		else:
			l[-1] += 1
	else:
		if prev == '1':
			o.append(1)
		else:
			o[-1] += 1
	prev = s
l.append(0)

agg = sum(l[0:K+1]) + sum(o[0:K])
max_agg = agg
for i in range(1, len(o)-K+1):
	agg -= l[i-1] + o[i-1]
	agg += l[i+K] + o[i+K-1]
	max_agg = max(max_agg, agg)
print(max_agg)


Measured memory_bytes: 4476
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define   ull unsigned long long 
#define mp make_pair
#define pb push_back
const int MAX=2e5+9;
const long long mod=1e9+7;
using namespace std;
vector<int>adj[MAX];
int main(){
	int n;
	cin>>n;
	vector<int>a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	vector<int>s;
	for(int i=n-1;i>=0;i--){
		int idx=upper_bound(s.begin() , s.end() , a[i])-s.begin();
		if(idx==s.size())
			s.push_back(a[i]);
		else{
			s[idx]=a[i];
		}
	}
	cout<<s.size();

}

Measured memory_bytes: 6012
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   string s;
   cin>>s;
   int a=stoi(s.substr(0,2));
   int b=stoi(s.substr(2,2));
   bool x=(1<=a and a<=12);
   bool y=(1<=b and b<=12);
   if(x&y)cout<<"AMBIGUOUS"<<endl;
   else if(y)cout<<"YYMM"<<endl;
   else if(x)cout<<"MMYY"<<endl;
   else cout<<"NA"<<endl;  
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


Measured memory_bytes: 256
<?php
 
  $N = trim(fgets(STDIN));
 
  $H = explode(" ", trim(fgets(STDIN)));
 
  $count = 0;
  $max = 0;
 
  for ($i = 0; $i < ($N - 1); $i++) {
 
      if ($H[$i] >= $H[$i + 1]) {
 
          $count ++;
        
      } else {
 
          $max = max($max, $count);
          $count = 0;
        
      } 
    
  }
 
  $max = max($max, $count);
 
echo $max
 
?>

Measured memory_bytes: 14840
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n, m; std::cin >> n >> m;
    std::vector<std::vector<int>> edg(n);
    for (int i = 0; i < m; i++) {
        int a, b; std::cin >> a >> b;
        a--; b--;
        edg[a].push_back(b);
    }
    std::vector<int> prev(n);
    auto func = [&](const int s) {
        std::fill(prev.begin(), prev.end(), -1);
        std::deque<std::pair<int, int>> que;
        que.emplace_back(s, 0);
        while (!que.empty()) {
            int pos = que.front().first;
            int d = que.front().second;
            que.pop_front();
            if (pos == s && d > 0) return d;
            for (int u : edg[pos]) {
                if (prev[u] != -1) continue;
                prev[u] = pos;
                que.emplace_back(u, d + 1);
            }
        }
        return -1;
    };
    int s = -1, min = 1e9;
    for (int i = 0; i < n; i++) {
        int d = func(i);
        if (d == -1) continue;
        if (d < min) {
            min = d;
            s = i;
        }
    }
    if (s == -1) {
        std::cout << -1 << std::endl;
        return 0;
    }
    func(s);
    std::vector<int> ans = { s };
    int pos = prev[s];
    while (pos != s) ans.push_back(pos), pos = prev[pos];
    std::cout << ans.size() << std::endl;
    for (int i : ans) std::cout << i + 1 << std::endl;
    return 0;
}


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

int main(){
    int N;
    cin>>N;
    vector<ll> d;
    for(int i=0;i<N;i++){
        ll x;
        cin>>x;
        d.push_back(x);
    }

    sort(d.begin(),d.end());
    ll a=0,b=0;
    ll memory=0;
    for(int i=N-1;i>=0;i--){
        if(d.at(i)==memory){
            if(a==0) {
                a=memory;
                memory=0;
            }
            else if(b==0) b=memory;
        }
        else memory=d.at(i);
        if(b!=0) break;
    }

    cout<<a*b<<endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string ans, a;
    cin >> a;
    switch(a[a.size() - 1]){
        case '2':
        case '4':
        case '5':
        case '7':
        case '9':
            ans = "hon";
            break;
        case '0':
        case '1':
        case '6':
        case '8':
            ans = "pon";
            break;
        case '3':
            ans = "bon";
            break;
    }

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

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

int main()
{
    string x;
    cin>>x;
    int n=x.size(),c=0,cp=0;
    string y= x.substr(2,n-3);
    for(int j=0;j<y.size();j++)
    {
        if(y[j]=='C')
        c++;
        else
        if(y[j] != 'C' && y[j]!='A' && y[j]>='A' && y[j]<='Z')
        cp++;
    }
    if(x[0]=='A' && c==1 && cp==0 && x[1]>='a' && x[1]<='z' && x[n-1]>='a' && x[n-1]<='z')
    cout<<"AC"<<endl;
    
    else
    {
        cout<<"WA"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vector<int> v(n,0); for (int i=0; i<n; ++i) cin >> v[i];
    int sum = 0;
    for (int i=0; i<n; ++i)
    {
        sum += v[i];
    }
    int ave = sum/n;
    int ave1 = ave + 1;
    int ave2 = ave - 1;
    int ans = 0;
    int ans1 = 0;
    int ans2 = 0;
    for (int i=0; i<n; ++i)
    {
        ans += (ave-v[i]) * (ave-v[i]);
        ans1 += (ave1-v[i]) * (ave1-v[i]);
        ans2 += (ave2-v[i]) * (ave2-v[i]);
    }
    cout << min(ans2, min(ans, ans1)) << endl;
    return 0;
}


Measured memory_bytes: 3676
#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 <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int H, W;
  cin >> H >> W;
  vector<string> A(H);
  int cnt = 0;
  for (int i = 0; i < H; i++) {
    cin >> A[i];
    for (int j = 0; j < W; j++) {
      if (A[i][j] == '#') cnt++;
    }
  }
  if (cnt != H + W - 1) {
    cout << "Impossible" << endl;
    return 0;
  }


  vector<vector<int>> dp(H, vector<int>(W));
  dp[0][0] = A[0][0] == '#';
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (A[i][j] == '.') continue;
      if (i > 0) dp[i][j] |= dp[i - 1][j];
      if (j > 0) dp[i][j] |= dp[i][j - 1];
    }
  }
  if (dp[H - 1][W - 1]) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL N = 1000000007;

struct mat{
	LL a[205][205];
}M;

LL n,k;

mat operator * (const mat &x,const mat &y){
	mat c;
	memset(c.a,0,sizeof(c.a));
	for(LL k = 1;k <= n;k ++){
		for(LL i = 1;i <= n;i ++){
			for(LL j = 1;j <= n;j ++){
				c.a[i][j] = (c.a[i][j] + x.a[i][k] * y.a[k][j]) % N;
			}
		}
	}
	return c;
}

mat matE(LL x){
	mat ret;
	for(LL i = 1;i <= x;i ++){
		for(LL j = 1;j <= x;j ++){
			if(i == j) ret.a[i][j] = 1;
			else ret.a[i][j] = 0;
		}
	}
	return ret;
}

void output(mat x){
	for(LL i = 1;i <= n;i ++){
		for(LL j = 1;j <= n;j ++){
			if(M.a[i][j] != 0x3f3f3f3f3f3f3f3f) cout << M.a[i][j] << (j == n ? '\n' : ' ');
			else cout << 0 << (j == n ? '\n' : ' ');
		}
	}
}

mat pwr(mat x,LL y){
	mat ans = x,tmp = x;
	y --;
	while(y){
		if(y & 1) ans = ans * tmp;
		tmp = tmp * tmp;
		y >>= 1;
	}
	return ans;
}

int main(){
	scanf("%lld %lld",&n,&k);
	for(LL i = 1;i <= n;i ++){
		for(LL j = 1;j <= n;j ++){
			scanf("%lld",&M.a[i][j]);
		}
	}
	M = pwr(M,k);
	LL cnt = 0;
	for(LL i = 1;i <= n;i ++){
		for(LL j = 1;j <= n;j ++){
			cnt += M.a[i][j];
			cnt %= N;
		}
	}
	printf("%lld\n",cnt);
	return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

void cinfast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

ll N;
VL(a);
multiset<ll> st;

signed main() {
    LCIN(r);
    cout << 3 * r * r << "\n";
}


Measured memory_bytes: 256