akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define LL long long
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define sz(v) ((int)sizeof(v))
#define N 110
const int inf=1e9;
int g[N][N];
int e[N][N];

int main()
{
    int n,m,a,b,c;
    while(~scanf("%d%d",&n,&m)){
        ++n;
        rep(i,1,n) rep(j,1,n) g[i][j]=e[i][j]=inf;
        rep(i,0,m){
            scanf("%d%d%d",&a,&b,&c);
            g[a][b]=g[b][a]=c;
            e[a][b]=c;
        }

        rep(k,1,n){
            rep(i,1,n){
                rep(j,1,n){
                    if(g[i][k]+g[k][j]<g[i][j]){
                        g[i][j]=g[i][k]+g[k][j];
                    }
                }
            }
        }
        int ans=0;
        rep(i,1,n) rep(j,1,n) if(g[i][j]!=e[i][j]&&e[i][j]!=inf) ++ans;
        cout<<ans<<'\n';
    }
    return 0;
}


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

const int r = 2e3;

int sqrt5(int x) {
 for (int i = -100; i <= x; i++) {
    int curr = i * i * i * i * i;
    if (curr == x) {
        return i;
    }
    if (curr > x) {
        return -1;
    }
 }
}

int32_t main() {
 int x;
 cin >> x;
 for (int a = -r; a <= r; a++) {
    int a5 = a * a * a * a * a;
    if (a5 < x) {
        if (sqrt5(x - a5) != -1) {
            cout << a << " " << -sqrt5(x - a5);
            return 0;
        }
    }
    else {
        if (sqrt5(a5 - x) != -1) {
            cout << a << " " << sqrt5(a5 - x);
            return 0;
        }
    }
 }
 return 0;
}


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

using namespace std;

int ans;
int ds[200005];

inline int par(int x) {
	int t = x;
	while (ds[x] != x) {
		x = ds[x];
	}
	return ds[t] = x;
}

