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

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

inline void Main() {
  int a; cin >> a;
  cout << a + a * a + a * a * a << endl;
}

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


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


int main(){
	/*input*/
	int n;
	cin >> n;
	int v[20];
	int c[20];
	for(int i = 0; i < n; i++){
		cin >> v[i];
	}
	for(int i = 0; i < n; i++){
		cin >> c[i];
	}
	/*calc*/
    int  ans = 0;

    for(int i = 0; i < n; i++){
    	if(v[i] > c[i]) ans += v[i] - c[i];
    }
    /*output*/
	   	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]

lsts = []
temp = []
for aa in a:
    if aa == 0:
        if temp:
            lsts.append(temp)
            temp = []
    else:
        temp.append(aa)
if temp: lsts.append(temp)

ans = 0

for lst in lsts:
    for i, aa in enumerate(lst):
        ans += aa // 2
        if i != len(lst)-1:
            lst[i+1] -= aa % 2
            ans += aa % 2

print(ans)

Measured memory_bytes: 16932
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() int {
	sc.Scan()
	val, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	return val
}

func main() {
	sc.Split(bufio.ScanWords)

	K, S := next(), next()

	count := 0
	for i := 0; i < K+1; i++ {
		for j := 0; j < K+1; j++ {
			z := S - i - j
			if z >= 0 && z <= K {
				count++
			}
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 1772
h, w = map(int, input().split())
s = []
for i in range(h):
    s.append(list(str(input())))
x = []

for i in range(h):
    lst = []
    for j in range(w):
        cnt = 0
        if s[i][j]=='.':
            for m in range(3):
                for n in range(3):
                    if 0<=i-1+m<=h-1 and 0<=j-1+n<=w-1:
                        if s[i-1+m][j-1+n]=='#':
                            cnt += 1
            lst.append(str(cnt))
        else:
            lst.append('#')

    x.append(''.join(lst))

for i in range(h):
    print(x[i])

Measured memory_bytes: 3064
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------
const int MAX = 510000;

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;
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    vector<ll>cnt;
    map<ll,ll>used;
    ll ans=1;
    for(int i=2;i<=n;i++){
        int now=i;
        for(int j=2;j<=i;j++){
            while(now%j==0){
                //cout<<now<<" "<<j<<Endl;
                used[j]++;
                now/=j;
    
            }
        }
    }
    for(int i=2;i<=n;i++){
        if(used[i]>0){
            ans*=(used[i]+1);
            ans%=MOD;
        }
    }
    
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------







Measured memory_bytes: 384
N,K = map(int,input().split())
x = list(map(int,input().split()))

res = 1e+9
for i in range(N-K+1):
    if abs(x[i]) <= abs(x[i+K-1]):
        res = min(res,abs(x[i]) + abs(x[i+K-1] - x[i]))
    else:
        res = min(res,abs(x[i+K-1]) + abs(x[i+K-1] - x[i]))
print(res)

Measured memory_bytes: 14224
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Bits

printEdge :: Int -> Int -> IO ()
printEdge !i !j = putStrLn $ show i ++ " " ++ show j

main = do
  n :: Int <- readLn
  if n .&. (n-1) == 0 -- n = 2^k for some k
    then putStrLn "No"
    else do putStrLn "Yes"
            let m = bit (floor (logBase 2 (fromIntegral (n+1))))
            forM_ [1..m-2] $ \i -> do
              printEdge i (i+1)
            printEdge (m-1) (n+1)
            forM_ [1..m-2] $ \i -> do
              printEdge (n+i) (n+i+1)
            when (n >= m + 1) $ do
              printEdge 1 m
              printEdge m (m+1)
              printEdge 1 (n+m+1)
              printEdge (n+m+1) (n+m)
              when (n >= m + 2) $ do
                printEdge 2 (m+2)
                printEdge (n+m+1) (n+m+2)
                when (n >= m + 3) $ do
                  printEdge m (m+3)
                  printEdge 2 (n+m+3)
                  when (n >= m + 4) $ do
                    printEdge m (n+m+4)
                    printEdge 4 (m+4)
                    forM_ [m+5..n] $ \i -> do
                      printEdge (i-1) (n+i)
                      printEdge (i-m) i


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

int count(vector<int> &a, int n){
  
  rep(i,n){
    if(a[i]%2 != 0){
      return 0;
      break;
    }
    a[i] = a[i]/2;
  }
  
  return count(a, n) + 1;
}


int main(){
  int n;
  cin >> n;
  
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  
  cout << count(a, n) << endl;
}


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

struct node
{
  int num;
  node *left = NULL;
  node *right = NULL;
  node(int value) : num(value){}
};

node* parse(string& str,int& idx){
  node* now = new node(0);
  // (
  idx++;
  if(str[idx]=='('){
    now->left = parse(str, idx);
    idx++;
  }
  else if (str[idx] == ')')
  {
    now->left = NULL;
    idx++;
  }

  //[
  idx++;
  //read num
  while(str[idx]!=']'){
    int val = str[idx] - '0';
    now->num *= 10;
    now->num += val;
    idx++;
  }
  //]
  idx++;
  
  // (
  idx++;
  if(str[idx]=='('){
    now->right = parse(str, idx);
    idx++;
  }
  else if (str[idx] == ')')
  {
    now->right = NULL;
    idx++;
  }
  
  return now;
}

string output(node* node){
  string str = "";
  str += "(";

  
  if (node->left != NULL)
  {
    str += output(node->left);
  }
  str += ")";

  str += "[";
  str += to_string(node->num);
  str += "]";

  
  str += "(";
  if (node->right != NULL)
  {
    str += output(node->right);
  }
  str += ")";


  return str;
}

node* f(node* A,node* B){
  node *now = new node(0);

  now->num = A->num + B->num;
  
  if(A->left!=NULL&&B->left!=NULL){
    now->left = f(A->left, B->left);
  }
  if(A->right!=NULL&&B->right!=NULL){
    now->right = f(A->right, B->right);
  }
  return now;
}

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

  string A, B;
  cin >> A >> B;

  int Ai = 0;
  node* nodeA = parse(A, Ai);
  int Bi = 0;
  node* nodeB = parse(B, Bi);

  cout << output(f(nodeA,nodeB)) << endl;
}



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

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;
	int ans = A + B;
	ans = ans < A - B ? A - B : ans;
	ans = ans < A * B ? A * B : ans;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	string s;
	ll k;
	cin>>s>>k;
	rep(i,s.size()){
		ll num=(ll)('z'+1-s[i]);
		if(s[i]=='a' && i!=(s.size()-1))continue;
		if(num<=k){
			s[i]='a';
			k-=num;
		}
		if(i==(s.size()-1) && k>0){
			s[i]=(char)((int)(s[i]+k-'a')%26+'a');
		}
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 640
while True:
    m,f,r = map(int,input().split())
    if m == f == r == -1:
        break
    n=m+f
    if (m == -1 or f == -1) or n<30:
        grade = 'F'
    elif n >= 80:
        grade = 'A'
    elif n >= 65 and n <80:
        grade = 'B'
    elif (n>=50 and n<65) or (n>=30 and n<50 and r>=50):
        grade = 'C'
    elif n>=30 and n<50:
        grade = 'D'
    print(grade)



Measured memory_bytes: 5596
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();
	vector< vector<int> > A(26);
	for(int i=0;i<size;++i){
		A[(str[i]-'a')].push_back(i);
	}
	for(int a=0;a<26;++a){
		int asize = A[a].size();
		for(int i=0;i<asize;++i){
			for(int j=i+1;j<asize;++j){
				int Len = (A[a][j]-A[a][i]+1);
				if( Len < 2*(j-i+1) ){
					cout << A[a][i]+1 << " " << A[a][j]+1 << endl;
					return;
				}
				if( Len > 2*(asize-1-i+1) ) break;
			}
		}
	}
	cout << "-1 -1" << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 1104
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn divisors(n: usize) -> Vec<usize> {
    let mut divs = Vec::new();
    for i in 1..n+1 {
        if n % i == 0 {
            divs.push(i);
        }
    }

    divs.sort_unstable();
    divs
}

fn main() {
    input!{
        a: usize,
        b: usize,
        k: usize,
    };

    let a_divs = divisors(a);
    println!("{}", divisors(b).iter()
             .filter(|x| a_divs.binary_search(&x).is_ok())
             .rev()
             .collect::<Vec<&usize>>()[k-1]);
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	string s;
	cin>>s;
	bool f=0;
	rep(i,s.size()){
		if(s[i]=='7'){
			f=1;
		}
	} 
	if(f){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	re 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    sort(all(s));
    sort(all(t));
    reverse(all(t));
    if(s<t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, k;
    string s;
    cin >> n >> s >> k;
    rep(i, n) if (s[i] != s[k - 1]) s[i] = '*';
    cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
const int maxn = 100010;

int n,k;
int yes[maxn];

int32_t main() {
	FAST	
	cin >> n >> k;
	for (int i =0;i<k;i++) {
		int d; cin >> d;
		for (int j =0; j< d; j++) {
			int x; cin >> x;
			yes[x] = 1;
		}
	}
	
	int ans = 0;
	for (int i =1;i<=n;i++) {
		if (yes[i] == 0) ans++;
	}
	cout << ans;
	
}



Measured memory_bytes: 3660
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s1,s2;
    cin>>s1;
    s2 = s1+s1;
    ll in;
    cin>>in;
    ll a1=0,a2=0;
    ll f = 0;
    FOR(i,1,s1.size()){
      if(s1[i] != s1[i-1]) f=1;
    }
    FOR(i,1,s1.size()){
      if(s1[i] == s1[i-1]){
        s1[i]='0';
        a1++;
      }
    }
    FOR(i,1,s2.size()){
      if(s2[i] == s2[i-1]){
        s2[i]='0';
        a2++;
      }
    }

    if(f == 1)cout<<a1 + (a2-a1)*(in-1)<<endl;
    else cout<<s1.size()*in/2<<endl;
}


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

int main()
{
	string N;

	cin >> N;

	int ns = N.size(),sum = 0,M = stoi(N);

	for (int i = 0; i < ns; i++) {
		int n = N[i] - '0';
		sum += n;
	}

	if (M % sum == 0)cout << "Yes";
	else cout << "No";

	return 0;
}

Measured memory_bytes: 256
//author: dxm
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath> 
#include<cstring> 
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
inline void Fail(){
	printf("-1");
	exit(0);
}

const int maxn=100005;
int n,x,y,ans;
char c[maxn];
string s,cur;

int main(){
	scanf("%s",c);
	s=c;
	n=s.size();
	x=y=-1;
	rep(i,n){
		if(s[i]=='x')continue;
		cur+=s[i];
		if(x==-1)x=i;
		y=max(y,i);
	}
	if(x==-1){
		printf("0");
		return 0;
	}
	rep(i,cur.size()/2)if(cur[i]!=cur[cur.size()-i-1])Fail();
	int l=x,r=y;
	while(x<y){
		if(s[x]==s[y]){
			x++;y--;
			continue;
		} 
		ans++;
		if(s[x]=='x')x++;
		else y--;
	}
	ans+=abs(l-((int)s.size()-r-1));
	printf("%d",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static void Main() {
        int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int n = input[0], m = input[1];
        if(m == 0) { Console.WriteLine((int) ModInt.Fib(n + 1)); return; }
        int[] a = new int[m], b = new int[m + 1];
        for(int i = 0; i < m; i++) a[i] = int.Parse(Console.ReadLine());
        b[0] = a[0];
        for(int i = 1; i < m; i++) b[i] = a[i] - a[i - 1] - 1;
        b[m] = n - a[m - 1];
        ModInt pro = 1;
        for(int i = 0; i < m + 1; i++) pro *= ModInt.Fib(b[i]);
        Console.WriteLine((int) pro);
    }
}

struct ModInt {
    const int MOD = 1000000007;
    long value;
    
    static List<ModInt> fib = new List<ModInt> { 0, 1 };

    public ModInt(long value) { this.value = value; }
    public static implicit operator ModInt(long a) => new ModInt(a % MOD + (a < 0 ? MOD : 0));
    public static explicit operator int(ModInt a) => (int) a.value;
    public static ModInt operator +(ModInt a, ModInt b) => a.value + b.value;
    public static ModInt operator *(ModInt a, ModInt b) => a.value * b.value;
    public static ModInt Fib(int n) {
        for(int i = fib.Count(); i <= n; i++) fib.Add(fib[i - 2] + fib[i - 1]);
        return fib[n];
    }
}

Measured memory_bytes: 15968
N = int(input())
e = [0] * (N+1)
for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m): # e の要素のうち m-1 以上のものの個数
    return len(list(filter(lambda x: x >= m-1, e)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2)





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

long long cost(int n,vector<long long>& v,vector<long long>& dp)
{
    if(n==1||n==0)
      return 0;
      if(n==2)
       {dp[n]=abs(v[n]-v[n-1]);
         return dp[n];}
      if(dp[n]!=-1)
       return dp[n];
       
     dp[n]=min(cost(n-1,v,dp)+abs(v[n]-v[n-1]),cost(n-2,v,dp)+abs(v[n]-v[n-2]));
     return dp[n];
}

int main() {
	
	    int n;
	    cin>>n;
	    vector<long long> v(n+1),dp(n+1);
	    v[0]=0;
	    dp[0]=-1;
	    for(int i=1;i<=n;i++)
	    {
	        cin>>v[i];
	        dp[i]=-1;
	    }
	    
long long ans=cost(n,v,dp);	    
	cout<<ans;
	return 0;
}


Measured memory_bytes: 8020
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Debug.Trace

dfs :: Int -> [Int] -> Int -> Int -> [Int]
dfs l oks acc i
  | l < i = [acc]
  | otherwise = [acc] ++ concat [dfs l oks (acc*10+j) (i+1) | j <- oks]
  
main = do
  [n,k] <- map read . words <$> getLine :: IO [Int]
  ds <- map read . words <$> getLine :: IO [Int]
  let 
    oks = filter (flip notElem ds) [0..9]
    res = dfs (length $ show n) oks 0 0
  
  print $ minimum $ filter (>=n) res

Measured memory_bytes: 892
#include <iostream>

int main()
{
	int a;

	std::cin >> a;

	bool a_nine = a == 11 || a == 13 || a == 17 || a == 19 || a == 22 || a == 23 || a == 26 || a == 29 || a == 31 ||
		a == 33 || a == 34 || a == 37 || a == 38 || a == 39 || a == 41 || a == 43 || a == 44 || a == 46 ||
		a == 47 || a == 50 || a == 51 || a == 52 || a == 53 || a == 55 || a == 57 || a == 58 || a == 59 ||
		a == 60 || a == 61 || a == 62 || a == 65 || a == 66 || a == 67 || a == 68 || a == 69 || a == 70 ||
		a == 71 || a == 73 || a == 74 || a == 75 || a == 76 || a == 77 || a == 78 || a == 79 || a == 80 ||
		82 <= a;

	if (a_nine) {
		std::cout << "No" << std::endl;
		return 0;
	} else {
		std::cout << "Yes" << std::endl;
		return 0;
	}
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

SUITS = ('S', 'H', 'C', 'D')
cards = dict()

for key in SUITS:
    cards[key] = [False for i in range(14)]

n = int(sys.stdin.readline())
for i in range(n):
    suit, rank_s = sys.stdin.readline().split()
    rank = int(rank_s)

    cards[suit][rank] = True

for suit in SUITS:
    for rank in range(1, 14):
        if cards[suit][rank] == False:
            print(suit, rank)



Measured memory_bytes: 5612
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, unsigned long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

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

  std::vector<ll> a(n);
  for(auto&& e:a)std::cin>>e;

  if(k>50){
    rep(i,0,n)std::cout<<n<<" ";
    std::cout<<"\n";
    return 0;
  }

  while(k--){
    std::vector<ll> imos(n+1,0);
    rep(i,0,n){
      imos[std::max(0ll,i-a[i])]++;
      imos[std::min(n,i+a[i]+1)]--;
    }

    rep(i,0,n)imos[i+1]+=imos[i];
    rep(i,0,n)a[i]=imos[i];
  }

  rep(i,0,n)std::cout<<a[i]<<" ";
  std::cout<<"\n";

  return 0;
}

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

using namespace std;

typedef long long ll; 

int MOD;

inline void add(int &x,int y) {
  ((x+=y)>=MOD)?x-=MOD:0;
}

int f[2][5005][5005],sum1[5005],sum2[5005];

inline ll S(int n) {
  return n*(n+1)>>1;
}

int main() {
  int n=5000; 
  scanf("%d%d",&n,&MOD);
  if (n==2) {
  	puts("3");
  	return 0;
  }
  int k=((n-1)>>1);
  int cur=0;
  for(int i=0;i*k<=n;i++) f[cur][i][i]=((n&1)?1:i+1);
  for(int i=2;i<=k;i++) {
  	cur^=1;
  	memset(sum1,0,sizeof(sum1));
  	memset(sum2,0,sizeof(sum2));
  	for(int j=0;j*(k-i+1)<=n;j++) {
  		memset(f[cur][j],0,sizeof(f[cur][j]));
  		for(int l=0;l<=n;l++) {
  			sum1[l]=(sum1[l]+f[cur^1][j][l])%MOD;
  			sum2[l]=(sum2[l]+sum1[l])%MOD;
		  }
		for(int l=j;l<=n;l++) f[cur][j][l]=sum2[l-j];
	  }
  }
  int ans=0;
  for(int i=0;i<=n;i++)
    for(int j=0;j<=i;j++)
      if (f[cur][j][i]&&i+j<n) ans=(ans+f[cur][j][i]*S(n-j-i))%MOD;
  printf("%d\n",ans);
  return 0;
} 

Measured memory_bytes: 148736
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/







int N; vector<int> E[101010];
//---------------------------------------------------------------------------------------------------
int dp[101010];
void dfs(int cu, int pa = -1) {
    int zero = 0;
    fore(to, E[cu]) if (to != pa) {
        dfs(to, cu);
        if (dp[to] == 0) zero++;
        dp[cu] += dp[to];
    }
    dp[cu] += max(0, zero - 1);
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N-1) {
        int a, b; cin >> a >> b;
        E[a].push_back(b);
        E[b].push_back(a);
    }

    int root = -1;
    rep(i, 0, N) if (3 <= E[i].size()) root = i;
    if (root < 0) {
        printf("1\n");
        return;
    }

    dfs(root);

    //rep(i, 0, N) printf("dp[%d] = %d\n", i, dp[i]);

    cout << dp[root] << endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, i, j, k;
	cin >> n;
	vector<int> a(n), ans(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
		ans[a[i] - 1] = i + 1;
	}

	for (auto p : ans) cout << p << " ";
	cout << "\n";
	
	return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define loop(n) for(int i=0; i<n; i++)
void solve()
{
	int a,b,c,k;cin>>a>>b>>c>>k;
	int sum=0;
	int n=min(a,k);
	a-=n;k-=n;
	sum+=n;
	if(k>0)
	{
	     n=min(b,k);
	     k-=n;
	     if(k>0)
	     {
	          n=min(c,k);
	          sum-=n;
	     }
	}
	cout<<sum;
	return;
}
int32_t main() 
{ 
	fast;
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0; 
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ll n,i,j;
    double sum = 0;
    double ans = 0;

    cin >> n;
    vector<pair<ll,ll>> hoge(n);
    for(i = 0; i < n; i++){
        cin >> hoge[i].first >> hoge[i].second;
    }

    for(i = 0; i < n; i++){
        for(j = i+1;j < n; j++){
            sum += sqrt((double)abs(hoge[j].first-hoge[i].first)*(double)abs(hoge[j].first-hoge[i].first)+(double)abs(hoge[j].second-hoge[i].second)*(double)abs(hoge[j].second-hoge[i].second));
        }
    }
    ans = sum * 2.0 / n;
    cout <<setprecision(10)<< ans << endl;
}

Measured memory_bytes: 256
n = int(input())
A = [int(i) for i in input().split()]
q = int(input())
M = [int(i) for i in input().split()]
bit = 1
for a in A:
    bit |= bit<<a
for m in M:
    if bit & 1<<m:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll INF = 1e+10;

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

  vector<ll> A(N);

  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }

  vector<ll> v(N);
  fill(v.begin(), v.end(), INF);
  for (int i = N - 1; i >= 0; i--)
  {
    *lower_bound(v.begin(), v.end(), A.at(i) + 1) = A.at(i);
  }
  ll ans = 0;
  for (int i = 0; i < N; i++)
  {
    if (v.at(i) < INF)
      ans++;
    else
      break;
  }
  cout << ans << endl;
  // cout << endl;

  // for (int i = 0; i < N; i++)
  // {
  //   if (v.at(i) < INF)
  //     cout << v.at(i) << endl;
  //   else
  //     break;
  // }
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-S
x,y = [int(i) for i in input().split()]

"""
if x == 2 or y == 2:
    print("No")
elif (x == 4 or x == 6 or x == 9) and (y == 6 or y == 9 or y == 11):
    print("Yes")
elif (x == 1 or x == 3 or x == 5 or x == 7 or x == 8 or x == 10) and (y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12):
    print("Yes")
else:
    print("No")
"""

"""
A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
tmp = False

for i in range(7):
    if A[i] == x:
        for j in range(i,7):
            if A[j] == y:
                tmp = True
for i in range(4):
    if B[i] == x:
        for j in range(i,4):
            if B[j] == y:
                tmp = True
if tmp:
    print("Yes")
if not tmp:
    print("No")
"""

A = [1,3,5,7,8,10,12]
B = [4,6,9,11]
if x in A and y in A:
    print("Yes")
elif x in B and y in B:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define N 100000
int data[N],dp[N];
main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++)cin>>data[i];
  dp[0]=0,dp[1]=abs(data[1]-data[0]);
  for(int i=2;i<n;i++){
  	dp[i]=min(dp[i-2]+abs(data[i]-data[i-2]),dp[i-1]+abs(data[i]-data[i-1]));
  }
  cout<<dp[n-1]<<"\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


int main() {
  long long a,b,k;
  cin >> a >> b >> k;
  
  if (k<=a) a-=k;
  else if(k<=a+b) {
    b=a+b-k;
    a=0;
  }
  else {
    a=0;
    b=0;
  }
  
  cout << a << " " << b << endl;
   
}


Measured memory_bytes: 256
"use strict";

const main = args => {

    const input = args.trim().split(" ");
    const k = parseInt(input[0]);
    const x = parseInt(input[1]);

    const left = Math.max(-1000000, x - k + 1);
    const right = Math.min(1000000, x + k - 1);

    for (let i = left; i <= right; i++) {
        if (i > left) {
            process.stdout.write(" ");
        }
        process.stdout.write(i.toString());
    }
    process.stdout.write("\n");
}

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

Measured memory_bytes: 29600
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
ll dp2[300000][60]={};
int main() {
	int n,k;
	cin>>n>>k;
	vector<ll> h;
	rep(i,n){
		ll a;
		cin>>a;
		h.push_back(a);
	}
	sort(h.begin(),h.end());
	ll r=0;
	rep(i,n-k){
		r+=h[i];
	}
	cout<<r;
	return 0;
}


Measured memory_bytes: 6132
N = int(input())
cnt_max = 0
num_max = 1
for i in range(1,N+1):
  cnt = 0
  num = i
  while True:
    if i%2 == 0:
        i = i/2
        cnt += 1
    else:
      break
  if cnt_max < cnt:
    cnt_max = cnt
    num_max = num
print(int(num_max))

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		int[] xi = new int[n];
		for (int i = 0; i < n; i++)
			xi[i] = in.nextInt();
		int[] yi = new int[m];
		for (int i = 0; i < m; i++)
			yi[i] = in.nextInt();
		
		boolean z = false;
		if (x < y && max(xi) < min(yi) && x < min(yi) && max(xi) < y)
			z = true;
		if (z == true)
			System.out.println("No War");
		else
			System.out.println("War");

	}
	public static int max(int[] list){
		int ans = Integer.MIN_VALUE;
		for (int i = 0; i < list.length; i++){
			if (list[i] > ans)
				ans = list[i];
		}
		return ans;
	}
	public static int min(int[] list){
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < list.length; i++){
			if (list[i] < ans)
				ans = list[i];
		}
		return ans;
	}

}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;

void solve() {
	string s, t;
	cin >> s >> t;
	int ans = INT_MAX;
	for (int i = 0; i + t.size() - 1 <= s.size() - 1; i++) {
		int cnt = 0;
		for (int j = 0; j < t.size(); j++) {
			if (t[j] != s[i + j])cnt++;
		}
		ans = min(cnt, ans);
	}
	cout << ans;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}



Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
using ll = long long;
int main(){
    int n; std::cin >> n;
    std::vector<int>A(n+1);
    std::vector<int>B(n);
    for(auto && e : A)
        std:: cin >> e;
    for(auto && e : B)
        std:: cin >> e;
    ll a = 0, ta = 0;
    auto tA = A;
    reverse(tA.begin(),tA.end());
    for(int i = 0; i < n; ++i){
        
        a += std::min(A[i], B[i]);
        B[i] -= std::min(A[i],B[i]);
        a += std::min(A[i+1],B[i]);
        A[i+1] -= std::min(B[i],A[i+1]);
        
        int cp = B[n - i - 1];
        if(cp > tA[i]){
            ta += std::min(tA[i],cp);
            cp -= std::min(tA[i],cp);
            ta += std::min(tA[i+1],cp);
            tA[i+1] -= std::min(cp,tA[i+1]);
        }
    }
    std::cout << std::max(ta,a) << std::endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  ll X,Y,Z,K;
  cin >> X >> Y >> Z >> K;
  vector<ll> A(X);
  vector<ll> B(Y);
  vector<ll> C(Z);
  vector<ll> D;
  for (int i = 0; i < X; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < Y; i++) {
    cin >> B[i];
  }
  for (int i = 0; i < Z; i++) {
    cin >> C[i];
  }
  sort(A.begin(),A.end(), greater<ll>());
  sort(B.begin(),B.end(), greater<ll>());
  sort(C.begin(),C.end(), greater<ll>());
  for (int i = 0; i < min(K,X); i++) {
    for (int j = 0; j < min(K,Y); j++) {
      D.push_back(A[i]+B[j]);
    }
  }
  sort(D.begin(),D.end(), greater<ll>());
  vector <ll> E;
  for (int i = 0; i < min((ll)(D.size()),K); i++) {
    E.push_back(D[i]);
  }
  vector<ll> ans;
  for (int i = 0; i < min((ll)(E.size()),K); i++) {
    for (int j = 0; j < Z; j++) {
      ans.push_back(E[i]+C[j]);
    }
  }
  sort(ans.begin(),ans.end(), greater<ll>());
  for (int i = 0; i < K; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 43400
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
  int a, b, c, d[100], n;

  cin >> n >> a >> b >> c;

  for (int i = 0; i < n; i++){
    cin >> d[i];
  }
  
  sort(d, d + n, greater<int>());

  for (int i = 0; i < n - 1; i++){
    d[i + 1] += d[i];
  }

  int max;
  max = c / a;

  for (int i = 0; i < n; i++){
    int e = (c + d[i]) / (a + (i * b) + b);
    if (max <= e){
      max = e;
    }
  }

  cout << max << endl;

  return 0;
}

Measured memory_bytes: 1176
n = int(input())
A = list(map(int, input().split()))
d = {}
for i in range(n):
    if A[i] not in d:
        d[A[i]] = 1
    else:
        d[A[i]] += 1
#print(d)

L = []
for k, v in d.items():
    if v >= 2:
        L.append([k, v])
L.sort(reverse=True)
if len(L) == 0:
    print(0)
elif len(L) == 1:
    if L[0][1] < 4:
        print(0)
    else:
        print((L[0][0])**2)
else:
    if L[0][1] >= 4:
        print((L[0][0])**2)
    else:
        print(L[0][0]*L[1][0])


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

int main(){
    map<int,int> mp;
    vector<int> v;
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        int u,s;
        cin >> u >> s ;
        mp[u]=s;
        v.push_back(u);
    }
    sort(v.begin(),v.end());
    int ans=0;
    ans+=mp[v[N-1]]+v[N-1];
    cout << ans << "\n";
    return 0 ;
}

Measured memory_bytes: 5368
#include<stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <sstream>
#include<math.h>
#include <algorithm>
using namespace std;



int main(void)
{
  int i=0;
  int aiTable[5];
  int v[5];

cin>>aiTable[0]>>aiTable[1]>>aiTable[2]>>aiTable[3]>>aiTable[4];
 sort(aiTable, aiTable + 5);

for(i=0;i<5;i++)
{
v[4-i]=aiTable[i];
}

for(i=0;i<5;i++)
    {
	cout<<v[i];
	if(i<4){cout<<" ";}
    }
cout<<endl;
}

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

int main()
{
	int n,m; scanf("%d%d",&n,&m);
	int ai;
	int sum=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d",&ai);
		sum+=ai;
	}
	if(sum>n) printf("-1\n");
	else printf("%d\n",n-sum);
	return 0;
}

Measured memory_bytes: 3828
N=int(input())
def test(n):
    buf=0
    for i in range(1,n):
        if i**2 > n:
            break
        if i**2 == n:
            buf+=1
            break
        if n%i==0:
            buf+=2
    return buf

ans=0
for i in range(N-1):
    ans+=int((N-1)/(i+1))

print(ans)


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

using namespace std;

vector<long long> cir(vector<long long>x){
    vector<long long>Y;
    int count=0;
    Y.push_back(x[0]);
    for(int i=1;i<x.size();i++){
//        cout<<x[i]<<endl;
        if(x[i]%x[0]==0){
            count++;
        }else{
            Y.push_back(x[i]%x[0]);
        }
        if(x[i]%x[0]==1){
            cout<<1<<endl;
            exit(0);
        }

    }
//    cout<<count<<" "<<x.size()-1<<endl;
    if(count==x.size()-1){
        cout<<Y[0]<<endl;
        exit(0);
    }
    sort(Y.begin(),Y.end());
    cir(Y);
}

int main()
{
    int N;
    cin>>N;
    vector<long long>A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    sort(A.begin(),A.end());
    cir(A);
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define inf (int)1e9+7
#define eb emplace_back

template<typename T> void out(vector<T> v) {rep(i, v.size()) cout << v[i] << " "; cout << endl;}
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int n, k; string s; cin >> n >> k >> s;
    vector<int> Nums;
    int now = 1; //今見ているかず
    int cnt = 0; //nowがいくつ並んでいるか
    for (int i = 0; i < n; ++i) {
        if (s[i] == (char)('0' + now)) cnt++;
        else {
            Nums.eb(cnt);
            now = 1 - now; //0, 1 切り替え
            cnt = 1; //新しいのをカウントし始める
        }
    }
    if (cnt != 0) Nums.push_back(cnt);
    //1 - 0 - 1 - 0 - 1
    //0で終わってたら
    if(Nums.size() % 2 == 0) Nums.eb(0);
    int Add = 2 * k + 1;
    int ans = 0;
    //1 - 0 - 1...の1から始めるので偶数番目だけ見る
    for (int i = 0; i < Nums.size(); i += 2) {
        int tmp = 0;
        int left = i;
        int right = min(i + Add, (int)Nums.size());
        for (int j = left; j < right; ++j) {
            tmp += Nums[j];
        }
        chmax(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1020
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

struct edge {
	ll to;
	ll cost;
};
typedef pair<ll, ll> P;
vector<vector<edge>> G;
int N, u, v, ans = 0;
vector<int> adist,bdist;

void dfs1(int pos, int depth) {
	adist[pos] = depth;
	for (int i = 0; i < G[pos].size(); i++) {
		if (adist[G[pos][i].to] != -1)continue;
		dfs1(G[pos][i].to, depth + 1);
	}
}

void dfs2(int pos, int depth) {
	bdist[pos] = depth;
	for (int i = 0; i < G[pos].size(); i++) {
		if (bdist[G[pos][i].to] != -1)continue;
		dfs2(G[pos][i].to, depth + 1);
	}
}


int main() {
	cin >> N >> u >> v;
	G = vector<vector<edge>>(N + 1);
	bdist = adist = vector<int>(N + 1, -1);
	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		G[a].push_back({ b,1 });
		G[b].push_back({ a,1 });
	}
	dfs1(v, 0); dfs2(u, 0);
	for (int i = 1; i <= N; i++) {
		if (G[i].size() == 1) {
			if (bdist[i] < adist[i]) {
				ans = max(ans, adist[i]);
			}
		}
	}
	cout << ans - 1 << endl;
}

Measured memory_bytes: 10624
import math
n,d = list(map(int,input().split()))
List = []
for i in range(n):
	List.append(list(map(int,input().split())))
count = 0
for i in range(n):
	for j in range(n):
		if(i < j):
			s = 0
			for k in range(d):
				s = s + (List[i][k] - List[j][k]) * (List[i][k] - List[j][k])
			if(math.sqrt(s).is_integer()):
				count = count + 1
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
 
#define N  100005
signed main()
{
	fast;
	int n,m;
	cin>>n>>m;
	int arr[n];
	int i,j,k;
	int sum=0;
	for(i=0;i<=n-1;i++)
	{
		cin>>arr[i];
		sum+=arr[i];
	}
	float x=(float)sum/(4*m);
	sort(arr,arr+n);
	int num=0;
	for(i=0;i<=n-1;i++)
	{
		if((float)arr[i]>=x)
		{
			num++;
		}
	}
	if(num>=m)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] A = new int[n];
    for (int i = 0; i < n; i++)
      A[i] = sc.nextInt();
    for (int i = n - 1; i > 0; i--)
      System.out.printf("%d ", A[i]);
    System.out.println(A[0]);
  }
}


Measured memory_bytes: 26468