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

# encodign: utf-8

while true do
    # ????°??????§???????????? (?????????0??\???1000??\???)
    max = -1
    min = 1001
    # ????¨?????????????
    sum = 0
    # n??????
    n = gets.to_i
    break if n == 0 # 0?????¨????????????
    # n?????????????????????
    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #encodign
    1 | # encodign: utf-8
      |   ^~~~~~~~
a.cc:4:7: error: invalid preprocessing directive #?
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |       ^
a.cc:4:11: error: extended character ° is not valid in an identifier
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |           ^
a.cc:4:18: error: extended character § is not valid in an identifier
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |                  ^
a.cc:4:57: warning: trigraph ??) ignored, use -trigraphs to enable [-Wtrigraphs]
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
a.cc:7:7: error: invalid preprocessing directive #?
    7 |     # ????¨?????????????
      |       ^
a.cc:9:7: error: invalid preprocessing directive #n
    9 |     # n??????
      |       ^
a.cc:11:21: error: stray '#' in program
   11 |     break if n == 0 # 0?????¨????????????
      |                     ^
a.cc:12:7: error: invalid preprocessing directive #n
   12 |     # n?????????????????????
      |       ^
a.cc:3:1: error: expected unqualified-id before 'while'
    3 | while true do
      | ^~~~~
Language: C++

# encoding: utf-8

while true do
    # ????°??????§???????????? (?????????0??\???1000??\???)
    max = -1
    min = 1001
    # ????¨?????????????
    sum = 0
    # n??????
    n = gets.to_i
    break if n == 0 # 0?????¨????????????
    # n?????????????????????
    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #encoding
    1 | # encoding: utf-8
      |   ^~~~~~~~
a.cc:4:7: error: invalid preprocessing directive #?
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |       ^
a.cc:4:11: error: extended character ° is not valid in an identifier
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |           ^
a.cc:4:18: error: extended character § is not valid in an identifier
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |                  ^
a.cc:4:57: warning: trigraph ??) ignored, use -trigraphs to enable [-Wtrigraphs]
    4 |     # ????°??????§???????????? (?????????0??\???1000??\???)
a.cc:7:7: error: invalid preprocessing directive #?
    7 |     # ????¨?????????????
      |       ^
a.cc:9:7: error: invalid preprocessing directive #n
    9 |     # n??????
      |       ^
a.cc:11:21: error: stray '#' in program
   11 |     break if n == 0 # 0?????¨????????????
      |                     ^
a.cc:12:7: error: invalid preprocessing directive #n
   12 |     # n?????????????????????
      |       ^
a.cc:3:1: error: expected unqualified-id before 'while'
    3 | while true do
      | ^~~~~
Language: C++

#!/usr/bin/env ruby -
# coding: utf-8

while true do
    # ????°??????§???????????? (?????????0??\???1000??\???)
    max = -1
    min = 1001
    # ????¨?????????????
    sum = 0
    # n??????
    n = gets.to_i
    break if n == 0 # 0?????¨????????????
    # n?????????????????????
    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env ruby -
      |  ^
a.cc:2:3: error: invalid preprocessing directive #coding
    2 | # coding: utf-8
      |   ^~~~~~
a.cc:5:7: error: invalid preprocessing directive #?
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |       ^
a.cc:5:11: error: extended character ° is not valid in an identifier
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |           ^
a.cc:5:18: error: extended character § is not valid in an identifier
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |                  ^
a.cc:5:57: warning: trigraph ??) ignored, use -trigraphs to enable [-Wtrigraphs]
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
a.cc:8:7: error: invalid preprocessing directive #?
    8 |     # ????¨?????????????
      |       ^
a.cc:10:7: error: invalid preprocessing directive #n
   10 |     # n??????
      |       ^
a.cc:12:21: error: stray '#' in program
   12 |     break if n == 0 # 0?????¨????????????
      |                     ^
a.cc:13:7: error: invalid preprocessing directive #n
   13 |     # n?????????????????????
      |       ^
a.cc:4:1: error: expected unqualified-id before 'while'
    4 | while true do
      | ^~~~~
Language: C++

#!/usr/bin/ruby
# -*- coding: utf-8 -*-

while true do
    # ????°??????§???????????? (?????????0??\???1000??\???)
    max = -1
    min = 1001
    # ????¨?????????????
    sum = 0
    # n??????
    n = gets.to_i
    break if n == 0 # 0?????¨????????????
    # n?????????????????????
    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/ruby
      |  ^
a.cc:2:3: error: invalid preprocessing directive #-
    2 | # -*- coding: utf-8 -*-
      |   ^
a.cc:5:7: error: invalid preprocessing directive #?
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |       ^
a.cc:5:11: error: extended character ° is not valid in an identifier
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |           ^
a.cc:5:18: error: extended character § is not valid in an identifier
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |                  ^
a.cc:5:57: warning: trigraph ??) ignored, use -trigraphs to enable [-Wtrigraphs]
    5 |     # ????°??????§???????????? (?????????0??\???1000??\???)
a.cc:8:7: error: invalid preprocessing directive #?
    8 |     # ????¨?????????????
      |       ^
