Plus[Times[a,b],c]

a*b+c

FullForm[%]

{a,b,c,a}

p1=x*y-1;

p2=x^2+y+1;

Expand[x^2*y-x*p1]

Expand[x^2*y-y*p2]

List@@(x^7)

Exponent[#,{x,y}]&/@{x^7*y^2,x*y}

list={a,b,c,d}

list[[3]]

LeadingMonomial[poly_,vars_]:=
Module[{p,exps},
p=Expand[poly];
(* comment *)
If[Head[p]===Plus,p=List@@p,p={p}];
exps=Exponent[#,vars]&/@p;
exps=Sort[exps];
Return[Times@@(vars^Last[exps])];
]

LeadingMonomial[x^2*y,{x,y}]

LeadingCoefficient[poly_,vars_]:=
Module[{lm,p},
lm=LeadingMonomial[poly,vars];
p=poly;
Do[
p=Coefficient[p,vars[[i]],Exponent[lm,vars[[i]]]];
,{i,1,Length[vars]}];
Return[p];
]

LeadingCoefficient[-x^2*y+2*y^2-1,{y,x}]

PolynomialReduction[poly_,set_,vars_]:=
Module[{i,p,lm,lc,test,rem=0},
p=poly;
While[p=!=0,
lm=LeadingMonomial[p,vars];
lc=LeadingCoefficient[p,vars];
i=1;
While[i≤Length[set],
test=lm/LeadingMonomial[set[[i]],vars];
If[PolynomialQ[test,vars],
p=p-test/LeadingCoefficient[set[[i]],vars]*lc*set[[i]];
Break[];
];
i=i+1;
];
If[i>Length[set],rem=rem+lc*lm;p=p-lc*lm];
p=Expand[p];
];
Return[rem];
]

PolynomialReduction[x^2*y,{p1,p2},{x,y}]

PolynomialReduction[x^2*y,{p2,p1},{x,y}]