criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
main(){
  int N;
  cin >> N;
  vector<int> V(N);
  for(int i = 0;i < N;i++)cin >> V[i];
  sort(V.rbegin(), V.rend());
  int sum = 0;
  for(int i = 0;i < N;i++){
    sum += V[i];
  }
  sum -= V[0];
  cout << sum << endl;
}  


Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> V(N);
      |   ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> V(N);
      |          ^~~
a.cc:8:34: error: 'V' was not declared in this scope
    8 |   for(int i = 0;i < N;i++)cin >> V[i];
      |                                  ^
a.cc:9:8: error: 'V' was not declared in this scope
    9 |   sort(V.rbegin(), V.rend());
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: expected initializer before '+=' token
   11 |     int ans+=p;
      |            ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int> p(N);
  
  int sum=0;
  int max=0;
  
  for(int i=0;i<N;i++){
    cin>>p.at(i);
    sum+=p.at(i)
      
      if(max<=p.at(i))
        max=p.at(i);
    
  }
}

cout<<sum-max/2<<endl;
}

  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: expected ';' before 'if'
   13 |     sum+=p.at(i)
      |                 ^
      |                 ;
   14 | 
   15 |       if(max<=p.at(i))
      |       ~~         
a.cc: At global scope:
a.cc:21:1: error: 'cout' does not name a type
   21 | cout<<sum-max/2<<endl;
      | ^~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int sum=0;
  int ma;
  for(int i=0;i<n;i++){
    cin>>s;
    sum+=s;
    ma=max(ma,s);
  }
  cout<<sum-ma/2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 's' was not declared in this scope
    9 |     cin>>s;
      |          ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int sum=0;
  int price[n];
  for(int i=0;i<n;i++){
    cin>>price[i];
    sum+=price[i];
  }
  cout<<sum-max_element(price.begin(),price.end())/2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: request for member 'begin' in 'price', which is of non-class type 'int [n]'
   12 |   cout<<sum-max_element(price.begin(),price.end())/2;
      |                               ^~~~~
a.cc:12:45: error: request for member 'end' in 'price', which is of non-class type 'int [n]'
   12 |   cout<<sum-max_element(price.begin(),price.end())/2;
      |                                             ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int sum=0;
  vactor<int> price(n);
  for(int i=0;i<n;i++){
    cin>>price[i];
    sum+=price[i];
  }
  cout<<sum-max_element(price.begin(),price.end())/2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vactor' was not declared in this scope
    7 |   vactor<int> price(n);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vactor<int> price(n);
      |          ^~~
a.cc:9:10: error: 'price' was not declared in this scope
    9 |     cin>>price[i];
      |          ^~~~~
a.cc:12:25: error: 'price' was not declared in this scope
   12 |   cout<<sum-max_element(price.begin(),price.end())/2;
      |                         ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int sum=0;
  vactor<int> price(n);
  for(int i=0;i<n;i++){
    cin>>price[i];
    sum+=price[i];
  }
  cout<<sum-max_element(price.begin(),price.end());
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vactor' was not declared in this scope
    7 |   vactor<int> price(n);
      |   ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vactor<int> price(n);
      |          ^~~
a.cc:9:10: error: 'price' was not declared in this scope
    9 |     cin>>price[i];
      |          ^~~~~
a.cc:12:25: error: 'price' was not declared in this scope
   12 |   cout<<sum-max_element(price.begin(),price.end());
      |                         ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int & v : a) cin >> v;
  sort(v.begin(), v.end());
  v[n - 1] /= 2;
  cout << accumulate(v.begin(), v.end(), 0) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'v' was not declared in this scope
    7 |   sort(v.begin(), v.end());
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: expected primary-expression before '<<' token
   14 |   cout<<ans-maxp/2;<<endl;
      |                    ^~
Language: C

#include <stdio.h>

int main(void)
{
	int n;
	scanf("%d",&n);
	
	int a[n];
	
	int i;
	
	for(i = 0; i < n; i++){
		scanf("%d",&a[i]);
	}
	
	int max = a[0];
	
	for(i = 0; i < n; i++){
		if(a[i] > max){
			max = a[i];
		}
	}
	
	int sum = 0;
	
	for(i = 0; i < n; i++){
		sum = sum + a[i]
	}
	
	sum = sum - max/2;
	
	printf("%d\n",sum);
	
	return 0;
}
	
	
	
	

Compiler output:
main.c: In function 'main':
main.c:27:33: error: expected ';' before '}' token
   27 |                 sum = sum + a[i]
      |                                 ^
      |                                 ;
   28 |         }
      |         ~
