akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>

int main(){
  std::string str;
  std::cin>>str;

  long one_count = 0;
  long zero_count = 0;
  for(int i = 0 ; i < (int)str.size() ; i++ ){
    if(str[i] == '0') zero_count++;
    if(str[i] == '1') one_count++;
  }
  long result = std::fabs(zero_count - one_count);
  std::cout<<(int)str.size() - result<<std::endl;
  
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define MID ((l+r)>>1)
#define lc (rt<<1)
#define rc (rt<<1|1)
#define ls lc,l,MID
#define rs rc,MID+1,r
#define st 1,1,n
#define PII pair<int,int>
#define PLL pair<LL,LL>
using namespace std;
//LL pw(LL a, LL b,LL M) { return b ? b & 1 ? a*pw(a, b - 1,M) % M : pw(a*a%M, b>>1,M) : 1; }
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){return x?BIT[x]+sum(x-(x&-x)):0;}
const int N=1e5+1;
const LL M=1e18;
int main(){Accel
	LL n,h,s=0,md=0,x,y;
	cin>>n>>h;
	priority_queue<LL>q;
	REP(i,n){
		cin>>x>>y;	
		q.push(y);
		md=max(md,x);
	}
	LL t=0,R=0;
	while(t<h&&q.size()){
		if(q.top()<=md)break;
		t+=q.top(),R++,q.pop();
	}
	while(h>0&&h>t)h-=md,s++;
	if(h>0&&h<=t)s+=R;
	cout<<s<<endl;
}

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

using namespace std;

using ll = long long;

ll dp[3005][3005];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	for (int j = 1; j <= n; j++) {
		for (int i = 0; i + j <= n; i++) {
			int k = i + j;
			int turn = (n - j) % 2;
			if (turn == 0) {
				dp[i][k] = max(dp[i][k - 1] + a[k - 1], dp[i + 1][k] + a[i]);
			} else {
				dp[i][k] = min(dp[i][k - 1] - a[k - 1], dp[i + 1][k] - a[i]);
			}
		}
	}
	cout << dp[0][n] << endl;
	return 0;
}

Measured memory_bytes: 70016
def successive_subtraction(N, A, i=1, l=[]):
    mx = max(A)
    mn = min(A)
    if i == N - 1:
        print(mx - mn)
        return l
    l.append((mn, mx))
    A.remove(mn)
    A.remove(mx)
    A.append(mn - mx)
    return successive_subtraction(N, A, i + 1, l)

N = int(input())
A = [int(e) for e in input().split()]
A.sort()
l = []
for i in range(N - 2):
    (a, b, c) = (A[0], A[1], A[-1])
    if b < 0:
        l.append((c, a))
        A[-1] = c - a
    else:
        l.append((a, b))
        A[1] = a - b
    A.pop(0)
print(A[1] - A[0])
l.append((A[1], A[0]))
for v in l:
    print(v[0], v[1])

