Problem:
Ievan Ritola is a researcher of behavioral ecology. Her group visited a forest to analyze an ecological system of some kinds of foxes.
The forest can be expressed as a two-dimensional plane. With her previous research, foxes in the forest are known to live at lattice points. Here, lattice points are the points whose
x
and
y
coordinates are both integers. Two or more foxes might live at the same point.
To observe the biology of these foxes, they decided to put a pair of sensors in the forest. The sensors can be put at lattice points. Then, they will be able to observe all foxes inside the bounding rectangle (including the boundary) where the sensors are catty-corner to each other. The sensors cannot be placed at the points that have the same
x
or
y
coordinate; in other words the rectangle must have non-zero area.
The more foxes can be observed, the more data can be collected; on the other hand, monitoring a large area consumes a large amount of energy. So they want to maximize the value given by
N' / (|x_1 − x_2| × |y_1 − y_2|)
, where
N'
is the number of foxes observed and
(x_1, y_1)
and
(x_2, y_2)
are the positions of the two sensors.
Let's help her observe cute foxes!
Input
The input is formatted as follows.
N
x_1
y_1
w_1
x_2
y_2
w_2
:
:
x_N
y_N
w_N
The first line contains a single integer
N
(
1 ≤ N ≤ 10^5
) indicating the number of  the fox lairs in the forest.
Each of the next
N
lines contains three integers
x_i
,
y_i
(
|x_i|,\, |y_i| ≤ 10^9
) and
w_i
(
1 ≤ w_i ≤ 10^4
), which represent there are
w_i
foxes at the point
(x_i, y_i)
.
It is guaranteed that all points are mutually different.
Output
Output the maximized value  as a fraction:
a
/
b
where
a
and
b
are integers representing the numerator and the denominato respectively.
 There should be exactly one space before and after  the slash.
The fraction should be written in the simplest form, that is,
a
and
b
must not have a common integer divisor greater than one.
If the value becomes an integer, print a fraction with the denominator of one (e.g.
5 / 1
to represent 5).
This implies zero should be printed as
0 / 1
(without quotes).
Sample Input 1
2
1 1 2
2 2 3
Output for the Sample Input 1
5 / 1

Submitted solutions:

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using a2 = array<ll, 2>;
using a3 = array<ll, 3>;

bool chmin(auto& a, const auto& b) { return a > b ? a = b, 1 : 0; }
bool chmax(auto& a, const auto& b) { return a < b ? a = b, 1 : 0; }

ll mod = 998244353;
const ll INF = 1e18;

ifstream in;
ofstream out;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    if(argc > 2) {
        in.open(argv[1]);
        cin.rdbuf(in.rdbuf());
        out.open(argv[2]);
        cout.rdbuf(out.rdbuf());
    }

    ll n;
    cin >> n;
    map<a2, ll> mp;
    for(int i = 0; i < n; i++) {
        ll x, y, w;
        cin >> x >> y >> w;
        mp[{x, y}] = w;
    }
    ll ans = 0;
    for(auto [pos, cnt] : mp) {
        ll sum = 0;
        for(int i = 0; i < 2; i++)
            for(int j = 0; j < 2; j++)
                if(mp.contains({pos[0] + i, pos[1] + j})) {
                    sum += mp[{pos[0] + i, pos[1] + j}];
                }
        chmax(ans, sum);
    }
    for(auto [pos, cnt] : mp) {
        ll sum = 0;
        for(int i = 0; i < 2; i++)
            for(int j = -1; j < 1; j++)
                if(mp.contains({pos[0] + i, pos[1] + j})) {
                    sum += mp[{pos[0] + i, pos[1] + j}];
                }
        chmax(ans, sum);
    }
    for(auto [pos, cnt] : mp) {
        ll sum = 0;
        for(int i = -1; i < 1; i++)
            for(int j = 0; j < 2; j++)
                if(mp.contains({pos[0] + i, pos[1] + j})) {
                    sum += mp[{pos[0] + i, pos[1] + j}];
                }
        chmax(ans, sum);
    }
    for(auto [pos, cnt] : mp) {
        ll sum = 0;
        for(int i = -1; i < 1; i++)
            for(int j = -1; j < 1; j++)
                if(mp.contains({pos[0] + i, pos[1] + j})) {
                    sum += mp[{pos[0] + i, pos[1] + j}];
                }
        chmax(ans, sum);
    }

    cout << ans << " / 1" << endl;
    return 0;
}
accuracy: 1
time_ms: 120
memory_kb: 9856
final_rank: 7

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using a2 = array<ll, 2>;
using a3 = array<ll, 3>;

bool chmin(auto& a, const auto& b) { return a > b ? a = b, 1 : 0; }
bool chmax(auto& a, const auto& b) { return a < b ? a = b, 1 : 0; }

ll mod = 998244353;
const ll INF = 1e18;

