akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int A, B;
    cin >> A >> B;

    --A;
    --B;

    vector<string> table(100);
    rep(i, 0, 100)
    {
        table[i] = string(100, i < 50 ? '.' : '#');
    }

    {
        int r = 51;
        int c = 0;
        while (A > 0)
        {
            table[r][c] = '.';
            c += 2;
            if (c >= 100)
            {
                r += 2;
                c = 0;
            }
            --A;
        }
    }

    {
        int r = 1;
        int c = 0;
        while (B > 0)
        {
            table[r][c] = '#';
            c += 2;
            if (c >= 100)
            {
                r += 2;
                c = 0;
            }
            --B;
        }
    }

    cout << "100 100" << endl;
    for (const string& s : table)
    {
        cout << s << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second 
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int n,a[202020],b[202020];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n;
	fo(i,1,n){
		cin>>a[i];
		b[a[i]-1]++;
	}
	fo(i,0,n)cout<<b[i]<<endl;
	return 0;
}

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

int main() {
    //input
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b == c || a+c == b || b+c == a){
        cout << "Yes";
    }else{
        cout << "No";
    }


    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [0]*N
AC = int(0)
WA = int(0)
TLE = int(0)
RE = int(0)


for i in range(0,N):
  S[i] = input()
  if(S[i]=='AC'):
    AC += 1
  if(S[i]=='WA'):
    WA += 1
  if(S[i]=='TLE'):
    TLE += 1
  if(S[i]=='RE'):
    RE += 1
    
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)

Measured memory_bytes: 16180
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
    long long n,c,k;
    cin >> n >> c >> k;
    vector<long long> t(n);
    for(int i=0;i<n;i++){
        cin >> t[i];
    }
    sort(t.begin(),t.end());
    long long ans=1;
    int cnt=1;
    long long temp=t[0];
    for(int i=1;i<n;i++){
        if(t[i]-temp<=k&&cnt<c){
            cnt++;
        }else{
            temp = t[i];
            ans++;
            cnt=1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll  INFL = 1e18;

template <class T>
class SegmentTree
{
private:
    int n;
    vector<T> data; 
    const T identity;
    const function<T(T, T)> operate;
    const function<T(T, T)> change;

    T query(int l, int r, int k, int a, int b)
    {
        if(b <= l || r <= a) return identity;
        if(l <= a && b <= r) return data[k];
        T vl = query(l, r, 2*k+1, a, (a+b)/2);
        T vr = query(l, r, 2*k+2, (a+b)/2, b);
        return operate(vl, vr);
    }
public:
    SegmentTree(int size, T identity, function<T(T, T)> operate, function<T(T, T)> change)
        :identity(identity), operate(operate), change(change)
    {
        n = 1;
        while(n < size) n <<= 1;
        data.resize(2*n-1, identity);
    }

    void update(int index, T value)
    {
        index += n-1;
        data[index] = change(data[index], value);
        while(index > 0)
        {
            index = (index-1)/2;
            data[index] = operate(data[2*index+1], data[2*index+2]);
        }
    }

    T query(int l, int r)
    {
        return query(l, r, 0, 0, n);
    }
};

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N, Q;
    string S;
    cin >> N >> S >> Q;

    SegmentTree<bitset<26>> st(
        N,
        bitset<26>(0),
        [](bitset<26> a, bitset<26> b){return a | b;},
        [](bitset<26> a, bitset<26> b){return b;}
    );

    REP(i, N)
    {
        bitset<26> b(0);
        b[S[i]-'a'] = 1;
        st.update(i, b);
    }

    vi ans;
    REP(i, Q)
    {
        int type; cin >> type;
        if(type == 1)
        {
            int index;
            char c;
            cin >> index >> c;
            bitset<26> b(0);
            b[c-'a'] = 1;
            st.update(index-1, b);
        }
        else
        {
            int l, r; cin >> l >> r;
            bitset<26> b = st.query(l-1, r);
            ans.push_back(b.count());
        }
    }
    REP(i, ans.size()) cout << ans[i] << endl;
}

Measured memory_bytes: 9244
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use ascii::{AsciiChar, AsciiStr, AsciiString};
use indexmap::IndexMap;
use itertools::*;
use libm::*;
use num::*;
use ordered_float::OrderedFloat;
use permutohedron::LexicalPermutation;
use proconio::marker::{Bytes, Chars};
use proconio::{fastout, input};
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;

fn main() {
    input!(l:usize, r:usize, d:usize);
    let mut ans = 0;
    for i in l..=r {
        if i % d == 0 { ans += 1;}
    }

    println!("{}", ans);
}


Measured memory_bytes: 2136
import java.io.*;

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in1 = br.readLine().split(" ");
        //int N = Integer.parseInt(br.readLine());
        long A = Long.parseLong(in1[0]);
        long B = Long.parseLong(in1[1]);
        long C = Long.parseLong(in1[2]);
        br.close();

        long ans = 0L;
        if(A%2 != 0 && B%2 != 0 && C%2 != 0){
            ans = Math.min(A * B, B * C);
            ans = Math.min(ans, C * A);
        }

        System.out.println(ans);
    }
}

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

