This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved.Pikachu is a cute and friendly pokémon living in the wild pikachu herd.But it has become known recently that infamous team R wanted to steal all these pokémon! Pokémon trainer Andrew decided to help Pikachu to build a pokémon army to resist.First, Andrew counted all the pokémon — there were exactly $$$n$$$ pikachu. The strength of the $$$i$$$-th pokémon is equal to $$$a_i$$$, and all these numbers are distinct.As an army, Andrew can choose any non-empty subsequence of pokemons. In other words, Andrew chooses some array $$$b$$$ from $$$k$$$ indices such that $$$1 \le b_1 < b_2 < \dots < b_k \le n$$$, and his army will consist of pokémons with forces $$$a_{b_1}, a_{b_2}, \dots, a_{b_k}$$$.The strength of the army is equal to the alternating sum of elements of the subsequence; that is, $$$a_{b_1} - a_{b_2} + a_{b_3} - a_{b_4} + \dots$$$.Andrew is experimenting with pokémon order. He performs $$$q$$$ operations. In $$$i$$$-th operation Andrew swaps $$$l_i$$$-th and $$$r_i$$$-th pokémon.Note: $$$q=0$$$ in this version of the task.Andrew wants to know the maximal stregth of the army he can achieve with the initial pokémon placement. He also needs to know the maximal strength after each operation.Help Andrew and the pokémon, or team R will realize their tricky plan!

Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10^3$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 3 \cdot 10^5, q = 0$$$) denoting the number of pokémon and number of operations respectively. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le n$$$) denoting the strengths of the pokémon. $$$i$$$-th of the last $$$q$$$ lines contains two positive integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \le l_i \le r_i \le n$$$) denoting the indices of pokémon that were swapped in the $$$i$$$-th operation. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$, and the sum of $$$q$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$.

For each test case, print $$$q+1$$$ integers: the maximal strength of army before the swaps and after each swap.

NoteIn third test case we can build an army in such way: [1 2 5 4 3 6 7], its strength will be $$$5−3+7=9$$$.

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var N = nextInt();
    var list = nextIntArray();
    var max = 0;
    for(var j = 1; j < N - 1; j++){
      if(list[j] > list[j + 1] && list[j - 1] < list[j]){
        max += list[j];
      }
      if(list[j] < list[j + 1] && list[j - 1] > list[j]){
        max -= list[j];
      }
    }
    if(N >= 2){
      if(list[0] > list[1]){
        max += list[0];
      }
      if(list[N - 1] > list[N - 2]){
        max += list[N - 1];
      }
    }else{
      max = 1;
    }

    output[i] = max;
  }
  myout(myconv(output, 9));
}

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) != null) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) != null) return res;
    }
  }
}

function Arr(a, b, fn, init) {
  if (a < b) {
    let arr = Array(b + 1);
    if (init) init(arr);
    for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
    return arr;
  } else {
    let arr = Array(a + 1);
    if (init) init(arr);
    for (let i = a; i >= b; i--) arr[i] = fn(i, arr);
    return arr;
  }
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);
// let MOD = 998244353n;
// let gt = Arr(0, n, (i, a) => i == 0 ? 1n : a[i - 1] * BigInt(i) % MOD);
// let rgt = Arr(0, n, (i, a) => i <= 1 ? 1n : MOD - MOD / BigInt(i) * a[998244353 % i] % MOD);
// for (let i = 2; i < n; i++) rgt[i] = rgt[i] * rgt[i - 1] % MOD;
// let nCk = (n, k) => {
//   return gt[n] * rgt[k] * rgt[n - k] % MOD;
// }
// for (let i = dm[l.l]; i <= n + n; i += i & -i) s[i]++; // start from index 1

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let test = inp[r++];
  while (test--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    t = new SplayTree();
    for (let i = 0; i < n; i++) t.insert(i, a[i])
    console.log(t.root.p);
    // t.print();
    for (let i = 0; i < q; i++) {
      let li = inp[r++], ri = inp[r++];
      t.update(li - 1, a[ri - 1]);
      // t.print();
      t.update(ri - 1, a[li - 1]);
      // t.print();
      let temp = a[li - 1];
      a[li - 1] = a[ri - 1];
      a[ri - 1] = temp;
      console.log(t.root.p);
    }
  }
})();

