akhauriyash/Code-Regression huggingface dataset:
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <iomanip>       // fixed, setprecision
using namespace std;

int main()
{
  int N, alice = 0, bob = 0;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
  {
    cin >> a.at(i);
  }
  sort(a.rbegin(), a.rend());
  for (int i = 0; i < N; i++)
  {
    if (i % 2 == 0)
    {
      alice += a[i];
    }
    else
    {
      bob += a[i];
    }
  }
  cout << alice - bob << endl;
}


Measured memory_bytes: 3136
import numpy as np

bingo_list = [list(map(int, input().strip().split())) for i in range(3)]
n = int(input())
num_list = [int(input()) for i in range(n)]

bingo_ar = np.array(bingo_list)
out_ar = np.zeros((3, 3), dtype=int)

for i in range(3):
    for j in range(3):
        if bingo_ar[i, j] in num_list:
            out_ar[i, j] = 1

out = 'No'

if max(max(np.sum(out_ar, 0, dtype=int)), max(np.sum(out_ar, 1, dtype=int)), out_ar[0, 0] +
       out_ar[1, 1] + out_ar[2, 2], out_ar[2, 0] +
       out_ar[1, 1] + out_ar[0, 2]) == 3:
    out = 'Yes'

print(out)

Measured memory_bytes: 12452
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

int gcd(int a, int b){ return (a % b) ? gcd(b, a % b) : b;}
int lcm(int a, int b){ return (a / gcd(a, b)) * b;}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

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

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

int main(){
    char s[27];

    scanf("%s", s);

    for(int i = 0; i < strlen(s); ++i){
        for(int j = i + 1; j < strlen(s); ++j){
            if(s[i] == s[j]){
                puts("no");
                return 0;
            }
        }
    }
    puts("yes");

    return 0;
}


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

using namespace std;
typedef long long int ll;

