akhauriyash/Code-Regression huggingface dataset:
/// a.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,a,b;
    fi>>n>>a>>b;
    if (a == b)
    {
        fo << "1\n";
        return 0;
    }
    if (b < a)
    {
        fo << "0\n";
        return 0;
    }
    if (n < 2)
    {
        fo << "0\n";
        return 0;
    }
    n -= 2;
    fo << (1ll * n * b - 1ll * n * a + 1) << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


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

namespace _0259
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string n = RSt();
                if (n == "0000") break;

                if (n.Distinct().Count() == 1)
                {
                    Console.WriteLine("NA");
                }
                else
                {
                    int cnt = 0;
                    while (n != "6174")
                    {
                        string l = new string(n.OrderByDescending(x => x).ToArray());
                        string s = string.Join("", l.Reverse());
                        n = (int.Parse(l) - int.Parse(s)).ToString().PadLeft(4, '0');
                        cnt++;
                    }
                    Console.WriteLine(cnt);
                }
            }
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 20596
#define _USE_MATH_DEFINES
#include <math.h>
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    int x[n];
    for(int i = 0;i < n;i++)
    {
        cin >> x[i];
    }
    long long int ans = LLONG_MAX;
    for(int i = 0;i + k <= n;i++)
    {
        long long int temp = min(fabs(x[i]) + x[i + k - 1] - x[i],fabs(x[i + k - 1]) + x[i + k - 1] - x[i]);
        if(temp < ans)
        {
            ans = temp;
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<cstring>
#include<functional>

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	int n;
	long long d;

	scanf("%d %lld", &n, &d);

	int sol = 0;
	
	for (int i = 0; i < n; i++)
	{
		long long x, y;

		scanf("%lld %lld", &x, &y);

		sol += (x*x + y*y <= d*d);
	}

	printf("%d\n", sol);

	return 0;
}

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

using namespace std;

ifstream f("anticub.in");

const long long maxim = 100005 ;
bool ciur[maxim + 10];
vector < long long > prime;

void era()
{

    for (int i = 4; i <= maxim; i += 2)
        ciur[i] = 1;
    for (int i = 3; i * i <= maxim; ++ i)
        if (!ciur[i])
            for (int j = i * i; j <= maxim; j += 2 * i)
                ciur[j] = 1;
    prime.push_back(2);
    for (int i = 3; i <= maxim; ++ i)
        if (!ciur[i])
            prime.push_back(i);

}

map < long long , long long>  monMap;
map < long long, pair <long long, long long >  > memo;
long long  a[100009];


void make(long long x)
{
    if (memo[x].first != 0)
    {
        monMap[memo[x].first] ++;
        return;

    }
    long long nucomb, k;
    long long aux = x;

    k = nucomb = 1;
    if ( x > maxim ||  ciur[x] == 1)
        for (int d = 0; d < prime.size() && x != 1 && prime[d] * prime[d] <= x; ++ d)
        {
            long long  con = 0;
            while (x % prime[d] == 0)
            {
                con ++;
                x /= prime[d];
            }
            if (con % 3 == 1)
            {
                k *= prime[d];
                nucomb *= prime[d] * prime[d];
            }
            if (con % 3 == 2)
            {
                k *= prime[d] * prime[d];
                nucomb *= prime[d] ;
            }

        }
    if (x != 1)
    {
        k *= x;
        nucomb *= x * x;
    }
    monMap[k]++;
    memo[aux].first = k;
    memo[aux].second = nucomb;



}


int main()
{
    int n;
    cin >>n;
    era();

    for (int i = 1; i <= n; ++ i)
    {
        cin >>a[i];
        make(a[i]);
    }

    int ans = 0;
    for (int i = 1; i <= n; ++ i)
    {

        if (memo[a[i]].second == 1 && monMap[1])
            ans++;
        else
        {
           // cout << monMap[memo[a[i]].first] << " " <<monMap[memo[a[i]].second] << endl;
            ans += max(monMap[memo[a[i]].first], monMap[memo[a[i]].second]);
        }

        monMap[memo[a[i]].first] = monMap[memo[a[i]].second] = 0;
    }

    cout << ans;


}

Measured memory_bytes: 19968
S = input()

count_0101 = 0
count_1010 = 0

for i, s in enumerate(S):
	if i & 1:
		if '1' == s:
			count_1010 += 1
		else:
			count_0101 += 1
	else:
		if '1' == s:
			count_0101 += 1
		else:
			count_1010 += 1

print(min(count_0101, count_1010))


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

int main() {
	int n, a, b[100010], tog, max = 0;
	cin >> n;
	for (int i = 0; i <= 100000; i++) b[i] = 0;
	for (int i = 1; i <= n; i++) {
	    cin >> a;
	    b[a]++;
	}
	tog = b[0] + b[1] + b[2];
	max = tog;
	for (int i = 3; i <= 100000; i++) {
	    tog += (b[i] - b[i - 3]);
	    if (tog > max) max = tog;
	}
	cout << max;
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
  int a,b,c,d;
  int ab,cd;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  ab=a*b;
  cd=c*d;
  printf("%d\n",ab>cd?ab:cd);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll a[114514], b[114514];
signed main() {
	ll n, ans = 0;
	cin >> n;
	rep(i, n + 1)cin >> a[i];
	rep(i, n)cin >> b[i];
	rep(i, n) {
		ans += min(b[i], a[i] + a[i + 1]);
		a[i + 1] = min(a[i + 1], max((ll)0, a[i] + a[i + 1] - b[i]));
	}
	cout << ans << endl;
	ggr
}

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

int main(){
    int W,a,b;
    cin >> W >> a >> b;
    if(a+W<b) cout << b-(a+W) << endl;
    else if(b+W<a) cout << a-(W+b) << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<long> vl;
typedef vector<vector<long> > vvl;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

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

    char middle = 'a' + S[K - 1] - 'A';
    cout << S.substr(0, K - 1) << middle << S.substr(K, S.size()) << endl;
    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()     // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()  // 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

int main() {
	char week[7][4] = { {"thu"}, {"fri"}, {"sat"}, {"sun"}, {"mon"}, {"tue"}, {"wed"} };
	int x;
	cin >> x;
	cout << week[x % 7] << endl;
}


Measured memory_bytes: 3100
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(N), B(N);
	for (int i = 0; i < N; ++i) cin >> A[i] >> B[i];
	if (A == B) cout << 0 << endl;
	else {
		long long sum = 0;
		int mn = (1 << 30);
		for (int i = 0; i < N; ++i) {
			sum += B[i];
			if (A[i] > B[i]) mn = min(mn, B[i]);
		}
		cout << sum - mn << endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i=2; i<=n; i++)
#define rep2(i,n) for(int i=0; i<n; i++)
bool isprime(int n){
	rep(i,sqrt(n)){
		if(n%i==0) return false;
	}
	return true;
}
int main(){
	int n, ans;
	bool table[1000000];
	rep2(i,1000000) table[i]=true;
	rep(i,1000000){
		if(table[i] && isprime(i)){
			rep(j,999999/i) table[i*j]=false;
		}
	}
	while(cin >> n){
		ans=0;
		rep(i,n) if(table[i]) ans++;
		cout << ans << endl;
	}
    return 0;
}

Measured memory_bytes: 2132
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
#include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
	void sort(std::vector<int>* vec) {
		std::sort(vec->begin(), vec->end());
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	const int rei = data->getNum()[0], den = data->getNum()[1], war = data->getNum()[2];

	AtCoder::Num Rei;
	data->getInput();
	Rei = data->getNum();

	AtCoder::Num Den;
	data->getInput();
	Den = data->getNum();

	AtCoder::Num War;
	for (int i = 0; i < war; i++) {
		data->getInput();
		const int reiIndex = (data->getNum()[0] - 1), denIndex = (data->getNum()[1] - 1), ka = data->getNum()[2];
		const int ssum = (Rei[reiIndex] + Den[denIndex]) - ka;
		War.push_back(ssum);
	}

	AtCoder::sort(&Rei);
	AtCoder::sort(&Den);

	{
		const int ssum = ( Rei[0] + Den[0] );
		War.push_back(ssum);
	}

	AtCoder::sort(&War);

	const int ans = War[0];

	printf("%d\n", ans);

	delete(data);

	return 0;
}


Measured memory_bytes: 7796
#include <stdio.h>

int main()
{
    long long int a = 0, b = 0, n = 0;
    char c;
    while (scanf("%c", &c) != EOF) {
        if (n%2==0) {
            if (c == '0'){
                a++;
            } else if (c == '1'){
                b++;
            }
        } else if (n%2==1){
            if (c == '0'){
                b++;
            } else if (c == '1'){
                a++;
            }
        }
        n++;
    }
    printf("%lld\n", a<b?a:b);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

ll MOD = 1e9 + 7;

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

	string L;
	cin >> L;

	int n = L.size();
	vector<vector<ll>> dp(n+1, vector<ll>(2, 0));
	dp[0][1] = 1;

	for(int i = 0; i < n; i++){
		// 1 -> 1
		if(L[i] == '0'){
			dp[i+1][1] += dp[i][1];
			dp[i+1][1] %= MOD;
		}else{
			dp[i+1][1] += dp[i][1] * 2;
			dp[i+1][1] %= MOD;
		}

		// 1 -> 0
		if(L[i] == '1'){
			dp[i+1][0] += dp[i][1];
			dp[i+1][0] %= MOD;
		}

		// 0 -> 0
		dp[i+1][0] += dp[i][0] * 3;
		dp[i+1][0] %= MOD;
	}

	cout << (dp[n][0] + dp[n][1]) % MOD << endl;
}


Measured memory_bytes: 5840
W,H,X,Y,R = map(int, open(0).read().split())

x0 = X - R
x1 = X + R
y0 = Y - R
y1 = Y + R
if x0 >= 0 and x1 <= W and y0 >= 0 and y1 <= H:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
using namespace std;
#define INF 1010101010
#define MOD 1000000007
#define LL long long
using Coord = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a + b) % 24 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	double f;
	long a,b,d,r;
	
	cin>>a>>b;
	d=a/b;
	r=a%b;
	f=(double)a/b;
	printf("%ld %ld %lf\n",d,r,f);
	return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<double> p(n+1);
    vector<double> sum(n+1);
    double ans = 0;
    for(int i = 1; i <= n; i++){
        double a;
        cin >> a;
        p[i] = (a+1)/2;
        sum[i] = sum[i-1] + p[i];   
    }
    for(int i = k; i <= n; i++){
        ans = max(ans, sum[i] - sum[i-k]);
    }
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 6428
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s: String,
    }
    let ans = if s == "RRR" {
        3
    } else if s.contains("RR") {
        2
    } else if s.contains("R") {
        1
    } else {
        0
    };

    println!("{}", ans);
}


