{"problem":{"name":"Triangle","description":{"content":"You are given a simple undirected graph $G$ with $N$ vertices. $G$ is given as the $N \\times N$ adjacency matrix $A$. That is, there is an edge between Vertices $i$ and $j$ if $A_{i,j}$ is $1$, and th","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc258_g"},"statements":[{"statement_type":"Markdown","content":"You are given a simple undirected graph $G$ with $N$ vertices.\n$G$ is given as the $N \\times N$ adjacency matrix $A$. That is, there is an edge between Vertices $i$ and $j$ if $A_{i,j}$ is $1$, and there is not if $A_{i,j}$ is $0$.\nFind the number of triples of integers $(i,j,k)$ satisfying $1 \\le i < j < k \\le N$ such that there is an edge between Vertices $i$ and $j$, an edge between Vertices $j$ and $k$, and an edge between Vertices $i$ and $k$.\n\n## Constraints\n\n*   $3 \\le N \\le 3000$\n*   $A$ is the adjacency matrix of a simple undirected graph $G$.\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_{1,1}A_{1,2}\\dots A_{1,N}$\n$A_{2,1}A_{2,2}\\dots A_{2,N}$\n$\\vdots$\n$A_{N,1}A_{N,2}\\dots A_{N,N}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc258_g","tags":[],"sample_group":[["4\n0011\n0011\n1101\n1110","2\n\n$(i,j,k)=(1,3,4),(2,3,4)$ satisfy the condition.\n$(i,j,k)=(1,2,3)$ does not satisfy the condition, because there is no edge between Vertices $1$ and $2$.\nThus, the answer is $2$."],["10\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000","0"]],"created_at":"2026-03-03 11:01:14"}}