akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill( x, y ) memset( x, y, sizeof x )
#define copy( x, y ) memset( x, y, sizeof x )
using namespace std;

typedef long long LL;
typedef pair < int, int > pa;

const int MAXN = 105;
const int mod = 1e9 + 7;

int a[MAXN], dp[MAXN][MAXN][MAXN], n, ans;

inline int inc(int &x, int y) { x += y; if( x >= mod ) x -= mod; }

int main()
{
#ifdef wxh010910
	freopen( "data.in", "r", stdin );
#endif
	scanf( "%d", &n );
	for( int i = 1 ; i <= 2 * n - 1 ; i++ ) scanf( "%d", &a[ i ] );
	sort( a + 1, a + 2 * n );
	dp[ 1 ][ 1 ][ 1 ] = 1;
	for( int i = 1 ; i < n ; i++ )
		for( int j = 1 ; j <= 2 * i - 1 ; j++ )
			for( int k = 1 ; k <= j ; k++ )
			{
				int ret = dp[ i ][ j ][ k ];
				if( !ret ) continue;
				int x = j, y = k;
				if( a[ n - i ] ^ a[ n - i + 1 ] ) x++, y++;
				if( a[ n + i ] ^ a[ n + i - 1 ] ) x++;
				for( int l = 1 ; l <= x ; l++ )
					inc( dp[ i + 1 ][ x - max( abs( y - l ) - 1, 0 ) ][ l <= y ? l : ( y + 1 ) ], ret );
			}
	for( int i = 1 ; i <= 2 * n + 1 ; i++ )
		for( int j = 1 ; j <= i ; j++ )
			inc( ans, dp[ n ][ i ][ j ] );
	return printf( "%d\n", ans ), 0;
}


Measured memory_bytes: 3328
# ALDS_1_C.
from math import sqrt, floor

def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def get_prime():
    P = []
    P.append(2); P.append(3); P.append(5); P.append(7)
    # まず100までの素数を作って、それから10000まで行く。
    # 100までの合成数は必ず2, 3, 5, 7のどれかで割れる。
    for n in range(8, 101):
        is_prime = True
        for i in range(4):
            if n % P[i] == 0: is_prime = False; break
        if is_prime: P.append(n)
    for n in range(101, 10001):
        is_prime = True
        limit = floor(sqrt(n))
        for i in range(len(P)):
            if n % P[i] == 0: is_prime = False; break
            if P[i] > limit: break
        if is_prime: P.append(n)
    return P

def main():
    # 10000までの素数のリスト作って、
    # 平方根までの素数で割っていった方が早い。多分。
    primes = get_prime()
    n = int(input())
    data = []
    for i in range(n): data.append(int(input()))
    count = 0
    for i in range(n):
        # 1と2だけ特別扱いする。
        if data[i] == 1: continue
        if data[i] == 2: count += 1; continue
        # 残りの数は普通に判定する。
        limit = floor(sqrt(data[i]))
        is_prime = True
        for p in primes:
            if data[i] % p == 0: is_prime = False; break
            if p > limit: break
        if is_prime: count += 1
    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 5976
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;



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

	string s, t;
	cin >> s >> t;
	int a = 0, b = 0;
	bool flag = false;
	for (int i = 0; i < s.size(); i++) {
		if (i & 1) {
			while (b < t.size() && t[b] != s[i])b++;
			if (b >= t.size())break;
			b++;
		}
		else {
			while (a < s.size() && s[a] != s[i])a++;
			if (a >= s.size())break;
			a++;
		}
		if (i + 1 == s.size())flag = true;
	}
	a = b = 0;
	for (int i = 0; i < s.size(); i++) {
		if ((i & 1) == 0) {
			while (b < t.size() && t[b] != s[i])b++;
			if (b >= t.size())break;
			b++;
		}
		else {
			while (a < s.size() && s[a] != s[i])a++;
			if (a >= s.size())break;
			a++;
		}
		if (i + 1 == s.size())flag = true;
	}
	if (flag)cout << "Yes\n";
	else cout << "No\n";
}


