akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
typedef long long ll;
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}


int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    char retu[10];
    int cnt=0;
    scanf("%s",retu);
    for(int i=0;i<strlen(retu);i++){
        if(i==0 && retu[i]!='A'){
            printf("WA");
            return 0;
        }else if(i>=2 && i<strlen(retu)-1 && retu[i]=='C'){
            cnt++;
        }else if(i!=0 && retu[i]<'a'){
            printf("WA");
            return 0;
        }
    }
    if(cnt==1){
        printf("AC");
        return 0;
    }else{
        printf("WA");
        return 0;
    }
    
}


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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    ll n; cin >> n;

    string in;
    map<string, ll> mp;

    rep(i, n){
        cin >> in;
        mp[in] = 1;
    }

    cout << mp.size() << endl;

    return 0;
}

Measured memory_bytes: 19152
function main(_stdin) {
    const stdin = _stdin.replace('\n', '').split(' ');
    console.log(compute(stdin));
}

function compute(chars) {
    const stack = [];
    for(const c of chars) {
        if(/\d+/.test(c)) {
            stack.push(c);
        } else {
            const rightOp = stack.pop();
            const leftOp = stack.pop();
            let a = `${leftOp}${c}${rightOp}`;
            a = a.replace('--', '+');
            stack.push(eval(a));
        }
    }
    return stack[0];
}


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



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

#define N 10000

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  char h[ N + 1 ];

  while ( scanf ( "%s", h ) == 1 )
  {
    int     res;
    char  * p;

    for ( p = strstr ( h, "JOI" ), res = 0
        ; p != NULL
        ; p = strstr ( p + 1, "JOI" ) ) ++res;
    printf ( "%d\n", res );

    for ( p = strstr ( h, "IOI" ), res = 0
        ; p != NULL
        ; p = strstr ( p + 1, "IOI" ) ) ++res;
    printf ( "%d\n", res );
  }

  return ( 0 );
}

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

namespace procon
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();


            Console.WriteLine("{0} {1}", inputs[0] * inputs[1], inputs.Sum() * 2);
            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 9620
#include <cstdio>
#include <cstring>
#include <algorithm>
#define R register
using namespace std;
const int mod=1000000007;
const int MAXN=3100;
int pre[MAXN];
int dp[MAXN][MAXN],r[MAXN];
char s[MAXN];

void reads(char* st)
{
	int len=0;char ch=getchar();
	while(ch<'0'||ch>'1')ch=getchar();
	while(ch>='0'&&ch<='1')st[++len]=ch,ch=getchar();
}

void add(int &x,int y)
{x=(x+y)%mod;}

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	reads(s);
	for(int i=1;i<=n;++i)
	  if(s[i]=='1')pre[i]=pre[i-1]+1;
	  else pre[i]=pre[i-1];
	pre[n+1]=pre[n];
	int t1,t2;
	for(R int i=1;i<=n+1;++i)r[i]=i;
	for(R int i=1;i<=m;++i)
	{
		scanf("%d%d",&t1,&t2);
		if(t2>r[t1])r[t1]=t2;
	}
	for(R int i=1;i<=n+1;++i)
	  if(r[i-1]>r[i])r[i]=r[i-1];
	dp[1][pre[r[1]]]=1;
	for(R int i=1;i<=n;++i)
	  for(R int j=0;j<=n;++j)
	    if(dp[i][j])
	    {
	    	if(r[i]-i-j+1)add(dp[i+1][j+pre[r[i+1]]-pre[r[i]]],dp[i][j]);
	    	if(j)add(dp[i+1][j-1+pre[r[i+1]]-pre[r[i]]],dp[i][j]);
	    }
	printf("%d\n",dp[n+1][0]);
	return 0;
}

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

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    int n, mi, sum, s[110];
    cin >> n;

    mi = 1000;
    sum = 0;
    REP(i, n)
    {
        cin >> s[i];
        sum += s[i];

        if (s[i] % 10 != 0)
            mi = min(s[i], mi);
    }

    int ans;
    if (mi == 1000)
        ans = 0;
    else if (sum % 10 != 0)
        ans = sum;
    else
        ans = sum - mi;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<queue>
#include<string>
using namespace std;
int main(){
	string a,b;
	cin>>a;cin>>b;
	int ans=0;
	for(int i=0;i<a.size();i++){
		if(a[i]==b[i]){ans++;}
	}
	cout<<ans;return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <cstdlib>

using namespace std;

int main(int argc, const char * argv[]) {
	char A[4], B[4];

	cin >> A;

	if(strcmp(A, "Sunny") == 0){ cout << "Cloudy" << endl;};
	if(strcmp(A, "Cloudy") == 0){ cout << "Rainy" << endl;};
	if(strcmp(A, "Rainy") == 0){ cout << "Sunny" << endl;};

	return 0;
}


Measured memory_bytes: 760
#include <iostream>

using namespace std;

int te[200000],vi[200000],po[200000];
long long k;

int vis(int ac, int c){
	vi[ac]=c;
	po[c] = ac;
	if(c==k+1)return ac+1;
	if(vi[te[ac]]){
		k-=(vi[te[ac]]-1);
		k%=(c-vi[te[ac]]+1);
		return po[vi[te[ac]]+k]+1;
	}
	return vis(te[ac],c+1);
}
int main(){
	
	cin.tie(0); ios_base::sync_with_stdio(0);
	int n;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		a--;
		te[i] = a;
	}
	cout<<vis(0,1)<<endl;
	
	return 0;
}

