akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main(){
	int n, min, r, mar = 0;
	cin >> n >> min;
	for (int i = 1; i < n; i++){
		cin >> r;
		if (r - min > mar || i == 1) mar = r - min;
		if (min > r) min = r;
		
	}
	cout << mar << endl;
}

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

const int MAXN = 1.1e5;
int N;
pair<int, int> A[MAXN];
pair<int, int> B[MAXN];

int perm[MAXN];

bool go() {
	sort(A, A + N);
	sort(B, B + N);
	for (int i = 0; i < N; i++) {
		if (A[i].first > B[i].first) return false;
	}
	for (int i = 0; i+1 < N; i++) {
		if (A[i+1].first <= B[i].first) return true;
	}

	for (int i = 0; i < N; i++) {
		perm[A[i].second] = B[i].second;
	}

	for (int i = 0, cur = 0; i < N; i++) {
		if (perm[cur] == -1) return true;
		int nxt = perm[cur];
		perm[cur] = -1;
		cur = nxt;
	}
	return false;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i].first; A[i].second = i;
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i].first; B[i].second = i;
	}
	cout << (go() ? "Yes" : "No") << '\n';

	return 0;
}


Measured memory_bytes: 2176
#include<cstdio>
#include<cstring>
#define min(a,b) ((a)<(b)? (a):(b))
#define max(a,b) ((a)>(b)? (a):(b))
typedef long long ll;
ll inf=0;
int a[3005][3005];
ll f[3005][3005][4];
inline int read() {
    register int x=0,f=1;register char s=getchar();
    while(s>'9'||s<'0') {if(s=='-') f=-1;s=getchar();}
    while(s>='0'&&s<='9') {x=x*10+s-'0';s=getchar();}
    return x*f;
}
int main() {
    int n=read(),m=read(),k=read();
    for(register int i=1;i<=k;++i) {
        int x=read(),y=read(),z=read();
        a[x][y]=z;	
	}
	memset(&inf,-0x3f,sizeof(inf));
	memset(f,-0x3f,sizeof(f));
	f[1][1][0]=0;f[1][1][1]=a[1][1];
	//for(register int i=1;i<=n;++i) for(register int x=0;x<=3;++x) f[i][0][x]=0;
	//for(register int i=1;i<=m;++i) for(register int x=0;x<=3;++x) f[0][i][x]=0;
    for(register int i=1;i<=n;++i) {
        for(register int j=1;j<=m;++j) {
            if(i==1&&j==1) continue;
            f[i][j][0]=f[i][j-1][0];
            for(register int x=0;x<=min(j,3);++x) f[i][j][0]=max(f[i][j][0],f[i-1][j][x]);
            for(register int x=0;x<=min(j,3);++x) f[i][j][1]=max(f[i][j][1],f[i-1][j][x]+(a[i][j]==0? inf:a[i][j]));
            for(register int x=1;x<=min(j,3);++x) {
                f[i][j][x]=max(f[i][j][x],max(f[i][j-1][x],f[i][j-1][x-1]+(a[i][j]==0? inf:a[i][j])));
            }
        }
    }
    printf("%lld\n",max(max(f[n][m][2],f[n][m][3]),max(f[n][m][0],f[n][m][1])));
    return 0;
}

Measured memory_bytes: 319000
#include<bits/stdc++.h>
using namespace std;
int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   int n; cin >> n;
   vector<int> r, l;
   int count = 0;
   for(int i = 0;i < n;i++) {
       int x, y;
       cin >> x >> y;
       count+=abs(x-y)+1;
   }
   cout << count << endl;
}

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

using ll = long long;

