akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y))
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;

const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;
int s1, s2;
vector<int> graph[MAXN];
int dp[MAXN][2];

void dfs(int p, int u, int d, int opt) {
    dp[u][opt] = d;
    for (int i = 0; i < graph[u].size(); ++i) {
        int v = graph[u][i];
        if (v == p) continue;
        dfs(u, v, d + 1, opt);
    }
    return;
}

int main()
{
    int i, j, u, v;
    scanf("%d%d%d", &N, &s1, &s2);
    for (i = 1; i <= N - 1; ++i) {
        scanf("%d%d", &u, &v);
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    dfs(0, s1, 0, 0);
    dfs(0, s2, 0, 1);
    int maxi = 0;
    for (i = 1; i <= N; ++i) {
        if (dp[i][0] >= dp[i][1]) continue;
        maxi = MAX(maxi, dp[i][1] - 1);
    }
    printf("%d", maxi);
    return 0;
}


Measured memory_bytes: 12928
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int bd[4001][4001];
using P = pair<int, int>;
int main() {
    int n;
    cin >> n;
    vector<P> p[2];
    map<int, int> mp[2];
    for (int i = 0; i < 2; ++i) p[i].resize(n);
    for (int i = 0; i < n; ++i) {
        for (int k = 0; k < 2; ++k) {
            cin >> p[k][i].first >> p[k][i].second;
            mp[0][p[k][i].first] = 0;
            mp[1][p[k][i].second] = 0;
        }
    }
    vector<i64> imp[2];
    for (int k = 0; k < 2; ++k) {
        int c = 0;
        for (auto& p : mp[k]) {
            p.second = c++;
            imp[k].push_back(p.first);
        }
    }
    for (int i = 0; i < n; ++i) {
        int x1, y1, x2, y2;
        tie(x1, y1) = p[0][i];
        tie(x2, y2) = p[1][i];
        x1 = mp[0][x1];
        y1 = mp[1][y1];
        x2 = mp[0][x2];
        y2 = mp[1][y2];
        bd[x1][y1]++;
        bd[x2][y1]--;
        bd[x1][y2]--;
        bd[x2][y2]++;
    }
    i64 ans = 0;
    for (int i = 0; i < mp[0].size() - 1; ++i) {
        for (int j = 0; j < mp[1].size() - 1; ++j) {
            if (i > 0) bd[i][j] += bd[i - 1][j];
            if (j > 0) bd[i][j] += bd[i][j - 1];
            if (i > 0 && j > 0) bd[i][j] -= bd[i - 1][j - 1];
            if (bd[i][j] > 0) {
                ans += (imp[0][i + 1] - imp[0][i]) * (imp[1][j + 1] - imp[1][j]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int k,a,b;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;
}

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

using namespace std;

int N, a[100009];
long long dp[100009][2];

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d", &N);
for (int i=1; i<=N; i++)
    scanf ("%d", &a[i]);
dp[1][0] = a[1] / 2;
for (int i=1; i<N; i++)
    for (int j=0; j<2; j++)
        for (int k=0; k<2; k++)
            if (j + k <= a[i] && k <= a[i + 1])
                dp[i + 1][k] = max (dp[i + 1][k], dp[i][j] + k + (a[i + 1] - k) / 2 - (k == 1 && a[i] % 2 == j % 2));
printf ("%lld\n", max (dp[N][0], dp[N][1]));
return 0;
}


Measured memory_bytes: 2176
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            List<Integer> aMinusI = new ArrayList<>();

            for (int i = 0; i < n; i++) {
                aMinusI.add(sc.nextInt() - (i + 1));
            }

            Collections.sort(aMinusI);

            int b;
            if (n % 2 == 1) {
                b = aMinusI.get(n / 2);
            } else {
                b = (aMinusI.get(n / 2 - 1) + aMinusI.get(n / 2)) / 2;
            }

            long ans = 0;
            for (int i = 0; i < n; i++) {
                ans += Math.abs(aMinusI.get(i) - b);
            }
            System.out.println(ans);

        }
    }

}


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


int main() {
    string s;
    cin >> s;
    bool ok = true;
    sort(s.begin(), s.end());
    if (s[0] != s[1]) ok = false;
    if (s[1] == s[2]) ok = false;
    if (s[2] != s[3]) ok = false;
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
int main(){

    int k,s;
    cin>>k>>s;
    int ans=0;
    map<pair<int,pair<int,int>>,int> a;
    for(int i=0;i<=k;i++){
        map<int,int> m;
        for(int j=0;j<=i;j++){
            m[j]++;
        }
        for(int j=i;j<=k;j++){
            int n=i+j;
            if(m.count(s-n)){
                a[make_pair(i,make_pair(j,s-n))]++;
            }
        }
    }
    for(auto i: a){
        map<int,int> my;
        my[i.first.first]++;
        my[i.first.second.first]++;
        my[i.first.second.second]++;
        if(my.size()==3){
            ans+=6*i.second;
        }
        else if(my.size()==2){
            ans+=3*i.second;
        }
        else ans+=i.second;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 49408
#include<stdio.h>

int main(){
	int H,W;
	while(1){
		scanf("%d",&H);
		scanf("%d",&W);
		if(H==0 && W==0)break;
		make_frame(H,W);
	}
	return 0;
}

int make_frame(int height,int width){
	int i,j;
	for(i=1;i<=height;i++){
		for(j=1;j<=width;j++){
			if(i==1 || i==height) printf("#");
			else if(j==1 || j==width) printf("#");
			else printf(".");
		}
		printf("\n");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=mpowe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
int main()
{
    fastio();
    ll n,x;
    cin>>n>>x;
    if(n*500>=x)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	int n;
	cin >> n;
	for (int i = 1; i <=9; i++) {
		if (n % i == 0 && n / i <= 9) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int h,w,dp[10][10],L,ok,cnt,ans;
int main(void){
    while(1){
    cin>>h>>w;
    if(h==0&&w==0)return 0;
    ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>dp[i][j];
        }
    }
    for(int x1=1;x1<h-1;x1++){
        for(int x2=x1;x2<h-1;x2++){
            for(int y1=1;y1<w-1;y1++){
                for(int y2=y1;y2<w-1;y2++){
                    L=10;
                    ok=1;
                    cnt=0;
                    for(int i=x1-1;i<=x2+1;i++){
                        L=min(L,dp[i][y1-1]);
                        L=min(L,dp[i][y2+1]);
                    }
                    for(int i=y1-1;i<=y2+1;i++){
                        L=min(L,dp[x1-1][i]);
                        L=min(L,dp[x2+1][i]);
                    }
                    for(int i=x1;i<=x2;i++){
                        for(int j=y1;j<=y2;j++){
                            if(L<=dp[i][j])ok=0;
                            cnt+=dp[i][j];
                        }
                    }
                    if(ok){
                        ans=max(ans,(x2-x1+1)*(y2-y1+1)*L-cnt);
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
    }
}



Measured memory_bytes: 3088
#include <iostream>

using namespace std;

int main() {
	int x[5];
	for (int i = 0; i < 5; i++) {
		cin >> x[i];
	}

	int res = -1;
	for (int i = 0; i < 5; i++) {
		if (x[i] == 0) {
			res = i + 1;
			break;
		}
	}
	cout << res <<endl;
}


Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define int long long
using namespace std;

int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n % 2 == 0) return powmod((a * a) % mod, n / 2, mod);
	return (a * powmod(a, n - 1, mod)) % mod;
}

int mod = 1000000007;
int fact[200000];
int factInv[200000];

void init() {
	int i;
	
	fact[0] = 1;
	factInv[0] = 1;
	for (i = 1; i < 200000; i++) {
		fact[i] = (i * fact[i - 1]) % mod;
		factInv[i] = powmod(fact[i], mod - 2, mod);
	}
}

int comb(int n, int k) {
	return fact[n] * factInv[k] % mod * factInv[n - k] % mod;
}

int n, m;

signed main() {
	int i, j;
	
	init();
	cin >> n >> m;
	if (m == 1) { cout << 1 << endl; return 0; }
	
	//mを素因数分解（mを破壊）, 指数部しかいらない
	vector<int> vec;
	for (i = 2; i * i <= m; i++) {
		int cnt = 0;
		while (m % i == 0) {
			cnt++;
			m /= i;
		}
		vec.push_back(cnt);
	}
	if (m > 1) vec.push_back(1);
	
	//数え上げ
	int ans = 1;
	for (i = 0; i < vec.size(); i++) {
		int e = vec[i];
		ans *= comb(n - 1 + e, e);
		ans %= mod;
	}
	
	cout << ans << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	int A[3], ans = 0;

	rep(i,3) cin >> A[i];

	while( A[0] != A[1] || A[1] != A[2] ){
		sort(A, A+3);
		if( A[1] == A[2] ) A[0] += 2;
		else{
			A[0] += 1;
			A[1] += 1;
		}
		ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
# youtube
from heapq import *

q = int(input())
sum_a = 0
sum_b = 0
L = []
R = []
for _ in range(q):
    qi = list(map(int, input().split()))
    if qi[0] == 1:
        a = qi[1]
        heappush(L, -a)
        heappush(R, a)
        if -L[0] > R[0]:
            LtoR = -heappop(L)
            RtoL = heappop(R)
            sum_a += LtoR - RtoL
            heappush(L, -RtoL)
            heappush(R, LtoR)
        sum_b += qi[2]
    else:
        print(-L[0], sum_a + sum_b)


Measured memory_bytes: 19064
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
const ll MOD=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin>>N>>K;
    int d;
    int A;
    set<int> okashi;
    for(int i=0;i<K;i++){
        cin>>d;
        for(int j=0;j<d;j++){
            cin>>A;
            okashi.insert(A);
        }
    }
    cout<<N-okashi.size()<<endl;
}

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

int main(){ 
  Int K, N; cin >> N >> K;
  vector<Int> p(N);
  rep(i,N) {
      cin >> p[i];
      p[i]--;
  }
  
  Int temp = 0, ans2 = 0;
  rep(i,K) temp += p[i];
  ans2 = temp;
  for(Int j = 0; j + K < N; j++) {
    temp = temp - p[j] + p[j+K];
    ans2 = max(ans2, temp);
  }
  
  ans2 += 2 * K;
  double ans;
  if (ans2 % 2 == 1) ans = (ans2 / 2) + 0.5;
  else ans = ans2 / 2;
  cout << fixed << setprecision(12);
  cout << ans << endl;
    

}


Measured memory_bytes: 4832
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int N;
void solve(int n,int m,string s){
	if(n==0)cout<<s<<endl;
	else{
		for(int i=0;i<m;i++){
			solve(n-1,m,s+(char)('a'+i));
		}
		solve(n-1,m,s+(char)('a'+m));
		if(N>n)solve(n-1,m+1,s+(char)('a'+m+1));
	}
}
int main(){
	cin>>N;
	solve(N,0,"");
	return 0;
}

Measured memory_bytes: 1536
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int N;
  scanf("%d", &N);
  static int A[16][16];
  for (auto i = 0; i < N; ++i)
    for (auto j = 0; j < N; ++j)
      scanf("%d", &A[i][j]);
  auto mask = (1u << N) - 1;
  static long long F[1 << 16];
  static int T[16];
  for (auto s = 1u; s <= mask; ++s) {
    auto c = 0;
    for (auto t = s; t; ) {
      auto u = t & -t;
      t ^= u;
      T[c++] = __builtin_ctz(u);
    }
    for (auto i = 1; i < c; ++i)
      for (auto j = 0; j < i; ++j)
        F[s] += A[T[i]][T[j]];
  }
  for (auto s = 1u; s <= mask; ++s)
    for (auto t = (s - 1) & s; t; t = (t - 1) & s)
      F[s] = max(F[s], F[t] + F[s ^ t]);
  printf("%lld\n", F[mask]);
  return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>
int main() {
	  int A,B;
	  char op;
	  scanf("%d %c %d",&A,&op,&B);
	  if(op=='+')
		printf("%d",A+B);
	  else if(op=='-')
		printf("%d",A-B);
	  else
		printf("Error");

	return 0;
}





Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d) cout<<"Left";
    else if(a+b<c+d) cout<<"Right";
    else cout<<"Balanced";
    return 0;
}


Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
import itertools
# import math
# import networkx as nx
from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n,k=n1()
D=n1()

while True:
    t=str(n)
    for i in D:
        if t.count(str(i))>0:
            n+=1
            break
    else:
        break
print(n)

Measured memory_bytes: 3188
#include<stdio.h>
#include<stdlib.h>
int main(void){
    char *x;
    int *flag;
    int i,max,con;
    x=(char*)malloc(sizeof(char)*20);
    flag=(int*)malloc(sizeof(int)*20);
    for(i=0;i<20;i++){
        x[i]=0;
        flag[i]=0;
    }
    scanf("%s",x);
    for(i=0;i<20;i++){
        if(x[i]=='A'||x[i]=='T'||x[i]=='G'||x[i]=='C'){
            flag[i]=1;
        }
    }
    max=0;
    con=0;
    for(i=0;i<20;i++){
        if(flag[i]==1){
            con++;
        }else{
            if(max<con){
                max=con;
            }
            con=0;
        }
    }
    printf("%d\n",max);
    free(x);
    free(flag);
    return 0;
}

Measured memory_bytes: 128
import sys
from io import StringIO
import unittest

def resolve():
    N = int(input())
    # スペース区切りの整数の入力
    ls = list(map(int, input().split()))
    ls.sort()
    num =0
    for i in range(0,N-2):
        for j in range(i+1, N-1):
            for k in range(j+1, N):
                if ls[i]==ls[j] or ls[j]==ls[k]:
                    continue
                elif (ls[i]+ls[j])>ls[k]:
                    num=num+1

    # 文字列の入力

    # 出力
    print("{}".format(num))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5
4 4 9 7 5"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """6
4 5 4 3 3 5"""
        output = """8"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10
9 4 6 1 9 6 10 6 6 8"""
        output = """39"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """2
1 1"""
        output = """0"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


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

int dp[100010];
int h[100010];

int main()
{
    int N;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < N; i++)
    {
        dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
X, N = map(int, input().split())
if N == 0 :
  print(X)
  sys.exit()

p = set(map(int, input().split()))

S_ans = X
L_ans = X

if X not in p :
    print(X)
    sys.exit()
    
for i in range(N) :
  S_ans -= 1
  L_ans += 1
  
  if S_ans not in p :
    print(S_ans)
    sys.exit()
  elif L_ans not in p :
    print(L_ans)
    sys.exit()

Measured memory_bytes: 9204
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            IO io = new IO();

            //ここから
            int n = io.ReadLineToInt();
            int[] p = new int[n];
            for(int i = 0; i < n; i++)
            {
                p[i] = io.ReadLineToInt();
            }
            int ans = p.Sum() - (p.Max() / 2);
            
            //ここまで
            Console.Write(ans);
            Console.ReadKey();
        }
    }

    //関数
    public class Func
    {
        public void Swap<T>(ref T a,ref T b)
        {
            T temp;
            temp = a;
            a = b;
            b = temp;
        }
    }

    //IOを担う関数群
    public class IO
    {
        //stringの入力
        public string ReadLineToString()
        {
            return Console.ReadLine();
        }

        //intの入力
        public int ReadLineToInt()
        {
            return int.Parse(Console.ReadLine());
        }

        //空白区切りの複数の文字列の入力をstring[]にして返す
        public string[] ReadLineToStringArray()
        {
            return Console.ReadLine().Split(' ').ToArray();
        }


        //空白区切りの複数の整数の入力をint[]にして返す
        public int[] ReadLineToIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        //空白区切りの複数の文字列の入力をList<string>で受け取る
        public List<string> ReadLineToStringList()
        {
            return Console.ReadLine().Split(' ').ToList();
        }

        //空白区切りの複数の整数の入力をList<int>で受け取る
        public List<int> ReadLineToIntList()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }

}


Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const ll MOD=1000000007;
const ll LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

#include<atcoder/all>
using namespace atcoder;

int main(){
    int n,m;cin >> n >> m;
    vector<ll> a(n),b(m);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    auto c = convolution(a, b);
    for (int i = 0; i < c.size(); i++) {
        cout << c[i] << " \n"[i+1==c.size()];
    }
    return 0;
}


Measured memory_bytes: 27244
function main()
    N = pread(Int)
    ans = zeros(Int, N)
    ans = cn(N,ans)
    for i in 1:N
        println(ans[i])
    end
end

function cn(N,ans)
    for i in 1:N
        xsum = i^2
        if xsum > N
            break
        end
        for j in 1:i
            ysum = j^2 + i*j + xsum
            if ysum > N
                break
            end
            for k in 1:j
                zsum = k^2 + j*k + k*i + ysum
                if zsum > N
                    break
                end
                if i == j == k
                    ans[zsum] += 1
                elseif i == j || j == k || k == i
                    ans[zsum] += 3
                else
                    ans[zsum] += 6
                end
            end
        end
    end
    return ans
end

import Base.parse
import Base.StringVector

parse(::Type{String},  str::AbstractString) = str
isdelim(x::UInt8, xs::Set{UInt8}) = x in xs
const delimset = Set([0x0a, 0x20])

function myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}
    out = StringVector(0)
    c::UInt8 = 0x00
    while !eof(s)
        c = read(s, UInt8)
        !isdelim(c, delims) && break
    end
    push!(out, c)
    eof(s) && return out
    while !eof(s)
        c = read(s, UInt8)
        isdelim(c, delims) && break
        push!(out, c)
    end
    return out
end

function readword(io::IO = stdin, delims = delimset)::String
    word = myreaduntil(io, delims)
    i = length(word)
    if i == 0 || word[i] != 0x0a
        return String(word)
    elseif i < 2 || word[i-1] != 0x0d
        return String(resize!(word,i-1))
    else
        return String(resize!(word,i-2))
    end
end

pread(ty) = parse(ty, readword())

reads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)

function readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}
    rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)
    for i in 1:len
        for j in 1:length(tys)
            @inbounds rv[j][i] = pread(tys[j])
        end
    end
    rv
end

readvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]

function readmat(ty::Type, s...)::Matrix{ty}
    v = Matrix{ty}(undef, s...)
    @inbounds for i in 1:s[1]
        v[i,:] = readvec(ty, s[2])
    end
    v
end

main()


Measured memory_bytes: 185772
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll a, b;
	cin>>a>>b;
	if(a%2!=b%2){
		cout<<"IMPOSSIBLE"; return 0;
	}
	ll c = max(a, b);
	ll d =min(a, b);
	cout<<(c+d)/2;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> a >> b;
    if (a + b >= 24) {
        MSG(a + b - 24)
    } else {
        MSG(a + b)
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,i,j;
	char z[101][101];
	scanf("%d %d",&a,&s);
	for(i=0;i<a;i++) scanf("%s",z[i]);
	for(i=0;i<=s+1;i++) printf("#");
	printf("\n");
	for(i=0;i<a;i++){
		printf("#");
		printf("%s",z[i]);
		printf("#\n");
	}
	for(i=0;i<=s+1;i++) printf("#");
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#define IO ios::sync_with_stdio(false);cin.tie(0);
const int MOD=1e9+7;
typedef long long ll;
using namespace std;
int a[3], cnt=0;
int main()
{
	for(int i = 0; i < 3; i++){
		cin >> a[i];
	}
	sort(a, a+3);
	while(a[0] != a[2]){
		cnt++;
		if(a[1] == a[2] || a[2]-a[0]>1)
			a[0] += 2;
		else a[0]++, a[1]++; 
		sort(a, a+3);
	}
	cout << cnt << endl;
	return 0;
} 

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

using namespace std;

ll val[100005];
ll weight[100005];
int n, W;

ll dp[105][100005];

ll solve(int i, int w){

    if (i == n || w == 0) return 0;
    
    if(dp[i][w] != -1){
        return dp[i][w];
    }
    
    if(weight[i] <= w)
        return dp[i][w] = max(solve(i+1, w - weight[i]) + val[i], solve(i+1, w));
    else
        return dp[i][w] = solve(i+1, w);
}


int main(){
    
    
    cin >> n >> W;
    
    memset(dp, -1, sizeof(dp));
    
    for(ll i=0; i<n;i++){
        cin >> weight[i] >> val[i];
    }
        
    cout << solve(0,W) << endl;

}

Measured memory_bytes: 82304
#include <iostream>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <stdio.h> 
#include <map>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <deque>
#include <sstream>
#include <vector>
#include <algorithm>

typedef long long ll;
using namespace std;

int main() {
	int a, b;
	cin>>a>>b;
	
	for (int i=1; i<=10000; i++) {
		if((i*8)/100==a && (i*10)/100==b) {
			cout << i;
			return 0;
		}
	}
	
	cout << -1;
	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 [] list = new int[n];
		//????´???????????????°?????????
		for(int i = 0; i<n; i++){
			//??????????´?
			list[i] = sc.nextInt();
			//System.out.print(list[i] + " ");
		}

		//??????????????????????????????????????????
		for(int i = n-1 ; 0 <= i ; i--){
			if(i==0){
				//???????????¨?????????????¬????????????????
				System.out.println(list[i]);
			}else{
				//???????????¨???
				System.out.print(list[i] + " ");
			}
		}
		//???????????????
		//System.out.println();
	}
}

Measured memory_bytes: 26488
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int H, W;
  cin >> H >> W;
  vector<string> v;
  rep(i,H){
    string s;
    cin >> s;
    v.push_back(s);
  }

  map<int,int> a, b;
  rep(i,H){
    bool flg = true;
    rep(j,W){
      if(v[i][j] == '#') flg = false;
    }
    if(flg) a[i]=1;
  }
  rep(j,W){
    bool flg = true;
    rep(i,H){
      if(v[i][j] == '#') flg = false;
    }
    if(flg) b[j]=1;
  }

  rep(i,H){
    bool flg = false;
    rep(j,W){
      if(a[i]==1 || b[j]==1) continue;
      cout << v[i][j];
      flg = true;
    }
    if(flg) cout << endl;
  }
  
  
  return 0;
}


Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import Counter