int main(){
  int N,K;
  cin >> N;
  vector<int> d(N,0);
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  sort(d.begin(),d.end());
  if(d[(N/2)-1]==d[N/2]){
    K = 0;
  }
  else{
    K = d[N/2]-d[(N/2)-1];
  }
  cout << K << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  int x;
  cin >> x;
  if (x == 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}


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


#ifdef NO_UNLOCK_IO
#define getchar_unlocked getchar
#define putchar_unlocked putchar
#endif
struct FastIO {
	static void scan(double &x) {
		scanf("%lf", &x);
	}
	template <class Integral>
	static void scan(Integral &x) {
		int k, m = 1;
		x = 0;
		for (;;) {
			k = getchar_unlocked();
			//if (k == '-') {
			//	m = -1;
			//	break;
			//}
			//else
			if ('0' <= k && k <= '9') {
				x = k - '0';
				break;
			}
		}
		for (;;) {
			k = getchar_unlocked();
			if (k < '0' || k > '9')
				break;

			x = x * 10 + k - '0';
		}
		//x *= m;//mul is faster than branch-misprediction penalty (maybe)
	}
	template <class Arithmetic, class... Rest>
	static void scan(Arithmetic &x, Rest&... y) {
		scan(x);
		scan(y...);
	}
	static void print(double x, char c) {
		printf("%.12f%c", x, c);
	}
	static void print(const char *x, char c) {
		printf("%s%c", x, c);
	}
	template <class Integral>
	static void print(Integral x, char c) {
		int s = 0, m = 0;
		char f[20];//Is this faster than "static char" ?
		if (x < 0) {
			m = 1;
			x = -x;
		}
		while (x) {
			f[s++] = x % 10;
			x /= 10;
		}

		if (!s)
			f[s++] = 0;

		if (m) putchar_unlocked('-');
		while (s--)
			putchar_unlocked(f[s] + '0');

		putchar_unlocked(c);
	}
	template <class Arithmetic>
	static void println(Arithmetic x) {
		print(x, '\n');
	}
};


 
using namespace std;
 
typedef long long LL;
 
const LL INF = 1LL << 61;
const int mod = 1e9 + 7;
 
int N;
LL A, B;
LL v[100005];
int dp[100005][2];
 
int add(int x, int y) {x += y; if(x >= mod) x -= mod; return x;}
int sub(int x, int y) {x -= y; if(x < 0) x += mod; return x;}
 
int main()
{
 
    //scanf("%d", &N);
    //scanf("%lld%lld", &A, &B);
    FastIO::scan(N,A,B);
    if(A > B)   swap(A, B);
    v[0] = -INF;
    for(int i = 1; i <= N; i++){
      //scanf("%lld", &v[i]);
      FastIO::scan(v[i]);
    }
 
    dp[1][0] = dp[1][1] = 1;
    int posB = 1;
    int lftA = 1;
    for(int i = 2; i <= N; i++)
    {
        if(v[i] - v[i - 1] >= A)    dp[i][0] = add(dp[i - 1][0], dp[i - 1][1]);
        else if(v[i] - v[i - 2] >= A)   dp[i][0] = dp[i - 1][1];
        else { if(i > 2) { printf("0\n"); return 0; } }
 
        while(v[i] - v[posB] >= B)  posB++;
 
        if(posB == i)   dp[i][1] = add(dp[i - 1][0], dp[i - 1][1]);
        else if(lftA <= posB)   dp[i][1] = dp[posB][0];
 
        if(v[i] - v[i - 1] >= A);
        else    lftA = i;
    }
 
    int ans = add(dp[N][0], dp[N][1]);
    printf("%d\n", ans);
 
    return 0;
}

Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
	var S, T string
	fmt.Scan(&S, &T)
	sm := map[string][]string{}
	tm := map[string][]string{}
	for i := 0; i < len(S); i++ {
		sm[S[i:i+1]] = append(sm[S[i:i+1]], T[i:i+1])
		tm[T[i:i+1]] = append(tm[T[i:i+1]], S[i:i+1])
	}
	for _, v := range sm {
		if len(v) > 1 {
			w := v[0]
			for i := 1; i < len(v); i++ {
				if w != v[i] {
					fmt.Println("No")
					return
				}
			}
		}
	}
	for _, v := range tm {
		if len(v) > 1 {
			w := v[0]
			for i := 1; i < len(v); i++ {
				if w != v[i] {
					fmt.Println("No")
					return
				}
			}
		}
	}
	fmt.Println("Yes")
}

