akhauriyash/Code-Regression huggingface dataset:
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . ___
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         ·ð×æ±£ÓÓ       ÓÀÎÞBUG
*/
//use readint!
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#pragma GCC optimize(5)
#pragma GCC optimize(6)
#pragma GCC optimize(7)
#pragma GCC optimize(8)
#pragma GCC optimize(9)
#include<map>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
#include<stdio.h>
#include<fstream>
#include<assert.h>
#include<time.h>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<string.h>
#define mp make_pair
#define ll long long
#define all(v) v.begin(),v.end()
#define memset(a,b) memset(a,b,sizeof(a))
using namespace std;
const int INF=1e9;
inline int pt(int a[],int l,int r){
	int p,i,j;
	p=a[l];
	i=l;
	j=r+1;
	for(;;){
		while(a[++i]<p) if(i>=r) break;
		while(a[--j]>p) if(j<=l) break;
		if(i>=j) break;
		else swap(a[i],a[j]);
	}
	if(j==l) return j;
	swap(a[l],a[j]);
	return j;
}
inline void q_sort(int a[],int l,int r){
	int q;
	if(r>l){
		q=pt(a,l,r);
		q_sort(a,l,q-1);
		q_sort(a,q+1,r);
	}
}
inline int readint(){
    int x=0;
    int f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
	if(ch=='-'){
		f=-1;
		ch=getchar();
	}
    while(ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int n;
int a[200005];
int mn[200005];
int ap[200005];
long long dp[200005];
inline void Do(){
	int i,j;
	mn[n]=a[n];
	for(i=n-1;i>-1;i--) mn[i]=min(a[i],mn[i+1]);
}
inline long long solve1(){
	long long rt=0;
	memset(ap,-1);
	int i,j;
	for(i=1;i<=n;i++){
		dp[i]=1;
		if(ap[a[i]-1]!=-1){
			dp[i]+=dp[ap[a[i]-1]];
		}
		ap[a[i]]=i;
	}
	for(i=1;i<=n;i++) rt=max(rt,dp[i]);
//	for(i=1;i<=n;i++) cout<<dp[i]<<' ';
//	cout<<endl;
	return n-rt;
}
inline long long solve2(){
	long long rt=0; 
	memset(ap,-1);
	int i,j;
	for(i=n;i>=1;i--){
		dp[i]=1;
		if(ap[a[i]-1]!=-1){
			dp[i]+=dp[ap[a[i]-1]];
		}
		ap[a[i]]=i;
	}
	for(i=1;i<=n;i++) rt=max(rt,dp[i]);
//	for(i=1;i<=n;i++) cout<<dp[i]<<' ';
//	cout<<endl;
	return n-rt;
}
int main(){
	cin>>n;
	int i,j;
	long long ans=123456789123456789;
	for(i=1;i<=n;i++) cin>>a[i];
	ans=min(ans,solve1());
//	cout<<ans<<endl;
//	ans=min(ans,solve2());
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3328
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;
    // minnanopro2019 c
    static void solve(InputReader in, PrintWriter out){
        long k = in.nl(), a = in.nl(), b = in.nl();
        long ans = 1;
        if(b-a>2){
            if(a>1){
                if(k >= a-1){
                    ans += a-1;
                    k -= a-1;
                    ans += k/2*(b-a);
                    ans += k%2;
                }else{
                    ans += k;
                }
            }else{
                ans += k/2*(b-a);
                ans += k%2;
            }
        }else{
            ans += k;
        }
        out.println(ans);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 23124
A, B = map(int, input().split())

if A == 1 and B == 1:
    print('Draw')
elif A == 1 and B != 1:
    print('Alice')
elif B == 1 and A != 1:
    print('Bob')
elif A > B:
    print('Alice')
elif B > A:
    print('Bob')
else:
    print('Draw')


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

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


int main(){
    int N,x,cnt=0;
    cin >> N;

    vector<int> a(N);
    int flg;

    rep(i,N){
        flg = (i+1)%2;
        cin >> x;
        switch (flg)
        {
        case 0:
            break;
        
        case 1:
            if(x%2!=0) cnt++;
            break;
        }
    }

    cout << cnt << endl;
}



Measured memory_bytes: 3592
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> li = new ArrayList<>();
		for (int i=0; i<N; i++) {
			li.add(Integer.parseInt(sc.next()));
		}
		Collections.sort(li);
		Collections.reverse(li);
		int Alice = 0, Bob = 0;
		for (int i=0; i<N; i++) {
			//System.out.println(li.get(i));
			if (i % 2 == 0) Alice += li.get(i);
			else Bob += li.get(i);
		} 
		System.out.println(Alice - Bob);
	}
}

Measured memory_bytes: 21844
using System;

namespace AtCoder.ABC._112
{
    class b
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var spl = line.Split(' ');
            var N = int.Parse(spl[0]);
            var T = int.Parse(spl[1]);
            var min = 10000;
            var c = 0;
            var ok = false;
            for (var i = 0; i < N; ++i)
            {
                line = Console.ReadLine().Trim();
                spl = line.Split(' ');
                c = int.Parse(spl[0]);
                var t = int.Parse(spl[1]);
                if (t <= T)
                {
                    ok = true;
                    if (c < min)
                    {
                        min = c;
                    }
                }
            }
            if (ok)
            {
                Console.WriteLine(min);
            }
            else
            {
                Console.WriteLine("TLE");
            }
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
using namespace std;
int n;
double a,sum;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lf",&a),sum+=1/a;
	printf("%.5lf",1/sum);
	return 0;
}

Measured memory_bytes: 256
# 【条件1】各ノードに記載する数字が全部正の整数
# start: v (> 0) として
# 1: s1 - v > 0            =>  s1 > v
# 2: s2 - s1 + v > 0       =>  v > s1 - s2
# 3: s3 - s2 + s1 - v > 0  =>  s1 - s2 + s3 > v
# 4: ...
# -> max{0, s1 - s2, s1 - s2 + s3 - s4, ...} < v < min{s1, s1 - s2 + s3, ...}
#    なので、max{0, 右辺 - 左辺 - 1} が答え。
# 【条件2】 loopがあったらそのloop上で s1 - s2 + s3 - s4 + ... = 0 じゃないとダメ
# あるノードまで複数の行き方で行けた場合、
# 偶奇が同じケースなら
#   s1 - s2 + s3 - ... = s'1 - s'2 + s'3 - ...
# が成り立っていれば整合性は保たれる。
# 偶奇が異なるケースなら、
# v = (奇のs + 遇のs) / 2
# の時のみ整合性が保たれる。
from collections import defaultdict, deque


def main():
    INF = 10 ** 15
    N, M = map(int, input().split())
    S = defaultdict(int)
    adj = defaultdict(list)
    for _ in range(M):
        u, v, s = map(int, input().split())
        u -= 1
        v -= 1
        adj[u].append(v)
        adj[v].append(u)
        S[(u, v)], S[(v, u)] = s, s
    even_sum_s, odd_sum_s = [- INF] * N, [INF] * N
    start = 0
    even_sum_s[start] = 0
    que = deque([(start, -1, 0, 0)])  # (node, parent, dist from start, sum of signed `s`)
    unique_n = -1
    # DFS
    while len(que) > 0:
        node, parent_node, dist, sum_s = que.pop()
        for next_node in adj[node]:
            if parent_node == next_node:
                continue
            next_dist = dist + 1
            if next_dist % 2 == 1:
                next_sum_s = sum_s + S[(node, next_node)]
                if even_sum_s[next_node] != - INF:
                    s = next_sum_s + even_sum_s[next_node]
                    if s < 2 or s % 2 != 0 or (unique_n > 0 and unique_n != s // 2):
                        print(0)
                        return
                    unique_n = s // 2
                if odd_sum_s[next_node] == INF:
                    odd_sum_s[next_node] = next_sum_s
                    que.append((next_node, node, next_dist, next_sum_s))
                else:
                    if odd_sum_s[next_node] != next_sum_s:
                        print(0)
                        return
            else:
                next_sum_s = sum_s - S[(node, next_node)]
                if odd_sum_s[next_node] != INF:
                    s = odd_sum_s[next_node] + next_sum_s
                    if s < 2 or s % 2 != 0 or (unique_n > 0 and unique_n != s // 2):
                        print(0)
                        return
                    unique_n = s // 2
                if even_sum_s[next_node] == - INF:
                    even_sum_s[next_node] = next_sum_s
                    que.append((next_node, node, next_dist, next_sum_s))
                else:
                    if even_sum_s[next_node] != next_sum_s:
                        print(0)
                        return
    lower, upper = max(even_sum_s), min(odd_sum_s)
    if unique_n > 0:
        if lower < unique_n < upper:
            print(1)
        else:
            print(0)
    else:
        print(max(0, upper - lower - 1))


if __name__ == '__main__':
    main()

Measured memory_bytes: 150160
#include <stdio.h>

long long int ans[22] ;

void init ( ) ;

int main ( )
{
	long long int s ;
	init ( ) ;
	while ( scanf ( "%lld" , &s ) == 1 ) {
		printf ( "%lld\n" , ans[s] ) ;
	}
	return 0 ;
}

void init ( )
{
	ans[0] = 0 ;
	ans[1] = 1 ;
	for ( long long int i = 2 ; i <= 20 ; i++ ) {
		ans[i] = ans[i-1] * i ;
	}
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<vector<int>> pos(3);
  for (int i = 0; i < N; i++) {
    if (S[i] == 'R') pos[0].emplace_back(i);
    if (S[i] == 'G') pos[1].emplace_back(i);
    if (S[i] == 'B') pos[2].emplace_back(i);
  }
  vector<int> idx(3);
  iota(idx.begin(), idx.end(), 0);
  int64_t res = 0;
  do {
    for (int i = 0; i < (int)pos[idx[0]].size(); i++) {
      for (int j = 0; j < (int)pos[idx[1]].size(); j++) {
        if (pos[idx[0]][i] > pos[idx[1]][j]) continue;
        int k = upper_bound(pos[idx[2]].begin(), pos[idx[2]].end(),
                            pos[idx[1]][j]) -
                pos[idx[2]].begin();
        if (k == (int)pos[idx[2]].size()) continue;
        if (binary_search(pos[idx[2]].begin(), pos[idx[2]].end(),
                          2 * pos[idx[1]][j] - pos[idx[0]][i]))
          k++;
        res += max(0, (int)pos[idx[2]].size() - k);
      }
    }
  } while (next_permutation(idx.begin(), idx.end()));

  /*   for (int i = 0; i < (int)R.size(); i++) { */
  /*     for (int j = 0; j < (int)G.size(); j++) { */
  /*       if (R[i] > G[j]) continue; */
  /*       int k = upper_bound(B.begin(), B.end(), G[j]) - B.begin(); */
  /*       cout << k << ' ' << B.size() << '\n'; */
  /*       if (k == (int)B.size()) continue; */
  /*       if (binary_search(B.begin(), B.end(), G[j] + (G[j] - R[i]))) k++; */
  /*       res += max(0, (int)B.size() - k); */
  /*     } */
  /*   } */
  cout << res << '\n';
  return 0;
}


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

int main()
{
	int A, B;
	string S,ret,haihun,Ans;
	cin >> A >> B >> S;

	for (int i = 1; i <= A + B + 1; i++)
	{
		ret = S[i-1];
		haihun = "-";
		if (ret == haihun && i == A + 1 || ret != haihun && i != A+1)
			Ans = "Yes";
		else
		{
			Ans = "No";
			break;
		}
	}
	cout << Ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int n; cin >> n;
	vector<int> a(n);
	rep(i,n)cin>>a[i];
	
	sort(ALL(a));
	int i=1;
	if(n%2==1)
	{
		a.erase(a.begin());
		n--;
		i=2;
	}

	int ans=1;
	for(int j=0;j<n;j+=2)
	{
		if(i!=a[j]||i!=a[j+1])
		{
			cout<<0<<endl;
			return 0;
		}
		i+=2;
		ans*=2;
		ans%=1000000007;
	}
	cout<<ans<<endl;

	
	return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

vector<vector<P>> v(111111);
ll ans[111111];
set<ll> s;

void dfs(int node, int color, int pre){
    int now = (color == 1 ? 2 : 1);
    REP(i, v[node].size()){
        int aite = v[node][i].FI;
        int id = v[node][i].SE;
        if(aite == pre)continue;

        ans[id] = now;
        s.insert(now);
        dfs(aite, now, node);
        now++;
        if(now == color)now++;
    }
}

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

    ll n;cin >> n;
    REP(i, n - 1){
        ll a, b;cin >> a >> b;
        a--;b--;
        v[a].EB(b, i);
        v[b].EB(a, i);
    }
    dfs(0, 0, -1);

    cout << s.size() << endl;
    REP(i, n-1)cout << ans[i] << "\n";

	return 0;
}


Measured memory_bytes: 11008
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (int)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

vector<vector<int>> edge;

//ll dfs(int now, int pa) {
	//cnt[now]++;

//}

signed main() {
	EmiliaMyWife
	
	int n;
	cin >> n;
	//edge.resize(1+n);
	//for(int i = 0, a, b; i < n-1; i++)
		//cin >> a >> b, edge[a].push_back(b), edge[b].push_back(a);
	//cout << dfs(1, 1) << '\n';
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		ans += 1LL*(n-i)*(i+1);
	}
	for(int i = 0, a, b; i < n-1; i++) {
		cin >> a >> b;
		if(a > b)
			swap(a, b);
		ans -= 1LL*a*(n-b+1);
	}
	cout << ans;

	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

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

	cout << ceil(n / (double)(d * 2 + 1)) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    vector<ll>a(n);
    ll even=0,odd=0;
    for(ll i=0;i<n;i++){
        cin >> a[i];
        if(a[i]%2==0) even++;
        else odd++;
    }
    if(odd>0)cout << "first"  << endl;
    else cout << "second" << endl;
}


Measured memory_bytes: 4024
n, m = map(int, input().split())
x = [x for x in map(int, input().split())]
y = [y for y in map(int, input().split())]
sum_x = 0
sum_y = 0
ans = 0
for i in range(n):
    sum_x += (2*i - n + 1) * x[i] 
for j in range(m):
    sum_y += (2*j - m + 1) * y[j]
ans = sum_x * sum_y
print(ans%1000000007)

Measured memory_bytes: 25396
using System;
using System.Collections.Generic;
class Solve{
    string s;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        int i;
        for(i=0;i<s.Length;i++){
            if(s[i] == 'C'){
                break;
            }
        }
        for(;i<s.Length;i++){
            if(s[i] == 'F'){
                break;
            }
        }
        if(i == s.Length){
            Console.WriteLine("No");
        }
        else{
            Console.WriteLine("Yes");
        }
    }
    void getinput(){
        s = Console.ReadLine();
    }    
}

Measured memory_bytes: 2648
#include<stdio.h>
int main(){
  char s[3][11];
  scanf("%s%*c%s%*c%s",s[0],s[1],s[2]);
  printf("%c%c%c\n",s[0][0]-32,s[1][0]-32,s[2][0]-32);
  return 0;
}


Measured memory_bytes: 1704
#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 all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int n;
   cin >> n;
   if (n % 10 == 0) {
      cout << 10 << endl;
      return 0;
   }
   int ans = 0;
   while (n) {
      ans += n % 10;
      n /= 10;
   }
   cout << ans << endl;
   return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl);
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr int MOD = 1e9+7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    int n, k;
    cin >> n >> k;
    int cnt = 0;

    rep(i, n){
        int h;
        scanf("%d", &h);
        if(h >= k) ++cnt;
    }
    ppp(cnt);



    return 0;
}


Measured memory_bytes: 256
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int main()
{
    int n, k, d, a;
    int ok[100]={ 0};
    int ans = 0;
    cin >> n >> k;


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

        for (int i = 0; i < d; i++) {
            cin >> a;
            ok[a - 1] = 1;

        }


    }

    for (int i = 0; i < n; i++) {
        if (ok[i] == 0)ans++;
    }
    cout << ans << endl;

}

Measured memory_bytes: 3156
n = int(input())
a = list(map(int,input().split()))
cnt = {}
for x in a:
    if x not in cnt:cnt[x] = 1
    else:cnt[x] +=1
ans = 0
for key in cnt:
    res = 0
    if key in cnt:res += cnt[key]
    if key-1 in cnt:res += cnt[key-1]
    if key+1 in cnt:res += cnt[key+1]
    ans = max(ans,res)
print(ans)

Measured memory_bytes: 55788
a = int(input())
b = range(1, a + 1)
res = 1
max_cnt = 0

for index, bb in enumerate(b):
  cnt = 0
  while True:
    if bb % 2 == 0:
      bb /= 2
      cnt += 1
    else:
      break
  if cnt > max_cnt:
    max_cnt = cnt
    res = index + 1
    
print(res)

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

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

  int flag=0;
  int now = 1;
  int count = 0;
  int c  = 0;
  while((flag == 0) && (c < n)){
    c++;
    if(now != 2){
      count++;
      // cout << now << endl;                                                                            
      now = a[now - 1];
    }
    else{
      flag = 1;
    }
  }

  if(flag == 0){
    cout << -1 << endl;
  }
  else{
    cout << count << endl;
  }

  return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    for(int T = 0; T < t ; T++){
        ll n, sum = 0;
        cin >> n;
        ll a[n];
        for(int i = 0; i < n; i++){  
            cin >> a[i];
        }
        sort(a, a + n);
        sum += a[n - 1];
        ll d;
        if(n%2 == 0)
            d = n/2 - 1;
        else
            d = n/2;
        ll x = 0;
        for(int i = 0; i < n/2 - 1; i++){
            sum += 2*a[n - 2 - i];
            x = i;
        }
        if(n%2 == 1)
            sum += a[n - 3 - x];
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 5200
a = list(list(map(int,input().split())) for i in range(3))
n = int(input())
b = [int(input()) for x in range(n)]
d = [[0 for i in range(3)] for j in range(3)]
ans = "No"
for x in range(n):
    for i in range(3):
        for j in range(3):
            if a[i][j] == b[x]:
                d[i][j] = 1
for i in range(3):
    c = 0
    for j in range(3):
        c+=d[i][j]
    if c == 3:
        ans = "Yes"
for i in range(3):
    c = 0
    for j in range(3):
        c+=d[j][i]
    if c == 3:
        ans = "Yes"
c = 0
for j in range(3):
    c+=d[j][j]
if c == 3:
    ans = "Yes"
c = 0
for j in range(3):
    c+=d[j][2-j]
if c == 3:
    ans = "Yes"
print(ans)

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

int main() {
	int N;
	string S, T;
	cin >> N;
	cin >> S >> T;

	for (int i = 0; i < N; i++) {
		cout << S.at(i) << T.at(i);
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
double a,b,c,d,e,f,g,h;z;main(){for(;~scanf("%*d%lf%lf%lf%lf%lf%lf%lf%lf"+z,&a,&b,&c,&d,&e,&f,&g,&h);)puts((b-d)*(e-g)-(f-h)*(a-c)?"NO":"YES"),z=3;}

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

using namespace std;

int main(int argc, char*argv[])
{
	int N, K;
	cin >> N >> K;
	vector <int> a(N);
	for (int i = 0; i < N; ++i)
		cin >> a[i];
	
	vector<bool> dp(K+1);
	// lets starts with 0-stones and iterate upto K
	for (int i = 0; i <=K; ++i)
		for (auto & j: a) // iterate over all possible moves
			if(i>=j && !dp[i - j])
				dp[i] = true; // This means Taro is winning because Taro has taken 'j' stones and also left over stone dp[i-j] is false
	
	if(dp[K])
		cout << "First";
	else
		cout << "Second";
}

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


/*
4 2
0 1 0 0
0 0 1 1
0 0 0 1
1 0 0 0
*/

vector<vector<long long> >adjmat;

vector<vector<long long> > multiply(vector<vector<long long >>a,vector<vector<long long>>b){

    int sz = a.size();
    vector<vector<long long> >res(sz,vector<long long>(sz,0));
    for(int i=0;i<sz;i++){
        for(int j=0;j<sz;j++){
            for(int k=0;k<sz;k++){
                res[i][j] += (a[i][k]*b[k][j])%mod;
                res[i][j] %=mod;
            }
        }
    }
    return res;
}

vector<vector<long long> > power(vector<vector<long long> >&adj,long long n){

    if(n==1){
        return adj;
    }
    vector<vector<long long> > res = power(adj,n/2);
    if(n&1){
        return multiply(adj,multiply(res,res));
    }else{
        return multiply(res,res);
    }
}


void solve(){
    long long n,k;cin>>n>>k;
    adjmat.resize(n,vector<long long>(n));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>adjmat[i][j];
        }
    }
    vector<vector<long long>> ansmat = power(adjmat,k);
    long long ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ans += ansmat[i][j];
            ans %= mod;
            //cout<<ansmat[i][j]<<" ";
        }
        //cout<<"\n";
    }
    cout<<ans<<"\n";
}

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

    cout.precision(10);
    int t=1;//cin>>t;
    while(t--){

        solve();
    }
    return 0;
}


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