class Node {
  left; right; key; value; p; m; pm; mp; size;
  constructor(key, value) {
    this.key = key;
    this.value = value;
    this.p = value;
    this.m = -value;
    this.pm = -1e10;
    this.mp = -1e10;
    this.size = 1;
  }
  update() {
    this.size = 1 + (this.left ? this.left.size : 0) + (this.right ? this.right.size : 0);
    if (this.left && this.right) {
      this.p = Math.max(this.left.p, this.right.p, this.value, this.left.p + this.right.mp, this.left.pm + this.right.p, this.left.pm + this.value, this.value + this.right.mp, this.left.p - this.value + this.right.p, this.left.pm + this.value + this.right.mp);
      this.m = Math.max(this.left.m, this.right.m, -this.value, this.left.mp - this.value, -this.value + this.right.pm, this.left.mp + this.right.m, this.left.m + this.right.pm, this.left.mp - this.value + this.right.pm, this.left.m + this.value + this.right.m);
      this.pm = Math.max(this.left.pm, this.right.pm, this.left.p + this.right.m, this.left.pm + this.right.pm, this.left.p - this.value, this.value + this.right.m, this.left.pm + this.value + this.right.m, this.left.p - this.value + this.right.pm);
      this.mp = Math.max(this.left.mp, this.right.mp, this.left.m + this.right.p, this.left.mp + this.right.mp, this.left.m + this.value, -this.value + this.right.p, this.left.mp - this.value + this.right.p, this.left.m + this.value + this.right.mp);
    } else if (this.left) {
      this.p = Math.max(this.value, this.left.p, this.left.pm + this.value);
      this.m = Math.max(-this.value, this.left.m, this.left.mp - this.value);
      this.pm = Math.max(this.left.pm, this.left.p - this.value);
      this.mp = Math.max(this.left.mp, this.left.m + this.value);
    } else if (this.right) {
      this.p = Math.max(this.value, this.right.p, this.value + this.right.mp);
      this.m = Math.max(-this.value, this.right.m, -this.value + this.right.pm);
      this.pm = Math.max(this.right.pm, this.value + this.right.m);
      this.mp = Math.max(this.right.mp, -this.value + this.right.p);
    } else {
      this.p = this.value;
      this.m = -this.value;
      this.pm = -1e10;
      this.mp = -1e10;
    }
  }
  toString() {
    return (this.left ? this.left.toString() + ' ' : '') + `(${this.key},${this.size},${this.value},${this.p},${this.m},${this.pm},${this.mp})` + (this.right ? ' ' + this.right.toString() : '')
  }
}

class SplayTree {
  root;
  constructor(node) {
    this.root = node;
  }

  uptree(x, p, g) {
    if (!g) {
      // lazy update p, x
      if (p.left == x) {
        p.left = x.right;
        x.right = p;
      } else {
        p.right = x.left;
        x.left = p;
      }
      p.update(); x.update();
      return x;
    }
    // lazy update g, p, x
    if (g.left == p && p.left == x) {
      g.left = p.right;
      p.right = g;
      p.left = x.right;
      x.right = p;
    } else if (g.right == p && p.right == x) {
      g.right = p.left;
      p.left = g;
      p.right = x.left;
      x.left = p;
    } else if (g.left == p) {
      p.right = x.left;
      x.left = p;
      g.left = x.right;
      x.right = g;
    } else {
      p.left = x.right;
      x.right = p;
      g.right = x.left;
      x.left = g;
    }
    g.update(); p.update(); x.update();
    return x;
  }

