copy code from OJ for _5.DP