using namespace std;
using ll = long long;

#define let auto
#define conr auto const&

int const N = 200 * 1000 + 16;
int const M = 1000 * 1000 * 1000 + 7;

int n, m;
int a[N];
ll p[N+N];
ll b[N+N];

void add(int idx, ll v) {
  for(int i = idx; i <= m+m; i |= i+1)
    b[i] += v;
}

void add(int l, int r, ll v) {
  add(l, v);
  add(r+1, -v);
}

ll query(int idx) {
  ll sum = 0;
  for(int i = idx; i >= 0; i = (i&(i+1)) - 1)
    sum += b[i];
  return sum;
}

int dist(int x, int y) {
  return x < y ? y-x : y+m-x;
}


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

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

    if(i) {
      int l = a[i-1];
      int r = a[i];
      if(r < l)
        r += m;
      int d = r-l;
      p[r] += d;
      add(l, r-1, -1);
    }
  }

  for(int i = m+m; i >= 0; --i)
    p[i] += query(i);

  for(int i = m+m-1; i >= 0; --i)
    p[i] += p[i+1];

  for(int i = 0; i < m; ++i) {
    p[i] += p[i+m];
    // cout << p[i] << " ";
  }

  int idx = max_element(p, p+m) - p;

  ll sum = 0;
  for(int i = 1; i < n; ++i) {
    int l = a[i-1];
    int r = a[i];
    int d = dist(l, r);
    if(r == idx)
      d = 1;
    else if(l != idx)
      d = min(d, 1 + dist(idx, r));
    sum += d;
  }
  cout << sum << endl;
}

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