Measured memory_bytes: 3196
S = input()
m = 0
for i in range(len(S)):
    if i == 0:
        m = abs(int(S[i: i + 3]) - 753)
    elif i == len(S) - 2:
        break
    else:
        m = min(m, abs(int(S[i: i + 3]) - 753))
    # print(m)    



print(m)    


Measured memory_bytes: 9044
print(" ".join(list(map(str, [p for p in [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381] if p % 5 == 1][0:int(input())]))))

Measured memory_bytes: 3192
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
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 II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    N = II()
    s = SI()
    if s.count('R') > s.count('B'):
        ans = 'Yes'
    else:
        ans = 'No'
    return ans

print(main())

Measured memory_bytes: 3064
a, b, c = map(int, input().split())
k = int(input())
for x in range(k + 1):
	for y in range(k + 1):
		for z in range(k + 1):
			if a * 2**x < b * 2**y and b * 2**y < c * 2**z and x + y + z <= k:
				print("Yes")
				exit()
print("No")

Measured memory_bytes: 9192
/*
2つの数の交換
*/

#include<stdio.h>

#define MAX(a,b) ((a) > (b) ? (a):(b))
#define MIN(a,b) ((a) < (b) ? (a):(b))

int main(void){
  int x,y;
  while(1){
    scanf("%d %d",&x,&y);
    if(x == 0 && y == 0)
      break;
    printf("%d %d\n",MIN(x,y),MAX(x,y));
  }
  return 0;
}



Measured memory_bytes: 2716
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
  long long h, w;

  cin >> h >> w;

  if (h == 1 || w == 1)
  {
    cout << 1 << endl;
  }
  else if (h * w % 2)
  {
    cout << h * w / 2 + 1 << endl;
  }
  else
  {
    cout << h * w / 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import sys


def main():
    # 読み込み回数が多い場合
    input = sys.stdin.readline
    # 複数
    N, K = map(int, input().split())

    # リスト読み込み
    V_A = [inp for inp in map(int, input().split())]
    V_B = V_A.copy()[::-1]
    
    ret = 0
    for A in range(min(K + 1, N + 1)):
        for B in range(min(K - A + 1, N - A + 1)):
            left_jewels = V_A.copy()[:A]
            right_jewels = V_B.copy()[:B]

            if len(left_jewels) >= len(right_jewels):
                jewels = left_jewels
                jewels.extend(right_jewels)
            else:
                jewels = right_jewels
                jewels.extend(left_jewels)
            jewels.sort()

            score = sum(jewels)

            for i in range(min(K - A - B, len(jewels))):
                jewel = jewels[i]
                if jewel < 0:
                    score -= jewel
                else:
                    break
                    
            ret = max(ret, score)
                
    print(ret)

if __name__ == "__main__":
    main()

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

public class Main{
	static void main() throws Exception{
		long d=sc.nextLong(),s=sc.nextLong(),t=sc.nextLong();
		if(s*t>=d) {
			pw.println("Yes");
		}
		else {
			pw.println("No");
		}
	}
	public static void main(String[] args) throws Exception{
		sc=new MScanner(System.in);
		pw = new PrintWriter(System.out);
		int tc=1;
//		tc=sc.nextInt();
		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

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

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let mut buf = buf.split_whitespace();
    let m = buf.next().unwrap().parse::<f64>().unwrap();
    let n = buf.next().unwrap().parse::<f64>().unwrap();

    if n == 1.0 || m == 1.0 {
        println!("1");
    } else {
        println!("{}", (m * n / 2.0).ceil() as i64);
    }
}


Measured memory_bytes: 4352
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = B[A[0] - 1]
for i in range(1, N):
    a = A[i] - 1
    pa = A[i - 1] - 1
    ans += B[a]
    if 0 <= pa < N - 1 and a == pa + 1:
        ans += C[pa]
print(ans)


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

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline T gcd(T m, T n) {
  if (n == 0)
    return m;
  else
    return gcd(n, std::abs(m) % std::abs(n));
}

#define IOS ios::sync_with_stdio(false), cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()
#define MAX(a) *max_element(all(a))

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vc = vector<char>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vvi;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  IOS;
  constexpr char endl = '\n';

  int K;
  cin >> K;
  int sum = 0;
  FOR(i, 1, K + 1) FOR(j, 1, K + 1) FOR(k, 1, K + 1) sum += gcd(i, gcd(j, k));

  cout << sum << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1145141919
#define LLINF 1145148101919
#define PI 3.14159265359
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}

class UnionFind
{
public:
    vector<ll> par; // 各元の親を表す配列
    vector<ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL)
    {
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_)
    {
        siz.assign(sz_, 1LL); // assign: 再代入
        par.resize(sz_);      // resize: 再確保
        for (ll i = 0; i < sz_; ++i)
            par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x)
    { // 根の検索
        while (par[x] != x)
        {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y])
            swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y)
    { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x)
    { // 素集合のサイズ
        return siz[root(x)];
    }
};

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

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

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

