akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <cstring>
#include <iomanip>
using namespace std;

#define double long double
//#define int long long
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << '\n';
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; };
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; };

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}

const int N = 2e5 + 10;
int a[N];

signed main() {
	fast();
	int n, k;
	cin >> k >> n;
	int ans = k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i + 1 < n; i++) {
		chkmin(ans, k - a[i + 1] + a[i]);
	}
	chkmin(ans, a[n - 1] - a[0]);
	cout << ans << '\n';
 	return 0;
}

Measured memory_bytes: 1024
<?php
fscanf(STDIN, "%s", $S);
$S_lis = str_split($S);
$ATGC = array("A", "G", "T", "C");
$i = 0;
$tmp = 0;
$ans = 0;
while (True){
    if (in_array($S_lis[$i], $ATGC)){
        $tmp++;
    } else {
        if ($tmp > $ans){
            $ans = $tmp;
            $tmp = 0;
        }
    }
    if ($i == count($S_lis)){
        break;
    }
    $i++;
}
echo $ans;

Measured memory_bytes: 3828
#include <stdio.h>
int main(void)
{
	long n,m;
	scanf("%ld%ld",&n,&m);
	if(n==1 && m==1){
		puts("1");
	}else if(n>=2 && m>=2){
		printf("%ld\n",(n-2)*(m-2));
	}else if(n==1 || m==1){
		printf("%ld\n",n*m-2);
	}
	return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	A := scanInts(3)
	sort.Ints(A)
	fmt.Println(A[2] - A[0])
}

/*
	Snippets
*/
func scanInt() (n int) {
	fmt.Scan(&n)
	return
}
func scanInts(n int) []int {
	N := make([]int, n)
	for i := 0; i < n; i++ {
		N[i] = scanInt()
	}
	return N
}
func scanInts2(n int) ([]int, []int) {
	N1, N2 := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		N1[i] = scanInt()
		N2[i] = scanInt()
	}
	return N1, N2
}
func scanInts3(n int) ([]int, []int, []int) {
	N1, N2, N3 := make([]int, n), make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		N1[i] = scanInt()
		N2[i] = scanInt()
		N3[i] = scanInt()
	}
	return N1, N2, N3
}
func scanMatrix(n, m int) [][]int {
	M := make([][]int, n)
	for i := 0; i < n; i++ {
		M[i] = scanInts(m)
	}
	return M
}
func scanStr() (s string) {
	fmt.Scan(&s)
	return
}
func scanStrs(n int) []string {
	S := make([]string, n)
	for i := 0; i < n; i++ {
		S[i] = scanStr()
	}
	return S
}
func getAbs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func getPow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}
func getMin(nums ...int) (int, int) {
	if len(nums) == 0 {
		panic("funciton getMin() requires at least one argument.")
	}
	min := nums[0]
	pos := 0
	for i := 1; i < len(nums); i++ {
		if min > nums[i] {
			min = nums[i]
			pos = i
		}
	}
	return min, pos
}
func getMax(nums ...int) (int, int) {
	if len(nums) == 0 {
		panic("funciton getMax() requires at least one argument.")
	}
	max := nums[0]
	pos := 0
	for i := 1; i < len(nums); i++ {
		if max < nums[i] {
			max = nums[i]
			pos = i
		}
	}
	return max, pos
}

/*
	Sort template
*/
type sortType struct {
	a int
	b int
}
type byA []sortType

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[n];
  int ans=0;
  rep(i,n){
    cin >> a[i];
    while(a[i]%2==0){
      a[i]/=2;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int N, ans =0;
	cin >> N;
	
	ans += min(9, N-0);
	if (N>=100) ans += min(900, N-99);
	if (N>=10000) ans += min(90000, N-9999);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
#include<string.h>
typedef long long int ll;
using namespace std;
priority_queue<int,vector<int>,greater<int>> q;
int mod=1e9+7;
int main()
{
	int n,i,j,m,a;
	cin>>n;
	int s=0;
	for(i=0;i<n;i++)
	{
		cin>>a;
		q.push(a);
		if(q.top()==a)
		s++;
	}
	printf("%d\n",s);
	
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

double dist(int d, vi p1, vi p2) {
  int su = 0;
  for(int i=0;i<d;++i) {
    su += (p1[i] - p2[i]) * (p1[i] - p2[i]);
  }
  return sqrt(su);
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, d; cin >> n >> d;
  vvi x(n, vi(d));
  for(int i=0;i<n;++i) {
    for(int j=0;j<d;++j) {
      cin >> x[i][j];
    }
  }

  int cnt = 0;
  for(int i=0;i<n;++i) {
    for(int j=i+1;j<n;++j) {
      double tmp = dist(d, x[i], x[j]);
      if(abs(tmp - floor(tmp)) < eps) cnt++;
    }
  }
  cout << cnt << endl;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
constexpr int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;

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

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x, y, z, k;
	cin >> x >> y >> z >> k;
	vl a(x), b(y), c(z);
	REP(i, x)cin >> a[i];
	REP(i, y)cin >> b[i];
	REP(i, z)cin >> c[i];
	ll l = 1, r = INF * INF;
	vl v;
	REP(i, x)REP(j, y)v.push_back(a[i] + b[j]);
	sort(ALL(v));
	sort(ALL(c));
	while (r - l > 1) {
		ll mid = (r + l) / 2;
		ll cnt = 0;
		REP(i, v.size()) {
			ll t = mid - v[i];
			ll s = lower_bound(ALL(c), t) - c.begin();
			cnt += z - s;
		}
		if (cnt >= k)l = mid;
		else r = mid;
	}
	vl ans;

	REP(i, v.size()) {
		ll t = l - v[i];
		ll s = upper_bound(ALL(c), t) - c.begin();
		FOR(j, s, z) {
			ans.push_back(v[i] + c[j]);
		}
	}
	while (ans.size() < k)ans.push_back(l);
	sort(ALL(ans));
	RREP(i, ans.size()) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 10480
#include <cstdio>
#include <iostream>

using namespace std;

int main(){
  
  int n;
  
  while(cin >> n){
    bool d[1000000];
    int ans = 0;
    
    for(int i = 1;i <= n;i++){
      d[i] = true;
    }
    d[1]  = false;
    
    for(int i = 1;i <= n;i++){
      if(d[i] == true){
	ans++;
	for(int j = 1;j*i <= n;j++){
	  d[i*j] = false;
	}
      }
    }
    
    printf("%d\n",ans);
  }
  
  return 0;
  
}
    
    


Measured memory_bytes: 2120
N = int(input())
S = list(input())

f = 0
b = 0
count = 0
for i in range(N - 1, -1, -1):
    if S[i] == '(':
        if count > 0:
            count -= 1
        else:
            b += 1
    else:
        count += 1
    
print ('(' * count, end = '')
print (*S, sep = '', end = '')
print (')' * b)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
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); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    pairs p(N);
    REP(i, N){
        cin >> p[i].s >> p[i].f;
    }
    Sort(p);
    int t = 0;
    bool f = true;
    REP(i, N){
        t += p[i].s;
        if(t > p[i].f) f = false;
    }
    Ans(f, "Yes", "No");

    return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 10e9+5;
int main()
{
    int n,x,i,j;
    cin>>n;
    vector<int>v;
    vector<int>dp(n,INF);
   for(i=1;i<=n;i++)
   {
       cin>>x;
       v.push_back(x);
   }
    dp[0]=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<=i+2;j++)
        {
            if(j<n)
                dp[j]=min(dp[j],dp[i]+abs(v[i]-v[j]));
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1276
#include <stdio.h>

long long power3[32];
#define LIM3 31 // 3^32 > 2^50

void prepare()
{
  int i;
  long long acc;
  for(i=0,acc=1LL;i<LIM3;i++)
    {
      power3[i]=acc;
      acc *= 3;
    }
}


int log3(long long n)
{ int i;
  for(i=0;i<LIM3;i++)
    if((n >= power3[i]) && (n < 3*power3[i]))
      return(i);
      
  return(-1);
}

int solve1(long long n)
{
  int ret;
  
  ret=log3((n+2)/2);
  
  return(ret);
}

int sum_digits(long long n)
{
  int ret;
  ret=0;
  while(n>0)
    {
      ret += (n % 3);
      n /= 3;
    }
  return(ret);
}

int solve2(long long n,long long h)
{
  int ret;
  
  ret=n/h;
  ret+=sum_digits(n % h);
  return(ret);
}


int main()
{
  long long n,n2;
  int ret,ret1,ret2;
  
  prepare();

  scanf("%lld",&n);
  ret1=solve1(n);
  
  n2 = n-(2*power3[ret1]-2);
  ret2=solve2(n2,power3[ret1]);

  ret=2*ret1+ret2;
  printf("%d\n",ret);
  
  return(0);
}



Measured memory_bytes: 2108
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
    int n, p;
    while (cin >> n >> p && n&&p) {
        vector<int> d(n,0);
        int cnt = 0,turn=0;
        while (cnt != 1||!d[turn]||p!=1) {
            for (int i = 0; i < p; ++i) {
                if (!d[(turn+i)%n]) ++cnt;
                ++d[(turn+i)%n];
            }
            turn += p;
            p = 0;
            while (!d[turn%n]) {
                ++turn;
            }
            --cnt;
            turn %= n;
            p = d[turn];
            d[turn] = 0;
            turn = (turn + 1) % n;
        }
        cout << turn << endl;
    }
    return 0;
}


Measured memory_bytes: 3068
#include<iostream>
#include<vector>
#include<climits>

int check(long long n, const std::vector<long long> list);


int main(){
	int k;
	long long maxVal=-1;
	long long minVal=-1;
	long long left;
	long long right;
	long long mid;
	std::vector<long long> aList; 

	std::cin>>k;
	aList.resize(k);

	for(int i=0; i<k; i++)
		std::cin>>aList[i];

	left=2;
	right= LLONG_MAX;

	while(right-left>1){
		mid= left+ (right-left)/2;
		int status= check(mid, aList);

		switch(status){
			case -1:
				left= mid;
				break;
			case 0:
				left= mid;
				break;
			case 1:
				right= mid;
				break;
			default:
				break;
		}
	}

	if(check(left, aList)==0)
		maxVal= left;

	if(check(right, aList)==0)
		maxVal= right;

	left=2;
	right= LLONG_MAX;

	while(right-left>1){
		mid= left+ (right-left)/2;
		int status= check(mid, aList);

		switch(status){
			case -1:
				left= mid;
				break;
			case 0:
				right= mid;
				break;
			case 1:
				right= mid;
				break;
			default:
				break;
		}
	}

	if(check(right, aList)==0)
		minVal= right;

	if(check(left, aList)==0)
		minVal= left;

	if(minVal==-1 || maxVal==-1){
		std::cout<<-1<<std::endl;
		return 0;
	}

	std::cout<<minVal<<" "<<maxVal<<std::endl;

	return 0;
}


int check(long long n, const std::vector<long long> list){
	for(int i=0; i<list.size(); i++){
		if(n<list[i])
			return -1;

		n-= n%list[i];
	}

	if(n==2)
		return 0;
	else
		return 1;
}

Measured memory_bytes: 1792
dishes = []
minimum = 9
min_id = 0

for i in range(5):
  t = int(input())
  dishes.append(t)
  if t % 10 <= minimum and t % 10 > 0:
    minimum = t % 10
    min_id = i

print(sum([dishes[i] + (10 - dishes[i] % 10) if i != min_id and dishes[i] % 10 != 0 else dishes[i] for i in range(len(dishes))]))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

const int MAXN = 105;

int n;
vector<int> a, res;

signed main() {
	ios_base::sync_with_stdio(0);

	cin >> n;
	a.resize(n + 1);
	for (int i = 1; i <= n; ++i) cin >> a[i];
	
	for (int turn = n; turn >= 1; --turn) {
		for (int i = a.size() - 1; i > 0; --i) {
			if (a[i] == i) {
				res.push_back(i);
				a.erase(a.begin() + i);
				break;
			}
		}
	}

	if (res.size() == n) {
		for (int i = n - 1; i >= 0; --i) cout << res[i] << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))  # リスト入力（数値）  map関数はリストの各要素に対して関数を適用してくれる

l = list()
for h in range(len(H)):
    l.append(abs(T - H[h] * 0.006 - A))

print(l.index(min(l))+1)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	int a, b;
	cin >> a >> b;
	cout << max(0, a - b) << endl;
	return 0;
}

//Ctrl+Aを使わない

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll a, b, h;
    cin >> a >> b >> h;
    cout << ((double)a + b) * h / 2 << endl;
    return 0;
}



Measured memory_bytes: 256
H,W = map(int,input().split())
a = [input() for i in range(H)]
b = [0] * W
c = [0] * H
for i in range(H):
    cnt = 0
    for j in range(W):
        if a[i][j] == '#':
            b[j] += 1
            cnt += 1
    c[i] = cnt 

for i in range(H):
    if c[i]==0:
        continue
    for j in range(W):
        if b[j]!=0:
            print(a[i][j],end='')
    print()


Measured memory_bytes: 9136
def resolve():
    table={}
    n=int(input())
    for i in range(n):
        tmp=input()
        if tmp in table.keys():
            table[tmp]+=1
        else:
            table[tmp]=1
    m=int(input())
    for i in range(m):
        tmp=input()
        if tmp in table.keys():
            table[tmp]-=1
        else:
            table[tmp]=-1
    ans=max(table.values())
    if ans<0:
        print(0)
    else:
        print(ans)
resolve()

Measured memory_bytes: 38512
import java.util.*;

public class Main {
	 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
	 int []value ={6000,4000,3000,2000};
	 int []ans;
	 for(int i=0; i<4; i++){
		 int t=sc.nextInt()-1;
		 int n=sc.nextInt();
		  System.out.println(value[t]*n);
	 }
	 }
	 }

