akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)

int main() {
    ll n;
    cin >> n;
    if (n & 1) {
        puts("0");
        return 0;
    }
    ll cnt = n / 10;
    n /= 10;
    while (n) {
        n /= 5;
        cnt += n;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
// ここにQuestionクラスをコピペ
using AtcoderBeginnerContest160.Questions;
using AtcoderBeginnerContest160.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtcoderBeginnerContest160.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var s = inputStream.ReadLine();
            yield return s[2] == s[3] && s[4] == s[5] ? "Yes" : "No";
        }
    }
}


namespace AtcoderBeginnerContest160
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtcoderBeginnerContest160.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtcoderBeginnerContest160.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 11092
import math
def Ii():return int(input())
def Mi():return map(int,input().split())
def Li():return list(map(int,input().split()))

a,b,h,m = Mi()
rad = math.pi*abs(h/6 + m/360 - m/30)


c = a**2+b**2-2*a*b*math.cos(rad)

print(math.sqrt(c))

Measured memory_bytes: 9292
#include<iostream>
#include<cstring>
#define INF 1000000000
using namespace std;
int memo[1000001];
int dp(int N)
{
	if(N < 0)
		return INF;
	if(N==0)
		return 0;
	if(memo[N]!=-1)
		return memo[N];
	int ans = dp(N-1);
	for(int p = 6; p <= N; p*= 6)
		ans = min(ans,dp(N-p));
	for(int p = 9; p <= N; p*= 9)
		ans = min(ans,dp(N-p));
	return memo[N] = 1+ans;
}
int main()
{
	memset(memo,-1,sizeof memo);
	int N; cin >> N;
	cout<<dp(N)<<endl;
	return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  ll m;
  cin >> s >> m;
  ll n=s.size();
  ll d[n+1][m];
  mem(d);
  d[0][0]=1;
  rep(i,n) {
    rep(j,m) {
      rep(k,10) {
        d[i+1][(j+k)%m]+=d[i][j];
        d[i+1][(j+k)%m]%=MAX;
      }
    }
  }
  ll ans=0,c=0;
  rep(i,n) {
    rep(j,s[i]-'0') {
      ans+=d[n-1-i][(m-(c+j)%m)%m];
      ans%=MAX;
    }
    c+=s[i]-'0';
    c%=MAX;
  }
  if(c%m==0) {
    ans++;
    ans%=MAX;
  }
  pr((ans-1+MAX)%MAX);
}

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


Measured memory_bytes: 8064
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(string, S);
    OUT(S.substr(0, 3));
}

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

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int main() {
  int N;
  cin >> N;
  vector<int> A(N), B(N);

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


  for(int i = 0; i < N; i++) {
    B[i] = A[i] - (i + 1);
  }

  sort(B.begin(), B.end());

  int b = B[N / 2];
  ll sum = 0;
  for(int i = 0; i < N; i++) {
    sum += abs(b - B[i]); 
  }

  cout << sum;

    return 0;
}


Measured memory_bytes: 1792
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| i64::from_str(n).unwrap());
    let (a, b, c) = (it.next().unwrap(), it.next().unwrap(), it.next().unwrap());
    if b - a == c - b {
        println!("YES");
    } else {
        println!("NO");
    }

}


Measured memory_bytes: 4352
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = count = 0; pro = 1

n=int(input())
S=sum(map(int,input().split()))
print(S-n)

Measured memory_bytes: 39024
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	int a = 0, b = 0, ba = 0;
	string s;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		for (int j = 1; j < (int) s.size(); ++j) {
			if (s[j] == 'B' && s[j - 1] == 'A') {
				++ans;
			}
		}

		if (s[s.size() - 1] == 'A' && s[0] != 'B') {
			++a;
		}
		else if (s[0] == 'B' && s[s.size() - 1] != 'A') {
			++b;
		}
		else if (s[0] == 'B' && s[s.size() - 1] == 'A') {
			++ba;
		}
	}

	if (a && ba) {
		ans += ba;
		ba = 0;
	}

	int match = min(a, b);
	ans += match;
	a -= match;
	b -= match;

	if (b) {
		ans += ba;
		ba = 0;
	}

	ans += max(0, ba - 1);

	cout << ans << "\n";

	return 0;

}

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

const int N = 100005, mod = 1000000007;

void up(int &x, int y) { x += y - mod, x += x >> 31 & mod; }

int n, dp[N], nxt[N], ans;
char s[N];

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> s + 1, n = std::strlen(s + 1), dp[0] = 1;
	nxt[n + 1] = n + 1;
	for (int i = n; i >= 1; --i)
		nxt[i] = s[i] == s[i + 1] ? i + 1 : nxt[i + 1];
	if (nxt[1] > n) return std::cout << 1 << '\n', 0;
	for (int i = 0; i < n; ++i)
		up(dp[i + 1], dp[i]), up(dp[nxt[i + 1]], dp[i]);
	for (int i = n, S = 0; i >= 1; S += s[i--])
		if (!(S % 3)) up(ans, dp[i]);
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 1152
#  --*-coding:utf-8-*--

def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]
    return helper


@memoize
def f(d, k):
    if d == 1:
        return 1

    s = f(d-1, k)

    if k > 0:
        s += f(d-1, k-1)

    if k < 9:
        s += f(d-1, k+1)

    return s


def g1(K):
    d = 1
    cnt = 0

    while True:
        for i in range(1, 10):
            cnt2 = f(d, i)
            if (cnt + cnt2 >= K):
                return (cnt, d, i)

            cnt += cnt2

        d += 1


def g2(K, cnt, d, k):
    d -= 1
    X = [k]

    while d > 0:
        for j in range(-1, 2):
            if k+j < 0 or k+j > 9:
                continue

            cnt2 = f(d, k+j)

            if (cnt + cnt2 >= K):
                X.append(k+j)
                k = k+j
                break

            cnt += cnt2

        d -= 1

    return X

K = int(input())
cnt, d, k = g1(K)
print(''.join(map(str, g2(K, cnt , d, k))))



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

namespace test2 {

    public class Program {

        public static void Main(string[] args) {

            var array = Console.ReadLine().Split(' ');
            var a = int.Parse(array[0]);
            var b = int.Parse(array[1]);

            if((1 <= a && a <= 9) && (1 <= b && b <= 9)) {

                Console.WriteLine(a * b);

            } else {

                Console.WriteLine(-1);

            }
   

        }

        

        
    }

}


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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

int main()
{
    ll n,a,b;
    cin >> n >> a >> b;

    ll cnt = n / (a + b);
    ll sum = cnt * (a + b);
    ll left = n - sum;
    ll ans = a * cnt + min(left, a);
    ANS(ans)
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int sumA = 0,sumB = 0;
  int A[4] = {};
  int B[4] = {};

  for(int i = 0;i < 4;i++){
    cin >> A[i];
    sumA += A[i];
  }

  for(int i = 0;i < 4;i++){
    cin >> B[i];
    sumB += B[i];
  }

  cout << ((sumA > sumB) ? sumA : sumB) << endl;

  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(void){ 

int m,n,ai,min,max;

long sum; scanf("%d",&n);

for(m=0;m<n;m++){

scanf("%d",&ai);

if(m==0){

min=ai; max=ai; sum=ai;

} 

else{ 

if(ai<min){

min=ai;

}

if(max<ai){

max=ai;

} 

sum+=(long)ai;

}

}

printf("%d %d %ld\n",min,max,sum);

return 0;

}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << "\n"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(100001);
	rep(i, n) {
		int b; cin >> b;
		a[b]++;
	}
	int ans = 0;
	for (auto& c : a) if (c > 0) ans++;
	dunk(ans % 2 == 0 ? ans - 1 : ans);
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
#define ll long long
#define trace(x) cerr << #x << " = " << x << endl
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> 

int main()
{
   /*
    #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("ouput.txt","w",stdout);
    #endif 
   */

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    while(t--){
        ll a, b, c, d;
	cin>>a>>b>>c>>d;

        vector<ll>v;
	v.push_back(b*d);
	v.push_back(a*c);
	v.push_back(a*d);
	v.push_back(b*c);
	ll ans = *max_element(v.begin(), v.end());
	cout<<ans<<endl;
	
	/*if(b<=0 && d<=0)
		cout<<(a*c)<<endl;
	else if(b<0 && d>0){
		if(c<0)
			cout<<(a*c)<<endl;
		else
			cout<<(b*c)<<endl;
	}
	else if(b>0 && d<0){
		if(a<0)
			cout<<(a*c)<<endl;
		else
			cout<<(a*d)<<endl;
	}
	else if(b>0 && d>0){
		if(a>0 && c>0)
		    cout<<(b*d)<<endl;
		else if(a<0 && c<0){
			if(a*c > b*d)
				cout<<(a*c)<<endl;
		}
	}*/
		

    }
    return 0;
} 


Measured memory_bytes: 3624
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


show_flg = True
show_flg = False


def main():
    N, M = MI()
    jobs = {}
    ans = 0

    for i in range(N):
        A, B = MI()
        if A not in jobs:
            jobs[A] = []
        jobs[A].append(B)

    h = []
    remaining_days = 1
    while remaining_days <= M:
        if remaining_days in jobs:
            for rewards in jobs[remaining_days]:
                heappush(h, -rewards)

        if len(h) > 0:
            rewards = heappop(h)
            ans += -rewards
        remaining_days += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67800
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1

#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <random>
#include <ctime>

const long long INF = 10000000000000000;

using namespace std;



int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]==',') s[i]=' '; 
	}
	cout<<s<<endl;
	return 0;
}

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

#define sz(x) int(x.size())
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout);
  int a, b; cin >> a >> b;
  cout << 6 - a - b;
}



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

int main(){
//srandom((unsigned long)time(NULL));
long long n,m;
cin>>n>>m;
vector<long long> l,r;
for(long long i=0;i<m;i++){
    long long x,y;
    cin>>x>>y;
    l.emplace_back(x);
    r.emplace_back(y);
}
sort(l.begin(),l.end());
sort(r.begin(),r.end());
if(r[0]>=l[m-1])
cout<<r[0]-l[m-1]+1<<endl;
else cout<<0<<endl;

return 0;
}

Measured memory_bytes: 2036
n=int(input())
a=input()
b=input()
c=input()
count=0
for i in range(n):
    if a[i]==b[i] and b[i]==c[i]:
        continue
    elif a[i]==b[i] or c[i]==b[i] or a[i]==c[i]:
        count += 1
    else:
        count += 2
print(count)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
void chmin(int &a,int b){if(a>b) a=b;}

int main()
{
    int flag=0;
    string s;
    cin>>s;
    if(s[0]=='A')
    {
        flag+=1;
    }
    string temp=s.substr(2,s.length()-3);
    int strflag=0;
    int smallflag=0;
    for(int i=0;i<temp.length();i++)
    {
        if(temp[i]=='C')strflag++;
    }
    if(strflag==1)flag+=1;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]>='A' && s[i]<='Z')smallflag++;
    }
    if(smallflag==2)flag+=1;
    if(flag==3)cout<<"AC"<<endl; else cout<<"WA"<<endl;


}

Measured memory_bytes: 256
S=input()
ans=1