const int mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<pair<int, int>> red(N), blue(N);
    for (int i = 0; i < N; ++i) cin >> red[i].second >> red[i].first;
    for (int i = 0; i < N; ++i) cin >> blue[i].first >> blue[i].second;
    sort(red.begin(), red.end());
    sort(blue.begin(), blue.end());
    vector<bool> used_red(N, false);
    int ans = 0;
    for (auto bp : blue) {
        int bx = bp.first;
        int by = bp.second;
        for (int i = N - 1; i >= 0; --i) {
            if (used_red[i]) continue;
            int rx = red[i].second;
            int ry = red[i].first;
            if (rx < bx && ry < by) {
                ++ans;
                used_red[i] = true;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Integer> mountains = new ArrayList<Integer>();
		int i = 0;
		while(true){
			String s = r.readLine();
			mountains.add(Integer.valueOf(s));
			if(++i == 10) break;
		}
		Collections.sort(mountains);
		Collections.reverse(mountains);
		i = 0;
		for(int m : mountains) {
			System.out.println(m);
			if(++i >= 3) break;
		}
	}
}

Measured memory_bytes: 9348
import java.util.Scanner;


public class Main{
    public static void main(String srgs[]){
        Scanner sc = new Scanner(System.in);
        
        int i,j,k;
        while(true){
            int a = sc.nextInt();
        int b = sc.nextInt();
            if(a==0 && b==0){
                break;
            }

        for(i = 0;i<b;i++){
            System.out.printf("#");
        }for(j=1;j<a-1;j++){
            System.out.printf("\n");
            System.out.printf("#");
            for(k=1;k<b-1;k++){
                System.out.printf(".");
            }
            System.out.printf("#");
        }
        System.out.printf("\n");
        for(i = 0;i<b;i++){
            
            System.out.printf("#");
        }
        System.out.printf("\n");
        System.out.printf("\n");
        }
        
        sc.close();
    }
}


Measured memory_bytes: 60280
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
 ll x;
 cin >> x;
 
 rep(a,-1000,1000){
   rep(b,-1000,1000){
   
     if(a*a*a*a*a-b*b*b*b*b==x) {
       cout << a << " " << b << endl;
       return;
     }
   }
 }
  
  
  
}

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

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

    
    public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        
        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        
        if(val1 < val2){
            System.out.println("a < b");
        }else if(val1 > val2){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }

    }
    
}


Measured memory_bytes: 26172
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


n = int(input())
li = make_divisors(n)
li = [(x, n // x) for x in li]

ans = 1 << 60
for x, y in li:
    ans = min(ans, max(len(str(x)), len(str(y))))

print(ans)

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

using namespace std;

int main() {
	string a, b;
	cin >> a >> b;
	bool flag = false;
	int n = stoi(a + b);

	for (int i = 1; i <= 1000; i++)
	{
		if (n == i * i) flag = true;
	}
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n: u32,
        v: [u32; n],
    }
    println!(
        "{}",
        v
            .iter()
            .map(|x| x.trailing_zeros())
            .min()
            .unwrap()
    );
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=998244353;
ll dp[3001][3001];
int main ()
{
    ll n,sum;
    cin>>n>>sum;
    vector<int> v(n);
    for(int i=0;i<n;i++)
    cin>>v[i];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=0;j<=sum;j++)
        {
            dp[i][j]=(2*dp[i-1][j])%M;
            if(j-v[i-1]>=0)
            {
                dp[i][j]=(dp[i][j]+dp[i-1][j-v[i-1]])%M;
            }
        }
    }
    cout<<dp[n][sum];
    return 0;
}

Measured memory_bytes: 73968
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] line = br.readLine().split(" ");
		int x = Integer.parseInt(line[0]);
		int y = Integer.parseInt(line[1]);
		int r;

		while( (r = x % y) != 0 ) {
			x = y;
			y = r;
		}

		System.out.println(y);
	}
}

Measured memory_bytes: 24352
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <cstring>
#include <cmath>

using namespace std;
const long double eps = 1e-12;

typedef long long ll;
typedef pair<int , int> pt;

#define sz(a) ((int) a.size() )
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)
#define For(i , a , b) for (int i = a ; i <= b ; i++)
#define Ford(i , a , b) for (int i = a ; i >= b ; i--)
#define Rep(i , n) for (int i = 0 ; i < n ; i++)

const int maxn = 5004;
int n , m;
int cheo[maxn * 2][maxn] , doc[maxn][maxn];
int b[maxn][maxn];
int a[maxn][maxn];

void ReadData() {
    cin >> n >> m;
    while (m--) {
         int a , b , x; cin >> a >> b >> x;
         doc[b ][a]++;
         doc[b ][min(n + 1 , a + x + 1 )]--;
         cheo[a - b - 1 + n ][a]--;
         cheo[a - b - 1 + n ][min(n + 1 , a + x + 1)]++;
    }

    For(j , 0 , n) {
        int sum = 0;
        For(i , 1 , n) {
            sum += doc[j][i];
            b[i][j] += sum;
        }
    }

    For(i , 1 , n) {
        For(j , 1 , n) {
            cheo[i - j + n][i] += cheo[i - j + n ][i - 1];
            b[i][j] += cheo[i - j + n ][i];
        }
    }


    int res = 0;
    For(i , 1 , n) {
         For(j , 1 , n) {
             b[i][j] += b[i][j - 1]; if (b[i][j]) res++;
         }
    }
    cout << res << endl;
}

void Process() {

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   // freopen("/users/youaremysky/documents/workspace/input.inp" , "r" , stdin);
    ReadData();
    Process();
}

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

pair<int,int> solve(int x){
    int f=x%10;
    int s;
    while(x){
        s=x%10;
        x/=10;
    }
    return {s,f};
}