  splay(trace) {
    var x = trace.pop();
    while (true) {
      var p = trace.pop();
      var g = trace.pop();
      if (!p) return this.root = x;
      if (!g || !trace.length) return this.root = this.uptree(x, p, g);
      if (trace[trace.length - 1].left == g) trace[trace.length - 1].left = x = this.uptree(x, p, g);
      else trace[trace.length - 1].right = x = this.uptree(x, p, g);
    }
  }

  insert(key, value) {
    if (!this.root) return this.root = new Node(key, value);
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur = trace[trace.length - 1];
    if (key < cur.key) trace.push(cur.left = new Node(key, value));
    else trace.push(cur.right = new Node(key, value));
    // cur.update();
    this.splay(trace);
  }

  join(tree) {
    if (!this.root) return this.root = tree.root;
    var trace = [this.root];
    var cur = this.root;
    while (cur.right) trace.push(cur = cur.right);
    this.splay(trace);
    this.root.right = tree.root;
    this.root.update();
  }

  remove(key) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    if (trace[trace.length - 1].key != key) return;
    this.splay(trace);
    var tree = new SplayTree(this.root.right);
    this.root = this.root.left;
    this.join(tree);
  }

  update(key, value) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur.value = value;
    // for (let i = trace.length - 1; i >= 0; i--) {
    //   trace[i].update();
    // }
    this.splay(trace);
  }

  res() {
    if (!this.root) return 0;
    return (this.root.max - this.root.min - this.root.maxGap) || 0
  }

  print() {
    return;
    console.log(this.root ? this.root.toString() : undefined);
  }
}

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    for (let i = 1; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(cong[n - 1]);
  }
})();

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);
// let MOD = 998244353n;
// let gt = Arr(0, n, (i, a) => i == 0 ? 1n : a[i - 1] * BigInt(i) % MOD);
// let rgt = Arr(0, n, (i, a) => i <= 1 ? 1n : MOD - MOD / BigInt(i) * a[998244353 % i] % MOD);
// for (let i = 2; i < n; i++) rgt[i] = rgt[i] * rgt[i - 1] % MOD;
// let nCk = (n, k) => {
//   return gt[n] * rgt[k] * rgt[n - k] % MOD;
// }
// for (let i = dm[l.l]; i <= n + n; i += i & -i) s[i]++; // start from index 1

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let test = inp[r++];
  let ans = [];
  while (test--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    t = new SplayTree();
    for (let i = 0; i < n; i++) t.insert(i, a[i])
    ans.push(t.root.p);
    // t.print();
    for (let i = 0; i < q; i++) {
      let li = inp[r++], ri = inp[r++];
      t.update(li - 1, a[ri - 1]);
      // t.print();
      t.update(ri - 1, a[li - 1]);
      // t.print();
      let temp = a[li - 1];
      a[li - 1] = a[ri - 1];
      a[ri - 1] = temp;
      ans.push(t.root.p);
    }
  }
  console.log(ans.join('\n'));
})();