vector<ll> decom;

void decompositPrime(ll n)
{
    ll a = 2;
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            decom.push_back(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }
    decom.push_back(n);
}

////////////////////////////////////////

const ll mod = 1e9 + 7;
double a, b, x;

////////////////////////////////////////

int main()
{
    cin >> a >> b >> x;
    double remain = 2 * x / (a * b);
    cout << std::defaultfloat << std::setprecision(10);

    if (a >= remain)
        cout << (PI / 2 - atan(remain / b)) * 180 / PI << endl;
    else
        cout << atan((a * a * b - x) / (a * a / 2) / a) * 180 / PI << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
template<class T> void read(T &x)
{
    x=0; int f=1,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=getchar();}
    x*=f;
}
typedef long long ll;
const int maxn=40+5;
int n;
char A[maxn][maxn];
ll f[maxn][maxn][maxn][maxn];
ll g[maxn][maxn][maxn][maxn];
ll F(int,int,int,int);
ll G(int,int,int,int);
ll G(int a,int b,int c,int d)
{
    if(g[a][b][c][d]!=-1) return g[a][b][c][d];
    ll re=0;
    for(int x=a;x<=b;++x) for(int y=c;y<=d;++y) if(A[x][y]=='1')
    {
        re+=F(c,y-1,y+1,d)*F(a,x-1,x+1,b);
    }
    return g[a][b][c][d]=re;
}
ll F(int a,int b,int c,int d)
{
    if(a>b&&c>d) return 1;
    if(a>b||c>d) return 0;
    if(f[a][b][c][d]!=-1) return f[a][b][c][d];
    ll re=G(a,b,c,d);
    for(int x=a;x<b;++x) for(int y=c+1;y<=d;++y)
    {
        re+=G(a,x,y,d)*F(x+1,b,c,y-1);
    }
    return f[a][b][c][d]=re;
}
int main()
{
    read(n),n<<=1;
    for(int i=1;i<=n;++i) scanf("%s",A[i]+1);
    ll an=0;
    memset(f,-1,sizeof(f));
    memset(g,-1,sizeof(g));
    for(int i=2;i<=n;++i) if(A[1][i]=='1')
    {
        an+=F(2,i-1,i+1,n);
    }
    printf("%lld\n",an);
    return 0;
}

Measured memory_bytes: 64384
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def mod_com_once(n, r, MOD):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    r = min(r, n - r)
    numer = denom = 1
    for i in range(n - r + 1, n + 1):
        numer = numer * i % MOD
    for i in range(1, r + 1):
        denom = denom * i % MOD
    return numer * pow(denom, MOD - 2, MOD) % MOD


def main():
    X, Y = map(int, readline().split())

    if (X + Y) % 3:
        print(0)
        return

    p, q = (-X + 2 * Y) // 3, (2 * X - Y) // 3
    if p < 0 or q < 0:
        print(0)
        return

    ans = mod_com_once(p + q, p, MOD)

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 63132
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

bool is_prime(ll n){
	if(n==1)return false;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}
vector<ll>divisor(ll n){
	vector<ll>res;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			res.push_back(i);
			if(i!=n/i)res.push_back(n/i);
		}
	}
	return res;
}
map<ll,int>prime_factor(ll n){
	map<ll,int>res;
	for(ll i=2;i*i<=n;i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1)res[n]++;
	return res;
}
vector<ll>prime_enum(int n){
	vector<bool>is_prime(n+1,true);
	is_prime[0]=is_prime[1]=false;
	vector<ll>res;
	for(int i=2;i<=n;i++){
		if(!is_prime[i])continue;
		res.push_back(i);
		for(int j=2*i;j<=n;j+=i){
			is_prime[j]=false;
		}
	}
	return res;
}
int main(){
	int a,b,c;cin>>a>>b>>c;
	cout<<min(c,b/a)<<endl;
}

