akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if(e-a>k) cout<<":("<<endl;
    else cout<<"Yay!"<<endl;


    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque
def solve():
  n = int(input())
  treenode = [[] for _ in range(n)]
  treecolor = [-2]*n
  for i in range(n-1):
    u,v,w = (int(i) for i in input().split())
    u -= 1
    v -= 1
    treenode[u].append((v,w%2))
    treenode[v].append((u,w%2))
  query = deque([(0,0,0)])
  while query:
    a,b,c = query.popleft()
    if b%2 == 0:
      treecolor[a] = c
      nextc = c
    else:
      treecolor[a] = 1^c
      nextc = 1^c
    for nextnode,weight in treenode[a]:
      if treecolor[nextnode] != -2:
        continue
      else:
        query.append((nextnode,weight,nextc))  
        treecolor[nextnode] = -1
  for i in treecolor:
    print(i)
solve()

Measured memory_bytes: 70816
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
#include<list>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<limits>
#include<cctype>
#include<unordered_map>
#include<complex>
#pragma warning(disable:4996)
using namespace std;

#define debug(i) cout<<"<debug> "<<#i<<" "<<i<<" <\\debug>"<<endl
#define mfor(i,a,b) for(int i=(a);i<=(b);i++)
#define mrep(i,a,b) for(int i=(a);i>=(b);i--)
#define lll __int128
#define Re register
#define mem(a,b) memset(a,(b),sizeof(a))
#define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
typedef pair<int, int> intpair;
typedef pair<long long int, long long int> llpair;
typedef long long int ll;
const double pi = acos(-1);
const double eps = 1e-5;
const int INF = 0x3f3f3f3f;
const long long int INFLL = 0x3f3f3f3f3f3f3f3f;

const int maxn = 2000010;

struct poi
{
	int x;
	int y;
	bool operator < (poi s)const
	{
		return x + y < s.x + s.y;
	}
}p[200010];

bool cmp (poi a,poi b)
{
	return a.x - a.y < b.x - b.y;
}

int main()
{
	Design;
	int n;
	cin >> n;
	mfor(i, 1, n)
	{
		cin >> p[i].x >> p[i].y;
	}
	sort(p + 1, p + 1 + n);
	int ans = 0;
	ans = max(ans, (p[n].x + p[n].y) - (p[1].x + p[1].y));
	sort(p + 1, p + 1 + n, cmp);
	ans = max(ans, (p[n].x - p[n].y) - (p[1].x - p[1].y));
	cout << ans;
}

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