Measured memory_bytes: 5348
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N; long K;
    scan(N, K);
    auto a = readln.split.to!(long[]);

    long[] pos, neg;
    long zero;

    foreach (ai ; a) {
        if (ai > 0) {
            pos ~= ai;
        }
        else if (ai < 0) {
            neg ~= ai;
        }
        else {
            zero++;
        }
    }

    pos.sort();
    neg.sort!"a > b"();

    int Ps = pos.length.to!int;
    int Ng = neg.length.to!int;

    bool check(long x) {
        long cnt;

        if (x >= 0) {
            cnt += zero * (zero - 1) / 2;
            cnt += zero * (N - zero);
            cnt += 1L * Ps * Ng;

            int r = Ps - 1;
            foreach (i ; 0 .. Ps) {
                while (r >= 0 && pos[r] * pos[i] > x) r--;
                cnt += max(r - i, 0);
            }

            r = Ng - 1;
            foreach (i ; 0 .. Ng) {
                while (r >= 0 && neg[r] * neg[i] > x) r--;
                cnt += max(r - i, 0);
            }
        }
        else {
            int r = Ng - 1;
            foreach (i ; 0 .. Ps) {
                while (r >= 0 && pos[i] * neg[r] <= x) r--;
                cnt += Ng - 1 - r;
            }
        }

        debug {
            writefln("x :%s, cnt: %s", x, cnt);
        }

        return cnt >= K;
    }

    long ng = -infl, ok = infl;
    while (abs(ok - ng) > 1) {
        auto mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }

    writeln(ok);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 11736
