// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
int arr[5]={1,7,3,10,6};
int sum = 17;
int i=0,j=4;
for (i=0;i<5;i++)
{
cout<<"i="<<i<<","<<"j="<<j<<endl;
if (i==j)
{
i=0;
j--;
}
if (i!=j && arr[i]+arr[j]==sum)
{
cout<<i+1<<","<<j+1<<endl;
break;
}
else if (i>j)
break;
}
if (j==0)
cout<<"Not found"<<endl;
return 0;
}
Ly8gT25saW5lIEMrKyBjb21waWxlciB0byBydW4gQysrIHByb2dyYW0gb25saW5lCiNpbmNsdWRlIDxpb3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKSB7CiAgICBpbnQgYXJyWzVdPXsxLDcsMywxMCw2fTsKICAgICAgICBpbnQgc3VtID0gMTc7CiAgICAgICAgaW50IGk9MCxqPTQ7CiAgICAgICAgZm9yIChpPTA7aTw1O2krKykKICAgICAgICB7CiAgICAgICAgICAgICAgICBjb3V0PDwiaT0iPDxpPDwiLCI8PCJqPSI8PGo8PGVuZGw7CiAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgaWYgKGk9PWopCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIGk9MDsKICAgICAgICAgICAgICAgICAgICAgICAgai0tOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGlmIChpIT1qICYmIGFycltpXSthcnJbal09PXN1bSkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBjb3V0PDxpKzE8PCIsIjw8aisxPDxlbmRsOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZiAoaT5qKQogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgCiAgICAgICAgfQogICAgICAgIGlmIChqPT0wKQogICAgICAgIGNvdXQ8PCJOb3QgZm91bmQiPDxlbmRsOwogICAgICAgIHJldHVybiAwOwoKfQ==