akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    val (H, W) = readLine()!!.split(" ").map { it.toLong() }
    val S = (0 until H).map { readLine()!! }

    println(
            S.mapIndexed { indexH, h ->
                h.mapIndexed { indexW, w ->
                    if (S[indexH][indexW] == '#') "#"
                    else {
                        var r = 0
                        (-1..1).forEach { a ->
                            (-1..1).forEach { b ->
                                if (S.getOrNull(indexH + a)?.getOrNull(indexW + b) ?: '.' == '#') r++
                            }
                        }
                        r.toString()
                    }
                }.foldRight("") { a, b -> a + b }.plus("\n")
            }.foldRight("") { a, b -> a + b }
    )
}

Measured memory_bytes: 42128
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

typedef long long ll;

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

const int N=505,M=N*N; 

struct P { int x,c; } a[N]; 
bool operator<(const P &a,const P &b) {
	return a.x<b.x; 
}

int fail,n,cnt[N],q[M],h,t,res[M]; 

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	scanf("%d",&n); 
	rep(i,1,n){
		scanf("%d",&a[i].x); 
		a[i].c=i;
	}
	sort(a+1,a+n+1); 
	int p=n;
	dec(i,n,1){
		lop(k,0,n-a[i].c)q[t++]=a[i].c;
		cnt[a[i].c]=n;
	}
	dec(i,n*n,1){
		if(p&&i==a[p].x){
			if(cnt[a[p].c]!=a[p].c)fail=true;
			res[i]=a[p].c;
			lop(k,1,a[p].c)q[t++]=a[p].c;
			--p;
		}else{
			if(h==t)fail=true;
			res[i]=q[h++];
			--cnt[res[i]]; 
		}
	}
	puts(fail?"No":"Yes"); 
	if(!fail)rep(i,1,n*n)printf("%d ",res[i]); puts(""); 
	return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

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

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

const ll MOD = 1000000007;
const int INF = 1<<29;