int main() {
  string S;
  cin >> S;
  int count = 0;
  int max_count = 0;
  for (int i=0; i<3; i++) {
    if (S[i] == 'R') {
      count++;
      max_count = max(count, max_count);
    }
    else {
      count = 0;
    }
  }
  cout << max_count << endl;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int uint;

int popcount(uint x) {
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

int tzcnt(uint x) {
    return popcount(~x & x - 1);
}

struct Point {
    int x, y;

    Point(int p, int q) : x(p), y(q) {}
};


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

    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int ans = 0;

    for (int i = 0; i <= A; ++i) {
        for (int j = 0; j <= B; ++j) {
            for (int k = 0; k <= C; ++k) {
                ans += (500 * i + 100 * j + 50 * k) == X;
            }
        }
    }

    out(ans);

    int aaa;
    cin >> aaa;
}

Measured memory_bytes: 896
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0430_atcoder問題_09
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(input[0]);
            int b = Convert.ToInt32(input[1]);
            Console.WriteLine(a+(b/2));
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    vint a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(ALL(a),greater<int>());
    cout << a[0]*10+a[1]+a[2] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, a[100001], ma, mi, p;
int main()
{
    cin >> n;
    mi = 1e9;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        ma = max(ma, a[i]);
        mi = min(mi, a[i]);
    }
    if (ma - mi > 1) {
        cout << "No" << endl;
    } else {
        if (ma == mi) {
            if (ma + 1 != n && ma << 1 > n) {
                cout << "No" << endl;
            } else {
                cout << "Yes" << endl;
            }
        } else {
            for (int i = 1; i <= n; ++i) {
                if (a[i] == mi) p++;
            }
            if (ma <= p || ma - p << 1 > n - p) {
                cout << "No" << endl;
            } else {
                cout << "Yes" << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 640
#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);

	int n, i, j, k, minn, maxx, x;
	cin >> n >> minn;
	maxx = minn;
	for (i = 1; i < n; i++) {
		cin >> x;
		minn = min(minn, x);
		maxx = max(maxx, x);
	}

	cout << maxx - minn << "\n";


	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
    int a, b;
 
    scanf("%d%d", &a, &b);

    if (a < b)
    {
        printf("a < b\n");
    }

    else if (a > b) 
     {
        printf("a > b\n");
     }

    else 
     {
        printf("a == b\n");
     }
    return 0;
}


Measured memory_bytes: 2128
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;


int main() {
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    if (a < b) {
        for (int i = 0; i < b; i++) {
            cout << a;
        }
    }
    else {
        for (int i = 0; i < a; i++) {
            cout << b;
        }
    }


}

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

int main(void) {
    int H, W;
    
    cin >> H >> W;
    
    while( !(H == 0 && W == 0) ) {
        for(int h=1; h<=H; h++) {
            for(int w=1; w<=W; w++) {
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
        
        cin >> H >> W;
    }
    
    return 0;
}

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

using namespace std;

#define fo(i, n) for(i = 0; i < n; i++)
#define of(i, n) for(i = n - 1; i >= 0; i--)
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long k=0, t=0,i=0,mex=0,e=0,cnt=0;
    ll n,m;
    cin>>n;
    int a[n],dp[n];
    fo(i,n) cin>>a[i];
    dp[n-2]=abs(a[n-1]-a[n-2]);
    dp[n-1]=0;
    for(i=n-1;i>=1;--i)
    {
        dp[i-2]=min(dp[i-1]+abs(a[i-1]-a[i-2]),dp[i]+abs(a[i]-a[i-2]));
    }
    cout<<dp[0];
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    int x,y,z;
  cin>>x>>y>>z;
  int wdt=x-z;
  int ans;
  ans=wdt/(y+z);
  cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
//#define local
#ifdef local
    #include "dbg-macro/dbg.h"
#endif
//#define hacks
#ifdef hacks
    #include <boost/multiprecision/cpp_int.hpp>
#endif
#define p std::pair
#define ll long long
#define ld long double
#define ull unsigned long long
#define vi std::vector<int>
#define pi std::pair<int, int>
#define mp std::make_pair
#define stdabs std::abs
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
#define vec std::vector
#define oreq |=
#define npm next_permutation
#define Yes std::cout << "Yes" << std::endl
#define No std::cout << "No" << std::endl
#define YES std::cout << "YES" << std::endl
#define NO std::cout << "NO" << std::endl
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy8[8] = {0, 1, 0, -1, 1, -1, 1, -1};
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);
ll extgcd(ll a, ll b, ll& x, ll& y);
ll nCr(ll n, ll r);
void stat();
template <typename T> T fact(T num);
unsigned long long modpow(int x__, int n__, long long mod__);
template <typename T> void debug(const T& t);
constexpr ll mod10_9p7 = 1000000000 + 7;

/**************************************************************/
ull ans=0;
void f(int x,int y,int z){
	if(x%2!=0||y%2!=0||z%2!=0){
		return ;
	}
	int nx,ny,nz;
nx=(y+z)/2;
ny=(z+x)/2;
nz=(x+y)/2;
if(x==nx&&y==ny&&z==nz){cout<<-1<<endl;exit(0);}
++ans;
	f(nx,ny,nz);
}
int main()
{
    stat();
    ll a, b, c;
    cin >> a >> b >> c;
f(a,b,c);
cout<<ans<<endl;

    return 0;
}
/**************************************************************/
ll extgcd(ll a, ll b, ll& x, ll& y)
{
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) {
        is_prime[i] = true;
    }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++) {
        if (is_prime[i]) {
            for (unsigned ll j = 2 * i; j <= N; j += i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

void stat(){
#ifdef local
    rep(i, 2){std::cout << "local enable" << std::endl;
}
#endif
#ifdef hacks
rep(i, 2) { std::cout << "boost enable" << std::endl; }
#endif
}

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

template <typename T> T fact(T num)
{
    if (num == 1) { return 1; }
    return num * fact(num - 1);
}

unsigned long long modpow(int x__, int n__, long long mod__)
{
    long long ret__ = 1;
    for (long long i__ = 0; i__ < n__; ++i__) {
        ret__ = ret__ * x__ % mod__;
    }
    return ret__;
}

template <typename T> void debug(const T& t)
{
#ifdef local
    dbg(t);
#endif
}


Measured memory_bytes: 3624
S = list(input())
T = list(input())
len_s = len(S)
len_t = len(T)

max_same = 0

for i in range(len_s - len_t + 1):
  tmp = 0
  for j in range(len_t):
    if S[i+j] == T[j]:
      tmp += 1
    max_same = max(max_same, tmp)

print(len_t - max_same)

Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
struct node
{
    int l,r,i;
    bool operator<(const node& x)const
    {
        if((l>=r)==(x.l>=x.r))
        {
            if((l>=r)) return r<x.r;
            return l>x.l;
        }
        return l-r>x.l-x.r;
    }
} arr[2000007],brr[2000007];
int main()
{
    int n;
    cin>>n;
    string s;
    for(int i=0; i<n; i++)
    {
        cin>>s;
        int l=0,r=0;
        for(int j=0; j<(int)s.length(); j++)
        {
            if(s[j]=='(')
                l++;
            else if(l)
                l--;
            else
                r++;
        }
        arr[i]= {l,r,i};
        brr[i]= {r,l,i};
    }
    sort(arr,arr+n);
    sort(brr,brr+n);
    int ll=0;
    for(int i=0; i<n; i++)
    {
        if(ll<arr[i].r)
        {
            cout<<"No"<<endl;
            return 0;
        }
        else
            ll+=arr[i].l-arr[i].r;
    }

    if(ll==0)
    {
        cout<<"Yes"<<endl;
       /* for(int i=0; i<n; i++)
            cout<<arr[i].i+1<<' ';
        cout<<endl;*/
    }
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 26892
D, N = map(int,input().split())
if D == 0:
    if N < 100:
        print(N)
    else:
        print(101)
elif D == 1:
    if N < 100:
        print(N*100)
    else:
        print(10100)
else:
    if N < 100:
        print(N*10000)
    else:
        print(1010000)


Measured memory_bytes: 2940
A,B,Q=map(int,input().split())
s=[int(input()) for i in range(A)]
t=[int(input()) for i in range(B)]
X=[int(input()) for i in range(Q)]
s.append(2*10**10+1)
t.append(2*10**10+1)
import bisect
for i in range(Q):
  a=bisect.bisect_left(s,X[i])
  b=bisect.bisect_left(t,X[i])
  s1,s2=s[a-1],s[a]
  t1,t2=t[b-1],t[b]
  ans=10**10*2
  for k in [s[a],s[a-1]]:
    for j in [t[b],t[b-1]]:
      d=abs(k-j)+min(abs(k-X[i]),abs(j-X[i]))
      ans=min(ans,d)
  print(ans)

Measured memory_bytes: 16136
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int N, Num[200005];
long long result;

int abs(int num)
{
    return num > 0 ? num : -num;
}

int main()
{
    scanf("%d", &N);
    for(int i = 0; i < N; i++)
    {
        scanf("%d", &Num[i]);
        Num[i] -= i;
    }
    sort(Num, Num + N);
    for(int i = 0; i < N; i++)
    {
        result += abs(Num[i] - Num[N / 2]);
    }
    printf("%lld", result);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
string s, t;
int a[30], f[300000][30];
int main() {
	cin>>s>>t;
	string ss=s;
	int nn=ss.size();
	s=s+s;
	int n=s.size();
	
	for (int j=0; j<26; j++) a[j]=-1;
	
	for (int i=n-1; i>=0; i--) {
		a[s[i]-'a']=i;	
		for (int j=0; j<26; j++) f[i][j]=a[j];
	}
	//  0..n-1, 
	//f[i][j] 表示 ihei 之后第一个j。 
	long long ans=0;
	int start=-1;
	for (int i=0; i<t.size(); i++) {
		int nxt = f[start+1][t[i]-'a'];
		if (nxt==-1) {
			cout<<-1<<endl;
			return 0;
		}
	//	cout<<t[i]<<": "<<start<<" "<<nxt<<endl;
		ans+=nxt-start;
		start = nxt%nn;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 25344
class UnionFind(n: Int) {
    private val parent = IntArray(n, {-1})
    private val rank = IntArray(n, {0})
    private val size = IntArray(n, {1})
    private var numTree = n
    
    fun find(x: Int): Int {
        if (parent[x] == -1) {
            return x
        } else {
            parent[x] = find(parent[x])
            return parent[x]
        }
    }
    
    fun isSame(x: Int, y: Int): Boolean {
        return find(x) == find(y)
    }
    
    fun getSize(): Int {
        return numTree
    }
    
    fun sizeOf(x: Int): Int {
        return size[find(x)]
    }
    
    fun rankOf(x: Int): Int {
        return rank[find(x)]
    }
    
    fun unite(x: Int, y: Int) {
        val parentX = find(x)
        val parentY = find(y)
        
        if (parentX == parentY) {
            return
        }
        
        numTree--
        
        if (rank[parentX] < rank[parentY]) {
            parent[parentX] = parentY
            size[parentY] += size[parentX]
        } else {
            parent[parentY] = parentX
            size[parentX] += size[parentY]
            if (rank[parentX] == rank[parentY]) {
                rank[parentX]++
            }
        }
    }
}

fun main(args: Array<String>) {
    val (H, W) = readInputLine().split(" ").map { it.toInt() }
    
    val map = Array(H) { readInputLine().toCharArray() }
    
    val unionFind = UnionFind(H * W)
    
    for (i in 0 until H) {
        for (j in 0 until W) {
            if (i < H - 1 && map[i][j] != map[i + 1][j]) {
                unionFind.unite((i + 1) * W + j, i * W + j)
            }
            if (j < W - 1 && map[i][j] != map[i][j + 1]) {
                unionFind.unite(i * W + (j + 1), i * W + j)
            }
        }
    }

    var ans = 0L

    val black = LongArray(H * W)
    val white = LongArray(H * W)
    
    for (i in 0 until H) {
        for (j in 0 until W) {
            if (map[i][j] == '#') {
                black[unionFind.find(i * W + j)]++
            } else {
                white[unionFind.find(i * W + j)]++
            }
        }
    }
    
    for (i in 0 until H * W) {
        ans += black[i] * white[i]
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


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

int main() {
  int A, B;
  cin >> A >> B;
  
  int c = 0;
  for (int i = A; i <= B; i++) {
    int t = i;
    int ds[5];
    for (int j = 0; j < 5; j++) {
      ds[4 - j] = t % 10;
      t /= 10;      
    }
    if (ds[0] == ds[4] && ds[1] == ds[3]) {
      c++;
    }
  }
  cout << c << endl;
}

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

int w, h, black;
char tile[24][24];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void dfs(int x, int y){
    black++;
    tile[x][y] = '#';
    for(int i = 0; i < 4; i++){
        if( x+dx[i] >= 0 && x+dx[i] < h &&
            y+dy[i] >= 0 && y+dy[i] < w &&
            tile[ x+dx[i] ][ y+dy[i] ] == '.' ){
            dfs( x+dx[i], y+dy[i] );
        }
    }
}

int main(){
    int i, j;
    while( cin >> w >> h, w||h ){
        for(i = 0; i < h; i++){
            cin >> tile[i];
        }
        black = 0;
        for(i = 0; i < h && !black; i++){
            for(j = 0; j < w && !black; j++){
                if( tile[i][j] == '@' ){
                    dfs(i, j);
                }
            }
        }
        cout << black << endl;
    }
    return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }

  int q; cin >> q;
  int cnt = 0;
  for (int i = 0; i < q; i++) {
    int y; cin >> y;
    if (binary_search(v.begin(), v.end(), y))
    cnt++;
  }
  cout << cnt << endl;
}



Measured memory_bytes: 3092
#include <iostream>                                             
#include <vector>                                               
#include <numeric>                                              
#include <cmath>                                                
#include <iomanip>                                              
using namespace std;                                            
                                                                
int main() {                                                    
  int n, x;                                                     
  double m;                                                     
  while (true) {                                                
    cin >> n;                                                   
    if (n==0) {                                                 
      break;                                                    
    }                                                           
    vector <double> s;                                          
    for (int i=0; i<n; i++) {                                   
      cin >> x;                                                 
      s.push_back((double)x);                                   
    }                                                           
    m = accumulate(s.begin(),s.end(),0.0)/s.size();             
    double a = 0;                                               
    for (int i=0; i<s.size(); i++) {                            
      a += (pow(s[i]-m,2));                                     
    }                                                           
    a = sqrt(a/n);                                              
    cout << fixed << setprecision(8) << a << endl;              
  }                                                             
  return 0;                                                     
}                                                               
                                                                
                                        

Measured memory_bytes: 3244
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const ll MOD = 1e9 + 7;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


ll h,w;
vector<string> v(50);

ll modpow(ll a, ll n) {
    ll ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ret;
}

ll modinv(ll a) { return modpow(a, MOD - 2); }

ll comb(ll n, ll r) {
    ll ret = 1;
    for (ll i = 0; i < r; i++) ret = ret * (n - i) % MOD;
    for (ll i = 1; i <= r; i++) ret = ret * modinv(i) % MOD;
    return ret;
}

int main(){

    ll x,y; cin >> x >> y;
    ll cx = 0,cy = 0;
    ll tx = x, ty = y;

    while(ty > 0 && tx > 0){
        if(ty > tx){
            ty -= 2;
            tx -= 1;
            cy += 1;
        }else{
            ty -= 1;
            tx -= 2;
            cx += 1;
        }
    }

    if(tx == 0 && ty == 0){
        ll sum = cx + cy;
        cout << comb(sum, cx);
    }else{
        cout << 0;
    }

    /*
    if(x == y) {
        if (x % 3 == 0 && y % 3 == 0) {
            cout << comb(x / 3 * 2, x / 3);
        }else{
            cout << 0;
        }
    }
*/

}

Measured memory_bytes: 3660
#include <stdio.h>
#define MAX2(x,y)	((x)>(y)?(x):(y))
#define MAX3(x,y,z)	((x)>(MAX2(y,z)) ? (x):(MAX2(y,z)))

int main(){
  int	p,q,r;

  scanf("%d %d %d", &p, &q, &r);
  printf("%d", (p+q+r)-MAX3(p,q,r));

  return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	int h,w;
	cin >> h >> w;
	string s[h];
	FOR(i,h) cin >> s[i];
	FOR(i,w+2) cout << '#';
	cout << "\n";
	FOR(i,h){
		cout <<'#' <<s[i]<<"#\n";
	}
	FOR(i,w+2) cout << '#';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

bool isPrime(int x) {
    if (x == 2) return true;
    if (x < 2 || (x % 2) == 0) return false;

    int i = 3;
    
    while (i <= sqrt(x)) {
        if ((x % i) == 0) {
            return false;
        }
        i = i + 2;
    }
    return true;
}
int main()
{
    int N{ 0 };
    cin >> N;
    int nCount = 0;

    for (int i = 0; i < N;i++) {
        int x{ 0 };
        cin >> x;

        if (isPrime(x)) nCount++;
    }
    cout << nCount << endl;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <stdlib.h>
#include <vector>
#include <math.h>
using namespace std;

int main(void) {
    vector<int> array;
    
    int s;
    cin >> s;
    
    bool found = false;
    array.push_back(s);
    
    
    int counter = 1;
    int current = 0;

    
    while (found == false) {
        counter++;
        auto i = array.back();
        if (i % 2 == 0)
            current = i / 2;
        else
            current = 3 * i + 1;
        for (auto x: array) {
            if (x == current) {
                found = true;
                cout << counter <<endl;
                break;
            }
        }
        array.push_back(current);
    }
    return 0;
}

Measured memory_bytes: 256
/*
  -> Do Good Die Great
*/
#include <bits/stdc++.h>
#define int long long int
#define pii pair<int, int>
#define ff first
#define ss second
#define eb emplace_back
#define pb push_back
#define MOD 1000000007
#define Hiraishin                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr);                 \
    cout.tie(nullptr);
#define tests \
    int t;    \
    cin >> t; \
    while (t--)
using namespace std;

// global

void solve()
{
    int n, k;
    cin >> n >> k;
    int arr[n + 1];
    for (int i = 1; i <= n; i++)
        cin >> arr[i];
    int dp[n + 1];
    dp[0] = 0;
    dp[1] = 0;
    for (int i = 2; i <= n; i++) {
        int res = INT_MAX, cost = 0;
        for (int j = 1; j <= k; j++) {
            if (j < n and i - j > 0) {
                //cout << i << ' ' << j << ' ' << dp[i - j] << ' ' << abs(arr[i] - arr[i - j]) << '\n';
                res = min(res, dp[i - j] + abs(arr[i] - arr[i - j]));
            }
        }
        dp[i] = res;
        //cout << dp[i] << ' ';
    }
    cout << dp[n] << '\n';
}

signed main()
{
    Hiraishin
    // tests
    solve();
    return 0;
}

Measured memory_bytes: 5160
#include<iostream>
#include<vector>

using std::cout;
using std::endl;
using std::cin;
using std::vector;

void printVector(vector<vector<int> > v) {
    for (int i = 0; i < v.size(); i++ ) {
        for (int j = 0; j < v.front().size(); j++) {
            cout << v[i][j] << " "; 
        }
        cout << endl;
    }
}

int FromCharToInt(char moji) {
    if (moji == 'S') {
        return 0;
    } else if (moji == 'H') {
        return 1;
    } else if (moji == 'C') {
        return 2;
    } else {
        return 3;
    }
}

char FromIntToChar(int mojinum) {
    if (mojinum == 0) {
        return 'S';
    } else if (mojinum == 1) {
        return 'H';
    } else if (mojinum == 2) {
        return 'C';
    } else {
        return 'D';
    }
}

void searchVector(vector<vector<int> > v) {
    for (int i = 0; i < v.size(); i++ ) {
        for (int j = 0; j < v.front().size(); j++) {
            if( v[i][j] == 0) {
                char mark = FromIntToChar(i);
                cout << mark << " " << j + 1 << endl;
            }
        }
    }
    
}

int main(void) {
    vector<vector<int> > v(4, vector<int>(13, 0));
    int n;
    cin >> n;
    char moji;
    int mojinum;
    int num;
    for (int i = 0; i < n; i++) {
        cin >> moji >> num;
        mojinum = FromCharToInt(moji);
        v[mojinum][num - 1] = 1;
    }
    searchVector(v);
    return 0;
}

Measured memory_bytes: 3156
using System;

namespace C_sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split();

            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            var c = int.Parse(line[2]);

            if (a < b)
            {
                if (c < a)
                {
                    Console.WriteLine($"{c} {a} {b}");
                }
                else if (c < b)
                {
                    Console.WriteLine($"{a} {c} {b}");
                }
                else
                {
                    Console.WriteLine($"{a} {b} {c}");
                }
            }
            else
            {
                if (c < b)
                {
                    Console.WriteLine($"{c} {b} {a}");
                }
                else if (c < a)
                {
                    Console.WriteLine($"{b} {c} {a}");
                }
                else
                {
                    Console.WriteLine($"{b} {a} {c}");
                }
            }
        }
    }
}



Measured memory_bytes: 15972
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

/*
5
-1 -1 3 -1 -1

ans:3
4
5 4 1 1
*/
void solve(){
	int N;
	cin >> N;
	vector<LL> A(N);
	for(int i=0;i<N;++i){
		cin >> A[i];
	}
	vector<LL> dp = A;
	for(int i=0;i<N;++i){
		for(int j=i-2;j>=0;j-=2){
			dp[i] = max(dp[i],dp[j]+A[i]);
		}
	}
	LL ans = -LINF;
	int posR;
	for(int i = N-1;i >= 0;--i){
		if( dp[i] > ans ){
			ans = dp[i];
			posR = i;
		}
	}
	cout << ans << endl;
	vector<int> op;
	int Len = N;
	//右端を消す
	for(int i=N-1;i>=0;--i){
		if( posR < i ){
			op.push_back( Len );
			--Len;
		}
	}

	int posL;
	while(Len>2){
		LL ter = dp[posR] -A[posR];
		for(posL=posR-2;posL>=0;posL-=2){
			if(dp[posL] == ter ){
				int count = (posR-posL)/2;
				for(;count;count--){
					op.push_back( Len-count);
					Len -= 2;
				}
				break;
			}
		}
		if( posL < 0 ){
			while(Len>1){
				op.push_back( 1 );
				Len--;
			}
		}else{
			posR = posL;
		}
	}
	if(Len>1){
		op.push_back(1);
	}
	int size = op.size();
	cout << size << endl;
	for(int i=0;i<size;++i){
		cout << op[i] << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	char date[10];
	for(int i = 0; i < 10; i++){
	scanf("%c", &date[i]);
}
	if(date[3] == '7'){
		date[3] = '8';
	}
	for(int i = 0; i < 10; i++){
	printf("%c", date[i]);
}
	return 0;
}

Measured memory_bytes: 1556
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n, m;
    cin >> n >> m;
    multiset<ll> a;
    rep(i,n) {
        ll ai; cin >> ai;
        a.insert(ai);
    }
    rep(i,m) {
        auto it = a.rbegin();
        ll mx = *it;
        a.erase(prev(a.end()));
        a.insert(mx/2);
    }
    ll ans = 0;
    for (auto id = a.begin(); id != a.end(); id++) {
        ans += *id;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 8304
def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    x = a[-1]
    ans = a[-1]
    for i in range(1,n):
        if x==0:
            x = a[-1-i]
        e = x-1
        if e>a[-1-i]:
            print(-1)
            return
        elif e<a[-1-i]:
            x = a[-1-i]
            ans += a[-1-i]
        else:
            x -= 1
    if x==0:
        print(ans)
    else:
        print(-1) 

if __name__ == "__main__":
    main()

Measured memory_bytes: 16784
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string x="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int n;
  string y;
    cin>>n>>y;
  rep(i,y.size()){
    rep(j,26){
      if(y[i]==x[j]){
        y[i]=x[j+n];
        break;
      }
    }
  }
  cout<<y;
  
} 

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
 
 
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll r,s,p;
    cin>>r>>s>>p;
    vector<ll> v(600000);
    FOR(i,0,p){
        ll x,y;
        cin>>x>>y;
        if(y>s) y = y-s;
        else y = s+1-y;
        x = r-x+1;
        v[x+y]++; 
    }
    ll res = 0;

    FOR(i,0,599999){
        if(v[i] != 0){
            v[i+1] = v[i+1] + v[i] - 1;
            res = i;
        }
    }

    cout<<res<<endl;
}


Measured memory_bytes: 7576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 50 + 5;
ll arr[maxn];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    ll res = 0;
    for (int i = 0; i < n; ++i)
        cin >> arr[i];
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
            res += arr[i] * arr[j];
    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 256
/*input
abaccaba
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
set<char> st;
int main()
{
	IOS;
	string s;
	cin>>s;
	for(char c:s){
		if(st.count(c)) st.erase(c);
		else st.insert(c);
	}
	if(!SZ(st)) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=3003,INF=1<<30;

int main(){
    
    ll N;cin>>N;
    ll dp[80][3];//i桁みて、そこより上でのNとvとの差が0,1,2以上の個数
    
    memset(dp,0,sizeof(dp));
    
    dp[0][0]=1;
    
    for(int i=0;i<62;i++){
        if(N&(1LL<<(61-i))){
            dp[i+1][0]+=dp[i][0];
            dp[i+1][1]+=dp[i][0];
            
            dp[i+1][1]+=dp[i][1];
            dp[i+1][2]+=2*dp[i][1];
            
            dp[i+1][2]+=3*dp[i][2];
        }else{
            dp[i+1][0]+=dp[i][0];
            
            dp[i+1][0]+=dp[i][1];
            dp[i+1][1]+=dp[i][1];
            dp[i+1][2]+=dp[i][1];
            
            dp[i+1][2]+=3*dp[i][2];
        }
        
        for(int j=0;j<3;j++){
            dp[i+1][j]%=mod;
        }
    }
    
    ll ans=0;
    
    for(int j=0;j<3;j++){
        ans+=dp[62][j];
        ans%=mod;
    }
    
    cout<<ans<<endl;
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;



int main(){
string s,t;cin >> s>> t;
int lens=s.length(),lent=t.length();
bool ans = false;
string maxs(s.size(), 'z');
string ss = maxs;
if(lens<lent){
    cout << "UNRESTORABLE" << endl;
    return 0;
}
else{
    rep(i,lens-lent+1){
            bool checks=true;
            for(int j = 0;j<lent;j++){
                if(s[i+j]!=t[j] and s[i+j]!='?'){
                    checks = false;
                }
            }
            string tem=s;
            if(checks){
                rep(k,lens){
                    if(s[k]=='?')tem[k]='a';
                }
                rep(j,lent){
                    tem[i+j]=t[j];
                }
            }
            else continue;
        ss=min(tem,ss);
        }
}
if(ss==maxs) cout << "UNRESTORABLE" << endl;
else cout << ss << endl;


return 0;
}





Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,Q[4],a[10],ans=1e9;
void DFS(int x, int S, int v) {
	if (x == 4){
		if (!v) {
			cout<<"";
		}
		ans = min(ans, v);
		return;
	}
	for (int i=1; i<(1<<n); ++i) {
		if (i&S) continue;
		int cnt=0, sum=0;
		for (int j=0; j<n; ++j)
			if (i&(1<<j)) cnt++, sum+=a[j];
		DFS(x+1, S|i, v+abs(sum-Q[x])+(cnt-1)*10);
	}
}
int main() {
	cin >> n >> Q[1] >> Q[2] >> Q[3];
	for (int i=0; i<n; ++i) cin >> a[i];
	DFS(1,0,0);
    cout << ans << endl;
}


Measured memory_bytes: 256
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_A main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi; 
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_A() {}


int main_A() {
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    int x, y; cin >> x >> y;

    set<int> g1, g2;
    g1.insert({ 1,3,5,7,8,10,12 });
    g2.insert({ 4,6,9,11 });

    string ans = "";
    if (x == 2 || y == 2) ans = "No";
    else if (g1.count(x)>0 && g1.count(y)>0) ans = "Yes";
    else if (g2.count(x)>0 && g2.count(y)>0) ans = "Yes";
    else ans = "No";

    cout << ans << endl;

    return 0;
}

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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

string s;
int cn = 0, f = 0;
ll res = 0;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> s;
	reverse(all(s));

	for (int c : s) {
		if (c == 'A') {
			if (!f) res += cn;
			else cn = f = 0;
		} else if (f) {
			if (c == 'B') cn++, f = 0;
			else cn = 0;
		} else {
			if (c == 'C') f = 1;
			else cn = 0;
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 720
#include<iostream>
#include<algorithm>
#include<numeric>
using ll = long long int;
using namespace std;

ll n, m;

int main(void) {
	cin >> n >> m;
	ll ret = 0;
	if (n < m) {
		if (n < m / 2) {
			ret = n;
			m -= n * 2;
			n = 0;
			ret += m / 4;
		}
		else {
			ret = m / 2;
			n -= m / 2;
			m = 0;
		}

	}
	else {
		ret = m / 2;
	}


	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define int long long
using namespace std;

void solve(){
    int n , w; 
    cin >> n >> w ;
    int val[n], wht[n];
    for(int i=0;i<n;i++)
        cin >> wht[i] >> val[i] ;

    int sum_val = accumulate(val,val+n,0ll);

    vector<int>dp(sum_val+1,INT_MAX);
    dp[0] = 0;
    for(int i=0;i<n;i++){
        for(int cur_val = sum_val - val[i] ; cur_val>=0 ; cur_val--){
            dp[cur_val+val[i]] = min(dp[cur_val+val[i]],dp[cur_val]+wht[i]);
        }
    }
    int ans =0;
    for(int i=0;i<=sum_val;i++){
        if(dp[i] <= w) ans = i;
    }
    cout << ans << endl; 
}

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

    int test = 1;
    if(false) cin >> test;
    while(test--)
        solve();

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
ll power(ll x, ll y, ll p) { 
    ll res = 1;    x = x % p;  
    while(y > 0) {
        if(y & 1) res = (res*x) % p; 
        y = y>>1;    x = (x*x) % p; 
    } return res; 
}
ll a[13];
void make(ll i)
{
    a[i]=a[i-1]+pow(26,i);
    if(i<13)
    make(i+1);
    else
    return;
}
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
     
       ll n;
       cin>>n;
       string ans="";
       while(n>0)
       {
           char ch='a';
           n=n-1;
          ll temp=n%26;
          ch=ch+temp;
          ans+=ch;
          n=n/26;
       }
       reverse(all(ans));
       cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <functional>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define P(r) do{for(auto i:r){cout<<i<<' ';}cout<<'\n';}while(0)
int main()
{
    int A, B;
    char op;
    cin >> A >> op >> B;
    cout << (op == '+' ? A + B : A - B) << endl;
    return 0;
}


Measured memory_bytes: 256