Time-series from single Sentinel-2 band (cloud filter)

Thank you very much, your advice is realy helpful.
I combined 2 pices of code you paste here and I recived code like below:

function setup() {
  return {
    input: [
        {datasource: "l2a", bands:["SCL"]},
        {datasource: "l1c", bands:["B04"]}
    ],
    output: { bands: 2 },
    mosaicking: "SIMPLE"

  };
}

function isCloud (scl) {
  // Compute clouds based on SCL layer
  if (scl == 3) { // SC_CLOUD_SHADOW
    return true;
  } else if (scl == 9) { // SC_CLOUD_HIGH_PROBA
    return true; 
  } else if (scl == 8) { // SC_CLOUD_MEDIUM_PROBA
    return false;
  } else if (scl == 7) { // SC_CLOUD_LOW_PROBA
    return false;
  } else if (scl == 10) { // SC_THIN_CIRRUS
    return false;
  } else if (scl == 11) { // SC_SNOW_ICE
    return false;
  } else if (scl == 1) { // SC_SATURATED_DEFECTIVE
    return true;
  } else if (scl == 2) { // SC_DARK_FEATURE_SHADOW
     return true;
  }
  return false;
}

function evaluatePixel(samples) {
  var s2l1c_samples = samples.l1c[0];
  var s2l2a_samples = samples.l2a[0];
  var cloud = isCloud(s2l2a_samples.SCL);
 return [s2l1c_samples.B04, cloud];
}

I think it works. As for the display of the data on the map, I expect that it is l1c data filtered by the SCL layer from l2a. However, when I try to do the time series for some polygon, I get “Error: Dataset with id: l2a not found.” Why is this tool trying to reference l2a data? Do you know how to fix it? I would like to have a time series from the S2L1C data for exactly the same imagery (acquisition times) as for S2L2A (using the SCL layer).