Measured memory_bytes: 20096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x_, i_, j_) cerr << #x_ << "------------" << "\n";cerr << "from " << i_ << " to " << j_ << "\n";for(ll k_=i_; k_<=j_; k_++) cerr << x_[k_] << " ";cerr << "\n"; cerr.flush();
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

const ll MOD = 1e9 + 7;
const int INF = 2e9;
const int MAX_LOG = 21;
const int MAX_N = 5005;

ll mult(ll a, ll b){
	if(a == 0 || b == 0){
		return 0;
	}
	else{
		if(a % 2 == 1){
			return (b + mult(a - 1, b)) % MOD;
		}
		else return mult(a / 2, b) * 2 % MOD;
	}
}

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

	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	ll ans = 0;
	vvll cnt(2, vll(64));
	for(int i = n - 1; i >= 0; i--){
		for(int bit = 0; bit < 61; bit++){
			ll same = (1LL << bit);
			if(a[i] & (1LL << bit)){
				cnt[1][bit] += same;
				cnt[1][bit] %= MOD;
				ans += cnt[0][bit];
				ans %= MOD;
			}
			else{
				cnt[0][bit] += same;
				cnt[0][bit] %= MOD;
				ans += cnt[1][bit];
				ans %= MOD;
				
			}
		}
		// trace2(ans, i);
		// debugtwo(cnt);
	}
	cout << ans << endl;

}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); ++i)
#define rep1(i,n) for (int i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
int main(){
  ll a,b; cin >> a >> b;
  cout << max(a+b, max(a-b, a*b));
  return 0;
}


Measured memory_bytes: 3616
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

h,w = i2()
for i in range(h):
	c = s()
	print(c)
	print(c)
	
	

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

using namespace std;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const long long MOD = 1e9 + 7;
const long long  INF = 5e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

int s, c, d[4] = { 6000,4000,3000,2000 };

