stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<algorithm>

using namespace std;

typedef long long unsigned int ll;







int main(){

    int n;

    cin>>n;

    ll m;

    cin>>m;

    ll a[100005];

    for(int i=0;i<n;i++){

        cin>>a[i];

        a[i]%=m;

    }

    

    

    map<ll,ll> mod;

    ll sum[100005]={0};

    mod[0]=1;

    for(int i=0;i<n;i++){

        sum[i+1]=a[i]+sum[i];

        sum[i+1]%=m;

        mod[sum[i+1]]++;

    }

    

    /*for(int i=1;i<=n;i++){

        mod[sum[i]]++;

    }*/

    ll ans=0;

    for(auto i : mod){

        ans += (i.second*(i.second - 1)) / 2;

    }

    

    cout<<ans<<endl;

    return 0;

}




// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#include<algorithm>

using namespace std;

typedef long long unsigned int ll;







int main(){

    int n;

    cin>>n;

    ll m;

    cin>>m;

    ll a[100005];

    for(int i=0;i<n;i++){

        cin>>a[i];

        a[i]%=m;

    }

    

    

    map<ll,ll> mod;

    ll sum[100005];

    sum[0]=0;

    mod[0]=1;

    for(int i=0;i<n;i++){

        sum[i+1]=a[i]+sum[i];

        sum[i+1]%=m;

        mod[sum[i+1]]++;

    }

   

    ll ans=0;

    for(auto i : mod){

        ans += (i.second*(i.second - 1)) / 2;

    }

    

    cout<<ans<<endl;

    return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<stdio.h>

//#include <bits/stdc++.h>

#include<vector>

#include<float.h>

#include<iomanip>

#include<algorithm>

#include<string>

#include<cstring>

#include<math.h>

#include<cmath>

#include<sstream>

#include<set>

#include<map>

#include<queue>

#include <cassert>

#include <cmath>

#include<cstdint>



#define INF 1e9

#define rep(i,n)for(int i=0;(i)<(int)(n);i++)

#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)

#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;

#define vec(type,n) vector<type>(n)

#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

#define ALL(a)  (a).begin(),(a).end()





using namespace std;

using ll = long long;

using Graph = vector<vector<int>>;

using P = pair<ll, ll>;



struct edge{

    int to;

    int dist;

};



vector<bool> seen(100000, false);

vector<int> pnt(100000, INF);

vector<vector<edge>> G(100000);

int n, m;

bool f = true;





void dfs(int v, int dist){

    seen[v] = true;

    if(pnt[v] == INF)pnt[v] = dist;

    else {

        if(pnt[v] != dist)f = false;

        return;

    }



    for(int i = 0; i < (int)(G[v].size()); i++){

        edge e = G[v][i];

        if(pnt[e.to] != INF && pnt[e.to] != pnt[v] + e.dist){

            f = false;

            return;

        }

        if(seen[e.to])continue;

        dfs(e.to, e.dist + pnt[v]);

    }

}



int main(){

    ll n, m;

    cin >> n >> m;

    vector<ll> rui(n + 1, 0);

    rep(i, n){

        ll a;

        cin >> a;

        rui[i + 1] = rui[i] + a;

    }

    ll res = 0;

    REP(i, 1, n){

        rui[i] %= m;

        if(rui[i] == 0)res++;

    }

    map<ll, ll> mp;

    REP(i, 1, n)mp[rui[i]]++;



    for(auto m : mp){

        res += m.second * (m.second - 1) / 2;

    }

    cout << res << endl;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<stdio.h>

//#include <bits/stdc++.h>

#include<vector>

#include<float.h>

#include<iomanip>

#include<algorithm>

#include<string>

#include<cstring>

#include<math.h>

#include<cmath>

#include<sstream>

#include<set>

#include<map>

#include<queue>

#include <cassert>

#include <cmath>

#include<cstdint>



#define INF 1e9

#define rep(i,n)for(int i=0;(i)<(int)(n);i++)

#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)

#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;

#define vec(type,n) vector<type>(n)

#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

#define ALL(a)  (a).begin(),(a).end()





using namespace std;

using ll = long long;

using Graph = vector<vector<int>>;

using P = pair<ll, ll>;







int main(){

    int n, m;

    cin >> n >> m;

    vector<ll> v(n);

    map<ll, ll>mp;

    ll res = 0;

    rep(i, n){

        int a;

        cin >> a;

        if(i == 0)v[i] = a;

        else v[i] = v[i - 1] + a;

        v[i] %= m;

        mp[v[i]]++;

        if(v[i] == 0)res++;

    }

    for(auto m : mp){

        res += (m.second) * (m.second - 1) / 2;

    }

    cout << res << endl;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<tuple>

using namespace std;

#define ll long long

int main(){

  int n, m;

  ll a[100000], b[100001] = {}, ans = 0;

  map<ll, ll> d;

  cin >> n >> m;

  d[0]++;

  for(int i=0;i<n;i++){

    cin >> a[i];

    b[i+1] = (a[i] + b[i]) % m; 

    d[b[i+1]]++;

  }

  for(map<ll, ll>::iterator iter = d.begin();iter !=d.end();iter++){

    ans += (iter->second * (iter->second -1)) / 2;

  }

  cout << ans << endl;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main(){

  int n, m;

  int a, buf = 0;

  ll ans = 0;

  map<int, int> d;

  cin >> n >> m;

  d[0]++;

  for(int i=0;i<n;i++){

    cin >> a;

    buf = (a + buf) % m; 

    d[buf]++;

  }

  for(map<int, int>::iterator iter = d.begin();iter !=d.end();iter++){

    ll cnt = iter->second;

    ans += (cnt * (cnt - 1)) / 2;

  }

  cout << ans << endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define LL long long int

using namespace std;



LL sum[100010];

LL a[100010];

map<LL,LL> Q;



int main()

{

    LL n,m;

    while(scanf("%lld%lld",&n,&m)!=EOF)

    {

        Q.clear();

        sum[0]=0;

        LL ans=0;

        for(LL i=1;i<=n;i++)

        {

            scanf("%I64d",&a[i]);

            sum[i]=sum[i-1]+a[i];

            sum[i]%=m;

            Q[sum[i]]++;

        }

        Q[0]++;

        map<LL,LL>::iterator it=Q.begin();

        while(it!=Q.end())

        {

            ans+=(it->second)*(it->second-1)/2;

            it++;

        }

        printf("%lld\n",ans);

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<algorithm>

#define ll long long

#define maxn 100010

using namespace std;



ll pre[maxn];

ll a[maxn];



int main()

{

    ll i,n,m,t = 1,sum = 0;



    scanf("%lld%lld",&n,&m);

    pre[0] = 0;

    for(i = 1; i <= n; i++)

    {

        scanf("%lld",&a[i]);

        pre[i] = (pre[i-1]+a[i])%m;

    }

    sort(pre+1,pre+n+1);



    for(i = 1; i <= n; i++)

    {

        if(pre[i] == pre[i-1])

            t++;

        else

        {

            sum += t*(t-1)>>1;

            t = 1;

        }

    }

    sum += t*(t-1)>>1;

    printf("%lld\n",sum);



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



long long memo[100010];



long long sum(int x) {

  if (memo[x] != -1) return memo[x];

  return memo[x] = x + sum(x - 1);

}



int main() {

  ios::sync_with_stdio(false);

  cin.tie(0);

  for (int i = 0; i < 100010; i++) memo[i] = -1;

  memo[0] = 0;

  memo[1] = 1;

  int n, m;

  cin >> n >> m;

  vector<int> a(n + 1, 0);

  for (int i = 1; i <= n; i++) cin >> a[i];

  map<int, int> mp;

  for (int i = 1; i <= n; i++) {

    a[i] = (a[i] + a[i - 1]) % m;

  }

  for (int i = 1; i <= n; i++) {

    mp[a[i]]++;

  }

  long long ans = 0;

  for (auto kv: mp) {

    if (kv.first == 0) {

      ans += sum(kv.second);

    } else {

      ans += sum(kv.second - 1);

    }

  }

  cout << ans << endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



#define rep(i, n) for (int i = 0; i < int(n); i++)

#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)

#define reps(i, n) for (int i = 1; i <= int(n); i++)

#define rreps(i, n) for (int i = int(n); i >= 1; i--)

#define repi(i, a, b) for (int i = (a); i < int(b); i++)

#define all(a) (a).begin(), (a).end()

#define bit(b) (1ull << (b))



using namespace std;

using i32 = int;

using i64 = long long;

using f64 = double;

using vi32 = vector<i32>;

using vi64 = vector<i64>;

using vf64 = vector<f64>;

using vstr = vector<string>;



template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }

template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }



int main() {

  ios::sync_with_stdio(false);

  cin.tie(0);

  cout << fixed << setprecision(16);

  i32 n, m; cin >> n >> m;

  vi64 a(n); rep(i, n) cin >> a[i];

  vi64 sums(n + 1, 0);

  rep(i, n) sums[i + 1] = (sums[i] + a[i]) % m;

  map<i64, i64> mp;

  rep(i, n + 1) mp[sums[i]]++;

  i64 ans = 0;

  for (auto v: mp) {

    ans += v.second * (v.second - 1) / 2;

  }

  cout << ans << endl;

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main () {

	int a,b;

	scanf("%d", &a);

	b=a*800-a/15*200;

	printf("%d\n",b);

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int N,x,y,s,a;

	1<=N<=100;

	scanf("%d",&N);

	s=N/15;

	x=800*N;

	y=200*s;

	a=x-y;

	printf("%d",a);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int a;



int main(){

	cin>>a;

	cout<<a*800-floor(a/15)*200<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int N,x,y,s,a;

	1<=N<=100;

	scanf("%d",&N);

	s=N/15;

	x=800*N;

	y=200*s;

	a=x-y;

	printf("%d",a);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    int n,x ;

    cin >> n;

    x=n/15;

    cout << (n*800)-(x*200) ;



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int N,x,y,s,a;

	1<=N<=100;

	scanf("%d",&N);

	s=N/15;

	x=800*N;

	y=200*s;

	a=x-y;

	printf("%d",a);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int x,y,n;



int main () {

	cin >> n;

	x=800*n;y=n/15*200;n=x-y;

	cout << n << endl;



}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int N,x,y,s,a;

	1<=N<=100;

	scanf("%d",&N);

	s=N/15;

	x=800*N;

	y=200*s;

	a=x-y;

	printf("%d",a);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int N;

int main(){

    cin>>N;

    cout<<800*N-200*(N/15)<<endl;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int N,x,y,s,a;

	1<=N<=100;

	scanf("%d",&N);

	s=N/15;

	x=800*N;

	y=200*s;

	a=x-y;

	printf("%d",a);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

   int n,p,q;

   cin>>n;

   q=n/15;

   p=n*800-200*q;



   cout<<p<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main()

{

	int N,x,y,s,a;

	1<=N<=100;

	scanf("%d",&N);

	s=N/15;

	x=800*N;

	y=200*s;

	a=x-y;

	printf("%d",a);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main() {

	int N, x, y;

	cin >> N;

	y = N / 15 * 200;

	x = N * 800;

	cout << x - y << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <string>

#include <cmath>

#include <algorithm>

#include <vector>

#include <map>

#include <queue>

#include <set>

using namespace std;

typedef long long LL;

const int MaxN = 1e5;

const int Inf = 1 << 30;



int main()

{

	int N;

	while(~scanf("%d",&N)){

		printf("%d\n",800 * N - N / 15 * 200);

	}

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int n;

int main() {

	cin >> n;

	cout << n * 800 - n / 15 * 200 << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

int main() {

	int n;

	scanf("%d", &n);

	printf("%d\n", n * 800 - n / 15 * 200);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std;



int main()

{

int a,b,c,d,e;



cin>>b;

c=b/15;

e=c*200;

a=b*800;

d=a-e;

cout<<d;



return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main()

{

   int N, B, x, y;

   scanf("%d", &N);

   x=N*800;

   y=(N/15)*200;

   printf("%d\n", x-y);

   return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main(){

    int a,b;

    cin>>a;

    b=a/15;

    a=(a*800)-(b*200);

    cout<<a;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main()

{

   int N, B, x, y;

   scanf("%d", &N);

   x=N*800;

   y=(N/15)*200;

   printf("%d\n", x-y);

   return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int x, n, y, z=0, i, t;

	scanf("%d", &n);

	z=800*n;

	if(n>15){

		i=n/15;

		t=z-(i*200);

		printf("%d", t);

	}

	else{

		printf("%d", z);

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main()

{

   int N, B, x, y;

   scanf("%d", &N);

   x=N*800;

   y=(N/15)*200;

   printf("%d\n", x-y);

   return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n,x,y,d;

    scanf("%d",&n);

    x=n*800;

    y=(n/15)*200;

	d=x-y;

	printf("%d",d);

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main()

{

   int N, B, x, y;

   scanf("%d", &N);

   x=N*800;

   y=(N/15)*200;

   printf("%d\n", x-y);

   return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int N;



int main () {

	cin >> N;

	cout << N*800-(N/15)*200 << endl;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

using namespace std;

int main()

{

   int N, B, x, y;

   scanf("%d", &N);

   x=N*800;

   y=(N/15)*200;

   printf("%d\n", x-y);

   return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<stack>

#include<cmath>

#include<cstring>

using namespace std;



int a[55];

int main()

{

	int n;

	while(cin>>n)

	{

		memset(a,0,sizeof(a));

		for(int i=0;i<n;i++)

		{

			cin>>a[i];

		}

		long long int sum=0;

		for(int i=0;i<n;i++)

		{

			for(int j=i+1;j<n;j++)

			{

				sum+= a[i]*a[j];

			}

		}

		cout<<sum<<endl;

	}

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>

int main()

{

    int n,sum=0;

    scanf("%d",&n);

    int ch[55];

    for(int i=0;i<n;i++)

        scanf("%d",&ch[i]);

    for(int i=0;i<n;i++)

    {

        for(int j=i+1;j<n;j++)

        {

            sum=sum+ch[i]*ch[j];

        }

    }

    printf("%d\n",sum);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#define debug(x) cout<<"***"<<x<<"***"<<endl;

using namespace std;

int a[55];

int main()

{

	int sum=0,n;

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a[i];

	}

	for(int i=1;i<=n-1;i++)

	{

		for(int j=i+1;j<=n;j++)

		{

			sum+=a[i]*a[j];

		}

	}

	cout<<sum;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int n,ci,sum;

	int d[51];

	sum=0;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&d[i]);

	}

	for(int i=1;i<n;i++){

		for(int j=i+1;j<=n;j++){

			sum=sum+d[i]*d[j];

		}

	}

	printf("%d",sum);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int sum=0, n, a[53], b[53];

int main()

{

	cin>>n;

	for(int i=0;i<n;i++){

		cin>>a[i];

		b[i+1]=b[i]+a[i];

	}

	for(int i=0;i<n;i++){

		sum+=(a[i]*b[i]);

	}

	cout<<sum<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int n,ci,sum;

	int d[51];

	sum=0;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&d[i]);

	}

	for(int i=1;i<n;i++){

		for(int j=i+1;j<=n;j++){

			sum=sum+d[i]*d[j];

		}

	}

	printf("%d",sum);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int a[1005],b[1005]={0},m,n;

int main(){

	cin>>n;

	for(int i=1;i<=n;i++)

		cin>>a[i];

	for(int j=n;j>=1;j--){

		b[j]=b[j+1]+a[j];

	}

	int ans=0;

	for(int i=1;i<=n;i++){

		ans+=a[i]*b[i+1];		

	}

	cout<<ans<<endl;

	return 0; 

} 

// Optimized solution to the same problem (faster):
#include<stdio.h> 

using namespace std;



int main() {

	int n,d[100];

	scanf("%d", &n);

	int i0 = 0; long result = 0;

	for(; i0<n; i0++) {scanf("%d", &d[i0]);}

	for(int i = 0; i < i0-1;i++){

		for(int j = i+1; j < i0;j++){

			result += d[i]*d[j];

		}

	}

	printf("%d", result);

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int a[51];

int main(){

	int n;

	cin>>n;

	for(int i=0;i<n;i++){

		cin>>a[i];

	}

	int sum=0;

	for(int i=0;i<n;i++){

		for(int j=i+1;j<n;j++){

			sum+=a[i]*a[j];

		}

	}

	cout<<sum;

}

// Optimized solution to the same problem (faster):
#include<stdio.h> 

using namespace std;



int main() {

	int n,d[100];

	scanf("%d", &n);

	int i0 = 0; long result = 0;

	for(; i0<n; i0++) {scanf("%d", &d[i0]);}

	for(int i = 0; i < i0-1;i++){

		for(int j = i+1; j < i0;j++){

			result += d[i]*d[j];

		}

	}

	printf("%d", result);

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int a[100];

int main()

{int n,i,j,sum=0;

cin >> n;

for(i=1;i<=n;i++)

cin >> a[i];

for(i=1;i<=n-1;i++)

 for(j=i+1;j<=n;j++)

  sum+=a[i]*a[j];

cout << sum;

return 0;







}

// Optimized solution to the same problem (faster):
#include<stdio.h> 

using namespace std;



int main() {

	int n,d[100];

	scanf("%d", &n);

	int i0 = 0; long result = 0;

	for(; i0<n; i0++) {scanf("%d", &d[i0]);}

	for(int i = 0; i < i0-1;i++){

		for(int j = i+1; j < i0;j++){

			result += d[i]*d[j];

		}

	}

	printf("%d", result);

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std; 

int main(){

//  freopen("test.in","r",stdin);

//  freopen("test.out","w",stdout);

	int n,sum=0;

	cin>>n;

	int a[n+1];

	memset(a,0,sizeof(a));

	for(int i =0;i<n;i++) cin>>a[i];

	for(int i =0 ;i<n;i++){

		for(int j=i+1;j<n;j++){

			sum+=a[i]*a[j];

		}

	}

	cout<<sum;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h> 

using namespace std;



int main() {

	int n,d[100];

	scanf("%d", &n);

	int i0 = 0; long result = 0;

	for(; i0<n; i0++) {scanf("%d", &d[i0]);}

	for(int i = 0; i < i0-1;i++){

		for(int j = i+1; j < i0;j++){

			result += d[i]*d[j];

		}

	}

	printf("%d", result);

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main()

{

    ll a,b,c,d,e,k,n,p,ct=0;

    cin>>a>>b>>c>>d>>e>>k;

    if(abs(a-b)>k) ct++;

    if(abs(a-c)>k) ct++;

    if(abs(a-d)>k) ct++;

    if(abs(a-e)>k) ct++;

    if(abs(b-c)>k) ct++;

    if(abs(b-d)>k) ct++;

    if(abs(b-e)>k) ct++;

    if(abs(c-d)>k) ct++;

    if(abs(c-e)>k) ct++;

    if(abs(d-e)>k) ct++;

    if(ct>0) cout<<":\("<<endl;

    else cout<<"Yay!"<<endl;

    return 0;

}






// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

  int a, b, c, d, e, k;

  scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &k);



  if( ((a-b)<=k) && ((a-c)<=k) && ((a-d)<=k) && ((a-e)<=k) && ((b-a)<=k) && ((b-c)<=k) && ((b-d)<=k) && ((b-e)<=k) && ((c-a)<=k) && ((c-b<=k)) && ((c-d)<=k) && ((c-e)<=k) && ((d-a)<=k) && ((d-b)<=k) && ((d-c)<=k) && ((d-e)<=k) && ((e-a)<=k) && ((e-b)<=k) && (e-c)<=k && (e-d)<=k)

    printf("Yay!\n");

  else printf(":(\n");



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{

  ios::sync_with_stdio(false);

  vector<int> v(5);

  int k, a = 5, max = 0;



  for (int i = 0; i < a; ++i)

    cin >> v[i];



  cin >> k;



  for (int i = 0; i < a; ++i)

  {

    for (int j = i + 1; j < a; ++j)

    {

      if (v[j] - v[i] > max)

        max = v[j] - v[i];

    }

  }



  if (max > k)

    cout << ":(\n";

  else

    cout << "Yay!\n";



  return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

  int a, b, c, d, e, k;

  scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &k);



  if( ((a-b)<=k) && ((a-c)<=k) && ((a-d)<=k) && ((a-e)<=k) && ((b-a)<=k) && ((b-c)<=k) && ((b-d)<=k) && ((b-e)<=k) && ((c-a)<=k) && ((c-b<=k)) && ((c-d)<=k) && ((c-e)<=k) && ((d-a)<=k) && ((d-b)<=k) && ((d-c)<=k) && ((d-e)<=k) && ((e-a)<=k) && ((e-b)<=k) && (e-c)<=k && (e-d)<=k)

    printf("Yay!\n");

  else printf(":(\n");



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std;



int main(){



    int ant[5],k;



    for(int i=0;i<5;i++){

        cin>>ant[i];

    }

    cin>>k;



    for(int i=0;i<5;i++){

        for(int j=1;j<5;j++){

            if(ant[j]-ant[i]>k){

                cout<<":(\n";

                return 0;

            }

        }

    }



    cout<<"Yay!\n";





    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main(){

  int a, b, c, d, e, k;

  scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &k);



  if( ((a-b)<=k) && ((a-c)<=k) && ((a-d)<=k) && ((a-e)<=k) && ((b-a)<=k) && ((b-c)<=k) && ((b-d)<=k) && ((b-e)<=k) && ((c-a)<=k) && ((c-b<=k)) && ((c-d)<=k) && ((c-e)<=k) && ((d-a)<=k) && ((d-b)<=k) && ((d-c)<=k) && ((d-e)<=k) && ((e-a)<=k) && ((e-b)<=k) && (e-c)<=k && (e-d)<=k)

    printf("Yay!\n");

  else printf(":(\n");



  return 0;

}


// Fastest known solution for this problem: