Language: C++

#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
int MOD=1e9+7;
#define INF 2*1e9
#define N 310000 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    int n,m;
    cin>>n>>m;
    pair<pii,int> p[400];
    rep(i,m){
        int l,r,x;
        cin>>l>>r>>x;
        p[i]={{r,l},x};
    }
    sort(p,p+m);
    int dp[400][400][400]={};
    dp[0][0][0]=1;
    rep(i,n){
        rep2(j,0,max(i-1,0)){
            rep2(k,0,max(0,j-1)){
                dp[i+1][i][k]=(dp[i+1][i][k]+dp[i][j][k])%MOD;
                dp[i+1][j][k]=(dp[i+1][j][k]+dp[i][j][k])%MOD;
                dp[i+1][i][j]=(dp[i+1][i][j]+dp[i][j][k])%MOD;
            }
        }
        int l=lower_bound(p,p+m,(pair<pii,int>){{i+1,0},0})-p;
        int r=upper_bound(p,p+m,(pair<pii,int>){{i+1,400},0})-p;
        rep2(j,0,i){
            rep2(k,0,max(0,j-1)){
                for(int ii=l;ii<r;ii++)
                    int count=1,s=p[ii].first.second;
                    if(s<=k){
                        count++;
                    }
                    if(s<=j){
                        count++;
                    }
                    if(count!=p[ii].second){
                        dp[i+1][j][k]=0;
                    }
                }
            }
        }
    }
    int ans=0;
    rep2(j,0,n-1){
        rep2(k,0,j-1){
            ans=(ans+dp[n][j][k])%MOD;
        }
    }
    cout<<ans;
    return 0;
}



Compiler output:
a.cc:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:43:24: error: 's' was not declared in this scope
   43 |                     if(s<=k){
      |                        ^
a.cc:44:30: error: no post-increment operator for type
   44 |                         count++;
      |                              ^~
a.cc:46:24: error: 's' was not declared in this scope
   46 |                     if(s<=j){
      |                        ^
a.cc:47:30: error: no post-increment operator for type
   47 |                         count++;
      |                              ^~
a.cc:49:33: error: 'ii' was not declared in this scope; did you mean 'i'?
   49 |                     if(count!=p[ii].second){
      |                                 ^~
      |                                 i
a.cc: At global scope:
a.cc:3:21: error: expected unqualified-id before 'for'
    3 | #define rep2(i,a,b) for(int i=a;i<=b;++i)
      |                     ^~~
a.cc:57:5: note: in expansion of macro 'rep2'
   57 |     rep2(j,0,n-1){
      |     ^~~~
a.cc:57:10: error: 'j' does not name a type
   57 |     rep2(j,0,n-1){
      |          ^
a.cc:3:33: note: in definition of macro 'rep2'
    3 | #define rep2(i,a,b) for(int i=a;i<=b;++i)
      |                                 ^
a.cc:3:38: error: expected unqualified-id before '++' token
    3 | #define rep2(i,a,b) for(int i=a;i<=b;++i)
      |                                      ^~
a.cc:57:5: note: in expansion of macro 'rep2'
   57 |     rep2(j,0,n-1){
      |     ^~~~
a.cc:62:5: error: 'cout' does not name a type
   62 |     cout<<ans;
      |     ^~~~
a.cc:63:5: error: expected unqualified-id before 'return'
   63 |     return 0;
      |     ^~~~~~
a.cc:64:1: error: expected declaration before '}' token
   64 | }
      | ^