Measured memory_bytes: 2136
<?php
$tmp = explode(' ', trim(fgets(STDIN)));
$H = (int)$tmp[0];
$W = (int)$tmp[1];
$tmp = explode(' ', trim(fgets(STDIN)));
$h = (int)$tmp[0];
$w = (int)$tmp[1];
echo (($H-$h)*($W-$w))."\n";


Measured memory_bytes: 4604
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cstdio>

using namespace std;

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

static const double eps = 1e-8;

int dp[5001][5001];

int main(){
  int num_of_A,num_of_B;
  while(~scanf("%d %d",&num_of_A,&num_of_B)){
    int A[5001];
    int B[5001];
    for(int i = 0; i < num_of_A; i++){
      scanf("%d",A + i);
    }
    for(int i = 0; i < num_of_B; i++){
      scanf("%d",B + i);
    }


    int res = 0;
    for(int start = 0; start < num_of_B; start++){
      int j = 0;
      for(int i = start; i < num_of_B;){
        for(; j < num_of_A; j++){
          if(B[i] == A[j]){
            i++;
            res = max(res,i - start);
          }
        }
        break;
      }
    }

    printf("%d\n",res);
  }
}

Measured memory_bytes: 1228
#include <sstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>
#define int long long
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define REP(i, a) for (int i = 0, _a = (a); i < _a; ++i)

