akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
    int N,A,B,x;
    scanf("%d%d%d",&N,&A,&B);
    x=N*A;
    if(x<B)
    {
        printf("%d",x);
    }
    else
    {
        printf("%d",B);

    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
using std::cin;
using std::cout;
constexpr int mod = 1e9 + 7;
int n, a[1000010];
int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    //cout << std::setiosflags(std::ios::fixed) << std::setprecision(3);
    cin >> n;
    long long sum = 0, ans = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        ans += sum * a[i];
        ans %= mod;
        sum += a[i];
        sum %= mod;
    }
    cout << ans << '\n';
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B; cin>>A>>B;
    cout<<A*B<<endl;
    return 0;
}


Measured memory_bytes: 3632
/**************************************
*Coded By: BadduCoder (Sumit Badsara) *
***************************************/
#include<bits/stdc++.h>
using namespace std;

//All the Loops and defines required
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

//All the declarations using typedef

typedef long long int ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef map<int,int> MII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int l;

int main()
{
    _cin;
    
    string x,y;
    cin>>x>>y;
    int x_len = x.length(), y_len = y.length();
    int dp[x_len+1][y_len+1];

    memset(dp, 0, sizeof dp);

    REP(i,x_len)
    {
        REP(j,y_len)
        {
            
            if(x[i]==y[j])
                dp[i+1][j+1] = dp[i][j]+1;
            else
                dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
        }
    }
    // cout<<"+ + ";
    // REP(i, y_len)
    //     cout<<y[i]<<" ";
    // cout<<"\n";

    // REP(i,x_len+1)
    // {
    //     if(i!=0)
    //         cout<<x[i-1]<<" ";
    //     else
    //         cout<<"+ ";

    //     REP(j,y_len+1)
    //         cout<<dp[i][j]<<" ";
    //     cout<<"\n";
    // }


    string ans="";
    int i=x_len, j=y_len;
    while(i>0 && j>0)
    {
        if(dp[i][j]!=dp[i-1][j] && dp[i][j]!=dp[i][j-1])
        {
            ans += x[i-1];
            i--;
            j--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
            i--;
        else
            j--;
    }
    reverse(ans.begin(),ans.end());
    
    cout<<ans;

    return 0;
}

Measured memory_bytes: 35456
input = raw_input

N = int(input())
H = list(map(int, input().split(" ")))

b = 0
tmp = 0
h = H[0]
for i in range(N-1):
    if h >= H[i+1]:
        tmp += 1
        h = H[i+1]
        if b < tmp:
            b = tmp
    else:
        h = H[i+1]
        tmp = 0
print(b)


Measured memory_bytes: 37560
a,b=input().split()
a=int(a)
b=int(b)
red=a-b
blue=b
ans=0
cb=1
cr=1
for i in range(1,b+1):
  cr*=(red-i+2)
  cr//=i
  print((cr*cb)%1000000007)
  cb*=(blue-i)
  cb//=i


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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    a,b,c = LI()
    for i in range(1,101):
        if a*i % b == c:
            return 'YES'

    return 'NO'


print(main())


Measured memory_bytes: 6604
from typing import List


def counting_sort(target: List[int], max_val: int) -> List[int]:
    """[summary]

    Args:
        target (List[int]): ソート対象の配列
        max_val (int): ソートする要素の最大値

    Returns:
        List[int]: ソート後の配列
    """
    result = [-1 for i in range(len(target) + 1)]

    # indexがtargetに格納される値に相当するリスト
    counta = [0 for i in range(max_val + 1)]

    # counta[i]にtの出現数を記録する。
    for t in target:
        counta[t] += 1

    # counta[i]にi以下の数の出現数を記録する。
    for i in range(1, max_val + 1):
        counta[i] += counta[i - 1]

    for t in reversed(target):
        result[counta[t]] = t
        counta[t] -= 1

    return result


n = int(input())
target = [int(i) for i in input().split()]
result = counting_sort(target, max(target))

print(' '.join(map(str, result[1:])))




Measured memory_bytes: 251304
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 1010
using namespace std;

int p[MAX];

void solve(){
 int n,m,ind;
 for(;;){
  cin>>n>>m;
  if(!n) break;
  int ma=0;
  vector<int> v;
  FOR(i,n){
   cin>>p[i];
   v.pb(p[i]);
  }
  FOR(i,n){
   FORR(j,i,n){
    v.pb(p[i]+p[j]);
   }
  }
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  ind=upper_bound(v.begin(),v.end(),m)-v.begin()-1;
  if(ind>=0) ma=v[ind];
  FOR(i,v.size()){
   ind=upper_bound(v.begin(),v.end(),m-v[i])-v.begin()-1;
   if(ind>=0) ma=max(ma,v[i]+v[ind]);
  }
  cout<<ma<<endl;
 }
}

int main(){
 solve();
 return 0;
}

Measured memory_bytes: 6780
N, M = map(int, input().split())
A = list(map(int, input().split()))
honsuu = [0,2,5,5,4,5,6,3,7,6]
aval = []
for a in A:
  aval += [honsuu[a]]
aval.sort()

dp = [0]+ [-float("INF")]*N 
# i 本のマッチで作れる最高の桁数
for i in range(1,N+1):
  for b in aval:
    if i < b:
      continue
    elif dp[i-b] >= 0:
      dp[i] = dp[i-b] + 1
      break
      
#作れる桁数はdp[-1]=dp[N] で, 最高桁にi が使えるかどうかの条件は, 
#a in A かつ dp[N- honsuu[a]] = dp[N] - 1
A.sort(reverse=True)
ans = []
for i in range(dp[N],0,-1):
  for a in A:
    if N - honsuu[a] < 0:continue
    if dp[N - honsuu[a]] == dp[N] - 1:
      N -= honsuu[a]
      ans += [a]
      break
print(''.join(map(str, ans)))

Measured memory_bytes: 3700
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())
if m > n:
    print('No')
    exit(0)