typedef long long ll;

#define PB push_back

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	int h[n]; 
	for (int i = 0; i < n; ++i) cin >> h[i];
	string result = "Yes";
	for (int i = 1; i < n; ++i) {
		if (h[i] > h[i - 1]) h[i] -= 1;
		else if (h[i] < h[i - 1]) result = "No";
	}
	cout << result << "\n";
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* print new lines
*/


Measured memory_bytes: 640
#include<stdio.h>
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
} Tree;

Tree t[10000];

void Preorder(int i){
  printf(" %d",i);
  if(t[i].left!=NIL){
    Preorder(t[i].left);
  }
  if(t[i].right!=NIL){
    Preorder(t[i].right);
  }
}

void Inorder(int i){
  if(t[i].left!=NIL && t[i].right!=NIL){
    Inorder(t[i].left);
    printf(" %d",i);
    Inorder(t[i].right);
  }
  if(t[i].left!=NIL && t[i].right==NIL){
    Inorder(t[i].left);
    printf(" %d",i);   
  } 
  if(t[i].right!=NIL && t[i].left==NIL){ 
    printf(" %d",i);
    Inorder(t[i].right);  
  } 
  if(t[i].left==NIL && t[i].right==NIL) printf(" %d",i);
}

void Postorder(int i){
  if(t[i].left==NIL && t[i].right==NIL){
    printf(" %d",i);
  }
  else if(t[i].left!=NIL && t[i].right==NIL){
    Postorder(t[i].left);
    printf(" %d",i);
  }
  else if(t[i].right!=NIL && t[i].left==NIL){
    Postorder(t[i].right); 
    printf(" %d",i);
  } 
  else{
    Postorder(t[i].left);
    Postorder(t[i].right); 
    printf(" %d",i);
  }
}