inline void uni(int a, int b) {
	int pa = par(a), pb = par(b);
	if (pa != pb) {
		ans--;
		ds[pa] = pb;
	}
	return;
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
	int n, k;

	while (cin >> n >> k) {
		vector<int> p(n);
		for (int i = 0;i < n;i++) {
			cin >> p[i];
			ds[i] = i;
		}
		if (n == k) {
			cout << 1 << endl;
			continue;
		}
		set<int> ma, mi;
		ans = n - k + 1;
		for (int i = 0;i < k+1;i++) {
			ma.insert(-p[i]);
			mi.insert(p[i]);
		}
		for (int i = 0;i+k < n;i++) {
			//cout << *mi.begin() << " " << -*ma.begin() << endl;
			if (p[i] == *mi.begin() && -p[i+k] == *ma.begin()) {
				uni(i, i+1);
			}
			if (i+k == n-1)
				break;
			mi.erase(p[i]);
			ma.erase(-p[i]);
			mi.insert(p[i+k+1]);
			ma.insert(-p[i+k+1]);
		}
		int pre = -1, len = 1;
		for (int i = n-1;i > 0;i--) {
			if (p[i] > p[i-1]) {
				len++;
				if (len >= k) {
					if (pre != -1)
						uni(i-1, pre);
					pre = i-1;
				}
			}
			else {
				len = 1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 20352
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>

using namespace std;

int main() {
	int i, j, N;
	int a[100001] = { 0 };
	int aa[100001] = { 0 };

	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> a[i];
	}

	for (i = 0; i < N; i++) {
		aa[a[i] + 1]++;
		aa[a[i] - 1]++;
		aa[a[i] ]++;
	}

	int max = 0;
	for (i = 0; i < 100001; i++) {
		if (max < aa[i]) {
			max = aa[i];
		}
	}

	cout << max << endl;


	return 0;
}


Measured memory_bytes: 1024
class Converter:
    d = {
        1: { 2: 3, 3: 5, 4: 2, 5: 4, },
        2: { 1: 4, 3: 1, 4: 6, 6: 3, },
        3: { 1: 2, 2: 6, 5: 1, 6: 5, },
        4: { 1: 5, 2: 1, 5: 6, 6: 2, },
        5: { 1: 3, 3: 6, 4: 1, 6: 4, },
        6: { 2: 4, 3: 2, 4: 5, 5: 3, }
        }

    def __init__(self, s):
        l = s.split()
        self.tbl = dict(zip(l, range(1,7)))
        self.pip = dict(zip(range(1,7), l))

    def __call__(self, s):
        l, r = s.split()
        print(self.pip[self.d[self.tbl[l]][self.tbl[r]]])

cv = Converter(input())
n = int(input())
for _ in range(n):
    cv(input())

Measured memory_bytes: 7816
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()
using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	double PI=3.14159265358979323846;
	double R;
	cin >> R;

	cout << R * 2 * PI << '\n';
	return 0;
}


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

typedef long long ll; typedef unsigned long long ull; typedef unsigned int uint; typedef long double ld;

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

int n;
cin >> n;
ll t;
ld ans = 1;
for (int i = 0; i < n; i++)
{
    cin >> t;
    if (ans != -1)
       ans *= t;
    if (ans > 1000000000000000000 || ans < 0)
       ans = -1;
    if (t == 0)
       ans = 0;
}
cout << (ll)ans;
return 0;
}

Measured memory_bytes: 3632
//#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) begin(a),end(a)
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=1e9+7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int mul(int a,int b){
  return ((a)*1ll*(b))%mod;
}

void add(int &a,int b){
  a+=b;
  if(a>=mod)a-=mod;
}

int sub(int a,int b){
  a-=b;
  if(a<0){
    a+=mod;
  }
  return a;
}

int powz(int a,int b){
  int res=1;
  while(b){
    if(b&1){
      res=mul(res,a);
    }
    b/=2;
    a=mul(a,a);
  }
  return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
  input>>x.F>>x.S;
  return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

template<typename T>
vector<pair<T,int>> getvec(int n){
  vector<pair<T,int>>a(n);
  for(int i=0;i<a.size();i++){
    cin>>a[i].F;
    a[i].S=i;
  }
  return a;
}

void clr(auto &a,int n){
  a.clear();
  a.resize(n);
}

void unq(auto &a){
  sort(all(a));
  a.resize(unique(all(a))-a.begin());
}

const int N=200005;

void solve(){
  int h,w,S;
  cin>>h>>w>>S;
  vector<string>a(h);
  cin>>a;
  int ans=1e9;
  for(int i=0;i<(1<<(h-1));i++){
    vector<int>dp(w);
    int val=0;
    vector<int>cnt(h);
    vector<int>block(h);
    int cr=0;
    for(int j=0;j<h;j++){
      block[j]=cr;
      if(i&(1<<j)){
	cr=j+1;
      }
    }
    int notpos=0;
    debug(i,block);
    for(int j=0;j<w;j++){
      int flag=0;
      for(int k=0;k<h;k++){
	if(a[k][j]=='1'){
	  cnt[block[k]]++;
	  if(cnt[block[k]]==S+1){
	    flag++;
	  }
	}
      }
      debug(j,cnt);
      if(flag){
	debug(j);
	for(auto &i:cnt){
	  i=0;
	}
	for(int k=0;k<h;k++){
	if(a[k][j]=='1'){
	  cnt[block[k]]++;
	  if(cnt[block[k]]==S+1){
	    flag++;
	  }
	}
      }
	for(auto &j:cnt){
	  if(j>S){
	    notpos=1;
	  }
	}
	val++;
      }
    }
    debug(i,val);
    if(notpos==0)
    ans=min(ans,val+__builtin_popcount(i));
  }
  cout<<ans;
}

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc=1;
  //cin>>tc;
  for(int _=0;_<tc;_++){
    // cout<<"Case #"<<_+1<<": ";
    solve();
    if(_!=tc-1){
      cout<<'\n';
    }
  }
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int A[] = new int[N+1];
		int answer[] = new int[N+1];
        //社員番号xの社員の直属の部下はA[i]=xを満たす。
        //つまり、各数がAに何度登場するかを求めればよい
		for(int i=2; i<=N; i++) {
			A[i] = sc.nextInt();
		}
		for(int i=2; i<=N;i++) {
			answer[A[i]]++;
		}
		for(int i=1; i<=N; i++) {
			System.out.println(answer[i]);
		}
	}		
}

Measured memory_bytes: 62112
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
using namespace std;
int MOD = 1e9 + 7;

string a, b;

int main() {
	cin >> a >> b;
	if (a == b)cout << "H" << endl;
	else cout << "D" << endl;
	return 0;
}

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

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


Measured memory_bytes: 256
def partition(num_list, start, end):
    split = start -1
    x = num_list[end]
    for i in range(start, end):
        if num_list[i] <= x:
            split += 1
            num_list[split], num_list[i] = num_list[i], num_list[split]
    num_list[split+1], num_list[end] = num_list[end], num_list[split+1]
    num_list = [str(i) for i in num_list]
    num_list[split+1] = '[{}]'.format(num_list[split+1])
    print(' '.join(num_list))

n = int(input())
input_line = [int(i) for i in input().split()]
partition(input_line, 0, n-1)


Measured memory_bytes: 16596
#include <bits/stdc++.h>
using namespace std;
int n,m,k,sum,a[105],b[105],c[105],d[105],mp[105];
void dfs(int t1,int t2)
{
	if(t1==n)
	{
		int res=0;
		for(int i=0;i<k;i++)
			res+=d[i]*(mp[b[i]]-mp[a[i]]==c[i]);
		sum=max(sum,res);
		return;
	}
	for(int i=t2;i<=m;i++)
	{
		mp[t1]=i;
		dfs(t1+1,i);
	}
}
int main()
{
	cin>>n>>m>>k;
	for(int i=0;i<k;i++)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		a[i]--;
		b[i]--;
	}
	dfs(0,1);
	cout<<sum;

	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#define loop(n) for(int i=0; i<(n); i++)
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;

