Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
using static CS_Contest.Utils;

namespace CS_Contest {
	using Li = List<int>;
	using LLi = List<List<int>>;
	class Program {
        static void Main(string[] args) {
			new Calc().Solve();
			return;
        }

		private class Calc {
			public void Solve() {
				int N = ReadInt();
				var a = ReadInt(' ');
				int cnt = 0;
				int sum = a[0];
				foreach (var item in a.Select((x,i)=>new { X = x, I = i }).Where(x=>x.I>=1).Select(x=>x.X)) {
					var asum = sum + item;
					if (asum * sum < 0) { sum += item;continue; }

					cnt += Abs(asum) + 1;
					sum = -1;
				}
				cnt.WL();
				return;
			}
		}
    }

	
	
    public static class Utils {
		public static int INF = (int)(1e9);
        public static void WL(this object obj) => WriteLine(obj);
        public static void WL(this string obj) => WriteLine(obj);
        public static void WL<T>(this IEnumerable<T> list) => list.ToList().ForEach(x => x.WL());
		public static int ReadInt() => int.Parse(ReadLine());
		public static List<int> ReadInt(char s) => ReadLine().Split(s).Select(int.Parse).ToList();
		public static long ReadLong() => long.Parse(ReadLine());
		public static List<long> ReadLong(char s) => ReadLine().Split(s).Select(long.Parse).ToList();
		public static void REP(int n,Action<int> act) {
			for (int i = 0; i < n; i++) {
				act(i);
			}
		}
		public static void RREP(int n,Action<int> act) {
			for (int i = n-1; i >=0; i--) {
				act(i);
			}
		}
		public static void REP(long n, Action<int> act) => REP((int)n, act);
		public static void RREP(long n, Action<int> act) => RREP((int)n, act);

		public static void Yes() => "Yes".WL();
		public static void No() => "No".WL();
		public static void YES() => "YES".WL();
		public static void NO() => "NO".WL();


		public static int ManhattanDistance(int x1, int y1, int x2, int y2) => Abs(x2 - x1) + Abs(y2 - y1);

		public class Tree {
			public LLi Graph;
			public Tree(int nodes) {
				Graph = new LLi();
				REP(nodes, x => {
					Graph.Add(new Li());
				});
			}
			public void Add(int x,int y) {
				Graph[x].Add(y);
				Graph[y].Add(x);
			}
		}
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'static'
    6 | using static System.Math;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'static'
    7 | using static System.Console;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'static'
    8 | using static CS_Contest.Utils;
      |       ^~~~~~
a.cc:11:20: error: 'List' does not name a type
   11 |         using Li = List<int>;
      |                    ^~~~
a.cc:12:21: error: 'List' does not name a type
   12 |         using LLi = List<List<int>>;
      |                     ^~~~
a.cc:14:26: error: 'string' has not been declared
   14 |         static void Main(string[] args) {
      |                          ^~~~~~
a.cc:14:35: error: expected ',' or '...' before 'args'
   14 |         static void Main(string[] args) {
      |                                   ^~~~
a.cc:19:24: error: expected ':' before 'class'
   19 |                 private class Calc {
      |                        ^~~~~~
      |                        :
a.cc:20:31: error: expected ':' before 'void'
   20 |                         public void Solve() {
      |                               ^~~~~
      |                               :
a.cc:35:18: error: expected ';' after class definition
   35 |                 }
      |                  ^
      |                  ;
a.cc:36:6: error: expected ';' after class definition
   36 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void CS_Contest::Program::Main(int*)':
a.cc:15:35: error: expected ';' before '.' token
   15 |                         new Calc().Solve();
      |                                   ^
a.cc: In member function 'void CS_Contest::Program::Calc::Solve()':
a.cc:21:41: error: 'ReadInt' was not declared in this scope
   21 |                                 int N = ReadInt();
      |                                         ^~~~~~~
a.cc:22:33: error: 'var' was not declared in this scope
   22 |                                 var a = ReadInt(' ');
      |                                 ^~~
a.cc:24:43: error: 'a' was not declared in this scope
   24 |                                 int sum = a[0];
      |                                           ^
a.cc:25:46: error: expected ')' before 'item'
   25 |                                 foreach (var item in a.Select((x,i)=>new { X = x, I = i }).Where(x=>x.I>=1).Select(x=>x.X)) {
      |                                              ^~~~
a.cc:25:41: note: to match this '('
   25 |                                 foreach (var item in a.Select((x,i)=>new { X = x, I = i }).Where(x=>x.I>=1).Select(x=>x.X)) {
      |                                         ^
a.cc:25:33: error: 'foreach' was not declared in this scope
   25 |                                 foreach (var item in a.Select((x,i)=>new { X = x, I = i }).Where(x=>x.I>=1).Select(x=>x.X)) {
      |                                 ^~~~~~~
a.cc:32:37: error: request for member 'WL' in 'cnt', which is of non-class type 'int'
   32 |                                 cnt.WL();
      |                                     ^~
a.cc: At global scope:
a.cc:40:5: error: expected unqualified-id before 'public'
   40 |     public static class Utils {
      |     ^~~~~~