Measured memory_bytes: 256
n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
dic={}

for i in range(n):
    s=input()
    dic[s]=dic.get(s,0)+1

print(len(dic.keys()))


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

long long cnt(long long n) {
  string m = to_string(n);
  int k = m.size();
  if (k == 1) return n + 1;
  long long tot = 0;
  tot += pow(10, (k - 1) / 2) * (m[0] - '1');
  tot += pow(10, k / 2) * 2 - 1 - 9 * pow(10, (k - 2) / 2) * (k & 1 ^ 1);
  while (k >= 2) {
    k -= 2;
    if (k == 0) {
      tot += m[1] >= m[0];
      break;
    } else if (k == 1) {
      tot += m[1] - '0' - (m[2] < m[0]) + 1;
      break;
    } else {
      m = to_string(stoi(m.substr(1, k)) - (m[k+1] < m[0]));
      while (m.size() < k) m = '0' + m;
      tot += (m[0] - '0') * pow(10, (k - 1) / 2); 
    }
  }
  return tot;
}

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

  long long a, b;
  cin >> a >> b;

  cout << cnt(b) - cnt(a - 1) << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

int main(){
 	int N;
  
  	std::cin>>N;
  
  	std::string s, t;
  	std::cin >> s >> t;
    std::string res;
  	res.resize(N*2);
  	for (int i=0; i < N*2; i += 2){
      	res[i] = s[i/2];
        res[i+1] = t[i/2];
    }
    std::cout<<res;
  	
  
  
 	return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define int long long
using namespace std;
typedef pair<int,int> P;

signed main(){
    int N;cin>>N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];
    vector<vector<int>> dp(N,vector<int>(N));
    vector<vector<int>> S(N+1,vector<int>(N+1,0));
    REP(i,N) S[0][i+1]=S[0][i]+a[i];
    REP(i,N) REP(j,N){
        if(i==j) dp[i][j]=0;
        else dp[i][j]=LLONG_MAX;
        S[i+1][j+1]=S[i][j+1]-a[i];
    }
    REP(j,N) REP(i,N-j){
        REP(k,j) dp[i][i+j]=min(dp[i][i+j],S[i][i+j+1]+dp[i][i+k]+dp[i+k+1][i+j]);
    }
    cout<<dp[0][N-1]<<endl;
}

Measured memory_bytes: 2816
#include <iostream>
#include <cstring>
#include <algorithm>
#include <deque>
#include <cmath>
using namespace std;

#define rep(i, N) for(int (i) = 0; (i) < N; (i) ++)
#define rep1(i, N, s) for(int (i) = s; (i) < N; (i) ++)
#define rrep(i, N) for(int (i) = (N); (i) >= 0; (i) --)
#define pint pair<int, int>
#define INF 1e9

typedef long long ll;

#include <vector>
#include <stack>

ll gcd(ll a, ll b){
    if(a < b){
        return gcd(b, a);
    }
    if(b == 0) return a;
    return gcd(b, a % b);
}

bool is_prime(int x) {
  if(x < 2)  return false;
  if (x == 2) return true;
  if (x % 2 == 0) return false;
  int i = 3;
  while (i <= sqrt(x)) {
    if (x % i == 0) return false;
    i += 2;
  }
  return true;
}

