SlideShare a Scribd company logo
ACM Aleppo CPC Training
Part 1 C++ Programming Concepts
By Ahmad Bashar Eter
Bit manipulation
• In competitive programing many problems need to utilize numbers
as there bit representation.
• The techniques of utilize the numbers bit representation is called Bit
manipulation.
• We will see in this part how to:
1. set or unset bit in number and check the state of a bit.
2. Know the right most bit.
3. Check if a number is power of 2.
4. Count the number of ones in binary representation.
5. Check if a number is odd or even or divide by 2.
Reference:
Bit manipulation
• To set the i-th position bit in a number we can do an OR operator
with a number that have a single 1 at the i-th position like that:
num = num | (1 << i);
• To unset the i-th bit in a number we must clear the i-th bit and leave
all numbers as it by this:
num = num & ~(1 << i);
• To check the state of the i-th bit we can do AND operator on the
number and the i-th bit like this:
if(num & (1<<i))
• To filp the state of a bits in number we can use the XOR operator:
num ^ mask; // if num=101 and mask= 011 the result
// will be flipped at each 1 in the
// mask and will be 110
Reference:
Bit manipulation
• We can use the last 3 techniques to represent a subset of element of
a set by a number which the 0 or 1 in it means that we take or leave
the elements.
• E.g. the flowing set {1,3,9,7,5,4} and the subset {9,5,4} can be
represented as the binary number 001011.
• This number is called bit mask.
• We can use this mask to do union or intersection operations on
subsets.
• To combine the all elements of two sets we can apply the OR
operator.
Reference:
Bit manipulation
• To check if tow subsets have the same elements we can check if the
first subset mask is equal to the second one mask.
• To check if tow subsets have some common elements we can apply
AND operator and check if the result is empty set (if it’s empty its
mask will be equal to zero).
• Note: if we use the basic integer values to represent subset the
maximum number of element in the set will be 64 element if we use
long long data type.
• To get more element we can use the bitset template (we will talk
about it in the STL).
Reference:
Bit manipulation
• To clear the right most digit in a number we can do & on the
number and the number-1:
x = num & num-1;
• Check if the number is power of 2 we can clear the right most digit if
the number became 0 then it is power of 2 (power of 2 contain
single 1 in binary representation) and the only power of 2 that don’t
have ones in it is 0 then we can do like that:
if(x && !(x&x-1))
• To divide a number by 2 we can simply shift it to the right by 1 and
to multiply it by 2 we can shift it to the left.
• In general to divide by any x that power of 2 we can shift to the right
by the log2 of x, and to multiply by any x that is power of 2 we can
shift to the left by log2 of x.
Reference:
Bit manipulation
• To determine if a number is odd or even we can simply check the
first bit if it set:
if(x & 1) cout <<”odd”; else cout<<“even”;
• To count the number of ones effectively we can loop while the
number is not 0 and clear the right most 1:
while( x ) {
x = x&(x-1);
count++;
}
• To get the right most digit we can simply XOR the number with it
after removing the right most digit:
x ^ ( x & (x-1))
Reference:
Example 1: Monk's Choice of Numbers
Monk loves cakes! He visits the Binary Bakery to buy some of his favorite
cheesecakes.
The owner of the bakery, Bob, is a clever man. He does not want Monk to finish
all his cheesecakes. Hence, he plays a game.
The Monk is given N numbers and has to select K of these numbers. For each
number that Monk chooses, he will get as many cheesecakes as the number
of 1's in the Binary representation of the number i.e. the number of bits that are
set.
Help Monk find the maximum number of cakes that he can have.
Solve At:
Example 1: Monk's Choice of Numbers
Input:
The first line of input contains T. T test cases follow.
First line of each test cases contains 2 space-separated integers N and K.
The next line contains N space-separated integers.
Output:
For each test cases, print the answer in a new line.
Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤ 103
0 ≤ K ≤ N
0 ≤ Numbers ≤ 105
Solve At:
Example 1: Monk's Choice of Numbers
Sample Input
1
4 2
6 1 2 0
Solve At:
Sample Output
3
Example 2: Monk and his Friend
Monk has a very good friend, Puchi. As weird as his name, are the games he
plays.
One fine day, they decided to play a game to test how diverse their choices are.
Both of them choose exactly one integer each. Monk chooses an integer M and
Puchi chooses an integer P.
The diversity of their choices is defined as the number of bits whose status is
different in the binary representation of M and P , i.e. , count of bits that are
,either set in M and unset in P or set in P and unset in M.
Find the answer to their game.
Solve At:
Example 2: Monk and his Friend
Input:
First line contains T. T test cases follow.
Each test case consists of 2 space-separated integers P and M.
Output:
Print the answer to each test case in a new line.
Constraints:
1 ≤ T ≤ 104
0 ≤ M, P ≤ 1016
Solve At:
Example 2: Monk and his Friend
Sample Input
4
1 4
3 3
5 1
8 7
Solve At:
Sample Output
2
0
1
4
Introduction to STL
• STL is the C++ stander template library contains a lot of templates of
containers and a lot of classes.
• Templates are a feature of the C++ that allows functions and classes
to operate with generic types.
• generic functions or classes is a way to creating functions which
perform the same operations but work with different data types.
• The STL containers are data structure that represent a set of
element that take care of the storage management of these
elements of any type and you must specify this type when you want
to use it.
• There are a lot of containers types each one use a data structure to
handle these elements.
Reference:
Introduction to STL
This is the most used containers:
vector : dynamic array
list : linked list data structure
set : a sorted binary search tree
map : associated container a sorted binary search tree
unordedset : hash table
unordedmap : associated container hash table
queue : queue data structure
stack : stack data structure
priority queue : max heap data structure
Reference:
STL Vectors:
• Default static arrays can’t change its size dynamically.
• Vector is the a data type that represent a dynamic size array
• We will use the STL vectors to talk about the containers.
• Like vectors each container when we want to define a vector we have
to till it the type that he will contain.
• We can define a vector of integers as:
vector<int> v;
Reference:
STL Vectors:
• Each container have the flowing methods in it:
Reference:
DescriptionMethod
Return iterator to beginningbegin
Return iterator to endend
Return sizesize
Test whether vector is emptyempty
Clear contentClear
Access elementoperator[] ,at
Erase elementserase
Insert elementsinsert
Add element at the endpush_back
Delete last elementpop_back
STL Iterators:
• An iterator is any object that, points to some element in a range of
elements (such as an array or a container) and has the ability to iterate
through those elements using a set of operators (with at least the
increment (++) and dereference (*) operators).
• A pointer is a form of an iterator. A pointer can point to elements in an
array, and can iterate over them using the increment operator (++).
There can be other types of iterators as well. For each container class,
we can define iterator which can be used to iterate through all the
elements of that container.
• For vector iterator we can create it as:
vector <int>::iterator it;
Reference:
STL pair:
• Pair is a container that can be used to bind together a two values
which may be of different types. Pair provides a way to store two
heterogeneous objects as a single unit.
• We can define a pair as: pair<[type1],[type2]> x;
• For integer and float pair: pair<int,float> x;
• We can initialize a pair by its constructor or the function make_pair:
pair<int,float> x = make_pair(2, 0.9);
• We can access the paired elements by the member variables first and
second: cout <<p 2.first << ‘ ‘ << p2.second;
• Pairs are compared by there first variable then the second variable.
Reference:
Binary search
• Suppose we have a set of ascending sorted element and we need to
find an element of this set effectively.
• We can start from the middle if the mid element is not what we want
we compere the mid with our element.
• If the mid is grater then we can go to the left side(the lower side since
it is impossible to be in the grater side).
• If the mid is lower then we can go to the left side(the grater side since
it is impossible to be in the lower side).
• We can use this property to search of any element in sorted set or any
increasing function.
• The benefit is this algorithm work in O(log(n)) complexity.
Binary search in STL
• In STL algorithm library we have 4 functions to do the binary search all
of them take 3 parameters the begin iterator and the end iterator of
the sorted elements container that we want to search in, and the value
of our element.
• lower_bound function do binary search and return iterator of the first
element not less than our element (the first occur if found and the first
element grater than our element if not found).
• upper_bound function do binary search and return iterator of the first
element greater than our element (the first greater element if found or
not).
Binary search in STL
• binary_search function do binary search and return true if the element
was found.
• equal_bound function return pair of iterators the first one point to
the first element not less than our element the second one point to the
first element greater than our element.
Example 3: Discover the Monk
You are given an array A of size N, and Q queries to deal with. For each query,
you are given an integer X, and you're supposed to find out if X is present in the
array A or not.
Input: The first line contains two integers, N and Q, denoting the size of
array A and number of queries. The second line contains N space separated
integers, denoting the array of elements Ai. The next Q lines contain a single
integer X per line.
Output: For each query, print YES if the X is in the array, otherwise print NO.
Constraints:
1 <= N, Q <= 105
1 <= Ai <= 109
1 <= X <= 109
Solve At:
Example 3: Discover the Monk
Sample Input
5 10
50 40 30 20 10
10
20
30
40
50
60
70
80
90
100
Solve At:
Sample Output
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
Thank you :) :) :)

