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

int main() {
  int N,K,x,ans;
  cin >> N >> K;
  for(int i;i < N;i++){
    cin >> x;
    if (x >= K - x){
      ans += K -x;
    }else{
      ans += x;
    }
  }
  cout << ans * 2 << endl;
}

Measured memory_bytes: 256
/* mamba mentality */
#include "bits/stdc++.h"
using namespace std;
typedef long double ld;
#define int long long
typedef pair<int,int> pii;
#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(i=0; i <n; i++)
#define repv(i,k,n) for(int i=k; i<=n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define endl '\n'
#define deb(x) cout<<#x<<" = "<<x<<endl
#define gcd __gcd
#define inf LLONG_MAX
#define minf LLONG_MIN 
const int mod = (int)(1e9+7);

int power(int x,int n)
{   
    if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}
bool is_power_2(int n)  { return log2(n)==floor(log2(n));}
bool is_prime(int n){for(int i=2; i*i<=n; i++)if(n%i==0)return 0; return 1;}

int dx[]    =  { -1 ,  0,  1,  0,  -1, -1, 1,  1};
int dy[]    =  { 0 ,  1,   0, -1,  -1,  1, 1, -1};
char dir[]  =  {'U', 'R', 'D','L' };
const int maxn =2005;

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


void solve()
{
    int n,h,w,i,j,k,m;
    cin>>h>>w>>k;
    char s[h][w];
    rep(i,h)    rep(j,w)    cin>>s[i][j];

    int ans=0;
    int maskr , maskc;
    rep(maskr , (1<<h) - 1)
    {
        rep(maskc , (1<<w)-1)
        {
            int black=0;
            rep(i,h)
            {
                rep(j,w)
                {
                    if(((maskr>>i)&1)==0 && ((maskc>>j)&1)==0 && s[i][j]=='#')
                        black++;
                }
            }
            if(black==k)
                ans++;
        }
    }
    cout<<ans;
}       
signed main()
{
    RAGE;   
    int t=1;
    //  cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int a,b;
  cin>>a>>b;
  if(a+b>=10) cout<<"error"<<endl;
  else cout<<a+b<<endl;
}

Measured memory_bytes: 256
gets.to_i.times do
  z = gets.split.map(&:to_r)
  a = (z[3]-z[1])/(z[2]-z[0])rescue Float::INFINITY
  b = (z[7]-z[5])/(z[6]-z[4])rescue Float::INFINITY
  puts a == b ? 'YES' : 'NO'
end

Measured memory_bytes: 6140
<?php
  list($a, $b) = explode(" ", trim(fgets(STDIN)));
  $ans = 0;
  if($a > $b){
    $ans = $a;
    $a--;
  }else{
    $ans = $b;
    $b--;
  }

  $ans += max($a, $b);

  echo $ans;


Measured memory_bytes: 16128
#include<bits/stdc++.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+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll H,W;cin>>H>>W;
    vvl info(H,vl(W));
    rep(i,H)rep(j,W)cin>>info[i][j];
    vector<pair<pl,pl>> ans;
    rep(i,H)rep(j,W){
        if(i<H-1){
            if(info[i][j]%2){
                ans.push_back({{i+1,j+1},{i+2,j+1}});
                info[i][j]--,info[i+1][j]++;
            }
        }
        else{
            if(j<W-1){
                if(info[i][j]%2){
                    ans.push_back({{i+1,j+1},{i+1,j+2}});
                    info[i][j]--,info[i][j+1]++;
                }
            }
        }
    }
    cout<<ans.size()<<endl;
    for(auto p:ans)cout<<p.fi.fi<<" "<<p.fi.se<<" "<<p.se.fi<<" "<<p.se.se<<endl;
    return 0;
}


Measured memory_bytes: 8432
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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;
}

void init_global() {}

