Snippets Collections
#include <iostream>
#include <string>
using namespace std;
#define ll long long



int main()
{
	srand(time(0));
	const int SIZE = 10;
	string words[SIZE] = { "skinny","skinny","three","arrange",
	"discussion", "squeeze" ,"flowers","credit","matter","visit"};
	int random = rand() % SIZE;
	string s = words[random];
	string astrid_word("");
	
		astrid_word = s;
		for (int i = 0; i < astrid_word.length(); i++)
		{
			astrid_word[i] = '*';
		}
		char guess;
		int tries = 1;
		bool youWin = false;
		int miss = 0;
		while ( tries <= 20)
		{
			int flag = 0;
			cout << tries<<" enter your guess " << astrid_word<<" ";
			cin >> guess;
			for (int i = 0; i < astrid_word.length(); i++)
					{
				if (s.at(i) == guess)
				{
					if (s.at(i) == astrid_word.at(i))
					{
					cout <<"   "<< guess << " is already in the word\n";
					}
					else
					{
						astrid_word.at(i) = guess;
						flag = 1;
					}
				}
			}
			if (flag == 0)
				miss++;
			if (astrid_word == s)
			{
				youWin = true;
				cout << "the word is " << astrid_word<<endl;
				break;
			}
			tries++;
		}
		if (youWin == true)
		{
			cout << " -------------------------------- \n";
			cout << "|                                |\n";
			cout << "|                                |\n";
			cout << "|   (:CONGRATULATIONS YOU WIN(:  |\n";
			cout << "|                                |\n";
			cout << "|                                |\n";
			cout << " -------------------------------- \n";
			cout << "you tried " << tries << " times \n";
			cout << "you miss " << miss << " time\n";

		}
		else
		{
			cout << "the word is " << s << "): you loose ):";
		}
		
		
	
}




#include <iostream>

#include <string>
using namespace std;
#define ll long long



int intOfEnd(string& s)
{
	int start = s.find("ATG");
	int end1 = s.find("TAG", start);
	int end2 = s.find("TAA", start);
	int end3 = s.find("TGA", start);

	int list[3] = { end1,end2,end3 };
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			if (list[i] < list[j] && list[i] != string::npos)
				return list[i];
		}
	}
	
	for (int i = 0; i < 3; i++)
	{
		if (list[i] != string::npos)
			return list[i];
	}
	return 0;
	

}
int main()
{
	string s;
	cin >> s;
	
	
	string ans("");
	int l = 0;
	
	for (int j = 0; j < s.length(); j++)
	{
			int start = s.find("ATG");
			if ((start != string::npos && intOfEnd(s) != 0))
			{
				for (int i = start + 3; i < intOfEnd(s); i++)
				{
					ans += s[i];
				}
				cout << "gene "<<ans << endl;

				s.erase(start, 6);
				ans.clear();
				l++;
			}
			
	}
	if (l == 0)
		cout << "no gene found ";
}




#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>
#include <vector>

using namespace std;