int main(){
    int N,M;
    cin >> N >> M ;
    if(N == M){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}

Measured memory_bytes: 256
import Control.Monad
import qualified Data.Set as S
import qualified Data.ByteString.Char8 as B
import qualified Data.Array.IArray as A
import qualified Data.IntMap.Strict as M

type Bound = (Vertex, Vertex)
type Vertex = Int
type Weight = Int
type Edge = ((Vertex, Vertex), Weight)
type Path = [Vertex]
type Graph = A.Array Vertex (S.Set (Vertex, Weight))

buildG :: Bound -> [Edge] -> Graph
buildG b = A.accumArray (flip S.insert) S.empty b . map (\((s, t), w) -> (s, (t, w)))

from :: Graph -> Vertex -> S.Set (Vertex, Weight)
from = (A.!)

size :: Graph -> Int
size g = let (i,j) = A.bounds g in j - i + 1

readDirectedEdge :: B.ByteString -> [Edge]
readDirectedEdge = map (constructOneWay . map readInt . B.words) . B.lines

constructOneWay :: [Int] -> Edge
constructOneWay [s,t,w] = ((s, t), w)
constructOneWay _ = undefined

readInt :: B.ByteString -> Int
readInt = maybe undefined fst . B.readInt

main :: IO ()
main = do
  [n,_] <- map read . words <$> getLine
  es <- readDirectedEdge <$> B.getContents
  let g = buildG (1, n) es
  putStrLn $ maybe "inf" show (score n g)

score :: Int -> Graph -> Maybe Weight
score n g = guard (im1 M.! n == im2 M.! n) >> return (im1 M.! n)
  where
    im1 = bellmanFord g 1
    im2 = _bellmanFord g (size g) im1

type Memo = M.IntMap Weight

bellmanFord :: Graph -> Vertex -> Memo
bellmanFord g s = _bellmanFord g n m0
 where
  n = size g
  m0 = M.singleton s 0

_bellmanFord :: Graph -> Int -> Memo -> Memo
_bellmanFord g n m
  | n == 0 = m
  | otherwise = _bellmanFord g (pred n) (M.foldrWithKey (move g) m m)

move :: Graph -> Vertex -> Weight -> Memo -> Memo
move g s aw m = S.foldr update m (from g s)
  where
    update (t, w) acc
      | M.notMember t acc || acc M.! t < aw + w = M.insert t (aw + w) acc
      | acc M.! t == aw + w = M.insertWith min t (aw + w) acc
      | otherwise = acc

Measured memory_bytes: 2428
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

	s, t := next(), next()

nextLoop:
	for i := len(s) - len(t); i >= 0; i-- {
		for j := 0; j < len(t); j++ {
			if s[i+j] != '?' && s[i+j] != t[j] {
				continue nextLoop
			}
		}
		fmt.Println(strings.Replace(s[:i] + t + s[i+len(t):], "?", "a", -1))
		return
	}

	fmt.Println("UNRESTORABLE")
}

Measured memory_bytes: 640
input1 = gets.split(" ").map{|item| item.to_i}
input2 = gets.split(" ").map{|item| item.to_i}

N = input1[0]
X = input1[1]

count = 1
total_length = 0
i = 1

for i in 0..N-1
  total_length += input2[i]
  if total_length > X
    break
  else
    count += 1
  end
end

p count

Measured memory_bytes: 1788
from heapq import heappush, heappop
import bisect

class Solver(object):
    def __init__(self):
        self.trees = []
        self.n, self.k = list(map(int, input().split(" ")))
        for _ in range(self.n):
            self.trees.append(int(input()))
            # heappush(self.trees, int(input()))
        self.trees.sort()

    def solve(self):
        global_min = self.trees[self.k-1] - self.trees[0]
        for i in range(1, self.n - self.k + 1):  # 0 .. n-k
            shortest = self.trees[i]
            tallest = self.trees[i+self.k-1]
            local_min = tallest - shortest
            if local_min < global_min:
                global_min = local_min
        print(global_min)


if __name__ == "__main__":
    s = Solver()
    s.solve()