ifstream in;
ofstream out;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    if(argc > 2) {
        in.open(argv[1]);
        cin.rdbuf(in.rdbuf());
        out.open(argv[2]);
        cout.rdbuf(out.rdbuf());
    }

    ll n;
    cin >> n;
    map<a2, ll> mp;
    for(int i = 0; i < n; i++) {
        ll x, y, w;
        cin >> x >> y >> w;
        mp[{x, y}] = w;
    }
    ll ans = 0;
    for(auto [pos, cnt] : mp) {
        ll sum = 0;
        for(int i = 0; i < 2; i++)
            for(int j = 0; j < 2; j++)
                if(mp.contains({pos[0] + i, pos[1] + j})) {
                    sum += mp[{pos[0] + i, pos[1] + j}];
                }
        chmax(ans, sum);
    }

    cout << ans << " / 1" << endl;
    return 0;
}
accuracy: 0.9591836734693877
time_ms: 50
memory_kb: 9728
final_rank: 17

code_snippet: #include<bits/stdc++.h>
// #include<atcoder/all>
// #include<boost/multiprecision/cpp_int.hpp>

using namespace std;
// using namespace atcoder;
// using bint = boost::multiprecision::cpp_int;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ve = vector<vector<int>>;
using vb = vector<bool>;
using vvb = vector<vb>;
#define rep(i,s,n) for(ll i = (ll)s;i < (ll)n;i++)
#define rrep(i,l,r) for(ll i = r-1;i >= l;i--)
#define ALL(x) (x).begin(),(x).end()
#define sz(c) ((ll)(c).size())
#define LB(A,x) (int)(lower_bound(A.begin(),A.end(),x)-A.begin())
#define UB(A,x) (int)(upper_bound(A.begin(),A.end(),x)-A.begin())
// #define MOD 1000000007
#define MOD 998244353
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<typename T>ostream&operator<<(ostream&os,vector<T>&v){for(int i = 0;i < v.size();i++)os<<v[i]<<(i+1!=v.size()?" ":"");return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2>&p){os<<p.first<<" "<<p.second;return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2>&p){is>>p.first>>p.second;return is;}
template<typename T> inline bool chmax(T &a,T b){if(a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a,T b){if(a > b){a = b;return true;}return false;}
ld dist(ld x1,ld y1,ld x2, ld y2){return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}

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

int main(){
  
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;cin >> n;
  map<pll,ll> mp;
  vector<pll> cand;
  rep(i,0,n){
    ll x,y,w;cin >> x >> y >> w;
    mp[{x,y}] += w;
    rep(j,0,2)rep(k,0,2)cand.emplace_back(x + dx[j],y + dy[k]);
  }
  sort(ALL(cand));cand.erase(unique(ALL(cand)));
  ll res = 0;
  for(auto [x,y] : cand){
    ll S = 0;
    rep(i,0,2)rep(j,0,2)S += mp[{x-dx[i],y-dy[j]}];
    chmax(res,S);
  }
  cout << res << " / " << 1 << endl;
  

  return 0;
}
accuracy: 1
time_ms: 230
memory_kb: 67212
final_rank: 11

code_snippet: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

#define int long long
struct Data{
  int x,y,w;
  Data(){};
  Data(int x,int y,int w):x(x),y(y),w(w){}
  bool operator < (const Data& s)const{
    return (x!=s.x) ? (x<s.x):(y<s.y);
  }
};

int n,x,y,w;

map<P,int> m;
int ans=-1;
signed main(){
  cin>>n;
  rep(i,n){
    cin>>x>>y>>w;
    int temp=0;
    rep(i,2)rep(j,2){
        temp=m[make_pair(x+i,y+j)]+=w;
        chmax(ans,temp);
    }
  }


  cout<<ans<<" / "<<1<<endl;



}
accuracy: 1
time_ms: 140
memory_kb: 28440
final_rank: 10

code_snippet: #include <iostream>
#include <map>
#include <iomanip>
#include <cassert>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <tuple>
#include <ranges>
namespace ranges = std::ranges;
namespace views = std::views;
// #include "Src/Number/IntegerDivision.hpp"
// #include "Src/Utility/BinarySearch.hpp"
// #include "Src/Sequence/CompressedSequence.hpp"
// #include "Src/Sequence/RunLengthEncoding.hpp"
// #include "Src/Algebra/Group/AdditiveGroup.hpp"
// #include "Src/DataStructure/FenwickTree/FenwickTree.hpp"
// #include "Src/DataStructure/SegmentTree/SegmentTree.hpp"
// using namespace zawa;
// #include "atcoder/modint"
// using mint = atcoder::modint998244353;
int N, X[100010], Y[100010], W[100010];
std::map<std::pair<int, int>, int> F;
int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cin >> N;
    for (int i = 0 ; i < N ; i++) {
        std::cin >> X[i] >> Y[i] >> W[i];
        F[{X[i], Y[i]}] += W[i];
    }
    int sum = 0;
    for (int i = 0 ; i < N ; i++) {
        const int x = X[i], y = Y[i];
        {
            int v = 0;
            for (int dx : {0, 1}) for (int dy : {0, 1}) {
                auto it = F.find({x + dx, y + dy});
                if (it != F.end()) v += it->second;
            }
            sum = std::max(sum, v);
        }
        {
            int v = 0;
            for (int dx : {0, 1}) for (int dy : {0, -1}) {
                auto it = F.find({x + dx, y + dy});
                if (it != F.end()) v += it->second;
            }
            sum = std::max(sum, v);
        }
        {
            int v = 0;
            for (int dx : {0, -1}) for (int dy : {0, 1}) {
                auto it = F.find({x + dx, y + dy});
                if (it != F.end()) v += it->second;
            }
            sum = std::max(sum, v);
        }
        {
            int v = 0;
            for (int dx : {0, -1}) for (int dy : {0, -1}) {
                auto it = F.find({x + dx, y + dy});
                if (it != F.end()) v += it->second;
            }
            sum = std::max(sum, v);
        }
    }
    std::cout << sum << " / 1\n";
}
accuracy: 1
time_ms: 130
memory_kb: 11008
final_rank: 8

code_snippet: #include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())

using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;

template <typename T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
    return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
    return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
    return (x == 0 ? -1 : __builtin_ctzll(x));
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "P(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
    cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
    for (; a[i] != ',' && a[i] != '\0'; i++)
        cerr << a[i];
    cerr << ":" << b << " ";
    _show(i + 1, a, c...);
}

#include <unistd.h>

namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf


uint32_t pil = 0, pir = 0, por = 0;

struct Pre {
    char num[10000][4];
    constexpr Pre() : num() {
        for (int i = 0; i < 10000; i++) {
            int n = i;
            for (int j = 3; j >= 0; j--) {
                num[i][j] = n % 10 | '0';
                n /= 10;
            }
        }
    }
} constexpr pre;

inline void load() {
    memmove(ibuf, ibuf + pil, pir - pil);
    pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
    pil = 0;
    if (pir < SZ)
        ibuf[pir++] = '\n';
}

inline void flush() {
    fwrite(obuf, 1, por, stdout);
    por = 0;
}

void rd(char &c) {
    do {
        if (pil + 1 > pir)
            load();
        c = ibuf[pil++];
    } while (isspace(c));
}

void rd(string &x) {
    x.clear();
    char c;
    do {
        if (pil + 1 > pir)
            load();
        c = ibuf[pil++];
    } while (isspace(c));
    do {
        x += c;
        if (pil == pir)
            load();
        c = ibuf[pil++];
    } while (!isspace(c));
}

template <typename T> void rd_real(T &x) {
    string s;
    rd(s);
    x = stod(s);
}

template <typename T> void rd_integer(T &x) {
    if (pil + 100 > pir)
        load();
    char c;
    do
        c = ibuf[pil++];
    while (c < '-');
    bool minus = 0;
    if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
        if (c == '-') {
            minus = 1, c = ibuf[pil++];
        }
    }
    x = 0;
    while ('0' <= c) {
        x = x * 10 + (c & 15), c = ibuf[pil++];
    }
    if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
        if (minus)
            x = -x;
    }
}

void rd(int &x) {
    rd_integer(x);
}
void rd(ll &x) {
    rd_integer(x);
}
void rd(i128 &x) {
    rd_integer(x);
}
void rd(uint &x) {
    rd_integer(x);
}
void rd(ull &x) {
    rd_integer(x);
}
void rd(u128 &x) {
    rd_integer(x);
}
void rd(double &x) {
    rd_real(x);
}
void rd(long double &x) {
    rd_real(x);
}