#define DEBUG(X) { cerr << #X << " = " << (X) << endl; }
#define PR(A, n) { cerr << #A << " = "; FOR(_, 1, n) cerr << A[_] << ' '; cerr << endl; }
#define PR0(A, n) { cerr << #A << " = "; REP(_, n) cerr << A[_] << ' '; cerr << endl; }

#define sqr(x) ((x) * (x))
#define ll long long
#define __builtin_popcount __builtin_popcountll
#define SZ(x) ((int)(x).size())
using namespace std;

double safe_sqrt(double x) { return sqrt(max((double)0.0, x)); }
int GI(int& x) { return scanf("%lld", &x); }

int get(int n, int p) {
    if (n < p) return 0;
    return n / p + get(n/p, p);
}

bool isPrime(int n) {
    for(int i = 2; i*i <= n; i++)
        if (n % i == 0) return 0;
    return n > 1;
}

int sieve[1011];

#undef int
int main() {
#define int long long
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << (fixed) << setprecision(9);
    int n;
    while (cin >> n) {
        memset(sieve, 0, sizeof sieve);

        const int MOD = 1e9 + 7;
        int res = 1;
        FOR(i,2,n) if (isPrime(i)) {
            int k = get(n, i);

            res = res * (k + 1) % MOD;
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

const double M_PI_U = 3.14159265358979323846264338327950L;


void solve(double A, double B, double H, double M){
    double s = double(M/60.0) * 30.0;
    double A_d = H * 30.0 + (double)(s);
    double B_d = M * 6.0;
    double degree = abs(A_d -B_d);

    double c_2 = pow(A , 2.000000000) + pow(B, 2.0000000000) -  2.00000000000 * A * B * cos(double(degree) * M_PI_U / 180.0000000000);
    printf("%20.20f", sqrt(c_2));
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    double A;
    scanf("%lf",&A);
    double B;
    scanf("%lf",&B);
    double H;
    scanf("%lf",&H);
    double M;
    scanf("%lf",&M);
    solve(A, B, H, M);
    return 0;
}


Measured memory_bytes: 4288
import sys
import copy
input = sys.stdin.readline

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

SUM=0
for a in A:
    SUM+=a
    if SUM>=K:
        MAX_NO_NEED=a
        break

else:
    print(N)
    sys.exit()
        

MAX=A.index(MAX_NO_NEED)-1

A=[a for a in A if a<K]
L=len(A)

MIN=-1
MAX=min(MAX,L-1)

while MIN!=MAX:

    x=(MIN+MAX+1)//2
    base=A[x]

    SET={base}
    flag=0
    
    for i in range(L):
        #print(x,i,SET)
        if i==x:
            continue
        a=A[i]
        NSET=copy.copy(SET)
        
        for j in SET:
            
            if K<=a+j<K+base:
                flag=1
                break
            elif a+j<K:
                NSET.add(a+j)

        if flag==1:
            #print(x,SET)
            MAX=x-1
            break

        SET=NSET

    else:
        MIN=x
        continue

print(MIN+1)

    


Measured memory_bytes: 102620
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;


    cin >> n;
    for (int i = 0; i < n; i++) cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for (int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}


Measured memory_bytes: 3848
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <string.h>

using namespace std;
#define ll long long int

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	string n;
	// ll n,m;
	cin>>n;
	bool flag=true;
	ll p=n.size();
	// cout<<p<<endl;
	for (int i = 1; i <= p/2; ++i)
	{
		if(n[i-1]!=n[p-i]){
			flag=false;
			cout<<"No";
			break;
		}
	}
	if(flag){
		for (int i = 1; i <= p/4; ++i)
		{
			if(n[i-1]!=n[p/2-i] || n[p/2+i]!=n[p-i]){
				flag=false;
				cout<<"No";
				break;
			}
		}
	}
	if(flag){
		cout<<"Yes";
	}
	// cout<<((n*(n-1))+(m*(m-1)))/2;

	return 0;
}

Measured memory_bytes: 256
#include "iostream"

using namespace std;

int main()
{
	int s;
	cin >> s;
	int h = s / 3600;
	s -= h * 3600;
	int m = s / 60;
	s -= m * 60;
	cout << h << ":" << m << ":" << s << endl;

    return 0;
}

Measured memory_bytes: 1168
#include <stdio.h>
int F[45];

int fib(int);

int main(){
  int n,i;

  for(i = 0; i < 45; i++) F[i] = 0;

  scanf("%d",&n);

  n = fib(n);

  printf("%d\n",n);

  return 0;
}

int fib(int n){
  if(n == 0 || n == 1) return F[n] = 1;
  if(F[n]) return F[n];
  return F[n] = fib(n - 1) + fib(n - 2);
}



Measured memory_bytes: 2104
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cassert>
#include<deque>
using namespace std;

#define sz(x) (int)(x.size())
#define fr(i,a,b) for(int i=a;i<b;++i)
#define fdr(i,a,b) for(int i=b-1;i>=a;--i)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
//////////////////////

int const N = 1e5 + 41;
int const MOD = 1e9 + 7;

void add(int &a, int b){
	a += b;
	a %= MOD;
	if(a >= MOD) a -= MOD;
	if(a < 0) a += MOD;
}

int mul(int a, int b){
	return a * 1LL * b % MOD;
}

int bp(int x, int d){
	if(!d) return 1;
	if(d&1) return mul(x, bp(x, d-1));
	int r = bp(x, d/2);
	return mul(r, r);
}

int f[N], invf[N];

int getC(int k, int n){
	if(k > n) return 0;
	int ret = f[n];
	ret = mul(ret, invf[k]);
	ret = mul(ret, invf[n-k]);
	return ret;
}

int n;
int a[N];
int w[N], p1, p2;
int ans[N];

void solve(){
	cin >> n;
	fr(i, 0, N) w[i] = -1;
	fr(i, 0, n+1){
		cin >> a[i];
		if(w[a[i]] != -1){
			p1 = w[a[i]];
			p2 = i;
		}
		w[a[i]] = i;
	}
	f[0] = invf[0] = 1;
	fr(i, 1, N){
		f[i] = mul(f[i-1], i);
		invf[i] = bp(f[i], MOD-2);
	}
	fr(i, 1, n){
		add(ans[i], getC(i, n-1));
	}
	fr(i, 0, n) add(ans[i+1], getC(i, n-1));
	fr(i, 0, n) add(ans[i+1], getC(i, n-1));
	fr(i, 0, n) add(ans[i+2], getC(i, n-1));
	int b = p2 - p1 + 1;
	fr(i, 0, n+2-b){
		add(ans[i+1], -getC(i, n+1-b));
	}
	fr(i, 1, n+2) cout << ans[i] << endl;
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	solve();

	return 0;
}

Measured memory_bytes: 3200
//solve the same using multiset
#include "iostream"
#include "set"
using namespace std;
int main()
{
    int n;
    cin>>n;
    multiset<int > m;
    int k;
    int i;
    for( k=0;k<n-1;k++)
    {
        cin>>i;
        m.insert(i);
    }
    
    for(int l=1;l<=n;l++)
    {
        cout<<m.count(l)<<endl;
    }
    
    
}


Measured memory_bytes: 12540
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start < end) {
			f(start)
			loop(start + 1, end)(f)
		}

	val s, t = Scanner.next

	pw.println(if (s == t.init) "Yes" else "No")
	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 54552
import math ,sys
x,y = map(int,input().split())
if (x+y)%3!=0:
  print(0)
  sys.exit()
n=(x+y)//3
r=y-n
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n]*g2[r] *g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