int main(){
    int N; cin >> N;
    map<pair<int,int>,int> ma;
    for(int i=1;i<=N;i++){
        pair<int,int> tmp=solve(i);
        ma[{tmp.first,tmp.second}]++;
    }
    int ans=0;
    for(int i=0;i<=9;i++){
        for(int j=0;j<=9;j++){
            ans+=ma[{i,j}]*ma[{j,i}];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

def solve():
    N, M = map(int, input().split())
    st = [[int(i) for i in input().split()] for j in range(N)]
    cp = [[int(i) for i in input().split()] for j in range(M)]

    for a, b in st:
        ans = 0
        min_len = 10**9

        for i, (c, d) in enumerate(cp):
            tmp = abs(c - a) + abs(d - b)
            if tmp < min_len:
                min_len = tmp
                ans = i + 1

        print(ans)


def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()

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

int main() {
  int n, sm = 0, m = INT_MAX;
  cin >> n;
  vector<int> s(n);
  for(int i = 0; i < n; i++) {
    cin >> s.at(i);
    sm += s.at(i);
    if(s.at(i) % 10)
      m = min(m, s.at(i));
  }
  if(sm % 10)
    cout << sm << endl;
  else {
    if(m == INT_MAX)
      cout << 0 << endl;
    else
      cout << sm - m << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define IOS ios::sync_with_stdio(0); cin.tie(0), cout.tie(0)
 
 
#define ll long long int
#define ld long double
 
#define fr first
#define se second
 
 
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(v) (int)v.size()
#define sunq(v) sort(all(v));v.resize(distance(v.begin(),unique(all(v))))
 
 
#define pb push_back
#define mp make_pair
 
 
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define emla(a, val) memset(a, val, sizeof(a))
#define easm(a, b) (a + b - 1) /b 
 
#define PI 3.141592653589793238
 
 
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
 
 
//bool valid(int i, int j){return i >= 0 && i < n && j >= 0 && j < m;}
 
int n, m;
ll ans, off;

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  //clock_t z = clock();
  cin >> n >> m;
  while(n--){
    int x;
    cin >> x;
    if(x > ans){
      off += 1ll * x - ans;
    }
    ans = 1ll * x + m;
  }
  cout << ans-off << endl;
  //debug("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
  /*
  *try tricky test cases:
    -bounds
    -small input (0, 1)
    -big input
    -random tests
  */
  return 0;
}

Measured memory_bytes: 256
num = list(map(int,input().split()))
 
circle_px = num[2] + num[4]
circle_mx = num[2] - num[4]

circle_py = num[3] + num[4]
circle_my = num[3] - num[4]

if(circle_px <= num[0] and circle_mx >= 0 and circle_py <= num[1] and circle_py >= 0): print("Yes")
else: print("No")


Measured memory_bytes: 5596
X = list(map(int,input().split()))
X.sort()
ans = 0
a = X[2] - X[1]
ans += a
ans += (X[2] - (X[0] + a)) // 2
#print(ans)
if (X[2] - (X[0] + a)) % 2 == 1:
    ans += 2
print(ans)

Measured memory_bytes: 3060
n = int(input())
A = list(map(lambda x: int(x)-1, input().split()))
ans = 0
now = 0
for i in range(n):
    if A[i] != now:
        ans += 1
    else:
        now += 1

if ans == len(A):
    print(-1)
else:
    print(ans)


Measured memory_bytes: 75980
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	var res int64
	for i := 1; i <= N; i++ {
		if i%3 == 0 || i%5 == 0 {
			continue
		}
		res = res + int64(i)
	}
	fmt.Println(res)

}


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


def main():
    X, A, B = map(int, input().split())
    if B - A > X:
        print('dangerous')
    elif 0 < B - A <= X:
        print('safe')
    else:
        print('delicious')


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
private class B {
    fun solve() {
        val n = nextInt()
        val l = IntArray(n) { nextInt() }
        var ans = 0
        for (i in 0 until n) {
            for (j in i + 1 until n) {
                for (k in j + 1 until n) {
                    if (l[i] == l[j] || l[i] == l[k] || l[j] == l[k]) {
                        continue
                    }
                    if (l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i]) {
                        ans++
                    }
                }
            }
        }
        println(ans)
    }

    var tokenBuffer = listOf<String>()
    var bufferPosition = 0

    private fun checkBuffer() {
        if (bufferPosition == tokenBuffer.size) {
            tokenBuffer = nextLine().split(" ")
            bufferPosition = 0
        }
    }

    fun nextLine() = readLine()!!
    fun nextInt(): Int {
        checkBuffer()
        return tokenBuffer[bufferPosition++].toInt()
    }

    fun nextLong(): Long {
        checkBuffer()
        return tokenBuffer[bufferPosition++].toLong()
    }

    fun nextDouble(): Double {
        checkBuffer()
        return tokenBuffer[bufferPosition++].toDouble()
    }

    fun nextToken(): String {
        checkBuffer()
        return tokenBuffer[bufferPosition++]
    }
}

fun main() {
    val reader = B().solve()

}


Measured memory_bytes: 38060
#include <cstdio>
#include <cmath>
#include <limits>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdint>
#include <functional>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;

const ll mod = 1000000000 + 7; //10^9


// bool is_integer(double x){
//     return floor(x) == x;
// }

// vector<int> bitsearch(int n, int bit) {
//     for (int i = 0; i < n; i++)
//     {
//         vector<int> S(n);
//         if(bit & (1 << i)){
//             S.push_back(i);
//         }
//     }
// }./  

int main() {
    int A, B;
    cin >> A >> B;
    int tap = 1;
    int ans = 0;
    while(B > tap){
        ans++;
        tap--;
        tap += A;
        
    }
    cout << ans<< endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<int, pii> viii; 
typedef vector<pll> vll; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef vector<vector<vl>> vvvl; 

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL);
    int d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

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

    vector<pair<int, int>> P;
    rep(i,n) {
        int x, y;
        cin >> x >> y;
        P.push_back(make_pair(x,y));
    }
    sort(P.begin(), P.end());

    double d = 0;
    int cnt = 0;
    do {
        ++cnt;

        rep(i,P.size()-1) {
            int xi = P[i].first;
            int yi = P[i].second;
            int xj = P[i+1].first;
            int yj = P[i+1].second;
            d += sqrt((xi-xj)*(xi-xj) + (yi-yj)*(yi-yj));
        }        

    } while (next_permutation(P.begin(), P.end()));

    d /= cnt;
    printf("%.8f\n", d);
    return 0;
}


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

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<int> a(n), b(n);
	for(int i = 0; i < n; ++i){ cin >> a[i] >> b[i]; }
	ll answer = 0;
	for(int i = 0; i < n; ++i){
		if((k | a[i]) == k){ answer += b[i]; }
	}
	for(int i = 0; (1 << i) <= k; ++i){
		const int bit = (1 << i);
		if(!(k & bit)){ continue; }
		const int mask = (k & ~bit) | (bit - 1);
		ll sum = 0;
		for(int j = 0; j < n; ++j){
			if((mask | a[j]) == mask){ sum += b[j]; }
		}
		answer = max(answer, sum);
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 1024
def main():
    n = int(input())
    s = input()

    if n % 2 == 0:
        t1 = s[:n // 2]
        t2 = s[n // 2:]
        if t1 == t2:
            print('Yes')
        else:
            print('No')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <iostream>
using namespace std;
int n,table[2][100],gyou,retu,sum,saidai;
int main(){
	cin >> n;
	for(int i=0;i<2;i++) for(int j=0;j<n;j++) cin >> table[i][j];
	for(int i=0;i<n;i++){
		sum=0;gyou=0;retu=0;
		while(retu!=n-1){
			if(retu==i){
				sum+=table[gyou][retu];
				gyou++;
				sum+=table[gyou][retu];
				retu++;
				continue;
			}
			sum+=table[gyou][retu];
			retu++;
		}
		if(saidai<=sum) saidai=sum;
	}
	if(n==1) saidai+=table[0][0];
	cout << saidai+table[1][n-1] << endl;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
L = [str(input()) for _ in range(N)]
c = Counter(L)
ans = []
for i, x in enumerate(c.most_common()):
  if i>0 and x[1]!=m:
    break
  ans.append(x[0])
  m = x[1]
for x in sorted(ans):
  print(x)

Measured memory_bytes: 45036
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=1012345678;
int main(){
	vector<int>a(5),p(5);
	cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
	for(int i=0;i<5;i++)p[i]=i;
	int final_answer=maxn;
	do{
		int ans=0;
		for(int i=0;i<5;++i){
			while(ans%10!=0) ans+=1;
			ans+=a[p[i]];
		}
		final_answer=min(final_answer,ans);
	}while(next_permutation(p.begin(),p.end()));
	cout<<final_answer<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 105000;

string s, t;
int cntS[MAXN], cntT[MAXN];

int main() { 

  getline(cin, s);
  getline(cin, t);

  for (int i = 0; i < sz(s); i++) {
    if (s[i] == 'A') {
      cntS[i]++;
    }
    if (i > 0) {
      cntS[i] += cntS[i - 1];
    }
  }

  for (int i = 0; i < sz(t); i++) {
    if (t[i] == 'A') {
      cntT[i]++;
    }
    if (i > 0) {
      cntT[i] += cntT[i - 1];
    }
  }

  int qn;
  scanf("%d", &qn);
  while (qn--) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    a--; b--; c--; d--;

    int sc = cntS[b];
    if (a > 0) {
      sc -= cntS[a - 1];
    }
    sc = (b - a + 1 - sc) + sc * 2;

    int tc = cntT[d];
    if (c > 0) {
      tc -= cntT[c - 1];
    }
    tc = (d - c + 1 - tc) + tc * 2;

    if (abs(tc - sc) % 3 == 0) {
      puts("YES");
    } else {
      puts("NO");
    }
  }


  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  string s;
  cin >> s;
  int n = s.size();

  int ans = 1;
  bool flg = false;
  rep(i, 1, n) {
    ans++;
    if (!flg && s[i] == s[i - 1]) {
      i++;
      flg = true;
      if (i == n)
        ans--;
    } else {
      flg = false;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3728
t[9999][9999],j;main(p,W,a,b,c){
for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){
		for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){
			for(j=0;j<=W;j++){
				t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b);
			}
		}
		for(j=0;t[0][j]!=t[0][W];j++);
	}
} 

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define ind(a) scanf("%lf", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a));
//your code here!

//優先度付きキュー　　最大値を求める場合
#define MAX_HEAP 100005
ll a[MAX_HEAP];
ll g_idx = -1;

ll PQ_pop(void){//最大値を取り出す
    ll i, j, ret = a[0];
    if(g_idx<0) exit(1);
    a[0] = a[g_idx--];
    i = 0;
    while(i*2+1<=g_idx){
        j = i*2+1;
        if(j+1<=g_idx && a[j]<a[j+1]){//min ならここを変更
            j++;
        }
        if(a[i] >= a[j]){//min ならここを変更
            break;
        }
        swap(a[i],a[j]);
        i = j;
    }
    return ret;
}

void PQ_push(ll elem){//ヒープに要素elemを追加する
    if(g_idx >= MAX_HEAP-1){
        exit(1);
    }
    a[++g_idx] = elem;
    ll x = g_idx;
    while(x>0 && a[(x-1)/2]<a[x]){//min ならここを変更
        swap(a[(x-1)/2], a[x]);
        x = (x-1)/2;
    }
}

int main(void){
    ll N, M, A, ans=0;
    in(N); in(M);
    rep(i,N){
        in(A);
        PQ_push(A);
    }
    rep(_,M){
        A = PQ_pop();
        PQ_push(A/2);
    }
    rep(i,N) ans += a[i];
    put(ans);
    return 0;
}

Measured memory_bytes: 896
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    a: i32,
    b: i32,
  }
  for _ in 0 .. cmp::max(a, b) {
    puts!("{}", cmp::min(a, b));
  }
  puts!("\n");
}


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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr int INF = 1001001001;
//constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;

struct UnionFind {
    vector<int> par, rank;
    int count_comp;

    UnionFind(int n) : par(n , -1), rank(n, 0),count_comp(n) { }

    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]);
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        count_comp--;
        return true;
    }
};