class Node {
  left; right; key; value; p; m; pm; mp;
  constructor(key, value) {
    this.key = key;
    this.value = value;
    this.p = value;
    this.m = -value;
    this.pm = -1e10;
    this.mp = -1e10;
  }
  update() {
    if (this.left && this.right) {
      this.p = Math.max(this.left.p, this.right.p, this.value, this.left.p + this.right.mp, this.left.pm + this.right.p, this.left.pm + this.value, this.value + this.right.mp, this.left.p - this.value + this.right.p, this.left.pm + this.value + this.right.mp);
      this.m = Math.max(this.left.m, this.right.m, -this.value, this.left.mp - this.value, -this.value + this.right.pm, this.left.mp + this.right.m, this.left.m + this.right.pm, this.left.mp - this.value + this.right.pm, this.left.m + this.value + this.right.m);
      this.pm = Math.max(this.left.pm, this.right.pm, this.left.p + this.right.m, this.left.pm + this.right.pm, this.left.p - this.value, this.value + this.right.m, this.left.pm + this.value + this.right.m, this.left.p - this.value + this.right.pm);
      this.mp = Math.max(this.left.mp, this.right.mp, this.left.m + this.right.p, this.left.mp + this.right.mp, this.left.m + this.value, -this.value + this.right.p, this.left.mp - this.value + this.right.p, this.left.m + this.value + this.right.mp);
    } else if (this.left) {
      this.p = Math.max(this.value, this.left.p, this.left.pm + this.value);
      this.m = Math.max(-this.value, this.left.m, this.left.mp - this.value);
      this.pm = Math.max(this.left.pm, this.left.p - this.value);
      this.mp = Math.max(this.left.mp, this.left.m + this.value);
    } else if (this.right) {
      this.p = Math.max(this.value, this.right.p, this.value + this.right.mp);
      this.m = Math.max(-this.value, this.right.m, -this.value + this.right.pm);
      this.pm = Math.max(this.right.pm, this.value + this.right.m);
      this.mp = Math.max(this.right.mp, -this.value + this.right.p);
    } else {
      this.p = this.value;
      this.m = -this.value;
      this.pm = -1e10;
      this.mp = -1e10;
    }
  }
  // toString() {
  //   return (this.left ? this.left.toString() + ' ' : '') + `(${this.key},${this.size},${this.value},${this.p},${this.m},${this.pm},${this.mp})` + (this.right ? ' ' + this.right.toString() : '')
  // }
}

class SplayTree {
  root;
  constructor(node) {
    this.root = node;
  }

  uptree(x, p, g) {
    if (!g) {
      // lazy update p, x
      if (p.left == x) {
        p.left = x.right;
        x.right = p;
      } else {
        p.right = x.left;
        x.left = p;
      }
      p.update(); x.update();
      return x;
    }
    // lazy update g, p, x
    if (g.left == p && p.left == x) {
      g.left = p.right;
      p.right = g;
      p.left = x.right;
      x.right = p;
    } else if (g.right == p && p.right == x) {
      g.right = p.left;
      p.left = g;
      p.right = x.left;
      x.left = p;
    } else if (g.left == p) {
      p.right = x.left;
      x.left = p;
      g.left = x.right;
      x.right = g;
    } else {
      p.left = x.right;
      x.right = p;
      g.right = x.left;
      x.left = g;
    }
    g.update(); p.update(); x.update();
    return x;
  }

  splay(trace) {
    var x = trace.pop();
    while (true) {
      var p = trace.pop();
      var g = trace.pop();
      if (!p) return this.root = x;
      if (!g || !trace.length) return this.root = this.uptree(x, p, g);
      if (trace[trace.length - 1].left == g) trace[trace.length - 1].left = x = this.uptree(x, p, g);
      else trace[trace.length - 1].right = x = this.uptree(x, p, g);
    }
  }

  insert(key, value) {
    if (!this.root) return this.root = new Node(key, value);
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur = trace[trace.length - 1];
    if (key < cur.key) trace.push(cur.left = new Node(key, value));
    else trace.push(cur.right = new Node(key, value));
    this.splay(trace);
  }

  join(tree) {
    if (!this.root) return this.root = tree.root;
    var trace = [this.root];
    var cur = this.root;
    while (cur.right) trace.push(cur = cur.right);
    this.splay(trace);
    this.root.right = tree.root;
    this.root.update();
  }

  remove(key) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    if (trace[trace.length - 1].key != key) return;
    this.splay(trace);
    var tree = new SplayTree(this.root.right);
    this.root = this.root.left;
    this.join(tree);
  }

  update(key, value) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur.value = value;
    this.splay(trace);
  }

  res() {
    if (!this.root) return 0;
    return (this.root.max - this.root.min - this.root.maxGap) || 0
  }

  print() {
    return;
    console.log(this.root ? this.root.toString() : undefined);
  }
}

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) != null) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) != null) return res;
    }
  }
}