int main(){
  int i,id,j,n,k,num,l,r;
  int depth=0,degree=0,height=0;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    t[i].parent=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&l,&r);
    t[id].left=l;
    t[id].right=r;
    if(l!=NIL && r!=NIL){
      t[l].parent=id;
      t[r].parent=id;
    }
    else if(l!=NIL && r==NIL){
      t[l].parent=id;
    }
    else if(l==NIL && r!=NIL){
      t[r].parent=id;
    }
  }
  for(j=t[0].parent;t[j].parent!=NIL;j=t[j].parent);
  printf("Preorder\n");
  Preorder(j);
  printf("\nInorder\n");
  Inorder(j);
  printf("\nPostorder\n");
  Postorder(j);
  printf("\n");

  return 0;
}



Measured memory_bytes: 2096
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
map<string, bool> memo;
bool ok(string s){
  if(s == "") return true;
  if(memo.count(s)) return memo[s];
  int i = 0, k = s.size() -1;
  if(!(s[i] == 'm' && s[k] == 'w')) return memo[s] = false;
  FOR(j, 1, s.size() - 1)if(s[j] == 'e'){
    if(ok(s.substr(i+1, j-i-1)) && ok(s.substr(j+1, k-j-1))){
      //cout<<s.substr(i+1, j-i-1) << " " << s.substr(j+1, k-j-1) << endl;
      return memo[s] = true;
    }
  }
  return memo[s] = false;
}
int main(){
  string s;
  while(cin>>s){
    if(ok(s))cout<<"Cat"<<endl;
    else cout<<"Rabbit"<<endl;
  }

  return 0;
}