int main(){
    int N;
    ll dn = 1e9 + 7;
    int primes[1010];
    memset(primes, 0, sizeof(primes));
    cin >> N;
    rep(i, N + 1){
        if(is_prime(i)){
            int s = N;
            while(s > 1){
                primes[i] += s / i;
                s /= i;
            }
        }
    }
    ll ans = 1;
    rep(i, N + 1){
         ans = (ans * (primes[i] + 1)) % dn;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
    int N,rem;
    cin>>N;
    rem=N%10;
    if(rem==2 || rem==4 || rem==5 || rem==7 || rem==9)
    {
        cout<<"hon";
    }
    else if(rem==0 || rem==1 || rem==6 || rem==8)
    {
        cout<<"pon";

    }
    else if(rem==3)
    {
        cout<<"bon";
    }
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

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

    vector<vector<int>> toy(5,vector<int>(5)),tox(5,vector<int>(5));
    for (int i = -2;i <= 2; ++i) {
        for (int j = -2;j <= 2; ++j) {
            toy[i + 2][j + 2] = i;
            tox[i + 2][j + 2] = j;
        }
    }

    int H,W; cin >> H >> W;
    int sy,sx; cin >> sy >> sx;
    --sy; --sx;
    int gy,gx; cin >> gy >> gx;
    --gy; --gx;
    vector<string> grid(H);
    rep(i,H) cin >> grid[i];

    
    vector<vector<int>> dist(H,vector<int>(W,-1));
    dist[sy][sx] = 0;
    deque<P> q;
    q.emplace_back(sy,sx);
    while (!q.empty()) {
        P p = q.front(); q.pop_front();
        int y = p.first,x = p.second;
        rep(k,4) {
            int i = y + dy[k],j = x + dx[k];
            if (i < 0 || i >= H || j < 0 || j >= W) continue;
            if (grid[i][j] == '#') continue;
            if (dist[i][j] >= 0 && dist[i][j] <= dist[y][x]) continue;
            dist[i][j] = dist[y][x];
            q.push_front(make_pair(i,j));
        }
        rep(s,5)rep(t,5) {
            int i = y + toy[s][t],j = x + tox[s][t];
            if (i < 0 || i >= H || j < 0 || j >= W) continue;
            if (grid[i][j] == '#') continue;
            if (dist[i][j] >= 0) continue;
            dist[i][j] = dist[y][x] + 1;
            q.push_back(make_pair(i,j));
        }
    }
    //rep(i,H)rep(j,W) cout << dist[i][j] << '\n';
    cout << dist[gy][gx] << '\n';
    return 0;
}

Measured memory_bytes: 8788
n=int(input())

sub=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]
cost=[0]*(n+1)
for i in range(n+1):
    cost[i]=i
for i in range(n+1):
    for j in range(len(sub)):
        if sub[j]<=i:
            cost[i]=min(cost[i], cost[i-sub[j]]+1)
print(cost[n])



Measured memory_bytes: 12644
N, M, *AB = map(int, open(0).read().split())

graph = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
    graph[a].append(b)
    graph[b].append(a)
    
# bfs
from collections import deque

queue = deque([1])
numsigns = [0] * (N + 1) # ←なるほど、0行および0列は定義するが使わないということか
numsigns[1] = 1

while queue:
    p = queue.popleft() # ←現在地
    for nxt in graph[p]: # ←現在地がつながっているところを探索
        if not numsigns[nxt]: # ←印が付いていなかったら
            numsigns[nxt] = p
            queue.append(nxt)

print('Yes')
print(*numsigns[2:], sep='\n')

Measured memory_bytes: 56208
#include <bits/stdc++.h>
#include <vector>
#include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9+5;
const int mod = 1e9+7;
signed main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int ma = a*c;
    ma = max(ma,b*d);

    ma = max(ma,a*d);

    ma = max(ma,b*c);
    cout << ma << endl;

    return 0;

}


Measured memory_bytes: 3632
#include <stdio.h>

int main()
{
    int a, b, c;
    while (scanf("%d%d%d", &a, &b, &c) && (a != -1 || b != -1 || c != -1))
    {
        if (a < 0 || b < 0)
            printf("F\n");
        else if (a + b >= 80)
            printf("A\n");
        else if (a + b >= 65)
            printf("B\n");
        else if (a + b >= 50 || c >= 50)
            printf("C\n");
        else if (a + b >= 30)
            printf("D\n");
        else
            printf("F\n");
    }
    return 0;
}



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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

const ll INF = 1LL<<60;

int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m;
	cin >>n >>m;
	
	vector<vector<ll>> a(n, vector<ll>(n, INF));
	rep(i, n) a[i][i] =0;
	rep(i, m){
		int x,y,z;
		cin >>x >>y >>z;
		a[x-1][y-1] = a[y-1][x-1] = z;
	}
	auto org = a;
	rep(k, n) rep(i,n) rep(j,n) a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
	
	//for(auto xl: a){for(auto x :xl) printf("%lld ",x); puts("");}puts("");
	//for(auto xl: org){for(auto x :xl) printf("%lld ",x); puts("");}
	ll ans =0;
	rep(i, n) rep2(j,i+1,n){
		if(org[i][j] !=INF && org[i][j] > a[i][j]) ans++;
	}
	cout << ans <<"\n";
	return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  ll n,k;
  std::cin >> n >> k;

  mint ans = 1;

  for (ll i = k; i < n + 1; ++i) {
    ans += i * (n + (n - i + 1)) / 2 - i * (i - 1) / 2 + 1;
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int count = 0;

		for (int i = 1; i <= n; i++) {
			if ((String.valueOf(i).length()) % 2 == 1) {
				count++;
			}
		}

		System.out.println(count);
		sc.close();

	}
}

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

using namespace std;

#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define INF 100000000000000000
#define EPS 1e-9