a.cc:10:7: error: invalid preprocessing directive #n
   10 |     # n??????
      |       ^
a.cc:12:21: error: stray '#' in program
   12 |     break if n == 0 # 0?????¨????????????
      |                     ^
a.cc:13:7: error: invalid preprocessing directive #n
   13 |     # n?????????????????????
      |       ^
a.cc:4:1: error: expected unqualified-id before 'while'
    4 | while true do
      | ^~~~~
Language: C++

while true do
    # ????°??????§???????????? (?????????0??\???1000??\???)
    max = -1
    min = 1001
    # ????¨?????????????
    sum = 0
    # n??????
    n = gets.to_i
    break if n == 0 # 0?????¨????????????
    # n?????????????????????
    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:2:7: error: invalid preprocessing directive #?
    2 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |       ^
a.cc:2:11: error: extended character ° is not valid in an identifier
    2 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |           ^
a.cc:2:18: error: extended character § is not valid in an identifier
    2 |     # ????°??????§???????????? (?????????0??\???1000??\???)
      |                  ^
a.cc:2:57: warning: trigraph ??) ignored, use -trigraphs to enable [-Wtrigraphs]
    2 |     # ????°??????§???????????? (?????????0??\???1000??\???)
a.cc:5:7: error: invalid preprocessing directive #?
    5 |     # ????¨?????????????
      |       ^
a.cc:7:7: error: invalid preprocessing directive #n
    7 |     # n??????
      |       ^
a.cc:9:21: error: stray '#' in program
    9 |     break if n == 0 # 0?????¨????????????
      |                     ^
a.cc:10:7: error: invalid preprocessing directive #n
   10 |     # n?????????????????????
      |       ^
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while true do
      | ^~~~~
Language: C++

while true do

    max = -1
    min = 1001

    sum = 0

    n = gets.to_i


    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while true do
      | ^~~~~
Language: C++



while true do
    max = -1
    min = 1001
    sum = 0
    n = gets.to_i
    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:3:1: error: expected unqualified-id before 'while'
    3 | while true do
      | ^~~~~
Language: C++

while true do
    max = -1
    min = 1001
    sum = 0
    n = gets.to_i
    break if n == 0
    n.times do
        v = gets.to_i
        min = v if v < min
        max = v if v > max
        sum += v
    end
    sum -= (min + max)
    p sum / (n-2)
end

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while true do
      | ^~~~~
Language: C++

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