Measured memory_bytes: 4628
#include <iostream>
using namespace std;
int n;
int a[200005];
int mx1,mx2;

signed main()

{
	ios::sync_with_stdio(false);
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];
		if (a[i]>mx1&&a[i]>mx2){
			mx2=mx1;
			mx1=a[i];
		}
		else if (a[i]<=mx1&&a[i]>mx2){
			mx2=a[i];
		}
	}

	for (int i=1;i<=n;i++){
		if (a[i]!=mx1) cout<<mx1<<endl;
		else cout<<mx2<<endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<string>
typedef unsigned int u;
using namespace std;
typedef string::iterator s;
u z=100000000;
void p(u*a,u*l,u n){
	if(a-l)
	p(a+1,l,(n+=*a*10)/z),
	*a=n%z;	
}
u t(u*a,u*l){
	u r=0;
	char b[11]={};
	if(a-l)
	if(!t(a+1,l)){
		if(*a)cout<<*a,r=1;
	}else
		sprintf(b,"%d",*a+z),
		cout<<b+1,
		r=1;
	return r;
}
void d(u*a,u*l,u*b,u n=0){
	if(a-l)
	d(a+1,l,b+1,(n+=(*a+*b))/z),
	*a=n%z;
}
int main(){
	u n;
	cin>>n;
	string a,b;
	getline(cin,a);
	for(;n--;){
		getline(cin,a);
		getline(cin,b);
		u x[11]={},y[11]={},c=0;
		for(s i=a.begin();i!=a.end();p(x,x+10,*i++-48))
			if(++c>80)goto g;
		c=0;
		for(s i=b.begin();i!=b.end();p(y,y+10,*i++-48))
			if(++c>80)goto g;
		d(x,x+11,y);
		if(x[10])goto g;
		else if(!t(x,x+10))cout<<'0';
		if(0)
g:
		cout<<"overflow";
		cout<<'\n';
	}
}

Measured memory_bytes: 0
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

int h;
int w;
int k;
vector<string> a;
int b[320][320];

void scan(int sy, int sx, int col) {
	int ey = -1, ex = -1;
	[&]() {
		for (int i = sy; i < h; ++i) {
			for (int j = sx; j < w; ++j) {
				if (b[i][j] > 0) {
					break;
				}
				if (a[i][j] != '.') {
					ey = i + 1;
					ex = j + 1;
					return;
				}
			}
		}
	}();
	[&]() {
		for (; ex < w; ++ex) {
			for (int i = sy; i < ey; ++i) {
				if (b[i][ex] > 0 || a[i][ex] != '.') {
					return;
				}
			}
		}
	}();
	[&]() {
		for (; ey < h; ++ey) {
			for (int j = sx; j < ex; ++j) {
				if (b[ey][j] > 0 || a[ey][j] != '.') {
					return;
				}
			}
		}
	}();
	for (int i = sy; i < ey; ++i) {
		for (int j = sx; j < ex; ++j) {
			b[i][j] = col;
		}
	}
}

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		h = -1, w = -1, k = -1;
		cin >> h >> w >> k;
		if (h <= 0) return 0;
		a.resize(h);
		for (int i = 0; i < h; ++i) {
			cin >> a[i];
		}
		memset(b, -1, sizeof(b));
		int col = 0;
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if (j) cout << " ";
				if (b[i][j] < 0) {
					scan(i, j, ++col);
				}
				cout << b[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var L = vals[0];
        var R = vals[1];
        var d = vals[2];

        var count = 0;
        for (int i = L; i <= R; i++)
        {
            if (i % d == 0)
            {
                count++;
            }
        }

        Console.WriteLine(count);
    }
}

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