template <class T, class U> void rd(pair<T, U> &p) {
    return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T> void rd_tuple(T &t) {
    if constexpr (N < std::tuple_size<T>::value) {
        auto &x = std::get<N>(t);
        rd(x);
        rd_tuple<N + 1>(t);
    }
}
template <class... T> void rd(tuple<T...> &tpl) {
    rd_tuple(tpl);
}

template <size_t N = 0, typename T> void rd(array<T, N> &x) {
    for (auto &d : x)
        rd(d);
}
template <class T> void rd(vector<T> &x) {
    for (auto &d : x)
        rd(d);
}

void read() {}
template <class H, class... T> void read(H &h, T &...t) {
    rd(h), read(t...);
}

void wt(const char c) {
    if (por == SZ)
        flush();
    obuf[por++] = c;
}
void wt(const string s) {
    for (char c : s)
        wt(c);
}
void wt(const char *s) {
    size_t len = strlen(s);
    for (size_t i = 0; i < len; i++)
        wt(s[i]);
}

template <typename T> void wt_integer(T x) {
    if (por > SZ - 100)
        flush();
    if (x < 0) {
        obuf[por++] = '-', x = -x;
    }
    int outi;
    for (outi = 96; x >= 10000; outi -= 4) {
        memcpy(out + outi, pre.num[x % 10000], 4);
        x /= 10000;
    }
    if (x >= 1000) {
        memcpy(obuf + por, pre.num[x], 4);
        por += 4;
    } else if (x >= 100) {
        memcpy(obuf + por, pre.num[x] + 1, 3);
        por += 3;
    } else if (x >= 10) {
        int q = (x * 103) >> 10;
        obuf[por] = q | '0';
        obuf[por + 1] = (x - q * 10) | '0';
        por += 2;
    } else
        obuf[por++] = x | '0';
    memcpy(obuf + por, out + outi + 4, 96 - outi);
    por += 96 - outi;
}

template <typename T> void wt_real(T x) {
    ostringstream oss;
    oss << fixed << setprecision(15) << double(x);
    string s = oss.str();
    wt(s);
}

void wt(int x) {
    wt_integer(x);
}
void wt(ll x) {
    wt_integer(x);
}
void wt(i128 x) {
    wt_integer(x);
}
void wt(uint x) {
    wt_integer(x);
}
void wt(ull x) {
    wt_integer(x);
}
void wt(u128 x) {
    wt_integer(x);
}
void wt(double x) {
    wt_real(x);
}
void wt(long double x) {
    wt_real(x);
}

template <class T, class U> void wt(const pair<T, U> val) {
    wt(val.first);
    wt(' ');
    wt(val.second);
}
template <size_t N = 0, typename T> void wt_tuple(const T t) {
    if constexpr (N < std::tuple_size<T>::value) {
        if constexpr (N > 0) {
            wt(' ');
        }
        const auto x = std::get<N>(t);
        wt(x);
        wt_tuple<N + 1>(t);
    }
}
template <class... T> void wt(tuple<T...> tpl) {
    wt_tuple(tpl);
}
template <class T, size_t S> void wt(const array<T, S> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
        if (i)
            wt(' ');
        wt(val[i]);
    }
}
template <class T> void wt(const vector<T> val) {
    auto n = val.size();
    for (size_t i = 0; i < n; i++) {
        if (i)
            wt(' ');
        wt(val[i]);
    }
}

void print() {
    wt('\n');
}
template <class Head, class... Tail> void print(Head &&head, Tail &&...tail) {
    wt(head);
    if (sizeof...(Tail))
        wt(' ');
    print(forward<Tail>(tail)...);
}
void __attribute__((destructor)) _d() {
    flush();
}
} // namespace fastio


using fastio::flush;
using fastio::print;
using fastio::read;

inline void first(bool i = true) {
    print(i ? "first" : "second");
}
inline void Alice(bool i = true) {
    print(i ? "Alice" : "Bob");
}
inline void Takahashi(bool i = true) {
    print(i ? "Takahashi" : "Aoki");
}
inline void yes(bool i = true) {
    print(i ? "yes" : "no");
}
inline void Yes(bool i = true) {
    print(i ? "Yes" : "No");
}
inline void No() {
    print("No");
}
inline void YES(bool i = true) {
    print(i ? "YES" : "NO");
}
inline void NO() {
    print("NO");
}
inline void Yay(bool i = true) {
    print(i ? "Yay!" : ":(");
}
inline void Possible(bool i = true) {
    print(i ? "Possible" : "Impossible");
}
inline void POSSIBLE(bool i = true) {
    print(i ? "POSSIBLE" : "IMPOSSIBLE");
}

/**
 * @brief Fast IO
 */

int main() {
    int N;
    cin >> N;
    vector<int> X(N), Y(N), Z(N);
    rep(i,0,N) cin >> X[i] >> Y[i] >> Z[i];
    map<pair<int,int>,int> mp;
    rep(i,0,N) mp[{X[i],Y[i]}] = Z[i];
    int ANS = 0;
    rep(i,0,N) {
        rep(j,-1,1) {
            rep(k,-1,1) {
                int COUNT = 0;
                rep(dx,0,2) {
                    rep(dy,0,2) {
                        int x = X[i]+j+dx, y = Y[i]+k+dy;
                        if (mp.count({x,y})) COUNT += mp[{x,y}];
                    }
                }
                chmax(ANS,COUNT);
            }
        }
    }
    cout << ANS << " / 1" << endl;
}
accuracy: 1
time_ms: 190
memory_kb: 10424
final_rank: 9

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(), v.end()
#define rng(i, l, r) for(int i = int(l); i < int(r); i++)
#define rep(i, n) rng(i, 0, n)
#define sz(v) int(v.size())
using pii = pair<int, int>;

void solve() {
	int n;
	cin >> n;
	map<pii, int> mp;
	rep(i, n) {
		int x, y, w;
		cin >> x >> y >> w;
		mp[{x, y}] += w;
	}
	ll ret = 0;
	auto f = [&](int x, int y) {
		if(mp.count({x, y})) return mp[{x, y}];
		return 0;
	};
	for(auto [p, w] : mp) {
		auto [x, y] = p;
		ll t1 = w + f(x + 1, y) + f(x + 1, y + 1) + f(x, y + 1);
		ll t2 = w + f(x - 1, y) + f(x - 1, y + 1) + f(x, y + 1);
		ret = max({ret, t1, t2});
	}
	cout << ret << " / 1" << endl;
}

int main() { solve(); }
accuracy: 1
time_ms: 100
memory_kb: 9624
final_rank: 4