bool  isConsecutiveFour(char grid[][7]) {

    // checking rows
    for (int i = 0; i < 6; i++)
    {
        char current = grid[i][0];
        int rowCnsec = 0;
        for (int j = 0; j < 7; j++)
        {
            if (current == grid[i][j] && grid[i][j] != ' ')
            {
                rowCnsec++;
                if (rowCnsec == 4) return true;
            }
            else
            {
                current = grid[i][j];
                rowCnsec = 1;
            }
        }
    }
    // check columns
    for (int j = 0; j < 7; j++)
    {
        char current = grid[0][j];
        int colConsec = 0;
        for (int i = 0; i < 6; i++)
        {
            if (current == grid[i][j] && grid[i][j] != ' ')
            {
                colConsec++;
                if (colConsec == 4) return true;
            }
            else
            {
                current = grid[i][j];
                colConsec = 1;
            }
        }
    }

    // check top Left side: going upright
    for (int i = 5; i >= 0 ; i--)
    {
        int consecutive = 0;
        int y = i;
        int x = 0;
        char current = grid[y][x];
        while (y >= 0)
        {
            if (grid[y][x] == current && grid[y][x] != ' ')
            {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else
            {
                consecutive = 1;
                current = grid[y][x];
            }
            x++;
            y--;
        }

    }
    // check bottom right side: going upright
    for (int j = 0; j < 7; j++) {
        int y = 6 - 1;
        int x = j;
        int consecutive = 0;
        int current = grid[y][x];

        while (x < 6 && y >= 0) {

            if (grid[y][x] == current && grid[y][x] != ' ') {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = grid[y][x];
            }
            x++;
            y--;
        }

    }

    // check bottom left side going up-left
    for (int j = 7 - 1; j > 0; j--) {

        int x = j;
        int y = 6 - 1;
        int current = grid[y][x];
        int consecutiveCount = 0;

        while (x >= 0 && y >= 0) {

            if (grid[y][x] == current && grid[y][x] != ' ') {
                consecutiveCount++;
                if (consecutiveCount == 4) return true;
            }
            else {
                consecutiveCount = 1;
                current = grid[y][x];
            }

            x--;
            y--;
        }
    }
    // check bottom right side going up-left
    for (int row = 1; row < 6; row++) {
        int x = 7 - 1;
        int y = row;
        int consecutive = 0;
        int current = grid[y][x];

        while (y >= 0) {

            if (grid[y][x] == current && grid[y][x] != ' ') {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = grid[y][x];
            }
            x--;
            y--;
        }
    }
    return false;
}
// a function to show the grid
void show_grid(char grid[][7])
{
   
    for (int i = 0; i < 6; i++)
    {
        for (int j = 0; j < 7; j++)
        {
            cout << "|" << grid[i][j];
        }
        cout << "|" << endl;
    }
}

void player1(char grid[][7], int x, int y)
{
    show_grid(grid);
    
    cout << "Drop a red disk at column (0–6): ";
    cin >> y;
    if (grid[x][y] == ' ')
        grid[x][y] = 'R';
    else {
        //make sure not to target the same row
        while (grid[x][y] != ' ')x--;
        grid[x][y] = 'R';
    }
}

void player2(char grid[][7],int x,int y)
{
    show_grid(grid);

    cout << "Drop a yellow disk at column (0–6): ";
    cin >> y;
    if (grid[x][y] == ' ')
        grid[x][y] = 'Y';
    else {
        //make sure not to target the same row
        while (grid[x][y] != ' ')x--;
        grid[x][y] = 'Y';
    }
       
}
//check if it's a draw
bool is_draw(char grid[][7])
{
    for (int i = 0; i < 7; i++)
    {
      int count{0};
        if (grid[0][i] != ' ' && grid[1][i] != ' ' && grid[2][i] != ' '
            && grid[3][i] != ' ' && grid[4][i] != ' ' && grid[5][i] != ' ')
            count++;
      if(count == 6)
        return true;
        return false;
    }
}
int main()
{
	char grid[6][7];	
    //fill the grid with blank space
    for (int i = 0; i < 6; i++)
    {
        for (int j = 0; j < 7; j++)
        {
            grid[i][j] = ' ';
        }
    }
    //to check the winner
    bool winner1 = false;
    bool winner2 = false;

    while (!is_draw(grid))
    {
        int x{ 5 };
        int y{ 0 };
        player1(grid, x, y);
        if (isConsecutiveFour(grid))
        {
            winner1 = true;
            break;
        }
        player2(grid, x, y);
        if (isConsecutiveFour(grid))
        {
            winner2 = true;
            break;
        }
    }
    show_grid(grid);
    if (winner1 == true)
        cout << "player 1 wins ";
    else if (winner2 == true)
        cout << "player 2 wins ";
    else
        cout << "It's a draw ";

    
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


bool  isConsecutiveFour(int values[][7]) {

    // checking rows
    for (int i = 0; i < 6; i++) {
       
        int current = values[i][0];
        int consecutiveCount = 0; // values[i][0] starts count

        for (int j = 0; j < 7; j++) {
            
            if (values[i][j] == current) {
                consecutiveCount++;
                if (consecutiveCount == 4) return true;
            }
            else {
                current = values[i][j];
                consecutiveCount = 1;
            }
        }
    }
    // check columns
    for (int j = 0; j < 7; j++) {
        
        int consecutiveCount = 0; // values[0][j] starts count
        int current = values[0][j];

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

            if (values[i][j] == current) {
                consecutiveCount++;
                if (consecutiveCount == 4) return true;
            }
            else {
                current = values[i][j];
                consecutiveCount = 1;
            }

        }
    }

    // check topLeft side: going upright
    for (int i = 6 - 1; i > 0; i--) {
        int y = i;
        int x = 0;
        int consecutive = 0;
        int current = values[y][x];

        while (y >= 0) {
           
            if (values[y][x] == current) {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = values[y][x];
            }
            x++;
            y--;
        }
    }

    // check bottom right side: going upright
    for (int j = 0; j < 7; j++) {
        int y = 6 - 1;
        int x = j;
        int consecutive = 0;
        int current = values[y][x];

        while (x < 6 && y >= 0) {
            
            if (values[y][x] == current) {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = values[y][x];
            }
            x++;
            y--;
        }

    }

    // check bottom left side going up-left
    for (int j = 7 - 1; j > 0; j--) {

        int x = j;
        int y = 6 - 1;
        int current = values[y][x];
        int consecutiveCount = 0;

        while (x >= 0 && y >= 0) {

            if (values[y][x] == current) {
                consecutiveCount++;
                if (consecutiveCount == 4) return true;
            }
            else {
                consecutiveCount = 1;
                current = values[y][x];
            }

            x--;
            y--;
        }
    }
    // check bottom right side going up-left
    for (int row = 1; row < 6; row++) {
        int x = 7 - 1;
        int y = row;
        int consecutive = 0;
        int current = values[y][x];

        while (y >= 0) {
            
            if (values[y][x] == current) {
                consecutive++;
                if (consecutive == 4) return true;
            }
            else {
                consecutive = 1;
                current = values[y][x];
            }
            x--;
            y--;
        }

    }
    return false;
}






// Driver code
int main()
{
    int m[6][7];
    for (int i = 0; i < 6; i++)
        for (int j = 0; j < 7; j++)
            cin >> m[i][j];
    if (isConsecutiveFour(m) == true)
        cout << "true";
    else 
        cout << "false";
  
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;




void decToBinary(int n)
{
    // array to store binary number 
    int binaryNum[3][3];
    
    //converting to binary 
    for (int i = 0; i < 3; i++) 
    {
        for (int j = 0; j < 3; j++)
        {
            binaryNum[i][j] = n % 2;
            n = n / 2;

        }
     }       

    // printing binary> array in reverse order 
    for (int i = 3-1; i >= 0; i--){
        for (int j = 3 - 1; j >= 0; j--)
        {
            if (binaryNum[i][j] == 0)
                cout << "H" << " ";
            else
                cout << "T" << " ";
        }
        cout << endl;
    }
    
 }

int main()
{
    int n;
    cout << "Enter a decimal number between 1 and 512 ";
    cin >> n;

    decToBinary(n);
    return 0;
}



//(Financial application: compute tax) Rewrite Listing 3.3, ComputeTax.cpp,
//using arrays. For each filing status, there are six tax rates. Each rate is applied
//to a certain amount of taxable income. For example, from the taxable income
//of $400,000 for a single filer, $8,350 is taxed at 10%, (33,950–8,350) at 15%,
//(82,250–33,950) at 25%, (171,550–82,550) at 28%, (372,550–82,250) at
//33%, and (400,000–372,950) at 36%. The six rates are the same for all filing
//statuses, which can be represented in the following array:
//double rates[] = {0.10, 0.15, 0.25, 0.28, 0.33, 0.36};
//The brackets for each rate for all the filing statuses can be represented in a twodimensional array as follows:
//i//nt brackets[4][5] =
//{
// {8350, 33950, 82250, 171550, 372950}, // Single filer
// //{16700, 67900, 137050, 20885, 372950}, // Married jointly
 // or qualifying
 // widow(er)
// {8350, 33950, 68525, 104425, 186475}, // Married separately
// {11950, 45500, 117450, 190200, 372950} // Head of household
//};
//Suppose the taxable income is $400,000 for single filers. The tax can be computed
//as follows:
//tax = brackets[0][0] * rates[0] +
// (brackets[0][1] – brackets[0][0]) * rates[1] +
 //(brackets[0][2] – brackets[0][1]) * rates[2] +
// (brackets[0][3] – brackets[0][2]) * rates[3] +
// (brackets[0][4] – brackets[0][3]) * rates[4] +
// (400000 – brackets[0][4]) * rates[5]


#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

double computeTax(int brackets[][5], double rates[],
    int status, double income);
int getStatus();


// Driver code
int main()
{
    double rates[] = { 0.10, 0.15, 0.25, 0.28, 0.33, 0.36 };

    int brackets[4][5] =
    {
     {8350, 33950, 82250, 171550, 372950}, // Single filer
     {16700, 67900, 137050, 20885, 372950}, // Married jointly
     // or qualifying
     // widow(er)
     {8350, 33950, 68525, 104425, 186475}, // Married separately
     {11950, 45500, 117450, 190200, 372950} // Head of household
    };
    
     cout << "(1-single filer, 2-married jointly, "
         << "or qualifying widow(er), " << endl
         << "3-married separately, 4-head of household)" << endl
         << "Enter the filing status: ";
     int status = getStatus();
 cout<< "Enter the taxable income: ";
 double income;
 cin >> income;
    cout << "The tax for your income " << income << " is " << computeTax(brackets, rates, status, income);
}

double computeTax(int brackets[][5], double rates[],
    int status, double income) {
    double tax = 0, incomeTaxed = 0;
    for (int i = 4; i >= 0; i--) {
        if (income > brackets[status][i])
            tax += (incomeTaxed = income - brackets[status][i]) * rates[i + 1];
        income -= incomeTaxed;
    }
    return tax += brackets[status][0] * rates[0];
}
int getStatus() {
   
    int status;
    do {
        cin >> status;
        if (status < 0 || status > 3)
            cout<<"Error: invalid status";
    } while (status < 0 || status > 3);
    return status;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


void sortRowWise(int m[][4],
    int r, int c)
{
    // loop for rows of matrix
    for (int i = 0; i < r; i++)
    {
        // loop for column of matrix
        for (int j = 0; j < c; j++)
        {
            // loop for comparison and swapping
            for (int k = 0; k < c - j - 1; k++)
            {
                if (m[i][k] > m[i][k + 1])
                {
                    // swapping of elements
                    swap(m[i][k], m[i][k + 1]);
                }
            }
        }
    }

    // printing the sorted matrix
    for (int i = 0; i < r; i++)
    {
        for (int j = 0; j < c; j++)
            cout << m[i][j] << " ";
        cout << endl;
    }
}

// Driver code
int main()
{
    int m[4][4];
    for (int i = 0; i < 4; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            cin >> m[i][j];
        }
    }
    int r = sizeof(m[0]) / sizeof(m[0][0]);
    int c = sizeof(m) / sizeof(m[0]);
    sortRowWise(m, r, c);
    return 0;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int octal2Dec(string& octal);
bool validity(int number);
int stringToNum(string number);
int bin2Dec(int binNumber);
int dec2octal(const string& number);



void readASolution(int grid[][9]);
 bool isValid(const int grid[][9]);
 bool isValid(int i, int j, const int grid[][9]);

 int main()
{
	 // Read a Sudoku puzzle
		 int grid[9][9];
	 readASolution(grid);
	
		 cout << (isValid(grid) ? "Valid solution" : "Invalid solution");
	
		 return 0;
		 system("pause");
 }

 // Read a Sudoku puzzle from the keyboard
 void readASolution(int grid[][9])
 {
	 cout << "Enter a Sudoku puzzle:" << endl;
	 for (int i = 0; i < 9; i++)
		 for (int j = 0; j < 9; j++)
		 cin >> grid[i][j];
 }
 bool isValid(const int grid[][9])
	 {
	  for (int i = 0; i < 9; i++) 
		  for (int j = 0; j < 9; j++)
		  if (grid[i][j] < 1 || grid[i][j] > 9 ||
			  !isValid(i, j, grid))
		  return false;
	 
		  return true; // The fixed cells are valid
 }
 
	  // Check whether grid[i][j] is valid in the grid
 bool isValid(int i, int j, const int grid[][9])
 {
	 // Check whether grid[i][j] is valid at the i's row
	 for (int column = 0; column < 9; column++)
		 if (column != j && grid[i][column] == grid[i][j])
			 return false;

	 // Check whether grid[i][j] is valid at the j's column
	 for (int row = 0; row < 9; row++)
		 if (row != i && grid[row][j] == grid[i][j])
			 return false;

	 // Check whether grid[i][j] is valid in the 3-by-3 box
	 for (int row = (i / 3) * 3; row < (i / 3) * 3 + 3; row++)
		 for (int col = (j / 3) * 3; col < (j / 3) * 3 + 3; col++)
			 if (row != i && col != j && grid[row][col] == grid[i][j])
				 return false;

	 return true; // The current value at grid[i][j] is valid
 }
USTRUCT()
struct FMapRow {
	GENERATED_BODY()

		UPROPERTY()
		TArray<int8> Columns;

	FORCEINLINE int8& operator[] (int32 j)
	{
		return Columns[j];
	}

	void SetGridBase(int8 Block, int32 y)
	{
		Columns[y] = Block;
	}

	void AddNewColumn()
	{
		Columns.Add(0);
	}

	FMapRow()
	{

	}
};

USTRUCT() 
struct FMapLayer {
	GENERATED_BODY()

		UPROPERTY()
		TArray<FMapRow> Rows;

	FORCEINLINE FMapRow& operator[] (int32 i)
	{
		return Rows[i];
	}

	void AddNewRow()
	{
		Rows.Add(FMapRow());
	}

	void AddUninitialized(const int32 RowCount, const int32 ColCount)
	{
		Clear();
		//Add Rows
		for (int32 v = 0; v < RowCount; v++)
		{
			AddNewRow();
		}

		//Add Columns
		for (int32 v = 0; v < RowCount; v++)
		{
			for (int32 b = 0; b < ColCount; b++)
			{
				Rows[v].AddNewColumn();
			}
		}
	}

	void Clear()
	{
		if (Rows.Num() <= 0) return;
		//~~~~~~~~~~~~~~~

		//Destroy any Actors
		const int32 RowTotal = Rows.Num();
		const int32 ColTotal = Rows[0].Columns.Num();

		//Empty
		for (int32 v = 0; v < Rows.Num(); v++)
		{
			Rows[v].Columns.Empty();
		}
		Rows.Empty();
	}

	TTuple<int32, int32> NumLayerDimensions()
	{
		return TTuple<int32, int32>(Rows.Num(), Rows[0].Columns.Num());
	}

	//default properties
	FMapLayer()
	{

	}

	FMapLayer(int32 Rows, int32 Cols) 
	{
		AddUninitialized(Rows, Cols);
	}
};

USTRUCT()
struct FMapSector {
	GENERATED_BODY()

	UPROPERTY()
	TArray<FMapLayer> Layers;

	FORCEINLINE FMapLayer& operator[] (int32 i)
	{
		return Layers[i];
	}

	void AddNewLayer()
	{
		Layers.Add(FMapLayer());
	}

	void AddUnitialized(int32 LayerCount, int32 RowCount, int32 ColCount)
	{
		Clear();
		// Add Layers
		for (int32 l = 0; l < LayerCount; l++)
		{
			AddNewLayer();
		}

		// Add Rows
		for (int32 l = 0; l < LayerCount; l++)
		{
			for (int32 r = 0; r < RowCount; r++)
			{
				Layers[l].AddNewRow();
			}
		}

		// Add Rows
		for (int32 l = 0; l < LayerCount; l++)
		{
			for (int32 r = 0; r < RowCount; r++)
			{
				for (int32 c = 0; c < ColCount; c++)
				{
					Layers[l].Rows[r].AddNewColumn();
				}
			}
		}
	}

	void Clear()
	{
		if (Layers.Num() <= 0) return;
		//~~~~~~~~~~~~~~~

		//Destroy any Actors
		const int32 LayerTotal = Layers.Num();
		const int32 RowTotal = Layers[0].Rows.Num();
		const int32 ColTotal = Layers[0].Rows[0].Columns.Num();


		//Empty
		for (int32 l = 0; l < LayerTotal; l++)
		{
			for (int32 r = 0; r < RowTotal; r++)
			{
				Layers[l].Rows[r].Columns.Empty();
			}
		}
		for (int32 l = 0; l < LayerTotal; l++)
		{
			Layers[l].Rows.Empty();
		}

		Layers.Empty();
	}

	FMapSector()
	{
		AddUnitialized(3, 3, 3);
	}

	FMapSector(int32 size)
	{
		AddUnitialized(size, size, size);
	}

	FMapSector(int32 Layers, int32 Rows, int32 Cols)
	{
		AddUnitialized(Layers, Rows, Cols);
	}
};
#include <iostream>
#include<iomanip>
#include <string>

using namespace std;

void partisons(int list[], int listSize);


int main() 
{
	const int size1 = 6;
	
	
	int list1[size1];
	for (int i = 0; i <size1 ; i++)
	{
		cin >> list1[i];
	}
	 selectionSort(list1, size1);

	
	for (int i = 0; i < size1; i++)
	{
		cout << list1[i] << " ";
	}

	
}

void partisons(int list[], int listSize)
{
    int first = 0;
    int low = first + 1;
    int high = listSize - 1;
    int pivot = list[first];

    while (high > low) {

        while (low <= high && list[low] <= pivot)
        {
            low++;
        }
        while (low <= high && list[high] > pivot)
        {
            high--;
        }
        if (high > low) {
            int temp = list[high];
            list[high] = list[low];
            list[low] = temp;
        }
    }

    while (high >= low && list[high] >= pivot) high--;

    if (high > first) {
        int temp = list[high];
        list[high] = list[first];
        list[first] = temp;
        
    }
    
	 }
	
	


#include<iostream>
using namespace std;

int sum(int arr[], int a);

int main() {
    int arr[1000], n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        cout << sum(arr, n);
    }
}
int sum(int arr[], int a) {
    int i;
    sum = 0;
    for (i=0; i<n; ++i) {
        sum += arr[i];
    }
    return sum;
}#include<iostream>
using namespace std;

int sum(int arr[], int a);

int main() {
    int arr[1000], n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        cout << sum(arr, n);
    }
}
int sum(int arr[], int a) {
    int i;
    sum = 0;
    for (i=0; i<n; ++i) {
        sum += arr[i];
    }
    return sum;
}
"For Loop": {
    "prefix": "for",
    "body": [
        "for (var ${index} = 0; ${index} < ${array}.length; ${index}++) {",
        "\tvar ${element} = ${array}[${index}];",
        "\t$0",
        "}"
    ],
    "description": "For Loop"
},
#include <iostream>
#include<iomanip>

using namespace std;
void eightQueens(char board[], int size);
void shuffle(char list[], int size);
int linearSearch(char list[], char key, int arraySize);
int linearSearchInt(int list[], int key, int arraySize);




const int SIZE = 8;
int main()
{	char board[SIZE];

	srand(unsigned( time(0)));
	int x = rand()%SIZE;
	for (int i = 0; i < SIZE; i++)
	{
		if (i == x)
			board[i] = 'Q';
		else
			board[i] = ' ';
	}
		eightQueens(board, SIZE);
}
void eightQueens(char board[],int size)
{
	int count = 0, vale, test[SIZE];
	for (int i = 0; i < size ; i++)
	{
		 vale = linearSearch(board, 'Q', size);
		 bool flage = true;
		 
		for (int j = 0; j < count;j++)
		{
			if (test[j] == vale)
				flage = false;
		}
		if (flage == true)
		{
			for (int j = 0; j < size; j++)
			{
				cout  << "|";
				cout << board[j];
			}
			test[count] = vale;
			count++;
			shuffle(board, size);
		}
		else
		{
			int n = 0;
			for (int j = 0; j < 100; j++)
			{
				shuffle(board, size);
				if (linearSearchInt(test, linearSearch(board, 'Q', size), size) == -1)
				{
					n = linearSearch(board, 'Q', size);
					test[count] = n;
					count++;
					break;
				}
			}
			for (int j = 0; j < SIZE; j++)
			{
				if (j == n)
					board[j] = 'Q';
				else
					board[j] = ' ';
			}
			for (int j = 0; j < size; j++)
			{
				cout << "|";
				cout << board[j] ;
			}
			

		}
		cout <<'|'<< endl;
	}
	
}

int linearSearch( char list[], char key, int arraySize)
{
	for (int i = 0; i < arraySize; i++)
	{
			if (key == list[i])
				return i;
	}
	return -1;
}
int linearSearchInt(int list[], int key, int arraySize)
{
	for (int i = 0; i < arraySize; i++)
	{
		if (key == list[i])
			return i;
	}
	return -1;
}
void shuffle(char list[], int size)
{
	
	for (int i = size - 1; i > 0; i--)
	{
		// Generate an index j randomly with 0 <= j <=i
		int j = rand() % (i + 1);
		// Swap myList[i] with myList[j]
		char temp = list[i];
		list[i] = list[j];
			list[j] = temp;
	}
}



	
	


 int list[LIMIT], i, j, val, count, flag, test[LIMIT], c = 0;
    //enter the values
    for (i = 0; i < LIMIT; i++)
    {
        cout << "Enter The Elements : ";
        cin >> list[i];
        if (list[i] == 0)
            break;
    }
    //count the occurence of each value
    for (j = 0; j < LIMIT; j++)
    {
        count = 0;
        flag = 1;
        val = list[j];
        //counts each value's occurence and if the value is 0 break
        for (i = 0; i < LIMIT; i++)
        {
            if (val == list[i])
                count++;
            else if (list[i] == 0)
                break;
        }
        //checks whether the value has been already counted (flag = 0) or not (flag stays 1)
        for (i = 0; i < c; i++)
        {
            if (test[i] == val)
                flag = 0;
        }
        //if the value has not been counted print 
        if (flag == 1)
        {

            cout << "The Occurence Of The Number " << val << " is " << count << endl;
            test[c] = val;
            c++;
        }

    }
#include<iostream>
#include <fstream>
#include <cctype>
#include<ctffunc.h>
using namespace std;

void enterLetters(char list[], int limit);
void countVandCLetters(char list[], int limit);



const int LIMIT = 100;


int main()
{
	char letters[LIMIT];

	enterLetters(letters, LIMIT);
	countVandCLetters(letters, LIMIT);
    
}
void enterLetters(char list[], int limit)
{
	
	for (int i = 0; i < limit; i++)
	{
		cin >> list[i];
		if (list[i] == '0')
			break;
	}
}
void countVandCLetters(char list[], int limit)
{
	int vowel = 0;
	int Consonant = 0;
	char vowels[] = { 'a','e','o','u','i' };
	char Consonants[] = { 'b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z' };
	
	for (int i = 0; i < limit; i++)
	{
		if (IsCharUpperA(list[i]))
			list[i] = list[i] + 32;
		
		for (int j = 0; j < 5; j++)
		{
			if (list[i] == vowels[j])
				vowel++;
		}
		for (int j = 0; j < 21; j++)
		{
			
			if (list[i] == Consonants[j])
				Consonant++;
		}
		
		
	}
	
		cout << "Number Of vowels Letters is " << vowel << endl;
		cout << "Number Of Consonants Letters is " << Consonant << endl;
	
}
 
#include<iostream>
#include <fstream>
using namespace std;
void selectionSort(double list[], int listSize);
int main()
{
    double list[] = { 3.4, 5, 3, 3.5, 2.2, 1.9, 2 };

    selectionSort(list, 7);
    for (int i = 0; i < 7; i++)
    {
        cout << list[i]<<" ";
    }
}
//decreasing order
void selectionSort(double list[], int listSize)
{
    for (int i = listSize-1; i >= 0 ; i--)
    {
        double currentMax = list[i];
        int currentMaxIndex = i;
        for (int j = i - 1; j >= 0; j--)
        {
            if (currentMax < list[j])
            {
                currentMax = list[j];
                currentMaxIndex = j;
            }
        }
            if (currentMaxIndex != i)
            {
                list[currentMaxIndex] = list[i];
                list[i] = currentMax;
            }
   
    }
}
//increasing order
void selectionSort(double list[], int listSize)
{
    for (int i = 0; i < listSize - 1; i++)
    {
        double currentMin = list[i];
        int currentMinIndex = i;
        for (int j = i + 1; j < listSize; j++)
        {
            if (currentMin > list[j])
            {
                currentMin = list[j];
                currentMinIndex = j;
            }
        }
            if (currentMinIndex != i)
            {
                list[currentMinIndex] = list[i];
                list[i] = currentMin;
            }
        
    }
}
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
ll cs=0;
ll tab[500000][20];
void spar(ll a[],ll n)
{
    ll i,j;
    for(i=0;i<n;i++)
        tab[i][0]=a[i];
    for(j=1;(1<<j)<=n;j++)
    {
        for(i=0;i+(1<<(j-1))-1<n;i++)
            tab[i][j]=__gcd(tab[i][j-1],tab[i+(1<<(j-1))][j-1]);
    }
}
ll qry(ll a,ll b)
{
    ll j=log2(b-a+1);
    return __gcd(tab[a][j],tab[b-(1<<j)+1][j]);
}
void sol()
{
    ll n,m,i,sum=0;
    cin>>n>>m;
    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    spar(a,n);
    for(i=0;i+m-1<n;i++)
        sum+=qry(i,i+m-1);
    cout<<sum;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ll t;
    //cin>>t;
    //while(t--)
    sol();
    return 0;
}
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
ll cs=0;
struct duo
{
    ld x,F,S;
};
bool sim(duo a,duo b)
{
    if(a.F==b.F||a.F==b.S||a.S==b.F||a.S==b.S)
        return 1;
    return 0;
}
void sol()
{
    cout.precision(11);
    cout<<fixed;
    ll n,i,k;
    cin>>n;
    ld a[n],vl,ans=0;
    duo low[3],h[3];
    for(i=0; i<3; i++)
        low[i].x=INT_MAX;
    for(i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=0; i<3; i++)
    {
        h[i].F=a[n-1-i];
        h[i].S=a[n-2-i];
    }
    for(i=0; i<n-1; i++)
    {
        vl=abs(a[i]-a[i+1]);
        for(k=0; k<3; k++)
        {
            if(vl<low[k].x)
            {
                ll j=k;
                for(j=2; j>=k+1; j--)
                {
                    low[j].x=low[j-1].x;
                    low[j].F=low[j-1].F;
                    low[j].S=low[j-1].S;
                }
                low[k].x=vl;
                low[k].F=a[i];
                low[k].S=a[i+1];
                break;
            }
        }
    }
    for(i=0;i<3;i++)
    {
        for(k=0;k<3;k++)
        {
            if(!sim(h[i],low[k]))
                ans=fmax(ans,(h[i].F+h[i].S)/low[k].x);
        }
    }
    cout<<ans;

}
int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //ll t;
    //cin>>t;
    //while(t--)
    sol();
    return 0;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>
// CPP program to check if a string is 
// substring of other. 

using namespace std;

// Returns true if s1 is substring of s2 
int isSubstring(string s1, string s2)
{
	int M = s1.length();
	int N = s2.length();

	/* A loop to slide pat[] one by one */
	for (int i = 0; i <= N - M; i++) {
		int j;

		/* For current index i, check for
pattern match */
		for (j = 0; j < M; j++)
			if (s2[i + j] != s1[j])
				break;

		if (j == M)
			return i;
	}

	return -1;
}

/* Driver program to test above function */
int main()
{
	string s1 ,s2 ;
	getline(cin, s1);
	getline(cin, s2);
	int res = isSubstring(s1, s2);
	if (res == -1)
		cout << "Not present";
	else
		cout << "Present at index " << res;
	return 0;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int octal2Dec(string& octal);
bool validity(int number);
int stringToNum(string number);
int bin2Dec(int binNumber);
int dec2octal(const string& number);




int main()
{
	string binNumber;
	getline(cin, binNumber);
	cout << dec2octal(binNumber);
	return 0;
}
int dec2octal(const string& number)
{
	int binNumber = stringToNum(number);
	int decimalNumber = bin2Dec(binNumber);
	int octal = 0, placeValue = 1;
	while (decimalNumber != 0)
	{
		octal += (decimalNumber % 8) * placeValue;
		decimalNumber /= 8;
		placeValue *= 10;
	}
	return octal;
}

int bin2Dec(int binNumber)
{
	int digits, decimal = 0, count = 0, bin = binNumber;
	while (bin != 0)
	{
		digits = bin % 10;
		  decimal += digits* pow(2,count);

		  bin /= 10;
		count++;
		
	}
	return decimal;
}
int stringToNum(string binNumber)
{
	int convertedNumber = 0;
	for (int i = 0; i < binNumber.length(); i++)
	{
		
		convertedNumber = (convertedNumber * 10) + static_cast<int>(binNumber[i] - '0');
	}
	return convertedNumber;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int octal2Dec(string& octal);
bool validity(int number);
int stringToNum(string number);


int main()
{
	string number;
	getline (cin , number);

	
	cout << octal2Dec(number);
	return 0;
}

int octal2Dec(string& octal)
{
	int digits, decimal = 0, count = 0,oct = stringToNum(octal);
	while (oct != 0)
	{
	
		digits = oct % 10;
		if(validity(digits) == true)
		  decimal += digits* pow(8,count);
		else
		{
			return NAN;
		}
		oct /= 10;
		count++;
		
	}
	return decimal;
}
bool validity(int number)
{
	return number % 8 == 0 || number % 9 == 0? false : true;
		
}
int stringToNum(string number)
{
	int convertedNumber = 0;
	for (int i = 0; i < number.length(); i++)
	{
		convertedNumber = (convertedNumber * 10) + static_cast<int>(number[i] - '0');
	}
	return convertedNumber;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;




string format(int number, int width);
int numberWidthF(int number);

int main()
{

	
	int number,width;
	cin >> number >> width;
	cout << format(number, width);
	
}
string format(int number, int width)
{
	string zeros = " ";
	string num = to_string(number);
	
	int numberWidth = numberWidthF(number);
	
	for (int  i = 1; i <= width-numberWidth; i++)
	{
		zeros += "0";
	}
	return zeros+num;
}
int numberWidthF(int number)
{
	int digits, numberWidth = 0;
	while (number != 0)
	{
		digits = number % 10;
		number /= 10;
		numberWidth++;
	}
	return numberWidth;
}
cout << "Machine ID: ";
	//WHILE LOOP: check whether Machine ID is in numeric
	while(!(cin >> machineID)){
		//display error message
		cout << "ERROR! Invalid Machine ID! Please try again..." << endl;
		cout << "Machine ID: ";
		
		cin.clear(); //clear previous user input
		cin.ignore(INT_MAX, '\n'); //discard previous user input
	}
//	optionMenu = getMenuOption();
//	
//	while(optionMenu > -1){
//		switch(optionMenu){
//			case 1:
//				addJob(h, j);
//				break;
//			
//			case 2:
//				retrieveJob(h, j);
//				break;
//				
//			case 3:
//				cout << "Option 3..." << endl;
//				break;
//				
//			case 4:
//				cout << "Option 4..." << endl;
//				break;
//			
//			case 5:
//				cout << "Bye!";
//				exit(0); //terminate program
//				break;
//				
//			default:
//				cout << "ERROR! Invalid option! Please try again..." << endl;
//				break;
//		}
//		
//		optionMenu = getMenuOption();
//	}


int getMenuOption(){
	int menuOption=0;
		
	cout << "Please enter number to select: ";
	cin >> menuOption;
	
	//error check
	while(!cin.good()){
		//report problem when user input in not numeric
		cout << "ERROR! Faulty input! Please try again..." << endl;
		
		//clear stream
		cin.clear();
		cin.ignore(INT_MAX, '\n');
		
		//get input again
		cout << "Please enter number to select: ";
		cin >> menuOption;
	}
	
	//clear stream
	cin.clear();
	cin.ignore(INT_MAX, '\n');
		
	return menuOption;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;



double avgOfEvenPlaces(int number);
int reversal(int n);


int main()
{
	
	int number;
	cin >> number;
	cout << fixed<<setprecision(3)<<avgOfEvenPlaces(reversal(number));
}
double  avgOfEvenPlaces(int n)
{
	
	int digit, count = 1.0, countOfEven = 0.0;
	double sumOfEven = 0.0;
	while (n != 0)
	{
		digit = n % 10;
		n /= 10;
		
		if (count % 2 == 0)
		{
		  
			sumOfEven += digit; 
			countOfEven++;
		}
			count++;
	}
	
		return  sumOfEven / countOfEven;
	
}
int reversal(int n)
{
	int digits, revers = 0.0;
	while (n != 0)
	{
		digits = n % 10;
		revers = revers * 10 + digits;
		n /= 10;
	}
	return revers;
 }


#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;



double sqrt(int n);


int main()
{
	
	long n;
	cin >> n;
	cout << "the approximated sqrt of the number " << n << " is " << sqrt(n);
}
double sqrt(long n)
{
	double lastGuess = 1;
	double nextGuess = (lastGuess + n / lastGuess) / 2;

	while (nextGuess - lastGuess > 0.0001)
	{
		nextGuess = lastGuess;
		(lastGuess + (n / lastGuess)) / 2;
	}
	lastGuess = nextGuess;
	return nextGuess = (lastGuess + n / lastGuess) / 2;

}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


bool primeNumber(int n);
bool additivePrime(int n);
int sumOfDigits(int n);



int main()
{
	
	int count = 0;
	int number = 13;
	cout << setw(3) << "Prime number" << setw(20) << "Sum of its digits" << endl;
	for (int i = 2; i <= 70; i++)
	{
		if (primeNumber(i) && additivePrime(i))
			cout <<setw(1)<< i<<setw(15)<<sumOfDigits(i)<<endl;
	}
		

}
bool primeNumber(int n) {
	
		for (int i = 2; i <= n / 2; i++) {
			
			if (n % i == 0) {

				return false;
			}
		}
		return true;
}

bool additivePrime(int n)
{
	
	if (primeNumber(sumOfDigits(n)))
		return true;
	else
		return false;
}
int sumOfDigits(int n)
{
	int sum = 0, digit = 0;
	while (n != 0)
	{
		digit = n % 10;
		sum += digit;
		n /= 10;
	}
	return sum;
}






	
   




#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


bool primeNumber(int n);
bool Emirp(int n);
int reversal(int n);
int recursive(int a, int b);

int main()
{
	
	int count = 0;
	int number = 13;
	while (count <= 100)
	{
		if (Emirp(number))
		{
			count++;
			if (count % 10 == 0)
				cout << setw(7) << number << endl;
			else
				cout << setw(7) << number;
		}
		number++;
	}
		

}
bool primeNumber(int n) {
	
		for (int i = 2; i <= n / 2; i++) {
			
			if (n % i == 0) {

				return false;
			}
		}
		return true;
}

bool Emirp(int n) {
	

	return primeNumber(n) && primeNumber(reversal(n));
	
}

int reversal(int n) {
	
		if (n < 10) {
			
				return n;
			
		}
		return recursive(n % 10, n / 10);
	
}

int recursive(int a, int b) {

	if (b < 1) {

		return a;

	}
	return recursive(a * 10 + b % 10, b / 10);
	
}



	
   




#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;
bool isEven(int number);
bool isPalindrom(int number);

int main()
{
	
	int count = 0, number = 1;
	
	while (count <= 50)
	{

		if(isEven(number) == true && isPalindrom(number) == true)
		{
			count++;
			if (count % 5 == 0)
				cout << setw(8) << number << endl;
			else
				cout << setw(8) << number;
		}
		number++;
	}
	
		
	

}

bool isEven(int number)
{
	if (number % 2 == 0)
		return true;
	else
		return false;
	
}
bool isPalindrom(int number)
{
	int reverse = 0, rem = 0;
	int num = number;
	while (number != 0)
	{
		rem = number % 10;
		reverse = reverse * 10 + rem;
		number /= 10;
	}
	if (reverse == num)
		return true;
	else
		return false;
}


	
   




#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

bool isArmstrong(int n);
int reversNumber(int n);
void isReversedArmstrong(int n);

int main()
{
	cout << "Enter first integer: ";
	int n1;
	cin >> n1;
	isReversedArmstrong(n1);
	

}

bool isArmstrong(int n)
{
	int temp = 0,armstrong, total = 0;
	armstrong = n;
	while (armstrong != 0)
	{
		temp = armstrong % 10;
		total += pow(temp, 3);
		armstrong /= 10;
	}
	if (total == n)
		return true;
	else
		return false;
 }
int reversNumber(int n)
{
	int reverse = 0, rem = 0;
	while (n != 0)
	{
		rem = n % 10;
		reverse = reverse * 10 + rem;
		n /= 10;
	}
	return reverse;
}
void isReversedArmstrong(int n)
{
	if (isArmstrong(n))
	{
		if(isArmstrong(reversNumber(n)))
			cout << "the Reversed "<< reversNumber(n)<<" number IS an Armstrong number ";
		else
			cout << "the Reversed " << reversNumber(n) << " number is NOT Armstrong number ";
	}
	else
		cout << "the number entered is NOT Armstrong number ";

}


	
   




#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int LCM(int n1, int n2);

int main()
{
	cout << "Enter first integer: ";
	 int n1;
	 cin >> n1;
	
		 cout << "Enter second integer: ";
	 int n2;
	 cin >> n2;
	
	
	
		cout << "Least Common Multiple for " << n1 <<
			" and " << n2 << " is " << LCM(n1,n2)<< endl;
}

 int LCM(int n1, int n2)
 {
	 int lcm = 1; 
	 int max = (n1 > n2) ? n1 : n2;
	
		 while (true)
		 {
			 if (max % n1 ==0 && max % n2 == 0)
			 {
				 lcm = max;
				 break;
			 }
			 else
				 max++;

		 }
	
		return lcm; // Return gcd
	 }




	
   




#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


int compute_profit(int quantity);

int main()
{
	int quantity = 1000;
	cout << "Quantity " << setw(9) << "Profit-per-item (in $)"<<endl;
    for ( ; quantity <= 10000; quantity+=1000)
    {
            cout<<quantity<< setw(9)<<compute_profit(quantity)<<endl;
    }
   
}
int compute_profit(int quantity)
{
    int profit = 0;
   

   
    if (quantity < 1000)
        profit += quantity; // * 1
    else
    {
        profit += 1000;
        quantity -= 1000;
        if (quantity < 4000)
            profit += quantity * 2;
        else
        {
            profit += 8000; // 4000 * 2
            quantity -= 4000;
            profit += quantity * 5;
        }
    }
    
    return profit;
}


// access v1 by copy 
[v1]() { 
	for (auto p = v1.begin(); p != v1.end(); p++) { 
		cout << *p << " "; 
	} 
}; 
/**
   SHAMI AL BASHAR PROTHOY
   PRESIDENCY INTERNATIONAL SCHOOL
**/

#include <bits/stdc++.h>
using namespace std;
#define csee "Case "<<cs<<": "
typedef long long ll;
typedef long double ld;
#define B begin()
#define E end()
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ins insert
#define vi vector
#define ins insert
const ld pi=2*acos(0.0);
ll T,cs=1;
vi<ll>coins;
struct tim
{
    ll s,f;
};
bool cmp(tim a,tim b)
{
    if(a.s!=b.s)return a.s<b.s;
    return a.f<b.f;
}
/**
THINK TWICE,
      CODE ONCE
**/

void sol(ll cs)
{
   ll n,i,sum=1,j;
   cin>>n;
   tim t;
   vector<tim>v;
   for(i=0;i<n;i++)
    cin>>t.f>>t.s,v.pb(t);
   sort(v.B,v.E,cmp);//if time ain't sorted
   j=0;
   for(ll i=1;i<n;i++)
   {
       if(v[i].f>=v[j].s)sum++,j=i;
   }
   cout<<sum<<"\n";
}
//CODE
int main()
{
    //freopen("inp.txt","r",stdin)
    scanf("%lld",&T);
    while(T--)
        sol(cs++);
    return 0;
}
/**
   SHAMI AL BASHAR PROTHOY
   PRESIDENCY INTERNATIONAL SCHOOL
**/

#include <bits/stdc++.h>
using namespace std;
#define csee "Case "<<cs<<": "
typedef long long ll;
typedef long double ld;
#define B begin()
#define E end()
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ins insert
#define vi vector
#define ins insert
const ld pi=2*acos(0.0);
ll T,cs=1;
struct pt
{
    ll x,y,t;
};
/**
THINK TWICE,
      CODE ONCE
**/
void show(vi<ll>&v)
{
    for(auto it:v)cout<<it<<' ';
    cout<<"\n";
}
vi<ll> filsub(vi<ll>v)
{
    vi<ll>temp;
    ll i,j,n=v.size(),sum;
    for(i=0;i<(1<<n);i++)
    {
        sum=0;
        for(j=0;j<n;j++)
        {
            if(i&(1<<j))
                sum+=v[j];
        }
        temp.pb(sum);
    }
    return temp;
}
void sol(ll cs)
{
    vi<ll>v,va,vb;
    ll n,i,a,k;
    cin>>n>>k;
    for(i=0;i<n;i++)cin>>a,v.pb(a);
    va.assign(v.B,v.E-n/2);
    vb.assign(v.B+(n+1)/2,v.E);
    sort(va.B,va.E);
    sort(vb.B,vb.E);
    va=filsub(va);
    vb=filsub(vb);
    bool bl=false;
    for(i=0;i<va.size();i++)
    {
        if(binary_search(vb.B,vb.E,k-va[i]))
        {
            bl=true;
            break;
        }
    }
    cout<<csee<<((bl)?"Yes":"No")<<"\n";
}
//CODE
int main()
{
    //freopen("inp.txt","r",stdin)
    scanf("%lld",&T);
    while(T--)
        sol(cs++);
    return 0;
}
/**
   SHAMI AL BASHAR PROTHOY
   PRESIDENCY INTERNATIONAL SCHOOL
**/

#include <bits/stdc++.h>
using namespace std;
#define csee "Case "<<cs<<": "
typedef long long ll;
typedef long double ld;
#define B begin()
#define E end()
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ins insert
#define vi vector
#define ins insert
const ld pi=2*acos(0.0);
ll T,cs=1;
struct pt
{
    ll x,y,t;
};
/**
THINK TWICE,
      CODE ONCE
**/
void show(vi<ll>&v)
{
    for(auto it:v)cout<<it<<' ';
    cout<<"\n";
}
set<ll> filsub(vi<ll>v)
{
    set<ll>temp;
    ll i,j,n=v.size(),sum;
    for(i=0;i<(1<<n);i++)
    {
        sum=0;
        for(j=0;j<n;j++)
        {
            if(i&(1<<j))
                sum+=v[j];
        }
        temp.ins(sum);
    }
    return temp;
}
void sol(ll cs)
{
    set<ll>sa,sb;
    vi<ll>v,va,vb;
    ll n,i,a,k;
    cin>>n>>k;
    for(i=0;i<n;i++)cin>>a,v.pb(a);
    va.assign(v.B,v.E-n/2);
    vb.assign(v.B+(n+1)/2,v.E);
    sort(va.B,va.E);
    sort(vb.B,vb.E);
    sa=filsub(va);
    sb=filsub(vb);
    bool bl=false;
    for(auto it=sa.B;it!=sa.E;it++)
    {
        if(sb.count(k-*it))
        {
            bl=true;
            break;
        }
    }
    cout<<csee<<((bl)?"Yes":"No")<<"\n";
}
//CODE
int main()
{
    //freopen("inp.txt","r",stdin)
    scanf("%lld",&T);
    while(T--)
        sol(cs++);
    return 0;
}
/**
   SHAMI AL BASHAR PROTHOY
   PRESIDENCY INTERNATIONAL SCHOOL
**/

#include <bits/stdc++.h>
using namespace std;
#define csee "Case "<<cs<<": "
typedef long long ll;
typedef long double ld;
#define B begin()
#define E end()
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ins insert
#define vi vector
const ld pi=2*acos(0.0);
ll T,N;
ll cs=1;
ll soln=0;
/**
THINK TWICE,
      CODE ONCE
**/
bool ok(vi<vi<ll>>&v,ll row,ll col)
{
    if(row>=0&&row<N&&col>=0&&col<N&&!v[row][col])
        return true;
    return false;
}
void go(vi<vi<ll>>&v,ll row,ll col,ll tp)
{
    if(row==N-1&&col==N-1)
    {
        if(N*N==tp)
            soln++;
        return;
    }
    v[row][col]=1;
    if(row==0&&col==0)
        go(v,row+1,col,tp+1);
    else
    {
        v[row][col]=0;
        bool l=false,r=false,u=false,d=false;
        if(ok(v,row,col+1))
            r=true;
        if(ok(v,row,col-1))
            l=true;
        if(ok(v,row+1,col))
            d=true;
        if(ok(v,row-1,col))
            u=true;
        if(!u&&!d&&r&&l)
            return;
        if(u&&d&&!r&&!l)
            return;
        v[row][col]=1;
        if(r)
            go(v,row,col+1,tp+1);
        if(l)
            go(v,row,col-1,tp+1);
        if(d)
            go(v,row+1,col,tp+1);
        if(u)
            go(v,row-1,col,tp+1);
    }
    v[row][col]=0;
}
void sol(ll cs)
{
    soln=0;
    cin>>N;
    vi<ll>temp(N,0);
    vi<vi<ll>>v(N,temp);
    go(v,0,0,1);
    cout<<csee<<2*soln<<"\n";
}
//CODE
int main()
{
    //freopen("inp.txt","r",stdin)
    scanf("%lld",&T);
    while(T--)
        sol(cs++);
    return 0;
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

void printMonth(int year, int month);
void printMonthTitle(int year, int month);
void ptintMonthName(int month);
void printMonthBody(int year, int month);
int getStartDay(int year, int month);
int getTotalNumberOfDays(int year, int month);
int getNumberOfDaysInMonth(int year, int month);
bool isLeapYear(int year);

int main()
{
	cout << "Enter full year ";
	int year;
	cin >> year;
	cout << " Enter month in number between 1 and 12: ";
	int month;
	cin >> month;
	printMonth(year, month);

}
void printMonth(int year, int month)
{
	printMonthTitle(year, month);

	printMonthBody(year, month);
}


void printMonthTitle(int year, int month)

{
	ptintMonthName(month);
	cout << " " << year << endl;
	cout << "-----------------------------" << endl;
	cout << " Sun Mon Tue Wed Thu Fri Sat" << endl;
	

}



void ptintMonthName(int month)

{
	switch (month)
	{
	case 1:
		cout << "January";
		break;
	case 2:
		cout << "February";
		break;
	case 3:
		cout << "March";
		break;
	case 4:
		cout << "April";
		break;
	case 5:
		cout << "May";
		break;
	case 6:
		cout << "June";
		break;
	case 7:
		cout << "July";
		break;
	case 8:
		cout << "August";
		break;
	case 9:
		cout << "September";
		break;
	case 10:
		cout << "October";
		break;
	case 11:
		cout << "November";
		break;
	case 12:
		cout << "December";
	}
}
void printMonthBody(int year, int month)
{
	int startDay = getStartDay(year, month);
	int numberOfDaysInMonth = getNumberOfDaysInMonth(year, month);

	for (int i = 0; i < startDay; i++)
		cout << "    ";
	for (int i = 1; i <=  numberOfDaysInMonth; i++)
	{
		cout << setw(4) << i;
		if ((i + startDay) % 7 == 0)
			cout << endl;
	}
}
int getStartDay(int year, int month)
{
	int startDay1800 = 3;
	int totalNumberOfDays = getTotalNumberOfDays(year, month);


	return (totalNumberOfDays + startDay1800) % 7;

}
int getTotalNumberOfDays(int year, int month)
{
	int total = 0;
	for (int i = 1800; i < year; i++)
	{
		if (isLeapYear(i))
			total += 366;
		else
			total += 365;
	}
	for (int i = 1; i < month; i++)
	{
		total += getNumberOfDaysInMonth(year, i);
	}
	return total;
}
int getNumberOfDaysInMonth(int year, int month)
{
	if (month == 1 || month == 3 || month == 5 || month == 7 ||
		month == 8 || month == 10 || month == 12)
		return 31;
	if (month == 4 || month == 6 || month == 9 || month == 11)
		return 30;
	
		if (month == 2) return isLeapYear(year) ? 29 : 28;
	
		 return 0;
}
bool  isLeapYear(int year)
{
	return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int hexDec(const string& hex);
int hexCharToDecimal(char ch);
int main()
{
	cout << "enter a hex Number ";
	string hex;
	cin >> hex;

	cout << "The Decimal Number For Hex Is  " << hex
		<< " is " << hexDec(hex) << endl;
}
int hexDec(const string&  hex)
{
	int decimalValue = 0;
	for (unsigned i = 0; i < hex.length(); i++)
	{
		decimalValue = decimalValue * 16 + hexCharToDecimal(hex[i]);
	}
	return decimalValue;
	
}
int hexCharToDecimal(char ch)
{
	ch = toupper(ch);
	if (ch >= 'A' && ch <= 'F')
		return 10 + ch - 'A';
	else
		return ch - '0';
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
    int counter = 1;
    int number = 0;
    int largest = 0;
    int n;
    cin >> n;
    int occurrence = 0;

    cout << "Please enter up to 10 numbers and I will print the largest one on the screen.\n\n";

    while (counter <= n)
    {
        cout << "Number: ";
        cin >> number;
        
        if (largest < number)
        {
            largest = number;
            occurrence = 1;
            
        }
        else if (number == largest)
        {
            occurrence++;
        }
        if (number == 0)
        {
            break;

        }
            counter++;
    }

    cout << "the largest number is "<<largest << endl;
    cout << "  the occurrence count " << largest << " is " << occurrence << " time";


	

}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{

	int firstprofit = 0;
	int quantity = 0;
	int q3 = 1;

	//the targeted profit >> 50000
	cout << "Enter the profit ";
	int endProfit;
	cin >> endProfit;

	//first five quantity 1 * 1000+2 * 4000
	firstprofit += 9000;
	do
	{
		//the remaining quantity(q3) which is 50000(endProfit) - 9000(firstProfit) / 5
		if (q3 == (endProfit - 9000) / 5)

			firstprofit += q3 * 5;
		else
			q3++;

	} while (firstprofit <= endProfit);

	//the whole quantity
	quantity += 1000 + 4000 + q3;

	cout << quantity;






}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	int num, reversedInteger = 0, remainder, originalInteger;
	cin >> num;
	originalInteger = num;
	for (; num != 0; num /= 10)
	{
		remainder = num % 10;
		reversedInteger = reversedInteger * 10 + remainder;
	}


	if (originalInteger == reversedInteger)
		cout << originalInteger << " is a palindrome.";
	else
		cout << originalInteger << " is not a palindrome.";


	
	

	
	
}

	
	

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{

	int f1 = 0, f2 = 1;
	int nextTerm = 0;
	for (int i = 1; i < 10; i++)
	{
		//print first 2 numbers
		if (i == 1)
		{
			cout <<  f1<<" ";
			continue;
		}
		if (i == 2)
		{
			cout << f2 << " ";
			continue;
		}
		
		nextTerm = f1 + f2;
		f1 = f2;
		//make f2 = the next term
		f2 = nextTerm;
		cout << nextTerm<<" ";

	}

	
	

	
	
}

	
	

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	cout << "enter the year ";
	int year;
	cin >> year;
	
	cout << "Enter The First Day Of The year ";
	int FirstDay;
	cin >> FirstDay;
	int count = 1;
	int days = 1;
	for (int month = 1; month <= 12; month++)
	{
		cout << "             ";
		switch (month)
		{
		case 1: cout << "January " << year<<endl;
			break;
		case 2: cout << "February " << year << endl;
			break;
		case 3: cout << "March  " << year << endl;
			break;
		case 4: cout << "April  " << year << endl;
			break;
		case 5: cout << "May " << year << endl;
			break;
		case 6: cout << "June  " << year << endl;
			break;
		case 7: cout << "July  " << year << endl;
			break;
		case 8: cout << "August " << year << endl;
			break;
		case 9: cout << "September " << year << endl;
			break;
		case 10: cout << "October " << year << endl;
			break;
		case 11: cout << "November " << year << endl;
			break;
		case 12: cout << "December " << year << endl;
			break;
		}
		cout << " --------------------------------------------------------- "<<endl;
		cout << "  Sun Mon Tue Wed Thu Fri Sat"<<endl;
		for (int i = 0; i < FirstDay; i++)
		{
			cout << "    ";
		}
		for (int i = 1; i < 31; i++)
		{
			if (i < 10) {
				cout<<"   " <<i;
			}
			else {
				cout<<"  " << i;
			}
			if ((i + FirstDay) % 7 == 0) {
				cout << endl;
			}
		}
		cout << endl;

		FirstDay = (FirstDay + 31) % 7;
		
	}
	
	
}

	
	

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	cout << "enter the month ";
	int month;
	cin >> month;
	cout << "Enter The First Day Of The Month ";
	int firstDay;
	cin >> firstDay;
	int nextSunday = 1;
	
		switch (firstDay)
		{
			
		case 1: nextSunday += 7;
			cout << "The first day of this month is sunday "<<endl;
			while (nextSunday < 30)
			{
					cout << "Next Sunday of this month is on " << nextSunday << endl;
									nextSunday += 7 ;
			}
			break;

		case 2: nextSunday += 6;
			cout << "The first day of this month is monday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 3: nextSunday += 5;
			cout << "The first day of this month is tuesday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 4: nextSunday += 4;
			cout << "The first day of this month is wednesday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 5: nextSunday += 3;
			cout << "The first dayof this month is thursday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 6: nextSunday += 2;
			cout << "The first day of this month is friday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;
		case 7: nextSunday += 1;
			cout << "The first day of this month is saturday " << endl;
			while (nextSunday < 30)
			{
				cout << "Next Sunday of this month is on " << nextSunday << endl;
				nextSunday += 7;
			}
			break;

		}
		
}

	
	

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	int number;
	cin >> number;
	for (int i = 0; i <=number; i++)
	{
		for (int j = 0; j <= number; j++)
		{
			if
				(
					i == 0 || i == number ||
					i == number/2|| j == number/2||
					j == 0 || j == number ||
					i == j || j == (number - i + 0)
					)
				cout <<" "<< "*";
			else
				cout << "  ";
			int h = (number - i + 1);
		}
	
			cout << "\n";
	}
		


		
	


}

	
	

	
	

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	for (int i = 0; i < 8; i++)
	{
		for (int k = 0; k <= i; k++)
		{
			cout << "  ";
		}
		for (int j = i; j < 8; j++)
		{
			cout <<" "<< static_cast<char>(j+97-i);

		}
		for (int j = 7; j >= i; j--)
		{
			cout << " " << static_cast<char>(j + 97 - i);
		}
			cout << "\n";
	}
		

}

	
	

	
	

#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	
	cout << " ##############";
	cout << endl;
	for (int  i = 0; i <=5; i++)
	{
		
		for (int j = 0;  j < 1;  j++)
		{
			cout << " " << "#";
		}
		for (int j = 1;  j <= i;  j++)
		{
                cout << " ";
		}
		for (int j = 0; j <1; j++)
		{
			cout << "#";
		}
		for (int j = i; j < 5; j++)
		{
			cout << " ";
		}
		for (int j = i; j < 5; j++)
		{
			cout << " ";

		}
		for (int j = 0; j <1 ; j++)
		{
			cout << "#";
		}
		for (int j = 0; j < i; j++)
		{
			cout << " ";
		}
		for (int i = 0; i < 1; i++)
		{
			cout << "#";
		}
		cout << endl;
	}

	for (int i = 0; i <=5; i++)
	{
		for (int j = 0; j < 1; j++)
		{
			cout << " " << "#";
		}
		for (int j = 5; j >i; j--)
		{
			cout << " ";
		}
		for (int j = 0;  j< 1; j++)
		{
			cout << "#";
		}
		for (int j = 0; j < i; j++)
		{
			cout << " ";
		}
		for (int j = 0; j < i; j++)
		{
			cout << " ";
		}
		for (int j = 0; j < 1; j++)
		{
			cout << "#";
		}
		for (int j = 5; j > i ; j--)
		{
			cout << " ";
		}
		for (int i = 0; i < 1; i++)
		{
			cout << "#";
		}
		cout << endl;
		
	}
	cout << " ##############";
	cout << endl;


}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{



    int rows;
    cin >> rows;

    for (int i = 1; i <= rows; i++)
    {
        for (int k = 1; k <= (rows -i); k++)
        {
            cout << "   ";
           
        }
        for (int d = i; d > 1; d--)
            {
            cout << d << "  ";
                
            }
        for (int  v = 1; v <= i; v++)
        {
            cout << v<<"  ";
        }
        cout << endl;

        
    }


}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	int firstLetter = 65;
	int count = 0;

	for (int i = 65; i <= 90; i++)
	{
		count++;
		if (count%5 == 0)
			cout << setw(3) << static_cast<char>(i) << endl;
		else
			cout << setw(3) << static_cast<char>(i);

		
		
	}

	
	
		

	
	
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{

	cout << "Enter two positive numbers ";
	int n1,n2;
	cin >> n1>>n2;
	int d = 1;
	int gcd = 1;
	
	if (n1 < n2)
		d = n1;
	else
		d = n2;
	while (true)
	{
		if (n1 % d == 0 && n2 % d == 0) {
				gcd = d;
				break;
		}
			
		d--;
	}
	
	cout << "the CGD of " << n1 << " and " << n2 << " is " << gcd;

	
	
		

	
	
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	
	int n = 1;
	int largest = 0;
	while (n*n<30000)
	{
		if (n > largest)
		{
			largest = n;
		}
		n++;
	}
	cout << "the largest number is " << largest;
	
	
		

	
	
}
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	
	int count = 0;
	
	// iterate from 0 to N 
	for (int num = 300,count = 0; num <=400; num++)
	{
		// Short-circuit operator is used  
		if (num % 3 == 0 || num % 6 == 0)
		{
			cout << setw(5) << num;
			count++;
			if (count % 5 == 0)
				cout << setw(5) << num << endl;
		
		}
		
		
			
	}
		

	
	
}
#include <iostream>  
using namespace std;  
int main() 
{  
  int n1=0,n2=1,n3,i,number;    
 cout<<"Enter the number of elements: ";    
 cin>>number;    
 cout<<n1<<" "<<n2<<" "; //printing 0 and 1    
 for(i=2;i<number;++i) //loop starts from 2 because 0 and 1 are already printed    
 {    
  n3=n1+n2;    
  cout<<n3<<" ";    
  n1=n2;    
  n2=n3;    
 }    
   return 0;  
}  
#include<iostream>
using namespace std;