from itertools import product
def main():
    a, b, c, d, e, f = list(map(int, input().split()))
    max_con = -1
    ans_w, ans_s = 0, 0
    W, S = [], []
    a *= 100
    b *= 100
    for i, j in product(range(f // a + 1), range(f // b + 1)):
        if (w := a * i + b * j) <= f:
            W.append(w)
    for i, j in product(range(f // c + 1), range(f // d + 1)):
        if (s := c * i + d * j) <= f:
            S.append(s)
    for w, s in product(W, S):
        if w == s == 0:
            continue
        if w * e >= 100 * s and (con := 100 * s / (w + s)) > max_con and w + s <= f:
            max_con = con
            ans_w, ans_s = w, s

    print(' '.join([str(ans_w + ans_s), str(ans_s)]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 20304
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  Vec(P,lli,N,0);
  rep(i,0,N)cin >> P[i];
  num++;
  rep(i,0,N){
    if(P[i]!=num)sum++;
    else num++;
  }
  if(sum==N)sum=-1;
  Out(sum);
}


Measured memory_bytes: 1792
#if 0

#endif
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <assert.h>
#include <complex>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
ll dp[101][10001];
ll vw[2][100];
ll N, W, v, w;
void dump_dp(ll dp[101][10001]) {
    for (int i = 0; i < 10001; ++i) {
        for (int j = 0; j < 101; ++j) {
            cout << dp[j][i] << " ";
        }
        cout << endl;
    }
}
void solve() {
    for (ll n = 0; n < N + 1; ++n) {
        for (ll c = 0; c < W + 1; ++c) {
            if (n == 0 || c == 0) {
                continue;
            } else if (vw[1][n - 1] > c) {
                dp[n][c] = dp[n - 1][c];
            } else {
                dp[n][c] = max(dp[n - 1][c], dp[n - 1][c - vw[1][n - 1]] + vw[0][n - 1]);
            }
        }
    }
    cout << dp[N][W] << endl;
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> W;
    for (int n = 0; n < N; ++n) {
        cin >> v >> w;
        vw[0][n] = v;
        vw[1][n] = w;
    }

    // dump_dp(dp);
    solve();

    return 0;
}


Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std; 
int n;
int main() { 
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	long long ans=0;
	for(int i=1;i<=n;i++){
		if(i%3!=0 && i%5!=0)ans+=i;
	}
	cout<<ans<<endl;
    return 0; 
}/*
*/

Measured memory_bytes: 3632
function main(input) {
  var lines = input.split("\n");
  var N = Number(lines[0]);
  var bcnt = lines[1].replace(/R/g,"").length;
  var rcnt = lines[1].replace(/B/g,"").length;
  console.log(rcnt>bcnt?"Yes":"No");


}

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


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

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

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

struct mint {
    // Preparation: MOD is already defined.
    ll value;

    mint(ll value = 0) : value((value % MOD + MOD) % MOD) {}

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint pow(mint m) const {
        return pow(m.value);
    }

    mint inv() const {
        ll a = value, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        return u;
    }

    mint &operator+=(const mint a) {
        if ((value += a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((value += MOD - a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (value *= a.value) %= MOD;
        return *this;
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    int n;
    cin >> n;
    vl l(n);
    rep(i, n) cin >> l[i];
    int m = *max_element(all(l));
    int acc = accumulate(all(l), 0);
    if (2 * m < acc)
        CYES;
    else
        CNO;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
char s[102],t[102];

int main()
{
    int n,i,j,l,ok;
    cin.getline(s,101);
    cin.getline(t,101);
    n=strlen(s);
    for(i=0;i<n;i++)
    {
        ok=1;
        for(j=0;j<n;j++)
        {
            l=j+i;
            if(l>=n)
                l-=n;
            if(s[l]!=t[j])
            {
                ok=0;
                break;
            }
        }
        if(ok==1)
        {
            break;
        }
    }
    if(ok==1)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
mycode = r'''
# distutils: language=c++
# cython: language_level=3
# cython: boundscheck=False
# cython: wraparound=False
# cython: infer_types=True
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。



# define 
ctypedef long long LL

# 読み込みはpython側で行う
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline #文字列読み込む時はこっち

cdef LL a_int(): return int(readline())

cdef LL i,j,k,_


cdef LL A=a_int()
cdef LL B=a_int()
cdef LL C=a_int()
cdef LL X=a_int()

# 愚直にシミュレーション
cdef LL a,b,c,ans
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            ans += (500*a + 100*b + 50*c == X)
print(ans)

'''

import sys
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    import os
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode


Measured memory_bytes: 9108
#include <stdio.h>

int f(int n) {
	int sum;

	sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

int main() {
	int n, a, b, x, sum;

	scanf("%d%d%d", &n, &a, &b);
	sum = 0;
	for (x = 1; x <= n; x++)
		if (f(x) >= a && f(x) <= b)
			sum += x;
	printf("%d\n", sum);
	return 0;
}


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

int main(){
  int N;
  cin>>N;
  vector<long long> A(N+1),B(N);
  for(int i=0;i<N+1;i++){
    cin>>A.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>B.at(i);
  }

  long long ans=0;
  for(int i=0;i<N;i++){
    if(A.at(i)>B.at(i)){
      A.at(i)-=B.at(i);
      ans+=B.at(i);
    }else{
      ans+=A.at(i);
      B.at(i)-=A.at(i);
      if(A.at(i+1)>B.at(i)){
        A.at(i+1)-=B.at(i);
        ans+=B.at(i);
      }else{
        ans+=A.at(i+1);
        A.at(i+1)=0;
      }
    }
  }
  cout<<ans<<endl;
}


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

// Inserted snippets: euclid, io, modint, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
ll euclid(ll a, ll b, ll &x, ll &y) {
	if (b) { ll d = euclid(b, a % b, y, x);
		return y -= a/b * x, d; }
	return x = 1, y = 0, a;
}
template<int MOD>
struct Mod {
	ll x;
	Mod() : x(0) {}
	Mod(ll xx) : x(xx) {}
	Mod operator+(Mod b) { return Mod((x + b.x) % MOD); }
	Mod operator-(Mod b) { return Mod((x - b.x + MOD) % MOD); }
	Mod operator*(Mod b) { return Mod((x * b.x) % MOD); }
	Mod operator/(Mod b) { return *this * invert(b); }
	Mod invert(Mod a) {
		ll x, y, g = euclid(a.x, MOD, x, y);
		assert(g == 1); return Mod((x + MOD) % MOD);
	}
	Mod operator^(ll e) {
		if (!e) return Mod(1);
		Mod r = *this ^ (e / 2); r = r * r;
		return e&1 ? *this * r : r;
	}
};
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	Mod<10001> a, b;
	read(a.x, b.x);
	die((a*b).x);
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){  
  int n;
  cin >> n;
  vector<int> a(n);
  map<int,int> mp;
  int sp=0;
  rep(i,n){ 
    cin >> a[i]; 
    if(a[i]<400){ mp[0]++; continue; }
    if(a[i]<800){ mp[1]++; continue; }
    if(a[i]<1200){ mp[2]++; continue; }
    if(a[i]<1600){ mp[3]++; continue; }
    if(a[i]<2000){ mp[4]++; continue; }
    if(a[i]<2400){ mp[5]++; continue; }
    if(a[i]<2800){ mp[6]++; continue; }
    if(a[i]<3200){ mp[7]++; continue; }
    sp++;
  }
  
  cout << max((int)mp.size(),1) << " " << (int)mp.size()+sp << endl;
  return 0;
}

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

namespace ABC127
{
    class A
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int A = a[0], B = a[1];
            int r = 0;
            if (A <= 5) r = 0;
            else if (A <= 12) r = B / 2;
            else r = B;
            Console.WriteLine(r);

        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int a, b, c, d, e, f;
	double max = -1;
	int max_sum = 0, max_sum_b = 0;

	cin >> a >> b >> c >> d >> e >> f;

	for (int i = 0; i*a * 100 < f; i++) {
		for (int j = 0; j*b * 100 <= f - i*a * 100; j++) {
			double sum_a = i*a * 100 + j*b * 100;
			for (int k = 0; k*c < f - sum_a; k++) {
				for (int l = 0; l*d <= f - sum_a - k*c; l++) {
					double sum_b = k*c + l*d;
					if (sum_a == 0)
						continue;
					if (e < 100 * sum_b / sum_a)
						break;
					else {
						double sum_r;
						if (sum_b!=0)
							sum_r = 100 * sum_b / (sum_a + sum_b);
						else 
							sum_r = 0;
						if (max < sum_r) {
							max = sum_r;
							max_sum = sum_a + sum_b;
							max_sum_b = sum_b;
						}
							
					}
				}
			}

		}
	}

	cout << max_sum << " " << max_sum_b << endl;

    return 0;
}


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

using str = string;
using ss = stringstream;

int a[26];
int b[26];

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

    int n;cin>>n;
    str s;cin>>s;

    for(int i=0;i<n;i++)a[s[i]-'a']++;

    int ans=0;

    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<26;j++)b[j]=0;

        for(int j=0;j<i;j++)b[s[j]-'a']++;

        int num=0;

        for(int j=0;j<26;j++)num+=(b[j]>0&&a[j]-b[j]>0?1:0);

        ans=max(ans,num);
    }
    
    cout<<ans<<"\n";

    return 0;
}


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

#define int long long
#define pb push_back
#define ff first
#define ss second
const int mod=(int)(1e9+7);
int solve(int *A,int n,int k)
{
    int product = 1; 
    if (A[n - 1] == 0 && (k & 1)) 
        return 0; 
  
    if (A[n - 1] <= 0 && (k & 1)) { 
        for (int i = n - 1; i >= n - k; i--) 
            product=(product%mod*A[i]%mod+mod)%mod; 
        return product%mod; 
    } 
     int i = 0; 
  
    int j = n - 1; 
  if (k & 1) { 
        product=(product%mod*A[j]%mod)%mod;
        product=product%mod;
        j--; 
        k--; 
    } 
  
    k >>= 1; 
    for (int itr = 0; itr < k; itr++) { 
        int left_product = (A[i]%mod * A[i + 1]%mod)%mod; 
        int right_product = (A[j]%mod * A[j - 1]%mod)%mod; 
        if (left_product > right_product) { 
            product = (product%mod*left_product%mod)%mod; 
                    product=product%mod;

            i += 2; 
        } 
        else { 
            product =(product%mod* right_product%mod)%mod;
                    product=product%mod;

             j -= 2; 
        } 
    }
    return product%mod;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n;
    cin>>n;
    
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n,greater<int>());
    
    int sum=a[0];
    int temp=1;
    
    if(n==2)
    {
        cout<<sum;
        return 0;}
    for(int i=1;i<n;i++)
    {
        temp++;
        sum=sum+a[i];
        if(temp==n-1)
            break;
        temp++;
        sum=sum+a[i];
         if(temp==n-1)
            break;
       
    }
    cout<<sum;
}

Measured memory_bytes: 5216
#include<cstdio>
#include<iostream>
#include<stack>
#include<string>

#define loop(lp) for(int i = 0;i < lp;i++)

using namespace std;       
int main(){
  string s;
  stack<char> a;
  int i=0,j=0;
  while(getline(cin,s)){
    if(s == ".")
      break;
    while(s[i] != '.'){
      
      if(s[i] == '('){
	a.push('(');  
      }else if(s[i] == ')'){
	if(a.size() == 0){
	  j = 1;
	  break;
	}
	if(a.top() == '('){
	  a.pop();  
	}else{
	  j = 1;
	  break;
	}
      }else if(s[i] == '[' ){
	a.push('[');  
      }else if(s[i] == ']'){
	if(a.size() == 0){
	  j = 1;
	  break;
	}
	if(a.top() == '['){
	  a.pop();  
	}else{
	  j = 1;
	  break;
	}
      }
      i++;
    }
    if(a.size() == 0 && j != 1){
	cout <<"yes"<<endl;
      }else{
	cout <<"no"<<endl;   
      }
    i = 0;
    while(a.size() != 0){
      a.pop();
    }
    j = 0;
  }
    
    
    return 0;
}

Measured memory_bytes: 1176
/*
  donttttttt use vector 
  run n = 1 and n = MAXN before submit
  try to AC within one submission
*/
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
     
typedef long long lo;
 
template<typename tp> inline void read(tp &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if (f) x = -x;
}

const lo mo = 1e9 + 7;
char str[333333]; int n;

int main(void) {
	scanf("%s", str + 1);
	n = strlen(str + 1);
	lo dpNULL, dp0, dp1, dp11, dp10, dp01, dp00, dp100;
	dpNULL = 1; dp0 = dp1 = dp11 = dp10 = dp01 = dp00 = dp100 = 0;
	
	rep (i, n) {
		lo nNULL, n0, n1, n11, n10, n01, n00, n100;
		nNULL = n0 = n1 = n11 = n10 = n01 = n00 = n100 = 0;
		
		if (str[i] != '1') {
			n0 += dpNULL;
			n0 += dp01;
			n0 += dp00;
			n00 += dp0;
			n10 += dp1;
			n11 += dp11;
			n100 += dp10;
			n10 += dp100;
		}

		if (str[i] != '0') {
			n1 += dpNULL;
			n1 += dp01;
			n1 += dp10;
			n11 += dp1;
			n11 += dp11;
			n10 += dp100;
			n01 += dp0;
			n0 += dp00;
		}			

		dpNULL = nNULL % mo;
		dp0 = n0 % mo;
		dp1 = n1 % mo;
		dp11 = n11 % mo;
		dp10 = n10 % mo;
		dp01 = n01 % mo;
		dp00 = n00 % mo;
		dp100 = n100 % mo;

		// printf("%lld %lld %lld %lld %lld %lld %lld %lld\n", dpNULL, dp0, dp1, dp11, dp10, dp01, dp00, dp100);
	}
	cout << (dp1 + dp11 + dp10) % mo << "\n";
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<set>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> P(N + 1, -1);
    rep(i, 0, N) {
        cin >> P[i + 1];
    }
    vector<int> cumsum(N + 1, 0);
    rep(i, 0, N) {
        cumsum[i + 1] = cumsum[i] + (P[i + 1] > P[i]);
    }
    set<int> S;
    rep(i, 1, K + 1) {
        S.insert(P[i]);
    }
    int ans = 1;
    bool not_found = cumsum[K] - cumsum[1] < K - 1;
    rep(i, K + 1, N + 1) {
        S.insert(P[i]);
        int min_p = *S.begin();
        int max_p = *S.rbegin();
        int inc_cnt = cumsum[i] - cumsum[i - K + 1];
        if (inc_cnt < K - 1 && (min_p != P[i - K] || max_p != P[i])) {
            ++ans;
        }
        if (inc_cnt == K - 1 && not_found) {
            ++ans;
            not_found = false;
        }
        S.erase(P[i - K]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pb push_back
#define vl vector<ll>
#define vs vector<string>
#define MP make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define vii vector<pii>
#define F first
#define S second
using namespace std;
signed main()
{
	std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll a,b;
	cin>>a>>b;
	cout<<a/b+(a%b!=0);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		long max = -1000000;
		long min = 1000000;
		long sum = 0;
		for (int i = 0; i < n; i++)
			sum += a[i];
		for (int i = 0; i < n; i++) {
			if (a[i] > max) {
				max = a[i];
			}
			if (min > a[i]) {
				min = a[i];
			}
		}
		System.out.println(min + " " + max + " " + sum);
	}
}


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

void solve(vector<vector<pair<int,int>>>& graph,vector<int>& color,int from, int now){
	pair<int,int> edge;
	for (int i = 0; i < graph[now].size(); i++) {
		edge=graph[now][i];
		if (edge.first==from) {
			continue;
		}
		if (edge.second%2==0) {
			color[edge.first]=color[now];
		}else {
			color[edge.first]=(color[now]+1)%2;
		}
		solve(graph,color,now,edge.first);
	}
}

int main(){
	int n;
	cin>>n;
	vector<vector<pair<int,int>>> graph(n);
	int tu,tv,tw;
	for (int i = 0; i < n-1; i++) {
		cin>>tu>>tv>>tw;
		graph[tu-1].push_back(make_pair(tv-1,tw));
		graph[tv-1].push_back(make_pair(tu-1,tw));
	}
	vector<int> color(n,-1);
	color[0]=0;
	solve(graph,color,-1,0);
	for (int i = 0; i < n; i++) {
		cout<<color[i]<<endl;
	}
}

Measured memory_bytes: 9728
d, n = (int(i) for i in input().split())

if d == 0 and n != 100:
    print(n)
elif d == 0 and n == 100:
    print(101)
elif d == 1 and n != 100:
    print(100*n)
elif d == 1 and n == 100:
    print(10100)
elif d == 2 and n != 100:
    print(10000*n)
else:
    print(1010000)


Measured memory_bytes: 2940
#include<cstdio>
#include<queue>
#include<utility>

using namespace std;

typedef pair<int, int> P;

const int MAX_N = 400;

const int di[] = {1, 0, -1, 0};
const int dj[] = {0, 1, 0, -1};

bool color[MAX_N][MAX_N];
int H, W;

char ch[MAX_N + 1];

void input(){
	scanf("%d%d", &H, &W);
	for(int i = 0; i < H; ++i){
		scanf("%s", ch);
		for(int j = 0; j < W; ++j){
			color[i][j] = (ch[j] == '#');
		}
	}
}

bool isin_(int i, int j){
	return i >= 0 && i < H && j >= 0 && j < W;
}

bool check_(int i, int j, int d){
	int ni = i + di[d];
	int nj = j + dj[d];
	if(!isin_(ni, nj)) return false;
	if(color[i][j] == color[ni][nj]) return false;
	return true;
}

bool used[MAX_N][MAX_N];

long long solve(){
	long long ans = 0;
	long long b = 0, w = 0;
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			if(used[i][j]) continue;
			b = 0;
			w = 0;
			queue<P> que;
			used[i][j] = true;
			que.push(P(i, j));
			while(!que.empty()){
				P p = que.front();
				que.pop();
				int ci = p.first, cj = p.second;
				if(color[ci][cj]) b++;
				else w++;
				for(int d = 0; d < 4; ++d){
					if(!check_(ci, cj, d)) continue;
					int ni = ci + di[d], nj = cj + dj[d];
					if(used[ni][nj]) continue;
					used[ni][nj] = true;
					que.push(P(ni, nj));
				}
			}
			ans += b * w;
		}
	}
	return ans;
}

int main(){
	input();
	long long ans = solve();
	printf("%lld\n", ans);
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    if(s.size() == 2){
        cout << s << endl;
    }
    else{
        reverse(s.begin() , s.end());
        cout << s << endl;
    }
}

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

int main(){
	int n;
	scanf("%d", &n);
	long ans = 0;
	long count = 0;
	for(int i=0; i <= n; i++) {
		if(!(i % 3) || !(i % 5))
			continue;
		ans += i;
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 3868
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
 
using namespace std;
typedef long long ll;


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};

int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	
	int rMax = min(k, n-1);
	mint ans = 0;
	
	mint c1 = 1;
	mint c2 = 1;
	for(int r = 0; r <= rMax; r++){
		if(r != 0){
			/*
			for (int i = n-1; i >= (n-1)-(r-1-r)+1; i--){
				c1 *= i;
			}
			for (int i = 1; i <= n-1-r; i++){
				c1 /= i;
			}
			*/
			c1 = c1 * (n-r) / (r);
		}
		
		if(r != 0){
			/*
			for(int i = n; i >= n-(n-r)+1; i--){
				c2 *= i;
			}			for(int i = 1; i <= n-r; i++){
				c2 /= i;
			}
			*/
			c2 = c2 * (n-r+1) / (r);
		}
		
		// printf("%d  %d :: %lld %lld\n",n,r, c1.x, c2.x);
		ans += c1 * c2;
	}
	
	printf("%lld\n", ans.x);
	
	return 0;
}

Measured memory_bytes: 128
cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
    
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
    
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))

Measured memory_bytes: 7700
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	vector<ll> p;
	vector<ll> m;
	for (auto i = 0; i < N; ++i)
	{
		ll A;
		cin >> A;
		if (A > 0)
		{
			p.push_back(A);
		}
		else
		{
			m.push_back(A);
		}
	}
	sort(p.begin(), p.end(), greater<ll>());
	sort(m.begin(), m.end(), greater<ll>());

	auto ans = 0ll;
	vector<pair<ll, ll>> list;
	if (p.size() > 0)
	{
		if (m.size() > 0)
		{
			auto prev = m[0];
			for (auto i = 1; i < (int)p.size(); ++i)
			{
				list.push_back({ prev, p[i] });
				prev -= p[i];
			}

			list.push_back({ p[0], prev });
			prev = p[0] - prev;

			for (auto i = 1; i < (int)m.size(); ++i)
			{
				list.push_back({ prev, m[i] });
				prev -= m[i];
			}
			ans = prev;
		}
		else
		{
			auto prev = p[(int)p.size() - 1];
			for (auto i = (int)p.size() - 2; i > 0; --i)
			{
				list.push_back({ prev, p[i] });
				prev -= p[i];
			}
			list.push_back({ p[0], prev });
			ans = p[0] - prev;
		}
	}
	else
	{
		auto prev = m[0];
		for (auto i = 0; i < (int)m.size() - 1; ++i)
		{
			list.push_back({ prev, m[i + 1] });
			prev -= m[i + 1];
		}
		ans = prev;
	}

	cout << ans << endl;
	for (auto i = 0; i < (int)list.size(); ++i)
	{
		cout << list[i].first << " " << list[i].second << endl;
	}

	return 0;
}

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

public class Main {


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

        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        String line = stdin.readLine();
        String[] temp = line.split(" ");
        int number = Integer.parseInt(temp[0]);
        int distance = Integer.parseInt(temp[1]);

        int count = 0;
        for(int i = 0 ; i < number; i++){
            line = stdin.readLine();
            temp = line.split(" ");
            double x = Double.parseDouble(temp[0]);
            double y = Double.parseDouble(temp[1]);
            double d =   Math.sqrt(x*x + y*y);
            if(d<=distance)
                count++;
        }

        System.out.println(count);
    }

} 


Measured memory_bytes: 56928
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main(){
	var sc = bufio.NewScanner(os.Stdin)
	var s string
	if sc.Scan() {
		s = sc.Text()
	}
	// ここからロジック
	n, _ := strconv.ParseInt(s, 10, 64)
	ans := 3 * n * n
	fmt.Println(ans)
}

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

int main() {
    int a,b;
    cin >> a >> b;
    if(a >= 13){
        std::cout << b << std::endl;
    }else if(6 <= a && 12 >= a){
        std::cout << b / 2 << std::endl;
    }else{
        std::cout << 0 << std::endl;
    }
}

Measured memory_bytes: 384
/*
    Sk arman Hossain
    University of Barisal

    Problem name :
    Algorithm :
 */

#include<bits/stdc++.h>
#define nl printf("\n");
#define N 200001
#define PR pair<int,int>
#define sf(n) scanf("%d", &n)
#define sff(n, m) scanf("%d %d",&n,&m)
#define sfl(n) scanf("%lld", &n)
#define sfu(n) scanf("%llu", &n)
#define sffl(n, m) scanf("%lld %lld",&n,&m)
#define pfn(n) printf("%d\n",n)
#define pf(n) printf("%d ",n)
#define pfl(n) printf("%lld ",n)
#define pfln(n) printf("%lld\n",n)
#define pfu(n) printf("%llu\n",n)
#define pfs(s) printf("%s",s)
#define YES printf("YES\n")
#define NO printf("NO\n")
#define PB push_back
#define PI 3.1415926536
#define VST(v) sort(v.begin(),v.end())
#define fori(i,n) for(;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define MP make_pair
#define first ff
#define second ss
int dx[]= {0,0,1,-1};
int dy[]= {1,-1,0,0};
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
vector<int>V,V2,V3;
void CLEAR()
{
    V.clear();
    V2.clear();
    V3.clear();
}
int main()
{
    ///freopen("1input.txt","r",stdin);
    int tcase=1;
    //sf(tcase);
    for(int test=1; test<=tcase; test++)
    {
        int n,ans=0;
        sf(n);
        for(int i=0; i<n; i++)
        {
            int a;;
            sf(a);
            V.PB(a);
        }
        for(int i=0; i<n; i++)
        {
            int a;
            sf(a);
            V2.PB(a);
        }
        for(int i=1; i<n; i++)
        {
            int a;
            sf(a);
            V3.PB(a);
        }
        ans+=V2[V[0]-1];
       // printf("%d \n",V2[V[0]-1]);
        for(int i=1; i<n; i++)
        {
            ans+=V2[V[i]-1];
            //printf("%d i\n",V2[V[i]-1]);
            if(V[i]==V[i-1]+1){
                ans+=V3[V[i-1]-1];
            //printf("%d o\n",V3[V[i-1]-1]);
        }
    }

    printf("%d\n",ans);
}
///*****************************  ALHAMDULILLAH  *****************************/
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long INF=1e9+7;
int main(){
  int N,K; cin>>N>>K;
  vector<long long>A(K);
  vector<long long>count(100001);
  count[0]=1;
  count[1]=1;
  for(int i=2;i<100001;i++){count[i]=count[i-1]+count[i-2];count[i]%=INF;}
  for(int i=0;i<K;i++){
    cin>>A[i];
    if(i!=0)if(A[i]-1==A[i-1]){cout<<0<<endl; return 0;}
  }
  if(K==0){
    cout<<count[N]<<endl;
    return 0;
  }
  long long ans=1;
  for(int i=0;i<=K;i++){
    if(i==0)ans*=count[A[i]-1];
    else if(i==K)ans*=count[N-A[i-1]-1];
    else ans*=count[A[i]-A[i-1]-2];
    ans%=INF;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4628
import java.util.Scanner;

public class Main {
    static Scanner stdIn = new Scanner(System.in);
    public static void main(String[] args){
        int n = stdIn.nextInt();
        long[] a = new long[n];
        for(int i=0; i<n; i++){
            a[i] = stdIn.nextLong();
        }

        double inverseSum = 0.0;
        for(int i=0; i<n; i++){
            inverseSum += ((double)1 / a[i]);
        }

        System.out.println((double)1 / inverseSum);
       }
}

Measured memory_bytes: 35844
#include<bits/stdc++.h>
using namespace std;
int main()
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        string s;
        cin>>s;
        int c=0,ans=0;
        for(int i =0;i<3;i++)
        {
                if(s[i]=='R')
                        c++;
                else
                {
                        ans = max(ans,c);
                        c =0;
                }
        }
        ans = max(ans,c);
        cout<<ans;

return 0;
}



Measured memory_bytes: 3596
#include <iostream>
using namespace std;
int main(void){
    string s, t, k;
    cin >> s;
    int m;
    int h;
    while(s != "-"){
        cin >> m;
        for (int i = 0; i < m; i++){
            cin >> h;
            t = s.substr(h);
            k = s.erase(h);
            s = t + k;
        }
        cout << s << endl;
        cin >> s;
    }
}



Measured memory_bytes: 3172
from decimal import *

l=list(map(int, input().split(' ')))
a=l[0]
v=l[1]
l=list(map(int, input().split(' ')))
b=l[0]
w=l[1]
s=int(input())
ans=True
if a>b:
    ans=Decimal(a)-Decimal(v*s)<=Decimal(b)-Decimal(w*s)
else:
    ans=Decimal(a)+Decimal(v*s)>=Decimal(b)+Decimal(w*s)
if ans:
    print("YES")
else:
    print("NO")
    



Measured memory_bytes: 71328
#include <bits/stdc++.h>
using namespace std;
  int main () {
  int P , Q , R , X;

  cin >> P >> Q >> R;
    
  X = P + R;  
    
  if (P + Q < P + R )  {
  X = P + Q;
  }
  
  if  (Q + R < X)  {
  X = Q + R;
  }
   
  cout << X;  
  }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int val, val4[101];
	vector<int> val2;

	cin >> val;

	for (int a = 0; a < val; ++a) {
		cin >> val4[a];
	}
	val2.assign(&val4[0], &val4[val]);
	sort(val2.begin(), val2.end());
	val2.erase(unique(val2.begin(), val2.end()), val2.end());

	cout << val2.size() << 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 rep1(i, n) for(int i=1; i<=n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define rrep1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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 a, b;
    cin >> a >> b;

    for (int i = 0; i <= (10000/8); i++) {
        int x = (int)(floor(double(i) * 0.08));
        int y = (int)(floor(double(i) * 0.10));
        if (x == a && y == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <list>
#include <string>
#include <map>
#include <numeric>
#include<unordered_map>
#include<queue>
#include <set>
#include<unordered_set>
#include <bitset>
#include <cmath>
#include <functional>
using namespace std;
int main()
{
	ifstream fin("input.txt");
	long long N, ans = 0;
	cin >> N;
	long long i = 0;
	long long l, r;
	while (i < N)
	{
		cin >> l >> r;
		ans += (r - l + 1);
		i++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N,M=map(int,input().split())
C=[list(map(int,input().split())) for i in range(M)]


for i in range(1000):
    S=str(i)

    if len(S)==N:
        for s,c in C:
            s-=1
            if S[s]==str(c):
                True
            else:
                break
        else:
            print(i)
            sys.exit()

print(-1)
                


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
typedef long long ll;

struct node{
        ll a,b;
}z[MAXN];

bool cmp(node x,node y) {
        return x.a<y.a;
}

int main() {
        int n,m;
        while(cin>>n>>m) {
                for(int i=0;i<n;++i)
                        cin>>z[i].a>>z[i].b;
                sort(z,z+n,cmp);
                ll ans = 0;
                int id = 0;
                priority_queue<ll> que;
                for(int i=1;i<=m;++i) {
                        while(z[id].a<=i && id<n) {
                                que.push(z[id].b);
                                id++;
                        }
                        if(que.empty()) continue;
                        ans += que.top();
                        que.pop();
                }
                cout<<ans<<endl;
        }
        return 0;
}


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

void Main()
{
    string s;
    cin >> s;
    if(s == "AAA" || s == "BBB")
        cout << "No" << endl;
    else
        cout << "Yes" << endl;    
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>

int main(void)
{
	int n;
	std::cin >> n;
	for(int j=0; j<n; j++)
	{
		int top[2]={0,0};
		for(int i=0; ; i++)
		{
			//std::cout << top[0] << top[1] << std::endl;
			int next;
			std::cin >> next;
			if((top[0] < next)&&(top[1] < next))
			{
				if(top[0] < top[1])
					top[1]=next;
				else
					top[0]=next;
			}
			else if(top[0] < next)
				top[0]=next;
			else if(top[1] < next)
				top[1]=next;
			else
			{
				std::cout << "NO" << std::endl;
				for(int k=1; k+i < 10; k++)
					std::cin >>next;
				break;
			}

			if(i==9)
			{
				std::cout << "YES" << std::endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1156
h,w,k = map(int,input().split())
c = [0] * h
for i in range(h):
    c[i] = input()
ans = 0
for si in range(1 << h):
    for sj in range(1 << w):
        cnt = 0
        for i in range(h):
            if si >> i & 1:
                continue
            for j in range(w):
                if sj >> j & 1:
                    continue
                if c[i][j] == '#':
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Measured memory_bytes: 73900
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int n;
	int A[2][110];
	cin >> n;
	rep(i, 2) {
		REP(j, 1, n + 1) {
			cin >> A[i][j];
		}
	}

	rep(i, 2) {
		rep(j, n) {
			A[i][j + 1] += A[i][j];
		}
	}

	int ma = 0;
	REP(j, 1, n + 1) {
		int tmp = (A[0][j] - A[0][0]) + (A[1][n] - A[1][j - 1]);
		ma = max(ma, tmp);
	}

	cout << ma << endl;
	return 0;
}


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

int main(){
	int H, W;
	
	while(1){
		cin >> H >> W;
		if(H == 0 && W == 0) break;
		
		for(int i=0; i<H; i++){
		  for(int j=0; j<W; j++){
		    if((i+j)%2 == 0){
			 cout << "#";
		    }else{ 
			 cout << ".";
		    }
		  }
		  cout << "\n";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
 
int main() {
    int n, k, ans = 0;  cin >> n >> k;
    int h[n];
    for (int i = 0; i < n; i++)  cin >> h[i];
 
    for (int i = 0; i < n; i++) {
        if (h[i] >= k)  ans++;
    }
 
    cout << ans << endl;
}


Measured memory_bytes: 640