const ll p = 31;
const ll N = 1e9 +1;


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

  ll n;
  cin>>n;
  ll b[n-1];
  ll ans = 0;
  for(int i =0;i<n-1;i++){
  	cin>>b[i];
  	if(i==0){
  		ans+=b[i];
  	}
  	else{
  		ans+=min(b[i],b[i-1]);
  	}
  }
  ans+=b[n-2];
  cout<<ans;
  
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define All(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

using namespace std;

main()
{
    int n;
    string s;
    cin>>n>>s;
    each(&it,s)
    {
        it+=n;
        if(it>90)it-=26;
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
import numpy as np
import itertools

N, M, X = map(int, input().split())

ca = []
for _ in range(N):
  ca.append( list(map(int, input().split())))
ca = np.array(ca)
#print(ca)
ans = 10000000

b = [0,1]
for p in list(itertools.product(b, repeat=N)): 
  a = np.array(p)
  to = a@ca
  if min(to[1:]) >= X:
    ans = min(ans, to[0])
#
if ans == 10000000:
  print(-1)
else:
  print(ans)
#

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

int main() {
  int q;
  cin >> q;
  vector<P> A(q), Q(q);
  rep(i,q) {
    int l, r;
    cin >> l >> r;
    A[i] = P(r,l);
    Q[i] = P(l,r);
  }
  sort(A.begin(), A.end(), greater<P>());
  int n = A[0].first;
  vector<bool> isP(n+1, true);
  isP[0] = false;
  isP[1] = false;
  for (int i = 2; i <= sqrt(n); ++i) {
    if (isP[i]) {
      for (int j = 2*i; j <= n; ++j) {
        if (j % i == 0) isP[j] = false;
      }
    }
  }
  vector<int> sum(n+5);
  int temp = 0;
  for (int i = 3; i < n+1; ++i) {
    if (isP[i] && isP[(i+1)/2]) temp++;
    sum[i] = temp;
  }
  for (auto x : Q) {
    int ans = sum[x.second] - sum[x.first-1];
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
int main(void){
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if(a == b && b == c){
        printf("No");
    }else if(a == b || b == c || a == c){
        printf("Yes");
    }else{
        printf("No");
    }
  
}


Measured memory_bytes: 1720
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	string st;
	while (getline(cin, st)) {
		ld a = stod(st.substr(0, st.find(" ")));
		ld b = stod(st.substr(st.find(" ")));
		a += 0.001;
		b += 0.001;
		if (a < 35.5&&b < 71)cout << "AAA" << endl;
		else if (a < 37.5&&b < 77)cout << "AA" << endl;
		else if (a < 40 && b < 83)cout << "A" << endl;
		else if (a < 43 && b < 89)cout << "B" << endl;
		else if (a < 50 && b < 105)cout << "C" << endl;
		else if (a < 55 && b < 116)cout << "D" << endl;
		else if (a < 70 && b < 148)cout << "E" << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 3216
(defun moge ()
  (let ((n (read))
        (lst nil))
    (dotimes (i n)
      (push (read) lst))
    (reverse lst)))


(defun chuou (b-lst)
  (let* ((len (length b-lst))
         (chuou-n (floor len 2))
         (new-lst (sort b-lst #'<)))
    (if (oddp len)
        (nth chuou-n new-lst)
        (let ((c1 (nth chuou-n new-lst))
              (c2 (nth (1- chuou-n) new-lst)))
          (floor (+ c1 c2) 2)))))

(defun hoge ()
  (let* ((lst (moge))
         (b-lst (loop :for a :in lst
                      :for i :from 1
                      :collect (- a i)))
         (b (chuou b-lst))
         (v (loop :for a :in lst
                  :for i :from 1
                  :sum (abs (- a (+ b i))))))
    (format t "~D~%" v)))


(hoge)


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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
#define check cout<<"?\n";
 
using namespace std;

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

signed main(){
    io();
    int a; cin >> a;
    string s; cin >> s;
    if(a >= 3200){
        cout << s << '\n';
    }else{
        cout << "red\n";
    }
    return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> wa(N);
    vector<bool> prob(N,true);
    int ans = 0, pena = 0; 
    rep(i, 0, M){
        int p;
        string s;
        cin >> p >> s;
        p--;
        if(s == "WA"){
            wa[p]++;
        }
        if(s == "AC" && prob[p] == true){
            prob[p] = false;
            ans++;
            pena += wa[p];
        }
    }
    cout << ans << " " << pena << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <set>
#define inf 1000000000

using namespace std;

struct SegTree{
	int size;
	vector<int> seg, delay;
	
	SegTree(){}
	SegTree(int size){
		this->size = size;
		seg.resize(1<<(size+1));
		delay.resize(1<<(size+1));
	}
	
	void init()
	{
		for(int i = 0; i < (1<<(size+1)); i++){
			seg[i] = inf;
			delay[i] = 0;
		}
	}
	
	void eval(int l, int r, int k)
	{
		if(delay[k]){
			seg[k] += delay[k];
			if(l < r){
				delay[k*2] += delay[k];
				delay[k*2+1] += delay[k];
			}
			delay[k] = 0;
		}
	}
	
	void update(int i, int val)
	{
		i += (1 << size);
		seg[i] = val;
		while(i > 1){
			i /= 2;
			seg[i] = min(seg[i*2], seg[i*2+1]);
		}
	}
	
	void add(int a, int b, int k, int l, int r, int val)
	{
		eval(l, r, k);
		
		if(b < l || r < a) return;
		if(a <= l && r <= b){
			delay[k] += val;
			eval(l, r, k);
			return;
		}
		add(a, b, k*2, l, (l+r)/2, val);
		add(a, b, k*2+1, (l+r)/2+1, r, val);
		seg[k] = min(seg[k*2], seg[k*2+1]);
	}
	void add(int a, int b, int val){
		if(a > b) return;
		add(a, b, 1, 0, (1<<size)-1, val);
	}

	int query(int a, int b, int k, int l, int r)
	{
		eval(l, r, k);
		
		if(b < l || r < a) return inf;
		if(a <= l && r <= b) return seg[k];
		int lval = query(a, b, k*2, l, (l+r)/2);
		int rval = query(a, b, k*2+1, (l+r)/2+1, r);
		return min(lval, rval);
	}
	int query(int a, int b)
	{
		return query(a, b, 1, 0, (1<<size)-1);
	}
};

int N, Q;
string s;
SegTree seg(19);
set<int> cand;

int getans(int p)
{
	int ub = p, lb = 0, mid;
	while(ub - lb > 1){
		mid = (ub + lb) / 2;
		if(seg.query(mid, p) >= 2) ub = mid;
		else lb = mid;
	}
	return ub;
}

int main(void)
{
	cin >> N >> Q;
	cin >> s;
	s = " " + s;
	
	seg.init();
	int sum = 0;
	for(int i = 1; i <= N; i++){
		if(s[i] == '(') sum++;
		else{
			sum--;
			cand.insert(i);
		}
		seg.update(i, sum);
	}
	
	int p, ans;
	for(int q = 0; q < Q; q++){
		cin >> p;
		if(s[p] == '('){
			s[p] = ')';
			cand.insert(p);
			seg.add(p, N, -2);
			
			while(s[*cand.begin()] == '(') cand.erase(cand.begin());
			ans = *cand.begin();
			s[ans] = '(';
			cand.erase(cand.begin());
			seg.add(ans, N, 2);
		}
		else{
			s[p] = '(';
			if(cand.count(p)) cand.erase(p);
			seg.add(p, N, 2);
			
			ans = getans(p);
			s[ans] = ')';
			cand.insert(ans);
			seg.add(ans, N, -2);
		}
		cout << ans << endl;
	}
	
	return 0;
}



Measured memory_bytes: 18532
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



typedef vector<ll> V;
typedef vector<V> MATRIX;

ll N,M,D;
ll SIZE;
ll S[105],T[105],F[105];

MATRIX calc(MATRIX left,MATRIX right){

	MATRIX ret(SIZE,V(SIZE));

	for(int i = 0; i < SIZE; i++){
		for(int k = 0; k < SIZE; k++)ret[i][k] = 0;
	}

	for(int row = 0; row < SIZE; row++){
		for(int col = 0; col < SIZE; col++){
			for(int a = 0; a < SIZE; a++){
				ret[row][col] += left[row][a]*right[a][col]%MOD;
			}
		}
	}

	return ret;

}

//MULTのT乗を計算する
MATRIX POW(MATRIX MULT,ll count){

	MATRIX ret(SIZE,V(SIZE));

	for(int row = 0; row < SIZE; row++){
		for(int col = 0; col < SIZE; col++){
			if(row == col)ret[row][col] = 1;
			else{
				ret[row][col] = 0;
			}
		}
	}

	while(count > 0){
		if(count%2 == 1)ret = calc(ret,MULT);
		MULT = calc(MULT,MULT);
		count /= 2;
	}

	return ret;
}


int main(){

	scanf("%lld %lld %lld",&N,&M,&D);

	for(int i = 0; i < N; i++){

		scanf("%lld",&S[i]);
	}
	for(int i = 0; i < N; i++){

		scanf("%lld",&T[i]);
	}
	for(int i = 0; i < M; i++){

		scanf("%lld",&F[i]);
	}


	SIZE = M+N+1;

	MATRIX MULT(SIZE,V(SIZE));

	for(int row = 0; row < SIZE; row++){
		for(int col = 0; col < SIZE; col++){
			MULT[row][col] = 0;
		}
	}

	MULT[0][0] = 1;
	for(int i = 0; i < N; i++){

		MULT[0][M+1+i] = T[i];
	}

	for(int row = 1; row <= M; row++){
		if(row != M){

			MULT[row][row+1] = 1;

		}else{

			MULT[row][1] = 1;
		}
	}

	for(int row = M+1; row <= M+N; row++){
		if(row != M+N){

			MULT[row][row+1] = 1;
		}else{

			MULT[row][M+1] = 1;
		}
	}
	MULT[M+N][1] = 1;

	MULT = POW(MULT,D);

	ll ans = 0;
	for(int i = 0; i < M; i++){
		ans += MULT[0][i+1]*F[i];
		ans %= MOD;
	}
	for(int i = 0; i < N; i++){
		ans += MULT[0][M+1+i]*S[i];
		ans %= MOD;
	}

	printf("%lld\n",ans);

	return 0;
}




Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdio>
using namespace std;

#define int long long
#define INF 1e18

signed main() {
    int n; cin >> n;
    vector<string> s(n); for(int i = 0; i < n; i++) cin >> s[i];

    int m;  cin >> m;
    vector<string> t(m); for(int i = 0; i < m; i++) cin >> t[i];

    int ans = 0;
    for(int i = 0; i < n - 1; i++) {
        int tmp = 0;
        for(int j = 0; j < n; j++) {
            if(s[i] == s[j]) {
                tmp++;
            }
        }
        for(int j = 0; j < m; j++) {
            if(s[i] == t[j]) tmp--;
        }
        ans = max(ans, tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

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

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}



void virus(){
        ll n;
        cin>>n;
        
    ll len = (int) floor(log(25 * (n + 1)) / log(26));
    string buf="";
    for (int i = len- 1; i >= 0; i--) {
        n--;
        buf += (char) ('a' + n % 26);
        n /= 26;
    }
    reverse(buf.begin(),buf.end());
    cout<<buf;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t=1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 3788
from itertools import permutations
if __name__ == "__main__":
    N = int(input())
    P = tuple(map(int,input().split()))
    Q = tuple(map(int,input().split()))
    arr = [i for i in range(1,N+1)]
    pattern_arr = list(permutations(arr))
    a,b = -1,-1
    for i,pattern in enumerate(pattern_arr):
        if pattern == P:
            a = i
        if pattern == Q:
            b = i
    print(abs(a-b))

Measured memory_bytes: 13848
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    private final int[][] search = new int[][]{
            {0, 1},
            {0, -1},
            {1, 1},
            {1, -1},
            {1, 0},
            {-1, 1},
            {-1, 0},
            {-1, -1}
    };

    public static void main(final String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        boolean b = true;
        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        while (b) {
            b = runOnce(reader);
        }

        reader.close();
    }

    private boolean runOnce(final BufferedReader reader) throws IOException {
        final String[] params = reader.readLine().split(" ");
        final int x = Integer.parseInt(params[0]);
        final int y = Integer.parseInt(params[1]);
        if (x == 0 && y == 0) return false;
        final Set<Field> fields = new HashSet<>();
        for (int i = 0; i < y; i++) {
            final String[] line = reader.readLine().split(" ");
            for (int j = 0; j < line.length; j++) {
                fields.add(new Field(i, j, line[j]));
            }
        }
        int landCount = 0;
        while (true) {
            final Iterator<Field> iterator = fields.iterator();
            if (!iterator.hasNext()) {
                break;
            }
            final Field next = iterator.next();
            if (next.land) {
                searchLand(next, fields);
                landCount++;
            } else {
                fields.remove(next);
            }
        }
        System.out.println(landCount);
        return true;
    }

    private void searchLand(final Field field, final Set<Field> fields) {
        fields.remove(field);

        final Field tmp = new Field(0, 0, "1");
        for (final int[] s: search) {
            tmp.x = field.x + s[0];
            tmp.y = field.y + s[1];
            if(fields.contains(tmp)) {
                searchLand(tmp, fields);
                fields.remove(tmp);
            }
        }
    }

    private final class Field {
        int x, y;
        boolean land;

        Field(final int x, final int y, final String type) {
            this.x = x;
            this.y = y;
            this.land = type.equals("1");
        }

        @Override
        public int hashCode() {
            return x + y * 100;
        }

        @Override
        public boolean equals(final Object obj) {
            if (obj instanceof Field) {
                return ((Field) obj).x == this.x && ((Field) obj).y == this.y && this.land == ((Field) obj).land;
            }
            return super.equals(obj);
        }
    }
}

Measured memory_bytes: 31296
#include <stdio.h>

void
calc_line_params(double x1, double y1, double x2, double y2, double *ap, double *bp, double *cp)
{
    *ap = y1 - y2;
    *bp = x2 - x1;
    *cp = y1*x2 - y2*x1;
}

double
det_for(double a, double b, double c, double d, double e, double f)
{
    return a*e - b*d;
}

void
calc_cross_point(double a, double b, double c, double d, double e, double f, double *cxp, double *cyp)
{
    double det = det_for(a, b, c, d, e, f);
    *cxp = (c*e - b*f) / det;
    *cyp = (a*f - c*d) / det;
}

int
judge_cross_point_is_valid(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp)
{
        double a, b, c, d, e, f, cx, cy;

        calc_line_params(x1, y1, x2, y2, &a, &b, &c);
        calc_line_params(x3, y3, xp, yp, &d, &e, &f);

        if (!det_for(a, b, c, d, e, f)) return 0;
        calc_cross_point(a, b, c, d, e, f, &cx, &cy);

        if ((x1 < cx) && (x2 < cx)) return 0;
        if ((cx < x1) && (cx < x2)) return 0;
        if ((y1 < cy) && (y2 < cy)) return 0;
        if ((cy < y1) && (cy < y2)) return 0;
        return 1;
}

int
main(int argc, char *argv[])
{
    double x1, y1, x2, y2, x3, y3, xp, yp;

    while (EOF != scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)) {
        if (judge_cross_point_is_valid(x1, y1, x2, y2, x3, y3, xp, yp)
            && judge_cross_point_is_valid(x2, y2, x3, y3, x1, y1, xp, yp)
            && judge_cross_point_is_valid(x3, y3, x1, y1, x2, y2, xp, yp)
            ) {
            puts("YES");
            continue;
        }
        puts("NO");
    }

    return 0;
}

Measured memory_bytes: 616
#include<bits/stdc++.h>
using namespace std;
 
#define ll          int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        200005
#define mod         1000000007 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double x;
    cin>>x;
    cout<<fd(10)<<(x*x*x)/27;
    // cout<<s1<<" "<<s2;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		
		String[] line = new String[h];
		
		for(int i = 0; i < h; i++) {
			line[i] = sc.next();
			
		}
		
		System.out.print("#");
		for(int i = 0; i < w; i++) {
			System.out.print("#");
		}
		System.out.println("#");
		
		for(int i = 0; i < h; i++) {
			System.out.println("#" + line[i] + "#");
		}
		
		System.out.print("#");
		for(int i = 0; i < w; i++) {
			System.out.print("#");
		}
		System.out.println("#");

	}

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 60; //10e18+10e17ちょっとくらい
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int x;
    cin >> x;
    if (x >= 30)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

int main(){
    int a, b;
  cin >> a >> b;
  if (a % 3 == 0 || b % 3 == 0) {
    cout << "Possible" << endl;
  }
  else if ((a + b) % 3 == 0) {
    cout << "Possible" << endl;
  }
  else {
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

MaxValu = -2147483646
d = 2 ** 10
for i in range(1, d):
  tmp = i
  L = [0 for _ in range(10)]
  for j in range(10):
    L[j] = tmp % 2
    tmp //= 2
  val = 0
  for j in range(N):
    tmp2 = 0
    for m in range(10):
      tmp2 += F[j][m] * L[m]
    val += P[j][tmp2]
  if val > MaxValu:
    MaxValu = val
print(MaxValu)

Measured memory_bytes: 3188
n = int(input())
count=0
flg=0

for num in range(n):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        count += 1
        if count>= 3:
            flg = 1
    else:
        count=0
else:
    if count > 3 or flg >0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 9156
import java.util.Arrays;
import java.util.List;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //最大値と最小値
        double max = 0;
        double min = 1000000;
        
        //数字が最大か最小か
        while(true) {
            double x;
            try {
                x = sc.nextDouble();
            }catch(Exception e) {
                break;
            }
            if(x > max) {
                max = x;
            }
            if(x < min) {
                min = x;
            }
        }
        System.out.println(max - min);
        
    }
}



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

#define N_MAX 10
#define SUM_MAX 500

int n, s;
int dp[1<<10][N_MAX+1][SUM_MAX];

void solve() {
  for(int S = (1<<10)-1; S >= 0; S--) {
    for(int t = 0; t <= N_MAX; t++) {
      for(int u = 0; u < SUM_MAX; u++) {
	dp[S][t][u] = (t == 0 && u == 0) ? 1 : 0;
      }
    }
  }

  for(int S = (1<<10)-2; S >= 0; S--) {
    for(int t = 1; t <= N_MAX; t++) {
      for(int u = 0; u < SUM_MAX; u++) {
	for(int k = 0; k <= 9; k++) {
	  if(S>>k & 1) continue;
	  if(u-t*k < 0) break;
	  dp[S][t][u] += dp[S|1<<k][t-1][u-t*k];
	}
      }
    }
  }
}

main() {
  solve();
  while((cin >> n >> s)) cout << dp[0][n][s] << endl;
}

Measured memory_bytes: 22000
num = int(input())

a = [ [0 for x in range(14)] for y in range(4)]

mark = ["S", "H", "C", "D"]

for i in range(num):
    m,t = input().split()
    n = int(t)
    if m == "S":
        a[0][n] =1
    elif m == "H":
        a[1][n] =1
    elif m == "C":
        a[2][n] =1
    elif m == "D":
        a[3][n] =1

for i in range(4):
    for j in range(1,14):
        if a[i][j] ==0:
            print(mark[i], j)




Measured memory_bytes: 5616
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rs(a, b) ((a) >> (b))
#define ls(a, b) ((a) << (b))
#define gcd __gcd
#define lcm(a, b) ((a * b) / gcd(a, b))
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define nani(x) cerr << #x << " is " << x << endl;
#define ch(x) (x - 'a' + 1)
#define mp make_pair
#define pb push_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scan(x, n) loop(i, 0, n) cin >> x[i];
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define print(x, n) loop(i, 0, n) cout << x[i] << " ";
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef vector<ii> vii;
typedef vector<pll> vll;
typedef um<int, int> umii;
typedef um<char, int> umci;
typedef map<char, int> mci;
typedef map<int, int> mii;

int main()
{
    fast;
    //freopen("input.txt", "r", stdin);
    int n, d;
    cin >> n >> d;
    cout << ceil((n / (float)((d << 1) + 1)));
    return 0;
}


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

int main()
{
    int n;
    int a[105];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n-1;i++)
    {
        cout<<a[i]<<" ";
    }
    cout<<a[n-1]<<endl;
    for(int i=1;i<n;i++)
    {
        int v = a[i];
        int j = i-1;
        while(j>=0&&a[j]>v)
        {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        for(int i=0;i<n-1;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<a[n-1]<<endl;
    }

    return 0;
}



Measured memory_bytes: 3104
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int N,K;
	scanf("%d%d",&N,&K);
	int A,B;
	for(int i=0;i<K;i++){
		scanf("%d%d",&A,&B);
		int x=min(min(A,B),min(N-A+1,N-B+1))%3;
		if(x==0)x=3;
		printf("%d\n",x);
	}
	return 0;
}

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

#define endl '\n'

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(15);
}
const int MAXN = 1e5 + 10 ;
long long A[MAXN] ; 
int main(int argc,char* argv[]) { 
    io() ;
    #ifndef ONLINE_JUDGE
      //  freopen("inp.txt", "r", stdin) ;
        // freopen("out.txt", "w", stdout);
    #endif
    long long ans1 = 0 ;
    long long prevs = 0 ;
    int n ;
    cin >> n ;
    for(int i = 1 ; i <= n ; i++){
        cin >> A[i] ;
    }
    for(int i = 1 ; i <= n ; i++){
        long long tmps = prevs + A[i] ;
        if(i&1){
            if(tmps <= 0){
                ans1 += (1 - tmps);
                tmps = 1 ;
            }
        }
        else{
            if(tmps >= 0){
                ans1 += (tmps + 1) ;
                tmps = -1 ;
            }
        }
        prevs = tmps ;
    }
    prevs = 0 ;
    long long ans2 = 0 ;
    for(int i = 1 ; i <= n ; i++){
        long long tmps = prevs + A[i] ;
        if(i%2 == 0){
            if(tmps <= 0){
                ans2 += (1 - tmps) ;
                tmps = 1 ;
            }
        }
        else{
            if(tmps >= 0){
                ans2 += (tmps + 1) ;
                tmps = -1 ;
            }
        }
        prevs = tmps ;
    }
    cout << min(ans1,ans2) << endl;
    return 0 ; 
}

Measured memory_bytes: 1024
#include <complex>
#include <cmath>
#include <cstdio>
#include <iostream>

using namespace std;
typedef complex<double> xy_t;
xy_t P[110];

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
int main() {
    int N=0;
    double x, y;
    while (~scanf("%lf,%lf", &x, &y)){
        P[N++] = xy_t(x,y);
    }
    double sum = 0.0;
    xy_t a=P[0];
    for (int i=0; i+2<N; ++i) {
        xy_t b=P[i+1], c=P[i+2];
        sum += cross_product(c-a, b-a)/2.0;
    }
    printf("%lf\n", abs(sum));
 }

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long n;
    cin>>n;
    f(i,0,50001){
        if(int(i*1.08)==n){
            cout<<i<<endl;
            return 0;
        }
        else if(int(i*1.08)>n){
            break;
        }
    }
    cout<<":("<<endl;
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n;
    string s; 
    cin>>n>>s;

    ll cnt=0;
    rep(i,1000){
        ll c[3]={i/100,(i/10)%10,i%10};
        ll p=0;
        rep(j,n){
            if(s[j]==('0'+c[p])) ++p;
            if(p==3) break;
        }
        if(p==3) ++cnt;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3660
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;


int main(){
  string s,t;
  cin >> s >> t;
  if(s == t.substr(0,s.length())) printf("Yes\n");
  else printf("No\n");
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> L;
  for(int i=0; i<2*N; i++){
    int l; cin >> l;
    L.push_back(l);
  }
  sort(L.begin(), L.end());
  int gu=0;
  for(int i=0; i<N; i++){
    gu += L[2*i];
  }
  cout << gu << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int l,a,b,c,d;
	scanf("%d",&l);//冬休みの日数
	scanf("%d",&a);//国語ドリルのページ数
	scanf("%d",&b);//算数ドリルのページ数
	scanf("%d",&c);//１日に進められる国語ドリルのページ数
	scanf("%d",&d);//１日に進められる算数ドリルのページ数
	int j,m;
	j=(a+(c-1))/c;//国語を解くのにかかる日数(小数繰り上げ）
	m=(b+(d-1))/d;//算数を解くのにかかる日数(小数繰り上げ)
	if(j>m){
		printf("%d\n",l-j);
	}
	else{
		printf("%d\n",l-m);
	}
	return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

class Main {
	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int k = scanner.nextInt();
		int x = scanner.nextInt();
		int y = scanner.nextInt();
		int ans = 0;

		for (int i = 1; i <= n; i++) {
			if (i <= k) {
				ans += x;
			} else {
				ans += y;
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
#include <stdio.h>
#define N 10000
int main(){
	int num,i,j,a;
	int cnt = 0;
	scanf("%d",&num);

	for(i=0;i<num;i++){

	scanf("%d",&a);

	for(j=2;j*j <= a;j++){
		if(a % j == 0) break;

	}
	if(j*j > a) cnt ++;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 2124
import java.util.*
fun findRoot(group : IntArray,  id : Int) : Int {
    var begin = id
    while(group[begin - 1] != begin){
        var temp = begin
        begin = group[begin - 1]
        group[temp - 1] = group[begin - 1]
    }
    return begin
}

fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)

    val N = reader.nextInt()
    val M = reader.nextInt()

    val members = IntArray(N)
    for(index in 0..N-1) {
        members[index] = index + 1
    }

    val weights = IntArray(N)
    weights.fill(1)

    var maxGroupMembers = 0
    repeat(M){
        val a = reader.nextInt()
        val b = reader.nextInt()

        val rootA = findRoot(members, a)
        //println(rootA)
        val rootB = findRoot(members, b)
        //println(rootB)

        if(rootA != rootB) {
            if(weights[rootA - 1] + weights[rootB - 1] > maxGroupMembers){
                maxGroupMembers = weights[rootA - 1] + weights[rootB - 1]
            }

            if (weights[rootA - 1] <= weights[rootB - 1]) {
                weights[rootA - 1] += weights[rootB - 1]
                members[rootB - 1] = rootA
            }
            else {
                weights[rootB - 1] += weights[rootA - 1]
                members[rootA - 1] = rootB
            }
        }
    }

    println(if(M == 0) 1 else maxGroupMembers)
}

Measured memory_bytes: 63644
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;

int main() {
  int X;
  cin >> X;
  int ans = X/500*1000+X%500/5*5;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;

int main()
{
    fastRead;
    int n;
    cin>>n;
    vector<int>vec(n);
    for(auto &x: vec) cin>>x;
    
    sort(vec.rbegin(), vec.rend());
    
    ll ans = 0;
    
    int nn = 1;
    
    ans += vec[0];
    
    for(int i = 1 ; i < n && nn < n-1 ; i++) {
        
        ans += vec[i];
        nn++;
//        cout<<nn<<" "<<vec[i]<<" "<<ans<<'\n';
        if(nn == n-1 ) break;
        
        ans += vec[i];
        nn++;
    }
    
    cout<<ans<<'\n';
    return 0;
}

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

int main(void)
{
    int m, f, r;

    auto grade = [&]() {
        int mf(m + f);
        return
            (m == -1 || f == -1)? 'F':
            (mf >= 80)? 'A':
            (mf >= 65)? 'B':
            (mf >= 50)? 'C':
            (mf >= 30)?
                (r >= 50)? 'C' : 'D' :
            'F';
    };

    while (cin >> m >> f >> r && !(m == -1 && f == -1 && r == -1))
        cout << grade() << endl;

    return 0;
}



Measured memory_bytes: 3084
n=int(input())
a=[int(i) for i in input().split()]
 
ans=0
b=0
j=0
for i in range(n):
    while j<n and b^a[j]==b+a[j]:
        b^=a[j]
        j=j+1
    ans += j-i
    b^=a[i]
print(ans)

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

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

//const long long int MOD=1000000007;
const int MOD=1000000007;
//const long long int MOD=998244353;

class UnionFind {
	vector<int>parent;
	vector<int>rank;
public:
	UnionFind(int num) {
		num++;
		parent.resize(num);
		rank.resize(num);
		for (int i = 0; i < num; i++) {
			parent[i] = i;
			rank[i] = 0;
		}
	}
	int Find(int node) {
		if (parent[node] == node)return node;
		else return parent[node] = Find(parent[node]);
	}
	void Unite(int u, int v) {
		u = Find(u);
		v = Find(v);
		if (u == v)return;
		if (rank[u] < rank[v])parent[u] = v;
		else {
			parent[v] = u;
			if (rank[u] == rank[v])rank[u]++;
		}
	}
	bool Check_Same(int u, int v) {
		return Find(u) == Find(v);
	}
};

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N>>K;
	vector<int>p(N);
	for(auto &i:p){
		cin>>i;
		i--;
	}
	UnionFind uf(N);
	for(int i=0;i<N;i++){
		uf.Unite(i,p[i]);
	}
	vector<int>v(N);
	for(int i=0;i<N;i++){
		v[uf.Find(i)]++;
	}
	K=min(K,N-K);
	//vector<int>dp(K+1);
	//dp[0]=1;
	bitset<150001>bs;
	bs.flip(0);
	for(int i=0;i<N;i++){
		if(!v[i])continue;
		bs|=(bs<<v[i]);
	}
	if(bs.test(K))cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 7608
#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<deque>
#include<cmath>
#include<set>
#include<cstring>
#include<string.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
//----------------
#define int long long
//----------------
inline int read()
{
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9') {if (ch == '-')f = -1; ch = getchar();}
    while (ch >= '0' && ch <= '9') {x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar();}
    return x * f;
}
#define sdf(x) x=read()
#define For(i, a, b) for (int i = (a); i <= (b); i++)
#define FFor(i, a, b) for (int i = (a); i >= (b); i--)
#define me(a, b) memset(a, b, sizeof(a))
#define mid ((l + ((r - l)/2)))
#define random(a, b) ((a) + rand() % ((b) - (a) + 1))
#define bg1(x) cout<<(#x)<<":"<<(x)<<" "<<endl
#define bg2(x,y) cout<<(#x)<<":"<<(x)<<" "<<(#y)<<":"<<(y)<<" "<<endl
#define bg3(x,y,z) cout<<(#x)<<":"<<(x)<<" "<<(#y)<<":"<<(y)<<" "<<(#z)<<":"<<(z)<<" "<<endl
#define bg4(x,y,z,w) cout<<(#x)<<":"<<(x)<<" "<<(#y)<<":"<<(y)<<" "<<(#z)<<":"<<(z)<<" "<<(#w)<<":"<<(w)<<" "<<endl
#define bg5(x,y,z,w,k) cout<<(#x)<<":"<<(x)<<" "<<(#y)<<":"<<(y)<<" "<<(#z)<<":"<<(z)<<" "<<(#w)<<":"<<(w)<<" "<<(#k)<<":"<<(k)<<" "<<endl
#define call(x) cout<<x<<":"
#define lll cout<<"\n------\n"
int die = 0;
#define Die die++;if(die>100000){cout<<"dead!!!";exit(0);}
#define mk make_pair
#define pb push_back
const double eps = 1e-8;
// srand((unsigned)time(NULL));
const int mod = 1e9 + 7;
const int N = 1e6 + 5;

int n;
std::vector<pair<int,int>>G[N];
int ans[N];

void dfs(int x, int fa) {
    for (auto t : G[x]) {
        int y = t.first;
        int w = t.second;
        if (y == fa)continue;
        if (w & 1)ans[y] = ans[x] ^ 1;
        else ans[y] = ans[x];
        dfs(y,x);
    }
}

void sol1() {
    ans[1] = 1;
    dfs(1, 1);
For(i,1,n)printf("%lld\n",ans[i] );

}

void rd() {
    sdf(n);
    int u, v, w;
    For(i, 1, n - 1) {
        sdf(u), sdf(v), sdf(w);
        G[u].pb(mk(v, w)), G[v].pb(mk(u, w));
    }
    sol1();
}

signed main()
{

    rd();
}



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

int main() {
    int N;
    cin >> N;
    int A[N + 1];
    vector<int> ans(N + 1, 0);
    for (int i = 2; i <= N; i++) {
        cin >> A[i];
        ans[A[i]]++;
    }
    for (int i = 1; i <= N; i++)
        cout << ans[i] << endl;
}

Measured memory_bytes: 4844
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(N+1)
x = 0
for i in range(1,N+1):
  D[i] = D[i-1]+L[i-1]
for i in D:
  if i <= X:
    x += 1
print(x)

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	vector<ll> p(N);
	REP(i, N) cin >> p[i];

	ll mi = -1;
	ll sum = 0;
	REP(i, N){
		sum += p[i];
		if(mi<p[i]) mi = p[i];
	}
	cout << sum - mi/2 << endl;
    return 0;
}

Measured memory_bytes: 256
//#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	double x[4],y[4],dx[3],dy[3],dpx[3],dpy[3];
	double th[3], pth[3];
	int check = 0;
	bool ans = true;


	while (	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3]){
		ans = true;

		if (x[1] == 0 && y[1] == 0){
			swap(x[0], x[1]);
			swap(y[0], y[1]);
		}
		if (x[2] == 0 && y[2] == 0){
			swap(x[0], x[2]);
			swap(y[0], y[2]);
		}
		if (sin(atan2(y[1]-y[0], x[1]-x[0]) - atan2(y[2]-y[0], x[2]-x[0])) > 0){
			swap(x[1], x[2]);
			swap(y[1], y[2]);
		}

		for (int i = 0; i < 3; i++){
			dx[i] = x[(i + 1) % 3] - x[i];
			dy[i] = y[(i + 1) % 3] - y[i];
			dpx[i] = x[3] - x[i];
			dpy[i] = y[3] - y[i];
			th[i] = atan2(dy[i], dx[i]);
			pth[i] = atan2(dpy[i], dpx[i]);
		}

		for (int i = 0; i < 3; i++){
			if (sin(th[i] - pth[i])>0){
				ans = false;
				break;
			}
		}
		cout << (ans ? "YES" : "NO" )<< endl;
	}
}

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

const int INF = 100010001000;

int n,m,cost[1010],miti[1010],memo[1010][1010];

int a(int day,int basho){
    if(memo[day][basho]>=0)return memo[day][basho];
    else if(basho==n)return 0;
    else if(day==m)return INF;
    else{
        return memo[day][basho]=min(a(day+1,basho+1)+cost[day]*miti[basho],a(day+1,basho));
    }
}

signed main()
{
    memset(cost,0,sizeof(cost));
    memset(miti,0,sizeof(miti));
    memset(memo,-1,sizeof(memo));
    cin >> n >> m;
    for(int i=0;i<n;i++){
        cin >> miti[i];
    }
    for(int j=0;j<m;j++){
        cin >> cost[j];
    }
    cout << a(0,0) << endl;
    return 0;
}

Measured memory_bytes: 9188
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
a, b, c, k = map(int, input().split())
if (a + b) >= k:
    print(min(a, k))
else:
    print(a - (k - a - b))

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

//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = (LL)INF * INF;

int a[100];

int main()
{
	//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	int s = 0;
	FOR(i, 0, n)
	{
		cin >> a[i];
		s += a[i];
	}
	if(s < 0)
		FOR(i, 0, n)
			a[i] = -a[i];
	vector<PII> ans;
	int prev = -1;
	FOR(i, 0, n)
	{
		if(a[i] >= 0)
		{
			if(prev != -1)
				ans.PB(MP(prev, i));
			prev = i;
		}
	}
	FOR(i, 0, n)
		if(a[i] < 0)
			ans.PB(MP(prev, i));
	if(s < 0)
		RFOR(i, n, 1)
			ans.PB(MP(i, i - 1));
	else
		FOR(i, 0, n - 1)
			ans.PB(MP(i, i + 1));
	assert(SZ(ans) <= 2 * n);
	cout << SZ(ans) << "\n";
	for(auto x: ans)
		cout << x.first + 1 << " " << x.second + 1 << "\n";
	return 0;
}

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

#define MAX 100

int main() {
    int X, N, p[MAX];
    cin >> X >> N;
    for (int i = 0; i < N; i++) {
        cin >> p[i];
    }
    for (int i = 0;; i++) {
        int x;
        x = X - i;
        if (find(p, p + N, x) == p + N) {
            cout << x << endl;
            break;
        }
        x = X + i;
        if (find(p, p + N, x) == p + N) {
            cout << x << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3624
N, M = map(int, input().split())
L = [list(map(int, input().split())) for i in range(M)]
s = []
g = []
for i in range(M):
    if 1 == L[i][0]:
        s.append(L[i][1])
    if 1 == L[i][1]:
        s.append(L[i][0])
        
for i in range(M):
    if N == L[i][0]:
        g.append(L[i][1])
    if N == L[i][1]:
        g.append(L[i][0])
        
if set(g)&set(s):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 61228
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <functional>
#include <utility>



void fastio(){std::ios_base::sync_with_stdio(false);std::cin.tie(0);}

using std::string;using std::cin;using std::cout;using std::vector;using std::map;using std::set;using std::pair;using std::max;using std::min;

template<class T> int sz(T x){return (int)x.size();};

using ll=long long;

#define f first
#define s second

int main(){
    ll n;
    int k;
    cin >> n >> k;
    vector<ll> a(n), dp(n, 1e18);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    std::function<ll(ll)> abs_=[&](ll x)->ll{return x<0? -x: x;};
    dp[0] = 0;
    for(int i = 0; i < n; i++) {
        for(int j = i-k; j < i; j++){
            if(j >= 0) {
                dp[i] = min(dp[i], dp[j] + abs_(a[i]-a[j]));
            }
        }
    }
    cout << dp[n-1] << '\n';
    return 0;
}



Measured memory_bytes: 4828
#include<stdio.h>

int main(void){
  int a, b;

  scanf("%d %d", &a, &b);
  if(a < b){
    printf("a < b\n");
  }else if(a > b){
    printf("a > b\n");
  }else{
    printf("a == b\n");
  }

  return 0;
}



Measured memory_bytes: 2100