akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var NL = ReadSplitInt();
            var N = NL[0];
            var L = NL[1];
            var min = int.MaxValue;
            var sum = 0;
            for (var i = 1; i <= N; i++)
            {
                var b = L + (i - 1);
                if (Abs(min) > Abs(b))
                {
                    min = b;
                }
                sum += b;
            }
            Println(sum - min);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
int i,j,n,m,k,l,a[31],b,c;
int main()
{
  for(cin>>n>>m;i<n;i++)for(j=0,cin>>k;j<k;j++)cin>>b,a[b]++;
  for(i=1;i<=m;i++)if(a[i]==n)c++;cout<<c;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTG(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define ENDL cout << endl;
using namespace std;
using ll = long long;
using ld = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VI = vector<int>;
using VVI = vector<VI>;
using Vll = vector<ll>;
using VVll = vector<Vll>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K, Q;
  cin >> N >> K >> Q;
  VI point(N, K);
  REP(i, Q)
  {
    int a;
    cin >> a;
    a--;
    point[a]++;
  }
  REP(i, N)
  {
    if (point[i] - Q > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
const ll mod = 1e9 + 7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N;
string S;
ll res = 1;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> S;
    for(int i = 1; i <= N; i++) res = res * i % mod;
    int cnt = 0;
    for(int i = 0; i < 2 * N; i++){
        if((i & 1) ^ (S[i] != 'B')){
            res = res * cnt % mod;
            cnt--;
        }else{
            cnt++;
        }
    }
    if(cnt != 0) res = 0;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 720
use std::io::stdin;

fn main(){
    let ks = getvec();
    let (k, s) = (ks[0], ks[1]);
    let mut ans = 0;
    for x in 0..k+1{
        ans += if s>=x {solve2(s-x, k)} else {0};
    }
    println!("{}", ans);
}

fn solve2(s :i64, k:i64) -> i64{
    if s > 2*k {0}
    else if s > k { (2*k)-s+1 }
    else {s+1}
}

#[allow(dead_code)]
fn getline() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn getvec() -> Vec<i64>{
    let line = getline();
    line.split_whitespace().map(|x| x.parse().unwrap()).collect()
}

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

using namespace std;
const int maxn=2e5+5;
#define ll long long
int a[maxn];
int b[maxn];
int main() {
    int n,k;
    ll ans=0;
    cin>>k>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    
    	for(int i=2;i<=n;i++)b[i-1]=a[i]-a[i-1];
    	b[n]=k+a[1]-a[n];
	sort(b+1,b+1+n);
	for(int i=1;i<=n-1;i++)ans+=b[i];
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>
using namespace std;
int main() {
    char a, b;
    cin >> a >> b;
    if(a == 'H') {
        if(b == 'H'){
            cout << 'H' << endl;
        }else{
            cout << 'D' << endl;
        }
    }else if(a == 'D') {
        if(b == 'H') {
            cout << 'D' << endl;
        }else{
            cout << 'H' << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000
  
	int main(){
	unsigned short *A,*B;

	int C[VMAX+1];
	int n,i,j;
	scanf("%d",&n);
	 
	A=malloc(sizeof(short)*n+1);
	B=malloc(sizeof(short)*n+1);

	for(i=0;i<=VMAX;i++) C[i]=0;

	for(i=0;i<n;i++){
		scanf("%hu",&A[i+1]);
		C[A[i+1]]++;
	}

	for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];

	for(j=1;j<=n;j++){
		B[C[A[j]]]=A[j];
		C[A[j]]--;
	}

	for(i=1;i<=n;i++){
		if(i>1) printf(" ");
		printf("%d",B[i]);
	}
	printf("\n");

return 0;
}

Measured memory_bytes: 9716
#include<stdio.h>
#include<string.h>

main(){
    int i,m,count=1;
    char command[5];
    int temp;
    while(1){
        scanf("%d",&m);
        if(m==0){
            break;
        }
        count=1;
        int u=1;
        int s=2;
        int e=3;
        int w=4;
        int n=5;
        int d=6;
        for(i=0;i<m;i++){
            scanf("%s",command);
            if(strcmp(command,"North")==0){
                temp=u;
                u=s;
                s=d;
                d=n;
                n=temp;
            }
            else if(strcmp(command,"South")==0){
                temp=u;
                u=n;
                n=d;
                d=s;
                s=temp;
            }
            else if(strcmp(command,"East")==0){
                temp=u;
                u=w;
                w=d;
                d=e;
                e=temp;
            }
            else if(strcmp(command,"West")==0){
                temp=u;
                u=e;
                e=d;
                d=w;
                w=temp;
            }
            else if(strcmp(command,"Left")==0){
                temp=s;
                s=w;
                w=n;
                n=e;
                e=temp;
            }
            else if(strcmp(command,"Right")==0){
                temp=s;
                s=e;
                e=n;
                n=w;
                w=temp;
            }
            count+=u;
        }
        printf("%d\n",count);
    }
    return 0;
}

Measured memory_bytes: 604
#include <stdio.h>
#include <algorithm>

void trace(int a[], int size) {
    for (int i = 0; i < size; ++i) {
        if (i > 0) {
            printf(" ");
        }
        printf("%d", a[i]);
    }
    printf("\n");
}

void SelectionSort(int A[], int N) {
    int count  = 0;
    for (int i = 0; i < N; ++i) {
        int min = i;
        for (int j = i; j < N; ++j) {
            if (A[j] < A[min]) {
                min = j;
            }
        }
        if (i != min) {
            std::swap(A[i], A[min]);
            count++;
        }
    }

    trace(A, N);
    printf("%d\n", count);
}

int main() {
    int N;
    int A[100];

    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }

    SelectionSort(A, N);
    return 0;
}

Measured memory_bytes: 2708
#include <cstdio>

using namespace std;

using i64=long long;

i64 pow(i64 b, i64 e) {
    /* Exponentiation by squaring */
    // returns n == b**e
    i64 n=1, a=b;
    while (e) {
        if (e & 1)
            n *= a;

        a *= a;
        e >>= 1;
    }
    return n;
}

int main() {
    i64 N, K;
    scanf("%lld %lld", &N, &K);

    printf("%lld\n", K*pow(K-1, N-1));
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>

int main(){
  int a, b, c, aux;
  scanf("%d%d%d", &a, &b, &c);
  if(a > b){
    aux = a;  a = b;  b = aux;
  }
  if(a > c){
    aux = a;  a = c;  c = aux;
  }
  if(b > c){
    aux = b;  b = c;  c = aux;
  }
  a -= b;
  c -= b;
  b = 0;
  int r = 0;
  r += (1 - a) / 2;
  if((-a) & 1)
    r++;
  r += c;
  printf("%d", r);
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  int a = N / 100;
  int b = (N - a * 100) / 10;
  int c = N % 10;

  int ans = 0;
  if (a == b) {
    if (b == c) {
      ans = N;
    } else {
      if (b > c) {
        ans = a * 100 + b * 10 + b;
      } else {
        ans = (a+1) * 100 + (b+1) * 10 + (b+1);
      }
    }
  } else {
    if (a > b) {
      ans = a * 100 + a * 10 + a;
    } else {
      ans = (a+1) * 100 + (a+1) * 10 + (a+1);
    }
  }

  cout << ans << endl;

  return 0;
}


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

#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mk make_pair
#define mod 1000000007
//map<int, int>::iterator itr; 

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;cin>>n;
    int arr[n+1];
    for(int i=0;i<=n;i++){
        arr[i]=0;
    }
    for(int i=1;i<=100;i++){
        for(int j=1;j<=100;j++){
            for(int k=1;k<=100;k++){
                ll val=i*i+j*j+k*k+i*j+j*k+i*k;
                if(val<=n){
                    arr[val]++;
                }
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<arr[i]<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	rep(i,n) a.at(i)-=i+1;
	sort(a.begin(),a.end());
	ll sum=0,ans=0;
	ll b=a[n/2],c;
	if(n%2==0) c=a[n/2-1];
	rep(i,n){
		sum+=abs(a.at(i)-b);
		ans+=abs(a.at(i)-c);
	}
	cout << min(ans,sum) << endl;
}

Measured memory_bytes: 1024
x = int(input())
prime = [2,3]
j = 3
while prime[-1] < 1000:
    j = j + 2
    i = 1
    pr = True
    while prime[i]*prime[i] <= j:
        if j % prime[i] == 0:
            pr = False
            break
        i = i+1
    if pr == True:
        prime.append(j)
        
newprime = 0
while newprime == 0:
    pr = True
    for i in range(len(prime)):
        if x == prime[i]:
            newprime = x
            break
        elif x %  prime[i] == 0:
            pr = False
            break
    if pr == True:
        newprime = x
    x = x+1
print(newprime)

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

signed main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	bool f[26] = { false };
	int i;
	rep(i, s.size()) {
		f[s[i] - 'a'] = true;
	}
	rep(i, 26) {
		if (!f[i]) {
			cout << (char)(i + 'a') << endl;
			return 0;
		}
	}
	cout << "None\n";
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
ll bit[100000],mx,res;
void count_bit_p(ll x){
    ll idx = 1;
    ll pos = 1;
    ll two = 2;

    while(pos<=x){
        mx = max(mx,idx);
        ll r = x-pos+1;
        bit[idx] += (r/two)*pos;
        ll p = r % two;
        //cout<<idx<<" "<<pos<<" "<<two<<" "<<p<<" "<<r<<endl;

        bit[idx] += min(p,two/2);

        idx++;
        pos*=2;
        two*=2;
    }
}
void count_bit_m(ll x){
    ll idx = 1;
    ll pos = 1;
    ll two = 2;

    while(pos<=x){
        ll r = x-pos+1;
        bit[idx] -= (r/two)*pos;
        ll p = r % two;
        //cout<<idx<<" "<<pos<<" "<<two<<" "<<p<<" "<<r<<endl;

        bit[idx] -= min(p,two/2);

        idx++;
        pos*=2;
        two*=2;
    }
}
int main(){
    ll a,b;
    cin>>a>>b;
    count_bit_p(b);
    count_bit_m(a-1);

    ll t = 1;
    for(int i=1;i<=mx;i++){
        if(bit[i]%2==1){res+=t;}
        t*=2;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
   int N;
   char S[55];
   int i;
   scanf("%d%s",&N,S);
   int ans=0;
   for(i=0;i<=N-3;i++)
   {
       if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C')
       {
           ans++;
       }
   }
   printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
bc = [list(map(int, input().split())) for _ in range(m)]
bc = sorted(bc, key=lambda x:x[1], reverse=True)
st = 0
flag = True
for i in range(m):
  b, c = bc[i]
  if flag and st < n:
    for i in range(st, min(b+st, n)):
      if a[i] < c:
        a[i] = c
      else:
        flag = False
        break
    st += b
  else:
    break

print(sum(a))


Measured memory_bytes: 33640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            char[] chr_N = n.ToString().ToCharArray();

            int inumA = chr_N.Length - 1;

            if(chr_N[inumA]== '2' | chr_N[inumA]== '4' | chr_N[inumA] == '5' | chr_N[inumA] == '7' | chr_N[inumA] == '9')
            {
                Console.WriteLine("hon");
            }
            else if (chr_N[inumA] == '0' | chr_N[inumA] == '1' | chr_N[inumA] == '6' | chr_N[inumA] == '8')
            {
                Console.WriteLine("pon");
            }
            else if (chr_N[inumA] == '3')
            {
                Console.WriteLine("bon");
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27548
N = int(input())

count = 0
flag = False
for i in range(N):
  D1, D2 = map(int, input().split())
  if D1 == D2:
    count += 1
  else:
    count = 0
  if count == 3:
    flag = True

if flag:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 62344
#include <bits/stdc++.h>
using namespace std;
const long long MOD=998244353;
template <typename T>
struct BIT{
    //区間加算O(log(N))
    //区間シグマ計算O(log(N))
    //単点加算O(log(N))
    //単点計算O(log(N))
    long long n;//元の数列のサイズ
    vector<T> bit[2];//データ収納用
    vector<T> for_bubblesort;
    void init(long long n_){
        n=n_+1;
        for(long long j=0;j<2;j++){
            bit[j].assign(n,0);
        }
    }
    void add_sub(long long p,long long i,T x){
        for(long long j=i;j<n;j+=j&-j){
            bit[p][j]+=x;
            bit[p][j]%=MOD;
        }
    }
    void add(long long l,long long r,T x){//[l,r]に加算
        add_sub(0,l,-x*(l-1));
        add_sub(0,r+1,x*r);
        add_sub(1,l,x);
        add_sub(1,r+1,-x);
    }
    T sum_sub(long long p,long long i){
        T s(0);
        for (long long j=i;j>0;j-=j&-j){
            s+=bit[p][j];
            s%=MOD;
        }
        return s;
    }
    T sum(long long i,long long j){//[i,j]のΣを計算
        int ss=(sum_sub(0,j)+sum_sub(1,j)*j-sum_sub(0,i-1)-sum_sub(1,i-1)*(i-1))%MOD;
         ss+=MOD;
      ss%=MOD;
      return ss;
    }
};
int main(){
  #define int long long
  int N,K;
  cin>>N>>K;
  BIT<int> rock;
  rock.init(N+1000000);
  vector<pair<int,int>> vec(K);
  for(int i=0;i<K;i++){
    int a,b;
    cin>>a>>b;
    vec.at(i)={a,b};
  }
  rock.add(1,1,1);
  for(int i=1;i<N;i++){
    int x=rock.sum(i,i)%MOD;
    for(int j=0;j<K;j++){
      rock.add(i+vec.at(j).first,i+vec.at(j).second,x);
    }
  }
    cout<<rock.sum(N,N)%MOD<<endl;
}

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



int n,m;


int main()
{
	int x1,y1,x2,y2,k,ans1=0,ans2=0;	
	cin>>x1>>y1>>x2>>y2>>k;
	ans1=x1*60+y1;
	ans2=x2*60+y2;
	cout<<(ans2-ans1-k)<<endl;
} 

Measured memory_bytes: 3596
// Something on it

#include <bits/stdc++.h>

using namespace std;

int main(){
    string s;
    int ans=700;
    cin >> s;
    if(s[0]=='o') ans+=100;
    if(s[1]=='o') ans+=100;
    if(s[2]=='o') ans+=100;
    cout << ans << endl;
}
 

Measured memory_bytes: 256
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const n: number = +input[0];
let ans: string = 'No';

for(let i = 1; i <10; i++){
    for(let j = 1; j < 10; j++){
        if(i*j === n){
            ans = 'Yes';
        }
    }
}
console.log(ans);

Measured memory_bytes: 7372
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    n = int(input())
    ds = list(map(int, input().split()))
    ans = 0
    for x, y in itertools.combinations(ds, 2):    
        ans += x * y
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
# solution

data=int(input())
M=10**9+7

dp={b:1 for b in 'ACGT'}
for i in range(data-1):
    dp_next={}
    for j in dp:
        for k in 'AGCT':
            elem=j[-3:]+k
            if elem[-3:] in ('AGC','GAC','ACG') or elem in ('AGGC','ATGC','ACGC','AGTC','AGGC'):
                continue
            else:
                dp_next.setdefault(elem,0)
                dp_next[elem]+=dp[j]
    dp=dp_next
print(sum(dp.values())%M)

Measured memory_bytes: 3064
def main():
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	h = A[-1]//2
	c = A[0]
	for a in A:
		if a == A[-1]:
			continue
		if abs(h-a) <= abs(h-c):
			c = a
	print(" ".join([str(A[-1]), str(c)]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 14428
<?php
fscanf(STDIN, '%d', $n);
for ($i=1; $i<=$n; $i++) {
  fscanf(STDIN, '%s %d', $title, $sec);
  $music[$i]['title'] = $title;
  $music[$i]['sec'] = $sec;
}
fscanf(STDIN, '%s', $ended_title);

$sleep_sec = 0;
$sleep_music_num = 0;
for ($i=1; $i<=$n; $i++) {
  if ($music[$i]['title'] == $ended_title) {
    $sleep_music_num = $i;
  }
  if ($i > $sleep_music_num && $sleep_music_num) {
    $sleep_sec += $music[$i]['sec'];
  }
}

echo $sleep_sec;

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

int main() {
  int a, b;
  string s;
  cin >> a >> b >> s;

  bool yes = true;

  for(int i=0;i<s.size();i++) {
    if(i==a) {
      if(s[i] != '-') {
        yes = false;
        break;
      }
    } else {
      if(s[i] == '-') {
        yes = false;
        break;
      }
    }
  }

  if(yes) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		C(sc);
	}
	
	public static void A(Scanner sc) {
		int N = sc.nextInt();
		int A = sc.nextInt();
		if(N%500 <=A) out.println("Yes");
		else out.println("No");
	}
	
	public static void B(Scanner sc) {
		int N = sc.nextInt();
		int ret = 0;
		Integer[] a = new Integer[N];
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a,Collections.reverseOrder());
		for(int i=0;i<N;i++) {
			if(i%2==0) ret+=a[i];
			else ret-=a[i];
		}
		out.println(ret);
	}
	
	public static void C(Scanner sc) {
		int[][] c = new int[4][4];
		for(int i=1;i<4;i++) {
			for(int j=1;j<4;j++) {
				c[i][j] = sc.nextInt();
			}
		}
		if(c[1][1]-c[1][2]==c[2][1]-c[2][2] && c[2][1]-c[2][2]==c[3][1]-c[3][2] &&
				c[1][2]-c[1][3]==c[2][2]-c[2][3] && c[2][2]-c[2][3]==c[3][2]-c[3][3] &&
				c[1][1]-c[1][3]==c[2][1]-c[2][3] && c[2][1]-c[2][3]==c[3][1]-c[3][3]) out.println("Yes");
		else out.println("No");
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   ll n,k;
   string s;
   cin>>n>>s>>k;
   for(ll i=0;i<n;i++)
   {
       if(s[i]!=s[k-1])
       s[i]='*';
   }
   cout<<s;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
		String b=sc.next();
		int n=0;
		for(int i=0;i<3;i++){
			if(a.charAt(i)==b.charAt(i)){
				n=n+1;
			}
		}
		System.out.print(n);
		
	}
}


Measured memory_bytes: 25556
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

ll inf=  1000000000000000000ll;
int check(ll x, ll y){
    ll k = inf/y;
    //cout<<k<<" "<<inf%y<<endl;
    return x<k || (k==x && inf%y==0);
}

int main() {
    fast;
    ll a; cin>>a;
    ll o = 1, fl = 1, f0 = 0;
    for(int q=0; q<a; q++){
        ll x; cin>>x;
        f0 |= x==0;
        if(x==0){
            o = 0;
            break;
        }
        if(check(o,x)) o*=x;
        else fl = 0;
    }
    fl |= f0;
    if(!fl) o = -1;
    cout<<o;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int cnt = 0;
        int x = i;
        while (x != 0) {
            x /= 10;
            cnt++;
        }
        if (cnt % 2 != 0) {
            ans++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
    #include<string>
    using namespace std;
    int a, b, i;
    string s;
    int main()
    {
    	cin >> a >> b >> s;
    	if(s.substr(a, 1) != "-") {
    		cout << "No" << endl;
    		return 0;
    	}
    	for(i = 0; i <= a + b; i ++)
    	{
    		if(i != a){
    			if(s.substr(i, 1) < "0" || s.substr(i, 1) > "9"){
    				cout << "No" << endl;
    				return 0;
    			}
    		}
    	}
    	cout << "Yes" << endl;
    	return 0;
    }

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

public class Test
{
	public static void Main()
	{
		
		var x = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
		int ans = 0;
		for(int i=0;i!=5;i++){
			if(x[i]==0){
				ans = i+1;
			}
		}
		
		Console.WriteLine(ans);
		
		
	}
}

Measured memory_bytes: 18952
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N = list(input())

p = 0
for i in range(len(N)):
    p += int(N[i])

if p % 9 == 0:
    print("Yes")
else:
    print("No")




















Measured memory_bytes: 12488
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(20);
    int n, k; cin >> n >> k;
    vector<ll> a(n);
    for (ll &x : a) {
        cin >> x;
    }
    sort(a.begin(), a.end(), [&](const ll &x, const ll &y) {
        return abs(x) > abs(y);
         });
    const ll mod = (ll) 1e9 + 7;
    ll res = 1;
    int sgn = 1;
    auto change = [&](ll x) {
        int other = (x > 0) - (x < 0);
        if (sgn == 0 || other == 0) {
            return sgn = 0;
        }
        if (sgn == other) {
            return sgn = 1;
        }
        return sgn = -1;
    };
    for (int i = 0; i < k; i++) {
        change(a[i]);
        res = (res * a[i]) % mod;
    }
    if (sgn >= 0) {
        cout << res << "\n";
        exit(0);
    }
    ll div1 = -1, mult1 = -1, div2 = -1, mult2 = -1;
    int i1 = -1, i2 = -1, j1 = -1, j2 = -1;
    /// div pos mult neg
    for (int i = k - 1; i >= 0; i--) {
        if (a[i] > 0) {
            div1 = a[i];
            i1 = i;
            for (int j = k; j < n; j++) {
                if (a[j] <= 0) {
                    j1 = j;
                    mult1 = a[j];
                    break;
                }
            }
            break;
        }
    }
    /// div neg mult pos
    for (int i = k - 1; i >= 0; i--) {
        if (a[i] < 0) {
            div2 = a[i];
            i2 = i;
            for (int j = k; j < n; j++) {
                if (a[j] >= 0) {
                    j2 = j;
                    mult2 = a[j];
                    break;
                }
            }
            break;
        }
    }
    if (j1 == -1 && j2 == -1) {
        res = 1;
        reverse(a.begin(), a.end());
        for (int i = 0; i < k; i++) {
            res = (res * a[i]) % mod;
        }
        while (res < 0) {
            res += mod;
        }
        cout << res << "\n";
        exit(0);
    }
    auto calc = [&](int fi, int se) {
        ll ret = 1;
        for (int i = 0; i < n; i++) {
            if (i < k) {
                if (i == fi) {
                    continue;
                }
                ret = (ret * a[i]) % mod;
            } else {
                if (i == se) {
                    ret = (ret * a[i]) % mod;
                }
            }
        }
        assert(ret >= 0);
        return ret;
    };
//    cerr << i1 << " " << j1 << " " << i2 << " " << j2 << "\n";
    if (j1 == -1) {
        cout << calc(i2, j2) << "\n";
        exit(0);
    }
    if (j2 == -1) {
        cout << calc(i1, j1) << "\n";
        exit(0);
    }
    if (abs(mult1 * div2) >= abs(mult2 * div1)) {
        cout << calc(i1, j1) << "\n";
    } else {
        cout << calc(i2, j2) << "\n";
    }
}


Measured memory_bytes: 5192
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;

    ll sum=0;
    for(int i=1;i<=n;i++){
        if(i%5 ==0 || i%3 == 0) continue;
        else                    sum +=i;
    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define fi first
#define se second
#define mk make_pair
using namespace std;
const int MAXN = 1e2 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
typedef long long LL;
typedef pair<int, int> PII;
char s[MAXN], k;
int dp[MAXN][4][2];
/*
digit dp

dp[i][j][r]: the higher i digits has already been decided,
and there are j non-zero digits,
r = 0: it has already been determined that it is less than N,
r = 1: it has not yet determined that it is less than N.
 */



int main() {
    scanf("%s%d", s + 1, &k);
    int len = strlen(s + 1);
    dp[0][0][1] = 1;
    for(int i = 1; i <= len; ++i){
        for(int j = 0; j <= k; ++j){
            for(int r=0; r <= 1; ++r){
                int up = r ? s[i] - '0' : 9;
                if(j == k)  up = 0;
                for(int h = 0; h <= up; ++h){
                    dp[i][j + (h!=0)][r&&(h==up)] += dp[i-1][j][r];
                }
            }
        }
    }
    printf("%d\n", dp[len][k][0] + dp[len][k][1]);
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define mkp make_pair
#define no {cout << "-1\n"; return;}

void solve() {
    string s; cin >> s;
    cout << s;
    if (s.back() == 's')
        cout << "es";
    else cout << "s";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

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

int main() {
  int N;
  string C;
  cin >> N >> C;
  int cnt = 0;
  rep(i, N) {
    if (C.at(i) == 'R') cnt++;
  }

  int ans = 0;
  for (int i = cnt; i < N; i++) {
    if (C.at(i) == 'R') ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3676
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>
using namespace std;
using dl=long long;

int main(){
    string s;
    int c=1,j;
    bool f=1;
    cin>>s;
    sort(s.begin(),s.end());
    lp(i,s.size()){
        for(j=i+1;s.size();j++){
            if(s[i]==s[j])
                c++;
            else
                break;
        }
        if(c%2!=0){
            f=false;
            break;
        }
        c=1;
        i=j-1;
    }
    cout<<(f?"Yes":"No")<<endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;

int main()
{
	char a[5], b[5], c[5];
	scanf("%s", a);
	scanf("%s", b);
	scanf("%s", c);
	printf("%c%c%c\n", a[0], b[1], c[2]);
}

Measured memory_bytes: 256
n,m=map(int,input().split())
s=list()
for i in range(n):
    s.append(list(map(int,input().split())))
c=list()
for i in range(m):
    c.append(list(map(int,input().split())))
#print(s,c)
for i in range(n):
    l=list()
    for j in range(m):
        l.append(abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1]))
    print(l.index(min(l))+1)

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a-1)*(b-1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
using PII = pair<int, int>;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

class Dijkstra {
private:
    struct Edge {
        int to;
        int cost;
    };
    // G[i]: vector of Edges connected to Edge i.
    vector<vector<Edge>> G;

public:
    int n;
    // d[i]: minimum cost to visit Edge i.
    vector<int> d;

    explicit Dijkstra(int size) {
        n = size;
        G.resize(n, vector<Edge>());
        d.resize(n, INF);
    }

    // `from` and `to` must be 0-indexed.
    void add(int from, int to, int cost) {
        Edge e = {to, cost};
        G[from].push_back(e);
    }

    void dijkstra(int start) {
        priority_queue <PII, vector<PII>, greater<PII>> pq;
        // vector of { minimum cost to Edge i, Edge i}
        d[start] = 0;
        pq.push({0, start});
        while (!pq.empty()) {
            PII p = pq.top();
            pq.pop();
            if (d[p.second] < p.first) continue;
            for (auto &&e : G[p.second]) {
                if (d[e.to] > d[p.second] + e.cost) {
                    d[e.to] = d[p.second] + e.cost;
                    pq.push({d[e.to], e.to});
                }
            }
        }
    }
};

signed main() {
    int n, m;
    cin >> n >> m;
    Dijkstra d(n);
    for (int i = 0; i < m; i++) {
        int l, r, c;
        cin >> l >> r >> c;
        d.add(l - 1, r - 1, c);
    }
    for (int i = 1; i < n; i++) {
        d.add(i, i - 1, 0);
    }
    d.dijkstra(0);
    cout << (d.d[n - 1] == INF ? -1 : d.d[n - 1]) << "\n";
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    string s;cin>>s;
    rep(i,s.size()){
        if(s[i] == 'A'){
            ll res;
            for(int j=i+1;j<s.size();j++){
                if(s[j] == 'Z')res=j;
            }
            out(res-i+1);
            return 0;
        }
    }
}


Measured memory_bytes: 720
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <vector>
#include <functional>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <cstdlib>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <deque>
#include <random>
#include <chrono>
#include <ctime>
#include <climits>
#include <stack>
#include <array>
#include <iomanip>
#include <complex>
#include <bitset>
#include <iostream>
#include <cstring>

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()
#define pb push_back
#define eb emplace_back
#define em emplace
#define y0 withindarkness
#define y1 apinklotusbloomed
#define yn carryingapurplesoul
#define j1 togetherformingtheTeam

void useiostream() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(8);
}

void drop(char const* bu) {
	printf("%s", bu);
	exit(0);
}

ull gcd(ull a, ull b) {
	return b == 0 ? a : gcd(b, a % b);
}

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

ld const pi = acos(-1.0L);
ld const eps = 0.0001L;

template<typename T, typename TT> bool mi(T& a, TT b) { return a > b ? (a = b, true) : false; }
template<typename T, typename TT> bool ma(T& a, TT b) { return a < b ? (a = b, true) : false; }

mt19937 ran(996);

int const mod = 1000000007;

ull bm(ull a, ull p, ull mod) {
	return (a * p - (ll)((ld)a * p / mod) * mod + mod) % mod;
}

ull bp(ull a, ull p, ull mod) {
	ull re = 1;
	while (p) {
		if (p & 1)re = bm(re, a, mod);
		p >>= 1;
		a = bm(a, a, mod);
	}
	return re;
}

ull n;

int main() {
	useiostream();
#ifdef _DEBUG
	(void)freopen("input.txt", "r", stdin);
	(void)freopen("output.txt", "w", stdout);
#else
	//(void)freopen("bisector.in", "r", stdin);
	//(void)freopen("bisector.out", "w", stdout);
#endif

	cin >> n;

	if (n & 1) {
		drop("0");
	}

	ull re = 0;

	for (ull a = 5; a <= n; a *= 5) {
		ull k = n / a;
		re += k;
		// 5 -> 3 6 -> 3
		re -= (k + 1) / 2;
	}


	cout << re;
	// a 2a 3a.... k*a <= n => k = n/a
	// a 3a 5a.... k*a <= n => k = n / a
	// 
	// 
	// 


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll a(n); REP(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    if (a[n-1]-a[0] > 1) cout << "No" << '\n';
    else if (a[n-1] == a[0]) {
        if (a[0]==n-1) cout << "Yes" << '\n';
        else if (2*a[0] <= n) cout << "Yes" << '\n';
        else cout << "No" << '\n';
    } else {
        ll ac=1;
        rep(i, 1, n) {
            if (a[i] == a[i-1]) ac++;
            else break;
        }
        if (ac <= a[0] && 2*(a[n-1]-ac)<=n-ac) cout << "Yes" << '\n';
        else cout << "No" << '\n';
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a + b > c + d)cout << "Left" << endl;
	else if (a + b < c + d)cout << "Right" << endl;
	else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
N = int(input())
S = input()

RGB = [list()] * 3
color = ['R', 'G', 'B']
RGB[0] = [i for i, s in enumerate(S) if s == color[0]]
RGB[1] = [i for i, s in enumerate(S) if s == color[1]]
RGB[2] = [i for i, s in enumerate(S) if s == color[2]]

order = sorted([0, 1, 2], key=lambda i: len(RGB[i]))
color = [color[i] for i in order]
RGB = [RGB[i] for i in order]

# b = list()
ans = len(RGB[0]) * len(RGB[1]) * len(RGB[2])
for c1 in RGB[0]:
    for c2 in RGB[1]:
        p = c1 * 2 - c2
        if 0 <= p and p < N and S[p] == color[2]:
            # b.append((c1, c2, p))
            ans -= 1

        p = c2 * 2 - c1
        if 0 <= p and p < N and S[p] == color[2]:
            # b.append((c1, c2, p))
            ans -= 1

        if (c1 + c2) % 2 == 0 and S[(c1 + c2) // 2] == color[2]:
            # b.append(c1, c2, c1 + c2 / 2)
            ans -= 1

print(ans)

# b = [sorted(t) for t in b]
# print(sorted(b))


Measured memory_bytes: 9260
import java.util.*;

public class Main {

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

		int N = sc.nextInt();
		int K = sc.nextInt();
		
		if (K % 2 == 0) {
			int tmp = N / K;
			long ans = 0;
			ans += convi(tmp);
			tmp = N / (K / 2);
			tmp = tmp / 2 + tmp % 2;
			ans += convi(tmp);
			System.out.println(ans);
		} else {
			int tmp = N / K;
			System.out.println(convi(tmp));
		}
	}
	
	static long convi(long yaku) {
		long ans = 0;
		if (yaku == 1) {
			ans = 1;
		} else {
			ans = (long) (Math.pow(yaku, 3));
		}
		
		return ans;
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;

int main() {
    vector<long long int> um1, um2;
    string s;
    cin >> s;
    int l = s.size();
    um1 = vector<long long int>(2019, 0);
    um1[0]++;
    long long int res = 0;
    int c = 0;
    for (int i = 0; i < l; i++) {
        um2 = vector<long long int>(2019, 0);
        for (int j = 0; j < 2019; j++) {
            um2[j * 10 % 2019] += um1[j];
        }
        um1 = um2;
        c = c * 10 + s[i] - '0';
        c %= 2019;
        res += um1[c];
        um1[c]++;
    }
    cout << res << endl;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, count = 0;
  cin >> A >> B;
  for(int i = A; i <= B; i++) {
    int tth, tho, ten, one;
    tth = i / 10000;
    tho = i / 1000 % 10;
    ten = i / 10 % 10;
    one = i % 10;
    if(tth == one && tho == ten) {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/practice/tasks/practice_1

use std::io;

fn read_as_vec() -> Vec<char>{
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    
    let input: Vec<char> = input.chars().collect(); 
    input
}

fn main(){
    let mut input: Vec<char> = read_as_vec();
    let len = input.len();
    let mut count = 0;

    for i in 0..len{
        if input[i]=='1'{
            count += 1;
        }
    }
    println!("{}",count);
}



Measured memory_bytes: 4352
n, k, l = map(int, raw_input().split())

def root(x):
    #if x != parent[x]: x = parent[x] = root(parent[x])
    if x != parent[x]: parent[x] = x = root(parent[x])
    return x
def unite(x, y):
    px = root(x)
    py = root(y)
    if px < py:
        parent[py] = px
    else:
        parent[px] = py

parent = range(n)
for i in xrange(k):
    p, q = map(int, raw_input().split())
    unite(p-1, q-1)
parent1 = parent
for i in xrange(n):root(i)

parent = range(n)
for i in xrange(l):
    r, s = map(int, raw_input().split())
    unite(r-1, s-1)
parent2 = parent
for i in xrange(n):root(i)

dic = {}
for p1, p2 in zip(parent1, parent2):
    dic[p1, p2] = dic.get((p1, p2), 0) + 1

ans = [dic[p1, p2] for p1, p2 in zip(parent1, parent2)]
print " ".join(map(str, ans))

Measured memory_bytes: 60728
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    int X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  }
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<P> a(n);
    rep(i, n){
        int A, B;
        cin >> A >> B;
        a[i].first = A; a[i].second = B;
    }

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

    int f = 0;
    ll ans = 0;
    rep(i, m){
        if(a[f].second == 0) f++;
        ans += (ll)a[f].first;
        a[f].second--;
    }

    cout << ans << endl;

    return 0;
}   

/*

2 3
1 2 3, 2 3 4

all:3*3=9
odd:2*1=2
9-2
*/

Measured memory_bytes: 4028
#include <bits/stdc++.h>
#include<vector>
#include<complex>
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define FOR(i, n, x) for(int i = x; i < n; i++)

using namespace std;



int main()
{
    fast;
    string s; cin >> s;
    set<string> ans;
    int n = s.size();
    if(n % 2)cout << "No";
    else
    {
        for(int i = 0; i < n; i += 2)
        {
            ans.insert(s.substr(i, 2));
        }
        for(auto e : ans)if(e != "hi"){cout << "No"; return 0;}
        cout << "Yes";
    }
    //for(auto e : ans)cout << e << ' ';

    return 0;
}



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

using namespace std;

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

int main()
{
	int mod = 1000000007;
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	for (int i = 0; i < m; i++)
	{
		cin >> a[i];
	}

	vector<int> dp(n + 1, 1);
	for (int i = 0; i < m; i++)
	{
		dp[a[i]] = 0;
	}

	for (int i = 2; i <= n; i++)
	{
		
		if (dp[i] != 0)
		{
			dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
		}
	}

	cout << dp[n] << endl;
}

Measured memory_bytes: 1024