More Related Content

PPTX
Data types in python
PPTX
Python data type
PPTX
Arrays in programming
PDF
Python-03| Data types
PDF
Computer science solution - programming - big c plus plus
PPTX
Python PCEP Comparison Operators And Conditional Execution
PPTX
PPT
Strings Arrays
Data types in python
Python data type
Arrays in programming
Python-03| Data types
Computer science solution - programming - big c plus plus
Python PCEP Comparison Operators And Conditional Execution
Strings Arrays

What's hot (19)

PPT
Data Structures- Part3 arrays and searching algorithms
PPTX
Basic data types in python
PDF
Python tuple
PPTX
Data Structures in Python
PPTX
Introduction To Programming with Python-4
PPT
9781439035665 ppt ch09
KEY
Programming with Python - Week 3
PDF
Binary Search - Design & Analysis of Algorithms
KEY
Programming with Python - Week 2
PDF
Dotnet programming concepts difference faqs- 2
PDF
Anton Kasyanov, Introduction to Python, Lecture3
PPTX
Lecture 7
PPTX
13string in c#
PDF
Pointers by: Professor Lili Saghafi
PDF
Linked Lists: The Role of Locking : The Art of Multiprocessor Programming : N...
PDF
Python :variable types
PDF
Session2
PDF
Pythonintro
PPTX
Binary search
Data Structures- Part3 arrays and searching algorithms
Basic data types in python
Python tuple
Data Structures in Python
Introduction To Programming with Python-4
9781439035665 ppt ch09
Programming with Python - Week 3
Binary Search - Design & Analysis of Algorithms
Programming with Python - Week 2
Dotnet programming concepts difference faqs- 2
Anton Kasyanov, Introduction to Python, Lecture3
Lecture 7
13string in c#
Pointers by: Professor Lili Saghafi
Linked Lists: The Role of Locking : The Art of Multiprocessor Programming : N...
Python :variable types
Session2
Pythonintro
Binary search
Ad