Measured memory_bytes: 17180
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 1e5;

int n;
int t[(N << 1) + 1];
struct Node {
	int x, num;
} node[(N << 1) + 1];
ll ans;

inline bool compare(Node a, Node b)
{
	return a.x < b.x;
}
int main()
{
	n = read();
	for (int i = 1; i <= n; i++) {
		int x = read();
		node[((i - 1) << 1) + 1] = Node{ x, ((i - 1) << 1) + 1 };
		x = read();
		node[i << 1] = Node{ x, i << 1 };
	}

	sort(node + 1, node + (n << 1) + 1, compare);
	for (int i = 1; i <= n; i++) {
		ans += (ll)node[i].x;
		t[node[i].num]++;
	}
	bool flag = true, flag2 = true, flag3 = true;
	for (int i = 1; i <= n; i++) {
		if (t[((i - 1) << 1) + 1])
			flag2 = false;
		if (t[i << 1])
			flag3 = false;
		if (t[((i - 1) << 1) + 1] && t[i << 1])
			flag = false;
	}
	if (flag && !flag2 && !flag3) {
		if ((node[n].num + 1) >> 1 != (node[n + 1].num + 1) >> 1)
			ans += (ll)node[n + 1].x - (ll)node[n].x;
		else
			ans += (ll)min(node[n + 2].x - node[n].x, node[n + 1].x - node[n - 1].x);
	}

	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 5992
#include<bits/stdc++.h>
#define ll  long long int
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;
/*const int N = 2e6+5;
ll cnt[N];*/
/*bool sortinrev(const pair<ll,ll> &a,
               const pair<ll,ll> &b)
{
     return (a.f<b.f);
}*/
void solve()
{   ll n,m,k,y,x,res=0,l,r,cnt0=0,z,sum1=0,cnt1=0,h,res1,ans=0,sum=0;
    string s;
    cin>>s;
    k=sz(s);
    rep(i,0,k)
    if(s[i]=='o')
        ans++;
    res=(15-k);
    res1=(8-ans);
    if(res>=res1)
        cout<<"YES";
    else
        cout<<"NO";
}
int main()
{   speed_up
    ll t;
   //cin>>t;
    t=1;
    while(t--)
        solve();

}


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

int main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);cout.tie(NULL);
    int h,a;
    cin>>h>>a;
    if(h%a==0)cout<<h/a<<'\n';
    else cout<<h/a+1<<'\n';
}