int main() {
	for (int i = 0;i < 4;i++) {
		cin >> s >> c;
		cout << c * d[s - 1] << endl;
	}
	return 0;
}




Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define N 100020
#define zyy 1000000007
#define ll long long
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
	while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return f?x:-x;
}
int pri[N], cnt, mark[N], pnt[N];
void split(int x) {
	for (int i = 1; i <= cnt && x > 1; i++) {
		while (x % pri[i] == 0) {
			pnt[i] ++;
			x /= pri[i];
		}
	}
}
int main(int argc, char const *argv[]) {
	int n = read();
	for (int i = 2; i <= n; i++) {
		if (!mark[i]) pri[++cnt] = i;
		for (int j = 1; j <= cnt && i * pri[j] <= n; j++) {
			mark[i * pri[j]] = 1;
			if (i % pri[j] == 0) break;
		}
	}
	for (int i = 2; i <= n; i++)
		split(i);
	ll ans = 1;
	for (int i = 1; i <= cnt; i++)
		ans = ans * (pnt[i] + 1) % zyy;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

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

  ll a[3] = {2,1,0};
  for (auto i = 2; i <= N; ++i) {
    a[i%3] = a[(i-1)%3] + a[(i-2)%3];
  }

  cout << a[N%3] << endl;;
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
even_list = [i for i in a if i % 2 == 0]
odd_list = [i for i in a if i % 2 != 0]
four_list = [i for i in even_list if i % 4 == 0]
two_idx = n // 2
if len(four_list) >= two_idx:
  print('Yes')
elif n - 2 * len(four_list) == len(even_list) - len(four_list):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int n;
set<string> ans;

void dfs(string &x) {
    if (x.size() == n) {
        ans.insert(x);
        return;
    }
    set<char> st;
    int sz = x.size();
    rep(i,sz) st.insert(x[i]);
    int kind = st.size();

    rep(i,kind+1) {
        string ret(x);
        ret.push_back('a'+i);
        dfs(ret);
    }

    return;
}

int main(int argc, char const *argv[]) {
    cin>>n;
    string a = "a";
    dfs(a);
    for (auto &&e: ans) cout << e << '\n';
    return 0;
}

Measured memory_bytes: 14208
from bisect import bisect_left
N = int(input())
L = sorted([int(i) for i in input().split()])

res = 0

for i in range(N):
    for j in range(i+1, N):
        r = bisect_left(L, L[i]+L[j])
        res += max(r-(j+1), 0)

print(res)


Measured memory_bytes: 3188
import java.util.*;
public class Main {
	static final Scanner stdin = new Scanner(System.in);
	public static void main(String[] args) {
		while(stdin.hasNext()){
			double a = stdin.nextDouble();
			double b = stdin.nextDouble();
			double c = stdin.nextDouble();
			double d = stdin.nextDouble();
			double e = stdin.nextDouble();
			double f = stdin.nextDouble();
			double x[] = solve(a,b,c,d,e,f);
			System.out.printf("%.3f %.3f\n", x[0], x[1]);
		}
	}
	static final double[] solve(double a, double b, double c, double d, double e, double f){
		double[] ans = new double[2];
		ans[0] = (c*e - b*f) / (a*e - b*d) + 0.0; //+0.0 ???????????¨??´???????????£??????
		ans[1] = (a*f - c*d) / (a*e - b*d) + 0.0; //printf????????¨??? -0.000??¨??????wrong answer????????£????????????
		return ans;
	}
}

Measured memory_bytes: 28392
#include <algorithm>
#include <bits/stdc++.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define PB push_back
#define MP make_pair
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
using ll = long long;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


void Main() {
  double A,B;
  cin >> A >> B;
  OUT(A/B);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();

  return 0;
}

Measured memory_bytes: 256
//模範回答
function main(input) {
  const args = input.split(' ');
  const N = parseInt(args[0], 10),
        Y = parseInt(args[1], 10);

  var result = '-1 -1 -1';

  //forループを二回に留めておくことがミソ
  for (var a = 0; a <= N; a++) {
      for (var b = 0; b <= N-a; b++) {
          if ((a + b) > N) {
              continue;
          }

          var sum = (a * 10000) + (b * 5000) + ((N - a - b) * 1000);
          if (sum === Y) {
              result = `${a} ${b} ${N - a - b}`;
              break;
          }
      }        
  }

  console.log(result);

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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



int main(){
    int AC, WA, TLE, RE, n;
    AC = 0;
    WA = 0;
    TLE = 0;
    RE = 0;
    string v;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> v;
        if (v == "AC") AC += 1;
        else if (v == "WA") WA += 1;
        else if (v == "RE") RE += 1;
        else if (v == "TLE") TLE += 1;        
    }    
    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

#define rep(loop, N) for (int loop = 0; loop < N; loop++)

using namespace std;

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
		else {
			break;
		}
	}
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination1(int, int);
};
int Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Tenki(void) {

	string S, T; cin >> S >> T;

	int counter = 0;
	rep(index, 3) if (S[index] == T[index]) counter++;
	
	cout << counter << flush;
	return;
}

void B_Power_Socket(void) {
	
	int A, B; cin >> A >> B;
	
	cout << ceil(double(B - 1) / double(A - 1)) << flush;
	return;
}

void C_Lower(void) {

	int N; cin >> N;
	vector<int> H(N); for (int& it : H)cin >> it;

	int counter = 0;
	int maxCount = 0;
	rep(index, N - 1) {
		if (H[index] >= H[index + 1]) {
			counter++;
		}
		else {
			maxCount = max(maxCount, counter);
			counter = 0;
		}
	}
	maxCount = max(maxCount, counter);
	
	cout << maxCount << flush;
	return;
}

int main(void) {

	//A_Tenki();
	//B_Power_Socket();
	C_Lower();
	return 0;
}


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