Similar to Acm aleppo cpc training sixth session (20)

PDF
Acm aleppo cpc training seventh session
PDF
An Introduction to Part of C++ STL
PPTX
Advanced oops using c and c++.Pptx in Srm
PPTX
Object Oriented Programming Using C++: C++ STL Programming.pptx
PPTX
Object Oriented Design and Programming Unit-05
PPTX
C++ STL (quickest way to learn, even for absolute beginners).pptx
PPTX
C++ STL (quickest way to learn, even for absolute beginners).pptx
PPTX
Standard template library
PDF
Ds lab handouts
PDF
STL in C++
PPTX
Lecture11 standard template-library
PPTX
Time and Space Complexity Analysis.pptx
PDF
Sppu University|BE|Computer Engineering|OOPs|unit 6 notes|ppt
PDF
Elements of Programming Interviews.pdf
PDF
Standard template library
PDF
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
PDF
Effective stl notes
PPTX
How to choose best containers in STL (C++)
PPTX
III_Data Structure_Module_1.pptx
Acm aleppo cpc training seventh session
An Introduction to Part of C++ STL
Advanced oops using c and c++.Pptx in Srm
Object Oriented Programming Using C++: C++ STL Programming.pptx
Object Oriented Design and Programming Unit-05
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
Standard template library
Ds lab handouts
STL in C++
Lecture11 standard template-library
Time and Space Complexity Analysis.pptx
Sppu University|BE|Computer Engineering|OOPs|unit 6 notes|ppt
Elements of Programming Interviews.pdf
Standard template library
C++ Language -- Dynamic Memory -- There are 7 files in this project- a.pdf
Effective stl notes
How to choose best containers in STL (C++)
III_Data Structure_Module_1.pptx
Ad

