akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

constexpr double eps = 1e-10;
constexpr double inf = 1e18;
int n;
class point{
public:
	double x, y;
	point(double _x, double _y) : x(_x), y(_y) {}
};
vector<point> p;
vector<int> r;

class Edge{
public:
	double cost;
	int from, to;
	Edge(double c, int f, int t){
		cost = c;
		from = f;
		to = t;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

bool operator < (const Edge &e, const Edge &f){
	return e.cost != f.cost ? e.cost > f.cost : e.from != f.from ? e.from < f.from : e.to < f.to;
}
void dijkstra(int s, const Graph &g, vector<double> &dist){
	int V = g.size();
	dist = vector<double>(V, inf);
	dist[s] = 0;
	priority_queue<Edge> q;
	q.push(Edge(0, s, s));
	while(!q.empty()){
		Edge e = q.top();
		q.pop();
		if(dist[e.to] < e.cost) continue;
		for(int i=0; i<(int)g[e.to].size(); ++i){
			Edge f = g[e.to][i];
			if(dist[f.to] > dist[e.to] + f.cost){
				dist[f.to] = dist[e.to] + f.cost;
				q.push(Edge(dist[f.to], s, f.to));
			}
		}
	}
}

double norm(double x, double y){
	return sqrt(x*x + y*y);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	point s(a, b);
	cin >> a >> b;
	point t(a, b);
	cin >> n;
	for(int i=0; i<n; ++i){
		int tx, ty, tr;
		cin >> tx >> ty >> tr;
		p.push_back(point(tx, ty));
		r.push_back(tr);
	}
	Graph g(n+2);
	for(int i=0; i<n; ++i){
		for(int j=i+1; j<n; ++j){
			double d = norm(p[i].x-p[j].x, p[i].y-p[j].y);
			double e = d + eps < r[i]+r[j] ? 0 : d-r[i]-r[j];
			g[i].push_back(Edge(e, i, j));
			g[j].push_back(Edge(e, j, i));
		}
		double d = norm(p[i].x-s.x, p[i].y-s.y) - r[i];
		if(d <= eps) d = 0.0;
		g[n].push_back(Edge(d, n, i));
		d = norm(p[i].x-t.x, p[i].y-t.y) - r[i];
		if(d <= eps) d = 0.0;
		g[i].push_back(Edge(d, i, n+1));
	}
	vector<double> dist;
	dijkstra(n, g, dist);
	double ans = norm(s.x-t.x, s.y-t.y);
	ans = min(ans, dist[n+1]);
	cout << fixed << setprecision(15) << ans << "\n";
}

Measured memory_bytes: 22548
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
long long M = 1e9+7;
long long power(long long a, long long p)
    {
        if(p==0) return 1;
        long long ans= power(a,p/2);
        ans =(ans * ans) % M;
        if(p%2) ans = (ans*a) % M;
        return ans;
    }

    bool isPrime(long long n)
    {
        if (n <= 1)
            return false;
        for (long long i = 2; i < n; i++)
            if (n % i == 0)
                return false;
        return true;
    }
    long long SieveOfEratosthenes(long long n, long long a)
    {
        bool prime[n+1];
        memset(prime, true, sizeof(prime));
        for (long long p=2; p*p<=n; p++)
        {
            if (prime[p] == true)
            {
                for (long long i=p*p; i<=n; i += p)
                    prime[i] = false;
            }
        }
        for (long long p=2; p<=n; p++)
           if (prime[p])
           {
               if(a%p==0)
               {
                   return (a-p);
               }
           }
    }
    long long nCr(int n, int r)
    {
        if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
        long long ans = 1;
        int i;
        for(i = 1; i <= r; i++) {
            ans *= n - r + i;
            ans /= i;
        }
        return ans;
    }
int main()
{
    IOS;
    long long a,b,c,d,e,h,n,t,f,m,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100001]={0},sum=0,sum1=0,ma=0,ma1=0,mi=1000000000000000001;
    long long g,co3=0,co4=0,co5=0,co6=0,co7=0,co8=0,mul=1,sum2=0,sum3=0,mu=1,mu1=1;
    long long a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,b6;
    double pi=2 * acos (0.0);
    string str,str1,str2,str3,str4,str5,str6;
    char ch,ch1;
    //vector<long long>v; //vector<long long> v(n+1);
    //vector<long long>v1;
    // vector<string>vs;
    // vector<string>vs1;
    vector<char>vc;
    //map<long long,long long>mp;
    map<char,int>mp1;
    //set<long long>s;
    set<long long>s1;
    queue<long long> q;
    //stack<long long> stk;
    //vector< pair<long long,long long> >v3;
    //map<long long,long long>::iterator it;
    //map<string,string>::iterator it;
    // vector<pair<char, pair<int,int> > > v3;
    //vector< pair<char,int > > v1;
    int x[]={1,1,1,0,0,-1,-1,-1};
    int y[]={0,1,-1,1,-1,1,-1,0};
    cin>>a>>b;
    vector<long long>v(b);
    for(int i=0; i<b; i++)
    {
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    for(int i=0; i<b-1; i++)
    {
        c=v[i+1]-v[i];
        ma=max(ma,c);
    }
    ma=max(ma,abs(v[0]+(a-v[b-1])));
    cout<<a-ma<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <stack>
#include <map>
#include <utility>
#include <bitset>
#include <cctype>

using namespace std;
typedef pair<int, int> pii;
typedef bitset<256> bs256;

bool is_number(const string &s){
	for(int i = 0; i < s.size(); ++i){
		if(!isdigit(s[i])){ return false; }
	}
	return true;
}
int to_number(const string &s){
	unsigned int x = 0;
	for(int i = 0; i < s.size(); ++i){ x = (x * 10) + (s[i] - '0'); }
	return x & 0xff;
}

map<string, pii> range;

int main(){
	int m;
	cin >> m;
	for(int i = 0; i < m; ++i){
		string name;
		int lower, upper;
		cin >> name >> lower >> upper;
		range[name] = pii(lower, upper);
	}
	int n;
	cin >> n;
	stack<bs256> stk;
	bool answer = true;
	for(int i = 0; i < n; ++i){
		string s;
		cin >> s;
		if(is_number(s)){
			bs256 bs;
			bs[to_number(s)] = true;
			stk.push(bs);
		}else if(range.find(s) != range.end()){
			pii p = range[s];
			bs256 bs;
			for(int i = p.first; i <= p.second; ++i){ bs[i] = true; }
			stk.push(bs);
		}else{
			bs256 b = stk.top(); stk.pop();
			bs256 a = stk.top(); stk.pop();
			if(s == "/" && b[0]){ answer = false; break; }
			bs256 c;
			for(int j = 0; j < 256; ++j){
				if(!a[j]){ continue; }
				for(int k = 0; k < 256; ++k){
					if(!b[k]){ continue; }
					int x = 0;
					if(s == "+"){
						x = (j + k) & 0xff;
					}else if(s == "-"){
						x = (j - k) & 0xff;
					}else if(s == "*"){
						x = (j * k) & 0xff;
					}else if(s == "/"){
						x = (j / k) & 0xff;
					}
					c[x] = true;
				}
			}
			stk.push(c);
		}
	}
	cout << (answer ? "correct" : "error") << endl;
	return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 2e5; int n;
lli a[maxN];
map<int, int> cnt[2];

int main()
{
  while (scanf("%d", &n) != EOF)
  {
    cnt[0].clear(), cnt[1].clear();
    for (int i = 0; i < n; i++)
    {
      scanf("%lld", &a[i]);
      lli b = a[i] + (i + 1), c = (i + 1) - a[i];
      if (!cnt[0].count(b)) cnt[0][b] = 0;
      cnt[0][b]++;
      if (!cnt[1].count(c)) cnt[1][c] = 0;
      cnt[1][c]++;
    }

    lli ans = 0;
    for (int i = 0; i < n; i++)
    {
      lli b = a[i] + (i + 1);
      ans += cnt[1].count(b) ? cnt[1][b] : 0;
    }
    printf("%lld\n", ans);
  }
  return 0;
}

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

int main(){
	
	string s;
	cin >> s;
	int m=1e9;
	for (int i=0;i<(int) s.size() - 2; i++){
		string number = s.substr(i,3);
		int result = stoi(number);
		m = min(m,abs(result - 753));
		//cout << number << " " << result << " " << m << endl;
	}
	cout << m;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long N,A,B,rest;
    cin>>N>>A>>B;
    rest = N % (A+B);
    if(rest > A)rest = A;
    N = (N / (A+B))*A;
    cout<<rest+N;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() { 
    char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << '\n';
    } else {
        cout << "consonant" << '\n';
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	int ans = k * pow(k - 1, n - 1);
	cout << ans << endl;
	return 0;
}


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

#define FOR(i,N) for(int i=0;i<N;i++)
#define ROF(i,N) for(int i=N-1;i>=0;i--)
#define ROF1(i,a,b) for(int i=(b);i>=(a);i--)
#define FOR1(i,a,b) for(int i=(a);i<=(b);i++)
#define FORi(i,a,b,c) for(int i=(a);i<=(b);i+=(c))

#define read freopen("IN.txt","r",stdin)
#define write freopen("OT.txt","w",stdout)
#define fastread {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mem(a,b)          memset(a,b,sizeof(a))
#define EPS 1e-9
#define PI              acos(-1.0)
#define INF             2e16

#define ll              long long
#define ull             unsigned long long
#define ft              first
#define sd              second
#define bn              begin
#define en              end
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>
#define all(x) x.begin(), x.end()


#define dbg(args...) {cerr<<"-->";debugger::call(#args,args);cerr<<"\n";}
struct debugger {
    static void call(const char* it) {}
    template<typename T, typename ... aT>
    static void call(const char* it, T a, aT... rest) {
        string b;
        for (; *it&&*it != ','; ++it) if (*it != ' ')b += *it;
        cerr << b << "=" << a << " ";
        call(++it, rest...);
    }
};

int main()
{
#ifdef SunWalker
    //read;
   //write;
#endif
double n,x,sum=0;
cin>>n;
FOR(i,n)
{
    cin>>x;

    sum+=(1/x);
}

cout<<(1/sum)<<"\n";


return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int W,H,x,y,r,ff;
	bool f;
	f=true;
	ff=0;
	W=H=x=y=r=0;
	scanf("%d",&W);scanf("%d",&H);scanf("%d",&x);scanf("%d",&y);scanf("%d",&r);
	if(W-x<r)ff=1;//f=false;
	if(x<r)ff=1;//f=false;
	if(H-y<r)ff=1;//f=false;
	if(y<r)ff=1;//f=false;
	if(ff==0)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 1012
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    println!("{}", N*N*N);
}


Measured memory_bytes: 4352
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Set<Integer> list = new HashSet<>();		// 整数列

		int num = scan.nextInt();					// 整数の個数
		for(int i = 0; i < num; i++) {
			list.add(scan.nextInt());
		}

		System.out.println(list.size());

		scan.close();

	}

}

Measured memory_bytes: 21844
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e5+5;
typedef long long ll;
const ll mod=1e9+7;
ll n,a,b;
ll s[N];
ll f[N],g[N];
int main()
{
    //freopen("division.in","r",stdin);
    //freopen("division.out","w",stdout);
    scanf("%lld%lld%lld",&n,&a,&b);
    for(ll i=1;i<=n;i++)
        scanf("%lld",&s[i]);
    if(a>b)
        swap(a,b);
    for(ll i=3;i<=n;i++)
        if(s[i]-s[i-2]<a){
            puts("0");
            return 0;
        }
    s[0]=-2e18;
	s[n+1]=2e18;
    f[0]=g[0]=1;
    int l=0,r=0;
    for(int i=1;i<=n+1;i++){
        while(r<i-1&&s[i]-s[r+1]>=b)
            r++;
        if(l<=r)
            f[i]=(g[r]+mod-(l?g[l-1]:0))%mod;
        g[i]=(g[i-1]+f[i])%mod;
        if(i>1&&s[i]-s[i-1]<a)
            l=i-1;
    }
    printf("%d\n",f[n+1]);
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
    char s[10];
    cin>>s;
    int a,b,c,d;
    a=s[0]-'0';
    b=s[1]-'0';
    c=s[2]-'0';
    d=s[3]-'0';
    for(int i=43;i<=45;i+=2)
	{
        for(int j=43;j<=45;j+=2)
		{
            for(int k=43;k<=45;k+=2)
			{
                int ans=a;
                if(i==43)
				{
                    ans+=b;
                }
                else
				{
                    ans-=b;
                }
                if(j==43)
				{
                    ans+=c;
                }
                else
				{
                    ans-=c;
                }
                if(k==43)
				{
                    ans+=d;
                }
                else
				{
                    ans-=d;
                }
                if(ans==7)
				{
                    cout<<a<<char(i)<<b<<char(j)<<c<<char(k)<<d<<"=7"<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

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

using namespace std;
typedef long long ll;



int main(void)
{
	ll n;
	cin >> n;

	ll power = 1;

	for(int i=2;i<=n;i++) {
		power =(power*i)%(1000000000+7);
	}

	cout << power << endl;


	
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int N;
  cin >> N ;
  
  if(N == 1){
    cout << "Yes" << endl;
    return 0;
  }
    
  vector<int> cont(N);
  bool result = false;
 
  for(int i = 0 ; i < N ; i++){
    cin >> cont.at(i);
  }
  
  reverse(cont.begin() , cont.end());
  
  for(int i = 0 ; i < N-1 ; i++){
    
    if( cont.at(i) >= cont.at(i+1)){
      
      if(i == N - 2){
        result = true;
        break;
      }
      continue;
    }
    else if( cont.at(i) + 1 == cont.at(i+1) ){
      if(i == N -2){
        result = true;
        break;
      }
      cont.at(i+1) -- ;
      continue;
    }
    else{ 
      break;
    }
  }
    
    
  if(result){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 640
N,M = list(map(int, input().split()))
a = []
for i in range(N):
    b = list(map(int, input().split()))
    a.append(b)

c = [0 for i in range(M + 1)]

for i in range(N):
    for j in range(a[i][0] + 1):
        if j == 0: continue
        c[a[i][j]] += 1

ans = 0
for i in range(len(c)):
    if c[i] == N:
        ans += 1

print(ans)

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

int main(){
    int N, M;
    cin >> N;

    int T[N];
    int solveSums = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> T[i];
        solveSums += T[i];
    }
    
    cin >> M;
    int P[M], X[M];
    for (int i = 0; i < M; i++){
        cin >> P[i] >> X[i];
    }

    for (int i = 0; i < M; i++)
    {
        int output = solveSums - (T[P[i]-1] - X[i]);
        cout << output << endl;
    }
}

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

using namespace std;

const int INF = 1e9 + 5;
const int N = 2e5 + 5;
const int MOD = 998244353;
const double EPS = 1e-9;

const double PI = acos(-1);



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int step = 1;
    while (a > 0 && c > 0) {
        if (step & 1) {
            c -= b;
        } else {
            a -= d;
        }
        step++;
    }
    if (a <= 0)
        cout << "No";
    else
        cout << "Yes";
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;

int main() {
  ll N;
  // 6565
  // 1, 2, 3, 4, 5, 6 => 1
  // 7, ..., (6+5)=11 => 2
  while (cin >> N) {
    // 6 * k + 5 * l .. (k>=l, k<=l+1)
    // 11k + (5 or 0) >= ans
    ll q = N / 11;
    ll ans = q * 2;
    N -= 11 * q;
    // 656565
    if (N >= 1 && N <= 6) {
      // 6
      ans += 1;
    } else if (N >= 7 && N < 11) {
      // 65
      ans += 2;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int r,c,i,j,k;

	scanf("%d %d", &r, &c);

	int data[r][c];
	int sum_r[r];
	int sum_c[c];
	int sum_all = 0;

	for(i = 0;i < r;i++){
		sum_r[i] = 0;
		for(j = 0;j < c;j++){
			scanf("%d",&data[i][j]);
			sum_r[i] += data[i][j];
		}
	}

	for(i = 0;i < c;i++){
		sum_c[i] = 0;
		for(j = 0;j < r;j++){
			sum_c[i] += data[j][i];
		}
		sum_all += sum_c[i];
	}

	for(i = 0;i < r;i++){
		for(j = 0;j < c;j++){
			printf("%d ",data[i][j]);
		}
		printf("%d\n",sum_r[i]);
		if(i == r -1){
			for(k = 0;k < c;k++){
				printf("%d ",sum_c[k]);
			}
			printf("%d\n",sum_all);
		}
	}
	return 0;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int x = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'I') x++;
    else x--;
    ans = max(ans, x);
  }
  cout << ans << endl;
}

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

int main(){
  int h,r,a,b;
  cin>>h>>r;
  if (h<=0){
    a=h+r;
    if(a==0){
      b=0;
      cout<<b<<endl;
    }else if(a<0){
      b=-1;
      cout<<b<<endl;
    }else{
      b=1;
      cout<<b<<endl;
    }
  } else{
    b=1;
    cout<<b<<endl;
  }

  return 0;
  
}



Measured memory_bytes: 3116
#include <stdio.h>

int main() {
	int w, n, i, tmp;
	int a, b, wary[30];

	scanf("%d",&w);
	scanf("%d",&n);
	for (i = 1; i <= w; i++) {
		wary[i] = i;
	}
	for (i = 0; i < n; i++) {
		scanf("%d,%d", &a, &b);
		tmp = wary[a];
		wary[a] = wary[b];
		wary[b] = tmp;
	}
	for (i = 1; i <= w; i++) {
		printf("%d\n", wary[i]);
	}	
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int N;
    cin >> N;
    if(N % 2 == 0) cout << N / 2 << endl;
    else cout << N / 2 + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
require 'prime'

n = gets.chomp.to_i

# 階差数列
# 2 ** 45 > 10 ** 12 (nの最大値)だから45まで用意
arr = [1, 3, 6, 10, 15, 21, 28, 36, 45]

# 素因数分解
# pdは[[p1, p1の指数], [p2, p2の指数], ... ]のような形
pd = n.prime_division

# n = p1^e1 * p2^e2 * ... のようにしたとき
# p1^1), p1^2, ... でnを順番に割っていきたい
result = 0
pd.each do |(p, exp)|
  # 階差数列を利用して exp -> p^iでnを順番に割れる個数に変換
  # ex) exp = 7 なら p^1, p^2, p^3 の3回で割れる. p^4では割れない
  result += arr.index{|a| a > exp}
end

puts result


Measured memory_bytes: 14404
/*************************************************************************
>>> Author: WindCry1
>>> Mail: lanceyu120@gmail.com
>>> Website: https://windcry1.com
>>> Date: 12/30/2019 11:03:37 PM
*************************************************************************/
//#pragma GCC optimize(3)
//#pragma GCC diagnostic error "-std=c++11"
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <iostream>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <stack>
#include <bitset>
#include <iomanip>
#include <list>
#include <sstream>
#include <fstream>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define endl '\n'
#define ll long long
#define ull unsigned long long
#define DEBUG(x) cout<<#x<<" : "<<x<<endl;
#define lowbit(x) x&(-x)
#define ls u<<1
#define rs u<<1|1
using namespace std;
template<typename T> inline T MIN(const T &a,const T &b) {return a<b?a:b;}
template<typename T> inline T MAX(const T &a,const T &b) {return a>b?a:b;}
template<typename T,typename ...Args> inline T MIN(const T &a,const T &b,Args ...args) {return MIN(MIN(a,b),args...);}
template<typename T,typename ...Args> inline T MAX(const T &a,const T &b,Args ...args) {return MAX(MAX(a,b),args...);}
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifdef WindCry1
	freopen("C:\\Users\\LENOVO\\Desktop\\in.txt","r",stdin);
#endif
	int n;cin>>n;
	vector<int> a(n),b(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	if(a>b) swap(a,b);
	int cnt=0;
	do{
		if(a==b){
			cout<<cnt<<endl;
			return 0;
		}
		++cnt;
	}while(next_permutation(a.begin(),a.end()));
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define MOD 998244353
#define zeros(x) x&(x-1)^x
#define fi first
#define se second
#define Nmax 10000005
const long double PI = acos(-1);

int n,x;
int A[Nmax],S[Nmax],B[Nmax],S2[Nmax], P2[Nmax];

template<typename T = long long>
T _pow(T a, T b){
    T ans = 1;
    for (; b; b >>= 1){
        if (b % 2) ans = ans * a % MOD;
        a = a * a % MOD;
    }
    return ans;
}

long long P[Nmax], inv[Nmax];
template<typename T = long long>
T comb(T n, T m){
    if (P[1] == 0) cerr << "Apeleaza functia prec!\n";
    return P[n] * inv[m] % MOD * inv[n-m] % MOD;
}

template<typename T = long long>
inline void add(T &a, T b){
    a += b;
    if (a >= MOD) a -= MOD;
    if (a < 0) a += MOD;
}

void prec(int n = Nmax-1){
    P[0] = inv[0] = 1;
    for (int i=1;i<=n;i++){
        P[i] = P[i-1] * i % MOD;
        inv[i] = _pow(P[i], MOD - 2LL);
    }
}

int main(){
    ios::sync_with_stdio(false);
    prec();

    cin >> n;
    int x = n / 2;

    P2[0] = 1;
    for (int i=1;i<=n;i++){
        P2[i] = 1LL * P2[i-1] * 2 % MOD;
    }

    for (int i=1;i<=x;i++){
        A[i] = comb(x,i);
    }
    for (int i=x;i>=1;i--){
        add(S[i], S[i+1]);
        add(S[i], A[i]);
        S2[i] = (S2[i+1] + 1LL * A[i] * P2[x-i]) % MOD;
    }

    int ans = 0;
    for (int i=1;i<=x;i++){
        int y = (x+1) - i;
        // dbg(i,A[i],P2[x-i],S2[y]);
        ans = (ans + 1LL * A[i] * P2[x-i] % MOD * S2[y]) % MOD;
    }

        // dbg(ans);
    ans = ans * 2 % MOD;
    ans = (1LL * _pow(3LL,1LL*n) - ans + MOD) % MOD;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 260352
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String, Long> map = new TreeMap<>();
		List<Long> out = new ArrayList<>();
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			switch (sc.nextByte()) {
				case 0:
					map.put(sc.next(), sc.nextLong());
					break;
				case 1:
					out.add(map.get(sc.next()));
					break;
			}
		}
		for (long n : out) {
			System.out.println(n);
		}
	}
}



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

int a, b, c, t;

int main()
{
    while (cin >> a >> b >> c) {
        t = 0;

        for (int i = 1; i <= 10; i++)
            if (i != a && i != b && i != c && a + b + i < 21)
                t++;

        if (t > 3)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}



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

int main()
{
   char ch;
   cin>>ch;
   if(ch=='a'||ch=='e'||ch=='i'||ch=='i'||ch=='o'||ch=='u'){
    cout<<"vowel"<<endl;

   }
   else
    cout<<"consonant"<<endl;
    return 0;
}


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

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

int main()
{
    ll i,j;
    ll n,W;
    cin >> n >> W;
    vector<ll> w(n);
    vector<ll> v(n);
    for(i = 0;i < n;++i){
        cin >> w.at(i) >> v.at(i);
    }
    ll V_MAX = n*1000;
    vector<vector<ll>> dp(n+1,vector<ll>(V_MAX+1,1e15));
    dp.at(0).at(0) = 0;
    for(i = 1;i <= n;++i){
        rep(j, V_MAX+1){
            if(j < v.at(i-1)) dp.at(i).at(j) = dp.at(i-1).at(j);
            else dp.at(i).at(j) = min(dp.at(i-1).at(j), dp.at(i-1).at(j - v.at(i-1)) + w.at(i-1));
        }
    }
    for(i = V_MAX;i >= 0;--i){
        if(dp.at(n).at(i) <= W){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
} 


Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
using namespace std;
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }


int main() {
    int A,B,C,D,N;
    int ans;
    cin>>N;
    int S[N];
    rep(i,N){
        int a;
        cin>>a;
        S[a-1]=1+i;
    }
    rep(i,N)
    Out(S[i]);
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n = 0;
    cin >> n;
    vector<int> a_array;

    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        a_array.push_back(tmp);
    }
    int res = 0;
    while (true){
        int cnt = 0;
        for (int &item : a_array) {

            if (item % 2 == 0) {
                cnt += 1;
            }
        }
        if(cnt == n){
            for (auto &item : a_array) {
                item /= 2;
            }
            res += 1;
        }
        else{
            break;
        }

    }


    printf("%d", res);

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979;

ll expo(ll a, ll b){
    ll ex = 1;
    rep(i, b){
        ex *= a;
    }
    return ex;
}

ll fact(ll a){
    ll fc = 1;
    REP(i, 1, a+1){
        fc *= i;
    }
    return fc;
}

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
   if(a<=x&&x<=a+b) {
       cout << "YES" << endl;
   }
   else {
       cout << "NO" << endl;
   }
}

Measured memory_bytes: 256
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
from bisect import bisect_left
from operator import lt, le
def find_nearst_value(lst, val, left=True):
    """ソート済のリストから，valに最も近い要素を返す.
    @param lst: ソート済のリスト
    @param left:
        lv < val < rv，val-lv == rv-val のとき，
        Trueならばlvを，Falseならばrvを選択する
    @return もっともvalに値が近いlstの要素
    """
    pos = bisect_left(lst, val)
    if pos == 0: return lst[0]
    if pos == len(lst): return lst[-1]
    lv, rv = lst[pos-1:pos+1]
    op = le if left else lt
    return lv if op(val-lv, rv-val) else rv
#======================================================#
def main():
    x, n = MII()
    pp = MII()
    setp = set(pp)
    qq = [i for i in range(200) if not i in setp]
    qq.sort()
    # print(*qq)
    print(find_nearst_value(qq,x))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9236
while True:
    A,op,B = input().split()
    a,b = int(A),int(B)
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)
    elif op == '*':
        print(a*b)
    elif op == '/':
        print(a//b)
    elif op == '?':
        break


Measured memory_bytes: 5600
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++) //0から
#define REP(i,n) for(int j=i;j<n;j++) //iから
#define in(a) cin>>a
#define out(a) cout<<a<<endl

long long int kaijo(long long int n){
    if(n == 0) return 1;
    return n * kaijo(n-1);
}


vector<bool> is_prime;
void Eratosthenes(long long int n){
    is_prime.resize(n+1,true);
    is_prime[0]=false;
    is_prime[1]=false;
    for(long long int i = 2; i <= n; i++){
        if(is_prime[i]){
            for(long long int j = i*i; j <= n; j++){
                is_prime[j] = false;
            }
        }
    }
}

//素数列挙
vector<long long int> Prime;
void Prime_Enumeration(long long int n){
    Eratosthenes(n);
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            Prime.push_back(i);
        }
    }
}

long long int gcd(long long int a, long long int b){
    if(a<b){
        swap(a,b);
    }
    long long int r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return r;
}

long long int lcm(long long int a, long long int b){
    long long int g = gcd(a,b);
    long long int l = (a * b) / g;

    return l;
}

//aが負の時でも余りを非負にしたいとき
long long  mod(long long a, long long m){
    return (a % m + m) % m;
}

//拡張ユークリッド ap + bq = gcd(a,b)
long long extGCD(long long a, long long b, long long &p, long long &q){
    if(b == 0){ p = 1; q = 0; return a;}
    long long d = extGCD(b, a % b, q, p);
    q -= a /b * p;
    
    return d;
}

//中国剰余定理
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2){
    long long p, q;
    long long d = extGCD(m1, m2, p, q);

    if((b2-b1) % d != 0) return make_pair(0, -1); //解なし

    long long m = m1 * (m2 / d);
    long long tmp = (b2 - b1) / d * p % (m2 / d);
    long long r =mod(b1 + m1 * tmp, m);

    return make_pair(r, m);
}

//mod.mでのa^{-1}
long long modinv(long long a, long long m){
    long long b = m, u = 1, v = 0;
    while(b){
        long long t = a /b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0)u += m;
    return u;

}
const long long MOD = 1000000007;

//key以上のうち最小の要素のindex
int binary_search(long long int *a, long long int n, long long int key){
    long long int right = n, left = -1;
    long long int md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}


int main(){
    long long int n,r;
    string s;

    cin>>n>>r;

    if(n>=10){
        cout<<r<<endl;
        return 0;
    }

    cout<< r + 100 * (10-n)<<endl;


    return 0;
}



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

using namespace std;

int main() {
  int H, W;
  cin >> H >> W;

  vector<string> s(H);
  for (int i = 0; i < H; i++) {
    cin >> s[i];
  }

  for (int i = 0; i != H; ++i) {
    for (int j = 0; j != W; ++j) {
      if (s[i][j] == '.') continue;
      if ((!i || s[i - 1][j] == '.') && (i + 1 == H || s[i + 1][j] == '.') &&
          (!j || s[i][j - 1] == '.') && (j + 1 == W || s[i][j + 1] == '.')) {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;
}


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

int main(){
  int N, a[100001], freq[100003];
  int ans = 0, count = 0;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }

  //頻度配列を作って、連続した3つの和、の最大値

  //頻度配列
  for(int i = 0; i < N; i++){
    freq[a[i]]++;
  }
  for(int i = 0; i < 100001; i++){
    count = freq[i] + freq[i+1] + freq[i+2];
    if(ans < count) ans = count;
  }

  cout << ans << endl;
  return 0;
}

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

#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=a; i>=b; --i)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a * b > c * d){
        cout << a * b << "\n";
    }else{
        cout << c * d << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 1000000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
    ll X,Y; cin >> X >> Y;
    ll out = 0;
    if((X+Y)%3!=0){
        out = 0;
    }else{
        COMinit();
        out = COM((X+Y)/3,2*(X+Y)/3-X);
        //cerr << "X=" << X << "  Y="<< Y <<endl;
        //cerr << (X+Y)/3 << " " <<2*(X+Y)/3-X << endl;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

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

ll dp[1010][10010];

/*bool hoge(pair<double, int> a, pair<double,int> b) {
	if(a.fi > b.fi) return true;
	else return false;
}*/

int main() {
	int h,n;
	cin >> h >> n;
	vector<ll> a(n), b(n);
	rep(i,n) cin >> a[i] >> b[i];
	rep(i,n+1)rep(j,h+1) dp[i][j] = 1e18;
	rep(i,n+1) dp[i][0] = 0;
	for(int i=1; i<=n; i++) {
      copy(begin(dp[i - 1]), end(dp[i - 1]), begin(dp[i]));
      for(int j=0; j<=h;j++)  {
        ll index = i-1;
        
		//cout << i << " " << j << " " << j+a[index] << " "; 
		if(j + a[index] < h) {
			//cout << "case1: ";
			//cout << dp[i][j]+b[index] << " " << dp[i-1][j+a[index]];
			dp[i][j + a[index]] = min(dp[i][j] + b[index], dp[i-1][j+a[index]]);
		}
		else {
			dp[i][h] = min({dp[i][h],dp[i][j] + b[index], dp[i-1][h]});
			//cout << "case2 ";
			//cout << i << " " << j << " " << dp[i][h] << " " << dp[i][j]+b[index] << " " << dp[i-1][h];
		}
		//cout << endl;
      }
	}
	/*rep(i,n+1) {
		rep(j,h+1) {
			if (dp[i][j] >= 1e9) cout << setw(3) << "na";
			else cout << setw(10) << dp[i][j];
		}
		cout << endl;
	}*/
	cout << dp[n][h] << endl;

	/*rep(i,n) {
		if(a[i] > h) a[i] = h;
	}
	vector<pair<double, int>> c(n);
	rep(i,n) c[i] = pair<double, int>(a[i]*1.0/b[i], i);
	sort(c.begin(), c.end(), hoge);
	ll ans = 0;
		while(h > 0) {
			cout << c[0].se << " ";
				
			//int tmp = h / a[c[0].se];
			//cout << tmp << " ";
			ans += b[c[0].se];
			h -= a[c[0].se];
			cout << h << endl;
			rep(i,n) {
				if(a[i] > h) a[i] = h;
				c[i] = pair<double,int>(a[i]*1.0/b[i], i);
		}
		sort(c.begin(),c.end(),hoge);
	}*/


  return 0;
}


Measured memory_bytes: 78592
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(0,n):
  if a[i]%2==0:
    if a[i]%3==0 or a[i]%5==0:
      count=count+1
  else:
    count=count+1
if count==n:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
H,W = map(int, input().split())

# 4 cases

from math import floor, ceil

f = lambda x,y,z: max(x,y,z) - min(x,y,z)

def vals(H,W):
  yield (ceil(W/3)-floor(W/3))*H
  yield f(ceil(W/3)*H, (W-ceil(W/3))*floor(H/2), (W-ceil(W/3))*ceil(H/2))
  yield f(floor(W/3)*H, (W-floor(W/3))*floor(H/2), (W-floor(W/3))*ceil(H/2))


print(min(min(vals(H,W)), min(vals(W,H))))

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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  int max=-1, sum=0;

  for(int i=0; i<p.size(); i++) {
    cin >> p.at(i);
    sum += p.at(i);
    if(max < p.at(i)) max=p.at(i);
  }

  cout << sum-(max/2) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,M;
    cin>>N>>M;
    M=M*2;
    vector<int>toshi(N);
    vector<int>douro(M);
    for(int i=0; i<M; i++){
            cin>>douro[i];
            toshi[douro[i]-1]++;
    }
    for(int i=0; i<N; i++){
            cout<<toshi[i]<<endl;
    }
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int h,w;
    cin >> h >> w;
    vs s(h);
    rep(i,h)cin >> s[i];
    vp v;
    rep(i,h){
        int j = 0;
        while(j < w){
            if(s[i][j] == 'B'){
                v.push_back(pii(i,j));
                break;
            }
            j++;
        }
        j = w-1;
        while(j >= 0){
            if(s[i][j] == 'B'){
                v.push_back(pii(i,j));
                break;
            }
            j--;
        }
    }
    rep(j,w){
        int i = 0;
        while(i < h){
            if(s[i][j] == 'B'){
                v.push_back(pii(i,j));
                break;
            }
            i++;
        }
        i = h-1;
        while(i >= 0){
            if(s[i][j] == 'B'){
                v.push_back(pii(i,j));
                break;
            }
            i--;
        }
    }
    int ans = 0;
    rep(i,v.size())rep(j,i){
        ans = max(ans, abs(v[i].first-v[j].first)+abs(v[i].second-v[j].second));
    }
    cout << ans << endl;
}



Measured memory_bytes: 3972
def warshalFloyd():
    G=[list(map(int,input().split())) for _ in range(10)]

    for k in range(10):
        for i in range(10):
            for j in range(10):
                G[i][j]=min(G[i][j],G[i][k]+G[k][j])

    return G


h,w=map(int,input().split())
Graph=warshalFloyd()

ans=0
for i in range(h):
    for j in list(map(int,input().split())):
        if j==-1:continue
        else:ans +=Graph[j][1]
print(ans)

Measured memory_bytes: 40812
program kadai
integer  ::  N,K
integer,allocatable  ::  p(:)
real(8)  ::  ans,ans_max

read(*,*) N,K
allocate(p(N))
read(*,*) p

ans=0.0_8
do i=1,K
    ans=ans+p(i)
end do
ans_max=ans

do i=1,N-K
    ans=ans-p(i)
    ans=ans+p(i+K)
    !write(*,*) ans,ans_max
    ans_max=max(ans,ans_max)
end do
write(*,*) (ans_max+real(K,8))/2.0_8

end program kadai

Measured memory_bytes: 1536
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int ok[100000+10],cnt[100000+10];
int n,m;
int res1,res2;
int main(){
	fastio;
	cin>>n>>m;
	rb(i,1,m) {
		int a;
		string c;
		cin>>a>>c;
		if(c=="AC"){
			if(!ok[a]){
				ok[a]=1;
				res1++;
				res2+=cnt[a];
			}
		}
		else{
			if(!ok[a]) cnt[a]++;
		}
	}
	cout<<res1<<" "<<res2;
	return 0;
}


Measured memory_bytes: 1024
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

N = I()
XY = LRI(N)

perm = list(itertools.permutations(XY))

ans = 0
for p in perm:
     for i in range(N - 1):
        ans += math.sqrt((p[i][0] - p[i+1][0]) ** 2 + (p[i][1] - p[i+1][1]) ** 2)


print(ans / len(perm))


Measured memory_bytes: 52080
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.00000001
#define pi 3.141592653589793
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti multiset <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
bool comparion(pair <string,ll> a,pair <string,ll> b)
{
    if(a.ff==b.ff)
        return (a.ss>b.ss);
    return (a.ff<b.ff);
}
int main()
{  
    FAST
    ll n,m;
    cin>>n>>m;
    ll a[m][n];
    ll p[m]={0};
    for(ll i=0;i<m;i++)
    {
        for(ll j=0;j<n;j++)
        {
            a[i][j]=0;
        }
    }
    ll x,y;
    for(ll i=0;i<m;i++)
    {
        cin>>x;
        for(ll j=0;j<x;j++)
        {
            cin>>y;
            a[i][y-1]=1;
        }
    }
    for(ll i=0;i<m;i++)
    {
        cin>>p[i];
    }
    ll ans=0;
    for(ll i=0;i<(1<<n);i++)
    {
        ll f=1;
        for(ll j=0;j<m;j++)
        {
            x=0;
            for(ll k=0;k<n;k++)
            {
                if((i>>k)&a[j][k])
                    x++;
            }
            x%=2;
            if(x!=p[j])
            {
                f=0;
                break;
            }
        }
        if(f)
            ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 256
//
// Created by RAJ SHAH on 18-08-2020.
//

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<long long>L(n);
    for(int i=0;i<n;i++)
        cin>>L[i];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(L[i]!=L[j] && L[i]!=L[k]  && L[j]!=L[k])
                {
                    if(L[k]>L[i] && L[k]>L[j])
                    {
                        if(L[i]+L[j]>L[k])
                            ans+=1;
                    }
                    if(L[i]>L[k] && L[i]>L[j])
                    {
                        if(L[k]+L[j]>L[i])
                            ans+=1;
                    }
                    if(L[j]>L[i] && L[j]>L[k])
                    {
                        if(L[i]+L[k]>L[j])
                            ans+=1;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3632
#include<iostream>

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

int main(){
  while(true){
    const auto H = input<int>();
    const auto W = input<int>();
    if(H == 0 && W == 0)
      return 0;
    for(int i = 0; i < H; ++i){
      for(int j = 0; j < W; ++j)
        std::cout << ((i + j) % 2 == 0 ? '#' : '.');
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }
}

Measured memory_bytes: 1152