Measured memory_bytes: 7560
#include<iostream>
using namespace std;
int main()
{
    int k,s,i,j,l,sum=0;
    cin>>k>>s;
    for(i=0;i<=k;i++)
    {
        for(j=0;j<=k;j++)
        {
            if(s-i-j>=0&&s-i-j<=k)
            {
                sum++;
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
require 'set'

def main
    s = gets.chomp
    puts s == "ABC" ? "ARC" : "ABC"
end

main

## イディオムなど
# until s.empty? do
#
## 配列のインデックス
# s[0,6] # 0番目から6文字
# s[0..6] # 0番目から6番目まで
# s[5..-1] # 5番目から最後まで
#
## 全探索
# [0, 1].repeated_permutation(n) do |combination| # bit全探索
# array.combination(i) do |selected| # array から要素が i 個である部分列を全部抽出
#
## 無向グラフの幅優先探索(BFS)
# to = Array.new(n).map{Array.new()} # ある頂点と繋がる頂点のリスト
# m.times do
#     a,b = gets.chomp.split(" ").map(&:to_i)
#     to[a].push b
#     to[b].push a
# end
# q = Queue.new # BFS は queue
# ds = Array.new(n, -1)
# pre = Array.new(n, -1)
#
## その他
# a1 = Marshal.load(Marshal.dump(a2)) # 深いコピー
# matrix = Array.new(n).map{Array.new()} # 二次元配列の初期化
# 

Measured memory_bytes: 14312
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

if __name__ == "__main__":
    li = list(map(int,input().split()))
    a=li[0]
    r=[]
    ret=a-1

    r=make_divisors(a)
    if(len(r)%2==1):
        print(r[-1]*2-2)
    else:
        for i in range(0,int(len(r)/2)):
            if(r[i*2]+r[i*2+1]-2<ret):
                ret=r[i*2]+r[i*2+1]-2
        print(ret)

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<long long> A(N), B(N);
    for(int i=0;i<N;++i) cin >> A[i] >> B[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    long long ans = 0;

    // 奇数
    if(N % 2){
        ans = B[N / 2] - A[N/2] + 1;
    }
    else{
        long long a = A[N/2 - 1] + A[N/2];
        long long b = B[N/2 - 1] + B[N/2];
        ans = b - a + 1;
    }
    if(ans < 0) ans = 0;
    cout << ans << endl;
}


Measured memory_bytes: 6408
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    x = int(input())
    if x in [3,5,7]:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, a[114];
int ans = INF;
int cnt1, cnt2;

signed main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		cnt2 += a[i];
	}
	ans = cnt2;
	rep(i, n) {
		cnt1 += a[i];
		cnt2 -= a[i];
		ans = min(ans, abs(cnt1 - cnt2));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
dp = [-1] * (N + 1)
dp[0] = 0
match = [2, 5, 5, 4, 5, 6, 3, 7, 6]
mn = []
for a in A:
    mn.append([match[a-1],a])
for i in range(2, N+1):
    for m, n in mn:
        if i-m  >= 0:
            dp[i] = max(dp[i],dp[i-m]*10+n)       
print(dp[-1])

Measured memory_bytes: 14388
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}

int main(){

   string str;
   cin>>str;
   int sz=str.size();

   if(str[sz-1]=='3')
   {
       cout<<"bon"<<endl;
   }
   else if(str[sz-1]=='0' || str[sz-1]=='1'  || str[sz-1]=='6' || str[sz-1]=='8' )
   {
       cout<<"pon"<<endl;
   }
   else cout<<"hon"<<endl;




return 0;
}



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

int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  rep(i, N) cin >> L.at(i);
  sort(L.begin(), L.end());
  priority_queue<int, vector<int>, greater<int>> pq;
  
  int64_t ans = 0;
  
  for(int i= 2; i < N; i++){
    for(int j = 0; j < i - 1; j++) pq.push(L.at(j) + L.at(i-1));
    while(pq.size()){
      if(pq.top() <= L.at(i)) pq.pop();
      else break;
    }
    ans += pq.size();
  }
  
  cout << ans <<  endl;
}

Measured memory_bytes: 10480
n = int(input())
S = list(map(int, input().split(' ')))
q = int(input())
T = list(map(int, input().split(' ')))

def linearSearch(key):
  i = 0
  len_pre_S = len(S)
  S.append(key)
  while S[i] != key:
    i += 1
  if i == len_pre_S:
    return 0
  return 1

count = 0
for t in T:
  count += linearSearch(t)
print(count)


Measured memory_bytes: 6552
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

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

  vector<int> x(N, 0), y(N, 0);

  for (int i = 0; i < M; i++)
  {
    int a, b;
    cin >> a >> b;
    if (a == 1) x.at(b)++;
    else if (b == N) y.at(a)++;
  }
  
  string ans = "IMPOSSIBLE";
  for (int i = 2; i < N; i++)
  {
    if (x.at(i) * y.at(i) > 0)
    {
      ans = "POSSIBLE";
      break;
    }
  }

  cout << ans << endl;
}

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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    cout << "vowel\n";
  else cout << "consonant\n";
  return 0;
}


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;

const int MAX = 1e5 + 5;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int K;
string S;

int main(){
    cin >> S >> K;

    vector<int> cnt(3, 0);

    string T = S + S + S;
    for (int i = 1; i < T.size(); ++i) {
        if (T[i - 1] == T[i]) {
            if (i < S.size()) cnt[0]++;
            else if (i < S.size() * 2) cnt[1]++;
            else cnt[2]++;
            i++;
        }
    }

    ll ans = 0;
    if (cnt[0] == cnt[1] && cnt[0] == cnt[2]) {
        ans = (ll)cnt[0] * K;
    } else if(cnt[1] == cnt[2]) {
        ans = (ll)cnt[0] + (ll)cnt[1] * (K - 1);
    } else {
        ans = (ll)(cnt[0] + cnt[1]) * (K / 2);
        if (K % 2) ans += (ll)cnt[0];
    }

    cout << ans << endl;
}

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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amin(T& a,T2 b){ if(a > b) a = b;}

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, ans =0;
	cin >>n;

	cout << (n+1)/2 <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include  <stdio.h>