a = cmb(n,r,mod)

print(a)

Measured memory_bytes: 121840
//
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define speed ios::sync_with_stdio(false)
using namespace std;

string gs(char x){
    string s(1,x);
    return s;
}

bool comp(ll a,ll b)
{
	return a>b;
}

int main()
{
	speed;
	
	ll a,b;
	cin>>a>>b;

	ll c=b-a;
	c--;
	c=(c*(c+1))/2;
	c-=a;
	cout<<c;

	return 0;
}

Measured memory_bytes: 256
def DFS(adj, start):
    n = len(adj)
    d = [0] * n
    f = [0] * n
    flag = [0] * n
    S = []
    time = 1

    S.append(start)
    flag[start] = 1
    d[start] = time
    time = time + 1
    
    while flag.count(2) != n: # ??¨????????????????????¢?´¢????????????????????§
        if len(S) != 0:
            u = S.pop()
            v = next(adj, u)
            v = [i for i in v if flag[i] == 0] # v <= ??£??\???????????????????????¢?´¢??????????????????
            if len(v) != 0:
                S.append(u)
                S.append(v[0])
                flag[v[0]] = 1
                d[v[0]] = time
                time = time + 1
            else:
            #??£??\??????????????¨????¨??????????
                flag[u] = 2
                f[u] = time
                time = time + 1

        else:
            u = flag.index(0)
            S.append(u)
            flag[u] = 1
            d[u] = time
            time = time + 1            

    return d, f