Measured memory_bytes: 256
def main():
    N = int(input())
    d = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
    for i in range(N):
        S = input()
        d[S] += 1
    print('AC x', d['AC'])
    print('WA x', d['WA'])
    print('TLE x', d['TLE'])
    print('RE x', d['RE'])
main()


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
	cin >> n;
	vi a(n);
	rep(i,n) cin >> a[i]; 
	sort(all(a));
  
	// a[n-1] が最大
	// かたわれは a[n-1]/2 に一番近いものを選ぶ
	// 2分探索は無理？
	int t = 0;
	int mid = a[n-1]/2;
	int temp = INT_MAX;
	rep(i,n-1){
		int dis;
		if(a[n-1]%2==0) dis = abs(mid - a[i]);
		else dis = min(abs(mid - a[i]), abs(mid + 1 - a[i]));
		if(dis < temp) {
			t = i;
			temp = dis;
		}
    }
	cout << a[n-1] << " " << a[t] << endl;  
	return;
}

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

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
        int i,j,k,f,n,x,sum;
        while(1){
                f = 0;
                sum = 0;
                scanf("%d %d",&n,&x);
                if(n==0&&x==0) break;
                for(i=1;i<=(n-2);i++){
                        for(j=(i+1);j<=(n-1);j++){
                                for(k=(j+1);k<=n;k++){
                                        sum = k + j + i;
                                        if(sum == x) f++;
                                }
                        }
                }
                printf("%d\n",f);
        }
        return 0;
}