code_snippet: // author: hanyu
#include <bits/stdc++.h>
using namespace std;

// 解説AC
// 本質に気づけなかった...
// こういう問題他にもいっぱいありそう

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

  int n;
  cin >> n;

  map<pair<int, int>, int> mp;
  for (int i = 0; i < n; i++) {
    int x, y, w;
    cin >> x >> y >> w;
    mp[make_pair(x, y)] += w;
  }

  int ans = 0;
  for (auto i : mp) {
    int nowx = i.first.first, nowy = i.first.second;
    int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0;
    // a1 a2
    // X  a3
    // a4 a5
    if (mp.find(make_pair(nowx, nowy + 1)) != mp.end()) a1 = mp[make_pair(nowx, nowy + 1)];
    if (mp.find(make_pair(nowx + 1, nowy + 1)) != mp.end()) a2 = mp[make_pair(nowx + 1, nowy + 1)];
    if (mp.find(make_pair(nowx + 1, nowy)) != mp.end()) a3 = mp[make_pair(nowx + 1, nowy)];
    if (mp.find(make_pair(nowx, nowy - 1)) != mp.end()) a4 = mp[make_pair(nowx, nowy - 1)];
    if (mp.find(make_pair(nowx + 1, nowy - 1)) != mp.end()) a5 = mp[make_pair(nowx + 1, nowy - 1)];
    ans = max({ans, i.second + a1 + a2 + a3, i.second + a3 + a4 + a5});
  }

  cout << ans << " / 1" << endl;
}
accuracy: 1
time_ms: 50
memory_kb: 9616
final_rank: 1

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int n, x, y, w;
    cin >> n;
    vector<tuple<int,int,int>> a(n);
    map<int,map<int,int>> mp;
    for(int i = 0; i < n; i++){
        cin >> x >> y >> w;
        a[i] = {x, y, w};
        mp[x][y] += w;
    }
    sort(a.begin(), a.end());
    vector<pair<int,int>> b = {{0,0},{1,1},{0,1},{1,0}};
    int ans = 0;
    for(int i = 0; i < n; i++){
        tie(x, y, w) = a[i];
        for(int j = 0; j < 4; j++){
            int v = 0;
            for(int k = 0, dx, dy; k < 4; k++){
                tie(dx, dy) = b[k];
                if(j & 1)dx *= -1;
                if(j & 2)dy *= -1;
                v += mp[x + dx][y + dy];
            }
            ans = max(ans, v);
        }
    }
    cout << ans << " / " << 1 << '\n';
}
accuracy: 1
time_ms: 240
memory_kb: 74632
final_rank: 14

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int n, x, y, w;
    cin >> n;
    vector<tuple<int,int,int>> a(n);
    map<int,map<int,long long>> mp;
    for(int i = 0; i < n; i++){
        cin >> x >> y >> w;
        a[i] = {x, y, w};
        mp[x][y] += w;
    }
    sort(a.begin(), a.end());
    vector<pair<int,int>> b = {{0,0},{1,1},{0,1},{1,0}};
    long long ans = 0;
    for(int i = 0; i < n; i++){
        tie(x, y, w) = a[i];
        for(int j = 0; j < 4; j++){
            long long v = 0;
            for(int k = 0, dx, dy; k < 4; k++){
                tie(dx, dy) = b[k];
                if(j & 1)dx *= -1;
                if(k & 2)dy *= -1;
                v += mp[x + dx][y + dy];
            }
            ans = max(ans, v);
        }
    }
    cout << ans << " / " << 1 << '\n';
}
accuracy: 0.7346938775510204
time_ms: 230
memory_kb: 69908
final_rank: 20

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int n, x, y, w;
    cin >> n;
    vector<tuple<int,int,int>> a(n);
    map<int,map<int,int>> mp;
    for(int i = 0; i < n; i++){
        cin >> x >> y >> w;
        a[i] = {x, y, w};
        mp[x][y] += w;
    }
    sort(a.begin(), a.end());
    vector<pair<int,int>> b = {{0,0},{1,1},{0,1},{1,0}};
    int ans = 0;
    for(int i = 0; i < n; i++){
        tie(x, y, w) = a[i];
        for(int j = 0; j < 4; j++){
            int v = 0;
            for(int k = 0, dx, dy; k < 4; k++){
                tie(dx, dy) = b[k];
                if(j & 1)dx *= -1;
                if(k & 2)dy *= -1;
                v += mp[x + dx][y + dy];
            }
            ans = max(ans, v);
        }
    }
    cout << ans << " / " << 1 << '\n';
}
accuracy: 0.7346938775510204
time_ms: 230
memory_kb: 60588
final_rank: 19

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (int i = (int)(s); i < (int)(t); ++i)
#define revrep(i, t, s) for (int i = (int)(t)-1; i >= (int)(s); --i)
#define all(x) begin(x), end(x)
template <typename T> bool chmax(T& a, const T& b) { return a < b ? (a = b, 1) : 0; }
template <typename T> bool chmin(T& a, const T& b) { return a > b ? (a = b, 1) : 0; }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int N;
    cin >> N;
    map<pair<int, int>, int> cnt;
    rep(_,0,N) {
        int x, y, w;
        cin >> x >> y >> w;
        cnt[{x, y}] = w;
    }
    ll ans = 0;
    for (auto& p : cnt) {
        auto [x, y] = p.first;

        vector<vector<int>> c(3, vector<int>(3));
        rep(i,0,3) rep(j,0,3) {
            auto it = cnt.find({x-1+i, y-1+j});
            if (it != cnt.end()) c[i][j] = it->second;
        }

        rep(i,0,2) rep(j,0,2) {
            ll cnt = 0;
            rep(k,0,2) rep(l,0,2) {
                cnt += c[i+k][j+l];
            }
            chmax(ans, cnt);
        }
    }
    cout << ans << " / 1" << endl;

}
accuracy: 1
time_ms: 80
memory_kb: 9628
final_rank: 2

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vvvvvll = vector<vvvvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
#define all(A) A.begin(),A.end()
#define ALL(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
using pqr = priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>;

