Say "Hello, World!" With Python

  • + 0 comments

    import java.util.*; public class Solution{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Box[] model=new Box[n];

        for(int i=0;i<n;i++) {
      model[i]=new Box(sc.nextInt(), sc.nextLine()+sc.nextLine(), sc.nextDouble());
        }
    
       int arg= sc.nextInt();
    
        if(findAverageQuantityOfBox(model)==0)
         System.out.println("No Box found with the mentioned attribute");
        else
         System.out.println("Average quantity:"+findAverageQuantityOfBox(model));
    
        if(searchBoxById(model,arg)==null)
         System.out.println("No Box found with the mentioned attribute");
        else {
           System.out.println(searchBoxById(model,arg));
        }
    
    
    
    }
    

    //1st public static double findAverageQuantityOfBox(Box[] arr){ double avg=0; int count=0; for(Box b:arr) { avg+=b.getQuantity(); count++; } if(count==0) return 0; return avg/count; }//end 1st

    //2nd
    public static Box searchBoxById(Box[] arr,int id){
     Box res=null;
    for(Box b:arr) {
     if(b.getId()==id)
      res=b;
    }
      return res;
    }//end 2nd
    

    }//end solution class

    class Box{ private int id; private String name;
    private double quantity; public Box() { } public Box(int id, String name, double quantity) { super(); this.id = id; this.name = name; this.quantity = quantity; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getQuantity() { return quantity; } public void setQuantity(double quantity) { this.quantity = quantity; } @Override public String toString() { return "id-" + id + "\nname-" + name + "\nquantity-" + quantity; }

    }

    /////////end/////////////////////////////////////////////////////////////////////////////////////

    ////////////////customer code////////////////////////////////////////////////

    import java.util.*; public class Solution{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Customer[] cst=new Customer[n];

        for(int i=0;i<n;i++) {
         int customerId=sc.nextInt();
         sc.nextLine();
             String customerName=sc.nextLine();  
             int age=sc.nextInt();
             sc.nextLine();
             String city=sc.nextLine(); 
          cst[i]=new Customer(customerId, customerName, age, city);
    
        }
    
       String arg= sc.nextLine();
    
        if(findAverageAgeOfCustomer(cst)==0)
         System.out.println("No such customer found");
        else
         System.out.println(findAverageAgeOfCustomer(cst));
    
        if(searchCustomerByCity(cst,arg)==null)
         System.out.println("No such customer found");
        else {
           System.out.println(searchCustomerByCity(cst,arg));
        }
    
    
    
    }
    
    
    public static double findAverageAgeOfCustomer(Customer[] arr){
     double avg=0;
     int count=0;
     for(Customer c:arr) {
      avg+=c.getAge();
      count++;
     }
     if (count==0)
      return 0;
        return avg/count;
    }
    
    
    
    
    public static Customer searchCustomerByCity(Customer[] arr,String city){
     Customer res=null;
    for(Customer c:arr) {
     if(c.getCity().equalsIgnoreCase(city))
      res=c;
    }
      return res;
    }
    

    }

    class Customer{ private int customerId; private String customerName;
    private int age; private String city;

    public Customer() { }

    public Customer(int customerId, String customerName, int age, String city) { super(); this.customerId = customerId; this.customerName = customerName; this.age = age; this.city = city; }

    public int getCustomerId() { return customerId; }

    public void setCustomerId(int customerId) { this.customerId = customerId; }

    public String getCustomerName() { return customerName; }

    public void setCustomerName(String customerName) { this.customerName = customerName; }

    public int getAge() { return age; }

    public void setAge(int age) { this.age = age; }

    public String getCity() { return city; }

    public void setCity(String city) { this.city = city; }

    @Override public String toString() { return customerId + "\n"+customerName + "\n"+ age + "\n" + city; }

    }

    //////////////////////////////end/////////////////////////////////////////////////////////////////////

    ///////////////student via list///////////////////////////////////////////////////////////////////////// import java.util.*;

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

        int n = sc.nextInt();
    
        List<Student> list = new ArrayList<>();
    
        for(int i = 1; i <= n; i++)
        {
            int id = sc.nextInt();
            sc.nextLine();
            String name = sc.nextLine();
            double marks = sc.nextDouble();
            int age = sc.nextInt();
    
            list.add(new Student(id, name, marks, age));
        }
    
        double marks = sc.nextDouble();
    
        Student s1 = searchStudentByMarks(list, marks);
    
        if(s1 == null)
            System.out.println("No Student found with mentioned marks.");
        else
            System.out.println("id-"+s1.getId()+"\nname-"+s1.getName()+"\nmarks-"+s1.getMarks()+"\nage-"+s1.getAge());
    
        Student s2 = findStudentWithMaximumAge(list);
    
        if(s2 == null)
            System.out.println("No Student found.");
        else
            System.out.println("id-"+s2.getId()+"\nname-"+s2.getName()+"\nmarks-"+s2.getMarks()+"\nage-"+s2.getAge());
    }
    
    public static Student searchStudentByMarks(List<Student> s,double marks){
    
        for (Student student : s) {
            if(student.getMarks() == marks)
                return student;
        }
    
        return null;
    }
    
    public static Student findStudentWithMaximumAge(List<Student> s){
        if(s.size() == 0)
            return null;
    
        Collections.sort(s, new StudentComp());
    
        return s.get(0);
    }
    

    }

    class StudentComp implements Comparator { public int compare(Student s1, Student s2) { return s2.getAge() - s1.getAge(); } }

    class Student { private int id; private String name; private double marks; private int age;

    public Student(int id, String name, double marks, int age)
    {
        this.id = id;
        this.name = name;
        this.marks = marks;
        this.age = age;
    }
    
    public double getMarks()
    {
        return marks;
    }
    
    public int getAge()
    {
        return age;
    }
    
    public int getId()
    {
        return id;
    }
    
    public String getName()
    {
        return name;
    }
    

    }

    //////////////////////////////////end////////////////////////////////////

    /////////////////////doctor code//////////////////////////////////////////////////////////////

    import java.util.*;

    public class IRASolution {

    public static void main(String[] args) {
    
        Doctor[] m = new Doctor[4];
        Scanner sc = new Scanner(System.in);
        int n= sc.nextInt();sc.nextLine();
        for (int i = 0; i < n; i++) {
            int id = sc.nextInt();sc.nextLine();
            String name = sc.nextLine();
            double salary = sc.nextDouble();sc.nextLine();
            int age = sc.nextInt();sc.nextLine();
            m[i] = new Doctor(id, name, salary, age);
        }
        String name = sc.nextLine();
            Doctor m1 = findMaximumAgeOfDoctor(m);
            if (m1 == null) {
                System.out.println("No Doctor found with mentioned attribute.");
            } else {
                System.out.println(m1.toString());
            }
    
        Doctor m2 = serachDoctorByName(m, name);
    
        if (m2 == null) {
            System.out.println("No Doctor found with mentioned attribute.");
        } else {
            System.out.println(m2.toString());
        }
    }
    
    
    public static Doctor findMaximumAgeOfDoctor(Doctor[] m) {
        if(m.length == 0)
            return null;
        int max = m[0].getAge();
        for (int i = 0; i < m.length; i++) {
            if (m[i].getAge() > max)
                max = m[i].getAge();
        }
        for (int i = 0; i < m.length; i++) {
            if (m[i].getAge() == max)
                return m[i];
        }
        return null;
    }
    
    
    public static Doctor serachDoctorByName(Doctor[] m, String name) {
        for (int i = 0; i < m.length; i++) {
    
            if (m[i].getName().equalsIgnoreCase(name))
                return m[i];
        }
        return null;
    }
    

    }

    class Doctor {

    private int id;
    private String name;
    private double salary;
    private int age;
    
    public Doctor() {
    
    }
    
    public Doctor(int id, String name, double salary, int age) {
        super();
        this.id = id;
        this.name = name;
        this.salary = salary;
        this.age = age;
    }
    
    public int getId() {
        return id;
    }
    
    public void setId(int id) {
        this.id = id;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public double getSalary() {
        return salary;
    }
    
    public void setSalary(double salary) {
        this.salary = salary;
    }
    
    public int getAge() {
        return age;
    }
    
    public void setAge(int age) {
        this.age = age;
    }
    
    @Override
    public String toString() {
        return "id-" + id + "\nname-" + name + "\nsalary-" + salary
                + "\nage-" + age ;
    }
    

    }

    ///////////////////////////end/////////////////////////////////////////////////

    //////////////course code/////////////////////////////////////////

    public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Course[] m = new Course[n]; for (int i = 0; i < n; i++) { int id = sc.nextInt(); sc.nextLine(); String name = sc.nextLine(); String admin = sc.nextLine(); int quiz = sc.nextInt(); sc.nextLine(); int hadson = sc.nextInt(); sc.nextLine(); m[i] = new Course(id,name,admin,quiz,hadson); }

        int id = sc.nextInt();
    
        Course m1 = findCourseWithMaximumHandson(m);
        if (m1 == null) {
            System.out.println("No Course found with mentioned attribute.");
        } else{
        System.out.println("name-" + m1.getName());
        System.out.println("admin-" + m1.getAdmin());
        System.out.println("handson-" + m1.getHandson());
        }
    
    
        Course s1 = searchCourseById(m, id);
        if (s1 == null) {
            System.out.println("No Course found with mentioned attribute.");
        } else {
            System.out.println("name-" + s1.getName());
            System.out.println("admin-" + s1.getAdmin());
            }
    
    
    }
    
    public static Course findCourseWithMaximumHandson(Course[] m) {
        double max = m[0].getHandson();
        for (int i = 0; i < m.length; i++) {
            if (m[i].getHandson() > max)
                max = m[i].getHandson();
        }
        for (int i = 0; i < m.length; i++) {
            if (m[i].getHandson() == max)
                return m[i];
        }
        return null; 
    }
    
    public static Course searchCourseById(Course[] arr, int id) {
        Course res = null;
        for (Course b : arr) {
            if (b.getId() == id)
                res = b;
        }
        return res;
    }
    

    }

    class Course { private int id; private String name; private String admin; private int quiz; private int handson;

    public Course() {
    }
    
    public Course(int id, String name, String admin, int quiz, int handson) {
        super();
        this.id = id;
        this.name = name;
        this.admin = admin;
        this.quiz = quiz;
        this.handson = handson;
    }
    
    public int getId() {
        return id;
    }
    
    public void setId(int id) {
        this.id = id;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public String getAdmin() {
        return admin;
    }
    
    public void setAdmin(String admin) {
        this.admin = admin;
    }
    
    public int getQuiz() {
        return quiz;
    }
    
    public void setQuiz(int quiz) {
        this.quiz = quiz;
    }
    
    public int getHandson() {
        return handson;
    }
    
    public void setHandson(int handson) {
        this.handson = handson;
    }
    

    }

    //////////////////////////the end//////////////////////////////////////

    /////////////////////player code//////////////////////////////////// import java.util.*;

    public class Solution2 {

    public static void main(String[] args) {
        Player[] m = new Player[4];
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        for (int i = 0; i < n; i++) {
            int id = sc.nextInt();sc.nextLine();
            int matchesPlayed = sc.nextInt();sc.nextLine();
            int totalRuns = sc.nextInt();sc.nextLine();
            String name = sc.nextLine();
            String team = sc.nextLine();
            m[i] = new Player(id, matchesPlayed,totalRuns, name, team);
        }
        int id = sc.nextInt();
    
        Player m1 = findPlayerWithMinimumMatchesPlayed(m);
        if (m1 == null) {
            System.out.println("No Player found with mentioned attribute");
        } else{
        System.out.println("id-" + m1.getId());
        System.out.println("matchesPlayed-" + m1.getMatchesPlayed());
        System.out.println("totalRuns-" + m1.getTotalRuns());
        System.out.println("name-" + m1.getName());
        System.out.println("team-" + m1.getTeam());
        }
    
    
        Player s1 = searchById(m, id);
    
        if (s1 == null) {
            System.out.println("No Player found with mentioned attribute");
        } else {
            System.out.println("id-" + s1.getId());
            System.out.println("matchesPlayed-" + s1.getMatchesPlayed());
            System.out.println("totalRuns-" + s1.getTotalRuns());
            System.out.println("name-" + s1.getName());
            System.out.println("team-" + s1.getTeam());
        }
    }
    
    private static Player findPlayerWithMinimumMatchesPlayed(Player[] m) {
        int min = m[0].getMatchesPlayed();
        for (int i = 0; i < m.length; i++) {
            if (m[i].getMatchesPlayed() < min)
                min = m[i].getMatchesPlayed();
        }
        for (int i = 0; i < m.length; i++) {
            if (m[i].getMatchesPlayed() == min)
                return m[i];
        }
        return null;
    }
    
    private static Player searchById(Player[] m, int id) {
        for (int i = 0; i < m.length; i++) {
            if (m[i].getId() == id) {
                return m[i];
            }
        }
        return null;
    }
    

    }

    class Player {

    private int id;
    private int matchesPlayed;
    private int totalRuns;
    private String name;
    private String team;
    public Player(int id, int matchesPlayed, int totalRuns, String name,
            String team) {
        super();
        this.id = id;
        this.matchesPlayed = matchesPlayed;
        this.totalRuns = totalRuns;
        this.name = name;
        this.team = team;
    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public int getMatchesPlayed() {
        return matchesPlayed;
    }
    public void setMatchesPlayed(int matchesPlayed) {
        this.matchesPlayed = matchesPlayed;
    }
    public int getTotalRuns() {
        return totalRuns;
    }
    public void setTotalRuns(int totalRuns) {
        this.totalRuns = totalRuns;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getTeam() {
        return team;
    }
    public void setTeam(String team) {
        this.team = team;
    }
    

    }

    ////////////////////////the end///////////////////////////////////////////////////////////////////////////////////////

    ////////////////////college//////////////////////////////////

    import java.util.*; class College { private int id,cNo,pcode; private String name,addr; public College(int id, int cNo, int pcode, String name, String addr) { super(); this.id = id; this.cNo = cNo; this.pcode = pcode; this.name = name; this.addr = addr; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getContactNo() { return cNo; } public void setContactNo(int cNo) { this.cNo = cNo; } public int getPincode() { return pcode; } public void setPincode(int pcode) { this.pcode = pcode; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return addr; } public void setAddress(String addr) { this.addr = addr; } } public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt();

        College college[] = new College[n];
    
        for(int i=0; i<college.length; i++)
        {
            int id = sc.nextInt();
            sc.nextLine();
            String name = sc.nextLine();
            int contactNo= sc.nextInt();
            sc.nextLine();
            String address = sc.nextLine();
            int pincode = sc.nextInt();
    
            college[i] = new College(id, contactNo,  pincode,  name,  address);  
        }
        sc.nextLine();
        String searchaddress = sc.nextLine();
    
        College res1 = findCollegeWithMaximumPincode(college);
    

    if(res1!=null) { System.out.println("id-"+res1.getId());

    System.out.println("name-"+res1.getName()); System.out.println("contactNo-"+res1.getContactNo()); System.out.println("address-"+res1.getAddress()); System.out.println("pincode-"+res1.getPincode()); } else { System.out.println("No College found with mentioned attribute"); }

    College res2 =searchCollegeByAddress(college,searchaddress); if(res2!=null) { System.out.println("id-"+res2.getId());

    System.out.println("name-"+res2.getName()); System.out.println("contactNo-"+res2.getContactNo()); System.out.println("address-"+res2.getAddress()); System.out.println("pincode-"+res2.getPincode()); } else { System.out.println("No College found with mentioned attribute."); }

    } public static College findCollegeWithMaximumPincode(College col[]) { int max=0; College result =null; for(int i=0; i max){ result = col[i]; max= col[i].getPincode(); }
    }

    if(result!=null) return result; else return null; }

    public static College searchCollegeByAddress(College c[],String address) { College ans=null; for(int i=0;i

    } } if(ans!=null) return ans; else return null; } }

    //////////////THE END////////////////////////////

    ////////////////lawyer////////////////////////////

    import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;

    public class Solution {

    public static void main(String[] args)
    {
    
    
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
    
        Lawyer[] lawyers = new Lawyer[n];
        for(int i=0;i<lawyers.length;i++){
          int id = sc.nextInt();
                sc.nextLine();
                String name = sc.nextLine();
                double salary = sc.nextDouble();
                int age = sc.nextInt();
                sc.nextLine();
            lawyers[i] = new Lawyer(id, name, salary, age);
        }
        double avg = findAverageAgeOfLawyer(lawyers);
        if(avg > 0){
            System.out.println("Average of age "+ avg);
        }else{
            System.out.println("No Lawyer found with mentioned attribute.");
        }
        String nm = sc.nextLine();
        Lawyer lw = searchLawyerByName(lawyers, nm);
        if(lw==null){
            System.out.println("No Lawyer found with mentioned attribute.");
        }else{
            System.out.println("id-"+ lw.getId());
            System.out.println("name-"+ lw.getName());
            System.out.println("salary-"+ lw.getSalary());
            System.out.println("age-"+ lw.getAge());
        }
    }
    
    public static double findAverageAgeOfLawyer(Lawyer[] d)
    {
        int count = 0;
        double tot = 0, avg=0;
    
        for(int i=0;i<d.length;i++)
        {
            tot = tot + d[i].getAge();
            count++;
        }
        avg = tot/count;
        if(count == 0)
        {
            return 0;
        }
        else
        {
            return avg;
        }
    
    }
    public static Lawyer searchLawyerByName(Lawyer[] d, String name) 
    {
        for(Lawyer l : d){
            if(l.getName().equalsIgnoreCase(name)){
                return l;
            }
        }
        return null;
    
    }
    

    } class Lawyer {

    private int id;
    private String name;
    private double salary;
    private int age;
    
    
    public int getId()
    {
        return id;
    }
    public String getName()
    {
        return name;
    }
    public double getSalary()
    {
        return salary;
    }
    public int getAge()
    {
        return age;
    }
    public void setId(int id)
    {
        this.id = id;
    }
    public void setName(String name)
    {
        this.name = name;
    }
    public void setSalary(double salary)
    {
        this.salary = salary;
    }
    public void setAge(int age)
    {
        this.age = age;
    }
    
    
    Lawyer(int id, String name, double salary, int age){
        this.id = id;
        this.name = name;
        this.salary = salary;
        this.age = age;
    }
    

    }

    //////////THE END/////////////////////////

    /////////sanitizer///////////////////////

    import java.util.Scanner;

    public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Sanitizer[] m = new Sanitizer[n]; for (int i = 0; i < n; i++) { int id = sc.nextInt(); sc.nextLine();

            String name = sc.nextLine();
            int stock = sc.nextInt(); sc.nextLine();
    
            int price = sc.nextInt();
            sc.nextLine();
            m[i] = new Sanitizer(id,name,stock,price);
        }
    
        double id = sc.nextDouble();
    
        int m1 = findTotalSanitizerStock(m);
        if (m1 == 0) {
            System.out.println("No Sanitizer found with mentioned attribute.");
        } else{
            System.out.println("Total Stock:"+ m1);
    
        }
    
    
        Sanitizer s1 = searchSanitizerByRackId(m, id);
        if (s1 == null) {
            System.out.println("No Sanitizer found with mentioned attribute.");
        } else {
            System.out.println("rackId-" + s1.getRackId());
            System.out.println("name-" + s1.getName());
            System.out.println("availableStock-" + s1.getAvailableStock());
            System.out.println("price-" + s1.getPrice());
            }
    
    
    }
    
    public static int findTotalSanitizerStock(Sanitizer[] m) {
        int max = 0;
        for (int i = 0; i < m.length; i++) {
            max = max + m[i].getAvailableStock();
        }
    
        return max; 
    }
    
    public static Sanitizer searchSanitizerByRackId(Sanitizer[] arr, double id) {
        Sanitizer res = null;
        for (Sanitizer b : arr) {
            if (b.getRackId()== id)
                res = b;
        }
        return res;
    }
    

    }

    class Sanitizer { private int rackId; private String name; private int availableStock; private int price;

    public Sanitizer() {
    }
    
    
    public Sanitizer(int rackId, String name, int availableStock, int price) {
        super();
        this.rackId = rackId;
        this.name = name;
        this.availableStock = availableStock;
        this.price = price;
    }
    
    
    public int getRackId() {
        return rackId;
    }
    
    
    public void setRackId(int rackId) {
        this.rackId = rackId;
    }
    
    
    public String getName() {
        return name;
    }
    
    
    public void setName(String name) {
        this.name = name;
    }
    
    
    public int getAvailableStock() {
        return availableStock;
    }
    
    
    public void setAvailableStock(int availableStock) {
        this.availableStock = availableStock;
    }
    
    
    public int getPrice() {
        return price;
    }
    
    
    public void setPrice(int price) {
        this.price = price;
    }
    

    }

    ///////////////THE END//////////////////

    /////////STUDENT CODE///////////////////

    import java.util.*;

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

        int n = sc.nextInt();
    
        List<Student> list = new ArrayList<>();
    
        for(int i = 1; i <= n; i++)
        {
            int id = sc.nextInt();
            sc.nextLine();
            String name = sc.nextLine();
            double marks = sc.nextDouble();
            int age = sc.nextInt();
    
            list.add(new Student(id, name, marks, age));
        }
    
        double marks = sc.nextDouble();
    
        Student s1 = searchStudentByMarks(list, marks);
    
        if(s1 == null)
            System.out.println("No Student found with mentioned marks.");
        else
            System.out.println("id-"+s1.getId()+"\nname-"+s1.getName()+"\nmarks-"+s1.getMarks()+"\nage-"+s1.getAge());
    
        Student s2 = findStudentWithMaximumAge(list);
    
        if(s2 == null)
            System.out.println("No Student found.");
        else
            System.out.println("id-"+s2.getId()+"\nname-"+s2.getName()+"\nmarks-"+s2.getMarks()+"\nage-"+s2.getAge());
    }
    
    public static Student searchStudentByMarks(List<Student> s,double marks){
    
        for (Student student : s) {
            if(student.getMarks() == marks)
                return student;
        }
    
        return null;
    }
    
    public static Student findStudentWithMaximumAge(List<Student> s){
        if(s.size() == 0)
            return null;
    
        Collections.sort(s, new StudentComp());
    
        return s.get(0);
    }
    

    }

    class StudentComp implements Comparator { public int compare(Student s1, Student s2) { return s2.getAge() - s1.getAge(); } }

    class Student { private int id; private String name; private double marks; private int age;

    public Student(int id, String name, double marks, int age)
    {
        this.id = id;
        this.name = name;
        this.marks = marks;
        this.age = age;
    }
    
    public double getMarks()
    {
        return marks;
    }
    
    public int getAge()
    {
        return age;
    }
    
    public int getId()
    {
        return id;
    }
    
    public String getName()
    {
        return name;
    }
    

    }

    ////////////////THE END////////////////////////

    /////////////VEHICLE CODE//////////////

    import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*; import java.util.Scanner; class Vehicle { int number; String name; double price; public Vehicle(int number,String name,double price) { super(); this.number=number; this.name=name; this.price=price; } public int getNumber() { return number; } public void setNumber(int number) { this.number=number; } public String getName() { return name; } public void setName(String name) { this.name=name; } public double getPrice() { return price; } public void setPrice(double price) { this.price=price; } } public class Solution { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine(); Vehicle[] v=new Vehicle[n]; for(int i=0;i

    ////////////////////////THE END ////////////////////

    ////////////////unix fruits///////////

    awk 'BEGIN{FS=",";c=o;IGNORECASe=1;} { if($3>100){ c++; } }END{ print("Total count: "c) }'

    ////////////////the end//////////////

    /////////////month////////////////

    awk 'BEGIN{IGNORECASE=1;c=0;} { if (index(0,"Month") || index($0,"MONTH") ){ c=c+1 } }END{ if(c==0){ print("File does not contain the pattern.") } else{ print("Number of lines found =",c) } }'

    ///////////////the end///////////////////////

    ///////////total////////////////

    awk 'BEGIN{FS="-";count=0;} { if(3+Extra open brace or missing close brace0 } } END{ if(count == 0) { print "Total: 0" } else { print "Total: " count } }'

    ///////////the end//////////////////

    ////////avg price/////////////////

    awk 'BEGIN{FS="-";count=0;c=0;avg=0} { if(NR>1){ avg=S3/$1; } }END{ if(avg>0) {print "2000";} else { print "Price Not Available" } } '

    ///////////////end////////////////////

    ///////////////////sem code////////////////

    awk 'BEGIN{FS="|"; IGNORECASE=1; c=0} (NR>1){ if( Misplaced &4 != "2nd Sem"){ c=c+1; }

    }END{ if(c==0){ print c; }else{ print c; } }'

    ///////////////////the end////////////

    //////////price avg code 2///////////

    awk 'BEGIN{FS=" ";IGNORECASE=1;avg=0;c=0} (NR>1){ if(Extra open brace or missing close brace3; c++; } }END{ if(avg==0){ print("Price Not Available") } else{ print(avg/c) } }'

    /////////end//////////////////

    //////////records////////// awk{'BEGIN{FS="|"; IGNORECASE=1;c=0;} { if (NR>1){ print(3) c=c+1 } } END{ if(c==0){ print ("No records found") }'

    ////////////tottal count/////////////

    awk 'BEGIN{FS="#";IGNORECASE=1;c=0;} { if(Extra open brace or missing close brace3+c; } }END{ print("Total count: "c); }'

    ///////////////the end////////////////////