int main()
{
  cout<<"Enter the integers: "<
}
include <FirebaseArduino.h>

#define FIREBASE_HOST "example.firebaseio.com"
#define FIREBASE_AUTH "token_or_secret"


void setup() {
  Serial.begin(9600);
  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

int n = 0;

void loop() {

  // set value
  Firebase.setFloat("number", 42.0);
  // handle error
  if (Firebase.failed()) {
      Serial.print("setting /number failed:");
      Serial.println(Firebase.error());  
      return;
  }
  delay(1000);
  
  // update value
  Firebase.setFloat("number", 43.0);
  // handle error
  if (Firebase.failed()) {
      Serial.print("setting /number failed:");
      Serial.println(Firebase.error());  
      return;
  }
  delay(1000);

  // get value 
  Serial.print("number: ");
  Serial.println(Firebase.getFloat("number"));
  delay(1000);

  // remove value
  Firebase.remove("number");
  delay(1000);

  // set string value
  Firebase.setString("message", "hello world");
  // handle error
  if (Firebase.failed()) {
      Serial.print("setting /message failed:");
      Serial.println(Firebase.error());  
      return;
  }
  delay(1000);
  
  // set bool value
  Firebase.setBool("truth", false);
  // handle error
  if (Firebase.failed()) {
      Serial.print("setting /truth failed:");
      Serial.println(Firebase.error());  
      return;
  }
  delay(1000);

  // append a new value to /logs
  String name = Firebase.pushInt("logs", n++);
  // handle error
  if (Firebase.failed()) {
      Serial.print("pushing /logs failed:");
      Serial.println(Firebase.error());  
      return;
  }
  Serial.print("pushed: /logs/");
  Serial.println(name);
  delay(1000);
}
  
#include <ESP8266WiFi.h>


// Set these to run example.
#define WIFI_SSID "SSID"
#define WIFI_PASSWORD "PASSWORD"

  // connect to wifi.
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("connecting");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println();
  Serial.print("connected: ");
  Serial.println(WiFi.localIP());
#include <stdio.h>
 
class Node
{
public:
    Node( int v )
    {
        data = v;
        left = 0;
        right = 0;
    }
 
    int data;
    Node* left;
    Node* right;
};
 
void Add( Node** root, Node* n )
{
    if ( !*root  )
    {
        *root = n;
        return;
    }
 
    if ( (*root)->data < n->data )
    {
        Add( &(*root)->right, n );
    }
    else
    {
        Add( &(*root)->left, n );
    }
}
 
void Print( Node* node )
{
    if ( !node )  return;   
    Print( node->left );
    printf( "value = %i\n", node->data );
    Print( node->right );
}
 
int main()
{
    Node* root = 0;
 
    Add( &root, new Node( 1 ) );
    Add( &root, new Node( 2 ) );
    Add( &root, new Node( -1 ) );
    Add( &root, new Node( 12 ) );
 
    Print( root );
    return 0;
}
int maxSubArraySum(int a[], int size) 
{ 
int max_so_far = 0, max_ending_here = 0; 
for (int i = 0; i < size; i++) 
{ 
	max_ending_here = max_ending_here + a[i]; 
	if (max_ending_here < 0) 
		max_ending_here = 0; 

	/* Do not compare for all elements. Compare only 
		when max_ending_here > 0 */
	else if (max_so_far < max_ending_here) 
		max_so_far = max_ending_here; 
} 
return max_so_far; 
} 
#include<iostream>                //including input/output libarary
using namespace std;
int main(){                               //starting main function
int array_name[5];                   //defining a variable array of type integer with name "array_name" and size 5.
array_name[0]=2;                   //assigning value of 2 to  first element of array "array_name"
array_name[1]=3;                   
array_name[2]=4                      // assinging values to other elements of array using their index number
array_name[3]=12;
array_name[4]=33;

return 0;
}
> More steps
// Define macros for inlining x86 assembly in a compiler-independent way
#ifdef _MSC_VER
	#define ASM1(asm_literal) \
		__asm asm_literal
	#define ASM2(asm_literal1, asm_literal2) \
		__asm asm_literal1, asm_literal2
	#define ASM3(asm_literal1, asm_literal2, asm_literal3) \
		__asm asm_literal1, asm_literal2, asm_literal3

	#define ASM_MOV_REG_VAR(register, variable) \
		ASM(mov register, variable)

	#define ASM_MOV_VAR_REG(variable, register) \
		ASM(mov variable, register)

#elif __GNUC__ || __clang__
	#define ASM1(asm_literal) \
		ASM_GCC(#asm_literal)
	#define ASM2(asm_literal1, asm_literal2) \
		ASM_GCC(#asm_literal1 ", " #asm_literal2)
	#define ASM3(asm_literal1, asm_literal2, asm_literal3) \
		ASM_GCC(#asm_literal1 ", " #asm_literal2 ", " #asm_literal3)
	
	#ifdef __x86_64__
		#define ASM_MOV_REG_VAR(register, variable) \
			__asm__ __volatile__("movq %0, %%" EXPAND_AND_QUOTE(register)  : /* no outputs */ : "m"(variable) : )

		#define ASM_MOV_VAR_REG(variable, register) \
			__asm__ __volatile__("movq %%" EXPAND_AND_QUOTE(register) ", %0"  : "=m"(variable) : /* no inputs */ : )
	#else
		#define ASM_MOV_REG_VAR(register, variable) \
			__asm__ __volatile__("mov %0, %%" EXPAND_AND_QUOTE(register)  : /* no outputs */ : "m"(variable) : )

		#define ASM_MOV_VAR_REG(variable, register) \
			__asm__ __volatile__("mov %%" EXPAND_AND_QUOTE(register) ", %0"  : "=m"(variable) : /* no inputs */ : )
	#endif

	#define ASM_GCC(asm_string) \
		__asm__ __volatile__(".intel_syntax noprefix;" asm_string ";.att_syntax prefix"); \
	
#endif
bookmark
dashboard

Thu Jan 21 2021 20:17:57 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Wed Jan 20 2021 22:02:30 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sat Jan 09 2021 02:24:44 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Fri Jan 08 2021 09:33:32 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Thu Jan 07 2021 06:42:04 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Wed Jan 06 2021 21:53:09 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sat Jan 02 2021 17:54:04 GMT+0000 (UTC)

#c++
bookmark
dashboard

Tue Dec 29 2020 11:21:13 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Mon Dec 28 2020 03:44:59 GMT+0000 (UTC)

#c++
bookmark
dashboard

Sun Dec 20 2020 11:27:54 GMT+0000 (UTC) https://stackoverflow.com/questions/29995863/how-to-add-custom-code-snippets-in-vscode

#c++
bookmark
dashboard

Fri Dec 18 2020 02:16:44 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Fri Dec 11 2020 20:09:09 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Wed Dec 09 2020 03:00:16 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Thu Nov 26 2020 14:13:55 GMT+0000 (UTC)

#c++
bookmark
dashboard

Wed Nov 25 2020 01:54:07 GMT+0000 (UTC)

#c++
bookmark
dashboard

Sun Nov 15 2020 20:41:49 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sun Nov 15 2020 04:08:15 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sun Nov 15 2020 02:54:42 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Fri Nov 13 2020 03:52:42 GMT+0000 (UTC)

#c++
bookmark
dashboard

Thu Nov 12 2020 14:28:30 GMT+0000 (UTC)

#c++
bookmark
dashboard

Tue Nov 10 2020 22:42:18 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Tue Nov 10 2020 16:12:46 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Mon Nov 09 2020 07:53:26 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Mon Nov 09 2020 01:01:29 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sun Nov 08 2020 23:35:48 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sat Nov 07 2020 03:20:33 GMT+0000 (UTC) https://www.geeksforgeeks.org/lambda-expression-in-c/

#c++
bookmark
dashboard

Fri Nov 06 2020 17:32:33 GMT+0000 (UTC)

#c++
bookmark
dashboard

Fri Nov 06 2020 15:00:33 GMT+0000 (UTC)

#c++
bookmark
dashboard

Fri Nov 06 2020 14:49:48 GMT+0000 (UTC)

#c++
bookmark
dashboard

Fri Nov 06 2020 03:45:15 GMT+0000 (UTC)

#c++
bookmark
dashboard

Thu Nov 05 2020 20:47:39 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Tue Oct 27 2020 02:55:57 GMT+0000 (UTC) https://zerojudge.tw/ShowProblem?problemid

#c++
bookmark
dashboard

Sun Oct 25 2020 03:45:41 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sat Oct 24 2020 17:58:24 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Sat Oct 24 2020 11:35:47 GMT+0000 (UTC) http://cpp.sh/

#c++
bookmark
dashboard

Wed Oct 21 2020 08:25:33 GMT+0000 (UTC) https://www.javatpoint.com/fibonacci-series-in-cpp

#c++ #fibonacci
bookmark
dashboard

Wed Oct 21 2020 07:59:21 GMT+0000 (UTC)

#c++
bookmark
dashboard

Wed Oct 14 2020 22:19:09 GMT+0000 (UTC)

#c++
bookmark
dashboard

Wed Oct 14 2020 18:44:50 GMT+0000 (UTC)

#c++
bookmark
dashboard

Fri Sep 11 2020 14:28:11 GMT+0000 (UTC) https://www.technical-recipes.com/2011/simple-binary-tree-implementation/

#c++
bookmark
dashboard

Thu Jul 16 2020 13:01:21 GMT+0000 (UTC) https://github.com/an-tao/drogon

#c++ #web #rest
bookmark
dashboard

Wed Dec 25 2019 10:57:06 GMT+0000 (UTC) https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/

#c++ #algorithms #interviewquestions #arrays
bookmark
dashboard

,

#c++

.

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension