akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void)
{
	int a[10][10][20]={};
	int b,f,r,v,n,x,y,z;
	scanf("%d",&n);
	for(x=1;x<=n;x++){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		a[b][f][r]=a[b][f][r]+v;
	}
	for(x=1;x<=3;x++){
		for(y=1;y<=3;y++){
			for(z=1;z<=10;z++){
				printf(" %d",a[x][y][z]);
			}
			printf("\n");
		}
		printf("####################\n");
	}
	for(y=1;y<=3;y++){
		for(z=1;z<=10;z++){
			printf(" %d",a[4][y][z]);
		}
		printf("\n");
	}
	return 0;
}

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

int main(){
  char c[26];
  for(int i=3;i<26;i++){
    c[i]='A'-3+i;
  }
  c[0]='X';c[1]='Y';c[2]='Z';
  string s;
  cin>>s;
  for(int i=0;i<s.length();i++){
    s[i]=c[s[i]-'A'];
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 1180
let print_array a =
  Array.iteri (fun i s -> Printf.printf (if i = 0 then "%s" else " %s") s) a;
  print_newline ()

let swap i j a = let tmp = a.(i) in a.(i) <- a.(j); a.(j) <- tmp

let bubble_sort a n cmp =
  let rec bubble j flag =
    if j <= 0 then doit flag
    else if cmp a.(j - 1) a.(j) <= 0 then bubble (j - 1) flag
    else (swap j (j - 1) a; bubble (j - 1) true)
  and doit flag =
    if flag then bubble (n - 1) false
  in
  doit true

let selection_sort a n cmp =
  let rec select j minj =
    if j >= n then minj
    else select (j + 1) (if cmp a.(j) a.(minj) < 0 then j else minj)
  in
  let rec doit i =
    if i < n then begin
      let minj = select i i in
      if minj <> i then swap i minj a;
      doit (i + 1)
    end
  in
  doit 0

let cmp_card x y =
  let num_of_char c = Char.code c - Char.code '0' in
  compare (num_of_char x.[1]) (num_of_char y.[1])

let stable_p a b n =
  let rec doit i =
    if i >= n then true
    else if a.(i) <> b.(i) then false
    else doit (i + 1)
  in
  doit 0

let () =
  let n = read_int () in
  let a = Array.of_list (Str.split (Str.regexp " ") (read_line ())) in
  let b = Array.copy a in
  bubble_sort a n cmp_card;
  selection_sort b n cmp_card;
  print_array a;
  print_endline "Stable";
  print_array b;
  print_endline (if stable_p a b n then "Stable" else "Not stable")

Measured memory_bytes: 2192
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

double getRatio(double a, double b){
	return abs(a - b) / a;
}

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

	vector<int> a(n);
	cin >> a;

	vector<vector<double>> dp(n, vector<double>(200000, numeric_limits<double>::max()));
	rep(i,n){
		range(j,1,200000){
			if(i == 0){
				dp[i][j] = getRatio(a[i], j);
			}else{
				for(int k = j; k < 200000; k+=j){
					dp[i][k] = min(dp[i][k], max(dp[i - 1][j], getRatio(a[i], k)));
				}
			}
		}
	}

	cout << fixed << setprecision(10) << *min_element(all(dp[n - 1])) << endl;
}



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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s, t; cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) if (s[i] != t[i]) ans++;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;

#define MAX	110

long long int DP[MAX][MAX];
long long int target;
long long int input[MAX];
long long int n;
long long int dfs_end;


long long int dfs(int now , int sum)
{
	if (now == dfs_end)
	{
		if (sum == target)
		{
			return 1;
		}
		return 0;
	}
	if (sum > 20 || 0 > sum)
	{
		return 0;
	}
	if (DP[now][sum] != 0)
	{
		return DP[now][sum];
	}

	DP[now][sum] += dfs(now + 1 , sum + input[now]);
	DP[now][sum] += dfs(now + 1 , sum - input[now]);

	return DP[now][sum];
}



int main()
{
	cin >> n;
	for (int i = 0; i < MAX; i++)
	{
		for (int j = 0; j < MAX; j++)
		{
			DP[i][j] = 0;
		}
	}

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

	target = input[n - 1];
	dfs_end = n - 1;

	//int i = 0;
	//while (input[i] == 0)
	//{
	//	i++;
	//}
	//
	//DP[0][0] = dfs(i , 0);
	DP[0][0] = dfs(1 , input[0]);
	
	printf("%lld" , DP[0][0]);
	puts("");

	return 0;
}

Measured memory_bytes: 1252
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

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

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll
void solve() {
	vector<int> inputs;
	REP(i, 9) {
		string s;
		cin >> s;
		inputs.push_back(0);
		REP(i, s.length()) {
			inputs.back() *= 16;
			if (s[i] >= 'a') {
				inputs.back() += s[i] - 'a' + 10;
			}
			else {
				inputs.back() += s[i] - '0';
			}
		}
	}
	int key = 0;
	for (int i = 0; i < 32; ++i) {
		int tmp = 0;
		REP(q, inputs.size() - 1) {
			tmp += inputs[q] ^ key;
		}
		tmp &= (1LL << (long long)(i + 1)) - 1LL;
		if (((inputs[8]^key) & ((1LL << (long long)(i + 1)) - 1LL)) == tmp) {
			key += 0;
		}
		else {
			key += (1LL << i);
		}
	}
	string ans;
	while (key != 0) {
		int hoge = key % 16;
		key /= 16;
		if (hoge <= 9) {
			ans.push_back(hoge + '0');
		}
		else {
			ans.push_back(hoge - 10 + 'a');
		}
	}
	if (ans.length() == 0) ans.push_back('0');
	reverse(ALL(ans));
	cout << ans << endl;
}

#undef int
int main() {
	init();
	int t;
	cin >> t;
	REP(tea,t)
	solve();
}


Measured memory_bytes: 3024
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)2e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
ll bit[mxn+5];
ll query(ll x){
	ll s=0;for(;x;x-=x&(-x)) s=max(s,bit[x]);
	return s;
}void upd(ll x,ll val){
	for(;x<mxn+5;x+=x&(-x)) bit[x]=max(bit[x],val);
}
int main(){
	int n,i;cin>>n;vi v(n+1),a(n+1),l(n+1,0);for(i=1;i<=n;i++) cin>>v[i];for(i=1;i<=n;i++) cin>>a[i];
	for(i=1;i<=n;i++){
		l[i]=query(v[i])+a[i];
		upd(v[i],l[i]);
	}cout<<*max_element(all(l))<<endl;
}



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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  int a,b,c,d;
  cin >>a>>b>>c>>d;
  cout << max(a*b, c*d) << endl;
  
  

  
}
      

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;
using Graph = vector<vector<int>>;