int main(){

    string S;
    cin >> S;
    if (S[S.size()-1] == 's') S += "es";
    else S += 's';

    cout << S << endl;

    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

class Main{
    
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int i = 1;
        int x = 1;
        
        while(i <= 10000){
            
            x = sc.nextInt();
            
            if(x == 0){
                break;
            }
            System.out.printf("Case %d: %d\n", i, x);
            
            i++;
            
        }
    }
}


Measured memory_bytes: 64544
#include <stdio.h>
#include <queue>
using namespace std;

int N,C[200200],D[200200];
vector<int> G[200200];

int go(int p)
{
	for (int i = 1; i <= N; i++) C[i] = 0;
	queue<int> Q;
	Q.push(p); C[p] = 1; D[p] = 0;
	int r;
	while (!Q.empty()){
		int x = Q.front(); Q.pop();
		for (auto &y : G[x]) if (!C[y]){
			Q.push(y); C[y] = 1; D[y] = D[x] + 1;
		}
		r = x;
	}
	return r;
}

int main()
{
	scanf ("%d", &N);
	for (int i = 1; i < N; i++){
		int x, y; scanf ("%d %d", &x, &y);
		G[x].push_back(y);
		G[y].push_back(x);
	}

	int x = go(1);
	int y = go(x);
	int d = D[y] + 1;

	if (d == 1) puts("First");
	else if (d == 2) puts("Second");
	else puts((d - 2) % 3 ? "First" : "Second");
	return 0;
}


Measured memory_bytes: 14324
# coding: utf-8
import sys
from collections import Counter

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# １の条件を満たすものを調べたのち、２の条件のものを引く
N = ir()
S = list(sr())
counter = Counter(S)
r = counter['R']
g = counter['G']
b = counter['B']
answer = r * g * b
for i in range(N-1):
    for j in range(i+1, N):
        if j + (j - i) >= N:
            continue
        x = S[i]; y = S[j]; z = S[j+j-i]
        if x != y and y != z and z != x:
            answer -= 1

print(answer)


Measured memory_bytes: 68896
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

const int N = 50;
//const int N=2;
long long K;
long long A[50];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> K;
  rep(i, N) A[i] = N-1;
  long long avg = K/N;
  rep(i, N) {
    long long diff = avg;
    A[i] += diff;
  }
  K -= avg*N;
  if (K > 0) {
    long long e = K;
    rep(i, N) {
      if (K == 0) {
        A[i] -= e;
      }
      else {
        K--;
        A[i] += 1;
      }
    }
  }

  cout << N << "\n";
  rep(i, N) {
    cout << A[i];
    if (i != N-1) cout << " ";
    else cout<< "\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value


void solve() {
	
	string s;
	cin >> s;

	int cnt = 0;
	for (int i = 0; i < 4; i++) {
		if (s[i] == '2') cnt++;
	}

	cout << cnt << endl;

	return;

}

int main() {

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

	solve();

	return 0;

}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
typedef long long LL;
using namespace std;
#define MP make_pair
int a, b, c;
set<pair<pair<int, int>, int>> mp;
int main() {
    scanf("%d%d%d", &a, &b, &c);
    int step = 0;
    while (mp.find(MP(MP(a,b),c)) == mp.end()){
        mp.insert(MP(MP(a,b),c));
        if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1){
            printf("%d\n",step);
            return 0;
        }
        int A = (b + c) / 2;
        int B = (a + c) / 2;
        int C = (a + b) / 2;
        //cout << A <<" "<<B<<" "<<C<<endl;
        a = A;
        b = B;
        c = C;
        step++;
    }
    printf("-1\n");
    return 0;
}


Measured memory_bytes: 256
l,r=map(int,input().split())
x=l//2019
if 2019*x<l and r<2019*(x+1):
    ans=float("inf")
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans=min(ans,(i*j)%2019)
    print(ans)
else:
    print(0)

Measured memory_bytes: 9060
use proconio::input;
use proconio::marker::Chars;
use superslice::*;
 
struct Solve {
    r: Vec<isize>,
    g: Vec<isize>,
    b: Vec<isize>,
}
 
impl Solve {
    fn new() -> Self {
        input! {
            n: usize,
            s: Chars,
        }
 
        let mut r = Vec::new();
        let mut g = Vec::new();
        let mut b = Vec::new();
 
        for i in 0..n {
            match s[i] {
                'R' => r.push(i as isize),
                'G' => g.push(i as isize),
                'B' => b.push(i as isize),
                _ => unreachable!(),
            }
        }
 
        Self { r, g, b }
    }
 