Measured memory_bytes: 18904
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		try {
			
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

String[] hyozyun = br.readLine().split(" ");
			int A =Integer.parseInt(hyozyun[0]);
			int B =Integer.parseInt(hyozyun[1]);
			int C =Integer.parseInt(hyozyun[2]);
			int X =Integer.parseInt(hyozyun[3]);
			int Y =Integer.parseInt(hyozyun[4]);
			int sum = 0;
			if (A + B < 2 * C) {
				sum = A * X + B * Y;
			} else {
				
					if (X > Y) {
						sum = C * 2 * Y + (X - Y) * A;
					} else {
						sum = C * 2 * X + (Y - X) * B;
					}
				
			}
			int compare = 0;
			if (X > Y) {
				compare = X * C * 2;
			} else {
				compare = Y * C * 2;
			}
			if (sum > compare) {
				sum = compare;
			}
			
			System.out.println(sum);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

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

bool prime(int n) {
  bool b = 1;
  for (int i = 2; i * i <= n; i++) {
    if(n % i == 0){
   b = 0; 
   break;}
  }
  return b;
}

int main(){
int N; 
cin >> N; 
  int count = 0; 
  for (int i = 1; i <= 5555; i++) {
    if(prime(i * 10 + 1) == 1){
   cout << i * 10 + 1 << endl;
   count ++; 
   if(count == N){
   break;}
    }
  }
}

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

// in-short-use macros

#define all(c) (c).begin(),(c).end()
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define PI 3.14159265
#define sizes 100010



//main function here
vector<vector<int  > > graph(sizes); 
vector<int > lev(sizes,10000000);
vector<int > par(sizes,10000000);
void bfs(int snode)
{
    queue< int > b;
    vector<bool> visited(sizes,false);
    int count=1;
    visited[snode]=true;
    b.push(snode);
    while(!b.empty())
    {
        int curnode=b.front();
        for(auto neighbour:graph[curnode])
        {
            if(!visited[neighbour])
            {
                 b.push(neighbour);
                 visited[neighbour]=true;
                 lev[neighbour]=count;
                 par[neighbour] = curnode;
                 // cout<<neighbour<<":"<<lev[neighbour]<<"\n";  
            }
        }
        b.pop();
        count++;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    lev[0]=0;
    bfs(1);
    bool ans = true;
    for(int i=2;i<=n;i++)
        if(lev[i]==10000000)
            ans=false;
    if(ans)
    {
        cout<<"Yes\n";
        for(int i=2;i<=n;i++)
        cout<<par[i]<<"\n";
    }
    else
        cout<<"No\n";
    
    return 0;
}

Measured memory_bytes: 10728
#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int a[25];
    int n;
    cin >>n;
    for (int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    int sum=1;
    int most=a[0];
    for (int i=1;i<n;i++)
    {
        if (a[i]>=most)
        {
            sum++;
            most=a[i];
        }
    }
    cout << sum <<endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		//Todo 回文のメソッド作成
		Scanner scan = new Scanner(System.in);
		long s;
		s = scan.nextLong();

		long count_500;
		long count_5;

		count_500 = s / 500;

		long amari = s % 500;

		count_5 = amari / 5;

		long score;

		score = count_500 * 1000 + count_5 * 5;

		System.out.println(score);
	}

	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


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

int main() {
	int n;
	ll c;
	cin >> n >> c;
	vector<ll> x(n+2);
	vector<int> v(n+1);
	x[0] = 0;
	x[n + 1] = c;
	for (int i = 1;i <= n;i++) {
		cin >> x[i] >> v[i];
	}
	ll ans = 0;
	vector<ll> right, left;
	ll sum = 0;
	for (int i = 1;i <= n;i++) {
		sum -= x[i] - x[i - 1];
		sum += v[i];
		right.push_back(sum);
		ans = max(ans, sum);
	}
	sum = 0;
	for (int i = n;i >= 1;i--) {
		sum -= x[i + 1] - x[i];
		sum += v[i];
		left.push_back(sum);
		ans = max(ans, sum);
	}

	vector<ll> right_max, left_max;
	right_max.push_back(0);
	for (int i = 0;i < n;i++) {
		right_max.push_back(max(right_max.back(), right[i] - x[i + 1]));
	}
	left_max.push_back(0);
	for (int i = 0;i < n;i++) {
		left_max.push_back(max(left_max.back(), left[i] - (c - x[n - i])));
	}

	for (int i = 0;i < n;i++) {
		ans = max(ans, left[i] + right_max[n - i - 1]);
	}

	for (int i = 0;i < n;i++) {
		ans = max(ans, right[i] + left_max[n - i - 1]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5364
/*
 * main.c
 *
 *  Created on: 2020/03/28
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

void yesno(int ans) {
	if (ans == 1) {	printf("Yes\n");
	} else {		printf("No\n");	}
	return;
}

void okng(int ans) {
	if (ans == 1) { printf("OK\n");
	} else { 		printf("NG\n");	}
	return;
}

int main()
{
	char a[2] = {0};
	scanf("%s", a);
	if ((a[0] & 0x20) == 0){
		printf("A\n");
	} else {
		printf("a\n");
	}

	//yesno(ans);
	//okng(ans);
	return 0;
}


Measured memory_bytes: 1644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<long long, long long>;
const long long INF = 1001001001;
const long long MOD = 1000000007;
const double EPS = 1e-10;
struct Edge { int from, to; long long cost; };
using Graph = vector<vector<Edge>>;

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

    int n;
    cin>>n;
    int ac=0,wa=0,tle=0,re=0;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        if(s=="AC")ac++;
        if(s=="WA")wa++;
        if(s=="TLE")tle++;
        if(s=="RE")re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}

Measured memory_bytes: 3652
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

int xx1, yy1, xx2, yy2;
int n;
VP V;
double PI = acos(-1.);

int LIS(VI a) {
	int n = SZ(a);
	VI d(n + 10, 1000000000);
	d[0] = -1000000000;

	int ret = 0;
	for (int i = 0; i < n; i++) {
		int j = int(upper_bound(d.begin(), d.end(), a[i]) - d.begin());
		ret = MAX(ret, j);
		d[j] = a[i];
	}
	return ret;
}

void conv(int& x, int &y) {
	int xd = y;
	int yd = 100000000 - x;
	x = xd;
	y = yd;
}

double solve() {
	if (xx1 == xx2) {
		if (yy1 > yy2) swap(yy1, yy2);
		for (int i = 0; i < n; i++) {
			if (V[i].first == xx1 && IN(V[i].second, (yy1), (yy2))) {
				return ABS(yy2 - yy1) * 100.0 - 20 + PI * 10;
			}
		}
		return ABS(yy2 - yy1) * 100.0;
	}

	if (yy1 == yy2) {
		if (xx2 < xx1) swap(xx1, xx2);
		for (int i = 0; i < n; i++) {
			if (V[i].second == yy1 && IN(V[i].first, xx1, xx2)) {
				return ABS(xx2 - xx1) * 100.0 - 20 + PI * 10;
			}
		}
		return ABS(xx2 - xx1) * 100.0;
	}

	if (xx1 > xx2 && yy1 > yy2) {
		swap(xx1, xx2);
		swap(yy1, yy2);
	}

	if (xx1 < xx2 && yy1 < yy2);
	else {
		conv(xx1, yy1);
		conv(xx2, yy2);
		for (int i = 0; i < n; i++) {
			conv(V[i].first, V[i].second);
		}
		return solve();
	}

	VP Z;
	for (int i = 0; i < n; i++) {
		if (IN(V[i].first, xx1, xx2) && IN(V[i].second, yy1, yy2)) {
			Z.push_back(V[i]);
		}
	}

	sort(ALL(Z));
	VI X;
	for (PII p : Z) X.push_back(p.second);
	int lis = LIS(X);
	double ret;
	if (lis == MIN(ABS(xx1 - xx2), ABS(yy1 - yy2)) + 1) {
		ret = ABS(xx1 - xx2) * 100.0 + ABS(yy1 - yy2) * 100.0 - lis * 20 + (lis + 1) * PI * 10 / 2;
	}
	else {
		ret = ABS(xx1 - xx2) * 100.0 + ABS(yy1 - yy2) * 100.0 - lis * 20 + lis * PI * 10 / 2;
	}
	//printf("lis=%d\n", lis);
	return ret;
}

int main()
{
	scanf("%d %d %d %d %d", &xx1, &yy1, &xx2, &yy2, &n);
	for (int i = 0; i < n; i++) {
		int xx, yy;
		scanf("%d %d", &xx, &yy);
		V.push_back({ xx, yy });
	}
	double ans = solve();
	printf("%.15lf\n", ans);
	return 0;
}


Measured memory_bytes: 6000
-- noch nicht fertig

import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    ias = filter ((< pred n) . snd) . zip [0..] $ as :: [(Int, Int)]
    bs = countN n . map ((+) <$> fst <*> snd) $ ias :: VU.Vector Int
    cs = countN n . map ((-) <$> fst <*> snd) $ ias :: VU.Vector Int
  print . VU.sum $ VU.zipWith (*) bs cs

countN :: Int -> [Int] -> VU.Vector Int
countN n = VU.accum (+) (VU.replicate n 0) . map (flip (,) 1) . filter ((&&) <$> (0 <=) <*> (< n))
{-# INLINE countN #-}

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


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

int main(){
  int a, b;
  cin >> a >> b;
  
  if ((a + b) % 2 == 0){cout << (a + b) / 2 << endl;}
  else {cout << (a + b) / 2 + 1 << endl;}
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = INT64_MAX;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

void solve() {
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    if((a+b)>(c+d)) {
        out("Left");
    }else if ((a+b)<(c+d)){
        out("Right");
    }else {
        out("Balanced");
    }
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    string s;
    cin>>s;
    vector<bool> wb(2 * n);
    rep(i, 2 * n) {
        if (s[i] == 'W' && i % 2 == 0) wb[i] = true;
        else if (s[i] == 'B' && i % 2 == 1) wb[i] = true;
    }

    ll cnt = 0;
    rep(i, 2 * n) if (wb[i]) cnt++;
    if (cnt != n) {
        cout<<0<<endl;
        return 0;
    }

    ll l = 0;
    mint ans = 1;
    rep(i, 2 * n) {
        if (!wb[i]) l++;
        else {
            ans *= l;
            l--;
        }
    }
    rep(i, n) ans *= i + 1;
    cout<<ans<<endl;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
 int N;
  int M;
  cin >>N>>M;

  vector<int> A(N);
  int data[N][M];
  rep(i,N)rep(j,M) data[i][j]=0;
  rep(i,N) {
    cin >>A.at(i);
    rep(j,A.at(i)) {
      cin >>data[i][j];
    }
  }
  //ここまで入力
 
  if(N !=1) {
 int count=0;
  vector<int> counting(M);
  rep(k,M) { 
    repl(j,1 , N) {
      repl(n, 0, M) {
    
       if((data[0][k]==data[j][n]) &&(data[0][k] !=0)){
           count++;
       }
      }
      }
    //cout <<count << endl;
      if(count==N-1) {
        
          
          
          counting.at(k)=N-1;
        
      }
    count=0;
    } //repループ　ストップ
        
  
  
  
  
  
  
  
 // cout <<counting.at(0)<< endl;
  int x=0;
  rep(i,M) {
    if(counting.at(i)==N-1) {
      x++;
    }
  }
cout << x<< endl;
  }
  else if (N==1) {
cout <<A.at(0)<< endl;
  }
  
  
  
  
  
  
  
  }


Measured memory_bytes: 256
import sys
import math
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")



R = int(input())
print(R*2*math.pi)

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;

    vector<ll> A(N);
    map<ll, ll, greater<ll>> m;
    REP(i, N) {
        cin >> A.at(i);
        m[A[i]]++;
    }
    vector<ll> B(M), C(M);
    REP(i, M) {
        cin >> B.at(i) >> C.at(i);
        m[C[i]] += B[i];
    }
    ll num = 0;
    long long ans = 0;
    for (auto p : m) {
        if (num + p.second < N) {
            ans += p.first * p.second;
            num += p.second;
        } else {
            ans += p.first * (N - num);
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    int N, K;
    int p[1000];

    cin >> N >> K;
    for(int i=0; i<N; i++){
        cin >> p[i];
    }

    sort(p, p + N);

    long int ans =0;
    for(int i=0; i<K; i++){
        ans += p[i];
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, a, b) for (i = a; i < b; i++)
#define repr(i, a, b) for (i = a; i >= b; i--)
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
#define all(a) (a).begin(), (a).end()

void solve()
{
    int n;
    cin >> n;
    long double prod = 1;
    vector<ull> j(n, 0);
    for (int i = 0; i < n; i++)
    {
        // ll j;
        cin >> j[i];
        if (j[i] == 0)
        {
            cout << "0";
            return;
        }
    }
    for (int i = 0; i < n; i++)
    {
        prod *= j[i];
        if (prod > 1000000000000000000ULL)
        {
            cout << "-1";
            return;
        }
    }

    cout << (ull)prod;
}

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // int t = 0;
    solve();
    cout << "\n";

    return 0;
}

Measured memory_bytes: 3956
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;

using namespace std;

int main()
{
	int n;
	ll a[200];
	ll l[200];
	int ans=1000;
	
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		l[i]=0;
		while(a[i]%2==0)
		{
			a[i]/=2;
			l[i]++;
		}
		if(ans>l[i])
		{
			ans=l[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

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



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

int top, S, E, W, N, bot;

void what(char c)
{
		int tmp;
		switch (c) {
				case 'S':
						tmp = top;
						top = N;
						N = bot;
						bot = S;
						S = tmp;
						break;
				case 'E':
						tmp = top;
						top = W;
						W = bot;
						bot = E;
						E = tmp;
						break;
				case 'W':
						tmp = top;
						top = E;
						E = bot;
						bot = W;
						W = tmp;
						break;
				case 'N':
						tmp = top;
						top = S;
						S = bot;
						bot = N;
						N = tmp;
						break;
				case 'R':
						tmp = S;
						S = E;
						E = N;
						N = W;
						W = tmp;
						break;
		}
}

int main()
{
		int i, j, q;
		string op;
		cin >> top >> S >> E >> W >> N >> bot;
		cin >> q;
		int t[q], f[q], ans[q];
		for (i=0; i<q; i++) cin >> t[i] >> f[i];

		for (i=0; i<q; i++) {
				op = "NNNNWEE";
				for (j=0; j<op.size(); j++) {
						if (top==t[i]) break;
						else what(op[j]);
				}
				op = "RRRR";
				for (j=0; j<op.size(); j++) {
						if (S==f[i]) break;
						else what(op[j]);
				}
				cout << E << "\n";
		}

}

Measured memory_bytes: 3032
a = []
for i in range(5):
    a.append(int(input()))
b =[]
c = []
for i in range(5):
    b.append(int(a[i]))
for i in range(5):
    while b[i] > 10:
        b[i] = b[i] - 10
if min(b) == 10:
    ans = sum(a)
else:
    for i in range(5):
    	c.append(int(a[i]) +10 -int(b[i]))
    d = sum(c)
    mini = min(b)
    ans = d - 10 + mini
print(ans)

Measured memory_bytes: 3064
n = int(input())
value = [int(i) for i in input().split()]

now = 0
a = sorted(value) ##value.sort() だとvalueで2行目を参照してしまう？

while len(a) >= 2:
  a = sorted(a)
  now = (float(a[0]) + float(a[1])) / float(2)
  if len(a) >= 3:
    del a[0],a[0] ##a[0],a[1]にしてた
    a.append(now)
  elif len(a) == 2:
    print(now)
    break
    

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

int main() {
    int N, K; cin >> N >> K;
    int arr[N];
    for (int i = 0; i < N; i++) {
        cin >> arr[i];
    }
    sort(arr, arr + sizeof(arr) / sizeof(arr[0]));
    int ans = 0;
    for (int i = 0; i < K; i++) {
        ans += arr[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3568
import sys
import numpy as np
from collections import Counter

read = sys.stdin

N, K = map(int, read.readline().split())
k = 2 * K
xyc = np.array(read.read().split(), np.str).reshape(-1, 3)
x = xyc[:, 0].astype(int)
y = xyc[:, 1].astype(int)
c = xyc[:, 2]

x[c == 'B'] -= K
x %= k
y %= k

'''
# grid[[1,1],[2,2]]+=1 としてもgrid[1,2]=1であり重複は考慮されない。
# uniqueを使って(x,y)の重複をカウントする
# return_countはver1.9からだった・・・ ダメじゃん
xy, cnt = np.unique(x + y * 10000, return_counts=True)
x = xy % 10000
y = xy // 10000
'''
xy = Counter(zip(x, y))
cnt = np.array(list(xy.values()), np.int64)
xy = np.array(list(xy.keys()), np.int64)
x = xy[:, 0]
y = xy[:, 1]

grid = np.zeros((3 * K, 3 * K), np.int64)
grid[x, y] += cnt
grid[x + K, y + K] += cnt
grid[x + K, y] -= cnt
grid[x, y + K] -= cnt
np.cumsum(grid, axis=0, out=grid)
np.cumsum(grid, axis=1, out=grid)

p1 = grid[:K, :K] + grid[k:, k:] + grid[K:k, K:k] + grid[k:, :K] + grid[:K, k:]
p2 = grid[K:k, :K] + grid[K:k, k:] + grid[:K, K:k] + grid[k:, K:k]
print(max(p1.max(), p2.max()))


Measured memory_bytes: 133392
import sys
input = sys.stdin.readline

if __name__ == '__main__':
  def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
  n=int(input())
  print(num2alpha(n).lower())


Measured memory_bytes: 61712
#include<bits/stdc++.h>
#define vi vector<int>
#define vl vector<long int>
#define vll vector<long long int>
#define pi pair<int, int>
#define  ump unordered_map
#define us  unordered_set
 using namespace std;
  
   int main()
   {
   	 int s, w;
		 cin>>s>>w;
		  if(w>=s)
		  cout<<"unsafe"<<endl;
		  else
		  cout<<"safe"<<endl; 
   }

Measured memory_bytes: 3628
import sys
from collections import Counter

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

mod = 10 ** 9 + 7

s = input()
ct = 0
for i in range(len(s) - 1):
    if s[i] != s[i + 1]:
        ct += 1
print(ct)

Measured memory_bytes: 3436
f=lambda:map(int,input().split())
n,m=f()
l=list(f())
def g(x,y):
  while y: x,y=y,x%y
  return x
k=1
for i in l:
  i//=2; k=k*i//g(k,i)
  if (k//i)%2<1 or k>m: print(0); break
else:
  print(m//k-m//(k*2))

Measured memory_bytes: 14244
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	getline(cin,s);
	int p1=0,p2=s.size()-1;
	while(s[p1]!='A') p1++;
	while(s[p2]!='Z') p2--;
	cout<<p2-p1+1;
	return 0;
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    ll n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>a>>b;

    if(a>b||(n==1&&a<b)){
        cout<<"0\n";
        return 0;
    }

    x = (n-1)*a+b;
    y = (n-1)*b+a;

    cout<<(y-x+1)<<"\n";


    return 0;
}


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

int main(){
    set<int> st;
    int n, m, k;
    cin >> n >> m >> k;

    for(int i = 0;i <= n;i++){
        long long tmp = i*m;
        for(int j = 0;j <= m;j++){
            st.insert(tmp);
            tmp -= i;
            tmp += (n-i);
        }
    }

    for(int i = 0;i <= m;i++){
        long long tmp = i*n;
        for(int j = 0;j <= n;j++){
            st.insert(tmp);
            tmp += (m-i);
            tmp -= i;
        }
    }

    if(st.find(k) == st.end()){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 13056
#include <stdio.h>

int main(){
int n;
scanf("%d\n", &n);
int h,m,s;
h = n / 3600;
m = (n % 3600) / 60; 
s =  (n % 3600) % 60; 
printf("%d:%d:%d\n", h, m,s);
}


Measured memory_bytes: 2084
using System;

namespace abc123_a
{
    class Program
    {
        static void Main(string[] args)
        {
            //アンテナ位置の入力
            int[] antenna = new int[5];
            for (int i = 0; i < antenna.Length; i++)
            {
                antenna[i] = Convert.ToInt32(Console.ReadLine());
            }
            //判定距離の入力
            int k= Convert.ToInt32(Console.ReadLine());
            //距離判定
            int flag = 0;
            for(int i = 0; i < antenna.Length; i++)
            {
                for(int j = i+1; j < antenna.Length; j++)
                {
                    if (antenna[j] - antenna[i] > k)
                    {
                        flag++;
                    }
                }
            }
            //判定結果出力
            if (flag == 0)
            {
                Console.WriteLine("Yay!");
            }
            else
            {
                Console.WriteLine(":(");
            }
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x); // 再帰的に解く
    y -= a / b * x;
    return d;
}

// 負の数にも対応した mod (a = -11 とかでも OK)
inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}

// 逆元計算 (ここでは a と m が互いに素であることが必要)
long long modinv(long long a, long long m) {
    long long x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}

static const ll MAX = 100001;
ll dp1[MAX] = {};
ll dp2[MAX] = {};

int main() {
    
    // abc42 d

    ll h,w;
    ll a,b;
    cin >> h >> w >> a >> b;

    ll tmp = 1;
    dp1[0] = 1;
    for (ll i=1;i<b;i++){
        tmp *= (h-a-1) + i;
        tmp = mod(tmp, mop);
        tmp *= modinv(i,mop);
        tmp = mod(tmp, mop);
        dp1[i] = tmp;
//        cout << dp1[i] << endl;
//        cout << tmp << endl;
//        cout << i << " " << tmp << endl;
    }

    ll wca = w+a-2;
//    cout << wca << endl;
    for (ll i=1;i<a-1;i++){
        wca *= w+a-2-i;
        wca = mod(wca, mop);
        wca *= modinv(i+1,mop);
        wca = mod(wca, mop);
//        if(i<3){
//            cout << wca << endl;
//        }
    }
    if(a == 1){
        wca = 1;
    }
//    cout << wca << endl;
//    for (ll i=2;i<=a-1;i++){
//        wca *= w - i + 2;
//        wca *= modinv(i,mop);
//        wca = mod(wca, mop);
//    }
//    if(a-1 == 0){
//        wca = 1;
//    }
//    cout << wca << endl;
    dp2[0] = wca;
    for (ll i=1;i<b;i++){
        wca *= (w-i);
        wca = mod(wca, mop);
        wca *= modinv(w-i+a-1,mop);
        wca = mod(wca, mop);
        dp2[i] = wca;
//        cout << i << " " << wca << endl;
    }

    ll minus = 0;
    for (ll i=0;i<b;i++){
        minus += dp1[i] * dp2[i];
//        cout << dp1[i] << " " << dp2[i] << endl;
        minus = mod(minus, mop);
//        cout << i << " " << minus << endl;
    }
//    cout << minus << endl;
    ll whole = h+w-2;
//    cout << whole << endl;
    for (ll i=1;i<h-1;i++){
        whole *= (h+w-2-i);
        whole = mod(whole, mop);
        whole *= modinv(i+1,mop);
        whole = mod(whole, mop);
//        cout << i << " " << whole << endl;
    }
//    cout << whole << endl;
    ll ans = whole - minus;
    while(ans < 0){
        ans += mop;
    }
    cout << ans << endl;



}




Measured memory_bytes: 1792
import Control.Monad
import Control.Monad.ST
import qualified Data.Array as A
import qualified Data.Array.ST as ST
import qualified Data.Array.Unboxed as AU
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.Int
import qualified Data.IntMap as IM
import Data.List
import qualified Data.Map as M
import Data.Maybe
import Data.Ord
import qualified Data.Set as S
import Data.Time
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt :: IO [Int]
readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

main = do
  [n, y] <- readInt
  putStrLn $ solve n y

solve n y = f $ head c
  where
    c =
      [ (a, b, c)
      | a <- [n,n - 1 .. 0]
      , b <- [n - a,n - a - 1 .. 0]
      , let c = n - a - b
      , y == a * 10000 + b * 5000 + c * 1000
      ] ++
      [(-1, -1, -1)]

f (a, b, c) = show a ++ " " ++ show b ++ " " ++ show c

Measured memory_bytes: 1020
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
main()
{
	fast();
	int t=1;
//	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		map<string,int> mp;
		for(int i=0;i<n;i++)
		{
			string s;
			cin>>s;
			mp[s]++;
		}
		cout<<"AC x "<<mp["AC"]<<endl;
		cout<<"WA x "<<mp["WA"]<<endl;
		cout<<"TLE x "<<mp["TLE"]<<endl;
		cout<<"RE x "<<mp["RE"]<<endl;
	}
	
}




Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		int res=0;
		while(n>1){
			n=(n+2)/3;
			res++;
		}
		cout<<res<<endl;
		break;
	}
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>

using namespace std;

bool judge() {
    string s, t; cin >> s >> t;
    size_t n = s.length();
    size_t z1[26], z2[26];
    for(size_t i=0;i<26;++i) z1[i]=z2[i]=26;
    for(size_t i=0;i<n;++i) {
        size_t so = (size_t)(s[i]-'a');
        size_t to = (size_t)(t[i]-'a');
        if (z1[so]==26) {
            z1[so] = to;
        } else if(z1[so]!=to) {
            return false;
        }
        if (z2[to]==26) {
            z2[to] = so;
        } else if(z2[to]!=so) {
            return false;
        }
    }
    return true;
}

int main(int argc, char const *argv[])
{
    cout << (judge()? "Yes": "No") << endl;
    return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  string s;cin >>s;
  set<string> st;
  for(int i=0;i<s.size();++i) st.insert(s.substr(i,1));
  if(st.size()==1){
    cout << 0 << endl;
    return 0;
  }
  int min_cnt = s.size()+ 100;
  for(auto ele:st){
    string tmp = s;
    int t_cnt=0;
    int cnt = 0;
    while(tmp.size()>t_cnt){
      int t_cnt2=0;
      string tmp2 = "";
      for(int j=0;j<tmp.size()-1;++j){
        auto sub =tmp.substr(j,1);
        auto sub2 = tmp.substr(j+1,1);
        if(sub == ele || sub2 == ele){
          tmp2 += ele;
          ++t_cnt2;
        } else {
          tmp2 += sub;
        }
      }
      tmp = tmp2;
      ++cnt;
      t_cnt = t_cnt2;
    }
    min_cnt = min(min_cnt,cnt);
  }
  cout << min_cnt << endl;
  return 0;
}


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

int main()
{
  int n,m;
  cin>>n>>m;
  vector<vector<int>> g(n+1);
  for(int i=0;i<m;i++)
  {
    int u,v;
    cin>>u>>v;
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
   int size[n];
   size[0]=0;
   
   bool v[n]={0};
  auto bfs=[&](int src)
  {
    queue<int> q;
    q.push(0);

    while(!q.empty())
    {
      int x=q.front();
      q.pop();
      v[x]=1;

      for(auto i:g[x])
      {
        if(!v[i])
        {
          size[i]=size[x]+1;
          q.push(i);
        }
      }

    }


  };
  bfs(0);

  if(size[n-1]==2)
  cout<<"POSSIBLE"<<endl;
  else
  cout<<"IMPOSSIBLE"<<endl;

}

Measured memory_bytes: 16188
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int W =sc.nextInt();
		int H =sc.nextInt();
		int x =sc.nextInt();
		int y =sc.nextInt();
		int r =sc.nextInt();
		
		if(x-r >= 0 && y-r >= 0 &&  x+r <= W && y+r <= H){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
}


Measured memory_bytes: 26220
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
R,C,K=map(int, sys.stdin.readline().split())

value=defaultdict(lambda: 0)
value=[ [0 for _ in range(C+1)] for __ in range(R+1) ]
for _ in range(K):
    r,c,v=map(int, sys.stdin.readline().split())
    value[r][c]=v

dp0=[0]*(C+1)
dp1=[0]*(C+1)
dp2=[0]*(C+1)
dp3=[0]*(C+1)

for r in range(1,R+1):
    for c in range(1,C+1):
        #今のマスにアイテムがある場合
        if 0<value[r][c]:
            dp3[c]=max( dp3[c-1], dp2[c-1]+value[r][c] )
            dp2[c]=max( dp2[c-1], dp1[c-1]+value[r][c] )
            #dp1[c]=max( dp1[c-1], dp0[c-1]+value[r][c], dp0[c]+value[r][c] )
            dp1[c]=max( dp1[c-1], dp0[c]+value[r][c] )
            #dp0[c]=max( dp0[c-1], dp0[c] )
            dp0[c]=dp0[c]
        #今のマスにアイテムがない場合
        else:
            #dp0[c]=max( dp0[c-1], dp0[c] )
            #dp1[c]=max( dp1[c-1], dp1[c] )
            #dp2[c]=max( dp2[c-1], dp2[c] )
            #dp3[c]=max( dp3[c-1], dp3[c] )
            dp0[c]=dp0[c]
            dp1[c]=dp1[c-1]
            dp2[c]=dp2[c-1]
            dp3[c]=dp3[c-1]

    #上の行にアイテムをコピー
    for c in range(1,C+1):
        dp0[c]=max( dp0[c], dp1[c], dp2[c], dp3[c] )
    dp1=[0]*(C+1)
    dp2=[0]*(C+1)
    dp3=[0]*(C+1)

print dp0[C]


Measured memory_bytes: 152068
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define inf 1e18
#define mm 998244353
 
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 modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

vector<ll> a(1,0), b(1,0);

int find(ll sum){
	int low = 0, high = b.size() - 1;
	int mid, ans = 0;
	while(low <= high){
		mid = low + (high-low)/2;
		if(b[mid] <= sum){
			ans = mid;
			low = mid+1;
		}
		else high = mid-1;
	}
	return ans;
}

int find1(ll sum){
	int low = 0, high = a.size() - 1;
	int mid, ans = 0;
	while(low <= high){
		mid = low + (high-low)/2;
		if(a[mid] <= sum){
			ans = mid;
			low = mid+1;
		}
		else high = mid-1;
	}
	return ans;
}

void solve(){
    int n,m; cin>>n>>m;
    ll sum; cin>>sum;
    ll r;
    for(int i=1;i<=n;i++){
    	cin>>r;
    	a.pb(r);
	}
    for(int i=1;i<=m;i++){
    	cin>>r;
    	b.pb(r);
	}
    for(int i=2;i<=n;i++) a[i] += a[i-1];
    for(int i=2;i<=m;i++) b[i] += b[i-1];
    int ans = 0;
    for(int i=0;i<=n;i++){
    	if(a[i] > sum) break;
    	int j = find(sum - a[i]);
    	ans = max(ans, i+j);
	}
	for(int i=0;i<=m;i++){
		if(b[i] > sum) break;
		int j = find1(sum - b[i]);
		ans = max(ans, i+j);
	}
	cout<<ans<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 7944
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    while(true) {
      int n = s.nextInt();
      int m = s.nextInt();
      int a = s.nextInt();
      if(n == 0 && m == 0 && a == 0) break;

      int[] he = new int[m];
      int[] fi = new int[m];
      int[] se = new int[m];

      
      for(int i = 0; i < m; i++) {
        he[i] = s.nextInt();
        fi[i] = s.nextInt(); 
        se[i] = s.nextInt();
      }


      for(int j = 1000; j > 0; j--) {
        for(int k = 0; k < m; k++) {
          if(he[k] == j) {
            if(fi[k] == a) {
              a = se[k];
              continue;
            }
            if(se[k] == a) {
              a = fi[k];
              continue;
            }
          }
        }
      }

      System.out.println(a);
      
    }
  }
}

Measured memory_bytes: 12000
#include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, ma, mb;
	cin >> n >> ma >> mb;
	vector<int> af(n / 2), bf(n / 2), cf(n / 2), al(n - n / 2), bl(n - n / 2), cl(n - n / 2);
	REP(i, n / 2) cin >> af[i] >> bf[i] >> cf[i];
	REP(i, n - n / 2)cin >> al[i] >> bl[i] >> cl[i];
	vector<vector<int>> v(401, vector<int>(401, INF));
	REP(i, 1 << (n / 2)) {
		int a = i;
		int A = 0, B = 0, C = 0;
		REP(j, n / 2) {
			if (a % 2) {
				A += af[j];
				B += bf[j];
				C += cf[j];
			}
			a /= 2;
		}
		v[A][B] = min(v[A][B],C);
	}
	
	int ans = INF;
	REP(i, 1 << (n - n / 2)) {
		int a = i;
		int A = 0, B = 0, C = 0;
		REP(j, n - n / 2) {
			if (a % 2) {
				A += al[j];
				B += bl[j];
				C += cl[j];
			}
			a /= 2;
		}
		for (int k = 1; k*ma <= 400 && k*mb <= 400;++k) {
			if (k*ma>=A&&k*mb>=B&&v[k*ma-A][k*mb-B] + C != 0)ans = min(ans, v[k*ma-A][k*mb-B]+C);
		}
	}
	
	if (ans == INF)cout << -1 << endl;
	else	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
using namespace std;
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using ll = long long;
using P  = pair<int, int>;
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
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; }

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(1){
        c -= b;
        if(c <= 0)
        {
            cout << "Yes" << endl;return 0;
        }
        a -= d;
        if(a <= 0)
        {
            cout << "No" << endl;return 0;
        }

    }
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <functional>
#include <unordered_set>
#include <vector>
using namespace std;


int main(void) {
    long long N;
    long long a;

    cin >> N;

    long long sum = 0;
    for(long long i=1; i<=N; ++i)
    {
        cin >> a;
        if(a & 0x01)
        {
            if(i & 0x01)
            {
                sum++;
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3584