using namespace std;


int main(void) {
    long n;
    cin >> n;
    string s;
    cin >> s;
    long q;
    cin >> q;

    for(int i=0; i<q; i++) {
        long k;
        cin >> k;

        long r = 0, d = 0, m = 0, dm = 0;
        for(int i=0; i<n; i++) {
            if(i-k >= 0) {
                switch(s[i-k]) {
                    case 'D':
                        d--;
                        dm -= m;
                        break;
                    case 'M':
                        m--;
                        break;
                }
            }
            switch(s[i]) {
                case 'D':
                    d++;
                    break;
                case 'M':
                    m++;
                    dm += d;
                    break;
                case 'C':
                    r += dm;
                    break;
            }


        }
        cout << r << endl;
    }
}


Measured memory_bytes: 1412
let ch v = if v = "25" then "Christmas" else v;;
let ch2 v = if v = "24" then "Christmas Eve" else v;;
let ch3 v = if v = "23" then "Christmas Eve Eve" else v;;
let ch4 v = if v = "22" then "Christmas Eve Eve Eve" else v;;



print_string " "; print_string (ch4(ch3(ch2(ch(read_line ()))))); print_string "\n";;

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  int n,t;
  cin >> n >> t;
  vector<int> s(n);
  rep(i,n) cin >> s[i];
  vector<ll> a(n);
  a[0] = s[0] + t;
  for(int i=1;i<=n-1;i++){
    a[i] = a[i-1] + t - max(s[i-1]+t-s[i],0);
  }
  cout << a[n-1] << endl;
}

Measured memory_bytes: 2560
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  ll n;
  cin>>n;
  for(int i=sqrt(n);i>=1;i--){
    if(n%i==0){
      cout<<i+n/i-2<<endl;
      return 0;
    }
  }
}

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

int main(){
  bool f = true;
  string N;
  cin >> N;
  for (int i = 0; i < N.length()/2; i++) {
    if (N[i] != N[N.length() - i - 1]) {
      f = false;
      break;
    }
  }
  printf("%s\n",f?"Yes":"No");
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<list>
#include<string>
#include<algorithm>

using namespace std;

int main() {
  long long n,m;
  cin >> n >> m;
  vector<bool> check(n,false);
  vector<int> WA(n,0);
  int wa = 0;
  int ac = 0;
  for(int i=0;i<m;i++){
    long long p;
    string s;
    cin >> p >> s;
    if(check[p]) continue;
    if(s == "AC"){
      check[p] = true;
      ac++;
      wa += WA[p];
    }else if(s == "WA"){
      WA[p]++;
    }
  }

  cout << ac << " " << wa << endl;
}

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

int main(void){
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)cin>>a[i];
    
    ll res=0,sum=0,xsum=0;
    bool flag=true;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;){
            if(flag){
                sum+=a[j];
                xsum^=a[j];
            }
            //cout<<"sum:"<<sum<<" xsum:"<<xsum<<endl;
            if(sum==xsum){
                res+=1+j-i;
                j++;
                flag=true;
            }else{
                sum-=a[i];
                xsum^=a[i];
                i++;
                flag=false;
            }
//            if(i==j)j++;
        }
        break;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <climits>

using namespace std;

typedef long long ll;
typedef vector<int> ivec;
typedef pair<int, int> ipair;

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

    int n = s.size();

    ll sum = 0;
    for (int i = 0; i < (1 << (n-1)); i++) {
        ll t = 0;
        for (int j = 0; j < n - 1; j++) {
            t *= 10;
            t += (s[j] - '0');
            if ((1 << j) & i) {
                sum += t;
                t = 0;
            }
        }
        t *= 10;
        t += (s[n-1] - '0');
        sum += t;
    }

    cout << sum << endl;

    return 0;
}


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


int main()

