Language: C++

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<math.h>
#include <cassert>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAXN 1200
ll a[210000];
ll q, b = 0, time = 1;
ll mins = 1000000000, maxs = -1000000000;
ll t, t1;
ll calc(ll m)
{
	ll at = b;
	for (int i = 1; i < time; i++)
	{
		at += abs(m - a[i]);
	}
	return at;
}
ll solve(ll L, ll R)
{
	ll M, RM;
	while (L + 1 < R)
	{
		M = (L + R) / 2;
		RM = (M + R) / 2;
		if (calc(M) < calc(RM)) //计算最小值,若为最大值则>
			R = RM;
		else
			L = M;
	}
	return L;
}


int main()
{
	cin >> q;
	for (ll i = 1; i <= q; i++)
	{
		scanf("%lld", &t);
		if (t == 1)
		{
			scanf("%lld %lld", &a[time], &t1);
			b += t1;
			mins = min(mins, a[time]);
			maxs = max(maxs, a[time]);
			time++;
		}
		else
		{
			ll t2 = solve(mins, maxs);
			printf("%lld %lld\n", t2, calc(t2));
		}
	}
}


Compiler output:
a.cc:23:14: error: 'll time' redeclared as different kind of entity
   23 | ll q, b = 0, time = 1;
      |              ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/sstream:40,
                 from a.cc:7:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'll calc(ll)':
a.cc:29:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   29 |         for (int i = 1; i < time; i++)
      |                         ~~^~~~~~
a.cc: In function 'int main()':
a.cc:59:46: error: invalid types 'll [210000] {aka long long int [210000]}[time_t(time_t*) noexcept {aka long int(long int*) noexcept}]' for array subscript
   59 |                         scanf("%lld %lld", &a[time], &t1);
      |                                              ^
a.cc:61:43: error: invalid types 'll [210000] {aka long long int [210000]}[time_t(time_t*) noexcept {aka long int(long int*) noexcept}]' for array subscript
   61 |                         mins = min(mins, a[time]);
      |                                           ^
a.cc:62:43: error: invalid types 'll [210000] {aka long long int [210000]}[time_t(time_t*) noexcept {aka long int(long int*) noexcept}]' for array subscript
   62 |                         maxs = max(maxs, a[time]);
      |                                           ^
a.cc:63:25: warning: ISO C++ forbids incrementing a pointer of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} [-Wpointer-arith]
   63 |                         time++;
      |                         ^~~~
a.cc:63:29: error: lvalue required as increment operand
   63 |                         time++;
      |                             ^~