int main(){
  string S; cin >> S;
  string S_rev = S;
  reverse(S_rev.begin(), S_rev.end());
  int res = 0;
  for (int i = 0; i < S.size(); ++i){
    if (S[i] != S_rev[i]) res++;
  }
  res /= 2;
  cout << res << endl;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	for(int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	int t = 0;
	int a = 0;
	int S = 0;
	for(int i = 0; i < N; i++) {
		if(t != v[i]) {
			S += a;
			a = 1;
		}
		if(t == v[i]) {
			a = 1 - a;
		}
		t = v[i];
	}
	S += a;
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 640
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int ms[]={3,6,11,16,21,26};
int main(){
	int n,x,y,z,m,s;
	while(cin>>n,n){
		s=0;
		rep(i,n){
			cin>>x>>y>>z>>m;
			rep(j,6)if(x+y+z<61+j*20&&m<ms[j]){
				s+=600+200*j; break;
			}
		}
		cout<<s<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)1e5+5;
const int M = (int)3e3+5;
const int Q = 301;
const int logN = 19;

void solve() {
    int n;
    cin>>n;
    vector<int> a(n+1);
    unordered_map<int,int> mp;
    ll ans = 0;
    REP(i,1,n) {
        cin>>a[i];
        if(mp.count(i-a[i]))
            ans += mp[i-a[i]];
        mp[i+a[i]]++;
    }
    cout<<ans;
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 12084
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
//vvi(n, vector<int>(m, -1))
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a) (a).begin(), (a).end()

int main(){
	int i,j,k,m,l,f,x,y,z; string s;
  ll n;
	cin >> n;
  ll a[5];
  rep(i, 5) cin >> a[i];
  sort(a, a+5);
  if(a[0] >= n){
    cout << 5;
    return 0;
  }
  
  cout << (n+a[0]-1)/a[0] + 4 << endl;
}

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

int main() {
    int n;
    double t;
    cin >> n >> t;
    double tan = 0.0;
    rep(i, n) {
        double x, h;
        cin >> x >> h;
        tan = max(tan, h/x);
    }
    printf("%.4f\n", t*tan);

    return 0;
}


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

int n;
int d[100005];
unordered_map<int, int> m;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> d[i];
	for (int i = 1; i <= n; i++) {
		m[d[i]]++;
		m[d[i] - 1]++;
		m[d[i] + 1]++;
	}
	auto iter = m.begin();
	int ans = 0;
	while (iter != m.end()) {
		ans = max(ans, iter->second);
		iter++;
	}
	cout << ans << endl;
}

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

int main() {
  
  string s;
  
  cin>>s;
  int ans = 0;
  
  string t, p = "";
  for(int i=0;i<s.size();i++){
    t += s[i];
    if (t == p) continue;
    p = t;
    t = "";
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<vector>
#include<iostream>
#include<string>
using namespace std;
int main(){
vector<string> list;
string s;
getline(cin,s);
for(int i=0;i<s.size()&&s.size()!=0;i++){
if(s[i]=='.' || s[i]==' ' || s[i]== ','){
if(i!=0)list.push_back(s.substr(0,i));
s = s.substr(i+1);
i=-1;
}
}
vector<string> ans ;
for(int i=0;i<list.size();i++){
if(2<list[i].size()&&list[i].size()<7){
ans.push_back(list[i]);
}
}
for(int i=0;i<ans.size()-1;i++){
cout<<ans[i]<<" ";
}cout<<ans[ans.size()-1]<<endl;
}

Measured memory_bytes: 1188
#include <iostream>
using namespace std;
const int N = 502;
int n; char a[N][N];
int main() {
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%s",a[i]);

    int res=0;
    for(int d=0;d<n;d++) {
        int ok=1;
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++)
                if(a[i][(j+d)%n]!=a[j][(i+d)%n]) ok=0;
        if(ok) res+=n;
    }
    cout<<res<<endl;
}




Measured memory_bytes: 384
//http://code-festival-2017-qualb.contest.atcoder.jp/tasks/code_festival_2017_qualb_a
#include <cstdio>
#include <cstring>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

const int mx = 55;
char ss[mx], * endS = "FESTIVAL";

int main(){
    cin >> ss;
    ss[strlen(ss) - strlen(endS)] = '\0';
    cout << ss << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
typedef long long ll;
using namespace std;
ll ans;
string S;
ll N;
ll DP[100001][4];
int main() {
	cin >> S;
	ans = 0;
	ll num = 0;
	ll A = 0, AB = 0 , ABC = 0;
	urep(i, S.size(), 0) {
		urep(j, 3, 0) {
			if (i == S.size() && j == 3)DP[i][j] = 1;
			else if (i == S.size())DP[i][j] == 0;
			else if (j == 3) {
				if (S[i] == '?')DP[i][j] = (DP[i + 1][j] * 3)%MOD;
				else DP[i][j] = DP[i + 1][j] % MOD;
			}
			else {
				if (S[i] == '?') {
					DP[i][j] = (DP[i + 1][j] * 3 + DP[i + 1][j + 1]) % MOD;
				}
				else if (S[i] - 'A' == j) {
					DP[i][j] = (DP[i+1][j]+DP[i + 1][j + 1]) % MOD;
				}
				else {
					DP[i][j] = DP[i + 1][j] % MOD;
				}
			}
		}
	}
	cout << DP[0][0]<< endl;
	cin >> ans;
	return 0;
}

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

signed main() {
	string s;
	getline(cin, s);

	for (int i = 0; i < s.size(); ++i) {
		if ('a' <= s[i] and s[i] <= 'z') {
			s[i] -= 32;
		}
		else if ('A' <= s[i] and s[i] <= 'Z') {
			s[i] += 32;
		}
	}

	cout << s << endl;
}



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

#define MAX 100000

int gcd(int y, int x){
	if(x>y)swap(x,y);
	
	if(x==0) return y;
	return gcd(x,y%x);

}

int main(){
	int mons[MAX];
	int n;	cin>>n;
	for(int i=0;i<n;i++){
		cin>>mons[i];
	}
	

	int ans=gcd(mons[0],mons[1]);
	for(int i=2;i<n;i++){
		ans=gcd(ans,mons[i]);
	}

	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;

struct X{
  int h;
  int post;
  int num;
};

bool asc1( const X& left, const X& right ) {
  return left.num < right.num;
}
bool asc2( const X& left, const X& right ) {
  return left.h < right.h;
}

int n;
X x[200001];
int main(){
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x[i].num;
    x[i].h = i;
  }
  sort(x,x+n,asc1);
  int m1 = x[n/2-1].num;
  int m2 = x[n/2].num;
  for(int i=0;i<n;i++) { x[i].post = i; }
  sort(x,x+n,asc2);
  for(int i=0;i<n;i++){
    if(x[i].post <= n/2-1) cout << m2 << endl;
    else cout << m1 << endl;
  }
  return 0;
}


Measured memory_bytes: 4480
#include<iostream>
#include<cstdio>
using namespace std;
const int maxn=5*1e5+7;
const int INF=1e9+7;
int cur,E,V,head[maxn],dist[maxn];
int A,B,C;
bool vis[maxn];
struct edge{
	int to,nex,cost;
	edge(){}
	edge(int _a,int _b,int _c){
		to=_a,nex=_b,cost=_c;
	}	
}eg[maxn];
void add_eg(int u,int v,int w){
	eg[++cur]=edge(v,head[u],w);
	head[u]=cur;
}
bool SPFA(int x){
	vis[x]=true;
	for(int i=head[x];i;i=eg[i].nex){
		int v=eg[i].to;
		if(dist[v]>dist[x]+eg[i].cost){
			dist[v]=dist[x]+eg[i].cost;
			if(vis[v]||!SPFA(v)){
				return false;
			}
		}
	}
	vis[x]=false;
	return true;
}
int main(){
	cin>>V>>E;
	for(int i=1;i<=E;i++){
		cin>>A>>B>>C;
		add_eg(A,B,C);
		add_eg(B,A,-C);
	}
	for(int i=1;i<=V;i++){
		dist[i]=0;
		if(!SPFA(i)){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
} 

Measured memory_bytes: 13568
# coding: utf-8
import math

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

X = int(input())
list = primes(10**5 + 4)
for i in list:
  if i < X:
    continue
  else:
    print(i)
    break

Measured memory_bytes: 7064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Node{
    int key;
    struct Node *right,*left,*parent;
};
struct Node *root,*NIL;


struct Node * find(struct Node *u,int k){
    
    while(u!=NIL&&k!=u->key){
        if(k < u->key) u=u->left;
        else u = u->right;
    }
    return u;

}

void insert(int k){
    struct Node *y = NIL;
    struct Node *x = root;
    struct Node *z;

z = (struct Node *)malloc(sizeof(struct Node));
z->key = k;
z->left = NIL;
z->right =NIL;
while(x!=NIL){
     y=x;
    if(z->key < x->key){
     x=x->left;
    }
else  x = x->right;
    
}
z->parent = y;
if(y==NIL){
    
    root =z;
}
else{
     if(z->key<y->key)
        y->left=z;
    
else y->right = z;
    
}
}
void inorder(struct Node *u){
    if(u==NIL)return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(struct Node *u){
    
    if(u==NIL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
    
}

int main(){
    int n,i,x;
    char com[20];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",com);
        if(com[0]=='f'){
        struct Node *t = find(root,x);
        if(t==NIL)printf("no\n");
        else printf("yes\n");
        }
    else if(com[0]=='i'){
        scanf("%d",&x);
        insert(x);
 
    }
   else if(com[0] == 'p'){
        inorder(root);
        printf("\n");
        preorder(root);
        printf("\n");
        }
    }
    return 0;
}



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

int main(void){
int h,w;
cin >> h >> w;
char map[8][9];
int vm[8][8];
int sh=0,sw=0;
  
for (int i=0;i<h;i++){
cin >> map[i];
//cout << map[i] << endl;
}
  
for (int i=0;i<h;i++){
for (int j=0;j<w;j++){
	vm[i][j] = map[i][j]=='#'?1:0;
    if (i+j<sh+sw & map[i][j]=='#' ){
      sh = i;
   	  sw = j;
    }
}}
  
vm[sh][sw]=0;

  
for (int p=0;p<10000;p++){
  	if (sh+1<h){if (vm[sh+1][sw]==1){
      sh++;
      vm[sh][sw]=0;
    }}
  	if (sw+1<w){if (vm[sh][sw+1]==1){
      sw++;
       vm[sh][sw]=0;
    }}
}
  
for (int i=0;i<h;i++){
for (int j=0;j<w;j++){
	//cout<<vm[i][j];
}}  

int su=0;
for (int i=0;i<h;i++){
for (int j=0;j<w;j++){
	su+=vm[i][j];
}}  
if (su==0){
  cout << "Possible" << endl;
} else {
  cout << "Impossible" << endl;
}

return 0; 
  
}

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

using namespace std;

int n, c;

bool is_prime(int x){
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0)
		return 0;
	}
	
	return 1;
}

int main(){
	scanf("%d%d", &n, &c);
	
	if(c >= 0){
		//n <= 3
		
		bool prime = 0;
		int res = -1;
		int ub = 1;
		
		for(int i = 0; i < n; i++)
		ub *= 10;
		
		for(int i = ub - 1; i >= ub / 10; i--){
			vector <int> d;
			int tmp = i;
			
			while(tmp){
				d.push_back(tmp % 10);
				tmp /= 10;
			}
			
			int v = i * 10 + c;
			
			for(int j = 0; j < d.size(); j++)
			v = v * 10 + d[j];
			
			if(is_prime(v)){
				prime = 1;
				res = v;
				break;
			}
		}
		
		if(!prime){
			for(int i = 0; i < n; i++)
			printf("9");
			printf("%d", c);
			printf("9");
			printf("\n");
		}
		else{
			printf("%d\n", res);
		}
	}
	else{
		if(n == 1)
		printf("11\n");
		else{
			for(int i = 0; i < 2 * n; i++)
			printf("9");
			printf("\n");
		}
	}
}



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

using namespace std;

const int N = 1e5 + 10;
int main() {
    int n, cap;
    cin >> n >> cap;
    vector<int> f = vector<int>(n * 1005, cap + 1);
    f[0] = 0;
    while (n--) {
        int cw, cv;
        cin >> cw >> cv;
        for(int i = f.size() - 1; i >= cv; i--)
            f[i] = min(f[i], f[i - cv] + cw);
    }
    int ans = f.size() - 1;
    while (f[ans] > cap) ans--;
    cout << ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll N,W;
vector<ll> w,v;
ll dp[101][100001];

void input(){
    cin >> N >> W;
    w.resize(N);
    v.resize(N);
    for(ll i=0;i<N;i++) cin >> w[i] >> v[i];
}

// i番目以降の品物から重さがj以下となるように選ぶ
ll rec(ll i, ll j){
    if(dp[i][j] >= 0){
        return dp[i][j];
    }
    ll res;
    if(i == N){
        res = 0;
    }
    else if(j < w[i]){
        res = rec(i + 1, j);
    }
    else{
        res = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i]);
    }
    return dp[i][j] = res;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    // -1で初期化
    for(ll i=0;i<101;i++){
        for(ll j=0;j<100001;j++){
            dp[i][j] = -1;
        }
    }
    ll ans = rec(0, W);
    cout << ans << endl;
    return 0;
}

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

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

// code starts
int main()
{
  int n;cin>>n;
  vector<int> b(n);
  int i;
  rep(i,n)cin>>b[i];
  bool ok=true;
  int len=n;
  int now=len-1;
  vector<int> take(n);
  while(len>0&&now>=0)
  {
    if(b[now]==now+1)
    {
      take[len-1]=b[now];
      for(i=now;i<len-1;i++)b[i]=b[i+1];
      len--;
      now=len-1;
    }
    else now--;
  }
  if(len>0)cout<<-1<<endl;
  else rep(i,n)cout<<take[i]<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int eye[2][4]={}, j;
	double r, l;

	while(scanf("%lf %lf", &l, &r) != EOF){
		if (l>=1.1)
			eye[0][0]++;
		else if(l>=0.6)
			eye[0][1]++;
		else if(l>=0.2)
			eye[0][2]++;
		else
			eye[0][3]++;

		if (r>=1.1)
			eye[1][0]++;
		else if(r>=0.6)
			eye[1][1]++;
		else if(r>=0.2)
			eye[1][2]++;
		else
			eye[1][3]++;
	}

	for (j = 0; j < 4; ++j)
			printf("%d %d\n", eye[0][j], eye[1][j]);
        return 0;
}

Measured memory_bytes: 628
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <cctype>
using namespace std;
#define swap(x,y) int (temp)=int (x);(x)=int (y);(y)=(temp);
#define swapS(x,y) string (tukar)=x;x=y;y=tukar;
#define swapC(x,y) char (pindah)=x;x=y;y=pindah;
#define ll long long
#define S string
#define len(a)	string (a).length()
#define arn 100000
#define forn(a,b) for(int (a)=1;a<=int (b);a++)
#define for3(a,b,c) for(int (a)=int (b); a<=int(c);a++)
int gcd(int a, int b) {
    return (a == 0 ? b : gcd(b % a, a));
}
int lcm(int a, int b)
{
    int temp = gcd(a, b);

    return ((a*b)/temp);
}
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b>=c)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <list>
#include <math.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

/*******-c++14 don't include-*******/
template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }
void printArr(int *a, int len){for(int i=0; i<len; i++){if(i)cout << " ";cout << a[i];}cout << endl;}
/*******---------------------*******/

static const int INTINF = (2147483647);
static const ll LLINF = (1ll<<32);
static const int MAX = 100001;

int arr[MAX];
int n;
long double sum = 0;
pair<double, double> p[MAX];

void cir(vector<int> v, int index, int arr2[]){
    if(n == index){
        double nowX = p[0].first;
        double nowY = p[0].second;
        long double tmpSum = 0;
        rep2(i, 0, n){
            int nowI = arr2[i];
            if(i == 0){
                nowX = p[nowI].first;
                nowY = p[nowI].second;
                continue;
            }
            double x = p[nowI].first;
            double y = p[nowI].second;
            tmpSum += sqrt(pow(nowX-x, 2) + pow(nowY-y, 2));
            nowX = x;
            nowY = y;
        }
        sum += tmpSum;
        return;
    }
    rep(i, v.size()){
        vector<int> v2 = v;
        arr2[index]=v2[i];
        v2.erase(v2.begin()+i);
        cir(v2, index + 1, arr2);
    }
}

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    cin >> n;
    vector<int> v;
    rep(i, n){
        pair<int, int> f;
        cin >> f.first;
        cin >> f.second;
        p[i] = f;
        v.push_back(i);
    }
    
    int *arr2;
    arr2 = new int[n];
    
    cir(v, 0, arr2);
    
    double tmpN = 1;
    rep(i, n){
        tmpN *= (n-i);
    }
    
    long double a = sum/tmpN;
    
    printf("%0.9Lf \n", (a));
    
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int m=1e9+7;
int32_t main()
{
    int n;
    cin>>n;
    string a;
    cin>>a;

    vector<int>dp(n+2, 0);
    dp[1]=1;
    for(int i=1; i<n; ++i)
    {
        vector<int>tmp(n+2, 0);
        if(a[i-1]=='<')
        {
            int sum=dp[1];
            for(int j=2; j<=i+1; ++j)
            {
                tmp[j]=sum;
                sum=(sum+dp[j])%m;
            }
        }
        else
        {
            int sum=0;
            for(int j=i; j>=1; --j)
            {
                sum=(sum+dp[j])%m;
                tmp[j]=sum;
            }
        }
        for(int j=1; j<=n; ++j)
        {
            dp[j]=tmp[j];
            // cout<<dp[j]<<" ";
        }
        // cout<<"\n";
    }
    int ans=0;
    for(int i=1; i<=n; ++i)
    {
        ans=(ans+dp[i])%m;
    }
    cout<<ans;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  cout << (B == 1 ? 0 : (B - 2) / (A - 1) + 1) << '\n';
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

void solve(){
	string a,b,c;
	cin>>a>>b>>c;
	cout<<a[0]<<b[0]<<c[0]<<endl;
}

int main(){
	fastread;
	int t = 1;
	// cin>>t;
	for(int i=1;i<=t;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int N;

  cin >> N;

  if (N % 2 == 0)
    cout << N << endl;
  else
    cout << N * 2 << endl;

  return 0;
}



Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<usize>();
    let mut v = read_vec::<u32>();

    for i in (0..n/2).rev() {
        let x = n / (i+1);
        let mut sum_mod2 = 0;
        for j in 2..x+1 {
            sum_mod2 = (sum_mod2 + v[(i+1) * j - 1]) % 2;
        }
        if sum_mod2 == v[i] {
            v[i] = 0;
        } else {
            v[i] = 1;
        }
        //println!("{:?}", v);
    }

    let m = v.iter().fold(0, |sum, x| sum+x);
    println!("{}", m);
    if m != 0 {
        let balls: String = v.into_iter().enumerate().map(|(i, y)| {
            if y == 1 {
                i + 1
            } else {
                0
            }
        }).filter(|&x| x != 0).map(|x| x.to_string()).collect::<Vec<String>>().join(" ");
        println!("{}", balls);
    }
}


Measured memory_bytes: 10492
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin>>n;
  if(n==1){
    cout<<"Yes"<<endl;
    return 0;
  }
  for(int i=9;i>1;i--){
    if(n%i==0&&n/i<=9){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
from decimal import Decimal,getcontext
getcontext().prec = 50
a,b,c = map(int,input().split())
a = Decimal(a).sqrt()
b = Decimal(b).sqrt()
c = Decimal(c).sqrt()
d = a+b
if d<c:
    print("Yes")
else:
    print("No")



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

using namespace std;

int main()
{
    int n,oop=0;
    cin>>n;
    vector<int>a(n,0);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)
    {
     if(a[i]!=i+1)
     oop++;
    }
    if(oop>2)cout<<"NO";
    else cout<<"YES";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main () {
  int A[3][3], ans[3][3];
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> A[i][j];
      ans[i][j] = 0;
    }
  }
  int N;
  cin >> N;
  int b[N];
  for (int i = 0; i < N; ++i) {
    cin >> b[i];
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        if (A[j][k] == b[i]) {
          ans[j][k] = 1;
        }
      }
    }
  }
  /*
  for (int i = 0; i < 3; ++i) {
    int count = 0;
    for (int j = 0; k < 3; ++j) {
      if (A[i][j] == 1) {
        ++count;
      }
    }
    if (count == 3) {
      ans = 1;
    }
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      printf("%d ", ans[i][j]);
    }
    printf("\n");
  }*/
  if (ans[0][0] == 1 && ans[0][1] == 1 && ans[0][2] == 1) {
    printf("Yes\n");
  } else if (ans[1][0] == 1 && ans[1][1] == 1 && ans[1][2] == 1) {
    printf("Yes\n");
  } else if (ans[2][0] == 1 && ans[2][1] == 1 && ans[2][2] == 1) {
    printf("Yes\n");
  } else if (ans[0][0] == 1 && ans[1][0] == 1 && ans[2][0] == 1) {
    printf("Yes\n");
  } else if (ans[0][1] == 1 && ans[1][1] == 1 && ans[2][1] == 1) {
    printf("Yes\n");
  } else if (ans[0][2] == 1 && ans[1][2] == 1 && ans[2][2] == 1) {
    printf("Yes\n");
  } else if (ans[0][0] == 1 && ans[1][1] == 1 && ans[2][2] == 1) {
    printf("Yes\n");
  } else if (ans[2][0] == 1 && ans[1][1] == 1 && ans[0][2] == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

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

int main() {
    long x, cur = 100, ans = 0;
    cin >> x;
    while(cur < x) {
        ans++;
        cur += cur / 100;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include<stdio.h>
long long int dp[1001][1001];//動的計画法の表
int main(void){
    int i,j,n,m,d[1001],c[1001];//n=都市の数,m=日数,d=都市間の距離,c=天候
    long long int min,M;//min=最小値
    M=922337203685477580;//最大値代入
    scanf("%d %d",&n,&m);//都市の数と日数の入力
	//↓表のすべての場所にM代入
    for(i=0;i<=m;i++){
        for(j=0;j<=n;j++) dp[i][j]=M;
    }
    for(i=0;i<n;i++) scanf("%d",&d[i]);//都市間の距離の入力
    for(i=0;i<m;i++) scanf("%d",&c[i]);//天候の入力
    dp[0][0]=0;//スタート位置に0代入
    for(i=0;i<m;i++){
        for(j=0;j<=n;j++){
            if(dp[i][j]!=M){
                if(dp[i+1][j]>dp[i][j]) dp[i+1][j]=dp[i][j];//縦方向に疲労度比べて代入
                if(dp[i+1][j+1]>dp[i][j]+d[j]*c[i]) dp[i+1][j+1]=dp[i][j]+d[j]*c[i];//斜め方向に
            }
        }
    }
    min=M;//minにM代入
    for(i=0;i<=m;i++){
        if(min>dp[i][n]) min=dp[i][n];//minと比べて更新
    }
    printf("%lld\n",min);//最小の疲労度出力
    return 0;
}

Measured memory_bytes: 8428
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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(a>b){a=b;return 1;}return 0;}

int a[575][575];
int b[575];

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

  int n, m, c;
  cin >> n >> m >> c;
  REP(i, m) {
    cin >> b[i];
  }
  REP(i, n) {
    REP(j, m){
      cin >> a[i][j];
    }
  }
  
  int ans = 0;
  REP(i, n){
    int tmp = c;
    REP(j, m){
      tmp += a[i][j]*b[j];
    }
    if(tmp > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    b = [int(x) for x in input().split()]
    a = []
    for i in range(n):
        a.append((b[i], i))
    a.sort()
    ans = [0] * n
    m = n // 2


    for i in range(n):
        j = a[i][1]
        if i < m:
            ans[j] = (a[m][0])
        else:
            ans[j] = (a[m-1][0])

    for e in ans:
        print(e)


t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

2 3 4 4
3 4 4
2 3 4
2 3 4
2 4 4


"""


Measured memory_bytes: 40752
# import itertools
# import math
import sys
# sys.setrecursionlimit(500*500)
# import numpy as np

X = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

for a in range(-130, 130):
    for b in range(-130, 130):
        _ = a ** 5 - b ** 5
        if _ == X:
            print(a, b)
            sys.exit()

Measured memory_bytes: 9032
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    int minv = 0;
    REP(i,0,n) {
        if (s[i] == '(') {
            ++cnt;
        } else {
            --cnt;
        }
        minv = min(minv, cnt);
    }
    REP(i,0,-minv) cout << "(";
    cout << s;
    cnt = 0;
    int maxv = 0;
    RREP(i,0,n) {
        if (s[i] == '(') {
            ++cnt;
        } else {
            --cnt;
        }
        maxv = max(maxv,cnt);
    }
    REP(i,0,maxv) cout << ")";
    cout << endl;
}

int main() {
    solve();
    
    return 0;
}

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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,b,a)     for(int i=b;i>=a;i--)

int a,b,c,d;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>a>>b>>c>>d;
    int x=c-a,y=d-b;
    cout<<c-y<<" "<<d+x<<" "<<a-y<<" "<<b+x;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n - 1);
  for (auto &e : a) cin >> e;
  for (auto &e : b) cin >> e;
  for (auto &e : c) cin >> e;
  int r = 0;
  for (auto e : a) r += b[e - 1];
  for (int i = 0; i + 1 < n; i++) {
    if (a[i] + 1 == a[i + 1]) r += c[a[i] - 1];
  }
  cout << r << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),k=nxt();
    int test=k;
    for(int i=1;i<n;i++)
        test*=(k-1);
    cout<<test<<endl;
  

    
    return 0;   
}




 
 


Measured memory_bytes: 256
#include <iostream>

using namespace std;

// Retorna o indice do maior lado
int max(int lados[]) {
    int idx_maior = 0, maior = lados[0];
    
    for(int i = 1; i < 3; i++) {

        if(lados[i] > maior) {
            maior = lados[i];
            idx_maior = i;
        }
    }

    return idx_maior;

}

int main() {
    int lados[3];
    int b, h;
    
    for(int i = 0; i < 3; i++) {
        cin >> lados[i];
    }

    int maior = max(lados);

    b = lados[(maior + 1) % 3];
    h = lados[(maior + 2) % 3];

    cout << (b * h) / 2 << endl;

    return 0;
}

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

using namespace std;

int n;
long long sum, x, c, t;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie();
    cin >> n >> t;
    for (int i=0; i<n; i++){
        cin >> x;
        if (c > x){
            sum += t - c + x;
        }
        else{
            sum += t;
        }
        c = x + t;
    }
    cout << sum;
    return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int mx = 0;
    int sum = 0;
    REP(i, 0, N) {
        int p;
        cin >> p;
        sum += p;
        mx = max(mx, p);
    }
    cout << sum - mx / 2 << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
typedef long long ll;
int n,m;
ll ans=0;
int factor[1000001];
//factor[i] stores the lowest prime that divides all numbers up to and including i
void init(int n){
    factor[1]=1;
    for(int i=2;i<=n;++i){
        factor[i]=i;
    }
    for(int i=4;i<=n;i+=2){
        factor[i]=2;
    }
    for(int i=3;i*i<=n;++i){
        if(factor[i]==i){
            for (int j=i*i;j<=n;j+=i) { 
                // if it has no prime factor before, then 
                // stores the smallest prime divisor 
                if (factor[j]==j) 
                    factor[j]=i; 
            } 
        }
    }
}
int fact(int n) { 
    if (n==1) return 1; 
    int ans=1, dup=factor[n], c = 1, j = n / factor[n]; 
    while (j != 1) { 
        if (factor[j] == dup)  c += 1; 
        else { 
            dup = factor[j]; 
            ans = ans * (c + 1); 
            c = 1; 
        } 
        j = j / factor[j]; 
    } 
    ans = ans * (c + 1); 
    return ans; 
} 

int main(){
    cin>>n;
    init(n);
    for(int i=1;i<n;++i){
        ans+=fact(i);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 7532
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(S, s) S.find(s) != string::npos

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    bool flag = false;
    Rep(i, N) {
        cin >> a[i];
        if (a[i] == 1) flag = true;
    }
    if (!flag) cout << -1 << endl;
    else {
        int index = 1, ans = 0;
        Rep(i, a.size()) {
            if (a[i] != index) {
                ans++;
            }
            else {
                index++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 4036
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <bitset>
#include <string>
#include <cmath>
#include <set>
#include <map>
#define Rep(i, x, y) for (int i = x; i <= y; i ++)
#define Dwn(i, x, y) for (int i = x; i >= y; i --)
#define RepE(i, x) for (int i = pos[x]; i; i = g[i].nex)
#define ev g[i].y
#define eps 1e-10
using namespace std;
typedef long long ll;
typedef double db;
const int N = 100005, mod = 1000000007;
int n, m, T, q, mx;
int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }
int main()
{
	cin >> n >> m;
	Rep(i, 1, n) {
		int x;
		scanf ("%d", &x);
		if (n == 1 && m != x) { puts("IMPOSSIBLE"); return 0; }
		q = gcd(x, q);
		mx = max(mx, x);
	}
	if (m % q == 0 && m <= mx) puts("POSSIBLE");
	else puts("IMPOSSIBLE");

	return 0;
}

Measured memory_bytes: 256
import sys
n,m = map(int, input().split())
sc = [-1]*n
ans = 0
for i in range(m):
    s,c = map(int, input().split())
    if sc[s-1]==-1: sc[s-1]=c
    else:
        if sc[s-1]!=c: ans=-1

if m==0 and n==1:print(0)
elif ans==-1:print(ans)
else:
    if sc[0]==-1:sc[0]=1
    elif sc[0]==0:
        if len(sc)!=1:
            print(-1)
            sys.exit()
    for i in range(n):
        if sc[i]==-1: sc[i]=0
    ans = ''.join([str(n) for n in sc])
    print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t,n,i,j=0,c=0;
  cin>>t;
  for(i=0;i<t;i++)
  {
     cin>>n;
     if(n>=c)
     {
         c=n;
         j++;
     }
  }
 cout<<j<<"\n";


return 0;
}


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 m = sc.nextInt();

        int min = 1;
        int max = n + 1;

        for (int i = 0; i < m; i++) {
            int l = sc.nextInt();
            int r = sc.nextInt();
            min = Math.max(min, l);
            max = Math.min(max, r);

            if (max < min) {
                System.out.println(0);
                return;
            }
        }

        System.out.println(max - min + 1);
    }
}


Measured memory_bytes: 63148
int main(){
    int N;
    int a;
    scanf("%d",&N);
    int num1=0,num2=0,num3=0;
    for(int i=0;i<N;i++)
    {
        scanf("%d",&a);
        if(a%4==0)num1++;
        else if(a%4!=0&&a%2==0)num2++;
        else num3++;
    }
    if(num3==0||num1>=N/2||num1>=num3)printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a) for(int i=0; i<a; i++)
#define rep1(i, a, b) for(int i=a; i<b; i++)
using ll = long long;
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<ll> v(n), dp(n);
    rep(i, n)
        cin>>v[i];
    dp[0] = 0;
    dp[1] = abs(v[1]-v[0]);
    rep1(i, 2, n)
        dp[i] = min(dp[i-1]+abs(v[i]-v[i-1]) , dp[i-2]+abs(v[i]-v[i-2]));
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner s  = new Scanner(System.in);
        String str = s.nextLine();
        String upper  = str.toUpperCase();
        String lower = str.toLowerCase();
        for(int i=0;i<str.length();i++){
            char ch=str.charAt(i);
            if(ch==upper.charAt(i)){
                System.out.print(lower.charAt(i));
            }
            else System.out.print(upper.charAt(i));
        }
        System.out.println();
    }
}


Measured memory_bytes: 26924
n = gets.to_i
s = gets.chomp
ans = 0

for i in 1...n do
  x = s.slice(0, i).split(//).uniq
  y = s.slice(i, n).split(//).uniq
  count = 0
  for j in 0...x.size do
    for k in 0...y.size do
      if x[j] == y[k] then
        count +=1
      end
    end
  end
    
  if count > ans then
    ans = count
  end
end
print ans

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

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

double f(int x,int y){
    return sqrt(pow(x,2)+pow(y,2));
}

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

    for(int x=0;x<=N;x++){
        for(int y=0;y<=N;y++){
            if(N - x - y < 0) break;
            if((Y - x * 10000 - y * 5000)/1000 == N - x - y){
                printf("%d %d %d\n",x,y,N-x-y);
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N;
  cin>>N;
  int64_t ans=1e18;
  for(int64_t i=1;i*i<=N;i++){
    if(N%i !=0){
      continue;
    }
    int64_t j=N/i;
    ans=min(ans,i+j-2);
  }
  cout<<ans<<endl;
}
    

Measured memory_bytes: 3580
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    

n,m = map(int,input().split())
uf = UnionFind(n)
for i in range(m):
    a,b = map(int,input().split())
    uf.union(a,b)
print(max(uf.size))

Measured memory_bytes: 90392
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n;
  cin >> n;
  vector<ll> t(n);
  rep(i,n) cin >> t[i];
  ll ans = 1;
  rep(i,n) {
    ans = t[i] / __gcd(ans, t[i]) * ans;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
#include<algorithm>
#include<cstdio>
#define mxn 500010
#define LL long long
#define mod 998244353
using namespace std;
LL fac[mxn],ifc[mxn];
int n,m,sl,fh,ans;
int rd()
{
	sl=0;fh=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
	while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
	return sl*fh;
}
LL C(int x,int y) {return fac[x]*ifc[y]%mod*ifc[x-y]%mod;}
LL _pow(LL k,int i)
{
	static LL t;t=1;
	for(;i;i>>=1,k=k*k%mod)
		if(i&1)
			t=t*k%mod;
	return t;
}
int main()
{
	n=rd();m=rd();if(n>m) swap(n,m);fac[0]=1;
	for(int i=1;i<=m;++i) fac[i]=i*fac[i-1]%mod;
	ifc[m]=_pow(fac[m],mod-2);
	for(int i=m;i;--i) ifc[i-1]=i*ifc[i]%mod;
	LL X=_pow(m+1,n),Y=_pow(n+1,m),invn=_pow(n+1,mod-2),invm=_pow(m+1,mod-2);
	for(int i=0,c=1;i<=n;++i,c=mod-c,X=X*invm%mod,Y=Y*invn%mod) ans=(ans+c*X%mod*Y%mod*fac[i]%mod*C(n,i)%mod*C(m,i))%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 7936