for i in range((len(S)-1)//2):
    
    if S[i]==S[len(S)-1-i]:
        ans*=1
    else:
        ans*=2

for j in range((len(S)-1)//2):
    
    if S[j]==S[(len(S)-1)//2-j-1]:
        ans*=1
    else:
        ans*=3

if ans==1:
    print("Yes")
else:
    print("No")

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

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

int main()
{
    int n, m;
    int min, minj, tmp;
    cin >> n >> m;
    vector<int> a(n), b(n), c(m), d(m);
    rep(i, n) cin >> a[i] >> b[i];
    rep(i, m) cin >> c[i] >> d[i];
    rep(i, n)
    {
        min = abs(a[i] - c[0]) + abs(b[i] - d[0]);
        minj = 0;
        for (int j = 1; j < m; j++)
        {
            tmp = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (tmp < min)
            {
                min = tmp;
                minj = j;
            }
        }
        cout << minj + 1 << endl;
    }
}

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

int main()
{
  vector<vector<int>> v(3, vector<int>(3));
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      cin >> v.at(i).at(j);
    }
  }
  for (int a1 = -200; a1 < 200; a1++)
  {
    for (int a2 = -200; a2 <= 200; a2++)
    {
      for (int a3 = -200; a3 <= 200; a3++)
      {
        int b1 = v.at(0).at(0) - a1;
        int b2 = v.at(0).at(1) - a1;
        int b3 = v.at(0).at(2) - a1;
        if (
            b1 + a2 == v.at(1).at(0) &&
            b1 + a3 == v.at(2).at(0) &&
            b2 + a2 == v.at(1).at(1) &&
            b2 + a3 == v.at(2).at(1) &&
            b3 + a2 == v.at(1).at(2) &&
            b3 + a3 == v.at(2).at(2))
        {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;

int main() {
    int ans = 0;
    string S;
    cin >> S;
    int slen = S.length();
    string tmp;
    for(int i = 0; i < slen; ++i) {
        if(tmp.length()>1){
            tmp = S[i];
            ans++;
        }
        else if(tmp[0] == S[i]){
            i++;
            if(i>=slen)
                break;
            tmp += S[i];
            ans++;
        }
        else{
            tmp = S[i];
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
typedef long long int llint;

int main(void){
  llint n, k, s;
  std::cin >> n >> k >> s;

  llint constant;
  if(s == 1000000000) constant = 1;
  else                constant = 1000000000;

  for(int i=0; i<k; i++){
    std::cout << s << " ";
  }
  for(int i=0; i<n-k; i++){
    std::cout << constant << " ";
  }
  std::cout << std::endl;
  
  return 0;
}


Measured memory_bytes: 1280
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    if op == "?":
        break



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

int main() {
  int r,d,x; cin >> r >> d >> x;
  rep(i,10) {
    int ans = r*x - d;
    cout << ans << endl;
    x = ans;
  }
  return 0;
}

Measured memory_bytes: 3612
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return (a % 1000000007);
}

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



int main(){
  ll n; cin >> n; ll sum = 0;
  
  rep(i,n){
    ll x; cin >> x; sum += x;
  }
  
  cout << sum - n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
//#define num 1000000007
#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define up(a,b) (((a)%(b)==0)?((a)/(b)):((a)/(b))+1)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) (a>b)?(a>c)?a:c:(b>c)?b:c
#define min3(a,b,c) (a<b)?(a<c)?a:c:(b<c)?b:c
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define fi first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
 
ll mymod(ll a, ll b)
{
	return (a%b + b)%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b, a%b);
}
bool prime[3001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=3000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=3000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[20];
void power()
{
	powe[0]=1;
	REP(i,1,20)
	{
		powe[i]=(powe[i-1]*10)%num;
        if(powe[i]<0)
        powe[i]+=num;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll k,n;
	cin>>k>>n;
	ll dist[n];
	REP(i,0,n)
	{
		cin>>dist[i];
	}
	ll ans=dist[n-1]-dist[0];
	REP(i,1,n)
	{
		assmin(ans, k - dist[i] + dist[i-1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define INF 2000000001
using namespace std;

typedef struct node{
  node *p,*l,*r;
  int key;
} Node;

typedef Node* Nodepointer;

Nodepointer T;

void insert(int z){
  Nodepointer t=(Node*)malloc(sizeof(Node));
  t->l=NULL;
  t->r=NULL;
  t->key=z;
  if(T->key==INF){
    T->key=z;
    return;
  }
  Nodepointer y=NULL,x=T;
  while(x!=NULL){
    y=x;
    if(t->key<x->key)x=x->l;
    else x=x->r;
  }
  t->p=y;
  if(y==NULL)T=t;
  else if(t->key<y->key)y->l=t;
  else y->r=t;
}

bool find(int key){
  Nodepointer x=T;
  while(x!=NULL){
    if(x->key==key)return true;
    if(key<x->key)x=x->l;
    else x=x->r;
  }
  return false;
}

void print(Nodepointer x,int y){
  if(y)cout<<' '<<x->key;
  if(x->l!=NULL)print(x->l,y);
  if(!y)cout<<' '<<x->key;
  if(x->r!=NULL)print(x->r,y);
}

Nodepointer treeMinimum(Nodepointer x){
  while(x->l!=NULL)x=x->l;
  return x;
}

Nodepointer treeSuccessor(Nodepointer x){
  if(x->r!=NULL)return treeMinimum(x->r);
  Nodepointer y=x->p;
  while(y!=NULL&&x==y->r){
    x=y;
    y=y->p;
  }
  return y;
}

void delNode(int key){
  Nodepointer z;
  Nodepointer x=T,y;
  while(x!=NULL){
    if(x->key==key)break;
    if(key<x->key)x=x->l;
    else x=x->r;
  }
  if(x->key!=key)return;
  z=x;
  if(z->l==NULL||z->r==NULL)y=z;
  else y=treeSuccessor(z);
  if(y->l!=NULL)x=y->l;
  else x=y->r;
  if(x!=NULL)x->p=y->p;
  if(y->p==NULL)T=x;
  else if(y==y->p->l)y->p->l=x;
  else y->p->r=x;
  if(y!=z)z->key=y->key;
}

int main(){
  string s;
  int n,z;
  cin>>n;
  T=(Node*)malloc(sizeof(Node));
  T->p=NULL;
  T->l=NULL;
  T->r=NULL;
  T->key=INF;
  while(n--){
    cin>>s;
    if(s=="insert")cin>>z,insert(z);
    else if(T->key!=INF&&s=="delete")cin>>z,delNode(z);
    else if(T->key!=INF&&s=="find"){
      cin>>z;
      if(find(z))cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }
    else if(T->key!=INF){
      print(T,0);
      cout<<endl;
      print(T,1);
      cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 19960
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int t, a;
    cin >> t >> a;
    double h[n];
    for( int i=0;i<n; i++){
        cin >> h[i];
    }
    int ans;
    double temp;
    double mint;
    double s;
    mint = 1e10;
    for( int i=0; i<n; i++){
        temp = t - h[i]*0.006;
        //cout << temp << endl;
        //s = hypot(temp,a);
        s = abs(temp - a);
        if( s < mint ){
            //cout << i << s << endl;
            ans = i+1;
            mint = s;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            String[] str = sc.next().split("");
            if(str[0].equals(str[1]) && str[0].equals(str[2]) || str[1].equals(str[2]) && str[2].equals(str[3]) || str[0].equals(str[1]) && str[1].equals(str[2]) && str[2].equals(str[3])){
              System.out.println("Yes");
            } else {
              System.out.println("No");
            }
          }
}

Measured memory_bytes: 23764
#!/usr/bin/env python3

n = int(input())

arr = [int(i) for i in input().split(' ')]

dp = [10**10]*n

dp[0] = 0

for i in range(0, n):
    for j in range(1, 3):
        if i+j < n:
            dp[i+j] = min(dp[i+j], dp[i] + abs(arr[i+j]-arr[i]))

print(dp[n-1])


Measured memory_bytes: 84256
def solve(N, H):

    if(N == 1):
        return 1
    
    else:

        highest = H[0]

        for i in range(1,N):

            if(highest - H[i] > 1):
                return 0

            else:
                if(highest < H[i]):
                    highest = H[i]
    
    return 1


N = int(input())
H = list(map(int,input().split()))

if(solve(N,H) == 1):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin>>a>>b;
  string str,ans;
  ans="Yes";
  cin>>str;
  if(str.at(a)!='-'){
    ans="No";
  }
  for(int i=0; i<a; i++){
    if('0'<=str.at(i) && str.at(i)<='9'){
    }
    else{
      ans="No";
    }
  }
  for(int i=a+1; i<a+b+1; i++){
    if('0'<=str.at(i) && str.at(i)<='9'){
    }
    else{
      ans="No";
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      long a = sc.nextLong();
      long b = sc.nextLong();

      long d = a / b;
      long r = a % b;
      double f = (double)a / (double)b;


      System.out.printf("%d %d %.5f\n", d, r, f);

      sc.close();
  }
}


Measured memory_bytes: 26612
n=int(input())
s=input()
l=0
r=n//2
while r-l>=1:
    m=(r+l+1)//2
    d={}
    flg=False
    for i in range(n-m+1):
        t=s[i:i+m]
        if t in d:
            if d[t]+m-1<i:
                flg=True
                break
        else:
            d[t]=i
    if flg:
        l=m
    else:
        r=m-1
print(l)

Measured memory_bytes: 193032
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = ReadInt();

            while (true)
            {
                if (IsPrime(X))
                {
                    WriteLine(X);
                    break;
                }
                X++;
            }
        }
        public static bool IsPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

            double sqrtNum = Math.Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    // 素数ではない
                    return false;
                }
            }

            // 素数である
            return true;
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
n,m = map(int, input().split())
H = list(map(int, input().split()))
Towers = [True]*n

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


print(sum(Towers))
  

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

int main() {
  int n;
  ll d;
  cin >> n >> d;
  int cnt = 0;
  rep(i, n) {
    ll x, y;
    cin >> x >> y;
    if(x*x + y*y <= d*d) cnt++;
  }
  
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stack>
using namespace std;
const int INF = 0x3f3f3f3f;

int main()
{
	char str[255];
	stack<int> s;
	int i = 0;
	while(scanf("%s", str) != EOF)
	{
		if(str[i] == '+')
		{
			int temp1 = s.top();
			s.pop();
			int temp = temp1 + s.top();
			s.pop();
			s.push(temp);
		}
		else if(str[i] == '-')
		{
			int temp1 = s.top();
			s.pop();
			int temp = s.top() - temp1;
			s.pop();
			s.push(temp);
		}
		else if(str[i] == '*') 
		{
			int temp1 = s.top();
			s.pop();
			int temp = temp1 * s.top();
			s.pop();
			s.push(temp);
		}
		else
		{
			int temp = 0;
			for(int i = 0; str[i]; i++)
				temp = temp * 10 + str[i] - '0';
			s.push(temp);
		}
	}
	printf("%d\n", s.top());
	return 0;
}

Measured memory_bytes: 3204
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {
    public static void main(String args[]) {
        ArrayList<Integer> StoppingTrain = new ArrayList<>();
        ArrayList<Integer> GoTrain = new ArrayList<>();
        int train = 0;
        int listEndIndex = 0;
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String line = null;
        try {
            while ((line = input.readLine()) != null) {
                train = Integer.parseInt(line);
                if (train == 0) { //departure train
                    listEndIndex = StoppingTrain.size() - 1;
                    train = StoppingTrain.get(listEndIndex);
                    StoppingTrain.remove(listEndIndex);
                    GoTrain.add(train);
                } else {
                    StoppingTrain.add(train);
                }
            }
        } catch (NumberFormatException e) {
            System.out.println(line + "is not Int");
        } catch (IOException e) {
            System.out.println("IOException");
        }
        for(int i = 0; i < GoTrain.size(); i++){
            System.out.println(GoTrain.get(i));
        }
    }
}


Measured memory_bytes: 24192
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# # スペース区切りの整数の入力
# b, c = map(int, input().split())
# スペース区切りの整数の入力
strs = input().split()

buka_nums = []
for i in range(a):
    buka_nums.append(0)

zyousi = []
for s in strs:
    zyousi_n = int(s)
    buka_nums[zyousi_n - 1] += 1

for i in buka_nums:
    print(i)

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

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

    std::vector<size_t> indices(array.size());
    std::iota(indices.begin(), indices.end(), 0);

    // ソートする。
    std::sort(indices.begin(), indices.end(), [&array](size_t i1, size_t i2) {
        return array[i1] < array[i2];
    });

    for (auto v : indices)
        std::cout << v + 1 << " ";
    cout << endl;
    // cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 2048
#include <stdio.h>

int main(){
  int a, b, c, tmp;

  scanf("%d %d %d", &a, &b, &c);

  if(a > b){
    tmp = a;
    a = b;
    b = tmp;
  }

  if(b > c){
    tmp = b;
    b = c;
    c = tmp;
  }

  if(a > b){
    tmp = a;
    a = b;
    b = tmp;
  }

  printf("%d %d %d\n", a, b, c);
}



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

int main() {
  string s;
  cin >> s;
  if(s.size()%2!=0) {
    cout << "No" << endl;
    return 0;
  }
  for(int i=0; i<s.size(); i++) {
    if(i%2==0) {
      if(s.at(i)!='h') {
        cout << "No" << endl;
        return 0;
      }
    }
    if(i%2==1) {
      if(s.at(i)!='i') {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
int n, cnt;
char a;
bool vis[200];
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) {
		scanf(" %c", &a);
		if(!vis[a])cnt++;
		vis[a] = 1;
	}
	if(cnt == 3)printf("Three\n");
	else printf("Four\n");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
struct edge{ll to, cost;};
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define INF 1000000000000

using Graph = vector<vector<edge>>;




/*
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};

*/

/*ll tree[100010][100010]
ll dis[100010]
for(ll i = 0; i < 100010; i++){
    for(ll j = 0; j < 100010;j++){
        tree[i][j] = -1;
    }
    dis[i] = 0;
}

int cal(){

}*/

int main(){
    ll n;
    Graph g;
    cin >> n;
    g.resize(n);
    ll temp1,temp2,temp3;
    for(ll i = 0; i < n-1; i++){
        cin >> temp1 >> temp2 >> temp3;
        edge e;
        e.to = temp2-1;
        e.cost = temp3%2;
        g[temp1-1].push_back(e);
        e.to = temp1-1;
        g[temp2-1].push_back(e);
    }
    vector<int> dist(n,-1);
    queue<int> que;
    dist[0] = 0;
    que.push(0);
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(auto nv : g[v]){
            if(dist[nv.to] != -1)continue;
            dist[nv.to] = dist[v]+ nv.cost;
            que.push(nv.to);
        }
    }
    //g.dijkstra(1);

        for(int i = 0; i < n; i++){
        if(dist[i] % 2 == 0) cout << 0 << endl;
        else cout << 1 << endl;
        }


}

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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

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

    string s = "RGB";
    sort(all(s));
    int n;
    string str;
    cin >> n >> str;

    ll ans = 0;
    do {
        char r = s[0], g = s[1], b = s[2];
        for (int i = 0, cnt_0 = 0, cnt_1 = 0; i < n; i++) {
            if (str[i] == r) cnt_0++;
            if (str[i] == g) cnt_1 += cnt_0;
            if (str[i] == b) ans += cnt_1;
        }
        rep(i, n - 2) {
            for (int d = 1; i < n - 2 * d; d++) {
                if (str[i] == r and str[i + d] == g and str[i + 2 * d] == b) ans--;
            }
        }
    } while (next_permutation(all(s)));

    out(ans);
}


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

while M>0:
    A.sort(reverse=True)
    if A[0]==0:
        break
    judge=A[0]//2
    for i in range(len(A)):
        if A[i]>judge and M>0:
            A[i]=A[i]//2
            M-=1
        else:
            break
print(sum(A))

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

int main() {
   int x;
   cin >> x;
   int ans;
   if(x <= 599) ans = 8;
   else if(x <= 799) ans = 7;
   else if(x <= 999) ans = 6;
   else if(x <= 1199) ans = 5;
   else if(x <= 1399) ans = 4;
   else if(x <= 1599) ans = 3;
   else if(x <= 1799) ans = 2;
   else if(x <= 1999) ans = 1;
   cout << ans << endl;
   return 0;

}

Measured memory_bytes: 3632
n = int(input().strip())
ab = [list(map(int, input().strip().split(" "))) for _ in range(n)]
cd = [list(map(int, input().strip().split(" "))) for _ in range(n)]

candidate = []
ans = 0
ps = sorted(ab + cd, key=lambda x: x[0])
for p in ps:
    if p in ab:
        candidate.append(p)
        candidate = sorted(candidate, key=lambda x: x[1], reverse=True)
    else:
        for i, _p in enumerate(candidate):
            if _p[1] < p[1]:
                ans += 1
                candidate.pop(i)
                break
print(ans)


Measured memory_bytes: 3064
package main

import "fmt"

const MOD = 1000000007
const MAX = 2000001

func comb(n, k int) int {
	fac  := make([]int, MAX)
	finv := make([]int, MAX)
	inv  := make([]int, MAX)
    fac[0], fac[1] = 1, 1;
    finv[0], finv[1] = 1, 1;
    inv[1] = 1;
    for i := 2; i < MAX; i++ {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

func main() {
	var X, Y, ans int
	fmt.Scan(&X, &Y)
	n := (2 * Y - X) / 3
	m := (2 * X - Y) / 3;
    if (X + Y) % 3 == 0 && n >= 0 && m >= 0 {
        ans = comb(n + m, n);
    }
    fmt.Println(ans)
}

Measured memory_bytes: 49028
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c<=32)c=_buff.get();return c;}
ll qpow(ll x,ll k){return k==0?1:1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
char s[311];
int n,k;
int dp[305][305][305];
void upd(int &x,int v){x=max(x,v);}
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	cin>>k;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=n;j>=i;j--)
		{
			for(int t=0;t<=k;t++)
			{
				int cur=dp[i][j][t];
				upd(ans,cur+(s[i]==s[j])*2-(i==j));
				if(t<k)upd(ans,cur+2-(i==j));
				if(i<j)
				{
					upd(dp[i+1][j][t],cur);
					upd(dp[i][j-1][t],cur);
					upd(dp[i+1][j-1][t],cur+(s[i]==s[j])*2-(i==j));
					if(t<k)upd(dp[i+1][j-1][t+1],cur+2-(i==j));
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

#define ll long long
#define ld long double
#define pb push_back
#define pi  pair<int,int>
#define pl  pair<ll,ll>

int const N=1e5+5;
ll min(ll x,ll y) { if(x<y) return x; else return y; }
ll max(ll x,ll y) { if(x>y) return x; else return y; }

ll n,l;
vector<ll>v(105),w(105);
ll dp[105][N];

ll sol(ll i,ll wt)
{
    if(wt<0) return -1e15;
    if(i>=n) {
        if(wt>=0) return 0;
    }

    if(dp[i][wt]!=-1) return dp[i][wt];
    return dp[i][wt]=max(v[i]+sol(i+1,wt-w[i]),sol(i+1,wt));




}

int main()
{
    ll i,a;
    cin>>n>>l;

    memset(dp,-1,sizeof(dp));
    for(i=0;i<n;i++) {
        cin>>w[i]>>v[i];
    }

    cout<<sol(0,l)<<endl;



}


Measured memory_bytes: 82304