a = ns()
n = len(a)
c = Counter(a)
eq = 0
for _, v in c.items():
    eq += v * (v - 1) // 2

ans = (n * (n - 1) // 2) - eq + 1
print(ans)

Measured memory_bytes: 3860
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] token = line.split(" ");
        int max1 = Integer.parseInt(token[0]);
        int cur1 = Integer.parseInt(token[1]);
        int cur2 = Integer.parseInt(token[2]);

        int residual;
        if (max1 - cur1 < cur2) {
            residual = cur2 - (max1 - cur1);
        } else {
            residual = 0;
        }

        System.out.println(residual);
    }
}

Measured memory_bytes: 23764
import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    counter = [0] * 3
    for a in map(int, input().split()):
        counter[a - 1] += 1

    # (i, j, k) -> (i - 1, j, k), (i + 1, j - 1, k), (i, j + 1, k - 1)
    # s = i + j + k の小さい方から遷移
    dp = [[[None] * (n + 1) for _ in range(n + 1)] for _ in range(n + 1)]
    dp[0][0][0] = 0
    for s in range(1, n + 1):
        for k in range(n + 1):
            for j in range(n + 1):
                i = s - j - k
                if i < 0:
                    break
                res = n
                if i: res += i * dp[i - 1][j][k]
                if j: res += j * dp[i + 1][j - 1][k]
                if k: res += k * dp[i][j + 1][k - 1]

                res /= s
                dp[i][j][k] = res

    i, j, k = counter
    print(dp[i][j][k])