int32_t main()
{
    int n;
    cin>>n;
    int r[n],l[n];
    for(int i=0;i<n;i++)
    {
        r[i]=0;
        l[i]=0;
    }
    string str;
    cin>>str;
    
    if(str[0]=='W')
        l[0] = 1;
    else
        r[0]=1;

    for(int i=1;i<n;i++)
    {
        if(str[i]=='W')
            l[i] = l[i-1]+1;
        else
            l[i]=l[i-1];

        if(str[i]=='E')
            r[i] = r[i-1]+1;
        else
            r[i]=r[i-1];
    }
    int ans = r[n-1];
    for(int i=1;i<n;i++)
    {
        //cout<<l[i-1]+r[n-1]-r[i-1]<<"\n";
        ans = min(ans,l[i-1]+r[n-1]-r[i-1] + (str[i]=='E'?-1:0));
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 5508
n, q = map(int, input().split())
# initialize
par = [-1] * n
rank = [0] * n

# Union Find Tree
def find(x):
    """ 根ノードの値を見つけて返す """
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    """xとyを結合する"""
    rootx = find(x)
    rooty = find(y)

    if rootx == rooty:
        return False
    else:
        if rank[rootx] < rank[rooty]:
            par[rootx] = rooty
        else:
            par[rooty] = rootx
            if rank[rootx] == rank[rooty]: rank[rootx] += 1
        return True

def same(x, y):
    return find(x) == find(y)


for _ in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        unite(x, y)
    elif com == 1:
        if same(x, y):
            print(1)
        else:
            print(0)



Measured memory_bytes: 5768
#!/usr/bin/env python3
import sys


def solve(N: int):
    print((N-1)*(N)//2)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	lint X, Y;
	cin >> X >> Y;
	if ((lcm(X, Y) - X) % Y != 0 && (lcm(X, Y) - X) <= 1000000000000000000) {
		cout << (lcm(X, Y) - X) << endl;
	}
	else {
		cout << -1 << endl;
	}
}


Measured memory_bytes: 256
import math

N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

K = 2 * math.factorial(N - 1)
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        d = (x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2
        ans += K * math.sqrt(d) / math.factorial(N)

print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	string s;cin>>s;
	set<char> d;
	rep(i,s.size()) d.insert(s[i]);
	if(d.size()==2) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
	while(true) {
		int m, f, r;
		cin >> m >> f >> r;
		if((m == -1) && (f == -1) && (r == -1))	break;
		
		int sum = m + f;
		if((m == -1) || (f == -1)) {
			cout << 'F' << endl;
		} else if(sum >= 80) {
			cout << 'A' << endl;
		} else if((65 <= sum) && (sum < 80)) {
			cout << 'B' << endl;
		} else if((50 <= sum) && (sum < 65)) {
			cout << 'C' << endl;
		} else if((30 <= sum) && (sum < 50)) {
			if(50 <= r) {
				cout << 'C' << endl;
			} else {
				cout << 'D' << endl;
			}
		} else if(sum < 30) {
			cout << 'F' << endl;
		}
	}
	
    return 0;
}

Measured memory_bytes: 3100
#include<stdio.h>
int main(void)
{
   int a,b,c,d,e,k;
   scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);                          

   if(e-a<=k){
                        printf("Yay!\n");}
   else printf(":(\n");

   return 0;
}


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

int arr[200000];
int dp[200000];
int MOD = 1000000007;
int main() {
    int N; cin>>N;
    for (int i=0; i<N; i++) cin>>arr[i];
    dp[N-1] = arr[N-1];
    for (int i=N-2; i>=0; i--) {
        dp[i] = (dp[i+1] + arr[i]) % MOD;
    }
    long long SUM = 0;
    for (int i=0; i<N-1; i++) {
        SUM += arr[i]*dp[i+1];
        SUM %= MOD;
    }
    cout<<SUM<<endl;
}

Measured memory_bytes: 4716
#include<cstdio>
#include<stdlib.h>

using namespace std;

//#define MAX_N 100
//#define MAX_M 100

char N[4];
//char R[MAX_N][MAX_M];


int main(){
  scanf("%s",N);
  
  bool b=true;
  for(int i=0;i<4-1;i++){
    if(N[i]==N[i+1]){
      b=false;
      break;
    }
  }
  
  if(b==false){
    printf("Bad\n");
  }else{
    printf("Good\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
n = int(input())
    
def md(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

a = md(n)

ans = 0
for i in a:
    b = n // i
    if i < b-1:
        ans += (b-1)
        
print(ans)

Measured memory_bytes: 40048
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define mset(x) memset(x, 0, sizeof(x))
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s;
    cin >> s;
    if (s[0] == 'S') cout << "Cloudy" << endl;
    else if (s[0] == 'C') cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
}


Measured memory_bytes: 3616
l  = []

n, k = map(int, input().split())
for _ in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for i in range(1, n+1):
        for j in A:
            if i == j:
                break
        else:
            l.append(i)

import collections
d = collections.Counter(l)
l2 = []
for u, v in d.items():
    if v == k:
        l2.append(u) 

print(len(l2))

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

int main(){
	int a,b,c,ans;
	cin >> a >> b >> c;
	ans = a * 100 + b * 10 + c;
	if(ans % 4 == 0)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
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():
    x,t = LI()

    return max(x-t,0)


print(main())






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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll comb[60][60];

void COMinit(int n){
	REP(i, n+1){
		REP(j, i+1){
			if(j==0 || j==i){
				comb[i][j]=1;
			}
			else{
				comb[i][j]=comb[i-1][j-1]+comb[i-1][j];
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a, b;
	ll v[60];
	cin>>n>>a>>b;
	REP(i, n){
		cin>>v[i];
	}
	sort(v, v+n, greater<ll>());
	double sum=0.0;
	int c=0;
	REP(i, a){
		sum+=v[i];
		if(i>0 && v[i-1]!=v[i]){
			c=i;
		}
	}
	COMinit(n);
	ll ans=0;
	ll d=upper_bound(v, v+n, v[a-1], greater<ll>())-lower_bound(v, v+n, v[a-1], greater<ll>());
	if(c!=0){
		ans=comb[d][a-c];
	}
	else{
		FOR(i, a, b+1){
			ans+=comb[d][i];
		}
	}

	cout.precision(10);
	cout<<fixed<<sum/a<<'\n';
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
const int A = 2e3;
const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    ll cnt = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (1LL * i * j >= n) break;
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define each(i,mp) for(auto& i:mp)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  string s;cin>>s;
  string t;cin>>t;
  bool e=true;
  rep(i,0,s.size()){
    if(s[i]!=t[i])e=false;
  }

  if(e)out("Yes");
  else out("No");



  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using vl = vector<ll>;
using mat = vector<vl>;

const ll mod = 1e9+7;

mat mul(const mat &a, const mat &b)
{
    int n = a.size();
    mat c(n,vl(n));
    rep(i,n)rep(j,n)rep(k,n) (c[i][j]+=a[i][k]*b[k][j])%=mod;
    return c;
}

vl mul(const mat &a, const vl &b)
{
    int n = a.size();
    vl c(n);
    rep(i,n)rep(j,n) (c[i]+=a[i][j]*b[j])%=mod;
    return c;
}

mat mat_pow(const mat &a, int T)
{
    int n = a.size();
    mat ret(n,vl(n));
    rep(i,n) ret[i][i] = 1;

    mat p(a);
    while(T)
    {
        if(T&1) ret = mul(ret,p);
        p = mul(p,p);
        T>>=1;
    }
    return ret;
}

int main()
{
    int n,k,C,T;
    cin >>n >>k >>C >>T;
    --C;

    vector<int> a(k),b(k),t(k);
    rep(i,k)
    {
        cin >>a[i] >>b[i] >>t[i];
        --a[i];
    }

    int SZ = 5*n;

    mat A(SZ,vl(SZ));
    // make A
    for(int i=n; i<5*n; ++i) A[i-n][i] += 1;
    rep(i,k)
    {
        rep(j,n)
        {
            int idx = (t[i]-1)*n+j;
            if(j<a[i]) idx += b[i];
            else if(j<a[i]+b[i]) idx -= a[i];

            A[idx][j] += 1;
        }
    }

    vl B(SZ);
    B[C] = 1;

    vl res = mul(mat_pow(A,T),B);
    cout << res[0] << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define INF 1000000000

int main() {

	int k;
	cin >> k;
	cout << k / 2 * (k - k / 2) << endl;
	
	return 0;
}

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

ll dp[1000010][2];
int main() {
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	ll ans=INF;
	for(ll i=0;i<1000010;i++){
		for(ll j=0;j<2;j++){
			dp[i][j]=INF;
		}
	}
	dp[0][0]=0;
	for(ll i=0;i<s.size();i++){
		ll now=s[i]-'0';
		dp[i+1][0]=min(dp[i+1][0],dp[i][0]+now);
		dp[i+1][1]=min(dp[i+1][1],dp[i][0]+10-now);
		dp[i+1][0]=min(dp[i+1][0],dp[i][1]+now+1);
		dp[i+1][1]=min(dp[i+1][1],dp[i][1]+10-(now+1));
		if(i==s.size()-1){
		ans=min(ans,dp[i+1][0]);
		ans=min(ans,dp[i+1][1]+1);
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 17028
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
string s[10] = {"pon","pon","hon","bon","hon","hon","pon","hon","pon","hon"};
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> n;
    cout << s[n%10];
}

Measured memory_bytes: 3652
n = int(input())
d = [str(i) for i in range(1, n+1)]
data = [0] * 100
answer = 0
for i in range(1, n+1):
    a = int(list(str(i))[0])
    b = int(list(str(i))[-1])
    data[a*10 + b] += 1
for i in range(1, 10):
    for j in range(1, 10):
        answer += data[i*10 + j] * data[j*10 + i]
print(answer)


Measured memory_bytes: 15768
#include <iostream>
#include <stack>
#include <map>

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

typedef pair<int, int> P;
const int dx[] = { 1, -1, 0, 0 };
const int dy[] = { 0, 0, 1, -1 };
char fie[12][13];

int main(){
    while (cin >> fie[0]){
        loop(i, 1, 12) cin >> fie[i];
        int n = 0;
        rep(i, 12)rep(j, 12){
            if (fie[j][i] == '1'){
                n++;
                stack<P> q;
                q.push(P(i, j));
                while (q.size()){
                    P s = q.top();
                    q.pop();
                    int x = s.first, y = s.second;
                    fie[y][x] = '0';
                    rep(i, 4){
                        int xx = x + dx[i], yy = y + dy[i];
                        if (fie[yy][xx] == '1') q.push(P(xx, yy));
                    }
                }
            }
        }
        cout << n << endl;
    }
}

Measured memory_bytes: 1180
def main():
    n = int(input())
    S = {}

    for _ in range(n):
        s = input()

        if s in S:
            S[s] +=1
        else:
            S[s] = 1
    
    m = int(input())
    
    for _ in range(m):
        t = input()

        if t in S:
            S[t] -= 1
        else:
            S[t] = -1
    
    print(max(0, max(list(S.values()))))

if __name__ == '__main__':
    main()

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

int main (int argc, char **argv) {
  int S;
  cin >> S;

  int s, m, h;
  s = S % 60;
  m = (S / 60) % 60;
  h = S / (60 * 60);

  cout << h << ":" << m << ":" << s << endl;
}

Measured memory_bytes: 1164