Measured memory_bytes: 600
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<bits/stdc++.h>
using namespace std;
std::mt19937 rnd(time(0));//std::mt19937_64 rnd(time(0));
namespace Sakurajima_Mai{
	#define si(a) scanf("%d",&a)
	#define sl(a) scanf("%lld",&a)
	#define sd(a) scanf("%lf",&a)
	#define ss(a) scanf("%s",a)
	#define ms(a) memset(a,0,sizeof(a))
	#define reg register
	#define repi(i,a,b) for(reg int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
	#define repd(i,a,b) for(reg int i=a,bbb=b;i>=bbb;--i)
	#define reps(s) for(reg int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
	#define ce(i,r) i==r?'\n':' '
	#define pb push_back 
	#define all(x) x.begin(),x.end()
	#define gmn(a,b) a=min(a,b)
	#define gmx(a,b) a=max(a,b)
	#define fi first
	#define se second
	#define pr(x) cout<<#x<<": "<<x<<endl
	typedef long long ll;
	typedef unsigned long long ull;
	typedef double db;
	const int infi=2e9;
	const ll infl=4e18;
	inline int qi(){
    int f=0,fu=1; char c=getchar();
    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
    return f*fu;
	}
	inline ll ql(){
		ll f=0;int fu=1; char c=getchar();
	    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
	    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
	    return f*fu;
	}
	inline db qd(){
	    char c=getchar();int flag=1;double ans=0;
	    while((!(c>='0'&&c<='9'))&&c!='-') c=getchar();
	    if(c=='-') flag=-1,c=getchar();
	    while(c>='0'&&c<='9') ans=ans*10+(c^48),c=getchar();
	    if(c=='.'){c=getchar();for(register int Bit=10;c>='0'&&c<='9';Bit=(Bit<<3)+(Bit<<1)) ans+=(double)(c^48)*1.0/Bit,c=getchar();}
	    return ans*flag;
	}
	inline ll ceil_div(ll a,ll b){ return (a+b-1)/b; }
}
using namespace Sakurajima_Mai;
const int MAX_N=3e5+5;
struct node{ int l,r,mx; };
struct SegTree{//?????
	#define kl k<<1
	#define kr k<<1|1
	node tr[MAX_N<<2];
	void pushup(int k){ tr[k].mx=max(tr[kl].mx,tr[kr].mx); }
	void build(int k,int l,int r)
	{
		tr[k].l=l,tr[k].r=r;
		if(l==r) { tr[k].mx=0; return; }
		int mid=(l+r)>>1; build(kl,l,mid),build(kr,mid+1,r); pushup(k);
	}
	void update_point(int k,int pos,int val)//????
	{
		if(tr[k].l==tr[k].r){ gmx(tr[k].mx,val); return ; }
		int mid=(tr[k].l+tr[k].r)>>1;
		if(pos<=mid) update_point(kl,pos,val);
		if(pos>mid) update_point(kr,pos,val);
		pushup(k);
	} 	
	int query_interval(int k,int l,int r)//????
	{
		if(l<=tr[k].l&&tr[k].r<=r) return tr[k].mx;
		int mid=(tr[k].l+tr[k].r)>>1;
		int ans=0;
		if(l<=mid) gmx(ans,query_interval(kl,l,r));
		if(r>mid) gmx(ans,query_interval(kr,l,r));
		return ans;
	}
}Tr;
int a[MAX_N],dp[MAX_N];
int main()
{
	int n=qi(),k=qi(),ans=0,mx=0;
	repi(i,1,n) a[i]=qi(),gmx(mx,a[i]);
	Tr.build(1,1,mx);
	repi(i,1,n){
		dp[i]=1;
		int l=max(1,a[i]-k),r=min(mx,a[i]+k);
		gmx(dp[i],1+Tr.query_interval(1,l,r)),gmx(ans,dp[i]);
		Tr.update_point(1,a[i],dp[i]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 18424
#include <iostream>

using namespace std;

int main() {
    string t = "CODEFESTIVAL2016";
    string s;
    cin >> s;

    int ans = 0;
    for (int i = 0; i < s.length(); i++) if(t[i] != s[i]) ans++;

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> v;
    vector<pair<int,int> > v1;
    vector<pair<long long int,long long int> > v2;
    for(int i = 0;i < n;i++)
    {
        int a,b;
        cin >> a >> b;
        v1.push_back(make_pair(a,b));
    }
    for(int i = 0;i < m;i++)
    {
        long long int a,b;
        cin >> a >> b;
        v2.push_back(make_pair(a,b));
    }
    for(int i = 0;i < n;i++)
    {
        int p;
        long long int min = LLONG_MAX;
        for(int j = 0;j < m;j++)
        {
            if((fabs(v1[i].first - v2[j].first) + fabs(v1[i].second - v2[j].second)) < min)
            {
                p = j;
                min = fabs(v1[i].first - v2[j].first) + fabs(v1[i].second - v2[j].second);
            }
        }
        v.push_back(p);
    }
    for(int i = 0;i < n;i++)
    {
        cout << v.at(i) + 1 << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    ll n;
    cin >> n;
    pair<ll, ll> range[n];
    repi(i, n, 0)
    {
        ll x, l;
        cin >> x >> l;
        range[i].second = x - l; //開始
        range[i].first = x + l;  //終了
    }
    sort(range, range + n);

    ll ans = 0, t = -INF;
    repi(i, n, 0)
    {
        if (t <= range[i].second)
        {
            ans++;
            t = range[i].first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    while(1){
        long long int kusa[1000]={0};
        long long int sa[1000]={0};
        int N;
        cin>>N;
        if(!N)break;
        for(int i=0;i<N+1;i++)cin>>kusa[i];
        //sort(kusa,kusa+N);
        for(int i=0;i<N;i++)sa[i]=kusa[i+1]-kusa[i];
        if(sa[0]!=sa[1]&&sa[1]==sa[2]&&sa[2]==sa[3])cout<<kusa[0]<<endl;
        //else if(sa[0]==sa[1]&&sa[1]==sa[2]&&sa[N-1]!=sa[N-2])cout<<kusa[N]<<endl;
        else if(sa[0]+sa[1]==sa[2]&&sa[2]==sa[3])cout<<kusa[1]<<endl;
        else{
            //puts("hoge");
            for(int i=0;;i++){
                if(sa[0]!=sa[i]){
                    cout<<kusa[i+1]<<endl;
                    break;
                }
            }
        }
        /*
        for(int i=0;i<N;i++){
            printf("[%d]",sa[i]);
        }
        puts("");
        */
    }
    return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
#define pll pair<ll,ll>
typedef long long ll;
#define mod 1000000007
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 1e15
long long binpow(long long a, long long b, long long m) 
{
	a %= m;
	long long res = 1;
	while (b > 0) 
	{
		if (b & 1) res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modInverse(int A,int M)
{
	return binpow(A,M-2,M);
}
int main()
{
	ll n;
	cin>>n;
	vector<ll> v(n+1);
	ll prod=1;
	ll g=v[1];
	for(ll i=1;i<=n;i++) cin>>v[i];
	vector<ll> p(1000005);
	ll lcm=1;
	for(ll i=0;i<=1e6;i++) p[i]=1;
	for(ll i=1;i<=n;i++)
	{
		ll p1=v[i];
		for(ll j=2;j*j<=p1;j++)
		{
			ll cnt=1;
			if(p1%j==0)
			{
				while(p1%j==0)
				{
					p1/=j;
					cnt*=j;
				}
				p[j]=max(p[j],cnt);	
			} 
		}
		p[p1]=max(p1,p[p1]);
	}
	for(ll i=1;i<=1e6;i++)
	{
		lcm*=p[i];
		lcm%=mod;
	}
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
		ll ans1=lcm;
		ans1*=modInverse(v[i],mod);
		ans1%=mod;
		ans+=ans1;
		ans%=mod;
	}
	cout<<ans<<endl;
	return 0; 
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define forn(i,n) for(int i=0; i<(int)n; i++)
ll power(ll x,ll n);
bool isprime(ll n);

void test_case()
{
    ll n,allxor=0;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++) {
        cin>>a[i];
        allxor^=a[i];
    }
    for(int i=0;i<n;i++)
        cout<<(a[i]^allxor)<<" ";

}

int main()
{
    fastio
//    int t;
//    cin>>t;
//    while(t--)
    test_case();
}
ll power(ll x,ll n)
{
    ll ans=1;
    while(n>0) {
        if(n&1)
            ans*=x;
        n>>=1;
        x*=x;
    }
    return ans;
}

bool isprime(ll n)
{
    if(n==2 || n==3)
        return true;
    if(n<=1 || n%2==0 || (n%6!=1 && n%6!=5))
        return false;
    for(int i=3;i*i<=n;i+=2) {
        if(n%i==0)
            return false;
    }
    return true;
}


Measured memory_bytes: 5204
#include<bits/stdc++.h>
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
#define fee(i,u) for(int&i=cur[u];i;i=e[i].next)
#define el putchar('\n')
#define ta putchar('	')
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline void open(const char *s)
{
	#ifndef ONLINE_JUDGE
	char str[20];
	sprintf(str,"%s.in",s);
	freopen(str,"r",stdin);
//	sprintf(str,"%s.out",s);
//	freopen(str,"w",stdout);
	#endif
}
inline int rd()
{
	static int x,f;
	x=0;f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return f>0?x:-x;
}
const int N=110;
int n,m,a[N][N],vis[N*N],ans1[N][N],ans2[N][N];
int head[N<<1],tot,vs,vt;
struct edge{int v,f,next;}e[100010];

inline void add(int u,int v)
{
	e[++tot]=edge{v,1,head[u]};head[u]=tot;
	e[++tot]=edge{u,0,head[v]};head[v]=tot;
}

namespace flow{
int d[N<<1],cur[N<<1];
bool bfs(int vs)
{
	memset(d,-1,sizeof d);
	memset(cur,0,sizeof cur);
	d[vs]=0;cur[vs]=head[vs];
	static queue<int>q;while(!q.empty())q.pop();
	q.push(vs);
	while(!q.empty()){
		int u=q.front();q.pop();
		fe(i,u){
			int v=e[i].v,f=e[i].f;
			if(!~d[v]&&f){
				d[v]=d[u]+1;cur[v]=head[v];
				if(v==vt)return 1;
				q.push(v);
			}
		}
	}
	return 0;
}
int dfs(int u,int a)
{
	if(u==vt||!a)return a;
	int ans=0;
	fee(i,u){
		int v=e[i].v,f=e[i].f;
		if(f&&d[v]==d[u]+1){
			f=dfs(v,min(f,a));
			if(!f)continue;
			e[i].f-=f;e[i^1].f+=f;
			a-=f;ans+=f;if(!a)break;
		}
	}
	return ans;
}
inline void gao()
{
	while(bfs(vs))
		dfs(vs,1e9);
}

}

inline void gao(int id)
{
	memset(head,0,sizeof head);
	vs=0;vt=n+n+1;tot=1;
	fo(i,1,n)fo(j,1,m)if(!vis[a[i][j]])add(i,n+(a[i][j]+m-1)/m);
	fo(i,1,n)add(vs,i),add(i+n,vt);
	flow::gao();
	fo(u,1,n){
		int hh=0;
		fe(i,u){int v=e[i].v;if(v>n&&!e[i].f)hh=v-n;}
		fo(i,1,m)if(!vis[a[u][i]]&&(a[u][i]+m-1)/m==hh){
			vis[a[u][i]]=1;ans1[u][id]=a[u][i];break;
		}
	}
}

int main()
{
	n=rd();m=rd();
	fo(i,1,n)fo(j,1,m)a[i][j]=rd();
	fo(i,1,m)gao(i);
	fo(i,1,n){
		fo(j,1,m)printf("%d ",ans1[i][j]);el;
	}
	fo(i,1,n)fo(j,1,m)ans2[(ans1[i][j]+m-1)/m][j]=ans1[i][j];
	fo(i,1,n){
		fo(j,1,m)printf("%d ",ans2[i][j]);el;
	}
	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n,t,min=1000000009;
  cin>>n>>t;
  vector<int> a(n),b(n);
  std::map<int, int> mp;
  for (int i = 0; i < n; ++i)
  {
    cin>>a[i];
    b[i] = (min>a[i] ? 0:a[i]-min); 
    min=std::min(min,a[i]);
    mp[b[i]]++;
  }
  sort(b.begin(), b.end());
  cout<<mp[b[n-1]];
}

Measured memory_bytes: 5760
#include<stdio.h>
 
int main(void){
  int n,i;
  long long int ans=0;
  scanf("%d",&n);
  int a[n+1],b[n];
  for(i=0;i<n+1;i++) scanf("%d",&a[i]);
  for(i=0;i<n;i++) scanf("%d",&b[i]);
  for(i=0;i<n;i++){
    if((a[i]+a[i+1])<=b[i]){
      ans += a[i]+a[i+1];
      a[i+1] = 0;
    }else{
      ans += b[i];
      if(a[i]<b[i]){
        a[i+1] = a[i+1] - (b[i]-a[i]);
      }
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int x;
    cin >> x;
    int cnt_500=0, cnt_5=0;
    
    cnt_500 = x/500;
    x %= 500;
    cnt_5 = x/5;

    cout << (cnt_500*1000) + (cnt_5*5) << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>

#define INF 100000000

using namespace std;

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    printf("%c%c%c\n", toupper(a[0]), toupper(b[0]), toupper(c[0]));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;

using namespace std;

signed main() {
    int N, M;
    cin >> N >> M;
    int L_max = 0;
    int R_min = INT_MAX;
    RANGE(i, M){
        int l,r;
        cin >> l >> r;
        L_max = max(L_max, l);
        R_min = min(R_min, r);
    }
    cout << max(R_min - L_max + 1, 0) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i;
  int a[10000],n=0,g;
  double w,h;
  while(scanf("%d,%lf,%lf",&g,&w,&h)!=-1){
    if(w/h/h>=25){
      a[n]=g;
      n++;
    }
  }
  for(i=0;i<n;i++)
    printf("%d\n",a[i]);
  return 0;
}

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

int main() {

	int n, k; cin >> n >> k;
	string s; cin >> s;
	int score = 0;
	for (int i = 1; i < n; i++) {
		if (s[i - 1] == s[i]) score++;
	}
	cout << min(n - 1, score + 2 * k) << endl;
	return 0;
}

Measured memory_bytes: 3732
N,C=gets.split(' ').map(&:to_i)
d=[]
c=[]
dd=[]
(1..C).each{|e| d[e] = [nil] + gets.split(' ').map(&:to_i)}
(1..N).each{|e| c[e] = [nil] + gets.split(' ').map(&:to_i)}
cc = [[],[],[]]
(1..N).each do |x|
  (1..N).each do |y|
    case (x+y)%3
    when 0
      cc[0] << c[y][x]
    when 1
      cc[1] << c[y][x]
    when 2
      cc[2] << c[y][x]
    end
  end
end
3.times do |e|
  dd[e] = []
  (1..C).each do |t|
    dd[e][t]=0
    cc[e].each do |ee|
      dd[e][t] += d[ee][t]
    end
  end
end
puts (1..C).to_a.permutation(3).to_a.map { |m| (0...3).inject(0) {|sum, i| sum+dd[i][m[i]]} }.min


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

#define int long long

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

// idx, (未処理, 偶数左, 奇数, 偶数右)
const int VARI = 5;
int dp[200010][VARI];

signed main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }

  const int one = 0; // 左のゼロ区間
  const int two = 1; // 右のゼロ区間
  const int three = 2; // 左の偶数区間
  const int four = 3; // 右の偶数区間
  const int five = 4; // 奇数区間

  // 初期化
  fill(dp[0], dp[N+1], INF);
  dp[0][one] = 0;
  dp[0][two] = 0;
  dp[0][three] = 0;
  dp[0][four] = 0;
  dp[0][five] = 0;

  // DP
  for (int i = 0; i < N; i++) {
    // 左のゼロ区間
    int cost1 = v[i];
    chmin(dp[i+1][one], dp[i][one] + cost1);

    // 左の偶数区間
    int cost2 = v[i] == 0 ? 2 : v[i] % 2;
    chmin(dp[i+1][two], min(dp[i][one], dp[i][two]) + cost2);

    // 奇数区間
    int cost3 = v[i] == 0 ? 1 : (v[i] % 2 == 0);
    chmin(dp[i+1][three], min({dp[i][two], dp[i][three], dp[i][one]}) + cost3);

    // 右の偶数区間
    int cost4 = v[i] == 0 ? 2 : v[i] % 2;
    chmin(dp[i+1][four], min({dp[i][three], dp[i][four], dp[i][two], dp[i][one]}) + cost4);

    // 右のゼロ区間
    int cost5 = v[i];
    chmin(dp[i+1][five], min({dp[i][four], dp[i][three], dp[i][two], dp[i][one], dp[i][five]}) + cost5);
  }

  int ans = INF;
  for (int i = 0; i < VARI; i++) {
    chmin(ans, dp[N][i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n){
        int a;
        cin >> a;
        mp[a]++;
    }

    vector<pair<ll, ll>> p;
    for(auto i = mp.begin(); i != mp.end(); i++){
        if(i->second > 1) p.push_back(make_pair(i->first, i->second)); 
    }
    
    if((int)p.size() < 2) cout << 0 << endl;
    else{
        sort(p.begin(), p.end(), greater<pair<ll, ll>>());
        if(p[0].second > 3) cout << p[0].first * p[0].first << endl;
        else cout << p[0].first * p[1].first << endl;
    }
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    for(int i=0;i<2;++i){
        if(a > b) swap(a,b);
        if(b > c) swap(b,c);
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}



Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum, ans, dp[10000][10000],a[200000], b[2000000];
string str;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ -1,0 } ,{ 0,-1 } };
struct Edge { LL to, cost; };
vector<Edge>vec[10000];
vector<Pll>v;
map<string, LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

int main() {
	cin >> n >> m;
	rep(i, n) {
		cin >> a[i];
	}
	n--;
	cout << n / (m-1)+(n%(m-1)==0?0:1) << endl;
	return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000001ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.14159265358979323
 
int main() 
{
    FAST;
    ll n;
    cin>>n;
    ve<ll> v;
    ll a;
    for(int i=0;i<n-1;i++)
    {
    	cin>>a;
    	v.pb(a);
    }
    ll ans=0;
    for(int i=0;i<n-2;i++)
    	ans+=min(v[i],v[i+1]);
    ans+=v[n-2]+v[0];
   	cout<<ans;
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

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

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

  vector<uint16_t> v(N);

  for(int i = 0; i < N; i++) cin >> v[i];

  sort(v.begin(), v.end(), less<uint16_t>());

  double value = v[0];
  for(int i = 1; i < N; i++) {
    value = (value + v[i]) / 2.0;
  }
  cout << value;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<utility>
#include<algorithm>

using namespace std;

int n,a,b;
int main(){
  cin>>n>>a>>b;
  if((b-a)%2==0)cout<<"Alice"<<endl;
  else cout<<"Borys"<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int[][] c = new int[4][13];
		for( int i = 0 ; i < num ; i++ ) {
			String[] card = br.readLine().split(" ");
			int j = Integer.parseInt(card[1]);
			switch(card[0]) {
				case "S":
				c[0][j-1] = 1;
				break;
				case "H":
				c[1][j-1] = 1;
				break;
				case "C":
				c[2][j-1] = 1;
				break;
				case "D":
				c[3][j-1] = 1;
				break;
				default:
				/* do nothing */
			}
		}
		String[] color = { "S ", "H ", "C ", "D "};
		for( int i = 0 ; i < 4 ; i++ ) {
			String s = color[i];
			for( int j = 0 ; j < 13 ; j++ ) {
				if ( c[i][j] == 0 ) {
					System.out.println( s + (j+1) );
				}
			}
		}
	}
}

Measured memory_bytes: 24152
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
const int maxn = 200000 + 10;

template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

char st[maxn];
int nxt[maxn][26], len;
int step[maxn][26], s[maxn];

void printans(int u) {
    
    if(u == -1) return;
    for(int i = 0; i < 26; ++i) {
        if(step[u][i] == s[u]) {
            putchar(i + 'a');
            printans(nxt[u][i]); 
            break;
        }
    }
}

int main() {
#ifdef Wearry
    freopen("data.txt", "r", stdin);
    freopen("ans.txt", "w", stdout);
#endif

    scanf("%s", st + 1);
    len = strlen(st + 1);
    for(int i = len; i >= 0; --i) {
        for(int j = 0; j < 26; ++j) 
            nxt[i][j] = (i == len) ? -1 : nxt[i+1][j];
        if(i < len) nxt[i][st[i+1] - 'a'] = i+1;

        s[i] = INT_MAX;
        for(int j = 0; j < 26; ++j) {
            if(nxt[i][j] != -1) 
                step[i][j] = (i == len) ? 0 : s[nxt[i][j]] + 1;
            chkmin(s[i], step[i][j]);
        }
    }
    printans(0);

    return 0;
}


Measured memory_bytes: 41984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  cout<<a[a.size()-1]-a[0]<<endl;
  return 0;
}

Measured memory_bytes: 256
def solve():
    N, *H = map(int, open(0).read().split())
    
    ans, h_max = 1, H[0]
    for i in range(1, N):
        if h_max <= H[i]:
            ans += 1
            h_max = max(h_max, H[i])
    print(ans)


if __name__ == '__main__':
    solve()


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;


void solve()
{
	int n, r;
	cin >> n >> r;

	cout << r + 100 * (10 - min(n, 10));
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
#define pc putchar
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
using namespace std;
const int N=5005;
int n,A,B,a[N],pos[N],dp[N][N],s[N][N];
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-1;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();}
    return ret*ff;
}
void write(int x){if(x<0){x=-x,pc('-');}if(x>9) write(x/10);pc(x%10+48);}
void writeln(int x){write(x),hh;}
void writesp(int x){write(x),pc(' ');}
signed main(){
	n=read(),A=read(),B=read();
	for(int i=1;i<=n;i++) a[i]=read(),pos[a[i]]=i;
	memset(dp,0x3f,sizeof(dp));
	memset(s,0x3f,sizeof(s));
	for(int i=0;i<=n;i++) s[0][i]=dp[0][i]=0;
	for(int i=1;i<=n;i++){//从小到大放 
		for(int j=0;j<=n;j++){
			if(pos[i]==j) dp[i][j]=min(dp[i][j],s[i-1][j-1]);
			dp[i][j]=min(dp[i][j],s[i-1][j]+(j<pos[i]?B:A));
		}
		s[i][0]=dp[i][0];
		for(int j=1;j<=n;j++) s[i][j]=min(s[i][j-1],dp[i][j]);
	}
	write(s[n][n]);
    return 0;
}

Measured memory_bytes: 391680
#include<bits/stdc++.h>
#define endl '\n';
using namespace std;

long long binpow(long long a, long long b)
{
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
long long  gcd(long long a,long long b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}

int32_t main()
{

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

    sort(a,a+k);
    int sum = 0;
    for(int i=0; i<n; i++)
    {
        sum+=a[i];
    }
    cout<<sum<<endl;
    return 0;

}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int n,d,v[3000][3000],s[3][3000][3000];

int S(int x1,int y1,int x2,int y2,int t)
{
	return s[t][x2][y2]-s[t][x2][y1-1]-s[t][x1-1][y2]+s[t][x1-1][y1-1];
}

int check(int x)
{
	int r=x%d;
	for(int i=1;i<=d;i++)
		for(int j=1;j<=d;j++)
		{
			int x1=i,y1=j,x2=x1+r,y2=y1+r,x3=x1+d-1,y3=y1+d-1;
			if(!S(x1,y2+1,x3,y3,1)&&!S(x2+1,y1,x3,y3,1)&&!S(x2+1,y2+1,x3,y3,0))
				return 1;
		}
	return 0;
}
int main()
{
	scanf("%d%d",&n,&d);
	memset(v,0,sizeof v);
	for(int i=0;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x%d+1][y%d+1]++;
	}
	int Mx=0,t;
	for(int i=1;i<=d;i++)
		for(int j=1;j<=d;j++)
			v[i+d][j]=v[i][j+d]=v[i+d][j+d]=v[i][j],Mx=max(Mx,v[i][j]);
	for(t=0;(t+1)*(t+1)<Mx;t++);
	int l[3]={t*t+1,t*(t+1)+1,(int)1e9};
	for(int i=1;i<=d*2;i++)
		for(int j=1;j<=d*2;j++)
			for(int t=0;t<2;t++)
			{
				s[t][i][j]=s[t][i-1][j]+s[t][i][j-1]-s[t][i-1][j-1];
				if(l[t]<=v[i][j])
					s[t][i][j]++;
			}
	int L=t*d,R=t*d+d,ans=R,mid;
	while(L<=R)
		if(check(mid=(L+R)>>1))
			R=mid-1,ans=mid;
		else
			L=mid+1;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 85504