int main() {
    ll N, M, Q; cin >> N >> M >> Q;
    int a, b, c;
    vector<pii> sing, dob;
    rep(i, Q) {
        cin >> a >> b >> c;
        if (c == 0) sing.pb(mp(a, b));
        else dob.pb(mp(a, b));
    }

    if (M == N - 1) {
        cout << (dob.empty() ? "Yes" : "No" ) << endl;
        return 0;
    }

    UnionFind uf(N);
    bool can = true;

    for (auto funi : sing) {
        a = funi.F, b = funi.S;
        /*if (uf.same(a, b)) {
            can = false;
            break;
        }
        else */
        uf.unite(a, b);
    }

    for (auto funi : dob) {
        a = funi.F, b = funi.S;
        if (uf.same(a, b)) {
            can = false;
            break;
        }
    }

    ll num = uf.count_comp;
    if (M > N - num + num * (num - 1) / 2 ) can = false;

    cout << (can ? "Yes" : "No") << endl;

}


Measured memory_bytes: 2036
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main(void) {
    int n;
    int x[1000] = {};
    int y[1000] = {};
    double a;
    
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    for(int i = 0; i < n; ++i) {
        cin >> y[i];
    }
    
    for(int i = 1; i <= 3; ++i) {
        a = 0;
        for(int j = 0; j < n; ++j) {
            a += pow(abs(x[j] - y[j]), i);
        }
        a = pow(a, (double)1 / i);
        printf("%lf\n", a);
    }
    a = 0;
    for(int i = 0; i < n; ++i) {
        if(a < abs(x[i] - y[i])) {
            a =  abs(x[i] - y[i]);
        }
    }
    printf("%lf\n", a);
    
    return 0;
    
}



