PRIMARY OBJECTIVES:
      I. To determine the maximum tolerated dose (MTD) and dose limiting toxicity (DLT) of
      nivolumab in combination with azacitidine (5-azacytidine) in patients with
      refractory/relapsed acute myeloid leukemia (AML). (Lead-in phase) II. To determine the
      maximum tolerated dose (MTD) and dose limiting toxicity (DLT) of nivolumab with ipilimumab in
      combination with 5-azacytidine in patients with refractory/relapsed acute myeloid leukemia
      (AML). (Lead-in phase) III. To determine the overall response rate (ORR) of nivolumab in
      combination with 5-azacytidine in patients with refractory/ relapsed AML. (Phase II) IV. To
      determine the overall response rate (ORR) of nivolumab in combination with 5-azacytidine in
      older patients (> 65 years) with newly diagnosed AML. (Phase II) V. To determine the overall
      response rate (ORR) of nivolumab with ipilimumab in combination with 5-azacytidine in
      patients with refractory/relapsed AML. (Phase II) VI. To determine the overall response rate
      (ORR) of nivolumab with ipilimumab in combination with 5- azacytidine in older patients (65
      years) with newly diagnosed AML. (Phase II)
      SECONDARY OBJECTIVES:
      I. To determine the number of patients who achieve a > 50% reduction in blasts on therapy
      with either vidaza+nivolumab or vidaza+nivolumab+ipilimumab.
      II. To determine the duration of response, disease-free survival (DFS), and overall survival
      (OS) of patients with refractory/relapsed AML treated with either vidaza+nivolumab or
      vidaza+nivolumab+ipilimumab.
      III. To determine the duration of response, disease-free survival (DFS), and overall survival
      (OS) in older patients with newly diagnosed AML treated with this combination with either
      vidaza+nivolumab or vidaza+nivolumab+ipilimumab.
      TERTIARY OBJECTIVES:
      I. To study immunological and molecular changes in the peripheral blood and bone marrow in
      response to nivolumab and 5-azacytidine therapy or nivolumab with ipilimumab and
      5-azacytidine therapy.
      II. To determine induction of hypomethylation and deoxyribonucleic acid (DNA) damage during
      therapy with this combination and its correlation with response.
      OUTLINE: This is a lead-in phase, dose-escalation study followed by a phase II study.
      Patients are assigned to 1 of 2 arms.
      ARM I: Patients receive azacitidine intravenously (IV) over 1 hour or subcutaneously (SC) on
      days 1-7 or days 1-4 and 7-9. Patients also receive nivolumab IV over 60 minutes on days 1
      and 14 (courses 1-4) or on day 1 (course 5 and all subsequent courses). Courses repeat every
      28 days in the absence of disease progression or unacceptable toxicity.
      ARM II: Patients receive azacitidine and nivolumab as Arm I. Patients also receive ipilimumab
      IV over 90 minutes on day 1 and then every 6 or 12 weeks. Treatment continues in the absence
      of disease progression or unacceptable toxicity.
      After completion of study treatment, patients are followed up at 30 days and then every 3-6
      months for up to 5 years.
    
        Inclusion Criteria:
          -  ARM 1 SALVAGE COHORT: Patients with AML or biphenotypic or bilineage leukemia who have
             failed prior therapy; patients with AML should have failed prior therapy or have
             relapsed after prior therapy will be eligible for Arm 1;
          -  ARM 2 SALVAGE COHORT: Patients with AML who have failed up to one prior salvage
             therapy (i.e. salvage 1 or 2 status) will be eligible for Arm 2 relapse cohort;
             allogeneic stem cell transplant for patients in remission at the time of stem cell
             transplant will not be considered a salvage regimen; similarly, hydroxyurea if used
             alone will not be considered a salvage regimen
          -  ARM 1 AND 2 FRONT LINE OLDER COHORT: Patients age 65 years and above with previously
             untreated AML who are unfit for or decline standard induction therapy; prior therapy
             with hydroxyurea, biological or targeted therapy (e.g. FLT3 inhibitors, other kinase
             inhibitors), or hematopoietic growth factors is allowed, however prior therapy with
             chemotherapy agents for the disease under study is not allowed; patients may have
             received one dose of cytarabine (up to 2 g/m2 administered at presentation for
             control) of hyperleucocytosis
          -  Patients with myelodysplastic syndrome (MDS) or chronic myelomonocytic leukemia (CMML)
             who received therapy for the MDS or CMML and progress to AML are eligible at the time
             of diagnosis of AML regardless any prior therapy for MDS or CMML; the World Health
             Organization (WHO) classification will be used for AML; prior therapy for MDS or CMML
             will not be considered as a prior therapy for AML, hence such patients will be
             considered as frontline AML and eligible for the frontline elderly cohort
          -  Prior therapy with hydroxyurea, chemotherapy, biological or targeted therapy (e.g.
             FLT3 inhibitors, other kinase inhibitors), or hematopoietic growth factors is allowed
          -  Eastern Cooperative Oncology Group (ECOG) performance status =< 2
          -  Total bilirubin =< 2 times upper limit of normal (x ULN) (=< 3 x ULN if considered to
             be due to leukemic involvement or Gilbert's syndrome)
          -  Aspartate aminotransferase or alanine aminotransferase =< 2.5 x ULN (=< 5.0 x ULN if
             considered to be due to leukemic involvement)
          -  Serum creatinine =< 2 x ULN or glomerular filtration rate (GFR) >= 50
          -  Patients must provide written informed consent
          -  In the absence of rapidly progressing disease, the interval from prior treatment to
             time of initiation of 5-azacytidine and nivolumab will be at least 2 weeks OR at least
             5 half-lives for cytotoxic/noncytotoxic agents; the half-life for the therapy in
             question will be based on published pharmacokinetic literature (abstracts,
             manuscripts, investigator brochure's, or drug-administration manuals) and will be
             documented in the protocol eligibility document; since the effect of both nivolumab
             and 5-azacytidine may be delayed; use of one dose of cytarabine (up to 2 g/m2) or
             hydroxyurea for patients with rapidly proliferative disease is allowed before the
             start of study therapy and during the study treatment; concurrent therapy for central
             nervous system (CNS) prophylaxis or continuation of therapy for controlled CNS disease
             is permitted
          -  Females must be surgically or biologically sterile or postmenopausal (amenorrheic for
             at least 12 months) or if of childbearing potential, must have a negative serum or
             urine pregnancy test within 72 hours before the start of the treatment
          -  Women of childbearing potential must agree to use an adequate method of contraception
             during the study and until 3 months after the last treatment; males must be surgically
             or biologically sterile or agree to use an adequate method of contraception during the
             study until 3 months after the last treatment; adequate methods of contraception
             include: total abstinence when this is in line with the preferred and usual lifestyle
             of the patient; periodic abstinence (e.g., calendar, ovulation, symptothermal,
             post-ovulation methods) and withdrawal are not acceptable methods of contraception;
             female sterilization (have had surgical bilateral oophorectomy with or without
             hysterectomy) or tubal ligation at least six weeks before taking study treatment; in
             case of oophorectomy alone, only when the reproductive status of the woman has been
             confirmed by follow up hormone level assessment; male sterilization (at least 6 months
             prior to screening); for female patients on the study, the vasectomized male partner
             should be the sole partner for that patient
          -  Combination of any of the two following
               -  Use of oral, injected or implanted hormonal methods of contraception or other
                  forms of hormonal contraception that have comparable efficacy (failure rate <
                  1%), for example hormone vaginal ring or transdermal hormone contraception
               -  Placement of an intrauterine device (IUD) or intrauterine system (IUS)
               -  Barrier methods of contraception: condom or occlusive cap (diaphragm or
                  cervical/vault caps) with spermicidal foam/gel/film/cream/ vaginal suppository;
                  in case of use of oral contraception, women should have been stable on the same
                  pill before taking study treatment; note: oral contraceptives are allowed but
                  should be used in conjunction with a barrier method of contraception
          -  Women are considered post-menopausal and not of child bearing potential if they have
             had 12 months of natural (spontaneous) amenorrhea with an appropriate clinical profile
             (e.g. age appropriate, history of vasomotor symptoms) or have had surgical bilateral
             oophorectomy (with or without hysterectomy) or tubal ligation at least six weeks ago;
             in the case of oophorectomy alone, only when the reproductive status of the woman has
             been confirmed by follow up hormone level assessment is she considered not of child
             bearing potential
          -  Patients with graft versus host disease (GVHD) active < grade 2 who are on a stable
             dose of immunosuppressive therapy (tacrolimus, cyclosporine, or other) for > 2 weeks
             will be included; Note: subjects may be using systemic corticosteroids or topical or
             inhaled corticosteroids
        Exclusion Criteria:
          -  Patients with known allergy or hypersensitivity to nivolumab, ipilimumab,
             5-azacytidine, or any of their components
          -  Patients with a known history of severe interstitial lung disease or severe
             pneumonitis or active pneumonitis that is uncontrolled in the opinion of the treating
             physician
          -  Patients who have previously been treated with nivolumab and/or ipilimumab in
             combination with 5-azacytidine will be excluded
          -  Patients with a known history of any of the following autoimmune diseases are
             excluded:
               -  Patients with a history of inflammatory bowel disease (including Crohn's disease
                  and ulcerative colitis)
               -  Patients with a history of rheumatoid arthritis, systemic progressive sclerosis
                  (scleroderma), systemic lupus erythematosus, autoimmune vasculitis (e.g.,
                  Wegener's granulomatosis)
          -  Patients with organ allografts (such as renal transplant) are excluded
          -  Patients with active GVHD > grade 2 will be excluded; patients with recent increase in
             the immunosuppressive medication dose within last 2 weeks to control GVHD will not be
             included; patients with grade 1 or lower GVHD on =< 10 mg prednisone without any
             additional immunosuppressive therapies (tacrolimus, prograf, etc) will be eligible
          -  Patients with symptomatic CNS leukemia or patients with poorly controlled CNS leukemia
          -  Active and uncontrolled disease/(active uncontrolled infection, uncontrolled
             hypertension despite adequate medical therapy, active and uncontrolled congestive
             heart failure New York Heart Association [NYHA] class III/IV, clinically significant
             and uncontrolled arrhythmia) as judged by the treating physician
          -  Patients with known human immunodeficiency virus seropositivity will be excluded
          -  Known to be positive for hepatitis B by surface antigen expression; known to have
             active hepatitis C infection (positive by polymerase chain reaction or on antiviral
             therapy for hepatitis C within the last 6 months)
          -  Any other medical, psychological, or social condition that may interfere with study
             participation or compliance, or compromise patient safety in the opinion of the
             investigator
          -  Patients unwilling or unable to comply with the protocol
          -  Pregnant or breastfeeding
          -  Acute promyelocytic leukemia (APL)