int main_() {
	int K, S;
	cin >> K >> S;

	int ans = 0;
	for (int x = 0; x <= K; x++) {
		for (int y = 0; y <= K; y++) {
			int z = S - x - y;
			if (0 <= z && z <= K) ans++;
		}
	}

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


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

//TO_STRING
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(char ch){
  string s;
  s += ch;
  return s;
}

string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + 
    to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + 
    to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

//DEBUG 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL //compile with -DLOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<pi> vpi;
typedef vector<char> vch;
typedef vector<string> vstr;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vvi> vvvi;
typedef vector<vch> vvch;
typedef vector<vstr> vvstr;

#define all(x) x.begin(), x.end()
#define pb push_back
#define pf push_front
#define fi first
#define se second  
#define sz(x) ((ll)x.size())

void solve() {
  int s, w;
  cin >> s >> w;
  cout << (w >= s ? "unsafe" : "safe");
}

int main() {
  ios::sync_with_stdio(false);  
  cin.tie(0);cout.tie(0); 
  
  int t = 1;
  for (int tc = 1; tc <= t; tc++) {
  	solve();
  }
}

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

const int64_t N = int64_t(1e9);

int main() {
	int n;
	cin >> n;
	vector<vector<pair<int, int>>> g(n);
	int ans = 0;
	for (int i = 1; i < n; i++) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		g[x].emplace_back(y, i);
		g[y].emplace_back(x, i);
		ans = max(ans, int(g[x].size()));
		ans = max(ans, int(g[y].size()));
	}
	vector<int> a(n);
	function<void(int, int, int)> dfs = [&](int x, int p, int c) {
		int cc = 0;
		for (pair<int, int> q : g[x]) {
			if (q.first == p) {
				continue;
			}
			if (cc == c) {
				cc++;
			}
			a[q.second] = cc;
			dfs(q.first, x, cc);
			cc++;
		}
	};
	dfs(0, -1, -1);
	cout << ans << endl;
	for (int i = 1; i < n; i++) {
		cout << a[i] + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 9216
import java.util.*;

public class Main{
  public static void main(String[] args){
    int[] a = new int[3];
    Scanner sc = new Scanner(System.in);
    for(int i=0; i<3; i++){
      a[i] = Integer.parseInt(sc.next());
    }

    Arrays.sort(a);
    System.out.println(a[2]-a[0]);
  }
}

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


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

    int n;
    cin >> n;
    ll a[n];
    for (int i=0;i<n;i++)
        cin >> a[i];

    ll c=0;
    for (int i=0;i<n-1;i++){
        if (a[i]>a[i+1]){
            c+=a[i]-a[i+1];
            a[i+1]=a[i];
        }
    }
    cout << c;


    return 0;
}


Measured memory_bytes: 5176
package main

import (
	"bufio"
	"flag"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"strconv"
	"strings"
	"time"
)

func (p *problem) solve() {
	s := p.Next()
	t, err := time.ParseInLocation("2006/01/02", s, time.Local)
	if err != nil {
		fmt.Println(err)
	}

	last := time.Date(2019, 04, 30, 0, 0, 0, 0, time.Local)
	if t.Unix() > last.Unix() {
		fmt.Println("TBD")
	} else {
		fmt.Println("Heisei")
	}
}

var (
	debug  bool
	output string
)

func main() {
	flag.BoolVar(&debug, "debug", false, "Print debug logs")
	flag.BoolVar(&debug, "d", false, "Print debug logs")
	flag.StringVar(&output, "output", "stdout", "Specify output target (Default: stdout)")
	flag.StringVar(&output, "o", "stdout", "Specify output target (Default: stdout)")
	flag.Parse()

	if debug {
		out := os.Stdout
		if output != "stdout" {
			logfile, err := os.OpenFile(output, os.O_CREATE|os.O_WRONLY, 0666)
			if err != nil {
				panic(err)
			}
			defer logfile.Close()
			out = logfile
		}
		log.SetOutput(out)
	} else {
		log.SetOutput(ioutil.Discard)
	}

	p := problem{
		in:  bufio.NewReader(os.Stdin),
		out: bufio.NewWriter(os.Stdout),
	}
	p.solve()

	if err := p.out.Flush(); err != nil {
		panic(err)
	}
}

type problem struct {
	in  *bufio.Reader
	out *bufio.Writer
}

func (p *problem) PrintInt(d int) {
	p.Printf("%d\n", d)
}

func (p *problem) Printf(format string, a ...interface{}) {
	if _, err := fmt.Fprintf(p.out, format, a...); err != nil {
		panic(err)
	}
}

func (p *problem) Printfln(format string, a ...interface{}) {
	if _, err := fmt.Fprintf(p.out, fmt.Sprintf("%v\n", format), a...); err != nil {
		panic(err)
	}
}

func (p *problem) NextInt() int {
	return stoi(p.Next())
}

func (p *problem) NextInts() []int {
	line := p.NextSSLine()
	ds := make([]int, len(line))
	for i, s := range line {
		ds[i] = stoi(s)
	}
	return ds
}

func (p *problem) NextSSLine() []string {
	return strings.Split(p.Next(), " ")
}

// Next reads line and return string.
func (p *problem) Next() string {
	var b []byte
	for {
		l, pre, err := p.in.ReadLine()
		if err != nil {
			panic(err)
		}
		b = append(b, l...)
		if !pre {
			break
		}
	}
	return string(b)
}

func stoi(s string) int {
	i, err := strconv.Atoi(s)
	if err != nil {
		fmt.Println(i)
		fmt.Println(err)
	}
	return i
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define rep(i,n) for(int i=0;i<(n);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; }
typedef long long ll;
#define PI 3.14159265358979323846264338327950L

int n;
int dfs(ll v,bool f_3,bool f_5,bool f_7){
	if(v>n)return 0;
  	return dfs(v*10+3, true,f_5,f_7)
      	+	dfs(v*10+5,f_3,true,f_7)
      	+	dfs(v*10+7,f_3,f_5,true)
      	+	(f_3&&f_5&&f_7);
}

int main() {

  	cin>>n;
  	ll v=0;
  	cout<<dfs(v,false,false,false)<<endl;
  
	
    }



Measured memory_bytes: 3544
#include <iostream>
#include <unordered_map>

using namespace std;

int main(){
  int n;
  unordered_map<char, char> trans_map;

  while(true){
    trans_map.clear();
    cin >> n;
    if(n == 0) break;

    for(int i = 0; i < n; i++){
      char before, after;
      cin >> before >> after;
      trans_map[before] = after;
    }

    cin >> n;
    for(int i = 0; i < n; i++){
      char ch;
      cin >> ch;
      if(trans_map.find(ch) != trans_map.end()){
        ch = trans_map[ch];
      }
      cout << ch;
    }
    cout << endl;
  }

  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define fo(i, n) for(int i = 1; i <= n; ++i)
#define rep(i, a, b) for(int (i) = (a); (i) < (b); ++(i))

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 200200;
const int mod = 1e9 + 7;
const ll INF = 1e18;

inline void add(int &x, int y)
{
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;	
}

inline void mult(int &x, int y)
{
	x = x * 1ll * y % mod;
}

ll dp[N], n;
ll x[N];

ll t[4 * N];

inline void build(int v, int tl, int tr)
{
	
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	fo(i, n) cin >> x[i];
	int l = 1;
	dp[1] = 1, dp[2] = 2;
	fo(r, n)
	{
		if(r <= 2) continue;
		while(l < r && (x[r - 1] <= 2 * (r - 1) - 2 * l || x[r] < 2 * r - 2 * l))
			++l;
		dp[r] = r - l + 1;
	}
	ll res = 1;
	fo(i, n)
		res = res * (dp[i]) % mod;
	cout << res;
	return 0;	
}

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

int main(){
	double money = 100000;
	int n;
	cin >> n;
	for( int i=0; i<n; i++ ){
		money = money * 1.05;
		int up = (int)(money / 1000.0);
		if( (int)money%1000 > 0 ){
			money = (up+1)*1000.0;
		}else{
			money = up * 1000.0;
		}
	}
	cout << (int)money << endl;
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
 
typedef long long LL;
typedef pair<int, int> PII;
 
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000;
const LL LINF = (LL)INF * INF;

const int MAX = 1 << 18;

int d[MAX];
vector<PII> g[MAX];
char s[MAX];
int ver[MAX];
int c[MAX];

bool cmp(int u, int v)
{
	return d[u] != d[v] ? d[u] < d[v] : u < v;
}

bool cmp2(PII u, PII v)
{
	return cmp(u.first, v.first);
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m;
	cin >> n >> m;
	FOR(i, 0, n)
	{
		s[i] = 'Q';
		cin >> d[i];
		ver[i] = i;
	}
	s[n] = '\0';
	FOR(i, 0, m)
	{
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g[u].PB(MP(v, i));
		g[v].PB(MP(u, i));
		c[i] = INF;
	}
	sort(ver, ver + n, cmp);
	FOR(i, 0, n)
	{
		PII to = MP(-1, -1);
		for(PII x: g[ver[i]])
			if(d[x.first] <= d[ver[i]] && (to == MP(-1, -1) || s[x.first] != 'Q'))
				to = x;
		if(to.first == -1)
		{
			cout << "-1\n";
			return 0;
		}
		c[to.second] = d[ver[i]];
		if(s[ver[i]] == 'Q')
		{
			if(s[to.first] == 'Q')
				s[to.first] = 'B';
			s[ver[i]] = s[to.first] == 'W' ? 'B' : 'W';
		}
		if(s[to.first] == 'Q')
			s[to.first] = s[ver[i]] == 'W' ? 'B' : 'W';
	}
	cout << s << "\n";
	FOR(i, 0, m)
		cout << c[i] << "\n";
	return 0;
}


Measured memory_bytes: 16000
# coding: utf-8
N, D = map(int, input().split())
X = []
ans = 0
for i in range(N):
    X.append(list(map(int, input().split())))
for i in range(N):
    for j in range(N):
        dist = 0
        if i == j:
            continue
        for d in range(D):
            dist += ((X[i][d] - X[j][d])**2)
        if dist**0.5 == int(dist**0.5):
            ans += 1
print(ans//2)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))  // xが範囲内か
#define sort_u(x) sort((x).begin(),(x).end())
#define sort_d(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()  // 配列のサイズ
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;  // 確認したいとき
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))  // 切り上げたいとき
#define newline puts("")
#define v(T) vector<T>  // Tはどんな型でもいい
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;  // ******
typedef vector<vi> vvi;
typedef vector<ll> vl;  // ******
typedef vector<P> vp;
typedef vector<T> vt;
int getInt(){int x;scanf("%d",&x);return x;}
template<typename T>istream& operator>>(istream&i,v(T)&v){rep(j,sz(v))i>>v[j];return i;}  // vi a(n); cin>>a;
template<typename T>string join(const v(T)&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const v(T)&v){if(sz(v))o<<join(v);return o;}  // cout<<a;  aの中身全部出す
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const v(T)&a){ll res(0);for(auto&&x:a)res+=x;return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame1 { puts("-1"); return 0;}
#define dame0 { puts("0"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define out cout << ans << endl;
//mins(ans,now);  ansに最小値が入る
//if(max(ans,now)) ansが小さければ更新して実行。cnt++とか。
//ll sum = suma(a);

int f(int x){
    int ans = 0;
    rep(k,x){
        int j=k+1;
        if(x%j==0) ans++;
    }
    return ans;    
}

int main() {
    int n; cin >> n;
    int ans = 0;
    rep(i,n){
        int x = i+1;
        if (x%2==0) continue; 
        if(f(x)==8) ans++;
    }
    out;
}

/*
g++ a.cpp
./a.out

oj d
oj t

debug:ctrl+shift+B+./problem.exe
problem.in+f5

*/


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

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

  ll r = 0, g = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R')
      r++;
    if (s[i] == 'G')
      g++;
    if (s[i] == 'B')
      b++;
  }

  ll ans = r * g * b;

  for (int i = 0; i < n; i++) {
    for (int step = 1; step < n; step++) {
      int j = i + step;
      int k = i + 2 * step;
      if (k > n - 1)
        break;
      if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i])
        ans--;
    }
  }

  cout << ans-- << endl;
}