template<class T>
bool chmax(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p < q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

template<class T>
bool chmin(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p > q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

ll gcd(ll(a), ll(b)) {
    if (b == 0)return a;
    ll c = a;
    while (a % b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return b;
}

vector<ll> fact, factinv, inv;
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
    fact.resize(n + 5);
    factinv.resize(n + 5);
    inv.resize(n + 5);
    fact.at(0) = fact.at(1) = 1;
    factinv.at(0) = factinv.at(1) = 1;
    inv.at(1) = 1;
    for (ll i = 2; i < n + 5; i++) {
        fact.at(i) = (fact.at(i - 1) * i) % mod;
        inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
        factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
    }

}
ll nCk(ll n, ll k) {
    if (k < 0)return 0;
    if (n < k) return 0;
    return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}


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

    ll N;
    cin>>N;
    map<pair<ll,ll>,ll> M;
    rep(i,N){
        ll X,Y,W;
        cin>>X>>Y>>W;
        M[{X,Y}]+=W;
    }
    ll an=0;
    for(auto p:M){
        ll z=0;
        z+=p.second;
        ll y=p.first.second;
        ll x=p.first.first;
        if(M.count({x+1,y})){
            z+=M[{x+1,y}];
        }
        if(M.count({x+1,y+1})){
            z+=M[{x+1,y+1}];
        }
        if(M.count({x,y+1})){
            z+=M[{x,y+1}];
        }
        chmax(an,z);
    }
    for(auto p:M){
        ll z=0;
        z+=p.second;
        ll y=p.first.second;
        ll x=p.first.first;
        if(M.count({x-1,y})){
            z+=M[{x-1,y}];
        }
        if(M.count({x-1,y-1})){
            z+=M[{x-1,y-1}];
        }
        if(M.count({x,y-1})){
            z+=M[{x,y-1}];
        }
        chmax(an,z);
    }
    for(auto p:M){
        ll z=0;
        z+=p.second;
        ll y=p.first.second;
        ll x=p.first.first;
        if(M.count({x+1,y})){
            z+=M[{x+1,y}];
        }
        if(M.count({x+1,y-1})){
            z+=M[{x+1,y-1}];
        }
        if(M.count({x,y-1})){
            z+=M[{x,y-1}];
        }
        chmax(an,z);
    }
    for(auto p:M){
        ll z=0;
        z+=p.second;
        ll y=p.first.second;
        ll x=p.first.first;
        if(M.count({x-1,y})){
            z+=M[{x-1,y}];
        }
        if(M.count({x-1,y+1})){
            z+=M[{x-1,y+1}];
        }
        if(M.count({x,y+1})){
            z+=M[{x,y+1}];
        }
        chmax(an,z);
    }
    
    cout<<an<<" / "<<1<<endl;
}
accuracy: 1
time_ms: 90
memory_kb: 9696
final_rank: 3

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vvvvvll = vector<vvvvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
#define all(A) A.begin(),A.end()
#define ALL(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
using pqr = priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>;

template<class T>
bool chmax(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p < q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

template<class T>
bool chmin(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p > q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}

ll gcd(ll(a), ll(b)) {
    if (b == 0)return a;
    ll c = a;
    while (a % b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return b;
}

vector<ll> fact, factinv, inv;
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
    fact.resize(n + 5);
    factinv.resize(n + 5);
    inv.resize(n + 5);
    fact.at(0) = fact.at(1) = 1;
    factinv.at(0) = factinv.at(1) = 1;
    inv.at(1) = 1;
    for (ll i = 2; i < n + 5; i++) {
        fact.at(i) = (fact.at(i - 1) * i) % mod;
        inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
        factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
    }

}
ll nCk(ll n, ll k) {
    if (k < 0)return 0;
    if (n < k) return 0;
    return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}


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

    ll N;
    cin>>N;
    map<pair<ll,ll>,ll> M;
    rep(i,N){
        ll X,Y,W;
        cin>>X>>Y>>W;
        M[{X,Y}]+=W;
    }
    ll an=0;
    for(auto p:M){
        ll z=0;
        z+=p.second;
        ll y=p.first.second;
        ll x=p.first.first;
        if(M.count({x+1,y})){
            z+=M[{x+1,y}];
        }
        if(M.count({x+1,y+1})){
            z+=M[{x+1,y+1}];
        }
        if(M.count({x,y+1})){
            z+=M[{x,y+1}];
        }
        chmax(an,z);
    }
    cout<<an<<" / "<<1<<endl;
}
accuracy: 0.9591836734693877
time_ms: 50
memory_kb: 9624
final_rank: 16

code_snippet: #include <bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
using vvll = vector<vll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)