{
   string s,t;
  cin>>s>>t;
  
  int ls=s.length();
  int lt=t.length();
  int ans=INT_MAX;
  for(int a=0;a<ls-lt+1;a++) 
  {
    int different=0;
    
  for(int b=0;b<lt;b++)
  {
       if(s[a+b]!=t[b])
         different++;
         
        
      
  }
    ans=min(ans,different);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3612
#include<cstdio>
int main(){
int x,y;
for(;;){
    std::scanf("%d%d",&x,&y);
    if(x == 0 && y == 0){
        break;
    }
    else if(x < y){
        std::printf("%d %d\n", x, y);
    }
        else {
            std::printf("%d %d\n", y, x);
        }
    }
}


Measured memory_bytes: 2552
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;

vector<int> buf;
int ans;
int n;

void dfs(int i, const int size, const int range_start, const int range_end)
{  
    if (i == size) {
        // ここで所望の作業を行う
      ll num=0;
      bool ok[4];
      ok[3]=true;
      rep(l,3)ok[l]=false;
        for(int k = 0; k < buf.size(); ++k){
          if(buf[k]==0){
            num+=3*pow(10,k);
            ok[0]=true;
          }
          else if(buf[k]==1){
            num+=5*pow(10,k);
            ok[1]=true;
          }
          else if(buf[k]==2){
            num+=7*pow(10,k);
            ok[2]=true;
          }
        }
      int nnum=num;
      while(nnum>0){
        if(nnum%10==0)ok[3]=false;
        nnum/=10;
      }
      if(num<=n && ok[0] && ok[1] && ok[2] && ok[3]){
        ans++;
      }
    }
    else{
        for(int j = range_start; j <= range_end; ++j){
            buf[i] = j;
            dfs(i + 1, size, range_start, range_end);
        }
    }
}

int main(void)
{
  cin >> n;
  
    int size = 9;
    int range_start = 0;
    int range_end = 3;
    buf.resize(size);
    dfs(0, size, range_start, range_end);
  cout << ans << endl;
    return 0;
}

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

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadInts();
            if (input[0] % 3 == 0) WriteLine("Possible");
            else if (input[1] % 3 == 0) WriteLine("Possible");
            else if ((input[0] + input[1]) % 3 == 0) WriteLine("Possible");
            else WriteLine("Impossible");
        }

        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
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  int cnt = 1;
  int tot = N - K;

  while(tot > 0){
    tot -= (K - 1);
    cnt++;
  }

  cout << cnt << endl;
}

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

using namespace std;

int a, b;