for j in range(n - m + 1):
    for i in range(n - m + 1):
        flag = 1
        for k in range(m):
            if A[j + k][i: i + m] != B[k]:
                flag = 0
                break
        if flag == 1:
            print('Yes')
            exit(0)
print('No')


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define rep2r(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

using C = complex<double>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N, L; cin >> N >> L;
  constexpr double pi = acos(-1);
  vector<double> theta(N);
  rep(i, N) {
    int T; cin >> T;
    theta[i] = 2 * pi * T / L;
  }
  C ans;
  rep(i, N) rep2(j, i + 1, N) {
    ans += polar(1.0, (theta[i] + theta[j]) / 2.0 - pi) * (double)(j - i - 1);
    ans += polar(1.0, (theta[i] + theta[j]) / 2.0) * (double)(N - 2 - (j - i - 1));
  }
  ans /= N * (N - 1) * (N - 2) / 6;
  cout << real(ans) << ' ' << imag(ans) << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;
import java.io.IOException;

class Main 
{
	private static final int SIZE = 5;
	private static Scanner sc = new Scanner(System.in);
	private static int[][] field;

	public static void main(String[] args) throws IOException
	{
		int N = getNumOfMap();
		int ans;

		for(int i = 0; i < N; i++)
		{
			initArray();
			ans = search();
			System.out.println(ans);
		}
	}

	public static int getNumOfMap() throws IOException
	{
		return sc.nextInt();
	}

	public static void initArray() throws IOException
	{
		field = new int[SIZE][SIZE];

		for(int i = 0; i < SIZE; i++)
		{
			for(int j = 0; j < SIZE; j++)
			{
				field[i][j] = sc.nextInt();
			}
		}
	}

	private static void addRow()
	{
		for(int i = 1; i < SIZE; i++)
		{
			for(int j = 0; j < SIZE; j++)
			{
				if(field[i][j] != 0)
				{
					field[i][j] += field[i - 1][j];	
				}
			}
		}
	}

	private static int[] addLine(int sx, int sy)
	{
		int N;
		int[] ans, tmp;
		int[] empty = {0};

		for(N = sx; N < SIZE; N++)
		{
			if(field[sy][N] == 0)
			{
				break;
			}
		}

		if(N == sx)
		{
			return empty;
		}
		else
		{
			ans = new int[N - sx];
		}

		for(int i = 0; i < N - sx; i++)
		{
			ans[i] = myadd(sx, sy, i);
			/*
			for(int j = 0; j < tmp.length; j++)
			{
				tmp[j] = field[sy][i + j];	
			}

			ans[i] = tmp.length * mymin(tmp);
			*/
		}

		return ans;
	}

	private static int myadd(int sx, int sy, int lim)
	{
		int[] tmp = new int[lim + 1];

		for(int i = 0; i < lim + 1; i++)
		{
			if(sx + i == SIZE)
			{
				break;
			}	
			tmp[i] = field[sy][sx + i];
		}
		
		return mymin(tmp) * (lim + 1);
	}

	private static int mymin(int[] data)
	{
		int min = 10000000;
		
		for(int i = 0; i < data.length; i++)
		{
			min = data[i] < min ? data[i]: min;
		}

		return min;
	}

	public static int search()
	{
		int max = 0, tmp;
		int[] ans;

		addRow();		

		for(int y = 0; y < SIZE; y++)
		{
			for(int x = 0; x < SIZE; x++)
			{
				ans = addLine(x, y);
				tmp = mymax(ans);
				max = tmp > max ? tmp: max; 
			}
		}

		return max;
	}

	private static int mymax(int[] data)
	{
		int max = 0;

		for(int i = 0; i < data.length; i++)
		{
			max = data[i] > max ? data[i]: max;
		}

		return max;
	}
}

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

#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define vi vector<int>
using namespace std;
int mod = 1'000'000'000 + 7;
namespace uf {
    vector<int> par, rank;

    void init(int n) {
        par.resize(n);
        rank.resize(n);
        for (int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = root(par[x]);
        }
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y)return;
        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y])rank[x]++;
        }
    }
}