signed _main(){
  // 頂点数と辺数
  int N, M; cin >> N >> M;

  // グラフ入力受取 (ここでは無向グラフを想定)
  Graph G(N);
  for (int i = 0; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  rep(i,N){
    if(SZ(G[i])%2==1){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 6144
fun main(args: Array<String>) {
  val (X, Y) = readInts()
  for (i in 0..X) {
    val a = i
    val b = X - i
    val n = a * 2 + b * 4
    if (n == Y) {
      println("Yes")
      return
    }
  }
  println("No")
}

fun myBinarySearch(begin: Int, end: Int, isOk: (key: Int) -> Boolean): Int {
  var ng = begin
  var ok = end

  while (Math.abs(ok - ng) > 1) {
    val mid = (ok + ng) / 2
    if (isOk(mid)) {
      ok = mid
    } else {
      ng = mid
    }
  }

  return ok
}

fun <T> List<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(-1, size) { index -> isOk(get(index)) }
}

fun <T> Array<T>.myBinarySearch(isOk: (T) -> Boolean): Int {
  return myBinarySearch(-1, size) { index -> isOk(get(index)) }
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 36344
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

#define INF LLONG_MAX / 5
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define enld endl

signed main() {
	vector<int>V = 
	{
1,
6,
36,
216,
1296,
7776,
46656,
9,
81,
729,
6561,
59049
	};
	int N;
	cin >> N;
	vector<int>dp(N + 1,INF);
	dp[0] = 0;
	rep(i,N+1){
		rep(j, V.size()) {
			if (i - V[j] >= 0) {
				dp[i] = min(dp[i], dp[i - V[j]] + 1);
			}
		}
	}
	cout << dp[N] << enld;
}

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

const int MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
    string s;
    cin >> s;
    int cost = 700;
    rep(i, 3)
    {
        if (s.at(i) == 'o') {
            cost += 100;
        }
    }

    cout << cost << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define YES printf("YES\n")
#define NO printf("NO\n")
#define all(c) (c).begin(),(c).end()
using namespace std;
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define N 100005
bool check(lld a,lld b,lld c) {
	if(a&1 or b&1 or c&1) return 1;
	return 0;
}
int main()
{
	lld a,b,c,p1,p2,p3;
	cin>>a>>b>>c;
	rep(iter,0,1000) {
		if(check(a,b,c)) return 0*print(iter);
		p1=(a+b)/2,p2=(b+c)/2,p3=(c+a)/2;
		a=p1,b=p2,c=p3;
	}
	return 0*print(-1LL);
}

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

int main() {
	int N, X;
	cin >> N >> X;
	int m[110];
	int i;
	for(i=0; i<N; ++i) cin >> m[i];
	int min=0;
	for(i=0; i<N; ++i)
	{
	    X -= m[i];
	    if(m[min]>m[i]) min=i;
	}
	i=X/m[min];
	cout << N+i << endl;
	return 0;
}


Measured memory_bytes: 256
import core.stdc.stdio;
import std.algorithm;

void main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int[] p = new int[m];
	foreach(ref v;p)
		scanf("%d",&v);
	int[] a=new int[n-1],b=new int[n-1],c=new int[n-1];
	foreach(i;0..n-1)
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
	int[] sum=new int[n-1];
	foreach(i;0..m-1){
		int s=p[i]-1,t=p[i+1]-1;
		if(s>t)
			swap(s,t);
		sum[s]++;
		if(t<n-1)
			sum[t]--;
	}
	foreach(i;1..n-1)
		sum[i]+=sum[i-1];
	long ans;
	foreach(i;0..n-1)
		ans+=min(cast(long)a[i]*sum[i],cast(long)b[i]*sum[i]+c[i]);
	printf("%lld\n",ans);
}

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

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define sz(c) int(c.size())
#define clr(v, d)   memset(v, d, sizeof(v))
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF             INT64_MAX
#define NINF            INT64_MIN

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;
typedef vector<ll> vl;

string neg2base(ll num)
{
    string res="";
    while(num!=0)
    {
        ll rem=num%(-2);
        num=num/(-2);
        if(rem<0)
        {
            num++;
            rem+=1;
        }
        res=to_string(rem)+res;

    }
    return res;
}
int main()
{
    //    std::ios_base::sync_with_stdio(false);
    //    cin.tie(NULL);
    //    cout.tie(NULL);

    //    freopen("popcorn.in", "r", stdin);

    //    ll t;
    //    cin>>t;
    //    while(t--)
    //    {

    ll n;
    cin>>n;
    cout<<pow(n,2)<<endl;
    return 0;
}


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

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


Measured memory_bytes: 256
//
//  atcoder_abc173_d.cpp
//  CF-1
//
//  Created by Avaneendra Alugupalli on 8/4/20.
//  Copyright © 2020 Avaneendra Alugupalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <bits/stdc++.h>

using namespace std;

int main () {
    int n;
    
    int i = 0;
    long long sum = 0;
    
    cin >> n;
    vector<int> frnd(n, 0);
    while (i < n) {
        cin >> frnd[i];
        i++;
    }
    
    sort(frnd.rbegin(), frnd.rend());
     
    sum = frnd[0]; //take the first element of increasing sorted array
    int reminder = n-2; // reminder of the elements
    i = 1;
    for(i = 1; reminder >= 0 && i < n; i++) {
        sum += (long) frnd[i] * min(2, reminder);
        reminder -= min(2, reminder);
    }
   
    
    cout << sum <<endl;
}


Measured memory_bytes: 3960
#include <iostream>
using namespace std;
#define MAX 1000000
#define MAXL 50005
int dp[3][MAXL];

int main(){
	int n;
	static bool c[MAX]={true, true};
	for(int i = 2;i < MAX;i++){
		if(!c[i]){
			for(int j = 2;i*j < MAX;j++)c[i*j] = true;
		}
	}
	dp[0][0] = 1;
	for(int k = 0;k < 2;k++){
		for(int i = 0;i < MAXL;i++){
			if(!c[i]){
				for(int j = 0;j < MAXL - i;j++){
					if(i >= j)dp[k+1][j+i] += dp[k][j];
				}
			}
		}
	}
	//for(int i = 0;i < 30;i++)cout << dp[2][i];
	while(cin >> n, n){
		cout << dp[2][n] << endl;
	}
	return 0;
}

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

int main(){
    int N;
    float x[12];
    string u[12];

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

    float res = 0;
    for (int i = 0; i < N; ++i) {
        if (u[i] == "JPY") res += x[i];
        else res += 380000 * x[i];
    }

    cout << res <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, x, N) for (int i = x; i < (N); i++)
using namespace std;
int main()
{
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if (m1 == m2)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

int N, M;
map<string, int> blue, red;

int main(void){
    
    scanf("%d", &N);
    for(int i = 0; i < N; ++i){
        string s; cin >> s; ++blue[s];
    }
    scanf("%d", &M);
    for(int i = 0; i < M; ++i){
        string s; cin >> s; ++red[s];
    }

    int ans = 0;
    for(auto b : blue){
        int v = b.second;
        for(auto r : red) if(b.first == r.first) v -= r.second;
        ans = max(ans, v);
    }
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define rep(i, n) for(int i = 0; i < (int)n; ++i)

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int s = 0, x;
  rep(i, m) {
    cin >> x;
    s += x;
  }
  if (s > n) cout << -1 << endl;
  else cout << n - s << endl;

  return 0;
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;

int n, m, k, arr[N];
int C[N][3];
void solve()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<char, int>m;
    m['R'] = 0;
    m['G'] = 1;
    m['B'] = 2;

    forn(i, 0, n - 1)
    {
        for (auto j : {0, 1, 2})
        {
            C[i + 1][j] = C[i][j];
        }
        C[i + 1][m[s[i]]]++;
    }

    //for (auto i : {0, 1, 2})cout << C[n][i] << " "; nl;

    s = '.' + s;
    int ans = 0;
    forn(i, 1, n)forn(j, i + 2, n)
    {
        if (s[i] != s[j])
        {
            int x = 3 - m[s[i]] - m[s[j]];
            int t = C[j][x] - C[i][x];
            //cout << i << " " << j << " " << x << "\n";
            if ((j - i) % 2 == 0 and t > 0)
            {
                if (m[s[i + (j - i) / 2]] == x)t--;
            }
            ans += t;
        }
    }
    cout << ans;





}


signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin>>t;
    forn(i, 1, t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;

Measured memory_bytes: 3744
# frozen_string_literal: true

def read
  gets.to_i
end

def solve(n)
  s = n.to_s.chars.map(&:to_i).reduce(:+)
  n % s == 0 ? 'Yes' : 'No'
end

puts solve(read)
# puts [
#   solve(12) == 'Yes',
#   solve(101) == 'No',
#   solve(999999999)=='Yes'
# ].all?


Measured memory_bytes: 1788
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	int N,C;
	cin>>N>>C;
	int a[50][SIZE]={};
	for(int i=0;i<N;i++){
		int s,t,c;
		cin>>s>>t>>c;
		s*=2;
		t*=2;
		a[c][s-1]++;
		a[c][t]--;
	}
	int ans=0;
	for(int i=0;i<50;i++){
		for(int j=1;j<SIZE;j++){
			a[i][j]+=a[i][j-1];
		}
	}
	for(int i=0;i<SIZE;i++){
		int sum=0;
		for(int j=0;j<50;j++){
			if(a[j][i])
				sum++;
		}
		//cout<<i<<" "<<sum<<endl;
		ans=max(ans,sum);
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 39296
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define Max 			1e6
#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define ppb				pop_back
#define pf				push_front
#define ppf				pop_front
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define v 				vector
#define mii             map<ll,ll>
#define umap			unordered_map
#define pq              priority_queue<ll>
#define pqm             priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define sp 				' '
#define pi 				3.14159265359
#define intmax 			INT32_MAX
#define intmin			INT32_MIN
#define conti           continue
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
ll d8[8][2] = {{ -1, -1}, { -1, 0}, { -1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
ll d4[4][2] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
/* ordered set:
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/
void IO()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
void fastIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}




int main()
{
	fastIO();
	IO();
	ll n;
	cin>>n;
	if(n>=30)
	{
		cout<<"Yes"<<endl;
	}
	else 
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3640
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    string S; cin >> S;
    F0R(i, sz(S)) {
        if (S[i] == '?') {
            cout << 'D';
        } else cout << S[i];
    }
    cout << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3792
import java.util.Scanner;

public class Main {
	
	int count = 0;
	
	void swap(int[] A, int a, int b) {
		int tmp = A[a];
		A[a] = A[b];
		A[b] = tmp;
		count++;
	}
	
	void selectionSort(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int minj = i;
			for (int j = i; j < A.length; j++) {
				if (A[j] < A[minj]) {
					minj = j;
				}
			}
			if (minj != i) swap(A, i, minj);
		}
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		count = 0;
		selectionSort(A);
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}



Measured memory_bytes: 26128
H,W = map(int,input().split(' '))
move_list = [ list(input()) for _ in range(H) ]
possible_list = [[10**9]*W  for _ in range(H)]

def dfs(x,y,score,is_sequence):
    if x < 0 or H <= x or y < 0 or W <= y: #対象idxがareaの外にいる場合は対象外
        return
    if is_sequence == False and move_list[x][y] == '#':
        score +=1
        is_sequence = True
    elif move_list[x][y] == '.':
        is_sequence = False
    if possible_list[x][y] <= score:
        return
    possible_list[x][y] = score
    dfs(x+1,y,score,is_sequence)
    dfs(x,y+1,score,is_sequence)
dfs(0,0,0,False)
#print(possible_list)
print(possible_list[H-1][W-1])


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

int N, A[100005], B[100005];

signed main(){
  
  cin>>N;

  for(int i=0;i<N;i++) scanf("%lld %lld", &A[i], &B[i]);
  
  int ans=0;
  
  for(int i=N-1;i>=0;i--){
    A[i]+=ans;
    if(A[i]%B[i]!=0) ans+=(B[i]-A[i]%B[i]);
  }
  
  cout<<ans<<endl;
  
  return 0;
}



Measured memory_bytes: 1792
package main

import (
	"fmt"
	"os"
)

func run() int {
	var s, t, u string
	var a, b int
	fmt.Scanf("%s %s\n", &s, &t)
	fmt.Scanf("%d %d\n", &a, &b)
	fmt.Scanf("%s\n", &u)

	if u == s {
		a--
	} else {
		b--
	}

	fmt.Printf("%d %d\n", a, b)

	return 0
}

func main() {
	os.Exit(run())
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int n;
void dfs(string s,char mx)
{
	if(s.size()==n)
	{
		cout<<s<<endl;
	}
	else
	{
		for(char c='a';c<=mx;c++)
		{
			if(c==mx)
			dfs(s+c,mx+1);
			else
			dfs(s+c,mx);
		}
	}
}
int main()
{
	cin>>n;
	dfs("",'a'); 
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B && B == C) cout << "No" << endl;
  else if (A == B || B == C || C == A) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1L<<29)

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

typedef int Cost;
struct Edge {
  int src, dst; Cost cost;
  Edge(int s, int d, Cost c) : src(s), dst(d), cost(c) {}
};
typedef vector<Edge>  Edges;
typedef vector<Edges> Graph;
typedef vector<Cost>  Array;
typedef vector<Array> Matrix;

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int W, H; cin >> W >> H;
  vector<int> p(W, 0), q(H, 0), ps(W, 0), qs(H, 0);
  rep(i, W) {
    cin >> p[i]; ps[i] = p[i];
  }
  rep(i, H) {
    cin >> q[i]; qs[i] = q[i];
  }
  sort(ps.begin(), ps.end());
  sort(qs.begin(), qs.end());

  ll ans = 0;
  for (int i = 0; i < W; i++) {
    int pos = lower_bound(qs.begin(), qs.end(), p[i]) - qs.begin();
    ans += (qs.size() - pos + 1) * p[i];
  }
  for (int i = 0; i < H; i++) {
    int pos = upper_bound(ps.begin(), ps.end(), q[i]) - ps.begin();
    ans += (ps.size() - pos + 1) * q[i];
  }
  cout << ans << endl;
  return 0; 
}


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


using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

ll solve(vector<ll> a)
{
    ll ans = 0;
    ll cursum = 0;
    for (int i = 0; i<a.size(); i++)
    {
        cursum+=a[i];
        if (i%2 == 0)
        {
            if (cursum<=0)
            {
                ans+=(1-cursum); cursum = 1;
            }
        }
        if (i%2==1)
        {
            if (cursum>=0)
            {
                ans+=(cursum+1); cursum = -1;
            }
        }
    }
    return ans;
}

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

    int n;
    cin>>n;
    vector<ll> a(n);
    for (int i = 0; i<n; i++) cin>>a[i];
    ll answer = solve(a);
    for (int i = 0; i<n; i++) a[i] = -a[i];
    answer = min(answer, solve(a));
    cout<<answer;

}

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

int f(int i){
  int count = 0;
  while(i > 0){
    count += i%10;
    i /= 10;
  }
  return count;
}

int main(){
  int n,m;
  cin >> n;
  int ans = 100000;
  rep(i,n){
    m = f(i) + f(n-i);
    ans = min(ans,m);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
//Never stop trying
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<str> vs;
typedef vector<ld> vd;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

#define dbg(x) cerr << " - " << #x << " : " << x << endl;
#define dbgs(x,y) cerr << " - " << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << " - " << #v << " : " << endl << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;

void IO() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int N,M; 
vi adj[MX];
bool vis[MX];
set <int> s;

void dfs(int u){
	vis[u]=true;
	s.insert(u);
	for(auto v: adj[u]) if(!vis[v]) dfs(v);
}

int32_t main() {
	boost; IO();

	cin>>N>>M;
	memset(vis,false,MX);
	for(int i=0; i<M; i++){
		int u,v; cin>>u>>v;
		adj[u].pb(v); adj[v].pb(u);
	}
	
	int ans=0;
	for(int i=1; i<=N; i++)if(!vis[i]){
		s.clear();
		dfs(i);
		ans=max(ans,sz(s));
	}
	cout << ans << endl;



	return 0;
}

/* Careful!!!
	.Array bounds
	.Infinite loops
	.Uninitialized variables / empty containers
	.Order of input

   Some insights:
	.Binary search
	.Graph representation
	.Write brute force code
	.Change your approach
*/


Measured memory_bytes: 33400
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
char p[maxn];
int s[maxn];
int main()
{
    int x,a=0;
    cin>>p;
    int m=strlen(p);
    int sum=0;
    for(int i=0;i<m;i++)
        s[i]=p[i]-'0';
    for(int i=0;i<m;i++)
        if(s[i]!=9)
        {
            x=i;
            break;
        }
    for(int i=0;i<m;i++)
        if(s[i]==9)
            a++;
    if(a==m-1&&s[0]!=9)
    {
        for(int i=0;i<m;i++)
        sum+=s[i];
    }
    else if(a==m)
    {
        for(int i=0;i<m;i++)
        sum+=s[i];
    }
    else
    {
    if(x==0)
    {
        s[x]-=1;
        for(int i=x+1;i<m;i++)
            s[i]=9;
    }
    else
    {
        s[x-1]-=1;
        for(int i=x;i<m;i++)
            s[i]=9;
    }
    for(int i=0;i<m;i++)
        sum+=s[i];
    }
    printf("%d\n",sum);
}

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

using namespace std;

#define MOD 1000000007
#define ll long long int
#define ld long double
#define pb push_back
#define mkp make_pair
#define pii pair<int, int> 
#define pll pair<long long int, long long int>
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define fi first
#define sc second
#define eps 1e-9

ll A[3][100005], DP[3][100005];

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

	ll n, i, j, k, x, y, z;
	cin >> n;
	for (i = 1; i <= n; ++i) cin >> A[0][i] >> A[1][i] >> A[2][i];
	for (i = 1; i <= n; ++i) {
		for (j = 0; j < 3; ++j) {
			DP[j][i] = -1e18;
			for (k = 0; k < 3; ++k) {
				if (j == k) continue;
				DP[j][i] = max(DP[j][i], DP[k][i-1] + A[j][i]);
			}
		}
	}
	cout << max(DP[0][n], max(DP[1][n], DP[2][n])) << endl;

	return 0;
}


Measured memory_bytes: 4992
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    a = [LI() for _ in range(m)]
    e = collections.defaultdict(list)
    for u,v,s in a:
        e[u].append((v,s))
        e[v].append((u,s))

    f = collections.defaultdict(bool)
    t = [None] * (n+1)
    t[e[1][0][0]] = -1000000
    nf = set()
    q = [e[1][0][0]]
    r = None
    while q:
        i = q.pop()
        for v,s in e[i]:
            if f[v]:
                continue
            if t[v] is None:
                t[v] = s - t[i]
                q.append(v)
            elif t[v] != s - t[i]:
                if v in nf:
                    return 0
                tv = (t[v] + s - t[i]) // 2
                t = [None] * (n+1)
                t[v] = tv
                nf.add(v)
                q = [v]
                break
        if nf:
            f = collections.defaultdict(bool)
        else:
            f[i] = True
    t[0] = inf
    t2 = t[:]
    tmi = t.index(min(t))
    f = collections.defaultdict(bool)
    t = [None] * (n+1)
    t[tmi] = 1
    nf = set()
    q = [tmi]
    r = None
    while q:
        i = q.pop()
        for v,s in e[i]:
            if f[v]:
                continue
            if t[v] is None:
                t[v] = s - t[i]
                q.append(v)
            elif t[v] != s - t[i]:
                if v in nf:
                    return 0
                tv = (t[v] + s - t[i]) // 2
                t = [None] * (n+1)
                t[v] = tv
                nf.add(v)
                q = [v]
                break
        if nf:
            f = collections.defaultdict(bool)
        else:
            f[i] = True
    r = inf
    if t[1:] == t2[1:]:
        if min(t[1:]) > 0:
            return 1
        return 0
    for i in range(1,n+1):
        if t[i] < 0:
            return 0
        if t[i] > t2[i]:
            continue
        if r > t[i]:
            r = t[i]


    return r



print(main())



Measured memory_bytes: 78012
Ass = []

for i in range(3) :
  As = list(map(int, input().split()))
  Ass.append(As)

N = int(input())

for i in range(N) :
  b = int(input())
  for i in range(3):
    for j in range(3):
      if Ass[i][j] == b :
        Ass[i][j] = 0

for i in range(3):
  bingo1 = True
  for j in range(3):
    if Ass[i][j] != 0 :
      bingo1 = False
  if bingo1 :
    print("Yes")
    exit()

for i in range(3):
  bingo1 = True
  for j in range(3):
    if Ass[j][i] != 0 :
      bingo1 = False
  if bingo1 :
    print("Yes")
    exit()

bingo1 = True
for i in range(3):
  if Ass[i][i] != 0 :
    bingo1 = False
if bingo1 :
  print("Yes")
  exit()

bingo1 = True
for i in range(3):
  if Ass[i][2-i] != 0 :
    bingo1 = False
if bingo1 :
  print("Yes")
  exit()

print("No")


Measured memory_bytes: 3064
m, otoshidama = map(int, input().split(" "))

for yukichi in range(m + 1):
  for higuchi in range(m + 1):
    noguchi = m - yukichi - higuchi
    money = yukichi * 10000 + higuchi * 5000 + noguchi * 1000
    if money == otoshidama and yukichi + higuchi + noguchi == m and noguchi >= 0:
      print(yukichi,higuchi,noguchi)
      exit()
print(-1, -1, -1)

Measured memory_bytes: 3060
s = input()
t = input()

al = list('abcdefghijklmnopqrstuvwxyz')

ss = {}
ts = {}
for char in s:
    if not char in ss.keys():
        ss[char] = 1
    else:
        ss[char] += 1

for char in t:
    if not char in ts.keys():
        ts[char] = 1
    else:
        ts[char] += 1

if sorted(list(ss.values())) == sorted(list(ts.values())):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3632
from decimal import Decimal as D

n=int(input())

for loop in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4=[D(i) for i in input().split(" ")]

    AB=[x2-x1,y2-y1]
    CD=[x4-x3,y4-y3]
    if AB[0]*CD[1]==AB[1]*CD[0]:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 9956
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;


int main(void) {
	int A, B, X;
    scanf("%d %d %d", &A, &B, &X);
    if (X - A <= B && X >= A) YES;
    else NO;
    

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void){
  int len, i, j, temp, count=0;
  int N[100];
 
  scanf("%d", &len);
  for(i=0; i<len; i++){
    scanf("%d", &N[i]);
  }
   
  for(i=0; i<len; i++){
    for(j=len-1; j>i; j--){

      if(N[j] < N[j-1]){

	temp = N[j];
	N[j] = N[j-1];
	N[j-1] = temp;

	count++;
      }

    }
  }
   
  for(i=0; i<len; i++){
    if(i<len-1){
      printf("%d ", N[i]);
    }else{
      printf("%d\n", N[i]);
    }
  }
   
  printf("%d\n", count);
  return 0;
}

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

using namespace std;

int n;
int mmap[2][110];
int maxi = -1;

void visit(int i, int j, int calc)
{
    if(i == 1 && j == n-1){
        maxi = max(maxi, calc + mmap[i][j]);
    };

    if( i < 0 || i >= 2 || j < 0 || j >= n ) return;
    visit(i, j+1, calc + mmap[i][j]);
    visit(i+1, j, calc + mmap[i][j]);
}

int main(){

    cin >> n;

    for(int i = 0; i < 2; i++){
        for(int j = 0; j < n; j++){
            cin >> mmap[i][j];
        }
    }
    
    visit(0, 0, 0);

    cout << maxi << endl;
    
    return 0;
}

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

using namespace std;
const int nmax = 2e5 + 100;
int a[nmax];
int main() {
    int n; scanf("%d", &n);
    int l = 1;
    long long ans = 0, sum = 0;
    for(int r = 1; r <= n; r++){
        scanf("%d", &a[r]);
        while((sum ^ a[r]) != sum + a[r]) sum ^= a[l], l++;
        sum ^= a[r];
        ans += (r - l + 1);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline void readInt(int &x) {
	x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x*=f;
}
inline void readLong(ll &x) {
	x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x*=f;
}
/*================Header Template==============*/
string s;
int main() {
	cin>>s;
	int len=s.length();
	cout<<s.substr(0,len-8)<<endl;
} 

Measured memory_bytes: 256
import itertools
def LI():return list(map(int,input().split()))
n,m,q=LI()
abcd=[]
for _ in range(q):
  a,b,c,d=LI()
  a-=1
  b-=1  
  abcd.append((a,b,c,d))
As=itertools.combinations_with_replacement(range(m),n)
ans=0
for A in As:
  cnt=0
  for a,b,c,d in abcd:
    if A[b]-A[a]==c:cnt+=d
  ans=max(ans,cnt)
print(ans)

Measured memory_bytes: 73260
# 2019-11-26 17:11:55(JST)
import sys
def main():
    n, *a = map(int, sys.stdin.read().split())
    a = [None] + a

    cnt = 0
    for i in range(1, n):
        j = a[i]
        if j > i and a[j] == i:
            cnt += 1
    
    print(cnt)

if __name__ == '__main__':
    main()


Measured memory_bytes: 13940
s = input()
t = input()
x = ""
if s==t:
  print('Yes')
else:
  for i in range(len(s)):
    if i!=len(s)-1:
      if s[i]==t[0] and s[i+1]==t[1]:
        for j in range(i,len(s)):
          x += s[j]
        for k in range(i):
          x += s[k]
    elif i==len(s)-1:
      if s[i]==t[0] and s[0]==t[1]:
        for j in range(i,len(s)):
          x += s[j]
        for l in range(i):
          x += s[l]
  print('Yes' if x==t else 'No')

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

int main(void){
	ll N, K;
	cin >> N >> K;
	if (K<=N) N = N%K;
	N = min(N,K-N);
	cout << N << endl;
	return 0;
}


Measured memory_bytes: 3548
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()
    result = []
    for i in range(N + 1):
        result.append(len(set(S[:i]) & set(S[i:])))
    print(max(result))


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
(let* ((n (read))
       (lst (make-array n :initial-contents (reverse (loop :repeat n :collect (read))))))
  (loop :for k :from 1 :upto (- (length lst) 1)
        :do(if (= (aref lst k) (1+ (aref lst (1- k))))
               (decf (aref lst k))))
  (if (or (= n 1)
          (loop :for k :from 0 :upto (- n 2)
                :always (>= (aref lst k) (aref lst (1+ k)))))
      (princ "Yes")
      (princ "No")))

Measured memory_bytes: 59752
using System;
public class Hello{
    public static void Main(){
        // Your code here!
        string input = Console.ReadLine();
        int x = 0;
        foreach(char s in input)
        {
            if(s == '+')
            {
                x++;
            }
            else
            {
                x--;
            }
        }
        Console.WriteLine(x);
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <cmath>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> k(M);
    vector<int> s(M);
    vector<int> p(M);
    for (int i = 0; i < M; i++) {
        cin >> k[i];
        s[i] = 0;
        for (int j = 0; j < k[i]; j++) {
            int sij;
            cin >> sij;
            s[i] |= (1 << (sij - 1));
        }
    }
    for (int i = 0; i < M; i++) {
        cin >> p[i];
    }

    vector<int> on(1 << N, 0);
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < (1 << N); j++) {
            if (__builtin_popcount(j & s[i]) % 2 == p[i]) {
                on[j]++;
            }
        }
    }

    int count = 0;
    for (int i = 0; i < (1 << N); i++) {
        if (on[i] == M) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.System.in;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] nw = reader.readLine().split(" ");
        int N = Integer.parseInt(nw[0]);
        int W = Integer.parseInt(nw[1]);
        int[] weights = new int[N+1];
        int[] values = new int[N+1];
        for (int i = 1; i <= N ; i++) {
            String[] wv = reader.readLine().split(" ");
            int w = Integer.parseInt(wv[0]);
            int v = Integer.parseInt(wv[1]);
            weights[i] = w;
            values[i] = v;
        }
        long[][] dp = new long[N+1][W+1];
        for (int i = 1; i <=N ; i++) {
            for (int j = 1; j <=W ; j++) {
                if(j>=weights[i]) dp[i][j] = Math.max(dp[i-1][j],values[i]+dp[i-1][j-weights[i]]);
                else dp[i][j] = dp[i-1][j];
            }
        }
        System.out.println(dp[N][W]);
    }
}


Measured memory_bytes: 124372