Measured memory_bytes: 3348
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define MAX 200005
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
const int N = 3e5 + 5;
#define MOD 1000000007
#define mod1 998244353
 
int n;
int a[N];
int cache[N];
vector<int> graph[N];

int handle(int x)
{
    return (x%MOD + MOD)%MOD;
}

void GO()
{
    cin>>n;
    string s = "";
    for (int i = 0; i < n; ++i)
    {
        /* code */s+="ACL";
    }cout<<s<<endl;
}

int32_t main()
{
    FAST
    #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
    #endif
    int tc;
    tc = 1;
    // cin>>tc;
    while(tc--) GO(); // let's solve this case :)
    return 0;
}

Measured memory_bytes: 10644
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef pair<int,int> P;

int main(){
  int N;
  cin>>N;
  vector<P> R(N),B(N);
  vector<bool> use(2*N);

  for(int i=0;i<N;i++)
    cin>>R[i].second>>R[i].first;
  for(int i=0;i<N;i++)
    cin>>B[i].first>>B[i].second;

  sort(R.begin(),R.end(),greater<P>());
  sort(B.begin(),B.end());

  int ans = 0;

  int pb = 0;
  while(pb < N){
   int pr = 0;
    while(B[pb].second < R[pr].first && pr < N)
      pr++;
    for(int i=pr;i<N;i++){
      if(R[i].second < B[pb].first && !use[i]){
        ans++;
        use[i] = true;
        break;
      }
    }
    pb++;
  }

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


Measured memory_bytes: 256
#include<iostream> 
using namespace std;
int main(){
	int n;
	bool flag=0;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]%2==0){
			if(a[i]%3!=0 && a[i]%5!=0)
			flag=1;
		}

	}	
	if(flag==1)
	cout<<"DENIED"<<endl;
	else
	cout<<"APPROVED"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