    fn solve(&self) -> usize {
        let mut result = 0;
 
        for r in self.r.iter() {
            for g in self.g.iter() {
                result += self.search_b(*r, *g);
            }
        }
 
        result
    }
 
    fn search_b(&self, r: isize, g: isize) -> usize {
        let mut n = self.b.len();
        let k = r - g;
 
        let x = r + k;
        n -= self.b.upper_bound(&x) - self.b.lower_bound(&x);
 
        let x = g - k;
        n -= self.b.upper_bound(&x) - self.b.lower_bound(&x);
 
        if k % 2 == 0 {
            let x = r - k / 2;
            n -= self.b.upper_bound(&x) - self.b.lower_bound(&x);
        }
 
        n
    }
}
 
fn main() {
    println!("{}", Solve::new().solve());
}

Measured memory_bytes: 2236
import java.util.*;


public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int d = a / b;
		int x = a % b;
		double c = 0; 
		c = (double)a / b;
		System.out.println(d + " " + x + " " + String.format("%.8f", c));
    }
}


Measured memory_bytes: 26440
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.length();
	string s1 = s.substr(0, (n - 1) / 2);
	string _s = s;
	string _s1 = s1;

	reverse(_s.begin(), _s.end());
	reverse(_s1.begin(), _s1.end());

	if (s == _s && s1 == _s1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


//AAAAAAAAAAAAAAA
//int main() {
//	int n, m;
//	cin >> n >> m;
//	int ans = 0;
//	if (n >= 2)ans += n * (n - 1) / 2;
//	if (m >= 2)ans += m * (m - 1) / 2;
//	cout << ans << endl;
//
//	return 0;
//}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	cout << (n-1)*n/2-n/2<<endl;
	for(ll i=0;i<n;i++){
		for(ll j=i+1;j<n;j++){
			if(n%2==0){
				if((n-1-j)==i){
					continue;
				}
			}
			else{
				if((n-2-j)==i){
					continue;
				}
			}
			cout << i+1<<" "<<j+1<<endl;
		}
	}
	// your code goes here
	return 0;
}

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

int main(){
  int n,d,x;
  cin >> n >> d >> x;
  vector<int>a (n);
  for(int i=0;i<n;i++){
      cin >> a[i];
      
    }
  d--;
  int ans =n;
  for(int i=0;i<n;i++){
      ans += d/a[i];
  }
  cout << ans + x << endl;
}


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

const int mod = 1000000007;
const int MOD = 1000000007;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
long repeatExp(long long n, long long k) {
  long long res = 1;
  while (k > 0) {
    if (k & 1) res = res * n % MOD;
    n = n * n % MOD;
    k = k >> 1;
  }
  return res % MOD;
}
long comb(int n, int x) {
  long long xx = 1;
  long long y = 1;
  for (int i = 0; i < x; ++i) {
    xx = (xx * (n - i)) % MOD;
    y = (y * (i + 1)) % MOD;
  }
  return (xx * repeatExp(y, MOD - 2)) % MOD;
}

int main() {
  int s;
  cin >> s;
  int k = s / 3;
  int r = s % 3;
  mint res = 0;
  r += 3;
  for (int i = 0; i < k; i++) {
    res += comb(r - 3 + (k - i - 1), k - i - 1);
    r += 3;
  }
  cout << res << endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	int a,b;
	cin >> a >> b;
	if(a%3==0 || b%3==0 || (a+b)%3==0) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

L,R = map(int, input().split())

if R - L >= 2020:
  print(0)
  sys.exit()

m = 10**9

for i in range(L, R+1):
  for n in range(i+1, R+1):
    s = i * n % 2019

    if m > s:
      m = s

print(m)

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

int main(void) {
	int a[50];
	for (int i = 0; i < 50; i++) {
		while (cin >> a[i]) {
			int ans = 0;
			for (int x = 0; x < 10; x++) {
				for (int y = 0; y < 10; y++) {
					for (int z = 0; z < 10; z++) {
						for (int w = 0; w < 10; w++) {
							if (a[i] - x - y - z - w == 0) ans++;
						}
					}
				}
			}
			cout << ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3064
#include<stdio.h>
int main(void)
{
	int a,b,x,y;
	scanf("%d %d",&a,&b);
	x=a+b;
	if(x%2==0){
		y=x/2;
	}
	else{
		y=x/2;
		y++;
	}
	printf("%d\n",y);
	return 0;
}


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

#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <climits>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;



long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}


//約数をベクトル形式で返す
vector<int> vect_yakusuu(int n) {
	vector<int> ret;
	for (int i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			ret.push_back(i);
			if (i*i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return ret;
}



int main() {

	long long ans;
	int L, R, D;

	cin >> L >> R >> D;

	ans = R/D - (L - 1) / D;


	cout << ans << endl;

	cin >> ans;

	return 0;


}

Measured memory_bytes: 3628