int main() {
    int i;

    scanf("%d%d",&a,&b);
    if (a<=0&&0<=b) {
        printf("Zero\n");
        return 0;
    }
    if (b<0&&(b-a+1)%2) printf("Negative\n");
    else printf("Positive\n");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

int main(){
    int N;
    cin >> N;
    int K;
    cin >> K;
    vector<int64_t> x(N);
    for(auto& c : x){
        cin >> c;
    }
    int64_t ans = 1ll << 40;
    for(int i = 0; i <= N-K; ++i){
        const int j = i + K - 1;
        if(x[i] < 0){
            if(x[j] <= 0){
                ans = min(ans, -x[i]);
            } else if(-x[i] < x[j]){
                ans = min(ans, -x[i] * 2 + x[j]);
            } else {
                ans = min(ans, -x[i] + x[j] * 2);
            }
        } else {
            ans = min(ans, x[j]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int N=2e3+100,mod=924844033;
ll dp[N][N],pd[N*2][N+100];
ll fac[N];
int32_t main(){
    ll n,k;
    fac[0]=1;
    for (int i=1;i<N;i++){
        fac[i]=fac[i-1]*i%mod;
    }
    cin >> n >> k;
    for (int i=0;i<N;i++) pd[i][0]=1;
    for (int i=2;i<N*2;i++){
        for (int j=1;j<=i/2;j++){
            pd[i][j]=pd[i-2][j-1]+pd[i-1][j];
            pd[i][j]%=mod;
        }
    }
    dp[0][0]=1;
    for (int i=1;i<=min(n,2*k);i++){
        ll z=n-i+1;
        z=(z+k-1)/k;
        if (i>k) z++;
        for (int j=0;j<N;j++){
            for (int k=0;k<=z/2;k++){
                if (j>=k){
                    dp[i][j]+=dp[i-1][j-k]*pd[z][k]%mod;
                    dp[i][j]%=mod;
                }
            }
        }
    }
    ll ans=1;
    for (int i=1;i<=n;i++) ans*=i,ans%=mod;
    ll z=-1;
    for (int i=1;i<=n;i++){
        ans+=z*dp[min(2*k,n)][i]%mod*fac[n-i]%mod;
        ans+=mod;
        ans%=mod;
        z*=-1;
    }
    cout << ans << endl;

}


Measured memory_bytes: 86028
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int L = ni();
        int sum = 0;
        for (int i = 0; i < N; i++) {
            sum += L+i;
        }
        int eat = 0;
        long ans = Integer.MAX_VALUE;
        for (int i = 0; i < N; i++) {
            if(Math.abs(L+i) < ans){
                ans = Math.abs(L+i);
                eat = i;
            }
        }
        ans = sum - (L+eat);
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

int main() {
    string s;
    int q;
    cin >> s >> q;
    deque<char> d;
    for (char i : s) {
        d.push_back(i);
    }
    int cnt = 0;
    for (int i = 0; i < q; ++i) {
        int t;
        cin >> t;
        if (t == 1) {
            cnt++;
        } else {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1) {
                if (cnt % 2 == 0) {
                    d.push_front(c);
                } else {
                    d.push_back(c);
                }
            } else {
                if (cnt % 2 == 0) {
                    d.push_back(c);
                } else {
                    d.push_front(c);
                }
            }
        }
    }
    if (cnt % 2 == 1) {
        reverse(d.begin(), d.end());
    }
    for (char j : d) {
        cout << j;
    }
    cout << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;

const int N = 200200;
long long p2[N];
long long gcd(long long a, long long b)
{
	return b ? gcd(b, a % b) : a;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	p2[0] = 1; 
	for (int i=1; i<N; i++){
		p2[i] = (p2[i-1]*2)%mod;
	} 
	int n;
	cin>>n;
	
	map<pair<long long, long long>, pair<int, int>> m;
	long long zeros = mod-1;
	
	for (int i=0; i<n; i++){
		long long a, b;
		cin>>a>>b;
		if (a==0 && b==0) {
			zeros++;
			continue;
		}
		
		long long g = gcd(abs(a), abs(b));
		a /= g;
		b /= g;
		
		if (a>0 and b>=0){
			m[{b, a}].first++;
		}
		else if (a<0 and b<=0){
			m[{-b,-a}].first++;
		}
		else if(a>=0 and b<0){
			m[{a,-b}].second++;
		}
		else if (a<=0 and b>0){
			m[{-a, b}].second++;
		}	
	}

	long long ans = 1;
	for (auto e: m){
		pair<int, int> cnt = e.second;
		ans = ans * (p2[cnt.first] + p2[cnt.second] - 1) % mod;
	}
	ans = (ans+zeros)%mod;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 17612
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

H,W = map(int,input().split())
S = [[] for i in range(H)]
for i in range(H):
    S[i] = list(str(input()))

lights = [[(0,0) for j in range(W)] for i in range(H)]

def count_ver(i,j):
    cnt = 0
    for x in range(i,W):
        if S[j][x] == ".":
            cnt += 1
        else:
            break
    for x in range(i,i+cnt):
        ver,hor = lights[j][x]
        lights[j][x] = (cnt,hor)
    return cnt


def count_hor(i,j):
    cnt = 0
    for y in range(j,H):
        if S[y][i] == ".":
            cnt += 1
        else:
            break
    for y in range(j,j+cnt):
        ver,hor = lights[y][i]
        lights[y][i] = (ver,cnt)
    return cnt

ans = -1
for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            ver,hor = lights[i][j]
            if ver == 0:
                ver = count_ver(j,i)
            if hor == 0:
                hor = count_hor(j,i)
            ans = max(ans,hor+ver-1)

print(ans)


Measured memory_bytes: 403824
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}


int main(){
    ios::sync_with_stdio(false);
	ll n; cin >> n;
	string s; cin >> s;
	ll r=0,g=0,b=0;
	rep(i,n){
		if(s[i]=='R') r++;
		else if(s[i]=='G') g++;
		else b++;
	}
	ll ans=r*g*b;
	for(int i=0;i<n;i++){
		for(int j=0;(j+2*i)<n;j++){
			if((s[j]!=s[i+j])&&(s[j+2*i]!=s[i+j])&&(s[j]!=s[j+2*i])){
				ans--;
			}
		}
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
struct ASUM{
    bool lA=false;
    ll cnt=0;
};
int main(void){
    ll N,Q;cin>>N>>Q;
    string S;cin>>S;

    ll asum[N+1]={};
    REPS(i,N){
        asum[i]=asum[i-1];
        if(S[i-1]=='A'&&S[i]=='C'){
            asum[i]++;
        }
    }
    pair<ll,ll> q[Q];REP(i,Q)cin>>q[i].first>>q[i].second;

    REP(i,Q){
        ll l=q[i].first,r=q[i].second;
        //cout<<S[r-1]<<"r:"<<asum[r]<<" "<<S[l-1]<<"l:"<<asum[l]<<"\n";
        cout<</*"res:"<<*/asum[r-1]-asum[l-1]<<"\n";
    }
}


Measured memory_bytes: 3456
function Main(input) {

	input = input.split(" ");
	
    const N = parseInt(input[0]);
    const X = parseInt(input[1]);
    const T = parseInt(input[2]);
    let time = 0;

    if(N%X == 0){
        time = (N/X)*T;
    } else {
        time = (Math.floor(N/X)+1)*T;
    }

    console.log( '%d', time);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29628
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int N;
    cin >> N;
    int A[N];
    REP(i, N) cin >> A[i];
    double s;
    REP(i, N) s += 1.0 / (double)(A[i]);
    cout << 1.0 / s << endl;
    
    return 0;
}


Measured memory_bytes: 256
i = list(map(int, input().split()))

H = i[0]
W = i[1]

while H != 0 or W != 0 :
    for i in range(H) :
        for j in range(W) :
            print('#', end='')
        if W != 0 :
            print()
    print()
    i = list(map(int, input().split()))

    H = i[0]
    W = i[1]

Measured memory_bytes: 9044
import java.util.Scanner;
public class Main{

    public static void main(String[] args){
        int i=0, n;

        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int A[] = new int[n];
        
        while(i < n){
            A[i] = sc.nextInt();
            i++;
        }
        i = n-1;
        while(i >= 0){
            if(i == 0) System.out.println(A[0]);
            else System.out.print(A[i]+" ");
            i--;
        }
    }
}


Measured memory_bytes: 26300
from itertools import product
from copy import deepcopy, copy
class QueenMAP():
    def __init__(self):
        self.yoko = set()
        self.tate = set()
        self.naname1 = set()
        self.naname2 = set()
        self.MAP = [["."] * 8 for _ in range(8)]
    def add(self, y, x):
        self.MAP[y][x] = "Q"
        self.yoko.add(y)
        self.tate.add(x)
        self.naname1.add(y - x)
        self.naname2.add(x + y)
    def check(self, y, x):
        if y in self.yoko or x in self.tate or (y - x) in self.naname1 or (x + y) in self.naname2:
            return False
        return True
    def allcheck(self):
        for i in range(8):
            if not "Q" in self.MAP[i]:
                return False
        return True
def nuri(m, a, b):
    for i in range(8):
        m[a][i] = "1"
        m[i][b] = "1"
    if a + b < 8:
        y = a + b
        x = 0
        l = a + b + 1
    else:
        y = 7
        x = a + b - 7
        l = 15 - a - b
    for i in range(l):
        m[y - i][x + i] = "1"
    if a <= b:
        ny = 0
        nx = b - a
        l = 8 - (b + a)
    else:
        ny = a - b
        nx = 0
        l = 8 - (a - b)
    for i in range(l):
        m[ny + i][nx + i] = "1"
    return m
def solve(MAP0, MAP, n):
    dp = [(deepcopy(MAP0), deepcopy(MAP), n)]
    while dp:
        m0, m, cnt = dp.pop()
        if cnt == 8:
            flg = True
            for r in range(8):
                if "".join(map(str, m0[r])).find("0"):
                    flg = False
                    break
            if flg:
                return m
        for i in range(8):
            for j in range(8):
                if m0[i][j] == "0":
                    dp.append((nuri(deepcopy(m0), i, j), deepcopy(m), cnt + 1))
    return m
def MAIN():
    f = lambda M: "\n".join("".join(map(str, m)) for m in M)
    QM = QueenMAP()
    n = int(input())
    for _ in range(n):
        a, b = map(int, input().split())
        QM.add(a, b)
    dp = [(deepcopy(QM), n)]
    while dp:
        Q, cnt = dp.pop()
        if cnt == 8:
            if Q.allcheck():
                print(f(Q.MAP))
                break
            continue
        cnt += 1
        for i in range(8):
            for j in range(8):
                if Q.check(i, j):
                    CQ = deepcopy(Q)
                    CQ.add(i, j)
                    dp.append((CQ, cnt))
MAIN()



Measured memory_bytes: 6356