function Arr(a, b, fn, init) {
  if (a < b) {
    let arr = Array(b + 1);
    if (init) init(arr);
    for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
    return arr;
  } else {
    let arr = Array(a + 1);
    if (init) init(arr);
    for (let i = a; i >= b; i--) arr[i] = fn(i, arr);
    return arr;
  }
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);
// let MOD = 998244353n;
// let gt = Arr(0, n, (i, a) => i == 0 ? 1n : a[i - 1] * BigInt(i) % MOD);
// let rgt = Arr(0, n, (i, a) => i <= 1 ? 1n : MOD - MOD / BigInt(i) * a[998244353 % i] % MOD);
// for (let i = 2; i < n; i++) rgt[i] = rgt[i] * rgt[i - 1] % MOD;
// let nCk = (n, k) => {
//   return gt[n] * rgt[k] * rgt[n - k] % MOD;
// }
// for (let i = dm[l.l]; i <= n + n; i += i & -i) s[i]++; // start from index 1

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let test = inp[r++];
  while (test--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    t = new SplayTree();
    for (let i = 0; i < n; i++) t.insert(i, a[i]);
    console.log(t.root.p);
  }
})();

class Node {
  left; right; key; value; p; m; pm; mp;
  constructor(key, value) {
    this.key = key;
    this.value = value;
    this.p = value;
    this.m = -value;
    this.pm = -1e10;
    this.mp = -1e10;
  }
  update() {
    if (this.left && this.right) {
      this.p = Math.max(this.left.p, this.right.p, this.value, this.left.p + this.right.mp, this.left.pm + this.right.p, this.left.pm + this.value, this.value + this.right.mp, this.left.p - this.value + this.right.p, this.left.pm + this.value + this.right.mp);
      this.m = Math.max(this.left.m, this.right.m, -this.value, this.left.mp - this.value, -this.value + this.right.pm, this.left.mp + this.right.m, this.left.m + this.right.pm, this.left.mp - this.value + this.right.pm, this.left.m + this.value + this.right.m);
      this.pm = Math.max(this.left.pm, this.right.pm, this.left.p + this.right.m, this.left.pm + this.right.pm, this.left.p - this.value, this.value + this.right.m, this.left.pm + this.value + this.right.m, this.left.p - this.value + this.pm);
      this.mp = Math.max(this.left.mp, this.right.mp, this.left.m + this.right.p, this.left.mp + this.right.mp, this.left.m + this.value, -this.value + this.right.p, this.left.mp - this.value + this.right.p, this.left.m + this.value + this.mp);
    } else if (this.left) {
      this.p = Math.max(this.value, this.left.p, this.left.pm + this.value);
      this.m = Math.max(-this.value, this.left.m, this.left.mp - this.value);
      this.pm = Math.max(this.left.pm, this.left.p - this.value);
      this.mp = Math.max(this.left.mp, this.left.m + this.value);
    } else if (this.right) {
      this.p = Math.max(this.value, this.right.p, this.value + this.right.mp);
      this.m = Math.max(-this.value, this.right.m, -this.value + this.right.pm);
      this.pm = Math.max(this.right.pm, this.value + this.m);
      this.mp = Math.max(this.right.mp, -this.value + this.p);
    }
  }
  // toString() {
  //   return (this.left ? this.left.toString() + ' ' : '') + `${this.key},${this.min},${this.max}` + (this.right ? ' ' + this.right.toString() : '')
  // }
}

class SplayTree {
  root;
  constructor(node) {
    this.root = node;
  }