ll gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}

int main() {
    ll N;
    cin>>N;
    map<pair<ll,ll>,ll> M;
    rep(i,N){
        ll X,Y,W;
        cin>>X>>Y>>W;
        M[{X,Y}]+=W;
    }
    ll an=0;
    for(auto p:M){
        auto t=p.first;
        ll k=0;
        k+=M[t];
        if(M.count({t.first,t.second+1}))k+=M[{t.first,t.second+1}];
        if(M.count({t.first+1,t.second}))k+=M[{t.first+1,t.second}];
        if(M.count({t.first+1,t.second+1}))k+=M[{t.first+1,t.second+1}];
        an=max(an,k);
    }
    for(auto p:M){
        auto t=p.first;
        ll k=0;
        k+=M[t];
        if(M.count({t.first,t.second+1}))k+=M[{t.first,t.second+1}];
        if(M.count({t.first-1,t.second}))k+=M[{t.first-1,t.second}];
        if(M.count({t.first-1,t.second+1}))k+=M[{t.first-1,t.second+1}];
        an=max(an,k);
    }
    
    cout<<an<<" / "<<1<<endl;
}
accuracy: 1
time_ms: 110
memory_kb: 9680
final_rank: 6

code_snippet: #include <stdio.h>
#include <map>
using namespace std;

int p[103000][3];
map<pair<int, int>, int> m;

int big(int a, int b) {
    return a > b ? a : b;
}

int getfox(int x, int y) {
    return m[make_pair(x, y)] + m[make_pair(x, y + 1)] + m[make_pair(x + 1, y)] + m[make_pair(x + 1, y + 1)];
}

int main(void) {
    int n, r = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &p[i][0], &p[i][1], &p[i][2]);
        m.insert(make_pair(make_pair(p[i][0], p[i][1]), p[i][2]));
    }
    for (int i = 0; i < n; i++) {
        r = big(r, getfox(p[i][0], p[i][1]));
        r = big(r, getfox(p[i][0], p[i][1] - 1));
        r = big(r, getfox(p[i][0] - 1, p[i][1]));
        r = big(r, getfox(p[i][0] - 1, p[i][1] - 1));
    }
    printf("%d / 1\n", r);
    return 0;
}
accuracy: 1
time_ms: 260
memory_kb: 60464
final_rank: 12

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

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

map<pair<int, int>, int> mp;

const int dx1[4] = {0, 0, -1, -1};
const int dy1[4] = {0, -1, 0, -1};

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> x(N), y(N), w(N);
    rep(i, N) cin >> x[i] >> y[i] >> w[i];
    rep(i, N) mp[{x[i], y[i]}] = i + 1;
    int ans = 0;
    rep(i, N) {
        // 大きさ1の正方形を考える
        rep(s, 4) {
            int cx = x[i] + dx1[s], cy = y[i] + dy1[s];
            int ws = 0;
            rep(k, 4) {
                int nx = cx + dx[k], ny = cy + dy[k];
                int id = mp[{nx, ny}];
                if (id != 0) {
                    ws += w[id - 1];
                }
            }
            ans = max(ans, ws);
        }
    }
    cout << ans << " / 1\n";
    return 0;
}
accuracy: 1
time_ms: 260
memory_kb: 60636
final_rank: 13

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

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) x.begin(), x.end()

map<pair<int, int>, int> mp;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> x(N), y(N), w(N);
    rep(i, N) cin >> x[i] >> y[i] >> w[i];
    rep(i, N) mp[{x[i], y[i]}] = i + 1;
    int ans = 0;
    rep(i, N) {
        // (x[i],y[i]) (x[i]+1,y[i]+1)からなる正方形を考える
        int ws = w[i];
        rep(k, 3) {
            int nx = x[i] + dx[k], ny = y[i] + dy[k];
            int id = mp[{nx, ny}];
            if (id != 0) {
                ws += w[id - 1];
            }
        }
        ans = max(ans, ws);
    }
    cout << ans << " / 1\n";
    return 0;
}
accuracy: 0.9591836734693877
time_ms: 100
memory_kb: 29212
final_rank: 18

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define inc(i, a, b) for (int i = (a); i <= (b); ++i)
#define dec(i, a, b) for (int i = (a); i >= (b); --i)

