https://www.codechef.com/LTIME100C/problems/SOD3 plz

#include
using namespace std;

int main() {

int t;
cin>>t;
while(t--)
{
    long long int l,r;
    cin>>l>>r;
    if(l>r)
    {
        cout<<0<<endl;
        continue;
    }
    long long int ans=(r-l)/3;
    if(l%3==0 || r%3==0)
    ans++;
    
    
    cout<<ans<<endl;
    
}
return 0;

}

1 Like