Measured memory_bytes: 3612
#include<iostream>

using namespace std;

#define NMAX 100

int main(){

	long long N,A,B,C,X,Y[NMAX];

	while(1){
		cin>>N>>A>>B>>C>>X;
		if(N==0&&A==0&&B==0&&C==0&&X==0) break;
		int c=0;
		for(int i=0;i<N;i++){
			cin>>Y[i];
		}
		int ind=0;
		if(X==Y[0]) ind++;
		while(c<=10000&&ind<N){
			c++;
			X=(A*X+B) % C;
			if(X==Y[ind]) ind++;
		}
		if(c<=10000) cout<<c<<endl;
		else cout<<"-1"<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF = numeric_limits<long long>::max();
int main(){

    string s;
    cin >>s;

    int_fast64_t n_f=0,n_z=0;
    rep(i,s.length()){
        if(s[i]=='0'){
            n_z++;
        }else if(s[i]=='1'){
            n_f++;
        }
    }

    std::cout << 2*min(n_z,n_f) <<endl;

}


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


int main(){
	int A,B,C,X;
	int cnt=0;
	cin >> A;
	cin >> B;
	cin >> C;
	cin >> X;

	for(int x=0;x<=A;x++){
		for(int y=0;y<=B;y++){
			for(int z=0;z<=C;z++){
				cnt+=(500*x+100*y+50*z==X);
			}
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

ll modpow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n) {
        if (n & 1) res = (res * x) % mod; // bitが立っていればxを掛ける
        x = (x * x) % mod; // x を二乗しておく
        n >>= 1; // 右bitシフト（log2）
    }
    return res;
}

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

    int n, m; cin >> n >> m;
    cout << modpow(n, m, MOD) << endl;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  int N=S.size();
  int ans=0;
  for(int i=0;i<N/2;i++){
  if(S.at(i)!=S.at(N-1-i))
    ans++;
  
  }cout<<ans<<endl;
  
  return 0;
}

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

using ll=long long;

int main() {
  string S; cin >>S;
  cout <<count(S.begin(),S.end(),'1') <<endl;
  return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	ll N, M, K;
	cin >>N >>M >>K;
	vector<ll> A(N+1, 0);
	vector<ll> B(M+1, 0);
	Rep1(i, N)
		cin >>A.at(i);
	Rep1(i, M)
		cin >>B.at(i);
	//
	Rep1(i, N)
		A.at(i) +=A.at(i-1);
	Rep1(i, M)
		B.at(i) +=B.at(i-1);
	ll S=0;
	Rep0(i, N+1) {
		if (A.at(i)>K)
			break;
		ll D=K-A.at(i);
		ll E=upper_bound(B.begin(), B.end(), D)-B.begin();
		S=max(S, i+E-1);
	}
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 6424
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

#define endl "\n"

using namespace std;

long long n, m, a, t;

int main(){

    priority_queue<int> p;

    cin >> n >> m;

    for(int i = 0; i < n; i++){
        cin >> a;
        p.push(a);
    }

    for(int i = 0; i < m; i++){
        long long x = p.top()/2;
        p.pop();
        p.push(x);
    }

    for(int i = 0; i < n; i++){
        t = t + p.top();
        p.pop();
    }

    cout << t;

}

//g++ -std=c++14 comp.cpp -o b; ./b.exe


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e12

#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}

void deb_p(pii p) { printf("pair = %d %d\n", p.fi, p.se); }
void deb_i(int i) { printf("i = %d\n", i); }
void deb_v(vector<int> v) {
  printf("v = ");
  for (auto i : v) printf("%d ", i);
  printf("\n");
}
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  int n;
  cin >> n;
  out("ABC" + to_string(n));
}
int main(void) { solve(); }


Measured memory_bytes: 3656
import java.io.*;
public class Main{
  public static void main(String[] args){
    BufferedReader mBufferedReader=new BufferedReader(new InputStreamReader(System.in));
    try{
      int x,y;
      String str;
      String[] arr;

      while((str=mBufferedReader.readLine())!=null){
        arr=str.split(" ");
        x=Integer.parseInt(arr[0]);
        y=Integer.parseInt(arr[1]);
    
        if(x==0&&y==0){
          break;
        }
          if(x<=y){
            System.out.println(str);
          }else{
            System.out.println(arr[1]+" "+arr[0]);
          }
        }
        mBufferedReader.close();
      }catch(IOException e){
        System.out.println("Error");
      }
   }
}


Measured memory_bytes: 27128
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  char c[n];
  cin >> c;
  int l=0, r=n-1;
  int ans=0;
  bool lwhite = false;
  while(l<=r){
    if(lwhite){
      if(c[r--]=='R'){
        ans++;
        lwhite = false;
      }
    }
    else{
      if(c[l++]=='W') {
        lwhite=true;
      }
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3384
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Typical_Stairs2
{
    class Program
    {
        static void Main(string[] args)
        {
            //以下入力時の処理
            string input = ReadLine();            
            string[] array = input.Split(' ');
            var totalStep = int.Parse(array[0]);//零段目を抜いた段数の総数なので＋１
            var totalBrokenStep =int.Parse( array[1]);//壊れた段の総数
            var step = new long[totalStep + 1];//零段目も含めた段数分の箱を用意
            var brokenStep = new int[totalBrokenStep+2];//壊れた階段用の箱を用意
            for (int i = 0; i < totalBrokenStep ; i++) {
                brokenStep[i] = int.Parse(ReadLine()); //一行ずつ読み込み
            }//壊れた階段段数を記録
            step[0] = 1;//0段目は一通りなので
                        //以下」一段目以降の処理//
            int N = 1000000007;///定数
            int count = 0;//壊れた階段＝＝処理中の段数となったときに比較する壊れた段数を次に移すために使う
            for (int j = 1; j < totalStep+1; j++) {
                
                if ( j< 2)
                {
                    step[j] = step[j - 1] ;//totalStep==1の時step[j-2]は存在しない
                }
                else {
                    step[j] = step[j - 1] + step[j - 2]%N; //一つ前への行き方と二つ前への生き方の総和を代入           
                }
                if (j == brokenStep[count])
                { //j段目の値＝＝壊れた階段の時にstep[j]=0を代入
                    step[j] = 0;
                    count++;//処理する段数を次に移すうつす
                }
            }
            
            WriteLine(step[totalStep] % N);//結果を表示
            ReadKey();

        }
    }
}


Measured memory_bytes: 13920
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
LL l,n,a[200010],t[200010];
LL ans=0;
void solve()
{
	//printf("a:");for(int i=1;i<=n;i++) printf("%lld ",a[i]);printf("\n");
	t[n]=l-1-a[n]+1;t[n-1]=a[n-1];
	LL tot=t[n]+t[n-1];
	ans=max(ans,a[n]);ans=max(ans,tot*2-t[n]);
	for(LL i=n-2;i>=1;i--)
	{
		LL len=n-i+1,p;
		t[i]=a[i];tot+=a[i];
		if(len&1) p=n-len/2;
		else
		{
			p=n-len/2+1;
			tot-=t[p];t[p]=l-1-a[p]+1;
			tot+=t[p];
		}
		ans=max(ans,tot*2-t[p]);
		//printf("%lld:%lld\n",i,tot);
		//for(int j=i;j<=n;j++) printf("%lld ",t[j]);printf("\n");
	}
}
int main()
{
	scanf("%lld %lld",&l,&n);
	for(LL i=1;i<=n;i++) scanf("%lld",&a[i]);
	solve();
	reverse(a+1,a+n+1);
	for(LL i=1;i<=n;i++) a[i]=l-a[i];
	solve();
	printf("%lld",ans);
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
const int Nmax = 1e5;
ll A[Nmax], B[Nmax], C[Nmax];

int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];
	for(int i=0; i<N; i++) cin >> B[i];
	for(int i=0; i<N; i++) cin >> C[i];

	sort(A, A+N);
	sort(B, B+N);
	sort(C, C+N);

	/*
	for(int i=0; i<N; i++) cout << A[i] << (i==N-1?'\n':' ');
	for(int i=0; i<N; i++) cout << B[i] << (i==N-1?'\n':' ');
	for(int i=0; i<N; i++) cout << C[i] << (i==N-1?'\n':' ');
	*/

	vector<int> bn(N);
	for(int i=0; i<N; i++){
		bn[i] = C+N-lower_bound(C, C+N, B[i]+1);
	}
	//for(int i=0; i<N; i++) cout << bn[i] << (i==N-1?'\n':' ');
	vector<ll> bcum(N);
	bcum[N-1] = bn[N-1];
	for(int i=N-2; i>=0; i--) bcum[i]=bcum[i+1]+bn[i];
	//for(int i=0; i<N; i++) cout << bcum[i] << (i==N-1?'\n':' ');

	ll ans = 0;
	for(int i=0; i<N; i++){
		int k = lower_bound(B, B+N, A[i]+1)-B;
		//cout << k << endl;
		if(k<N) ans += bcum[k];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

void _main() {
  ll N;
  cin >> N;

  int ans=inf;
  rep(a, 1, sqrt(N)+1) {
    if (0 != N%a) continue;
    ll b=N/a;
    int A=0, B=0;
    for (int i=a; i!=0; i/=10) A++;
    for (int i=b; i!=0; i/=10) B++;
    chmax(A,B);
    chmin(ans, A);
  }

  cout << ans << "\n";
}

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

    if (n %(2*d+1) == 0) printf("%d", n/(2*d+1));
    else {
        printf("%d", n/(2*d+1)+1);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

using namespace std::chrono;
inline ll get_time_millisec(void) {
	return static_cast<ll>(duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count());
}

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y;
	y = z;
	z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

inline int getRange(int l, int r) {
	return xor128() % (r + 1 - l) + l;
}


class Solver {

private:
	//要素
	ll D;
	ll C[26];
	ll S[365][26];
	ll date[365];


public:
	void input() {
		cin >> D;
		FOR(i, 0, 26)cin >> C[i];
		FOR(i, 0, D) {
			FOR(j, 0, 26) {
				cin >> S[i][j];
			}
		}

	}

	int calcScore() {
		int score = 0;



		return score;
	}
	void init() {

	}
	void rndchange() {

	}


	void output() {
		FOR(i, 0, D) {
			cout << xor128() % 26 + 1 << endl;
		}
	}
};


Solver solve(void) {

	Solver currentSeq;

	currentSeq.input();
	currentSeq.init();


	Solver bestSeq = currentSeq;
	int bestScore = currentSeq.calcScore();
	int currentScore = bestScore;

	const ll saTimeStart = get_time_millisec();

	const ll saTimeEnd = saTimeStart + 5;//milli
	double saTimeCurrent = saTimeStart;

	while (saTimeCurrent < saTimeEnd) {

		Solver nextSeq = currentSeq;
		

		nextSeq.rndchange();

		const int nextScore = nextSeq.calcScore();

		const ll T = saTimeEnd - saTimeStart;
		const ll t = saTimeCurrent - saTimeStart;
		const ll R = 10000;


		//const bool FORCE_NEXT = R * (T - t) > T*((xor128()) % (R));
		const bool FORCE_NEXT = false;
		/*
		double startTemp = 20;
		double endTemp = 10;
		double temp = startTemp + (endTemp - startTemp)*t / T;
		double probability = exp((nextScore - currentScore) / temp);
		const bool FORCE_NEXT = probability > (double)(xor128() % R) / (double)R;
		*/
		//const bool FORCE_NEXT = (xor128() % R) >998;


		if (nextScore > currentScore || FORCE_NEXT) {
			currentScore = nextScore;
			currentSeq = nextSeq;


		}


		if (currentScore > bestScore) {

			bestScore = currentScore;


			//cout << bestScore << endl;
			bestSeq = currentSeq;
		}
		saTimeCurrent = get_time_millisec();
	}

	return bestSeq;

}



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

	Solver ans =solve();
	ans.output();
	



	return 0;
}


Measured memory_bytes: 3812
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int diff = b - a;
		int sum = 0;
		for (int i = 1; i <= diff; i++) {
			sum += i;
		}
		System.out.println(sum - b);
	}
}

Measured memory_bytes: 22736
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A.sort(reverse=True)
A = Counter(A)
ans = 1
for k in sorted(A, reverse=True):
	if A[k] >= 4:
		if ans == 1:
			ans = k**2
			break
		else:
			ans *= k
			break
	elif  A[k] >= 2:
		if ans == 1:
			ans *= k
		else:
			ans *= k
			break
else:
	ans = 0
print(ans)


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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int ans=0;
  
  for(int i=0;i<=s.size()-3;i++){
    if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C')	ans++;
  }
  cout << ans;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()

int main()
{
    int a, p;
    cin >> a >> p;

    cout << (a * 3 + p) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb push_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int N, A, B, C, D; string S; cin>>N>>A>>B>>C>>D>>S;
  for(int i = A-1; i < max(C, D)-1; i++){
    if(S[i] == '#' and S[i+1] == '#'){
      cout << "No" << endl;
      return 0;
    }
  }
  if(C < D) cout << "Yes" << endl;
  else {
    for(int i = B-2; i < D-1; i++){
      if(S[i] == '.' and S[i+1] == '.' and S[i+2] == '.'){
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
  }
}

Measured memory_bytes: 592
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[1001000];
int main()
{
	cin>>a;
	for(int i=0;i<strlen(a);i++)
	  if(i%2==0)  cout<<a[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);
    private static int N;
    private static int Ma;
    private static int Mb;
    private static final int INF = 100000;

    public static void main(String[] args) {
	N = Integer.parseInt(scan.next());
	Ma = Integer.parseInt(scan.next());
	Mb = Integer.parseInt(scan.next());

	int[] a = new int[N];
	int[] b = new int[N];
	int[] c = new int[N];
	for (int i = 0; i < N; i++) {
	    a[i] = Integer.parseInt(scan.next());
	    b[i] = Integer.parseInt(scan.next());
	    c[i] = Integer.parseInt(scan.next());
	}

	int[][][] dp = new int[N+1][401][401];
	for (int i = 0; i < N+1; i++) {
	    for (int j = 0; j < 401; j++) {
		for (int k = 0; k < 401; k++) {
		    dp[i][j][k] = INF;
		}
	    }
	}
	dp[0][0][0] = 0;

	for (int i = 0; i < N; i++) {
	    for (int ca = 0; ca < 401; ca++) {
		for (int cb = 0; cb < 401; cb++) {
		    dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb]);
		    if(ca+a[i] < 401 && cb+b[i] < 401) {
			dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb]+c[i]);
		    }
		}
	    }
	}

	int min = INF;
	for (int ca = 0; ca < 401; ca++) {
	    for (int cb = 0; cb < 401; cb++) {
		if(ca == 0 && cb == 0) continue;
		if(match(ca, cb) && dp[N][ca][cb] < min) min = dp[N][ca][cb];
	    }
	}

	System.out.println(min == INF ? -1 : min);
	scan.close();
    }

    private static int min(int x, int y) {
	return (x < y ? x : y);
    }

    private static boolean match(int ma, int mb) {
	return (ma * Mb == mb * Ma);
    }
}


Measured memory_bytes: 56404
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n;
ll a[100001],b[100001],sa,sb;
priority_queue<ll> pq;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n){
		cin>>a[i];
		sa+=a[i];
	}
	rep(i,n){
		cin>>b[i];
		sb+=b[i];
	}
	if(sa<sb){
		cout<<-1;
		re 0;
	}
	int ans=0;
	ll m=0;
	rep(i,n){
		if(a[i]<b[i])
		ans++,m+=b[i]-a[i];
		else
		pq.push(a[i]-b[i]);
	}
	while(m){
		ans++;
		ll p=pq.top();
		pq.pop();
		m=max(0ll,m-p);
	}
	cout<<ans;
	re 0;
}


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