a= l()
a.sort()


aa = s(a)

if len(aa) % 2 == 0:
    print(len(aa) - 1)
else:
    print(len(aa))

Measured memory_bytes: 17572
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N1 = sc.nextInt();
        int N2 = sc.nextInt();
        int N3 = sc.nextInt();
        if(N1+N2+N3 >= 22){
            System.out.println("bust");
        }else{
            System.out.println("win");
        }
    }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define first fst
#define second scd

#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long


signed main(){
  int n;
  cin>>n;
  int a[100001];
  rep(i,n) cin>>a[i];
  int ans=0;
  int prev=0;
  rep(i,n){
    ans+=abs(prev-a[i]);
    prev=a[i];
  }
  ans+=abs(a[n-1]);
  a[n]=0;
  prev=0;
  rep(i,n){
    if(prev<a[i] && a[i]>a[i+1]) cout<<ans-(min(a[i]-prev,a[i]-a[i+1]))*2<<endl;
    else if(prev>a[i] && a[i]<a[i+1]) cout<<ans-(min(prev-a[i],a[i+1]-a[i]))*2<<endl;
    else cout<<ans<<endl;
    prev=a[i];
  }

  return 0;
}








Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

ll width[51];
ll paty[51];

ll solve(ll n,ll x) {
    if(n == 0) return x;
    if(x <= 1) return 0;
    if(x >= width[n]) return paty[n];
    ll w = width[n];
    if(x <= w/2) return solve(n-1,x-1);
    return paty[n-1]+1+solve(n-1,x-w/2-1);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    width[0] = 1;
    rep(i,50) width[i+1] = width[i]*2+3;
    paty[0] = 1;
    rep(i,50) paty[i+1] = paty[i]*2+1;
    ll n,x;
    cin >> n >> x;
    cout << solve(n,x) << endl;
}

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

int N, M;
vector<vector<int>> G;
vector<int> color;
pair<int, int> bw;
bool ok;

void dfs(int s, int c){
    if(!ok) return;

    if(color[s] != 0){
        if(color[s] != c) ok = false;
        return;
    }

    color[s] = c;
    if(c == 1) bw.first++;
    else bw.second++;

    for(auto t : G[s]){
        dfs(t, -c);
    }
}