int main() {
    ll n;
    cin >> n;
    ll x[n], y[n], w[n];
    map<pair<ll, ll>, ll> m;
    rep(i, n) {
        cin >> x[i] >> y[i] >> w[i];
        m[{x[i], y[i]}] += w[i];
    }
    ll mx = 0, dx[] = {1, -1, 1, -1}, dy[] = {1, 1, -1, -1};
    rep(i, n) {
        rep(k, 4) {
            ll sum = 0;
            rep(p, 2) rep(q, 2) sum += m[{x[i] + dx[k] * p, y[i] + dy[k] * q}];
            mx = max(mx, sum);
        }
    }
    cout << mx << " / 1" << endl;
}
accuracy: 1
time_ms: 290
memory_kb: 62024
final_rank: 15

code_snippet: #ifdef LOCAL
    #define _GLIBCXX_DEBUG
    #define __clock__
#else
    #pragma GCC optimize("Ofast")
#endif
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;
using PII = pair<ll, ll>;

// #define INT128 // 必要なら有効化してください
#ifdef INT128
  using LL = __int128;
#endif

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(char c){
  string s = {c};
  return s;
}

// LL
#ifdef INT128
// input
istream& operator>>(istream& is, LL& v)
{
    string s;
    is >> s;
    v = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        if (isdigit(s[i])) { v = v * 10 + s[i] - '0'; }
    }
    if (s[0] == '-') { v *= -1; }
    return is;
}
std::ostream &operator<<(std::ostream &dest, LL value) {
  std::ostream::sentry s(dest);
  if (s) {
    LL tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}
string to_string(LL v){
  stringstream ss;
  ss << v;
  return ss.str();
}
#endif // LL

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())
#define MP make_pair
#define p_yes() p("Yes")
#define p_no() p("No")
#define p_possible() p("Possible")
#define p_impossible() p("Impossible")
void yes(){p_yes(); exit(0);}
void no(){p_no(); exit(0);}
void possible(){p_possible(); exit(0);}
void impossible(){p_impossible(); exit(0);}

ll SUM(VI& V){
  return accumulate(ALL(V), 0LL);
}

ll MIN(VI& V){return *min_element(ALL(V));}
ll MAX(VI& V){return *max_element(ALL(V));}

void print_vector(VI& V, ll offset=0){
  ll n = V.size();
  rep(i, n){
    if(i) cout << ' ';
    cout << V[i]+offset;
  }
  cout << endl;
}

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

// long double
using ld = long double;
// #define EPS (1e-14)
constexpr ld EPS = 1e-14;
// #define equals(a,b) (fabs((a)-(b)) < EPS)
constexpr bool equals(ld a, ld b){return fabs((a)-(b)) < EPS;}

// 小さい順に取り出すpriority queue
using inverse_priority_queue = priority_queue<ll, vector<ll>, greater<ll> >;

int popcount(ll t){
    return __builtin_popcountll(t);
}

const ll mod = 1e9 + 7;
// const ll mod = 998244353;
const ll inf = 4e18; // LLONG_MAX = 9223372036854775807 (atcoder, codeforces)
const double PI = acos(-1);

// [a/b] (繰り上げ)
ll ceil_div(ll a, ll b){
  return (a+b-1)/b;
}

ll ll_pow(ll a, ll n){
    ll ans = 1;
    FOR(i, 0, n){
        ans *= a;
    }
    return ans;
}
// modなし

// snuke's mint
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
// const int mod = 1000000007;
struct mint {
  ll x; // using ll = long long;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// ※双方向
// N : 頂点数
// M : 辺数
// return vector<vector<ll>>
VV load_graph(ll N, ll M){
  VV G(N);
  rep(i,M){
    ll a,b;cin>>a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  return G;
}
VV load_tree(ll N){
  return load_graph(N, N-1);
}

VI loadV(ll N){
  VI A(N);
  rep(i,N)cin>>A[i];
  return A;
}

//#include <atcoder/dsu>
//using namespace atcoder; // 忘れがち

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

    // input
    ll N;
    cin>>N;
    
    map<PII,ll> mp;

    rep(i,N){
      ll x,y,w;
      cin>>x>>y>>w;

      mp[{x,y}] = w;
    }

    auto f = [&](PII point, ll dx, ll dy){
      ll sum = mp[point];
      {
        PII to = {point.first+dx, point.second+dy};
        if(mp.count(to)) sum+=mp[to];
      }
      {
        PII to = {point.first+0, point.second+dy};
        if(mp.count(to)) sum+=mp[to];
      }
      {
        PII to = {point.first+dx, point.second+0};
        if(mp.count(to)) sum+=mp[to];
      }
      return sum;
    };

    ll ma=0;
    for(auto pa : mp){
      PII point = pa.first;
      ll w = pa.second;

      // pointを中心に、
      chmax(ma, f(point, -1,-1));
      chmax(ma, f(point, -1,+1));
      chmax(ma, f(point, +1,-1));
      chmax(ma, f(point, +1,+1));
    }

    cout << ma << " / " << 1 << endl;

    return 0;
}
accuracy: 1
time_ms: 100
memory_kb: 9628
final_rank: 5