More from Ahmad Bashar Eter (6)

PDF
Acm aleppo cpc training ninth session
PDF
Acm aleppo cpc training eighth session
PDF
Acm aleppo cpc training fifth session
PDF
Acm aleppo cpc training third session
PDF
Acm aleppo cpc training second session
PDF
Acm aleppo cpc training introduction 1
Acm aleppo cpc training ninth session
Acm aleppo cpc training eighth session
Acm aleppo cpc training fifth session
Acm aleppo cpc training third session
Acm aleppo cpc training second session
Acm aleppo cpc training introduction 1

Recently uploaded (20)

PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Insiders guide to clinical Medicine.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Basic Mud Logging Guide for educational purpose
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Classroom Observation Tools for Teachers
PDF
01-Introduction-to-Information-Management.pdf
Microbial diseases, their pathogenesis and prophylaxis
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
GDM (1) (1).pptx small presentation for students
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Insiders guide to clinical Medicine.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Computing-Curriculum for Schools in Ghana
Module 4: Burden of Disease Tutorial Slides S2 2025
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Final Presentation General Medicine 03-08-2024.pptx
Basic Mud Logging Guide for educational purpose
TR - Agricultural Crops Production NC III.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Classroom Observation Tools for Teachers
01-Introduction-to-Information-Management.pdf

