Triangle Count(LintCode 382):

Problem