int main(){
    cin >> N >> M;
    G.resize(N);
    color.resize(N, 0);

    vector<vector<bool>> D(N, vector<bool>(N, false));
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        D[a][b] = true;
        D[b][a] = true;
    }

    for(int i=0; i<N; i++)
        for(int j=i+1; j<N; j++)
            if(!D[i][j]){
                G[i].push_back(j);
                G[j].push_back(i);
            }

    vector<pair<int, int>> v;
    for(int i=0; i<N; i++){
        if(color[i] != 0) continue;
        bw = make_pair(0, 0);
        ok = true;
        dfs(i, 1);
        if(!ok){
            cout << -1 << endl;
            return 0;
        }
        v.push_back(bw);
    }

    int T = v.size();
    vector<vector<bool>> dp(T+1, vector<bool>(N));
    dp[0][0] = true;
    for(int i=1; i<=T; i++){
        int b = v[i-1].first;
        int w = v[i-1].second;
        for(int j=0; j<N; j++){
            if(dp[i-1][j]){
                dp[i][j+b] = true;
                dp[i][j+w] = true;
            }
        }
    }
    int ans = N*N;
    for(int i=0; i<N; i++){
        if(dp[T][i]){
            int B = i;
            int W = N - i;
            ans = min(ans, B*(B-1)/2+W*(W-1)/2);
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

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

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

int pow(const int base, int m) {
    int res = 1;
    while (m > 0) {
        res *= base;
        m--;
    }
    return res;
}

int main(void) {
    int M, K;
    cin >> M >> K;

    if (K >= pow(2, M)) {
        cout << "-1" << endl;
        return 0;
    } else if (M == 0) {
        if (K == 0) {
            cout << "0 0" << endl;
        } else {
            cout << "-1" << endl;
        }
        return 0;
    } else if (M == 1) {
        if (K == 0) {
            cout << "0 0 1 1" << endl;
        } else {
            cout << "-1" << endl;
        }
        return 0;
    }

    vector<int> ans(pow(2, M + 1), 0);
    ans[0] = K;
    ans[pow(2, M)] = K;
    
    // do something

    int v = 0;
    for (int i = 1; i < pow(2, M); i++) {
        if (v == K) v++;
        ans[i] = v;
        ans[((int) ans.size()) - i] = v;
        v++;
    }

    cout << ans[0];
    for (int i = 1; i < (int) ans.size(); i++) {
        cout << " " << ans[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 2816
N,x = map(int,input().split())
a = list(map(int,input().split()))
count = 0
for i in range(N-1):
    if a[i]+a[i+1] >= x:
        tmp = (a[i]+a[i+1]-x)
        a[i+1] -= tmp
        a[i+1] = max(0,a[i+1])
        count += tmp
print(count)

Measured memory_bytes: 14540
#include<iostream>

using namespace std;

int main(void)

{
    int x, y;
    cin>>x>>y;
    if(x == 1 ||x == 3 ||x == 5 ||x == 7 ||x == 8 ||x == 10 ||x == 12 ){
        if(y == 1 ||y == 3 ||y == 5 ||y == 7 ||y == 8 ||y == 10 ||y == 12 )
            cout<<"Yes\n";
        else cout<<"No\n";
    }
    else if(x == 4 ||x == 6 ||x == 9 ||x == 11){
        if((y == 4 ||y == 6 ||y == 9 ||y == 11))
            cout<<"Yes\n";
        else cout<<"No\n";

    }
    else if(x == 2 && y ==2){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
    for(int i = 0; i < 1000000; i++){
        for(int j = 0; j < 100000; j++){

        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int fib(int n);

int main() {
    int n;
    int dp[45];

    //?????????
    /* ??????3-1 */
    dp[0] = 1;
    /* ??????3-2 */
    dp[1] = 1;

    //??\???
    cin >> n;

    //DP
    for (int i = 2; i <= n; i++) {
        /* ??????3-3 */
        dp[i] = dp[i-1] + dp[i-2];
    }

    //??????
    cout << dp[n] << endl;

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	int sm = 0,mp = 0;
	for(int i = 0;i<n;i++)
	{
		int p;
		cin >> p;
		sm += p;
		mp = max(mp,p);
	}
	mp /= 2;
	cout << sm - mp << endl;
	return 0;
}


Measured memory_bytes: 256
/*#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
#define ret return puts("-1"),0;
#define N 500055
//#define int ll
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
int n,m,x,y,a[N],f[N][2],vis[N];
char str[N];
int nedge,head[N*2],to[N*2],Next[N*2];
#define V to[i]
void add(int a,int b){
   Next[++nedge]=head[a];head[a]=nedge;to[nedge]=b;
}
void dfs(int x){
	vis[x]=0;
	go(i,x){
		f[V][a[x]]--;
		if (f[V][a[x]]==0&&vis[V]) dfs(V);
	}
}
signed main(){
	n=read();m=read();
	scanf("%s",str+1);
	F(i,1,n) a[i]=str[i]-'A',vis[i]=1;
	F(i,1,m){
		x=read();y=read();add(x,y);add(y,x);
		f[x][a[y]]++;f[y][a[x]]++;
	}
	F(i,1,n){
		if (vis[i]&&(f[i][0]==0||f[i][1]==0)) dfs(i);
	} 
	int pd=0;
	F(i,1,n) pd|=vis[i];
	if (pd) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 21248
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
typedef set<ll> Set;
const ll MOD=inf;

const ll max_N=100005;
ll n,k;
vector<ll> g[max_N];
ll ans=1;

bool visit[max_N];

void dfs(ll a){//頂点持って遷移
    visit[a]=1;
    ll conti=1;
    if(a!=0) conti++;
    for(auto b: g[a]){
        if(visit[b]) continue;
        else{
            ans*=k-conti;
            ans%=MOD;
            dfs(b);
            conti++;
        }
    }
}


int main(){
    cin >> n >> k;
    rep(i,n-1){
        ll a,b;
        cin >> a >> b;
        a--;b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    rep(i,n) {
        visit[i]=0;
    }
    ans*=k;
    dfs(0);
    kaku(ans);
}




Measured memory_bytes: 9344
s = list(input())
N = len(s)
ans = float("INF")
for c in set(s):
  i, cnt = 0, 0
  s1 = s
  while len(set(s1)) != 1:
    ns = []
    for i in range(len(s1)-1):
      if s1[i] == c or s1[i+1] == c:
        ns.append(c)
      else:
        ns.append(s1[i])
    s1 = ns
    cnt += 1
  ans = min(ans, cnt)
print(ans)  

Measured memory_bytes: 3064
N = int(input())
Ali = list(map(int,input().split()))
Q = int(input())
s = 0

alin = [0]*100001#各数字の個数
for i in range(N):
  alin[Ali[i]] += 1
  s += Ali[i]
  
for i in range(Q):
  B,C = map(int,input().split())
  alin[C] += alin[B]
  s += (C-B)*alin[B]
  alin[B] = 0
  print(s)

Measured memory_bytes: 84260
// dream, dreamer, erase, eraser
fun main(args: Array<String>) {
    val value = readLine() ?: return
    val reversedValue = value.reversed()
    var current = reversedValue
    while (true) {
        val str = extractTargetStr(current)
        if (str.isEmpty()) {
            println("YES")
            return
        }
        if (str.length == current.length) {
            println("NO")
            return
        }
        current = str
    }
}

// return next start position
private fun extractTargetStr(value: String): String {
    if (value.startsWith("maerd") || value.startsWith("esare")) {
        return value.substring(5)
    }
    if (value.startsWith("resare")) {
        return value.substring(6)
    }
    if (value.startsWith("remaerd")) {
        return value.substring(7)
    }
    return value
}

Measured memory_bytes: 116656
N,P = map(int,input().split())
S= list(map(int, list(input())))[::-1]
counter = [0]*P
counter[0] = 1
ans = 0
sum = 0
d = 0
r = []
mod = 0

if P != 2 and P != 5:
    mod = 1%P
    for i in range(N):
        d = S[i]*mod
        sum = (sum+d)%P
        mod = (mod*10)%P
        counter[sum] += 1
    for k in range(P):
        ans += (counter[k] * (counter[k]-1)) // 2

if P == 2 or P == 5:
    if P == 2:
        r = [0,2,4,6,8]
    if P == 5:
        r = [0,5]
    for j in range(N):
        if S[j] in r: ans += N - j

print(ans)

Measured memory_bytes: 12228
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

const double PI = 3.1415926535897932384626433832795;

struct Point {
  LL x;
  LL y;
};

int main() {
  LL n, k;
  cin >> n >> k;
  vector<Point> vp;
  vector<LL> vx;
  vector<LL> vy;
  LL tx, ty;
  REP(i, n) {
    cin >> tx >> ty;
    vp.push_back({tx, ty});
    vx.push_back(tx);
    vy.push_back(ty);
  }
  sort(ALL(vx));
  sort(ALL(vy));

  LL ans = 9223372036854775807;
  for(int x1 = 0; x1 < n; ++x1) {
    for(int x2 = x1 + 1; x2 < n; ++x2) {
      for(int y1 = 0; y1 < n; ++y1) {
        for(int y2 = y1 + 1; y2 < n; ++y2) {
          LL xl = vx[x1];
          LL xr = vx[x2];
          LL yb = vy[y1];
          LL yu = vy[y2];
          int count = 0;
          REP(i, n) {
            Point p = vp[i];
            if(xl <= p.x && p.x <= xr && yb <= p.y && p.y <= yu) {
              count++;
            }
          }
          if(count >= k) {
            LL size = (xr - xl) * (yu - yb);
            ans = min(ans, size);
          }
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256