copy code from oj for DS