/* Aizu Online Judge Problem 	*/
/* Volume0 0005:GCD and LCM 	*/

int main(void)
{
  int dat1, dat2;
  int gcd, lcm;
  int min, max;
  int m, n;

  while(scanf("%d %d", &dat1, &dat2) != EOF)
  {
    lcm = min = n = (dat1 < dat2) ? dat1 : dat2;
    gcd = max = m = (dat1 > dat2) ? dat1 : dat2;
    //LCM
    while(n != 0)
    {
      lcm = n;
      n = m % n;
      m = lcm;
    }

    //GCD
    while(1)
    {
      if( gcd % min == 0 )
        break;
      gcd += max;
    }

    printf("%d %d\n", lcm, gcd);
  }

  return 0;
}

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

int main()
{
  int N, L;
  cin >> N >> L;
  vector<string> s(N);
  for (int i = 0; i < N; i++)
  {
    cin >> s[i];
  }
  
  sort(s.begin(), s.end());
  for (int i = 0; i < N; i++)
  {
    cout << s[i];
  }
  cout << endl;
}

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[] count = new int[N];
    String str = sc.next();
    int max = 0;
    int count = 0;
    
    for(int i=0; i < str.length(); i++){
        if(str.charAt(i) == 'A' || str.charAt(i) == 'C' || str.charAt(i) == 'G' || str.charAt(i) == 'T'){
            count++;
        }else{
            count = 0;
        }
        if(max < count){
            max = count;
        }
    }
    //if(str[0].equals("H"));
    System.out.println(max);
  }
}

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

int main() {
  int n;
  cin >> n;
  int ans;
  
  if(n/100000>0) ans = 90909;
  else if(n/10000>0) ans = 909 + n - 9999;
  else if(n/1000>0) ans = 909;
  else if(n/100>0) ans = 9 + n - 99;
  else if(n/10>0) ans = 9;
  else ans = n;
  
  cout << ans << endl;
}
    
    

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

int main(){
    int n, Q;
    cin >> n >> Q;
    queue<P> ts;
    rep(i,n){
        string s;
        int x;
        cin >> s >> x;
        ts.push(P(s,x));
    }
    ll ans=0;
    int next=0;
    int q = Q;
    while(ts.size()!=0){
        if(next>0){
            q+=next;
        }else{
            q = Q;
        }
        P pp = ts.front();
        ts.pop();
        if(pp.second-q<=0){
            ans+=pp.second;
            pp.second = 0;
            cout << pp.first << " " << ans << endl;
            next = pp.second - q;
        }else{
            ans+=q;
            pp.second-=q;
            ts.push(pp);
        }
    }
    return 0;
}


Measured memory_bytes: 6352
#include <bits/stdc++.h>
using namespace std;
#define INF_LL 10000000000000000
#define INF 200000000
#define MOD 1000000007
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
// typedef float double;
// typedef priority_queue prique;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
typedef vector<vi> matrix;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll modpow(ll a, ll b, ll m) {
    if(b == 0)
        return 1;
    ll t = modpow(a, b / 2, m);
    if(b & 1) {
        return (t * t % m) * a % m;
    } else {
        return t * t % m;
    }
}
struct edge {
    int to;
    ll cost;
    edge(int t, ll c) { to = t, cost = c; }
};