Acm aleppo cpc training sixth session

  • 1. ACM Aleppo CPC Training Part 1 C++ Programming Concepts By Ahmad Bashar Eter
  • 2. Bit manipulation • In competitive programing many problems need to utilize numbers as there bit representation. • The techniques of utilize the numbers bit representation is called Bit manipulation. • We will see in this part how to: 1. set or unset bit in number and check the state of a bit. 2. Know the right most bit. 3. Check if a number is power of 2. 4. Count the number of ones in binary representation. 5. Check if a number is odd or even or divide by 2. Reference:
  • 3. Bit manipulation • To set the i-th position bit in a number we can do an OR operator with a number that have a single 1 at the i-th position like that: num = num | (1 << i); • To unset the i-th bit in a number we must clear the i-th bit and leave all numbers as it by this: num = num & ~(1 << i); • To check the state of the i-th bit we can do AND operator on the number and the i-th bit like this: if(num & (1<<i)) • To filp the state of a bits in number we can use the XOR operator: num ^ mask; // if num=101 and mask= 011 the result // will be flipped at each 1 in the // mask and will be 110 Reference:
  • 4. Bit manipulation • We can use the last 3 techniques to represent a subset of element of a set by a number which the 0 or 1 in it means that we take or leave the elements. • E.g. the flowing set {1,3,9,7,5,4} and the subset {9,5,4} can be represented as the binary number 001011. • This number is called bit mask. • We can use this mask to do union or intersection operations on subsets. • To combine the all elements of two sets we can apply the OR operator. Reference:
  • 5. Bit manipulation • To check if tow subsets have the same elements we can check if the first subset mask is equal to the second one mask. • To check if tow subsets have some common elements we can apply AND operator and check if the result is empty set (if it’s empty its mask will be equal to zero). • Note: if we use the basic integer values to represent subset the maximum number of element in the set will be 64 element if we use long long data type. • To get more element we can use the bitset template (we will talk about it in the STL). Reference:
  • 6. Bit manipulation • To clear the right most digit in a number we can do & on the number and the number-1: x = num & num-1; • Check if the number is power of 2 we can clear the right most digit if the number became 0 then it is power of 2 (power of 2 contain single 1 in binary representation) and the only power of 2 that don’t have ones in it is 0 then we can do like that: if(x && !(x&x-1)) • To divide a number by 2 we can simply shift it to the right by 1 and to multiply it by 2 we can shift it to the left. • In general to divide by any x that power of 2 we can shift to the right by the log2 of x, and to multiply by any x that is power of 2 we can shift to the left by log2 of x. Reference:
  • 7. Bit manipulation • To determine if a number is odd or even we can simply check the first bit if it set: if(x & 1) cout <<”odd”; else cout<<“even”; • To count the number of ones effectively we can loop while the number is not 0 and clear the right most 1: while( x ) { x = x&(x-1); count++; } • To get the right most digit we can simply XOR the number with it after removing the right most digit: x ^ ( x & (x-1)) Reference:
  • 8. Example 1: Monk's Choice of Numbers Monk loves cakes! He visits the Binary Bakery to buy some of his favorite cheesecakes. The owner of the bakery, Bob, is a clever man. He does not want Monk to finish all his cheesecakes. Hence, he plays a game. The Monk is given N numbers and has to select K of these numbers. For each number that Monk chooses, he will get as many cheesecakes as the number of 1's in the Binary representation of the number i.e. the number of bits that are set. Help Monk find the maximum number of cakes that he can have. Solve At:
  • 9. Example 1: Monk's Choice of Numbers Input: The first line of input contains T. T test cases follow. First line of each test cases contains 2 space-separated integers N and K. The next line contains N space-separated integers. Output: For each test cases, print the answer in a new line. Constraints: 1 ≤ T ≤ 10 1 ≤ N ≤ 103 0 ≤ K ≤ N 0 ≤ Numbers ≤ 105 Solve At:
  • 10. Example 1: Monk's Choice of Numbers Sample Input 1 4 2 6 1 2 0 Solve At: Sample Output 3
  • 11. Example 2: Monk and his Friend Monk has a very good friend, Puchi. As weird as his name, are the games he plays. One fine day, they decided to play a game to test how diverse their choices are. Both of them choose exactly one integer each. Monk chooses an integer M and Puchi chooses an integer P. The diversity of their choices is defined as the number of bits whose status is different in the binary representation of M and P , i.e. , count of bits that are ,either set in M and unset in P or set in P and unset in M. Find the answer to their game. Solve At:
  • 12. Example 2: Monk and his Friend Input: First line contains T. T test cases follow. Each test case consists of 2 space-separated integers P and M. Output: Print the answer to each test case in a new line. Constraints: 1 ≤ T ≤ 104 0 ≤ M, P ≤ 1016 Solve At:
  • 13. Example 2: Monk and his Friend Sample Input 4 1 4 3 3 5 1 8 7 Solve At: Sample Output 2 0 1 4
  • 14. Introduction to STL • STL is the C++ stander template library contains a lot of templates of containers and a lot of classes. • Templates are a feature of the C++ that allows functions and classes to operate with generic types. • generic functions or classes is a way to creating functions which perform the same operations but work with different data types. • The STL containers are data structure that represent a set of element that take care of the storage management of these elements of any type and you must specify this type when you want to use it. • There are a lot of containers types each one use a data structure to handle these elements. Reference:
  • 15. Introduction to STL This is the most used containers: vector : dynamic array list : linked list data structure set : a sorted binary search tree map : associated container a sorted binary search tree unordedset : hash table unordedmap : associated container hash table queue : queue data structure stack : stack data structure priority queue : max heap data structure Reference:
  • 16. STL Vectors: • Default static arrays can’t change its size dynamically. • Vector is the a data type that represent a dynamic size array • We will use the STL vectors to talk about the containers. • Like vectors each container when we want to define a vector we have to till it the type that he will contain. • We can define a vector of integers as: vector<int> v; Reference:
  • 17. STL Vectors: • Each container have the flowing methods in it: Reference: DescriptionMethod Return iterator to beginningbegin Return iterator to endend Return sizesize Test whether vector is emptyempty Clear contentClear Access elementoperator[] ,at Erase elementserase Insert elementsinsert Add element at the endpush_back Delete last elementpop_back
  • 18. STL Iterators: • An iterator is any object that, points to some element in a range of elements (such as an array or a container) and has the ability to iterate through those elements using a set of operators (with at least the increment (++) and dereference (*) operators). • A pointer is a form of an iterator. A pointer can point to elements in an array, and can iterate over them using the increment operator (++). There can be other types of iterators as well. For each container class, we can define iterator which can be used to iterate through all the elements of that container. • For vector iterator we can create it as: vector <int>::iterator it; Reference:
  • 19. STL pair: • Pair is a container that can be used to bind together a two values which may be of different types. Pair provides a way to store two heterogeneous objects as a single unit. • We can define a pair as: pair<[type1],[type2]> x; • For integer and float pair: pair<int,float> x; • We can initialize a pair by its constructor or the function make_pair: pair<int,float> x = make_pair(2, 0.9); • We can access the paired elements by the member variables first and second: cout <<p 2.first << ‘ ‘ << p2.second; • Pairs are compared by there first variable then the second variable. Reference:
  • 20. Binary search • Suppose we have a set of ascending sorted element and we need to find an element of this set effectively. • We can start from the middle if the mid element is not what we want we compere the mid with our element. • If the mid is grater then we can go to the left side(the lower side since it is impossible to be in the grater side). • If the mid is lower then we can go to the left side(the grater side since it is impossible to be in the lower side). • We can use this property to search of any element in sorted set or any increasing function. • The benefit is this algorithm work in O(log(n)) complexity.
  • 21. Binary search in STL • In STL algorithm library we have 4 functions to do the binary search all of them take 3 parameters the begin iterator and the end iterator of the sorted elements container that we want to search in, and the value of our element. • lower_bound function do binary search and return iterator of the first element not less than our element (the first occur if found and the first element grater than our element if not found). • upper_bound function do binary search and return iterator of the first element greater than our element (the first greater element if found or not).
  • 22. Binary search in STL • binary_search function do binary search and return true if the element was found. • equal_bound function return pair of iterators the first one point to the first element not less than our element the second one point to the first element greater than our element.
  • 23. Example 3: Discover the Monk You are given an array A of size N, and Q queries to deal with. For each query, you are given an integer X, and you're supposed to find out if X is present in the array A or not. Input: The first line contains two integers, N and Q, denoting the size of array A and number of queries. The second line contains N space separated integers, denoting the array of elements Ai. The next Q lines contain a single integer X per line. Output: For each query, print YES if the X is in the array, otherwise print NO. Constraints: 1 <= N, Q <= 105 1 <= Ai <= 109 1 <= X <= 109 Solve At:
  • 24. Example 3: Discover the Monk Sample Input 5 10 50 40 30 20 10 10 20 30 40 50 60 70 80 90 100 Solve At: Sample Output YES YES YES YES YES NO NO NO NO NO
  • 25. Thank you :) :) :)