int main(){
    int a,n;
    for(;;){
        vector<int> num;
        cin>>n;
        if(n==0) break;
        for(int i = 0; i < n; i++){
            cin>>a;
            num.push_back(a);
        }
        sort(num.begin(), num.end());
        num.erase(num.begin());
         num.pop_back();
        int sum=0;
        for(int x : num){
            sum+=x;
        }
        sum/=num.length();
        cout<<sum<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:18: error: 'class std::vector<int>' has no member named 'length'
   23 |         sum/=num.length();
      |                  ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    for(;;){
        int a,n,s=0,max=0,min=INT_MAX;
        cin>>n;
        if(n==0) break;
        for(int i = 0; i < n; i++){
            cin>>a;
            s+=a;
            if(max<a) max=a;
            if(min>a) min=a;
        }
        cout<<(s-max-min)/n<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:31: error: 'INT_MAX' was not declared in this scope
    8 |         int a,n,s=0,max=0,min=INT_MAX;
      |                               ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

import math
import copy

def average(points):
    sum = 0
    for i in points:
        sum += i
    return sum / len(points)

outputs = []

while True:
    num = int(input())
    if num == 0:
        break

    points = []
    for _ in range(num):
        point = int(input())
        points.append(point)

    points = sorted(points)
    points = points[1:len(points)-1]

    ave = average(points)
    outputs.append(int(ave))

for ave in outputs:
    print(ave)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
using namespace std;
int main(){
int judge;
int maxscore =0;
int minscore =0;
cin >> judge;
if(i != 0){
int score[judge];
	for(int i=0; i<judge; i++){
	cin >> score[i];
		if(score[i] > maxscore){
		maxscore = score[i];
		}
		if(score[i] < minscore){
		minscore = score[i];
		}
		if(i==0){
		minscore = score[0];
		}
	}
int lastscore = 0;
for(int j=0;j<judge;j++){
lastscore +=  score[j];
}
lastscore = (lastscore - maxscore - minscore)/(judge - 2);
cout << lastscore <<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:4: error: 'i' was not declared in this scope
    8 | if(i != 0){
      |    ^
Language: C++

#include<iostream>
using namespace std;
int main(){
int judge;
int maxscore =0;
int minscore =0;
int totalscore = 0;
cin >> judge;
if(judge != 0){
	int score;	
	for(int i=0; i<judge; i++){
	cin >> score;
		if(score[i] > maxscore){
		maxscore = score;
		}
		if(score[i] < minscore){
		minscore = score;
		}
		if(i==0){
		minscore = score;
		}
	totalscore += score;
	}

int lastscore = (totalscore - maxscore - minscore)/(judge - 2);
cout << lastscore <<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: invalid types 'int[int]' for array subscript
   13 |                 if(score[i] > maxscore){
      |                         ^
a.cc:16:25: error: invalid types 'int[int]' for array subscript
   16 |                 if(score[i] < minscore){
      |                         ^
Language: C++

#include <iostream>
using namespace std;
int larger(int x,int y) {
	int z = 0;
	if (x > y)z = x;
	else z = y;
	return z;
}
int smaller(int x, int y) {
	int z = 0;
	if (x < y)z = x;
	else z = y;
	return z;
}
int main(void) {
	int s = 1;
	while (s == 1) {
		int sinsa, a[100], sum = 0, ave;
		cin >> sinsa;
		if (sinsa == 0)s = 2;
		for (int i = 0; i < sinsa; i++) {
			cin >> a[i];
		}
		int n = a[0];
		for (int i = 0; i < sinsa; i++) {
			n = larger(n, a[i]);
		}
		int m = a[0];
		for (int i = 0; i < sinsa; i++) {
			m = smaller(m, a[i]);
		}
		for (int i = 0; i < sinsa; i++) {
			sum += a[i];
		}
		sum = sum - n - m;
		ave = sum / (sinsa - 2);
		cout << ave<<endl;
	}

	return 0;

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

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

int main()
{
  int n;
  while(cin >> n, n){
    vector<int> s(n);
    for(int i = 0; i < n; i++) cin >> s[i];
    sort(s.begin(), s.end());

    int sum = 0;
    int i;
    for(i = 1; i < n - 1; i++) sum += s[i];
    cout << sum / (i - 1) << endl;
  }

    return 0;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(s.begin(), s.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int N, n, sum, largest, smallest;
	sum  = 0; largest = 0; smallest = 1000;
	
	while(cin >> N; && N>0){
		for(int i = 0; i<N; i++)
		{
			cin >> n;
			sum += n;
			
			if(smallest > n){ smallest = n;}
			if(largest < n){ largest = n;}
		}
	
		cout << (sum-smallest-largest)/(N-2) << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: expected ')' before ';' token
    9 |         while(cin >> N; && N>0){
      |              ~        ^
      |                       )
a.cc:9:29: error: ordered comparison of pointer with integer zero ('void*' and 'int')
    9 |         while(cin >> N; && N>0){
      |                         ~~~~^~
a.cc:9:28: error: label 'N' used but not defined
    9 |         while(cin >> N; && N>0){
      |                            ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    while(1){
        cin>>n;
        if(n==0)break;
        vector<int> s(n);
        for(int i=0;i<n;i++){
            cin>>s[i];
        }
        sort(s.begin(),s.end());
        long long ans=0;
        for(int i=1;i<n-1;i++){
            ans+=s[i];
        }
        cout<<ans/(n-2)<<endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<int> s(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:9:16: error: expected primary-expression before 'int'
    9 |         vector<int> s(n);
      |                ^~~
a.cc:11:18: error: 's' was not declared in this scope
   11 |             cin>>s[i];
      |                  ^
a.cc:13:14: error: 's' was not declared in this scope
   13 |         sort(s.begin(),s.end());
      |              ^
Language: C++

int main()
{
    int a,b[100];
    int max=0,min=100,sum=0,result;
    for(int i=0;i<a;i++){
        cin>>b[i];
        sum+=b[i];
        if(b[i]<min){
            min=b[i];
        }
        else if(b[i]>max){
            max=b[i];
        }
    }
    result=sum-min-max;
    cout<<result;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'min'?
    6 |         cin>>b[i];
      |         ^~~
      |         min
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout<<result;
      |     ^~~~
Language: C++

while True:
    n = int(raw_input())

    if n == 0:
        break

    L = [int(raw_input()) for _ in range(n)]

    print (sum(L) - max(L) - min(L)) / (n - 2)



Compiler output:
a.cc:1:1: error: expected unqualified-id before 'while'
    1 | while True:
      | ^~~~~
Language: C++

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

using namespace std;

int main() {
    int n;
    while (true) {
        cin >> n;
        if (!n) { break; }

        vector<int> v(n);

        for (int i = 0; i < n; i++) { cin >> v[i]; }
        v.sort(v.begin(), v.end());

        int sum = 0;
        for (int i = 1; i < n-1; i++) {
            sum += v[i];
        }

        cout << sum / (n-2) << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: 'class std::vector<int>' has no member named 'sort'
   16 |         v.sort(v.begin(), v.end());
      |           ^~~~
Language: C++

#include <iostream>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    int n, tmp;
    int ans = 0;
    while(cin >> n && n) {
        vector<int> in;
        for(int i=0; i<n; ++i) {
            cin >> tmp;
            in.push_back(tmp);
        }
        sort(in.begin(), in.end());
        for(int i=1; i<n-1; ++i) ans += in[i];
        cout << ans/(n-2) << endl;
    }
}


Compiler output:
a.cc:2:10: fatal error: boost/foreach.hpp: No such file or directory
    2 | #include <boost/foreach.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

import java.util.Arrays;
import java.util.Scanner;
public class main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		while(true){
			int sum=0;
			int ave=0;
			int n=scan.nextInt();
			if(n==0){
				break;
			}
			int[] s = new int[n];
			for(int i = 0;i < n;i++){
				s[i]=scan.nextInt();
			}
			Arrays.sort(s);
			for(int i=1;i<n-1;i++){
				sum+=s[i];
			}
			ave=sum/(n-2);
			System.out.println(ave);
		}
	}
}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class main {
      | ^~~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

// boost
#define USE_BOOST_IN_CODE
#ifdef USE_BOOST_IN_CODE
#include <boost\range.hpp>
#include <boost\range\algorithm.hpp>
#include <boost\range\numeric.hpp>
#include <boost\range\irange.hpp>
#include <boost\range\adaptor\strided.hpp>
#include <boost\range\adaptor\transformed.hpp>
#include <boost\format.hpp>
#endif


using ll = long long;

//vector
template <class T>
using vec = std::vector<T>;

//namespace std
//{
//    template<>
//    class hash<Key>
//    {
//    public:
//        size_t operator() (const Key& key) const
//        {
//            size_t seed = 0;
//            auto i_hash = hash<int>()(key.i_th);
//            auto w_hash = hash<int>()(key.W);
//
//            seed ^= i_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
//            seed ^= w_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
//
//            return seed;
//        }
//    };
//}

void solve()
{
    using namespace std;

    int count {};
    int n;
    while (cin >> n)
    {
        if (n == 0)
            break;

        vec<int> v(n);
        for (auto& x : v)
            cin >> x;

        boost::sort(v);

        cout << accumulate(v.cbegin() + 1, v.cend() - 1, 0) / (n - 2) << endl;
        ++count;
    }

}

int main()
{
    solve();
    return 0;
}


Compiler output:
a.cc:24:10: fatal error: boost\range.hpp: No such file or directory
   24 | #include <boost\range.hpp>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main(void){
  while(true){
    long n;
    cin >> n;
    if(n == 0){
      break;
    }
    vector<long> S;
    for(int i = 0; i < n;++i){
      long s;
      cin >> s;
      S.push_back(s);
    }
      long mx = *max_element(S.begin(), S.end());
      long mn = *min_element(S.begin(), S.end());
      long sum = accumulate(S.begin(), S.end(), 0);
      cout << (sum - mx - mn) / (n - 2)  << endl;
  }
 return 0;
}



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

#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

int main(){
  ll N;
  cin>>N;
  ll T[i];
  ll sum=0;
  for(ll i=0; i<N; ++i){
    cin>>T[i];
    sum+=T[i];
  }
  cout<<sum/N<<endl;
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:8: error: 'i' was not declared in this scope
   23 |   ll T[i];
      |        ^
a.cc:26:10: error: 'T' was not declared in this scope
   26 |     cin>>T[i];
      |          ^
Language: C++

#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<random>
#include<string>
typedef long long ll;
using namespace std;
int main(){
  ll N;
  ll s[1100];
  ll sum=0;
  ll t=0;
  while(t<=20){
  s++;
  cin >> N;
  for(ll i = 0; i < N; ++i;){
      cin >> s[i];
  }
  sort(s,s+N);
  for(ll i = 1; i < N-1; ++i){
    sum+=s[i];
  }
  cout<<sum/(N-2)<<endl;
}
}
    
  
  
  





Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: lvalue required as increment operand
   18 |   s++;
      |   ^
a.cc:20:27: error: expected ')' before ';' token
   20 |   for(ll i = 0; i < N; ++i;){
      |      ~                    ^
      |                           )
a.cc:20:28: error: expected primary-expression before ')' token
   20 |   for(ll i = 0; i < N; ++i;){
      |                            ^
Language: C++

#include<bits/stdc++h>
typedef long long ll;
using namespace std;
int main(){
  ll N;
  ll s[1100];
  ll sum=0;
  while(N){
  cin >>N;
  for(ll i = 0; i < N; ++i){
      cin >> s[i];
  }
  sort(s,s+N);
  for(ll i = 1; i < N-1; ++i){
    sum+=s[i];
  }
  cout<<sum/(N-2)<<endl;
  cin>>N;
}
}
    
  
  
  





Compiler output:
a.cc:1:9: fatal error: bits/stdc++h: No such file or directory
    1 | #include<bits/stdc++h>
      |         ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
typedef long long ll;
using namespace std;
int main(){
  ll N;
  ll s[1100];
  ll sum=0;
  ll t=1;
  while(N){
  cin >>N;
  for(ll i = 0; i < N; ++i){
      cin >> s[i];
  }
  sort(s,s+N);
  for(ll i = 1; i < N-1; ++i){
    sum+=s[i];
  }
  cout<<sum/(N-2)<<endl;
  cin>>N;
}
}
    
  
  
  





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

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
  ll N;
  ll s[1100];
  ll sum=0;
cin>>N;
  while(N){
  for(ll i = 0; i < N; ++i){
      cin >> s[i];
  }
  sort(s,s+N);
  for(ll i = 1; i < N-1; ++i){
    sum+=s[i];
  }
  cout<<sum/(N-2)<<endl;
  cin>>N;
  }
}
}
    
  
  
  





Compiler output:
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
#include<type_traits>
long long int D[400000000];
long long int E[400000000];

using namespace std;
int main() {
	long long int N;
	long long int Y = -1;
	cin >> N;
	while (N) {
		Y++;
		for (long long int i = 0; i < N; i++) {
			cin >> D[i];
		}

		sort(D, D + N);
		long long int W = 0;
		for (long long int i = 1; i < N-1; i++) {
			W += D[i];
		}
		E[Y] = W / (N-2);
		cin >> N;
		
	}

	for (long long int i = 0; i <=Y ;i++) {
		cout << E[i] << endl;
	}
	return 0;
}




Compiler output:
/tmp/ccAIcKAw.o: in function `main':
a.cc:(.text+0xfc): relocation truncated to fit: R_X86_64_PC32 against symbol `E' defined in .bss section in /tmp/ccAIcKAw.o
a.cc:(.text+0x140): relocation truncated to fit: R_X86_64_PC32 against symbol `E' defined in .bss section in /tmp/ccAIcKAw.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
using namespace std;

int main(){
	int n, s, sum, max, min, i;
	while((cin >> n), n){
		sum = max = 0;
		min = 1000;
		for(i = 0; i < n; i++){
			cin >> s;
			sum += s;
			max = max(max, s);
			min = min(min, s);
		}
		cout << (int)(sum / n) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:34: error: 'max' cannot be used as a function
   12 |                         max = max(max, s);
      |                               ~~~^~~~~~~~
a.cc:13:34: error: 'min' cannot be used as a function
   13 |                         min = min(min, s);
      |                               ~~~^~~~~~~~
Language: C++

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

int main(){
	int n, s, sum, max, min, i;
	while((cin >> n), n){
		sum = max = 0;
		min = 1000;
		for(i = 0; i < n; i++){
			cin >> s;
			sum += s;
			max = max(max, s);
			min = min(min, s);
		}
		cout << (int)(sum / n) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:34: error: 'max' cannot be used as a function
   13 |                         max = max(max, s);
      |                               ~~~^~~~~~~~
a.cc:14:34: error: 'min' cannot be used as a function
   14 |                         min = min(min, s);
      |                               ~~~^~~~~~~~
Language: C++

#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	while(n){
		int p[100];
		for(int i = 0; i < n; i++){
			cin >> p[i];
		}
		sort(p,p+n);
		int a = 0;
		for(int i = 1; i < n-1; i++){
			a += p[i];
		}
		cout << a/(n-2) << endl;
		cin >> n;
	}
}

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

#include <iostream>
using namespace std;

int main()
{
	int number;
	int score, sum, max, min;
	
	while(true)
	{
		cin >> number;
		if(!number) return 0;
		sum = 0, max = 0, min = 1000;
		for(int i = 0; i < number; ++i)
		{
			cin >> score;
			sum += score;
			if(score[i] > max) max = score;
			if(score[i] < min) min = score;
		}
		cout << (sum - max - min) / (number - 2) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:33: error: invalid types 'int[int]' for array subscript
   18 |                         if(score[i] > max) max = score;
      |                                 ^
a.cc:19:33: error: invalid types 'int[int]' for array subscript
   19 |                         if(score[i] < min) min = score;
      |                                 ^
Language: C++

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

int main(){
int n;
while(cin >>n){
	if(n == 0) break;
	vector<int> vec;
	int tmp, max, min;
	cin >>tmp;
	vec.push_back(tmp);
	max = tmp;
	min = tmp;
	bool maxb = true, minb = true;
	for(int i = 1; i < n; i++){
		cin >>tmp;
		vec.push_back(tmp);
		if(tmp < max) max = tmp;
		if(tmp > min) min = tmp;
	}
	int sum = 0;
	for(int i = 0; i < vec.size(); i++){
	if(vec[i] == max && maxb){
		maxb = false;
	} else if(vec[i] == min && minb){
		minb =false;
	} else{
		vec[i] += sum;
	}
	cout <<sum <<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:7:15: note: to match this '{'
    7 | while(cin >>n){
      |               ^
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
	int n;
	while(cin >>n){
		if(n == 0) break;
		vector<int> vec;
		int tmp, max, min;
		cin >>tmp;
		vec.push_back(tmp);
		max = tmp;
		min = tmp;
		bool maxb = true, minb = true;
		for(int i = 1; i < n; i++){
			cin >>tmp;
			vec.push_back(tmp);
			if(tmp < max) max = tmp;
			if(tmp > min) min = tmp;
		}
		int sum = 0;
		for(int i = 0; i < vec.size(); i++){
		if(vec[i] == max && maxb){
			maxb = false;
		} else if(vec[i] == min && minb){
			minb =false;
		} else{
			vec[i] += sum;
		}
		cout <<sum <<endl;
		return 0;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
    while (1){
	int n;
	vector<int> s;
	
	cin >> n;
	if (n == 0) break;
	int t;
	for (int i = 0; i < n; i++){
	    cin >> t;
	    s.push_back(t);
	}
	sort(s.begin(), s.end());

	int score = 0;
	for (int i = 1; i < s.size() - 1; i++){
	    score += s[i];
	}
	score /= s.size() - 2;

	cout << score << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |         sort(s.begin(), s.end());
      |         ^~~~
      |         short
Language: C++

#include<iostream>
using namespace std;cat 
int n,sum,max,min;
int main(){
	while(cin>>n&&N>0){
		int S;
		sum=0;
		for(int i=0;i<n;i++){
			cin>>S;
			sum+=S;
			if(min>S){
				min=S;
			}
			if(max<S){
				max=S;
			}
		}
		sum-=(min+max);
		cout<<sum/n<<endl;
	}
}

Compiler output:
a.cc:2:21: error: 'cat' does not name a type
    2 | using namespace std;cat
      |                     ^~~
a.cc: In function 'int main()':
a.cc:5:20: error: 'n' was not declared in this scope
    5 |         while(cin>>n&&N>0){
      |                    ^
a.cc:5:23: error: 'N' was not declared in this scope
    5 |         while(cin>>n&&N>0){
      |                       ^
a.cc:7:17: error: 'sum' was not declared in this scope
    7 |                 sum=0;
      |                 ^~~
a.cc:11:31: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>'
   11 |                         if(min>S){
      |                            ~~~^~
a.cc:12:37: error: overloaded function with no contextual type information
   12 |                                 min=S;
      |                                     ^
a.cc:14:28: error: parse error in template argument list
   14 |                         if(max<S){
      |                            ^~~~~
a.cc:14:33: error: cannot resolve overloaded function 'max' based on conversion to type 'bool'
   14 |                         if(max<S){
      |                                 ^
a.cc:15:37: error: overloaded function with no contextual type information
   15 |                                 max=S;
      |                                     ^
a.cc:18:26: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator+'
   18 |                 sum-=(min+max);
      |                       ~~~^~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int n,m;
	int ave[1000]={0};

	m=0;
	while(1){
		int point[100]={0};
		int min=1000;
		int max=0;
		cin>>n;
		if(n==0) break;
		for(int i=0;i<n;i++){
			cin>>point[i];
			if(point[i]>max) max=point[i];
			if(point[i]<min) min=point[i];
			ave[m]++;
		}
		ave[m]=(ave[m]-max-min)/(n-2);
	m++;
	}
	for(i=0;i<m;i++){
		cout<<ave[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: 'i' was not declared in this scope
   25 |         for(i=0;i<m;i++){
      |             ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n, s, sum, max, min;
  while(1){
    cin >> n;
    if(n == 0) break;
    sum = 0;
    cin >> s;
    sum += s;
    max = s;
    cin >> s;
    sum += s;
    if(max < s){
      max = s;
    }else{
      min = s;
    }
    for(int i = 2; i < n; i++){
      cin >> s;
      sum += s;
      if(max < s){
	max = s;
      }else if{
	(min > s) min = s;
      }
    }
    sum -= max;
    sum -= min;
    int ave = sum / (n-2);

    cout << ave << endl;
  }

  return 0;
}

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

#include <iostream>
#include <cmath>

using namespace std;

void find_max(int data[], int N){
  int flag = -1;
  int max = 0;
  for (int i=0; i<N; ++i){
    if (max < data[i]){
      max = data[i];
      flag = i;
    }
  }
  data[flag] = 0;
}

void find_min(int data[], int N){
  int flag = -1;
  int min = 1000000;
  for (int i=0; i<N; ++i){
    if (min > data[i]){
      min = data[i];
      flag = i;
    }
  }
  data[flag] = 0;
}

int main(void){
  int n;
  while (cin >> n){
    if (n == 0){
      return -1;
    }
    
    int data[20];
    memset(data, 0, sizeof(data));
    
    for (int i=0; i<n; ++i){
      cin >> data[i];
    }
    find_min(data, n);
    find_max(data, n);
    int sum = 0;
    for (int i=0; i<n; ++i){
      sum += data[i];
    }
    int total = floor((double)sum/(n-2));
    cout << total << endl;
  }
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: 'memset' was not declared in this scope
   38 |     memset(data, 0, sizeof(data));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cmath>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <iostream>
using namespace std;

int main(){
	int n;
	while(cin >> n,n){
		int s[100],min = 1000,max = 0,sum = 0;
		for(int i = 0; i < n; i++){
			cin >> s[i];
			sum += s[i];
			if(s[i] < min){
				min = s[i];
			}
			if(s[i] > max){
				max = s[i];
			}
		}
		sum -= min + max;
		cout << floor(double(sum/(n-2))) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'floor' was not declared in this scope
   19 |                 cout << floor(double(sum/(n-2))) << endl;
      |                         ^~~~~
Language: C++

#include <iostream>
using namespace std;
int N, A[1024],Max,Min,Sum;

int main(){
 while(cin >> N && N>0){
  for (int i=0; i<N; ++i)
    cin >> A[i];
  for (int j=0; j<(N-1); ++j){
    Max=A[0];
	if(A[j+1]>A[j]) Max=A[j+1];
    }
  for (int k=0; k<(N-1); ++k){
    Min=A[0];
	if(A[k+1]<A[k]) Min=A[k+1];
	}
  for (int l=0; l<N; ++l){
    Sum += A[l];
	}
  cout<< (Sum-Max-Min)/(N-2) << endl;
  Sum=0;
  Max=0
  Min=0
 }
}	
	

Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: expected ';' before 'Min'
   22 |   Max=0
      |        ^
      |        ;
   23 |   Min=0
      |   ~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	while(true){
		int score;
		int n;
		int maxs,mins;
		vector<int> s(n);
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin>>s[i];
		}
		maxs=*max_element(s.begin(),s.end());
		mins=*min_element(s.being(),s.end());
		for(int i=0;i<n;i++){
			score+=s[i];
		}
		cout<<(score-maxs-mins)/(n-2)<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:37: error: 'class std::vector<int>' has no member named 'being'
   17 |                 mins=*min_element(s.being(),s.end());
      |                                     ^~~~~
Language: C++

#include <cstdio>
#include <vector>
using namespace std;
int main(){
    int n;
    for(;;){
        scanf("%d",&n);
        if(n==0) break;
        vector<int> ar(n);
        for(int &x : ar){
            scanf("%d",&x);
        }
        sort(ar.begin(),ar.end());
        int sum=0;
        for(int i=1;i<n-1;i++){
            sum+=ar[i];
        }
        printf("%d\n",sum/(n-2));
    }
}

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

#include <cstdio>

int main()
{
int n;
vector<int> s;
scanf("%d", &n);
s.resize(n);
for(int i = 0; i < n; ++i)
scanf("%d", &s[i]);
sort(s.begin(), s.end());
int sum = 0;
for(int i = 1; i < n - 1; ++i)
sum += s[i];
printf("%d\n", sum / (n - 2));
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: 'vector' was not declared in this scope
    6 | vector<int> s;
      | ^~~~~~
a.cc:6:8: error: expected primary-expression before 'int'
    6 | vector<int> s;
      |        ^~~
a.cc:8:1: error: 's' was not declared in this scope
    8 | s.resize(n);
      | ^
a.cc:11:1: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 | sort(s.begin(), s.end());
      | ^~~~
      | short
Language: C++

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

int main()
{
int n;
vector<int> s;
scanf("%d", &n);
s.resize(n);
for(int i = 0; i < n; ++i)
scanf("%d", &s[i]);
sort(s.begin(), s.end());
int sum = 0;
for(int i = 1; i < n - 1; ++i)
sum += s[i];
printf("%d\n", sum / (n - 2));
return 0;
}

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

#include <iostream>
using namespace std;

int N, S;

int main()
{
   while ( cin >> N && N>0)
   {
      int M = -1, m = 1001 ,addup = 0;
      for ( i = 0; i<N; i++)
      {
         cin >> S;
         addup += S;
         if ( S > M) M = S;
         if ( S < m) m = S;
      }
   }
   cout << (addup - M - m)/(n-2)  << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'i' was not declared in this scope
   11 |       for ( i = 0; i<N; i++)
      |             ^
a.cc:19:13: error: 'addup' was not declared in this scope
   19 |    cout << (addup - M - m)/(n-2)  << endl;
      |             ^~~~~
a.cc:19:21: error: 'M' was not declared in this scope
   19 |    cout << (addup - M - m)/(n-2)  << endl;
      |                     ^
a.cc:19:25: error: 'm' was not declared in this scope; did you mean 'tm'?
   19 |    cout << (addup - M - m)/(n-2)  << endl;
      |                         ^
      |                         tm
a.cc:19:29: error: 'n' was not declared in this scope
   19 |    cout << (addup - M - m)/(n-2)  << endl;
      |                             ^
Language: C++

#include <iostream>
using namespace std;

int N, S;

int main(){
   while ( cin >> N && N>0){
      int M = -1, m = 1001 ,addup = 0;
      for ( i = 0; i<N; i++){
         cin >> S;
         addup += S;
         if ( S > M) M = S;
         if ( S < m) m = S;
      }
   }
   cout << (addup - M - m)/(n-2)  << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'i' was not declared in this scope
    9 |       for ( i = 0; i<N; i++){
      |             ^
a.cc:16:13: error: 'addup' was not declared in this scope
   16 |    cout << (addup - M - m)/(n-2)  << endl;
      |             ^~~~~
a.cc:16:21: error: 'M' was not declared in this scope
   16 |    cout << (addup - M - m)/(n-2)  << endl;
      |                     ^
a.cc:16:25: error: 'm' was not declared in this scope; did you mean 'tm'?
   16 |    cout << (addup - M - m)/(n-2)  << endl;
      |                         ^
      |                         tm
a.cc:16:29: error: 'n' was not declared in this scope
   16 |    cout << (addup - M - m)/(n-2)  << endl;
      |                             ^
Language: C++

#include <iostream>
using namespace std;

int N, S;

int main(){
   while ( cin >> N && N>0){
      int M, m, addup;
      M = -1;
      m = 1001;
      addup = 0;
      for ( i = 0; i<N; i++){
         cin >> S;
         addup += S;
         if ( S > M) M = S;
         if ( S < m) m = S;
      }
   cout << (addup - M - m)/(n-2)  << endl;
   }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'i' was not declared in this scope
   12 |       for ( i = 0; i<N; i++){
      |             ^
a.cc:18:29: error: 'n' was not declared in this scope
   18 |    cout << (addup - M - m)/(n-2)  << endl;
      |                             ^
Language: Java

/**
 * Analyzing Login/Logout Records
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

public class P1148 {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		while (!(line = br.readLine()).equals("0 0")) {

			// record logs.
			Map<Integer, List<int[]>> log = new HashMap<Integer, List<int[]>>();
			StringTokenizer st;

			int r = parseInt(br.readLine());
			for (int i = 0; i < r; i++) {
				st = new StringTokenizer(br.readLine());
				int t, n, m, s;
				t = parseInt(st.nextToken());
				n = parseInt(st.nextToken());//not use
				m = parseInt(st.nextToken());
				s = parseInt(st.nextToken());
				if (!log.containsKey(m)) {
					log.put(m, new ArrayList<int[]>());
				}
				log.get(m).add(new int[]{t, s == 1 ? 1 : -1});
			}

			// answer
			int q = parseInt(br.readLine());
			for (int i = 0; i < q; i++) {
				st = new StringTokenizer(br.readLine());
				int ts, te, m;
				ts = parseInt(st.nextToken());
				te = parseInt(st.nextToken());
				m = parseInt(st.nextToken());
				int login = 0, total = 0;
				if (log.containsKey(m)) {
					for (int[] t : log.get(m)) {
						login += t[1];
						if (t[0] <= ts) {
							total = login > 0 ? te - ts : 0;
						} else if (ts < t[0] && t[0] < te) {
							if (t[1] == 1 && login == 1) {
								total += te - t[0];
							}
							if (t[1] == -1 && login == 0) {
								total -= te - t[0];
							}
						} else {
							break;
						}
					}
				}
				System.out.println(total);
			}
		}//end while
	}//end main
}

Compiler output:
Main.java:12: error: class P1148 is public, should be declared in a file named P1148.java
public class P1148 {
       ^
1 error
Language: Java

import java.util.HashMap;
import java.util.Scanner;

public class QbLoginLogout {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (true) {
      HashMap<Integer, Student> map = new HashMap<>();
      int n = sc.nextInt();
      int m = sc.nextInt();
      if ((n | m) == 0) {
        break;
      }
      for (int i = 0; i < m; i++) {
        map.put(i + 1, new Student(n));
      }
      int r = sc.nextInt();
      for (int i = 0; i < r; i++) {
        int t = sc.nextInt() - 540;
        int ni = sc.nextInt();
        int mi = sc.nextInt();
        int s = sc.nextInt();
        if (s == 1) {
          map.get(mi).login(ni, t);
        } else {
          map.get(mi).logout(ni, t);
        }
      }
      int q = sc.nextInt();
      for (int i = 0; i < q; i++) {
        int ts = sc.nextInt() - 540;
        int te = sc.nextInt() - 540;
        int m3 = sc.nextInt();
        int res = map.get(m3).time(ts, te);
        System.out.println(res);
      }
    }
  }

  static class Student {
    boolean[] login = new boolean[721];
    int[] cache;

    Student(int n) {
      this.cache = new int[n + 1];
    }

    void login(int n, int t) {
      cache[n] = t;
    }

    void logout(int n, int t) {
      for (int i = this.cache[n]; i < t; i++) {
        this.login[i] = true;
      }
    }

    int time(int ts, int te) {
      int c = 0;
      for (int i = ts; i < te; i++) {
        c += this.login[i] ? 1 : 0;
        // System.out.println(i + ":" + (this.login[i] ? 1 : 0));
      }
      return c;
    }
  }
}

Compiler output:
Main.java:4: error: class QbLoginLogout is public, should be declared in a file named QbLoginLogout.java
public class QbLoginLogout {
       ^
1 error
Language: Java

import java.util.*;
public class main {
	public static void main(String[] args) {
		int N, M, r, q, t, n, m, s, ts, te, hoge;
		String output = "";
		Scanner scan = new Scanner(System.in);
		
		for(int set = 0; set < 10; set++){
			int pc_count = scan.nextInt();//N
			int student_count = scan.nextInt();//M
			
			if(pc_count == 0 && student_count == 0){
				break;
			}
			
			int resultimeArray[][] = new int[student_count + 1][1260];
			int tmpArray[][] = new int[student_count + 1][pc_count + 1];
			
			r = scan.nextInt();
			for (int i = 0; i < r; i++){
				t = scan.nextInt();
				n = scan.nextInt();//PC
				m = scan.nextInt();//Student
				s = scan.nextInt();
				if(s==1){
					tmpArray[m][n] = t;
				}else{
					for (int j = tmpArray[m][n] + 1; j <= t; j++){
						resultimeArray[m][j] = 1;
					}
				}
			}
			
			q = scan.nextInt();
			for (int i = 0; i < q; i++){
				te = scan.nextInt();
				ts = scan.nextInt();
				m = scan.nextInt();
				int resultTmp = 0;
				for (int j = te + 1; j <= ts; j++){
					if (resultimeArray[m][j]==1){
						resultTmp++;
					}
				}
				System.out.println(resultTmp);
			}
		}
	}
}

Compiler output:
Main.java:2: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error