signed main() {
    int q;
    deque<char> dq;
    string s;
    cin >> s >> q;
    rep(i, s.size()) dq.emplace_back(s[i]);
    int t, f, k = 0;
    string c;
    rep(i, q) {
        cin >> t;
        if(t == 1) {
            k ^= 1;
        } else {
            cin >> f >> c;
            if(k ^ (f - 1)) {
                dq.emplace_back(c[0]);
            } else {
                dq.emplace_front(c[0]);
            }
        }
    }
    if(k) {
        rep(i, dq.size()) cout << dq[dq.size() - i - 1];
    } else {
        rep(i, dq.size()) cout << dq[i];
    }
    cout << endl;
}


Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string A, B; cin >> A >> B;
  if(A.size()>B.size()) cout << "GREATER" << endl;
  else if(A.size()<B.size()) cout << "LESS" << endl;
  else{
    if(A>B) cout << "GREATER" << endl;
    else if(A<B) cout << "LESS" << endl;
    else cout << "EQUAL" << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
s, t = 0, 0
for i in range(0,N-1):
    if H[i] >= H[i+1]:
        t = t+1
    else:
        if s < t:
            s, t = t, 0
        else:
            t = 0
print (max(s,t))

Measured memory_bytes: 14224
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
#include<iomanip>
namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
using lll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
template<typename T>
void swap(T &a, T &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main(){
  ll H,W;
  cin>>H>>W;
  vector<vector<ll>> A(H,vector<ll>(W));
  vector<vector<ll>> B(H,vector<ll>(W));
  FOR(i,H){
    FOR(j,W){
      cin>>A[i][j];      
    }
  }
             
  FOR(i,H){
    FOR(j,W){
      cin>>B[i][j];      
    }
  }
  vector<vector<vector<bool>>> DP(H,vector<vector<bool>>(W,vector<bool>(200*80,false)));
  DP[0][0][abs(A[0][0]-B[0][0])]=true;
  FOR(i,H){
    FOR(j,W){
      ll a=abs(A[i][j]-B[i][j]);
      
      if(j-1>=0){
        FOR(k,200*80){
          if(DP[i][j-1][k]==true){
            DP[i][j][abs(a+k)]=true;
            DP[i][j][abs(a-k)]=true;
          }
        }
      }
      if(i-1<0)continue;
      FOR(k,200*80){
        if(DP[i-1][j][k]==true){
          DP[i][j][abs(a+k)]=true;
          DP[i][j][abs(a-k)]=true;
        }
      }
    }
  }
  ll num=LLONG_MAX;
  FOR(k,200*80){      
    if(DP[H-1][W-1][k]==true){
      num=k;
      break;
    }
  }
  cout<<num<<endl;
  return 0;
}


Measured memory_bytes: 13312
X, N = map(int, input().split())
P = list(map(int, input().split()))

all = set(range(0, 102))
kouho = all - set(P)

min_dis = 200
for i in kouho:
    dis = abs(i-X)
    if min_dis > dis:
        min_i = i
        min_dis = dis

print(min_i)

Measured memory_bytes: 9176
/*感谢MYS大佬和他正经的CSDN....qwq....BY:Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
#include<vector>
#include<queue>
using namespace std;
const int MAXN=(int)1e5;
const int INF=(int)1e9;
int n_pnt,n_edg,cnt;
map<int,int> ID[MAXN+5];
int input[2*MAXN+5][3];
vector<pair<int,int> > lnk[5*MAXN+5];
int dist[5*MAXN+5];
bool vis[5*MAXN+5];
int main()
{
    scanf("%d%d",&n_pnt,&n_edg);
    cnt=n_pnt+1;
    for(int i=0;i<n_edg;i++)
    {
        int u,v,c;scanf("%d%d%d",&u,&v,&c);
        input[i][0]=u;input[i][1]=v;input[i][2]=c;
        if(!ID[u].count(c)) ID[u][c]=cnt++;
        if(!ID[v].count(c)) ID[v][c]=cnt++;
        lnk[ID[u][c]].push_back(make_pair(ID[v][c],0));
        lnk[ID[v][c]].push_back(make_pair(ID[u][c],0));
    }
    for(int i=1;i<=n_pnt;i++)
        for(map<int,int>::iterator it=ID[i].begin();it!=ID[i].end();it++)
        {
            int id=it->second;
            lnk[i].push_back(make_pair(id,1));
            lnk[id].push_back(make_pair(i,1));
        }
    fill(dist,dist+5*MAXN+5,INF);
    dist[1]=0;vis[1]=true;
    queue<int> que;que.push(1);
    while(!que.empty())
    {
        int u=que.front();que.pop();
        for(int i=0;i<lnk[u].size();i++)
        {
            int v=lnk[u][i].first,l=lnk[u][i].second;
            if(dist[v]>dist[u]+l)
            {
                dist[v]=dist[u]+l;
                if(!vis[v])
                    vis[v]=true,que.push(v);
            }
        }
        vis[u]=false;
    }
    if(dist[n_pnt]==INF) printf("%d\n",-1);
    else printf("%d\n",dist[n_pnt]/2);
    return 0;
}


Measured memory_bytes: 58752
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int N = 200200;
ll a[N];
int n;

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

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		a[i] -= i;
	}
	sort(a, a + n);
	ll b = a[n / 2];
	ll ans = 0;
	for (int i = 0; i < n; i++)
		ans += abs(a[i] - b);
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
int n,k;
cin>>n>>k;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];}
sort(arr,arr+n);
int i=0;
int j=k-1;
int diff=1000000000;
while(j<n){
if(arr[j]-arr[i]<diff){
diff=arr[j]-arr[i];}
i++;
j++;}
cout<<diff;
return 0;}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;cin>>n>>m;
  int ans=0;
  for(int i=0;i<m;i++){
  	int a;cin>>a;
    ans+=a;
  }
  if(n-ans>=0){
  	cout<<n-ans<<endl;
  }else{
  	cout<<-1<<endl;
  }
  
}

Measured memory_bytes: 3624
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string S;
    cin >> S;

    if (S == "SSS")
        cout << 0 << endl;
    else if (S == "SSR")
        cout << 1 << endl;
    else if (S == "SRS")
        cout << 1 << endl;
    else if (S == "SRR")
        cout << 2 << endl;
    else if (S == "RSS")
        cout << 1 << endl;
    else if (S == "RSR")
        cout << 1 << endl;
    else if (S == "RRS")
        cout << 2 << endl;
    else if (S == "RRR")
        cout << 3 << endl;

    return 0;
}


Measured memory_bytes: 3228
#include<iostream>

typedef long long ll;

using namespace std;

int main()
{ll R,G,B,N; cin >> R >> G >> B >> N;
 
 ll a = (N+R-1) / R; ll b = (N+G-1) / G ; ll c = (N+B-1) / b;
 
 ll cnt = 0;
 
 for(int i = 0; i <= a; i++){
   for(int j = 0; j <= b; j++){
       if( (N - i*R - j*G >= 0) && (N - i*R - j*G) % B == 0){ cnt++;}}}
 
 cout << cnt << endl;
 
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define fr first
#define sc second
#define pb push_back
const ll mod = 998244353;
const int N = 1e6+205;
ll cnt[N];
void solve(){
	int n,m; 
	cin>>n>>m; 
	for(int i=0;i<m;i++){
		int x,y; 
		cin>>x>>y; 
		cnt[x]++;
		cnt[y+1]--;
	}
	int ans = 0;
	for(int i=1;i<=n;i++){
		cnt[i] = cnt[i-1]+cnt[i];
		if(cnt[i]==m)ans++;
	}
	cout<<ans<<endl;
	
	
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


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

int main()
{
    int n, m, ans;
    cin >> n >> m;
    if (n <= 1 && m <= 1)
    {
        cout << 0 << endl;
        return 0;
    }
    else if (n <= 1)
    {
        ans = m * (m - 1) / 2;
        cout << ans << endl;
        return 0;
    }
    else if (m <= 1)
    {
        ans = n * (n - 1) / 2;
        cout << ans << endl;
        return 0;
    }
    else
    {
        ans = (m * (m - 1) / 2) + (n * (n - 1) / 2);
        cout << ans << endl;
        return 0;
    }
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

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

  int ans=0;
  int mx=0;
  REP(i,n){
    int p;
    cin >> p;
    ans += p;
    chmax(mx,p);
  }
  cout << ans - mx/2 << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
  long int n, a, b;
  
  scanf("%ld %ld %ld", &n, &a, &b);
  if(n % (a + b) <= a){
    printf("%ld\n", n / (a + b) * a + n % (a + b));
  }
  else{
    printf("%ld\n", n / (a + b) * a + a);
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int n,i,j,a,b,f[100010],q[100010],r,t;
  int ta[100010],to[200010],nt[200010],d[2][100010];
  scanf("%d",&n);
  for(i=0;i<=n;i++)ta[i]=-1;
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a,&b);
    to[i]=b;
    nt[i]=ta[a];
    ta[a]=i;
    to[i+n-1]=a;
    nt[i+n-1]=ta[b];
    ta[b]=i+n-1;
  }
  /*for(i=1;i<=n;i++){
    printf("%d:",i);
    for(j=ta[i];j+1;j=nt[j])printf("%d ",to[j]);printf("\n");
    }//*/
  q[t=0]=1;
  for(i=0;i<=n;i++)f[i]=0;
  for(r=f[q[0]]=1;r-t;t++){//printf("%d->",q[t]);
    for(i=ta[q[t]];i+1;i=nt[i]){
      if(f[to[i]])continue;//printf("%d ",to[i]);
      q[r++]=to[i];
      f[to[i]]=1;
    }//printf("\n");
  }//printf("a\n");

  //printf("\n");
  q[0]=q[r-1];//printf("%d\n",q[0]);
  d[0][q[0]]=t=0;
  for(i=0;i<=n;i++)f[i]=0;
  for(r=f[q[0]]=1;r-t;t++){//printf("%d:%d->",d[0][q[t]],q[t]);
    for(i=ta[q[t]];i+1;i=nt[i]){
      if(f[to[i]])continue;
      q[r++]=to[i];
      f[to[i]]=1;
      d[0][to[i]]=d[0][q[t]]+1;//printf("%d %d:",to[i],d[0][to[i]]);
    }//printf("\n");
  }//printf("a\n");

   //printf("\n"); 
  q[0]=q[r-1];
  d[1][q[0]]=t=0;
  for(i=0;i<=n;i++)f[i]=0;
  for(r=f[q[0]]=1;r-t;t++){//printf("%d:%d->",d[1][q[t]],q[t]);
    for(i=ta[q[t]];i+1;i=nt[i]){
      if(f[to[i]])continue;
      q[r++]=to[i];
      f[to[i]]=1;
      d[1][to[i]]=d[1][q[t]]+1;//printf("%d %d:",to[i],d[1][to[i]]);
    }//printf("\n");
  }//printf("\n");
  //for(i=1;i<=n;i++)printf("%d %d %d\n",i,d[0][i],d[1][i]);
  for(i=1;i<=n;i++)printf("%d\n",n*2-2-MAX(d[0][i],d[1][i]));
  return 0;
}

Measured memory_bytes: 4112
#include <bits/stdc++.h>
#define ll long long
#define p pair<int, int>
using namespace std;

struct UnionFind {
    vector<int> par;
    int cnt;
    UnionFind(int n) : par(n, -1), cnt(n) {}
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x != y) {
            if (par[y] < par[x]) swap(x, y);
            par[x] += par[y];
            par[y] = x;
            cnt--;
        }
    }
    int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) { return -par[find(x)]; }
    int size() { return cnt; }
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    set<int> fri[n];
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        fri[a].insert(b);
        fri[b].insert(a);
        uf.unite(a, b);
    }
    for (int i = 0; i < k; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (!uf.same(a, b)) continue;
        fri[a].insert(b);
        fri[b].insert(a);
        uf.unite(a, b);
    }
    for (int i = 0; i < n; i++) {
        cout << uf.size(i) - fri[i].size() - 1 << " \n"[i == n - 1];
    }
    return 0;
}