Language: C

#include <stdio.h>

int main(void)
{
	int n;
	scanf("%d,&n);
	
	int a[n];
	
	int i;
	
	for(i = 0; i < n; i++){
		scanf("%d",&a[i]);
	}
	
	int max = a[0];
	
	for(i = 0; i < n; i++){
		if(a[i] > max){
			max = a[i];
		}
	}
	
	int sum = 0;
	
	for(i = 0; i < n; i++){
		sum = sum + a[i]
	}
	
	sum = sum - max/2;
	
	printf("%d\n",sum);
	
	return 0;
}
	
	
	
	

Compiler output:
main.c: In function 'main':
main.c:6:15: warning: missing terminating " character
    6 |         scanf("%d,&n);
      |               ^
main.c:6:15: error: missing terminating " character
    6 |         scanf("%d,&n);
      |               ^~~~~~~~
main.c:8:9: error: expected expression before 'int'
    8 |         int a[n];
      |         ^~~
main.c:34:18: error: expected ';' before '}' token
   34 |         return 0;
      |                  ^
      |                  ;
   35 | }
      | ~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  int accm = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    accm += A[i]
  }
  
  sort(A.begin(), A.end());
  accm -= A[N-1]/2;
  cout << accm;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: expected ';' before '}' token
   15 |     accm += A[i]
      |                 ^
      |                 ;
   16 |   }
      |   ~
Language: Java

package learning4;
import java.util.Scanner;
public class Main102 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		int N = stdIn.nextInt();
		int sum = 0;
		int max = 0;
		
		for(int p = 1 ; p <= N ; p++) {
			
			p = stdIn.nextInt();
			if (max < p) max = p;		
			
			sum += p;
		}
		
		int X = sum - (max /2);
		System.out.println(X);
		

	}

}



Compiler output:
Main.java:3: error: class Main102 is public, should be declared in a file named Main102.java
public class Main102 {
       ^
1 error
Language: C++

#include<stdio.h>
  2 int main(void)
  3 {  
  4   int n,i;
  5   scanf("%d",&n);
  6   int p[n];
  7   for(i=0;i<n;i++){
  8     scanf("%d",&p[i]);
  9     if(p[i]%2 != 0){
 10       return 0;
 11     }
 12   }
 13    
 14   int max=p[0];
 15    
 16   for(i=1;i<n;i++){
 17     if(max < p[i]){
 18       max = p[i];
 19     }
 20   }
 21    
 22   int s,flag = 0;
 23   for(i=0;i<n;i++){
 24     if(flag != 1 && p[i] == max){
 25       p[i] = 0;
 26       flag = 1;
 27     }
 28     s += p[i];
 29   }
 30    
 31   s += max/2;
 32    
 33   printf("%d\n",s);                                 
 34   return 0;
 35 }  


Compiler output:
a.cc:2:3: error: expected unqualified-id before numeric constant
    2 |   2 int main(void)
      |   ^
Language: C++

#include<bits/stdc++.h>
#define REP(n)    for(int i = 0; i < (n); ++i)
#define RREP(n)   for(int i = (n); i >= 0; --i)
#define FOR(m, n) for(int i = (m); i < (n); ++i)
#define SZ(x)       ( (int)(x).size() )
#define BIT(n)      ( 1LL << (n) )
#define EXIST(x)    ( (x).find()		!= (x).end() )
#define DEBUG(n)    cerr << #n << " : " << n << '\n';
#define PB  push_back
#define UB  upper_bound			//k <
#define LB  lower_bound			//k	<= 
#define F   first
#define S   second
#define INF 1.0e9


using namespace std;

typedef long long			ll;
typedef pair<int, int>		pii;
typedef pair<long			long, long long>   pll;
typedef vector<int>			vi;
typedef vector<double>		vd;
typedef vector<long long>   vll
;

template<class T> void chmax(T &	a, const T & b){ if( a < b ) a = b; }
template<class T> void chmin(T &	a, const T & b){ if( a > b ) a = b; }

int r_up(const int a, const int b){ return (a + b - 1) / b; }

const int dx[] = { 0,  0, 1, -1 };
const int dy[] = { 1, -1, 0,  0 };

struct UFT{
  vi	p;
  UFT(){}
  UFT(int N)       { p.resize( N, -1 ); }
  int	par(int a)   { if( p[a] >= 0 ){ p[a]  = par( p[a] ); return p[a]; } return a;  }
  int size(int a)  { return -p[par(a)]; }
  bool	same(int a, int b) { return par(a)	 == par(b); }
  void unite(int	a, int b){
	a													  = par(a);  b = par(b);
	if( a == b ) return;
	if( size(a) < size(b) ) swap(a,b);
	p[a]												 -= size(b);
	p[b]												  = a;
  }
};

int main(){
  int n,sum=0;  
  vi(n);
  REP(n){cin>>vi[i];sum+=vi[i];}
  sort(vi.rbegin(),vi.rend());
  cout<<sum-vi[0]/2<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:6: error: conflicting declaration 'vi n'
   53 |   vi(n);
      |      ^
a.cc:52:7: note: previous declaration as 'int n'
   52 |   int n,sum=0;
      |       ^
a.cc:54:17: error: expected primary-expression before '[' token
   54 |   REP(n){cin>>vi[i];sum+=vi[i];}
      |                 ^
a.cc:54:28: error: expected primary-expression before '[' token
   54 |   REP(n){cin>>vi[i];sum+=vi[i];}
      |                            ^
a.cc:55:10: error: expected primary-expression before '.' token
   55 |   sort(vi.rbegin(),vi.rend());
      |          ^
a.cc:55:22: error: expected primary-expression before '.' token
   55 |   sort(vi.rbegin(),vi.rend());
      |                      ^
a.cc:56:15: error: expected primary-expression before '[' token
   56 |   cout<<sum-vi[0]/2<<endl;
      |               ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  vector<int>value;
  
  for(int i=0;i<n;i++){
    cin >> value[i];
  }
 
  int max = 0;
  for(int i=0;i<n;i++){
    if(max < value[i])
      max = value[i];
  }
  
  int sum = 0;
  for(int i=0;i<n;i++){
    sum = sum + value[i];
  }
  
  cout << sum - max / 2 << endl;
  
  return 0;
}
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  vector<int>value(10,0);
  
  for(int i=0;i<n;i++){
    cin >> value[i];
  }

  int max = 0;
  for(int i=0;i<n;i++){
    if(max < value[i])
      max = value[i];
  }
  
  int sum = 0;
  for(int i=0;i<n;i++){
    sum = sum + value[i];
  }
  
  cout << sum - max / 2 << endl;
  
  return 0;
}

Compiler output:
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main(void){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(void){
      |     ^~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  vector<int>value(10,0);
  
  for(int i=0;i<n;i++){
    cin >> value[i];
  }
 
  int max = 0;
  for(int i=0;i<n;i++){
    if(max < value[i])
      max = value[i];
  }
  
  int sum = 0;
  for(int i=0;i<n;i++){
    sum = sum + value[i];
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:23:4: error: expected '}' at end of input
   23 |   }
      |    ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
  ll n; cin >> n;     
  ll sum=0,mx=0;
  rep(i,n){
    lla;cin>>a;
    mx=max(ans,a)
      sum+=a;
  }
  ll ans=sum-ans/2;
  cout<<ans<<endl;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'lla' was not declared in this scope; did you mean 'll'?
   22 |     lla;cin>>a;
      |     ^~~
      |     ll
a.cc:22:14: error: 'a' was not declared in this scope
   22 |     lla;cin>>a;
      |              ^
a.cc:23:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |     mx=max(ans,a)
      |            ^~~
      |            abs
a.cc: At global scope:
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <iostream>

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}


int main() {

    int N;

    cin>>N;

    int i = 0,p[N],max = 0,sum = 0;
    while(i <= N)
    {
        cin >> p[i];
        if(max < p[i]){
            max = p[i];
        }
        sum = sum + p[i]
        i++;
    }

    cout<<sum-max/2<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:25: error: expected ';' before 'i'
   34 |         sum = sum + p[i]
      |                         ^
      |                         ;
   35 |         i++;
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main()
{
	int N;
	cin >> N;
	vector<int> price(N);
	rep(i, N) {
		cin >> price[i];
	}

	sort(price.begin(), price.end());

	int sum = price[N - 1];

	rep(i, N - 2) {

		sum = sum + price[j];

	}

	cout << sum << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:35: error: 'j' was not declared in this scope
   32 |                 sum = sum + price[j];
      |                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> price(N);
	rep(int i, N) {
		cin >> price[i];
	}

	sort(price.begin(), price.end());

	int sum = price[N - 1];

	rep(int j, N - 2) {

		sum = sum + price[j];

	}

	cout << sum << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: expected primary-expression before 'int'
    9 |         rep(int i, N) {
      |             ^~~
a.cc:9:9: error: 'rep' was not declared in this scope
    9 |         rep(int i, N) {
      |         ^~~
a.cc:17:13: error: expected primary-expression before 'int'
   17 |         rep(int j, N - 2) {
      |             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> price(N);
	rep(i, N) {
		cin >> price[i];
	}

	sort(price.begin(), price.end());

	int sum = price[N - 1];

	rep(i, N - 2) {

		sum = sum + price[i];

	}

	cout << sum << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         rep(i, N) {
      |             ^
a.cc:9:9: error: 'rep' was not declared in this scope
    9 |         rep(i, N) {
      |         ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}


int main() {

    int N;

    cin>>N;

    int i = 0,p[N],max = 0,sum = 0;
    while(i =< N)
    {
        cin >> p[i];
        if(max < p[i]){
            max = p[i];
        }
        sum = sum + p[i]
        i++;
    }

    cout<<sum-max/2<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: expected primary-expression before '<' token
   25 |     while(i =< N)
      |              ^
a.cc:31:25: error: expected ';' before 'i'
   31 |         sum = sum + p[i]
      |                         ^
      |                         ;
   32 |         i++;
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
	vector<int> price(n);
	rep(i, n) {
		cin >> price[i];
	}

	sort(price.begin(), price.end());

	int sum = price[n - 1];

	rep(i, n - 2) {

		sum = sum + price[i];

	}

	cout << sum << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:27: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |         vector<int> price(n);
      |                           ^
      |                           yn
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         rep(i, n) {
      |             ^
a.cc:7:9: error: 'rep' was not declared in this scope
    7 |         rep(i, n) {
      |         ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    ll n; cin >> n;
    // 合計と暫定の最大値をともに0で初期化する
    ll sum = 0, mx = 0;
    rep(i, n) {
        // 入力を受け取って合計と最大値を更新する
        ll a; cin >> a;
        mx = max(ans, a);
        sum += a;
    }
    ll ans = sum - ans / 2;
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     rep(i, n) {
      |         ^
a.cc:11:5: error: 'rep' was not declared in this scope
   11 |     rep(i, n) {
      |     ^~~
Language: C++

#include <iostream>
using namespace std;
int main(){
    
    int N;
    cin >> N;
    
    int p[10000] = {};
    
    int n = N;
    int i = 0;
    
    while(n--){
        cin >> p[i];
        i++;
        
    }
    
    sort(p,p+10000,greater<int>());
    
    p[0] = p[0]/2;
    
    n = N;
    i = 0;
    int ans = 0;
    while(n--){
        ans = ans+p[i];
        i++;
        
    }
    
    cout << ans << endl;
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 |     sort(p,p+10000,greater<int>());
      |     ^~~~
      |     short
Language: C++

N = int(input())
max_p = 0
sum = 0
for i in range(N):
  pi = int(input())
  sum += pi
  max_p = max(max_p, pi)
  
ans = int(sum - max_p / 2)
print(ans)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
int n;
int a[12];
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+n);
int ans=0;
for(int i=0;i<n;i++)
{
ans=ans+a[i]l
if(i==n-1){ans=ans-a[i]/2;}
}
printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: expected ';' before 'l'
   18 | ans=ans+a[i]l
      |             ^
      |             ;
Language: C++

#include <stdio.h>
#include <stdlib.h>

#define NEW(p,n) {p = malloc(n * sizeof(p[0]));}

typedef int* vector;

vector make_vector(int n)
{
    vector v;
    NEW(v,n);
    for(int i = 0; i < n; i++)
    {
        v[i] = 0;
    }
    return v;
}

int max(int n, vector v)
{
    int ret = 0;
    for(int i = 0; i < n; i++)
    {
        if (v[i] > ret) ret = v[i];
    }
    return ret;
}

int sum(int n, vector v)
{
    int ret = 0;
    for(int i = 0; i < n; i++)
    {
        ret += v[i];
    }
    return ret;
}

int main()
{
    int N;
    vector p;

    scanf("%d",&N);
    p = make_vector(N);
    for(int i = 0; i < N; i++)
    {
        scanf("%d",&p[i]);
    }
    printf("%d\n",sum(N,p) - max(N,p) / 2);
}

Compiler output:
a.cc: In function 'int* make_vector(int)':
a.cc:4:29: error: invalid conversion from 'void*' to 'vector' {aka 'int*'} [-fpermissive]
    4 | #define NEW(p,n) {p = malloc(n * sizeof(p[0]));}
      |                       ~~~~~~^~~~~~~~~~~~~~~~~~
      |                             |
      |                             void*
a.cc:11:5: note: in expansion of macro 'NEW'
   11 |     NEW(v,n);
      |     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s;
  cin>>s;
  vector<int>vec(s);
  for(i=0;i<s;i++){
    cin>>vec[i];
  }
  sort(vec.begin(),vec.end());
  int sum=0;
  for(i=0;i<s;i++){
    sum+=vec[i];
  }
  cout<<sum-vec[s-1]/2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<s;i++){
      |       ^
a.cc:13:7: error: 'i' was not declared in this scope
   13 |   for(i=0;i<s;i++){
      |       ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n,max = 0,ansi = -1;
    cin >> n;
    vector<int> p(n);
    for(int i=0;i<n;i++){
        cin >> p[i];
        if(p[i] > max){
            max = p[i];
            ansi = i;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(i==ansi){
            ans += p[i]/2;
        }
        else if{
            ans += p[i];
        }
    }
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: expected '(' before '{' token
   21 |         else if{
      |                ^
      |                (
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
	int N,M=0,ans=0; cin >> N;
	for(int i = 0 , i < N ; i++){
		int p; cin >> p;
		ans += p;
		M = max(M,p);
	}
	cout << ans - M/2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:26: error: expected ';' before '<' token
    6 |         for(int i = 0 , i < N ; i++){
      |                          ^~
      |                          ;
a.cc:6:27: error: expected primary-expression before '<' token
    6 |         for(int i = 0 , i < N ; i++){
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: expected ';' before '}' token
   10 |         m = max(m, p)
      |                      ^
      |                      ;
   11 |     }
      |     ~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int p[N];
  for(int i=0; i < N; i++){
    cin >> p[i];
  }

  sort(p, p+N);

  int price = 0;
  for(int i=0; i < N-1; i++){
    price += p[i];
  }
  price += p[N-1]/2;
  cout << price << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |   sort(p, p+N);
      |   ^~~~
      |   short
Language: C++

#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace  std;

int main()
{
    int a;
    cin >> a;
    vector<int> b(a);
    for(int i = 0; i > a;i++) cin >> b.at(i);
    
    sort(b.begin(),b.end());
    
    int ans;
    for(int i = 0;i<a-1;i++) ans += b.at(i);
    
    ans += b.at(a-1)/2;
    
    cout << ans << endl;
     
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin >> a;
      |     ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <algorithm>
  +++ |+#include <iostream>
    4 | 
a.cc:21:5: error: 'cout' was not declared in this scope
   21 |     cout << ans << endl;
      |     ^~~~
a.cc:21:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:20: error: 'endl' was not declared in this scope
   21 |     cout << ans << endl;
      |                    ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <algorithm>
  +++ |+#include <ostream>
    4 |
Language: C++

#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <list>
#include <string>
#include <numeric>
#include <utility>
#include <cfloat>

using namespace std;

//bool verified[200000];
//map <char, int> last_index;
//int next_same_char[200000];
int p[10];
int main(){
    int N;
    for(int i = 0; i < N; i++){
        cin >> p[i];
    }
    int tmp = 0;
    int max_p = ,max_element(p, p + N);
    cout << accumulate(p, P + n, tmp) - max_p / 2; << endl:
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: expected primary-expression before ',' token
   29 |     int max_p = ,max_element(p, p + N);
      |                 ^
a.cc:30:27: error: 'P' was not declared in this scope
   30 |     cout << accumulate(p, P + n, tmp) - max_p / 2; << endl:
      |                           ^
a.cc:30:31: error: 'n' was not declared in this scope
   30 |     cout << accumulate(p, P + n, tmp) - max_p / 2; << endl:
      |                               ^
a.cc:30:52: error: expected primary-expression before '<<' token
   30 |     cout << accumulate(p, P + n, tmp) - max_p / 2; << endl:
      |                                                    ^~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#include<string.h>

int main(){
    int N,max=0,ans=0,p;
    scanf("%d",&N);
    int i;
    for(i=0;i<N;i++){
        scanf("%d",&p);
        sum += p;
        max = max>p? max:p;
    }
    printf("%d",sum-max/2);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:9: error: 'sum' undeclared (first use in this function)
   12 |         sum += p;
      |         ^~~
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <algorithm>
#include <cstddef>
#include <iostream>
#include <numeric>

using namespace std;

// Convenience function to read a vector of values from standard input
template <typename T>
auto readVector(T N) {
    vector<T> A;
    for (T i = 0; i < N; i++) {
        T Ai;
        cin >> Ai;
        A.push_back(Ai);
    }
    return A;
}

int main() {
    int N;
    cin >> N;
    auto prices = readVector(N);
    sort(prices.begin(), prices.end());
    *prices.rbegin() /= 2;
    cout << accumulate(prices.begin(), prices.end(), 0) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'auto readVector(T)':
a.cc:11:5: error: 'vector' was not declared in this scope
   11 |     vector<T> A;
      |     ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    4 | #include <numeric>
  +++ |+#include <vector>
    5 | 
a.cc:11:13: error: expected primary-expression before '>' token
   11 |     vector<T> A;
      |             ^
a.cc:11:15: error: 'A' was not declared in this scope
   11 |     vector<T> A;
      |               ^
a.cc: In function 'int main()':
a.cc:23:10: error: deduced type 'void' for 'prices' is incomplete
   23 |     auto prices = readVector(N);
      |          ^~~~~~
Language: C++

#include <algorithm>
#include <cstddef>
#include <iostream>
#include <vector>

using namespace std;

// Convenience function to read a vector of values from standard input
template <typename T>
auto readVector(T N) {
    vector<T> A;
    for (T i = 0; i < N; i++) {
        T Ai;
        cin >> Ai;
        A.push_back(Ai);
    }
    return A;
}

// Read parameters from standard input and call main solution function
int main() {
    int N;
    cin >> N;
    auto prices = readVector(N);
    sort(prices.begin(), prices.end());
    *prices.rbegin() /= 2;
    cout << accumulate(prices.begin(), prices.end(), 0) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'accumulate' was not declared in this scope
   27 |     cout << accumulate(prices.begin(), prices.end(), 0) << endl;
      |             ^~~~~~~~~~
Language: C

#include<stdio.h>

int main(){

   int n,i,x;
   int a[10];
   int s=0;

   scanf("%d",&n);
   for(i=0;i<n;i++)
      scanf("%d",&a[i]);

   max=a[0];
   for(i=0;i<n;i++)
      if(max<a[i]){
         max=a[i];
         x=i;  
      }

   for(i=0;i<n;i++){
      if(x==i) s+=max/2;
      else s+=a[i];
   }
   printf("%d",s);
   return 0;

}


Compiler output:
main.c: In function 'main':
main.c:13:4: error: 'max' undeclared (first use in this function)
   13 |    max=a[0];
      |    ^~~
main.c:13:4: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(){

   int n,i,x;
   int a[10];
   inr s=0;

   scanf("%d",&n);
   for(i=0;i<n;i++)
      scanf("%d",&a[i]);

   max=a[0];
   for(i=0;i<n;i++)
      if(max<a[i]){
         max=a[i];
         x=i;  
      }

   for(i=0;i<n;i++){
      if(x==i) s+=max/2;
      else s+=a[i];
   }
   printf("%d",s);
   return 0;

}

Compiler output:
main.c: In function 'main':
main.c:7:4: error: unknown type name 'inr'; did you mean 'int'?
    7 |    inr s=0;
      |    ^~~
      |    int
main.c:13:4: error: 'max' undeclared (first use in this function)
   13 |    max=a[0];
      |    ^~~
main.c:13:4: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N;
  cin >> N;
  
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += p[i];
  }
  sum -= p[N - 1] / 2;
  
  cout << sum << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:23:23: error: expected '}' at end of input
   23 |   cout << sum << endl;
      |                       ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int maxof(int* p, int N){
    int r = -1000000000;
    for(int i=0; i<N; i++){
        if(r < p[i]) r = p[i];
    }
    return r;
}

int main() {
    int N;
    cin >> N;
    int p[N];
    int i, r=0;
    for(i=0; i<N; i++) cin >> p[i];
    bool f = true;
    for(i=0; i<N; i++){
        if(f && p[i] == maxof(p, N)) r+= p[i]/2; f=false;
        else r+= p[i];
    }
    cout << r << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'else' without a previous 'if'
   20 |         else r+= p[i];
      |         ^~~~
Language: Java

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int d = 0;
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for(int n = 1; n <= a; n++) {
			int b = sc.nextInt();
			d = d + b;
			list.add(b);
		}
		Integer i = Collections.max(list);
		int c  = d - i;
		i = i / 2;
		c = c + i;
		
		System.out.println(c);
	}
}


Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:10: error: cannot find symbol
		ArrayList<Integer> list = new ArrayList<Integer>();
		^
  symbol:   class ArrayList
  location: class Main
Main.java:10: error: cannot find symbol
		ArrayList<Integer> list = new ArrayList<Integer>();
		                              ^
  symbol:   class ArrayList
  location: class Main
Main.java:17: error: cannot find symbol
		Integer i = Collections.max(list);
		            ^
  symbol:   variable Collections
  location: class Main
5 errors
Language: C++

#include <iostream>
using namespace std;

int main(){
    int N;
    cin >> N;
    int A[11];
    for(int i = 0;i < N;++i) cin >> A[i];
    sort(A ,A + N);
    reverse(A, A + N);
    int answer = A[0]/2;
    for(int i = 1;i < N;++i){
        answer += A[i];
    }
    cout << answer << endl;
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |     sort(A ,A + N);
      |     ^~~~
      |     short
a.cc:10:5: error: 'reverse' was not declared in this scope
   10 |     reverse(A, A + N);
      |     ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
int main()
{
    ios;
    ll n ;
    cin >> n ;
    vector<ll> n;
    for(ll i=1;i<=n;++i){
        ll x;
        cin >> x;
        v,push_back(x);
    }
    sort(v.begin() , v.end());
    ll foo = accumulate(v.begin() , v.end() , 0) - v[0]/2;
    cout << foo <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:16: error: conflicting declaration 'std::vector<long long int> n'
   10 |     vector<ll> n;
      |                ^
a.cc:8:8: note: previous declaration as 'll n'
    8 |     ll n ;
      |        ^
a.cc:14:9: error: 'v' was not declared in this scope
   14 |         v,push_back(x);
      |         ^
a.cc:14:11: error: 'push_back' was not declared in this scope
   14 |         v,push_back(x);
      |           ^~~~~~~~~
a.cc:16:10: error: 'v' was not declared in this scope
   16 |     sort(v.begin() , v.end());
      |          ^
Language: Java

public class Main {

    public static void main(String[] args) {
        //Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	int A[] = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        System.out.println(shoppingWithDiscount(A));
    }

    private static int shoppingWithDiscount(int[] a) {
        int totalBill = 0;
        int highest = 0;
        for (int i = 0; i < a.length; i++) {
            totalBill += a[i];
            if (highest < a[i]) {
                highest = a[i];
            }
        }

        return totalBill - highest + highest/2;
    }
}

Compiler output:
Main.java:5: error: cannot find symbol
        int N = sc.nextInt();
                ^
  symbol:   variable sc
  location: class Main
Main.java:8: error: cannot find symbol
            A[i] = sc.nextInt();
                   ^
  symbol:   variable sc
  location: class Main
2 errors
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include <numeric>
using namespace std;

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

    sort(cost.begin(), cost.end());
    cost[n - 1] /= 2;

    cout << accumulate(cost.begin(), cost.end(), 0); << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:54: error: expected primary-expression before '<<' token
   18 |     cout << accumulate(cost.begin(), cost.end(), 0); << endl;
      |                                                      ^~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

    sort(cost.begin(), cost.end());
    cost[n - 1] /= 2;

    cout << accumulate(cost.begin(), cost.end(), 0); << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'accumulate' was not declared in this scope
   17 |     cout << accumulate(cost.begin(), cost.end(), 0); << endl;
      |             ^~~~~~~~~~
a.cc:17:54: error: expected primary-expression before '<<' token
   17 |     cout << accumulate(cost.begin(), cost.end(), 0); << endl;
      |                                                      ^~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

    sort(cost.begin(), cost.end());
    cost[n - 1] /= 2;
    int sum = accumulate(cost.begin(), cost.end(), 0);

    cout << sum << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'accumulate' was not declared in this scope
   16 |     int sum = accumulate(cost.begin(), cost.end(), 0);
      |               ^~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

    sort(cost.begin(), cost.end());
    cost[n - 1] /= 2;

    cout << accumulate(cost.begin(), cost.end(), 0)  << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'accumulate' was not declared in this scope
   17 |     cout << accumulate(cost.begin(), cost.end(), 0)  << endl;
      |             ^~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  
  vector<int> v(n);
  for (int i=0;i<n;i++){
    cin >> v[i];
  }
  
  int max = *std::max_element(v.begin(), v.end());
  std::vector<int>::iterator max_it = std::max_element(vec.begin(), vec.end());
  int min_index = std::distance(vec.begin(), max_it);
  v.erase(max_it);
  int sum = std::accumulate(v.begin(), v.end(), 0);
  sum = sum + max/2;
  cout << sum << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> v(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> v(n);
      |          ^~~
a.cc:10:12: error: 'v' was not declared in this scope
   10 |     cin >> v[i];
      |            ^
a.cc:13:19: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'?
   13 |   int max = *std::max_element(v.begin(), v.end());
      |                   ^~~~~~~~~~~
      |                   tuple_element
a.cc:13:31: error: 'v' was not declared in this scope
   13 |   int max = *std::max_element(v.begin(), v.end());
      |                               ^
a.cc:14:8: error: 'vector' is not a member of 'std'
   14 |   std::vector<int>::iterator max_it = std::max_element(vec.begin(), vec.end());
      |        ^~~~~~
a.cc:14:8: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:14:15: error: expected primary-expression before 'int'
   14 |   std::vector<int>::iterator max_it = std::max_element(vec.begin(), vec.end());
      |               ^~~
a.cc:15:33: error: 'vec' was not declared in this scope
   15 |   int min_index = std::distance(vec.begin(), max_it);
      |                                 ^~~
a.cc:15:46: error: 'max_it' was not declared in this scope
   15 |   int min_index = std::distance(vec.begin(), max_it);
      |                                              ^~~~~~
a.cc:17:18: error: 'accumulate' is not a member of 'std'
   17 |   int sum = std::accumulate(v.begin(), v.end(), 0);
      |                  ^~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N,sum,p[10];
  for (int i=0; i<N; ++i) cin >> p[i];
  int max = p[0];
  for (int i=0; i<N; ++i){
    if(max<p[i]) max = p[i];
  {
  for (int i=0; i<N; ++i) {
      sum += p[i];
  }
   sum -= max/2;
   cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:8:26: note: to match this '{'
    8 |   for (int i=0; i<N; ++i){
      |                          ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N,sum,p[10];
  for (int i=0; i<N; ++i) cin >> p[i];
  int max = p[0];
  for (int i=0; i<N; ++i){
    if(max<p[i]) max = p[i];
  {
  for (int i=0; i<N; ++i) {
      sum += p[i];
  {
   sum -= max/2;
   cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:11:27: note: to match this '{'
   11 |   for (int i=0; i<N; ++i) {
      |                           ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:10:3: note: to match this '{'
   10 |   {
      |   ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:8:26: note: to match this '{'
    8 |   for (int i=0; i<N; ++i){
      |                          ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N,sum,p[10];
  for (int i=0; i<N; ++i) cin >> p[i];
  int max = p[0];
  for (int i=0; i<N; ++i){
    if(max<p[i]) max = p[i]
  {
  for (int i=0; i<N; ++i) {
      sum += p[i];
  {
   sum -= max/2;
   cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:28: error: expected ';' before '{' token
    9 |     if(max<p[i]) max = p[i]
      |                            ^
      |                            ;
   10 |   {
      |   ~                         
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:8:26: note: to match this '{'
    8 |   for (int i=0; i<N; ++i){
      |                          ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N,sum,p[i];
  for (int i=0; i<N; ++i) cin >> p[i];
  int max = p[0];
  for (int i=0; i<N; ++i){
    if(max<p[i]) max = p[i]
  {
  for (int i=0; i<N; ++i) {
      sum += p[i];
  {
   sum -= max;
   cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'i' was not declared in this scope
    5 |   int N,sum,p[i];
      |               ^
a.cc:6:34: error: 'p' was not declared in this scope
    6 |   for (int i=0; i<N; ++i) cin >> p[i];
      |                                  ^
a.cc:7:13: error: 'p' was not declared in this scope
    7 |   int max = p[0];
      |             ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:8:26: note: to match this '{'
    8 |   for (int i=0; i<N; ++i){
      |                          ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int N,sum;
  for (int i=0; i<N; ++i) cin >> p[i];
  int max = p[0];
  for (int i=0; i<N; ++i){
    if(max<p[i]) max = p[i]
  {
  for (int i=0; i<N; ++i) {
      sum += p[i];
  {
   sum -= max;
   cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:34: error: 'p' was not declared in this scope
    6 |   for (int i=0; i<N; ++i) cin >> p[i];
      |                                  ^
a.cc:7:13: error: 'p' was not declared in this scope
    7 |   int max = p[0];
      |             ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:8:26: note: to match this '{'
    8 |   for (int i=0; i<N; ++i){
      |                          ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int N, max = 0, m = 0;
  cin >> N;
  vector<int> p(N);
  
  for(int i = 0; i < N; i++){
    ans = p.at(i);
    if(p.at(i) > p.at(m)){
      m = i;
    }
  }
  
  ans -= p.at(m);
  
  cout << ans << endl;
    
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |     ans = p.at(i);
      |     ^~~
      |     abs
a.cc:17:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |   ans -= p.at(m);
      |   ^~~
      |   abs