  uptree(x, p, g) {
    if (!g) {
      // lazy update p, x
      if (p.left == x) {
        p.left = x.right;
        x.right = p;
      } else {
        p.right = x.left;
        x.left = p;
      }
      p.update(); x.update();
      return x;
    }
    // lazy update g, p, x
    if (g.left == p && p.left == x) {
      g.left = p.right;
      p.right = g;
      p.left = x.right;
      x.right = p;
    } else if (g.right == p && p.right == x) {
      g.right = p.left;
      p.left = g;
      p.right = x.left;
      x.left = p;
    } else if (g.left == p) {
      p.right = x.left;
      x.left = p;
      g.left = x.right;
      x.right = g;
    } else {
      p.left = x.right;
      x.right = p;
      g.right = x.left;
      x.left = g;
    }
    g.update(); p.update(); x.update();
    return x;
  }

  splay(trace) {
    var x = trace.pop();
    while (true) {
      var p = trace.pop();
      var g = trace.pop();
      if (!p) return this.root = x;
      if (!g || !trace.length) return this.root = this.uptree(x, p, g);
      if (trace[trace.length - 1].left == g) trace[trace.length - 1].left = x = this.uptree(x, p, g);
      else trace[trace.length - 1].right = x = this.uptree(x, p, g);
    }
  }

  insert(key, value) {
    if (!this.root) return this.root = new Node(key, value);
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      cur = key < cur.key ? cur.left : cur.right;
    }
    cur = trace[trace.length - 1];
    if (key < cur.key) trace.push[cur.left = new Node(key, value)];
    else trace.push[cur.right = new Node(key, value)];
    cur.update();
    this.splay(trace);
  }

  join(tree) {
    if (!this.root) return this.root = tree.root;
    var trace = [this.root];
    var cur = this.root;
    while (cur.right) trace.push(cur = cur.right);
    this.splay(trace);
    this.root.right = tree.root;
    this.root.update();
  }

  remove(key) {
    if (!this.root) return;
    var trace = [];
    var cur = this.root;
    while (cur) {
      trace.push(cur);
      if (cur.key == key) break;
      cur = key < cur.key ? cur.left : cur.right;
    }
    if (trace[trace.length - 1].key != key) return;
    this.splay(trace);
    var tree = new SplayTree(this.root.right);
    this.root = this.root.left;
    this.join(tree);
  }

  res() {
    if (!this.root) return 0;
    return (this.root.max - this.root.min - this.root.maxGap) || 0
  }

  print() {
    console.log(this.root ? this.root.toString() : undefined);
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    C();
});

function readline() {
    return inputString[currentLine++];
}

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        let a = ti(readline().split(' '));

        let isReverseSorted = true;
        let allSame = true;
        for(let i = 1; i < n; i++){
            if(a[i] !== a[i-1]){
                allSame = false;
            }

            if(a[i] > a[i-1]){
                isReverseSorted = false;
                break;
            }
        }

        if(isReverseSorted){
            if(!allSame)
                console.log('No');
            else
                console.log('Yes');
        }else{
            console.log('Yes');
        }
    }
}

function C(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let [n, q] = ti(readline().split(' '));
        let a = ti(readline().split(' '));

        let dp = new Array(n);
        for(let i = 0; i < n; i++)
            dp[i] = new Array(2);

        let maxPos = a[0];
        let maxNeg = 0;
        for(let i = 1; i < n; i++){
            dp[i][0] = maxNeg + a[i];
            dp[i][1] = maxPos - a[i];

            maxPos = Math.max(maxPos, dp[i][0]);
            maxNeg = Math.max(maxNeg, dp[i][1]);
        }

        console.log(Math.max(maxPos, maxNeg));
    }
}

function solv() {
    var ip = readline().split(' ').map(x => parseInt(x))

    var x = ip[0]
    var y = ip[1]

    var s = readline().split(' ').map(x => parseInt(x))

    var a = [s[0]]
    var b = [0]

    for (var n = 1; n < x; n++) {
        var p = b[n - 1] + s[n]
        var q = a[n - 1] - s[n]
        a.push(Math.max(a[n - 1], p))
        b.push(Math.max(b[n - 1], q))
    }

    print(Math.max(a[x - 1], b[x - 1]))
}