int main(){
    string s, t;
    vector<size_t> pos[26];

    cin >> s >> t;
    for(int i=0;i<s.size();i++){
        pos[s[i]-'a'].push_back(i);
    }

    int64_t cnt = -1;
    int64_t p = 1000000;
    for(char c: t){
        if(pos[c-'a'].size()==0){
            cout << -1 << endl;
            return 0;
        }
        if(pos[c-'a'].back() <= p){
            ++cnt;
            p = pos[c-'a'].front();
        }else{
            int l=-1, r=pos[c-'a'].size()-1;
            while(r-l > 1){
                size_t mid = (l+r) / 2;
                if(pos[c-'a'][mid] <= p) l = mid;
                else r = mid;
            }
            p = pos[c-'a'][r];
        }
        //cerr << cnt << " " << p << endl;
    }
    cout << cnt * s.size() + p + 1 << endl;
    
    return 0;
}

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

const int N = 2005, M = N * N;

typedef bitset<M> bs;

int n;
bs dp;

int main() {
    cin >> n;
    dp[0] = true;
    int sum = 0;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        sum += x;
        dp |= (dp << x);
    }
    for(int cur = (sum + 1) / 2; ; cur++) {
        if(dp[cur]) {
            cout << cur << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1664
import java.util.*;
import java.math.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            long pos = -1;
            long n = in.nextLong();
            long[] a = new long[(int)n];
            for (int i = 0; i < n; ++i) a[i] = in.nextLong();
            Arrays.sort(a);
            for (int i = 0; i < n - 1; ++i) {
                a[i + 1] += a[i];
                if (a[i] * 3 < a[i + 1]) {
                    pos = i;
                }
            }
            System.out.println(n - pos - 1);
        }
    }
}


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