def next(adj, u):
    """
    u?????£??\??????????????????????????????????????????
    """
    return [i for i, x in enumerate(adj[u]) if x == 1]
    

def main():
    
    n = int(input())
    adj = [[0 for i in range(n)] for j in range(n)]

    for i in range(n):
        tmp = list(map(int, input().split()))
        u = tmp[0]
        u = u -1
        k = tmp[1]
        v = tmp[2:]
        for j in range(k):
            adj[u][v[j]-1] = 1
    
    d, f = DFS(adj, 0)
    for i in range(n):
        print(i+1, d[i], f[i])

if __name__ == "__main__":
    main()    

Measured memory_bytes: 7944
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
 
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007
 
#define ARRAY_MAX 1005
 
int main(){

    int n,m,a;
    while(cin >> n >> m >> a,n){
        int now = a;//今いる縦棒の番号
        vector<P> a[ARRAY_MAX];//各段の横棒のついている両端の棒番号の管理用
        int maxi = -1;//最大の高さ
        REP(i,m){
            int h,p,q;
            cin >> h >> p >> q;
            a[h].push_back({p,q});
            a[h].push_back({q,p});
            maxi = max(maxi,h);
        }
        for(int i = maxi;i > 0;i--){
            //高さiを見る
            REP(j,a[i].size()){
                //高さiにある横棒
                if(a[i][j].first == now){
                    //今いる棒とつながっているので移動する
                    now = a[i][j].second;
                    break;
                }
            }
        }
        cout << now << endl;
    }




    return 0;
}


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  llvec A(N);
  rep(i, N)cin >> A[i];
  llvec B = A;
  sort(ALL(A));
  rep(i, N){
    if(B[i]<=A[N/2-1]){
      cout <<A[N/2]<<endl;
    }else{
      cout <<A[N/2-1]<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 5376
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
n, k = list(map(int, input().split()))
d = [0]*k
A = []
for i in range(k):
    d[i] = int(input())
    A.extend(list(map(int, input().split())))
# print(set(A))

print(n-len(set(A)))


Measured memory_bytes: 27088
def main():
    month, day = map(int, input().split())
    answer = 0
    for m in range(1, month + 1):
        for d in range(1, day + 1):
            if (d % 10) * (d // 10) == m and (d % 10) > 1 and (d // 10) > 1:
                answer += 1
    print(answer)


if __name__ == '__main__':
    main()



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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
    int n,k,q;
    while (cin >> n >> k >> q) {
        map<int,int> cnt;
        FOR(i,0,q) {
            int a; cin >> a; cnt[a]++;
        }
        FOR(i,1,n+1) {
            if (k-q+cnt[i] > 0)
                cout << "Yes" << endl;
            else
                cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 6400
#include<bits/stdc++.h>
#define int long long
using namespace std;

const int M = 1e18+7;

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

    int n , c;
    cin >> n >> c;
    int v[n+1] , w[n+1] , mv = 0;
    for(int i = 1; i <= n; i++) {
        cin >> w[i] >> v[i];
        mv = max(mv , v[i]);
    }
    mv = n*mv;
    vector<vector<int>> dp(2 , vector<int>(mv+1 , M));
    dp[0][0] = 0 , dp[1][0] = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= mv; j++) {
            if(j-v[i] >= 0) dp[1][j] = min(dp[1][j] , w[i]+dp[0][j-v[i]]);
            dp[1][j] = min(dp[1][j] , dp[0][j]);
        }
        for(int j = 1; j <= mv; j++) dp[0][j] = dp[1][j] , dp[1][j] = M;
    }
    int ans = 0;
    for(int i = 0; i <= mv; i++) {
        if(dp[0][i] <= c) ans = i;
    }   
    cout << ans << "\n";

    return 0;
}

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

long long b[100];

long long c[100];

long long  a( long long k) {
     if (k==0){
	    
	    return 1;
	 }
	 else {
	    return 2*a(k-1)+3;
	 }
	 
} 

long long  p(long long y){
     if(y==0){
	    return 1;
	 }
	 else {
	    return 2*p(y-1)+1; 
	 }
}

long long res (long long m , long long n){


     if(m==0){
       if(n==0)return 0;
	   else {
	      return 1;
	   }	  
     }   
	 else { 
            if(n==0) return 0;
	 		else if(n>=1&&n<=b[m-1]+1) return res(m-1,n-1);
	        else if(n==b[m-1]+2) return res(m-1,n-2)+1;
            else if(n>=b[m-1]+3) return c[m-1]+1+res(m-1,n-b[m-1]-2);  
	 }

}



int main() {
  int N;
  cin >> N;
  
  long long X;
  cin >> X;
  
  
  for(int i=0 ;i<N;i++){
      b[i]=a(i);
	  c[i]=p(i);
  }
  
  
  long long  r;
  
  r=res(N,X);
  
  
  
  cout << r << endl ;
  
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (int n; cin >> n&&n;) {
		int ans = 0;
		rep(i, 0, n / 4) {
			int a; cin >> a;
			ans += a;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3056
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;

int main() 
{
	int n;
	cin >> n;
	int p[10];
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	if (n < 10) {
		for (int j = 0; j < 10 - n; j++) {
			p[j + n ] = 0;
		}
	}


	int max = 100;
	for (int k = 0; k < n; k++) {
		if (p[k] > max) {
			max = p[k];
		}
	}

	int sum = 0;

	for (int i = 0; i < n; i++) {
		sum += p[i];
	}


	cout << sum - max / 2 << endl;



}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,k,a[200005],aa,j,ans,cnt;
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d",&aa);
		a[aa]++;
	}
	sort(a+1,a+n+1);
	while(a[j]==0) j++;
	cnt=n-j+1;
	while(cnt>k){
		ans+=a[j];
  		j++;
		cnt--;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int n,l;
#define N 500005
struct W
{
	double t;
	int v;
} q[N];
double t;
int v;
int head=1,tail=0;
double sum;
int main()
{
	scanf("%d%d",&n,&l);
	scanf("%lf%d",&q[1].t,&q[1].v);tail++;
	printf("%.7lf\n",q[1].t);
	sum=1ll*q[1].t*q[1].v;
	for(int i=2;i<=n;i++)
	{
		scanf("%lf%d",&t,&v);
		int cnt=v;
		while(head<=tail&&cnt)
		{
			if(cnt>=q[head].v)
			{
				cnt-=q[head].v;
				sum-=1ll*q[head].t*q[head].v;
				head++;
			}
			else
			{
				q[head].v-=cnt;
				sum-=1ll*q[head].t*cnt;
				break;
			}
		}
		if(q[tail].t<=t)
		{
			tail++;
			q[tail].t=t;
			q[tail].v=v;
			sum+=1ll*t*v;
		}
		else
		{
			q[tail].t=(1ll*q[tail].t*q[tail].v+1ll*t*v)/(q[tail].v+v);
			q[tail].v+=v;
			sum+=1ll*t*v;
			while(head<tail&&q[tail-1].t>q[tail].t)
			{
				tail--;
				q[tail].t=(1ll*q[tail].t*q[tail].v+1ll*q[tail+1].t*q[tail+1].v)/(q[tail].v+q[tail+1].v);
				q[tail].v+=q[tail+1].v;
			}
			//tail++;
			//sum+=1ll*t*v;
			//q[tail].t=sum/l;
			//q[tail].v=l;
			//head=tail;
		}
		printf("%.7lf\n",sum/l);
	}
	return 0;
}

Measured memory_bytes: 16896
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	ll n, k;
	cin >> k >> n;
	ll res = 1;
	for (ll i = 1; i*i <= n; ++i) {
		if(n%i==0){
			ll j=i;
			for(int it=0;it<2;++it){
				ll i=it==0?j:n/j;
				if(i==1)
					continue;
				int cur=0;
				ll z=n;
				while(z%i==0){
					++cur;
					z/=i;
				}
				if(cur>=k)
					res=max(res,i);
			}
		}
	}
	cout<<res<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

struct edge{
    int to, from, cost;
    edge(){};
    edge(int t, int f, int c) : to(t), from(f), cost(c){};
};

const ll INFTY = 1e50;

int main(){
    int N,M; cin >> N >> M;
    int a,b,c;
    vector<edge> es(M);
    for(int i=0;i<M;i++){
        cin >> a >> b >> c;
        a--; b--;
        es[i] = edge(b,a,-c);
    }

    bool neg_loop = false;
    vector<ll> dist(N, INFTY);
    dist[0] = 0;
    for(int i=0;i<2*N;i++){
        for(int j=0;j<M;j++){
            edge e = es[j];
            if(dist[e.from] != INFTY && dist[e.to] > dist[e.from] + e.cost){
                dist[e.to] = dist[e.from] + e.cost;
                if(i >= N-1 && e.to == N-1){
                    neg_loop = true;
                }
            }
        }
    }

    if(neg_loop){
        cout << "inf" << endl;
    }else{
        cout << -dist[N-1] << endl;
    }
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Int int64_t
 
using namespace std;
 
int main() {
	constexpr Int MOD = 1e9 + 7;
	Int N;
	cin >> N;
	vector<Int> C(N);
	for (int i = 0; i < N; ++i) { cin >> C[i]; }

	vector<Int> x(500010, 0);
	x[0] = 1;
	for (int i = 1; i < x.size(); ++i) {
		x[i] = x[i - 1] * 2 % MOD;
	}

	sort(C.begin(), C.end());
	Int ans = C[N - 1] * x[2 * N - 1] % MOD;
	for (int i = 1; i < N; ++i) {
		Int y = x[N - i - 1] * (N - i + 2) % MOD;
		(ans += C[i - 1] * y % MOD * x[N + i - 1]) %= MOD;
	}
	cout << ans % MOD << endl;

	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h> 
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define per(i,n) for(long long i = (long long)(n-1);i >= 0;--i)
#define REP(i,s,t) for(long long i=s;i<t;i++)
#define PER(i,s,t) for(long long i=s;i>t;--i)
#define all(x) x.begin(),x.end()
#define sp(n) setprecision(n)
typedef long long ll;
using namespace std;
int main(){
  string s;
  cin>>s;
  if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3])){cout<<"Yes"<<endl;}
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 200005
  #define INF 1000000000000
  #define eps 1e-6

int32_t main()
{



    int n,k;
    cin >> n >> k;

    int arr[n+1];

    int pre[n+1];

    for(int i = 1; i <= n; i++)
    {
      cin >> arr[i];
    }

    pre[1] = arr[1];

    for(int i = 2; i <=n; i++)
    {
      pre[i] = pre[i-1] + arr[i];
    }

    double ans = (double)(pre[k] + k)/2;
    for(int i = 1; i <= n-k ; i++)
    {
    double ans1 = (double)(pre[k + i] - pre[i] + k)/2;
    if(ans < ans1)ans = ans1;

    }

    cout << fixed << setprecision(12) << ans;

    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

int main(){
    int x;
    cin >> x;
    if(x == 7 || x == 5 || x == 3)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A.append(0)

buy = A[0]
ans = 1000
for i in range(1, N):
  if A[i] > A[i+1] and buy < A[i]:
    ans = ans % buy + ans // buy * A[i]
    buy = 500
  elif buy > A[i]:
    buy = A[i]
print(ans)

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

int main(){
  string S;
  cin >> S;
  
  rep(i,S.size()){
    S[i] = 'x';
  }
  cout << S << endl;
}


Measured memory_bytes: 256