var tc = 1;
tc = parseInt(readline());
while (tc--) solv()

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var N = nextInt();
    var list = nextIntArray();
    var index = -1;
    for(var j = 0; j < N; j++){
      if(list[j] == N){
        index = j;
        break;
      }
    }
    var max = 0;
    for(var j = 1; j < N - 1; j++){
      if(list[j] > list[j + 1] && list[j - 1] < list[j]){
        max += list[j];
      }
      if(list[j] < list[j + 1] && list[j - 1] > list[j]){
        max -= list[j];
      }
    }
    if(N >= 2){
      if(list[0] > list[1]){
        max += list[0];
      }
      if(list[N - 1] > list[N - 2]){
        max += list[N - 1];
      }
    }

    output[i] = max;
  }
  myout(myconv(output, 9));
}

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    if (n == 1) {
      console.log(a[0]);
      return;
    }
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    cong[1] = a[1];
    tru[1] = Math.max(0, a[0] - a[1])
    for (let i = 2; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(cong[n - 1]);
  }
})();

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    if (n == 1) {
      console.log(a[0]);
      continue;
    }
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    cong[1] = a[1];
    tru[1] = Math.max(0, a[0] - a[1])
    for (let i = 2; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(cong[n - 1]);
  }
})();

let input = '';
let inputResolve;
let inputPromise = new Promise(resolve => inputResolve = resolve);
process.stdin.on('data', c => input += c);
process.stdin.on('end', () => inputResolve());

function For(a, b, fn) {
  let res;
  if (a < b) {
    for (let i = a; i <= b; i++) {
      if ((res = fn(i)) !== undefined) return res;
    }
  } else {
    for (let i = a; i >= b; i--) {
      if ((res = fn(i)) !== undefined) return res;
    }
  }
}

function Arr(a, b, fn, prev) {
  let p = prev || 0;
  if (a < b) return Array(b - a + 1).fill(0).map((v, i) => fn ? (p = fn(a + i, p)) : a + i);
  return Array(a - b + 1).fill(0).map((v, i) => fn ? (p = fn(a - i, p)) : a - i);
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn(v)).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = Math.min(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == min : v == min);
  return [this[i], i, min];
}
Array.prototype.max = function (fn) {
  let max = Math.max(...this.map((v, i) => fn ? fn(v, i) : v));
  let i = this.findIndex((v, i) => fn ? fn(v, i) == max : v == max);
  return [this[i], i, max];
}

function gcd(a, b) {
  if (!b) return a;
  return gcd(b, a % b);
}
function mod(a, n, m) {
  if (n == 0n) return 1n;
  if (n % 2n == 0n) return mod(a * a % m, n / 2n, m);
  return a * mod(a, n - 1n, m) % m;
}
function extendedEuclid(a, b) {
  if (!b) return [1, 0];
  else {
    let [x, y] = extendedEuclid(b, a % b);
    return [y, x - (a / b | 0) * y];
  }
}
// [m] = extendedEuclid(a, 998244353);

(async () => {
  await inputPromise;
  let inp = input.split(/\s+/).map(v => +v); r = 0;
  let t = inp[r++];
  while (t--) {
    let n = inp[r++], q = inp[r++];
    let a = inp.slice(r, r = r + n);
    if (n == 1) {
      console.log(a[0]);
      return;
    }
    let cong = Array(n).fill(0);
    let tru = Array(n).fill(0);
    cong[0] = a[0];
    cong[1] = a[1];
    for (let i = 2; i < n; i++) {
      cong[i] = Math.max(tru[i - 1] + a[i], cong[i - 1]);
      tru[i] = Math.max(cong[i - 1] - a[i], tru[i - 1])
    }
    console.log(Math.max(...cong));
  }
})();