int main(){

    int N,M;
    cin >> N >> M;
    int A;
    int Asum=0;
    for(int i=0; i<M; i++){
        cin >> A;
        Asum += A;
    }
    
    if( N-Asum < 0 ){
        cout << -1 << endl;
    }else{
        cout << N-Asum << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args)  {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.println((a*b)%2 == 0 ? "No" : "Yes");
	}

}


Measured memory_bytes: 21844
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n, ans = INF, A[MAXN];

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

    cin >> n;
    for (ll i = 1; i <= n; i++) cin >> A[i];
    for (ll i = 0; i <= 200; i++) {
        ll cost = 0;
        for (ll j = 1; j <= n; j++) cost += (A[j] - i) * (A[j] - i);
        ans = min(ans, cost);
    }
    cout << ans << endl;

    return 0;
}
/*

*/


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



int main() {
  ll num=0;
  while(1){
    char x;
    cin >> x;
    if(cin.eof())
        break;
    
    int tmp = x -'0';
    num += tmp;
  }
  string ans = "No";
  if(num%9==0) ans = "Yes";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
H,W,K=map(int,input().split())
C=[]
for i in range(H):
  tmp=input()
  C+=[tmp]
ans=0
Hlis=[0 for i in range(H)]
Wlis=[0 for j in range(W)]
def Hsin(n):
  t=H-1
  while t>0:
    tmpo=n//(2**t)
    Hlis[H-1-t]=tmpo
    n=n%(2**t)
    t-=1
  Hlis[-1]=n
  return Hlis
def Wsin(n):
  t=W-1
  while t>0:
    tmpo=n//(2**t)
    Wlis[W-1-t]=tmpo
    n=n%(2**t)
    t-=1
  Wlis[-1]=n
  return Wlis

res=0
for l in range(H):
  for m in range(W):
    if C[l][m]=="#":
      res+=1
K2= res-K


ans=0


for i in range(2**H):
  r=Hsin(i)
  for j in range(2**W):
    co=Wsin(j)
    res=0
    for l in range(H):
      for m in range(W):
        if (r[l]==1) or (co[m]==1 ):
          if C[l][m]=="#":
            res+=1
    if res==K2:
      ans+=1
print(ans)

Measured memory_bytes: 9236
#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
#include <stack>
#include <climits>

using namespace std;

int main() {

	int n = 0;
	cin >> n;

	for (int i = 0; i <= 25; ++i) {
		for (int j = 0; j <= 15; ++j) {
			if (4 * i + 7 * j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;

	return 0;

}

Measured memory_bytes: 256