resolve()

Measured memory_bytes: 307336
import sys
input = sys.stdin.readline
a1,b1 = input().split()
a2,b2 = input().split()
a3,b3 = input().split()
a1 = int(a1)
b1 = int(b1)
a2 = int(a2)
b2 = int(b2)
a3 = int(a3)
b3 = int(b3)
list = [a1,a2,a3,b1,b2,b3]
if list.count(1) == 3 or list.count(2) == 3 or list.count(3) == 3 or list.count(4) == 3:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){ return (a%m + b%m+2*m)%m;}

ll mul(ll a, ll b, ll m = MOD){ return ((a%m+m)*(b%m+m))%m;}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 100+5;
const int K = 100000+5;

int n, k;
int a[N];
int grundy[K];

int main(){
	ri2(n,k);
	for(int i=0; i<n; i++) ri(a[i]);
	for(int i=0; i<a[0]; i++){
		grundy[i] = 0;
	}
	for(int i=a[0]; i<=k; i++){
		vector<bool> used(n+1,false);
		for(int j=0; j < n and a[j] <= i; j++){
			used[grundy[i-a[j]]] = true;
		}
		int G = 0;
		while(used[G]){
			G++;
		}
		grundy[i] = G;
	}
	puts(grundy[k]?"First":"Second");
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    bool zero = true;
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] != 0) zero = false;
        mp[a[i]]++;
    }
    if (n % 3 != 0 || mp.size() >= 4) {
        cout << (zero ? "Yes" : "No") << endl;
        return 0;
    }
    if (mp.size() == 1) {
        if (mp[0] == 0) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    } else if (mp.size() == 2) {
        if (mp[0] * 3 != n) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    } else if (mp.size() == 3) {
        int check = 0;
        for (auto e : mp) {
            check ^= e.first;
            if (e.second * 3 != n) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << (check == 0 ? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 4224
#include <cstdio>

int main()
{
  int n,k;
  scanf("%d%d",&n,&k);
  bool p[10]={0};
  for(int i=0;i<k;i++){
    int a;
    scanf("%d",&a);
    p[a]=1;
  }
  while(1){
    int N=n;
    bool F=0;
    while(N>0){
      F|=p[N%10];
      N/=10;
    }
    if(!F){
      break;
    }
    n++;
  }
  printf("%d\n",n);
  return 0;
}


Measured memory_bytes: 128
import scala.io.StdIn._
object Main extends App {
  println(
    readLine.trim.toList match {
      case Cat(Nil) ⇒ "Cat"
      case _ ⇒ "Rabbit"
    })

  object Cat {
    def unapply(arg: List[Char]): Option[List[Char]] = {
      arg match {
        case Nil ⇒ Some(Nil)
        case 'm'::Cat('e'::Cat('w'::t)) ⇒ Some(t)
        case _ ⇒ Some(arg)
      }
    }
  }
}


Measured memory_bytes: 43796
def main():
    a,b,c,d,e,f = map(int,input().split())
    a*=100
    b*=100
    den=0.0
    x=0
    y=0
    for i in range(f//b+1):
        for j in range((f-(i*b))//a+1):
            for k in range((f-(i*b+j*a))//d+1):
                for l in range((f-(i*b+j*a+k*d))//c+1):
                    if i*b+j*a>0 and f>=i*b+j*a+k*d+l*c and (k*d+l*c)/(i*b+j*a) <= e/100 and den < (k*d+l*c)/(i*b+j*a):
                        den=(k*d+l*c)/(i*b+j*a)
                        x=i*b+j*a+k*d+l*c
                        y=k*d+l*c
    if x==0:
        print(a,0)
    else:
        print(x,y)                  
if __name__ == "__main__":
    main()

Measured memory_bytes: 41324
N, K = map( int, input().split() )

a, b = 0, 0 
for i in range( 1, N + 1 ):
  if i % K == 0:
    a += 1
  elif 2 * i % K == 0:
    b += 1

cnt = a ** 3 + b ** 3
print( cnt )

Measured memory_bytes: 2940
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
  int n;
  cin >> n;
  while(n--){
    cin >> a >> b >> c;
    if(a*a == b*b + c*c ||
       c*c == a*a + b*b||
       b*b == c*c + a*a)cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

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


// # DEFINES # //
#define ll long long
#define M (ll)(1e9+7)
#define EPS 1e-9

using namespace std;

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

    ll a, b;
    
    cin >> a >> b;

    if(a <= 8 && b <= 8)
        cout << "Yay!" << endl;
    else 
        cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 256
package main
import (
	"fmt"
	"strings"
)

func main(){
	var s, p string
	fmt.Scan(&s, &p)
	s = s+s[:len(p)]
	ans := strings.Index(s, p)
	if ans==-1{
		fmt.Println("No")
	}else{
		fmt.Println("Yes")
	}
}


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  double a, b, x;
  cin >> a >> b >> x;
  double d;
  d = x / (a * a);
  dump(a, b, x, d);
  if (d * a < a * b / 2.0) {
    double c, r;
    c = d * a * 2 / b;
    dump(b, c);
    r = atan2(b, c) * 180.0 / M_PI;
    dump(r);
    cout << r << endl;
  } else {
    double c, r;
    c = (d * a * 2.0 - a * b) / a;
    dump(b-c, a);
    r = atan2(b - c, a) * 180.0 / M_PI;
    dump(r);
    cout << r << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=205;
int n,ans;

int sg(int nowa,int nowk){
	if(nowa/nowk<1)return 0;
	if(nowa%nowk==0)return nowa/nowk;
	return sg(nowa-nowa/nowk-1,nowk);
}

int main(){
	scanf("%d",&n);
	rep(i,n){
		int a,k;
		scanf("%d%d",&a,&k);
		ans^=sg(a,k);
	}
	puts(ans?"Takahashi":"Aoki");
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int lc = 0;
		short[] heights = new short[10];
		while (lc < 10) {
			try {
				heights[lc] = Short.parseShort(reader.readLine());
			} catch (NumberFormatException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
			lc++;
		}

		Arrays.sort(heights);

		for (int i = heights.length-1; i > heights.length-4; i--) {
			System.out.println(heights[i]);
		}

	}

}

Measured memory_bytes: 16928
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val k = sc.nextInt()
    var sum = 0
    var r = k
    sum += minOf(a, r)
    r -= minOf(a, r)
    r -= minOf(b, r)
    sum -= minOf(c, r)
    println(sum)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	N=(N+1)/2;
	if(N>=K) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define size(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
int main(void){
  int a,b,c;
  cin >> a >> b;
  if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
    cout << "Possible";
  }else{
    cout << "Impossible";

  }
}

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

int main(){
    ll n;
    cin>>n;
    ll ans=0;
    if(n<10){
        ans=n;
    }else if(n<100){
        ans=9;
    }else if(n<1000){
        ans=9+(n-99);
    }else if(n<10000){
        ans=9+900;
    }else if(n<100000){
        ans=9+900+(n-9999);
    }else{
        ans=9+900+90000;
    }

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

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

#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

int main(){
    CIN2(t,x)
    cout << (double)t/x  << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> D(10, 0);
    for(int i=0; i<K; i++) {
        int a;
        cin >> a;
        D[a] = 1;
    }

    for(int i=N; i<=100000; i++) {
        int num = i;
        bool flg = true;
        while(num) {
            int x = num % 10;
            if (D[x] == 1) {
                flg = false;
                break;
            }
            num /= 10;
        }
        if(flg && i>= N) {
            cout << i << endl;
            return 0;
        }
    }
}

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

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string str;
    cin >> str;
    int res = str.length()%2;
    if (str[0] == str[str.length()-1]) res = (res+1)%2;
    if (res == 0) cout << "Second\n";
    else cout << "First\n";
}
/*

 */

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

bool isPali(const string &s) {
  for(int i = 0; i < s.size()-1-i; ++i) {
    if(s[i] != s[s.size()-1-i]) return false;
  }
  return true;
}

int main() {
  string s;
  int ans = 0;
  while(cin >> s) {
    ans += isPali(s);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1184
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<sstream>
#include<iomanip>

using namespace std;

#define INF 999999999

int mcxi_int(string s){
	int r=0, ins=1;
	for(int p=0; p<s.size(); p++){
		if(s[p]-'0'>=2 && s[p]-'0'<=9){
			ins = s[p]-'0';
		}
		else if(s[p] == 'm'){
			r += ins * 1000;
			ins = 1;
		}
		else if(s[p] == 'c'){
			r += ins * 100;
			ins = 1;
		}
		else if(s[p] == 'x'){
			r += ins * 10;
			ins = 1;
		}
		else if(s[p] == 'i'){
			r += ins;
			ins = 1;
		}
	}
	return r;
}

string int_mcxi(int i){
	string r;
	if((i/1000)%10 >= 1){
		if((i/1000)%10 >= 2){
			r += '0'+ (i/1000)%10;
		}
		r += 'm';
	}
	if((i/100)%10 >= 1){
		if((i/100)%10 >= 2){
			r += '0'+(i/100)%10;
		}
		r += 'c';
	}
	if((i/10)%10 >= 1){
		if((i/10)%10 >= 2){
			r += '0'+(i/10)%10;
		}
		r += 'x';
	}
	if((i/1)%10 >= 1){
		if((i/1)%10 >= 2){
			r += '0'+(i/1)%10;
		}
		r += 'i';
	}
	return r;
}

int main(){
	int i, j, k, n, a, b, c;
	string y, z, ans;
	cin >> n;
	for(i=0; i<n; i++){
		cin >> y >> z;
		c = mcxi_int(y) + mcxi_int(z);
		ans = int_mcxi(c);
		cout << ans << endl;
	}
	
	return 0;
}

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

int main(){
	int n,a=0,b=0;
	cin>>n;

	vector<int>l(n);

	for(int i=0;i<n;i++){
		cin>>l[i];
		if(l[i]>a)a=l[i];
		b+=l[i];
	}
	
	if(b-a>a)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		Set<Integer> sn = new HashSet<>();
		for(int i = 0; i < K; i++) {
			int d = sc.nextInt();
			for(int j = 0; j < d; j++)
				sn.add(sc.nextInt());	
		}
		System.out.println(N-sn.size());
	}

}

Measured memory_bytes: 46372
#include <bits/stdc++.h>
using namespace std;
int n;
long long X;

long long gcd(long long a, long long b) {
    if(a < b) {
        long long tmp = a;
        a = b;
        b = tmp;
    }
    long long r = a % b;

    while(r > 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    cin >> n >> X;
    vector<long long> x(n);
    for(int i = 0; i < n; ++i) {
        cin >> x.at(i);
    }

    x.push_back(X);
    sort(x.begin(), x.end());
    int xlen = x.size();

    vector<long long> dx;
    for(int i = 1; i < xlen; ++i) {
        dx.push_back(x.at(i) - x.at(i-1));
    }

    int dxlen = dx.size();
    long long g = 0;
    if(dxlen == 1) {
        g = dx.at(0);
    }else {
        g = gcd(dx.at(0), dx.at(1));
        for(int i = 2; i < dxlen; ++i) {
            g = gcd(g, dx.at(i));
        }
    }

    cout << g << endl;
}

Measured memory_bytes: 2800
#include<bits/stdc++.h>
using namespace std;
#include <math.h>
#define ll long long 
// to increase precision
// std::cout<<std::fixed;
// 	std::cout<<std::setprecision(6)<<z;
#define max1 1000001



int main(){	
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;


}
	
	
	
	





Measured memory_bytes: 3648