ll pow_mod(ll n, ll k, ll m) {
    ll r = 1;
    for (; k > 0; k >>= 1) {
        if (k & 1) r = (r * n) % m;
        n = (n * n) % m;
    }
    return r;
}

ll gcd(ll a, ll b) {
    if (b == 0)return a;
    return gcd(b, a % b);
} // C++17


void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

int S(ll A) {
    int res = 0;
    while (A > 0) {
        res++;
        A /= 10;
    }
    return res;
}

int F(ll A, ll B) {
    return max(S(A), S(B));
}

int main() {
    COME_LET_THE_GAMES_BEGIN();
    ll N;
    cin >> N;
    int ans = 1000;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ans = min(ans, F(i, N / i));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a;
	cin >> a;
	int b;
	cin >> b;

	if (a > b) {
		cout << "a > b" << endl;
	}
	else if (a < b) {
		cout << "a < b" << endl;
	}
	else {
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main() {
	int N; std::cin >> N;
	std::string s; std::cin >> s;
	int count{ 0 };
	for (auto i = 0; i < N - 2; ++i) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
			++count;
	}
	std::cout << count << std::endl;

	return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <iostream>
#include <cassert>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef vector<int> VI;

int main(){
	int n,a,b;
	cin>>n>>a>>b;
	int mn=max(0,a+b-n);
	int mx=min(a,b);
	cout<<mx<<' '<<mn<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a,b;
    int aa=0;
    int bb=0;
    scanf("%d %d",&a,&b);
    for(int i=1;i<=b;i++)aa=aa*10+a;
    for(int i=1;i<=a;i++)bb=bb*10+b;
    if(aa>bb){
        printf("%d",aa);
    }else{
        printf("%d",bb);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<class T>
struct BIT{
    //0-indexed
    vector<T> data;
    BIT(int size){
        data.assign(size+1,0);
    }
    T sum(int k){
        //[0,k]
        T res=0;
        for(++k;k>0;k-=k&-k){
            res+=data[k];
        }
        return res;
    }
    T sum(int l,int r){
        //[l,r]
        return sum(r)-sum(l-1);
    }
    void add(int k,T x){
        for(++k;k<data.size();k+=k&-k){
            data[k]+=x;
        }
    }
    void debug(){
        REP(i,data.size()-1){
            cerr<<sum(i,i)<<" ";
        }cerr<<endl;
    }
};
template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            swap(a,b);
            u-=t*v;
            swap(u,v);
        }
        return ModInt(u);
    }
    friend ostream &operator<<(ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend istream &operator>>(istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};

const int mod=1e9+7;
using mint=ModInt<mod>;
int main(){
    int n,K;
    cin>>n>>K;
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    vector<BIT<mint>> dp(2,BIT<mint>(K+1));
    dp[0].add(0,1);
    REP(i,n){
        dp[(i+1)%2]=BIT<mint>(K+1);
        REP(j,K+1){
            dp[(i+1)%2].add(j,dp[i%2].sum(max(0,j-vec[i]),j));
        }
    }
    cout<<dp[n%2].sum(K,K)<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
    map<int,int> d;
    vector<int> v1={1,3,5,7,8,10,12};
    vector<int> v2={4,6,9,11};
    for(auto a:v1)d[a]=1;
    for(auto a:v2)d[a]=2;
    d[2]=3;
    
    int a,b;
    cin>>a>>b;
    vector<string> y={"No","Yes"};
    cout<<y[d[a]==d[b]]<<endl;

    
}


Measured memory_bytes: 256
def main():
    n = int(input())
    hlis = list(map(int, input().split()))
    ans = 0
    highest = 0
    for i in range(n):
        if highest <= hlis[i]:
            ans += 1
            highest = hlis[i]
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 61928
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

bool check(string s1, string s2){
	if(s1.size() < s2.size()) return false;
	for(int i = 0;i < s2.size();i++){
		if(s1[i] != s2[i]) return false;
	}
	return true;
}

int main() {
	string str, nowStr = "";
	cin >> str;
	for(int i = str.size() - 1;i >= 0;i--){
		nowStr += str[i];
	}

	string s[4] = {"maerd", "remaerd", "esare", "resare"};
	int start[4] = {5, 7, 5, 6};

	while(nowStr.size()){
		bool flag = true;
		for(int i = 0;i < 4;i++){
			if(check(nowStr, s[i])){
				flag = false;
				nowStr.erase(0, start[i]);
				break;
			}
		}
		//cout << nowStr.size() << endl;
		if(flag) break;
	}

	if(nowStr.size() == 0) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 512
BUILDINGS = 4
FLOORS = 3
ROOMS = 10

house = [[[0] * ROOMS for i in range(FLOORS)] for j in range(BUILDINGS)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v

for b in range(BUILDINGS):
    for f in range(FLOORS):
        for r in range(ROOMS):
            print(' ', house[b][f][r], sep='', end='')
        print()
    if b < BUILDINGS - 1:
        print('#'*20)




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

typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n < 1200){
        cout << "ABC" << endl;
    }
    else if(n < 2800){
        cout << "ARC" << endl;
    }
    else{
        cout << "AGC" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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() {
    ll n, k, q, a;
    cin >> n >> k >> q;
    vector<ll> r(n, k-q);
    rep1(i, q){
        cin >> a;
        r[a-1]++;
    }
    rep1(i,n){
        if (r[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 4024
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    int N,ans=0;cin>>N;
    string S;cin>>S;
    mat A(5010,vec(5010));
    int x=0;
    while(true){
        int n=S.size();    
        A[x][0]=n;
        int i=1,j=0;
        while(i<n){
            while (i+j<n && S[j]==S[i+j]) ++j;
            A[x][i] = j;
            if(j==0){
                ++i; 
                continue;
            }
            int k=1;
            while(i+k<n && k+A[x][k]<j){
                A[x][i+k]=A[x][k];
                ++k;
            }
            i+=k;j-=k;
        }

        for(int y=1;y<n;y++){
            if(A[x][y]<=y)
                ans=max(ans,A[x][y]);
        }
        S.erase(0,1);
        x++;
        if(x==N-1)break;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 98432
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>
using namespace std;

//ツ可コツ古?q1ツ、ツ予ツ算 bツ、ツつアツづ個つィツ禿キツ可ョツつウツづアツづ?づ個嘉ッツ津δ地ツ鶏100ツグツδ可δ?づ個値ツ段 c1ツ、ツづ督づつつ、 ツづ個鶏ツ禿キ100ツグツδ可δ?づ個値ツ段 c2ツ、ツ嘉ッツ津δ地ツ鶏ツづーツ暗ェツ人ツつェツ板δつヲツづゥツ療環づ個湘」ツ古?q2 
//q1 b c1 c2 q2
int q1,b,c1,c2,q2;
int main(void){
	while(1){
		cin >> q1;
		if(q1==0)break;
		cin >> b >> c1 >> c2 >> q2;
		int ic=0;
		while(b>=c1 && ic<q2){
			ic++;
			b-=c1;
		}
		int nc=0;
		while(b>=c2){
			nc++;
			b-=c2;
		}
		while(ic+nc<q1){
			if(q1<=q2 || ic==0)break;
			ic--;
			b+=c1;
			while(b-c2>=0){
				nc++;
				b-=c2;
			}
		}
		if(ic+nc>=q1 && ic>0)cout << ic << " " << nc << endl;
		else cout << "NA" << endl;
	}
    return 0;
}

Measured memory_bytes: 1160
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int N, H;
  cin >> N >> H;
  int amax = 0;
  int b[N];
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a >> b[i];
    amax = max(amax, a);
  }
  sort(b, b + N);

  int ans = 0;
  for (int i = N - 1; b[i] >= amax && H > 0 && i >= 0; i--) {
    ans++;
    H -= b[i];
  }
  if (H > 0) {
    if (H % amax == 0) ans += H / amax;
    else ans += H / amax + 1;
  }
  cout << ans << endl;
}

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



Measured memory_bytes: 640
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

type event struct{ p, i, d int }
type events []event

func (p events) Len() int           { return len(p) }
func (p events) Less(i, j int) bool { return p[i].p < p[j].p }
func (p events) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	var r, c, n, x1, y1, x2, y2 int
	border := func(x, y int) bool { return x == 0 || x == r || y == 0 || y == c }
	getP := func(x, y int) int {
		if y == 0 || x == r {
			return x + y
		}
		return 2*r + 2*c - x - y
	}
	es := events{}
	Fscan(in, &r, &c, &n)
	for i := 0; i < n; i++ {
		Fscan(in, &x1, &y1, &x2, &y2)
		if border(x1, y1) && border(x2, y2) {
			p1, p2 := getP(x1, y1), getP(x2, y2)
			if p1 > p2 {
				p1, p2 = p2, p1
			}
			es = append(es, event{p1, i, 1}, event{p2, i, -1})
		}
	}
	sort.Sort(es)
	s := []int{}
	for _, e := range es {
		if e.d == 1 {
			s = append(s, e.i)
		} else {
			if s[len(s)-1] != e.i {
				Fprint(_w, "NO")
				return
			}
			s = s[:len(s)-1]
		}
	}
	Fprint(_w, "YES")
}

func main() { run(os.Stdin, os.Stdout) }


Measured memory_bytes: 21376
N, M = map(int, input().split())
roads = [list(map(int, input().split())) for _ in range(M)]
ans = [0 for _ in range(N)]
for i in range(len(roads)):
	ans[roads[i][0]-1] += 1
	ans[roads[i][1]-1] += 1
for i in range(len(ans)):
	print(ans[i])

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n, k;
    cin >> n >> k;
    ll a = 1e+9;
    ll b = 1e+9;
    for(ll i = 0; i < k; i++){
        a += i;
        b += n-i;
    }
    ll ans = 0;
    ll INF = 1e+9+7;
    for(ll i = k; i <= n+1; i++){
        ans+=b-a+1;
        ans%=INF;
      //  cout << a << " " << b << " " << b-a+1 << endl;
        a += i;
        b += n-i;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i, n) for (_loop_int i = 0; i < (_loop_int)(n); i++)
#define FOR(i, a, b) for (_loop_int i = (_loop_int)(a); i < (_loop_int)(b); i++)
#define FORR(i, a, b) for (_loop_int i = (_loop_int)(b)-1; i >= (_loop_int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))
#define ALL(v) (v).begin(), (v).end()

#define DEBUG(x) cerr << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                                                                                                   \
  cerr << #v << ": ";                                                                                                  \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", ";                                                                     \
  cerr << endl

#define PRINT(x) cout << (x) << endl;
#define PRINT_ARR(arr)                                                                                                 \
  for (_loop_int i = 0; i < arr.size() - 1; i++)                                                                       \
    cout << arr[i] << " ";                                                                                             \
  cout << arr[arr.size() - 1] << endl;
#define IN(n) cin >> n;
#define EXTEND(base_arr, arr) base_arr.insert(base_arr.begin(), arr.begin(), arr.end());

const ll MOD = 1000000007ll;

int main() {
  string s;
  IN(s)

  int rcount = 0;
  int lcount = 0;
  char l = 'R';
  vl result = vl(0);
  REP(i, s.size()) {
    char c = s[i];
    if (l == 'L' && c == 'R') {
      int rr = (rcount + 1) / 2 + (lcount / 2);
      int ll = rcount + lcount - rr;
      //   DEBUG_VEC(result);
      result.insert(result.end(), rcount - 1, 0);
      result.push_back(rr);
      result.push_back(ll);
      result.insert(result.end(), lcount - 1, 0);
      rcount = 0;
      lcount = 0;
    }
    if (c == 'R') {
      rcount += 1;
    }
    if (c == 'L') {
      lcount += 1;
    }
    l = c;
  }
  int rr = (rcount + 1) / 2 + (lcount / 2);
  int ll = rcount + lcount - rr;
  result.insert(result.end(), rcount - 1, 0);
  result.push_back(rr);
  result.push_back(ll);
  result.insert(result.end(), lcount - 1, 0);

  PRINT_ARR(result);
}


Measured memory_bytes: 2048
var
  a,b,x:int64;
  ans,temp,sum:int64;
begin
  read(a);
  read(b);
  read(x);
  if a mod x=0
    then temp:=a div x
    else temp:=(a div x)+1;
    sum:=b div x;
  ans:=sum-temp+1;
  write(ans);
end.

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

int main() {

    int n, m; cin >> n >> m;


    Graph G(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }


    vector<int> ans(200005, -1);
    queue<int> que;



    que.push(0);


    while (!que.empty()) {
        int v = que.front();
        que.pop();


        for (int nv : G[v]) {
            if (ans[nv] != -1) continue;


            ans[nv] = v + 1;
            que.push(nv);
        }
    }
    bool stl=1;
    for(int i=1;i<n;i++){
      if(ans[i]==-1) stl=0;
    }
    if(stl){
      cout << "Yes" << endl;
      for(int i=1;i<n;i++)cout << ans[i] << endl;
    }
    else{ cout << "No" << endl;
  }

}


Measured memory_bytes: 10668
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long H, long long W, long long h, long long w) {
  cout << (H - h) * (W - w) << endl;
}

int main() {
  cout << setprecision(10);
  long long H;
  scanf("%lld", &H);
  long long W;
  scanf("%lld", &W);
  long long h;
  scanf("%lld", &h);
  long long w;
  scanf("%lld", &w);
  solve(H, W, h, w);
  return 0;
}


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

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

int dp[3010][3010];

int main(void) {
	string s,t,ans = "";
	cin >> s >> t;
	int N=s.size(), M=t.size();
	for(int i=1; i<=N; i++)
		for(int j=1; j<=M; j++) {
			if(s[i-1] == t[j-1]) dp[i][j] = dp[i-1][j-1]+1;
			else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	int i = N,j = M;
	while(i > 0 && j > 0) {
		if(dp[i][j] == dp[i-1][j]) i--;
		else if(dp[i][j] == dp[i][j-1]) j--;
		else {
			ans = s[i-1] + ans;
			i--;
			j--;
		}
	}
  	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 35584
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <bitset>
#include <utility>
#include <assert.h>
using namespace std;
#define rank rankk
#define mp make_pair
#define pb push_back
#define xo(a,b) ((b)&1?(a):0)
#define tm tmp

//#define LL ll
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const int INF=0x3f3f3f3f;
//const ll INFF=0x3f3f3f3f3f3f3f3fll;
const int MAX=1e5+5;
//const ll MAXN=2e8;
//const int MAX_N=MAX;
//const ll MOD=1e15+37;
//const long double pi=acos(-1.0);
//const double eps=0.00000001;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
inline ll powMM(ll a,ll b,ll M){
    ll ret=1;
    a%=M;
//    b%=M;
    while (b){
        if (b&1) ret=ret*a%M;
        b>>=1;
        a=a*a%M;
    }
    return ret;
}
void open()
{
//    freopen("1009.in","r",stdin);
    freopen("out.txt","w",stdout);
}


//使用邻接表算法的复杂度是 O(|E|log|V|)
//当所有边权值相等时，单源最短路可以通过BFS求解，此时，Dijkstra算法使用的
//priority_queue和queue具有相同效果，因此复杂度会发生变化 变为O（V）
const int MAX_V=1e5+5;
struct edge
{
    int to,cost;
    edge(int x,int y){to=x;cost=y;}
};
typedef pair<int,int> P;//first是最短距离，second是顶点的编号
int V;
vector <edge>G[MAX_V];
int d[MAX_V];
void add_edge(int u,int v,int cost)
{
    G[u].pb(edge(v,cost));
}
void dijkstra(int s)
{
    //通过指定greater<P>参数，堆按照first从小到大的顺序取出值
//    queue<P>que;
//    priority_queue<P,vector<P>,greater<P> >que;
    queue<P>que;
    fill(d,d+V,INF);
    d[s]=0;
    que.push(P(0,s));
    while(!que.empty())
    {
//        P p=que.top();
        P p=que.front();
//        cout<<p.second<<"!!!"<<endl;
        que.pop();
        int v=p.second;
        if(d[v]<p.first)
            continue;
        for(int i=0;i<G[v].size();i++)
        {
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost)
            {
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}
int k,plu,mul;
int main()
{
    scanf("%d",&k);
    V=k;
    for(int i=0;i<k;i++)
    {
        plu=(i+1==k)?0:i+1;
        mul=i*10%k;
//        cout<<"i="<<i<<" plu="<<plu<<" mul="<<mul<<endl;
//        cout<<i<<" "<<mul<<endl;
        if(plu==mul)
            add_edge(i,mul,0);
        else
        {
            add_edge(i,mul,0);
            add_edge(i,plu,1);
        }
    }
//    for(int i=0;i<k;i++)
//    {
//        cout<<i<<" ";
//        for(int j=0;j<G[i].size();j++)
//            printf("%d ",G[i][j]);
//        printf("\n");
//    }
    dijkstra(1);
    printf("%d\n",d[0]+1);
}


Measured memory_bytes: 6400
n=int(input())
a=list(map(int,input().split()))

color=[]
free=0
Sans,Mans=0,0
for i in a:
    if i//400<8 and i//400 not in color:
        color.append(i//400)
        Sans+=1
    elif i>=3200:
        free+=1
        
#Mans=Sans
#if free+Sans>=8:
 #   Mans=8
#else:
 #   Mans=Sans+free

Mans=Sans+free
if Sans==0:
    Sans=1
print(Sans,Mans)

Measured memory_bytes: 9056
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

struct edge{
  ll to, cost;
  edge(){}
  edge(ll t, ll c){to = t; cost = c;}
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M, R;
  cin >> N >> M >> R;
  vll r(R);
  for(int i = 0; i < R; i++){
    cin >> r.at(i);
    r.at(i)--;
  }
  vvll G(N, vll(N, INF));
  for(int i = 0; i < M; i++){
    ll A, B, C;
    cin >> A >> B >> C;
    A--; B--;
    G.at(A).at(B) = C;
    G.at(B).at(A) = C;
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      for(int k = 0; k < N; k++){
        if(j == k){
          G.at(j).at(k) = 0;
        }
        else{
          chmin(G.at(j).at(k), G.at(j).at(i) + G.at(i).at(k));
        }
      }
    }
  }

  vvll dp((1<<R), vll(R, INF));

  function<ll(int, ll)> bitdp = [&](int bit, ll v){
    if(dp.at(bit).at(v) != INF) return dp.at(bit).at(v);
    if(bit == (1 << v)) return dp.at(bit).at(v) = 0;

    int prebit = bit & ~(1 << v);
    ll res = INF;
    for(int i = 0; i < R; i++){
      if(!(prebit & (1 << i))) continue;
      chmin(res, bitdp(prebit, i) + G.at(r.at(i)).at(r.at(v)));
    }
    return dp.at(bit).at(v) = res;
  };
  
  ll ans = INF;
  for(int i = 0; i < R; i++){
    chmin(ans, bitdp((1<<R)-1, i));
  }
  cout << ans << endl;
}

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

using namespace std;

//#define FILE_IO

const int mod = 1e9 + 7;

int N, M, A, B;

int fct[200005], ifct[200005];

int power(int x, int y)
{
    int p = x, r = 1;
    while(y)
    {
        if(y & 1)
            r = (1LL * r * p) % mod;
        p = (1LL * p * p) % mod;
        y >>= 1;
    }
    return r;
}

int C(int N, int K)
{
    if(K > N)   return 0;
    int ans = fct[N];
    ans = (1LL * ans * ifct[K]) % mod;
    ans = (1LL * ans * ifct[N - K]) % mod;
    return ans;
}

int roads(int N, int M)
{
    return C(N - 1 + M - 1, N - 1);
}

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d%d%d", &N, &M, &A, &B);

    fct[0] = ifct[0] = 1;
    for(int i = 1; i <= N + M; i++)
    {
        fct[i] = (1LL * fct[i - 1] * i) % mod;
        ifct[i] = power(fct[i], mod - 2);
    }

    int ans = 0;
    for(int i = B + 1; i <= M; i++)
    {
        int r1 = roads(N - A, i);
        int r2 = roads(A, M - i + 1);
        int rds = ( 1LL * r1 * r2 ) % mod;
        ans = (ans + rds) % mod;
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
ll C[60][60];
void init()
{
    //パスカルの三角形
    for (int i = 1; i < 59; i++)
    {
        rep(j, i + 1)
        {
            if (j == 0 || j == i)
            {
                C[i][j] = 1;
            }
            else
            {
                C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
            }
        }
    }
}

int main()
{
    init();
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    rep(i, n)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end(), greater<ll>());
    double key = v[a - 1];
    double s = 0;
    ll c = 0;
    ll k = 0;
    // 全部同じときはforでコンビネーションの和
    // 違うときにはコンビネーション一回とるだけ
    rep(i, a)
    {
        s += v[i];
    }
    rep(i, n)
    {
        if (v[i] == key)
        {
            c++;
            if (i >= a)
                k++;
        }
    }
    if (s / a != key)
    {
        printf("%.10f\n", s / a);
        cout << C[c][k] << endl;
    }
    if (s / a == key)
    {
        printf("%.6f\n", s / a);
        ll res = 0;
        for (int i = a; i <= min(c, b); i++)
        {
            res += C[c][i];
        }
        cout << res << endl;
    }
}

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

using namespace std;

#define MAX_NUM 200000

int c[MAX_NUM] = {0};  

int main(){
  int n, k;
  cin >> n >> k;
  cin.ignore();
  int tmp;

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

  sort(c, c + MAX_NUM);

  int ptr = MAX_NUM - 1;

  int sum = 0;
  for(int i = 0; i < MAX_NUM; i++){
    ptr = MAX_NUM - 1 - i;
    if(i < k) continue;
    if(c[ptr] == 0) break;

    sum += c[ptr];
  }

  cout << sum << endl;

  return 0;
}


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

typedef long long ll;
typedef long double ld;

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

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

int main(){

    ll a;
    string s;

    cin >> a >> s;

    cout << (a >= 3200 ? s: "red") << endl;    

    return 0;
}

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

int a[13];
int main(){
	int n,m;
	
	a[4] = a[6] = a[9] = a[11] = 1;
	cin >> n >> m;
	if(m==2||n==2) cout << "No";
	else{
		if(a[m]==a[n]) cout << "Yes";
		else cout << "No";
	}
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a >= 13) {
    cout << b << endl;
  } else if (a >= 6 && a <= 12) {
    cout << int(b / 2) << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
open Batteries
let n = read_int ()
let a = read_line () |> String.split_on_char ' ' |> List.sort compare

let _ =
  let rec loop lst =
    match lst with
    | [] -> "YES"
    | first :: second :: rest -> if first = second then "NO" else loop (second :: rest)
    | first :: rest -> loop rest
  in loop a |> print_endline

Measured memory_bytes: 26624
N  = int(input())
A = []
B = []
C = []
for i in range(N):
    a,b,c = map(int,input().split())
    A.append(a)
    B.append(b)
    C.append(c)

dp = [[0 for i in range(N)] for j in range(3)]
dp[0][0] = A[0]
dp[1][0] = B[0]
dp[2][0] = C[0]

# for i in range(N):
#     print(dp[i])

for i in range(1,N):
#     for j in range(N):
#         print(dp[j])
#     print()    i+1 = 今日
    dp[0][i] = max(dp[1][i-1]+A[i],dp[2][i-1]+A[i])
    dp[1][i] = max(dp[0][i-1]+B[i],dp[2][i-1]+B[i])
    dp[2][i] = max(dp[0][i-1]+C[i],dp[1][i-1]+C[i])
    
print(max(dp[0][-1],dp[1][-1],dp[2][-1]))

Measured memory_bytes: 83032
import java.util.*;
import java.math.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double l = sc.nextDouble();
    BigDecimal  l2 = new BigDecimal(l/3);
    
    System.out.println(l2.multiply(l2).multiply(l2));
    
   
  }
}

Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll H, W, N;
ll dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
ll dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
ll ans[11];

int main()
{
    cin >> H >> W >> N;
    set<pair<ll, ll>> st, br;
    ans[0] = (H - 2) * (W - 2);
    for (int i = 0; i < N; i++)
    {
        ll y, x;
        cin >> y >> x;
        y--, x--;
        pair<ll, ll> p = make_pair(y, x);
        br.insert(p);
        st.insert(p);
        for (ll i = 0; i < 8; i++)
        {
            ll ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || ny >= H)
                continue;
            if (nx < 0 || nx >= W)
                continue;
            pair<ll, ll> q = make_pair(ny, nx);
            st.insert(q);
        }
    }
    for (auto &p : st)
    {
        ll y = p.first, x = p.second, cnt = 0;
        if (br.find(p) != br.end())
            cnt++;
        for (ll i = 0; i < 8; i++)
        {
            ll ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || ny >= H || nx < 0 || nx >= W)
            {
                cnt = -1;
                break;
            }
            pair<ll, ll> q = make_pair(ny, nx);
            if (br.find(q) != br.end())
                cnt++;
        }
        if (cnt != -1)
            ans[cnt]++, ans[0]--;
    }
    for (int i = 0; i <= 9; i++)
        cout << ans[i] << endl;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  for(int i=1;i<12501;i++){
    if(int(i*0.08)==a && int(i*0.1)==b){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}



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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B;
	cin >> A >> B;

	if (A <= B)
	{
		cout << A << endl;
	}
	else
	{
		cout << A - 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256