# Candy Love Codechef Solution

Sammy and Simmy love candies and frequently visit the local candy shop. Sammy and Simmy have bought NN candy packs. Packet ii contains AiAi candies. Sammy being the elder one is happy only if she has strictly more candies than Simmy. However Simmy, the more sensible one, is happy only if the difference between their number of candies is not more than 11.

The shopkeeper, being a generous lady, agrees to help Sammy and Simmy by distributing the candies among them in a way that makes both of them happy. The shopkeeper can open the packs and distribute the candies even within a single pack to different people.

### Input:

• The first line will contain TT, the number of testcases.
• The first line of every test case will contain NN, the number of candy packs.
• The next line has NN integers, the ithith integer denoting AiAi, the number of candies in the ithith pack.

### Output:

Output “YES” if its possible for the shopkeeper to make both the sisters happy otherwise output “NO”.

### Constraints

• 1≤T≤1031≤T≤103
• 1≤N≤1031≤N≤103
• 1≤Ai≤1001≤Ai≤100

1
2
5 2

YES

### EXPLANATION:

Sammy gets 4 candies from the first pack.

Simmy gets 1 candy from the first pack and 2 from the second one.

So in total, Sammy has 4, and Simmy has 3. Since Sammy has strictly more candies than Simmy, Sammy is happy. And since the difference is not more then 1, Simmy is also happy. Thus both of them are happy.

## Candy Love   – CodeChef Solution in JAVA

```import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int a[]=new int[n];
int sum=0;
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
}
for(int i=0;i<n;i++){
sum=sum+a[i];
}
if(sum%2!=0){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
```

## Candy Love- CodeChef Solution in CPP

```#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main() {

int t;
cin>>t;

while(t--)
{
int n;
cin>>n;

vector<int> v(n);
int sum = 0;

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

sum = sum + v[i];
}

if(sum % 2 != 0)
{
cout<<"YES"<<"\n";
}
else if(sum % 2 == 0)
{
cout<<"NO"<<"\n";
}

}

return 0;
}
```

## Candy Love  -CodeChef Solution in Python

```t=int(input())
for i in range(t):
n=int(input())
l=list(map(int,input().split()))
if sum(l)%2!=0:print('YES')
else:print('NO')
```

Disclaimer: The above Problem (Candy Love) is generated by CodeChef but the solution is provided by Codeworld19.This tutorial is only for Educational and Learning purpose.