Measured memory_bytes: 24704
#include <bits/stdc++.h>
using namespace std;
int NMAX=100000;
int dp[100010]; //[]の中は金額 代入されてるのは回数
vector <int> nums={6,9,36,81,216,729,1296,6561,7776,46656,59049};
//min(dp[i],dp[i-power]+1);
int main(){
    int n; cin>>n;
    dp[0]=0;
    for(int i=0;i<=NMAX;i++){
        dp[i]=i;
        for(int j=0;nums[j]<=i;j++){
            dp[i]=min(dp[i],dp[i-nums[j]]+1);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int hA = sc.nextInt();
		int dA = sc.nextInt();
		int hB =sc.nextInt();
		int dB= sc.nextInt();
		while(hA > 0 && hB > 0) {
			hB-=dA;
			if(hB<1) {
				System.out.println("Yes");
			}else {
				hA-=dB;
				if(hA<1) {
					System.out.println("No");
				}
			}
		}
	}

}


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

using namespace std;

int main(){
  int N; cin >> N;
  vector<vector<int>> F(N,vector<int>(10,0));
  vector<vector<int>> P(N,vector<int>(11,0));
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 10; j++){ cin >> F[i][j];}}
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 11; j++){ cin >> P[i][j];}}
  
  int max_sum = -1e9;
  
  for(int i = 1; i < (1 << 10); i++){
   vector<int> joisino(10,0);
    for(int j = 0; j < 10; j++){
      if( i >> j & 1){ joisino[j] = 1;}
      else{ joisino[j] = 0;}}
    
    int sum = 0;
    
    for(int i = 0; i < N; i++){
      int cnt = 0;
      for(int j = 0; j < 10; j++){
        if( F[i][j] == 1 && joisino[j] == 1){ cnt++;}}
      sum += P[i][cnt];}
    
    max_sum = max(max_sum,sum);}
  
  cout << max_sum << endl; return 0;}
      
          

Measured memory_bytes: 256
n = int(input().strip())
a = list(map(int, input().split()))
a.sort()
counts = []
now = a[0]
count = 0
for e in a:
    if e == now:
        count += 1
    else:
        counts.append([now, count])
        now = e
        count = 1
counts.append([now, count])

if len(counts) == 1:
    print(counts[0][1])
elif len(counts) == 2:
    if (counts[0][0] + 1) == counts[1][0]:
        print(counts[0][1] + counts[1][1])
    else:
        print(counts[0][1])
else:
    ans = counts[0][1]
    for i in range(len(counts) - 2):
        rep = counts[i + 1][1]
        if (counts[i][0] + 1) == counts[i + 1][0]:
            rep += counts[i][1]
        if (counts[i + 1][0] + 1) == counts[i + 2][0]:
            rep += counts[i + 2][1]
        ans = max(rep, ans)
    print(ans)


Measured memory_bytes: 59244
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;


int main() {
    
    
    vector<int> v = {111, 222, 333, 444, 555, 666, 777, 888, 999};
    int n;
    cin >> n;
    for (int i = 0; i < v.size(); ++i)
    {
        if (v[i] - n >= 0)
        {
            cout << v[i] << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O3")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 
template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

lli tmod(lli x,lli m){return (x%m+m)%m;}//USE AT YOUR OWN RISK
lli power(lli x, lli y) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;  
    }
    if(res<0)
       res+=mod; 
    return res; 
}

int main() 
{ 
    fastio;
    int n;
    cin>>n;
    set <int> x;
    f(i,0,n){
        int p;cin>>p;
        x.insert(p);
    }
    if(x.size()==n)cout<<"YES\n";
    else cout<<"NO\n";
    return 0; 	
}


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

int main(){
    string S;
    cin >> S;
    int s=S.size();
    vector<char> vec(s);
    for(int i=0;i<s;i++){
        vec[i]=S[i];
    }
    bool flag=1;
    for(int j=1;j<s/2;j++){
    for(int i=0;i<s/2-j;i++){
        if(vec[i]!=vec[s/2-j+i])
        flag=0;
    }
    if(flag){
        cout << s-2*j << endl;
        return 0;
    }
    else{
        flag=1;
    }
    }
}

Measured memory_bytes: 256
#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))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>x>>y;
	i=1;
	while(x--) i*=100;
	int ret=0;
	while(y--) {
		ret+=i;
		if(ret%(i*100)==0) ret+=i;
	}
	
	
	cout<<ret<<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