Submission details
Task:Array
Sender: >--) ) ) )*>
Submission time:2015-09-30 19:21:52 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:75:1: error: 'e' was not declared in this scope
 e  for(; s[wb] - (wa >= 0 ? s[wa] : 0) < x; wb++);
 ^
input/code.cpp:75:40: warning: value computed is not used [-Wunused-value]
 e  for(; s[wb] - (wa >= 0 ? s[wa] : 0) < x; wb++);
                                        ^
input/code.cpp:75:49: error: expected ';' before ')' token
 e  for(; s[wb] - (wa >= 0 ? s[wa] : 0) < x; wb++);
                                                 ^

Code

#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

#define ll long long
#define ld long double
#define ii pair<int,int>
#define si pair<string,int>
#define iii pair<int,ii>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define msvs map<string,vs>
#define msi map<string,int>
#define mss map<string,int>
#define us unordered_set
#define um unordered_map
#define pq priority_queue
#define pb push_back
#define mp make_pair
#define forall(i,a,b) for (int i=a;i<b;i++)
#define foreach(v,c) for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define N (1<<17)
#define M 1000000007
#define I 500000004

vector<ll> a;
vector<ll> s;

ll summa(int i, int j) {
	if (i == 0) return s[j];
	return s[j]-s[i-1];
}

int main()
{
	ll n,x; cin >> n >> x;
	for (int i = 0; i < n; i++) {
		ll t; cin >> t; a.pb(t);
	}
	s.pb(a[0]);
	for (int i = 1; i < n; i++) {
		ll t = s[i-1]+a[i];
		s.pb(t);
	}
	sort(s.begin(),s.end());
	int wa,wb;
	ll c = 0;
	wa = -1; wb = -1;
	for ( wb = 0; wb < n; wb++){
e		for(; s[wb] - (wa >= 0 ? s[wa] : 0) < x; wb++);
		while (1) {
			for (; s[wb] - (wa >= 0 ? s[wa] : 0) == x; wa++) c++;
			for (; s[wb] - (wa >= 0 ? s[wa] : 0) > x; wa++);
			if (s[wb]-s[wa] < x) break;
		}
	}
	for(; wa < n; wa++)
		if(s[wb] -s[wa] == x)
			c++;

	cout << c << "\n";
}