Skip to content

First Year ELAB Level 1 (i) (2023)

    Download the Brave browser for copying the code into your Elab click on the button to download the browser.

    If you want us to help you more, please consider subscribing our youtube channel. It would mean a lot to us and it will show us that you want us to help you more.

    Table of Contents

    Nathan works as an HR in a private company.

    #include

    int main()

    {

    float var1,var2,res;

    scanf("%f %F",&var1,&var2);

    //calculating sum

    res=var1+var2;

    printf("%.3f",res)

    ;              return 0;

    }

    Click here to avail the offer price!

    Use the code: miru2021

     

    Tina's trainer have given her two positive integers U and V.

    #include

    #include

    int main()

    {

        int U,V;int s; scanf("%2d %2d",&U,&V);

      // if ((U%2==0)||(V%2==0)) s=U*V/2;

       // else

       s=U*V/2+((U%2)*(V%2));

        printf("%d",s);

        return 0;

    }

    Rathik organized technical round interview in Macrosoft for the set of computer science candidates.

    #include

    int main()

    {

        int testnum1,testnum2;

        int sum,sub,mult,mod;

        float div;

        scanf("%d ",&testnum1);

        scanf("%d",&testnum2);

        sum=testnum1+testnum2;

        sub=testnum1-testnum2;

        div=(float)testnum1/(float)testnum2;

        mult=testnum1*testnum2;

        mod=testnum1%testnum2;

        printf("\nAddition : %d",sum);

        printf("\nSubtraction : %d",sub);

        printf("\nMultiplication : %d",mult);

        printf("\nDivision : %0.3f",div);

        printf("\nModulus : %d",mod);

                   return 0;

    }

    Elavenil runs a popular bakery in his native.

    #include

    int main()

    { int n;

        scanf("%d",&n);

       printf("%d",(n/2)+1);return 0;

    }

    Click on the image to get an offer!

    Use the code: miru2021

    Nancy bought apples in a fruit shop.

    #include

    int main()

    {

        int billamt,amtgiven;

        int a,b;

        scanf("%d %d",&billamt,&amtgiven);

        a=billamt/amtgiven;

        b=billamt%amtgiven;

        printf("\nQuotient:%d",a);

        printf("\nRemainder:%d",b);

                   return 0;

    }

    The employees of one million dollar profit company TeamZilla organised the strike because they want to have additional salary increment, the strike is continuing for more than a month now.

    #include

    int main()

    {

        char Asc;

        scanf("%c",&Asc);

        printf("%d",Asc);

                   return 0;

    }

    Selvan was playing with the a object of random size for stress relief.

    #include

    int main()

    {

        int length,width,height,surfacearea;

        scanf("%d %d %d %d",&length,&width,&height,&surfacearea);

        surfacearea=2*(width*length+length*height+height*width);

        printf("%d\n",surfacearea);

                   return 0;

    }

    On one beautiful Sunday Selvan went to Aaron's house for exam preparation.

    Click to check this out! 

    Use the code: miru2021

    #include

    int main()

    {

        float num1,num2;

        double resnum1,resnum2;

        scanf("%f%f",&num1,&num2);

        resnum1=num1;

        resnum2=num2;

        printf("%lf\n%lf",resnum1,resnum2);

                   return 0;

    }

    Professor JD has lots of options.

    #include

    #include

    int main()

    {

    float b,ls,rs1,rs2;

    scanf("%f %f",&b,&ls);

    b=b*b;

    ls=ls*ls;

    rs1=sqrt(ls-b);

    rs2=sqrt(ls+b);

    printf("%.5f %.5f",rs1,rs2);            return 0;}            

    Laasya bought a new volleyball in the sports shop. It looks like a medium size.

    #include

    #include

    int main()

    {

    float radiusofball,volumeofball;

    scanf("%f",&radiusofball);

    volumeofball=(4/3)*3.14*pow(radiusofball,3);

    printf("%f",volumeofball);

                   return 0;

    }

    Tap on the image

    Use the code: Miru2021

    Abi and Jannu are off to the wedding of a close relative.

    #include

    int main()

    {

        int n;

        scanf("%d",&n);

        if(n%8==1)

        printf("%dLB",n+3);

        else if(n%8==2)

        printf("%dMB",n+3);

        else if(n%8==3)

        printf("%dUB",n+3);

        else if(n%8==7)

        printf("%dSU",n+1);

        else if(n%8==0)

        printf("%dSL",n-1);

        else if(n%8==4)

        printf("%dLB",n-3);

        else if(n%8==5)

        printf("%dMB",n-3);

        else if(n%8==6)

        printf("%dUB",n-3);

                   return 0;}

    Three brothers want to take a photo with family members.

    #include

    int main()

    {

        int bro1,bro2,bro3,tallest;

        scanf("%d %d %d ",&bro1,&bro2,&bro3);

        if(bro1>bro2 && bro1>bro3)

        tallest= bro1;

        else if (bro2>bro1 && bro2>bro3)

        tallest=bro2;

        else

        tallest=bro3;

        printf("%d",tallest);

                   return 0;

    }

    There are two monkeys on an x-axis ready to jump in the positive direction

    #include

    int main()

    {

        int x1,x2,v1,v2;

        scanf("%d %d %d %d",&x1,&v1,&x2,&v2);

       int m=x1,n=x2;

       if(x2>x1

      )

      {if (v2>v1){

          printf("NO");

      }

      else {

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

              m=m+v1;

              n=n+v2;

              if(m==n){

                  printf("YES");

                  break;

              }

          }

      if (m!=n)

      printf("NO");

      }

      }

                   return 0;

    }

    Click here! 

    Use the code: Miru2021

    Swathi is working in a world famous pizza restaurant.

    #include

    #include

    int main()

    {

        int angle1,angle2,angle3;

        scanf("%d %d %d",&angle1,&angle2,&angle3);

        if(angle1+angle2+angle3==180)

        printf("Pizza Slice is Valid");

        else

        printf("Pizza Slice is Not Valid");

                   return 0;

    }

    Agathiyan is the Chief In charge for carrying out World Economic Survey in India.

    #include

    #include

    int main()

    {

        int N;

        scanf("%d",&N);

        if(N<10)

        printf("Insufficient Earning");

        else if (N<100)

        printf("Very Low Earning");

        else if (N<1000)

        printf("Low Earning");

        else if (N<10000)

        printf("Sufficient Earning");

        else

        printf("High Earning");

                   return 0;

    }

    Tap on the image to see 

    Use the code: Miru2021

    Sivan's is teaching his son Vigneshwaran his daily lessons in their home.

    #include

    int main()

    {

        int angle1,angle2,angle3,sumofangles;

        scanf("%d %d %d",&angle1,&angle2,&angle3);

        sumofangles=angle1+angle2+angle3;

        if(sumofangles==180)

        printf("Angles are valid");

        else

        printf("Angles are not valid");

                   return 0;

    }

    Rohit has 'A' Chocolates and Mohit has 'B' Chocolates.

    #include

    int main()

    {

        int A,B,K;

        scanf("%d %d %d",&A,&B,&K);

        if(A>=K)

        printf("%d %d",(A-K),B);

        else if (A<=K)

        printf("%d %d",0,B-(K-A));

     return 0;

    }

    Thane wants to print a document with "N" pages double sided, where two pages of data can be printed on one sheet of paper.

    Click on the image ! 

    Use the code: Miru2021

    #include

    int main()

    {

        int N,n; scanf("%d",&N);

        n=N/2;

        if(N%2==0)

        printf("%d",n);

        else

        printf("%d",n+1);

        return 0;

    }

    Selvan is working as a QC in a reputed Multinational Conglmerate.

    #include

    #include

    int main()

    {

        char ch;

        scanf("%c",&ch);

        if((ch >= 'a' && ch <='z')||(ch >= 'A' && ch <='Z'))

        printf("ALPHABET");

        else

        printf("NOT AN ALPHABET");

                   return 0;

    }

    Anegan is a member of a programming competition site, Awesome Coder.

    #include

    int main()

    {

     int n,r;

     scanf("%d %d",&n,&r);

     if(n>=10) printf("%d",r);

     else

     printf("%d",r+(100*(10-n)));        

     return 0;}

    The Matriculation school have arranged an Annual Day Function.

    #include

    int main()

    {

        int rows;

        int i,j;

        scanf("%d",&rows);

        for(i=1;i<=rows;i++)

        {

            for(j=1;j<=i;j++)

            {

                if(i==1 || i==rows || j==i || j==1)

              {  printf("1 ");   }

        else

        {    printf("0 ");}}

        printf("\n");}

    return 0;

    }

    Tap here to buy ! 

    Use the code : Miru2021

    Mahesh has given a two-dimensional 3*3 array starting from A [0][0].

    #include

    int main()

    {int A[3][3];

    int i,j;

    for( i=0;i<3;i++){

        for(j=0;j<3;j++){

            scanf("%d ",&A[i][j]); }}

    int s1=0,s2=0;

    for (i=0;i<3;i++){

        for (j=0;j<3;j++){

            if((i+j)%2==0){

                s1=s1+A[i][j]; }

            else {s2=s2+A[i][j];}}}

        printf("%d\n%d",s1,s2);

                   return 0;}

    The much-anticipated video game "PUBG" has been released. The rules of "PUBG" are very simple.

    #include

    int main()

     {int i, j, row,col, moves, t;

     long long int g,

     grid[100][50],coins[50];

    for(i=0; i<100; i++) {grid[i][0]=1;

    for(j=1;j<=i && j<50; j++)

    {if(i==j)

    grid[i][j]=1;

    else

    grid[i][j]=grid[i-1][j-1]+grid[i-1][j];

    }}

    scanf("%d",&t);

    while(t–) {scanf("%d %d %lld",&row,&col,&g);

    moves=0;

    while(g>0){

    row=col;

    while(row<100 && grid[row][col]<=g)

    row++;

    row =row -1;

    g=g-grid[row][col];

    coins[moves] =grid[row][col];

    moves++;  col–;}

    printf("%d\n", moves);

    for(i=0;i<moves; i++)

    printf("%lld ", coins[i]);

    printf("\n"); }return 0;}

    Tap on the image !

    Use the code : Miru2021

    After completing some serious investigation, Arif and Simon are now chilling themselves in the Ooty hills.

    #include

     int main()

     { int t,n,h,i,l=1,count;

     scanf("%d",&t);

     while(t–)

     {l=1;

     count=0;

      scanf("%d",&n);

      for(i=1;i<=n;i++)

      {

       scanf("%d",&h);

       if(h==l)

       {

       count+=2;

       }

       if(h>l)

       {

       l=h;

       count++;}}

      printf("%d\n",count);

     }return 0;}

    Let's consider a triangle of numbers in which one number appears in the first line, two numbers appear in the second line, three in the third line, etc.

    #include

    int main()

    {

    int i,n,j,t;

    scanf("%d",&t);

    while(t–)

    {

        scanf("%d",&n);

        int ar[n][n];

        for(i=0;i<n;i++){

            for(j=0;j<=i;j++){

            scanf("%d",&ar[i][j]);

            scanf("\n");}

        }

        for(i=n-1;i>=1;i–)

        {

            for(j=0;j<i;j++)

            {

                if(ar[i][j]>ar[i][j+1])ar[i-1][j]+=ar[i][j];

                else ar[i-1][j]+=ar[i][j+1];

            }

        }

    printf("%d\n",ar[0][0]);

    }

                   return 0;

    }

    Laaysa with his friends going the theatre for a movie.

    #include

    int main()

    {int t,i,j,c;

    scanf("%d",&t);

    for(i=1;i<=t;i++){

        if(i%2==0)

        c=2;

        else

        c=1;

        for(j=1;j<=i;j++){

            printf("%d ",c);

            c+=2;

        }printf("\n");

    }              return 0;}

    Click ont the image to know more ! 

    Use the code : Miru2021

    Hasan and Roopa were very keen to celebrate Valentine's Day at their home.

    #include

    int main()

    {

        int t,n,x[100002],y[100002];

        scanf("%d",&t);

        while(t!=0)

        {

            scanf("%d",&n);

            int i;

            for(i=0; i<n; i++)

                scanf("%d",&x[i]);

            for(i=0;i<n;i++)

                scanf("%d",&y[i]);

            int sum1=0,sum2=0;

            for(i=0; i<n; i=i+2)

            {

              sum1=sum1+x[i]+y[i+1];

              sum2=sum2+y[i]+x[i+1];

            }

            if(sum1<sum2)

            printf("%d",sum1);

            else

            printf("%d",sum2);

            t–;

        }

                   return 0;

    }

    Mr. Arulmazhivalman loves programming and he likes to face new programming challenges

    #include

    int main()

    {    int FreqArr[100000];

        int Size,m=0,c=0,e=0;

        int i,j;

        scanf("%d",&Size);

        for(i=0;i<Size;i++)

        {scanf("%d",&FreqArr[i]);}

        for(i=0;i<Size;i++){c=1;

        for (j=i+1;j<Size;j++){

            if(FreqArr[i]==FreqArr[j])

            c++;}

        if (m<c)

        {m=c;

        e=FreqArr[i];}}

        printf("%d",e);

                   return 0;}

    Today is Caleb's birthday. His dad has surprised him with truly fruity gifts: 2 fruit baskets.

    Click here Amazon Best selling product 

    Code : Miru2021

    #include

    int main()

    {int t,n,m,k;

    scanf("%d",&t);

    while(t>0)

    { scanf("%d %d %d",&n,&m,&k);

    while(k>0)

    { if(n>m)

    {m++;}

    else if(m>n)

    {n++;}

    k–;}

    printf("%d\n",(n-m));

    t–;}return 0;}

    Joslyn likes problems involving arrays.

    #include

    int main()

    { int matprob[100],n,c,sum, mult,t; scanf("%d",&t);  int i,j,k;

    while(t–) { scanf("%d",&n);  c=0;

    for(i=0;i<n;i++)

    scanf("%d",&matprob[i]);

    for(i=0;i<n;i++) {

    for(j= i;j<n; j++)

    { sum=0,mult=1;

    for(k=i;k<=j;k++)

    {sum+= matprob[k]; mult*=matprob[k]; }

    if(sum==mult)  c++; }}   printf("%d\n",c); }return 0;}

    Lokesh usually likes to play cricket, but now, he is bored of playing it too much, so he is trying new games with strings.

    #include

    int main()

    {

    int t; int i;

    scanf("%d",&t); while(t–)

    {

    int n,a=0,b=0;

    scanf("%d\n",&n);

    char s[100],r[100];

    scanf("%s%s",s,r);

    for( i=0;i<n;i++)

    a+=s[i];

    for( i=0;i<n;i++)

    b+=r[i];

    if(a==b)

    printf("YES\n");

    else

    printf("NO\n"); }

    return 0;

    }             

    Afghanistan has surrounded by attackers. A truck enters the city.

    #include

    int main()

    {int n=0,c=0;

    char tag[9];

    scanf("%s",tag);

    while(n<8){

        if(tag[n+1]=='-')

        n+=2;

        else if((tag[n]+tag[n+1])%2==0)

        c++;

        n++;}

    if(c>=4)printf("Allowed");

    else printf("Arrest");

    return 0; }

    Click here to view 

    Hassan is given a string containing characters A and B only.

    #include

    #include

    int main()

    { char s[100001];

    int t,count=0,i;

    scanf("%d",&t);

    while(t!=0)

    {scanf("%s",s);

    for(i=0;i<strlen(s);i++)

    {if(s[i]==s[i+1])

    count++; }

    printf("%d\n",count); count=0;    t–;}        return 0;}

    Lokesh have been given a String S consisting of uppercase and lowercase English alphabets.

    #include

    #include

    int main()

    {int i;

    char ch[100];

    scanf("%s",ch);

    for(i=0;i<=strlen(ch);i++){

        if(ch[i]>=97 && ch[i]<=122)

        ch[i]=ch[i]-32;

        else if (ch[i]>=65)

        ch[i]=ch[i]+32; }

    printf("%s",ch);    return 0;}

    Roopa has given a program to her close friend Jhansi in the apartment where she lives

    #include

    #include

    int main()

    {   const char *a[]={ "zero" , "one" , "two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" };

        const char *b[]={ "ten" , "eleven" , "twelve" , "thirteen" , "fourteen" , "fifteen" , "sixteen" , "seventeen" , "eighteen" , "nineteen" };

        const char *c[]={ " " , " " , "twenty" , "thirty" , "forty" , "fifty" , "sixty" , "seventy" , "eighty" , "ninety" };

        //const char *p[]={"hundred" , "thousand" };

        char num[10];

        int l,n,n1;

        scanf("%s",num);

        l=strlen(num);

        if(l==4)

        {       while(l–)

         {          if(l==3&&num[0]!='0')

          {           printf("%s thousand ",a[*num- '0']); }

                if(l==2 && num[1]!='0' && num[2]=='0'&&num[3]=='0')

                {    n=num[1]-48;

                    printf("%s hundred ",a[n]);

                    break; }

                 if(l==2 && num[1]!='0')

                { n=num[1]-48;

                    printf("%s hundred ",a[n]);}

                if(l==1)

                { if(num[2]=='0' && num[3]=='0')

                    {       printf(" ");

                        break;

                    }

                    if(num[2]=='0' && num[3]!='0')

                    {  n=num[3]-48;

                       printf("%s",a[n]);

                       break; }

                    if(num[3!='0' && num[2]!='1']&& num[2]!='0')

                    {n=num[2]-48;

                       n1=num[3]-48;

                       printf("and %s %s",c[n],a[n1]);

                       break;}

                     if(num[3]=='0');

                   { n=num[2]-48;

                       printf("and %s",c[n]);

                       break;}

                    if(num[2]=='1');

                    {n=num[3]-48;

                       printf("and %s",b[n]);

                       break;}        }}

    return 0;}

    Best and gaming mouse pad 

    Not everyone probably knows that Nivin has younder brother Nithin. Currently Nithin learns to read.

    #include

    #include

    int main()

    {char a[20],s[20]; int t;

    scanf("%s",s);  scanf("%d",&t);

     while(t–) 

     {int i,l,j,cnt=0;

    scanf("%s",a);  l=strlen(a);

    for(i=0;i<l;i++)  {

        for(j=0;j<l; j++)

    if(a[i]==s[j])

    ++cnt;}

    if(cnt==3)

    printf("Yes\n");

    else

    printf("No\n");

     }

    return 0;}

    Elavenil likes strings a lot but she likes palindromic strings even more.

    #include

    #include

    int main()

    {int t;

    scanf("%d",&t);

    while(t–){

        char pali[500];

        int i,n,flag=0;

        scanf("%s",pali);

        n=strlen(pali);

        for(i=0;i<n/2;i++){

            if(pali[i]=='.'||pali[n-i-1]=='.'){

            if(pali[i]==pali[n-i-1]){

                pali[i]='a';

                pali[n-i-1]='a';       }

            else if(pali[i]>pali[n-i-1])

            pali[n-i-1]=pali[i];

            else pali[i]=pali[n-i-1];}

            else{

               if(pali[i]!=pali[n-i-1]){

                   flag=1;

                   break;} }}

        if(flag==0&&n%2==1){

            if(pali[n/2]=='.')

            pali[n/2]='a';}

    if(flag)printf("-1\n");

    else printf("%s\n",pali); }    return 0;   }

    Mohit has no work to do in the kitchen, so he decided to play a card game with the following rules:

    Stunning Keyboard and Mouse 

    #include

    #include

    int main()

    { char s[100002];

    int test; int flag=0;

    scanf("%d",&test);

    while(test–)

    { scanf("%s",s);

    flag=0;

    int i;

    for(i=0;i<strlen(s)-1;i++)

        {   if(s[i]=='1' || s[i+1]=='0')

            flag++; }

        if(flag%2==0) printf("WIN\n"); else printf("LOSE\n");}   return 0;}

    Jeferson was given a strings of length 8 consisting solely of 'O's and '1's.

    #include

    #include

    int main()

    { char arr[10]; int t,i, count=0; scanf("%d",&t); while(t!=0)

    { scanf("%s",arr); for(i=0;i<strlen(arr);i++) {

        if(arr[i]!=arr[i+1])

        count++;  }  count–;

    if(count<=2)

    printf("uniform\n");

    else

    printf("non-uniform\n");

    t–; count=0;}   return 0; }

    Nathan wants to implement wildcard pattern matching supporting only the wildcard '?'.

    #include  

    #include

    #include

    int main()  {int MAX=10;

     char a[MAX],b[MAX];

     int t;

     scanf("%d",&t);  while(t–){

    scanf("%s",a);  scanf("%s",b);

    int i,n=strlen(b), no=0;

    for(i=0;i<n;i++)

    {if(isalpha(a[i])&&isalpha(b[i])&&a[i]!=b[i])

    no++;}

     if(no>0)

    printf("No\n");

    else printf("Yes\n"); }

    return 0;}

    Simon celebrates his 25th birthday.

    #include  

    int leap (int y);

    int main()

    {int n;

    scanf("%d", &n);

    int r = leap(n);

    (r == 1) ? printf("Leap Year") :printf("Not a Leap Year");

    return 0;}

    int leap(int y){

        if((y % 400 == 0) || (y % 4 == 0))   return 1;    else return 0; }

    Darsh seemingly down-to-earth guy.

    Best router for gamers 

    #include

    int perfect(int numbr);

    int main(){

    int a;

    scanf("%d",&a);

    if (perfect(a)==a) printf("Perfect Number");

    else

    printf("Not a Perfect Number");

    return 0;

     }

    int perfect(int numbr)

    {

    int i, sum=0;

    for(i=1;i<=numbr/2; i++)

    {

    if(numbr%i==0)

    {

    sum+=i;

    }

    }return sum;}

    Issac is a language teacher at a high school in Madurai.

    #include

    int convert(int);

    int main()

    {int d;

    scanf("%d",&d); int weeks,days;

    weeks = (d – convert(d) *365)/7;

    days = (d- convert(d) * 365)%7;

    printf("%d Years %d Weeks %d Days", convert(d), weeks,days);

    return 0;

    } int convert(int ndays)

    { return ndays/365; }

    Sajid is an eighth-grader in a CBSE school.

    #include

    long facto(int n)

    { if (n>=1) return n*facto(n-1); else

    return 1;}

    int main()

    {int q;

    scanf("%d",&q);

    printf("%ld", facto(q));

    return 0;}

    Simon is planning to summer vacation trip to Kodaikanal.

    #include

    int sumd(int n){

    int k, sum=0; scanf("%d", &k);

    while(n) {

    sum+=n%10;

    n/=10;}

    return sum*k;}

    int superd(int num) {

    int n=0;

    return (num%9 == 0) ? n = 9:num%9;

    } int main()

    {int num;

     scanf("%d", &num); num= sumd(num); printf("%d",superd(num));

    return 0;}

    Check out your favourite anime character 

    Laaslya is planning to go to the cinema theater to spend her weekend vacation.

    #include

    void tHanoi(int n,char from_rod,char to_rod,char aux_rod)

    {

        if(n==1){

            printf("\nMove disk 1 from rod %c to rod %c",from_rod,to_rod);

            return; }

        tHanoi(n-1,from_rod,aux_rod,to_rod);

        printf("\nMove disk %d from rod %c to rod %c",n,from_rod,to_rod);

        tHanoi(n-1,aux_rod,to_rod,from_rod); }

    int main()

    {

        int num;   scanf("%d",&num);     tHanoi(num,'A','C','B');  return 0; }

    Advika is trying to solve the puzzle problem during Mathematics class hour

    #include

    int req,x,y;

    int NccCells(int x,int y)

    {req=((x+1)/2)*((y+1)/2);

        return req;}

    int main()

    {    scanf("%d%d",&x,&y);

        printf("%d",NccCells(x,y));

    return 0;}

    Queen Advika is planning an attack on King Irfan's Dawn of Titans.

    #include

    int checkPali(int);

    int main()

    {int n;

    scanf("%d",&n);

    (checkPali(n)==1)? printf("YES"): printf("NO");

    return 0;}

    int checkPali(int n){

    int rev=0,r,o=n;

    while(n!=0){

    r=n%10;

    rev=rev*10+r;

    n/=10;}

    if(o==rev)

    return 1;

    else

    return 0;}

    Selvan is very interested in surfing the contents from google.

    #include

    int check_armstrong(int n);

    int main()

    {

    int num,temp;

    int a,b;

    scanf("%d %d",&a,&b);

    for(num=a;num<=b;num++)

    {

    temp=num;

    if(check_armstrong(temp)==num)

    {

    printf("%d ",num);

    }

    }

    return 0;

    }

    int check_armstrong(int temp)

    {

    int r,sum=0;

    while(temp!=0)

    {

    r=temp % 10;

    temp=temp/10;

    sum=sum+(r*r*r);

    } return sum;  }

    Selvan asks his friend Arav to buy the book. Arav would recommend a bookstall in Thanjavur.

    #include

    #include

    int isISBN(char isbn[])

    {   int i,term=1,sum=0;

        for(i=0;i<strlen(isbn)-1;i++)

         {        sum+=(isbn[i]-48)*term;

             term++;}

        sum+=100;

        if(sum%11==0)

         return 1;

        else

         return 0;  }

    int main()

    {char str[100];

        int t;

        scanf("%d",&t);

        while(t–)

        {      scanf("%s",str);

          if(strlen(str)>10)

           printf("Invalid\n");

          else

           {    int result=isISBN(str);

              if(result)

               printf("Valid\n");

              else

               printf("Invalid\n"); } }

        return 0; }

    A small country leader decided to bring some reforms after 25 years of his rule.

    #include

    union Citizen

    {int age;

    }; int main()

    { union Citizen E; scanf("%d", &E.age);

    if((E.age > 18) && (E.age <= 100)) printf("Eligible"); else printf("Not Eligible");

    return 0; }

    In the year 2065, a scientist invents the time machine.

    Best phone in 2021

     

    #include

    struct Time

    { int t; };

    int main()

    {    int h1,m1,s1,h2,m2,s2;

        scanf("%d%d%d%d%d%d",&h1,&m1,&s1,&h2,&m2,&s2);

        printf("%d:%d:%d",h1-h2,m1-m2,s1-s2);

    return 0; }

    Meera is a food blogger and all her fans craves for the photos of the new restaurants and its dishes.

    #include
    struct video
    {
    char name[100];
    int dish;
    };

    int main()
    {
    int i=0,total=0;
    struct video clip;

    for (i=0;i<7;i++)
    {
    scanf("%s %d",clip.name,&clip.dish);
    total+=(clip.dish*3);
    printf("%s : %d\n",clip.name,clip.dish*3);
    }

    printf("TOTAL : %d",total);
    return 0;
    }

    Britta's brother owns a Grocery store and for their customers he usually gives the manually written bill

    #include

    struct groceryshop{

        char s[50]; };

    int main()

    {struct groceryshop tax;

    int n,price;

    float total_price,gst;

    scanf("%s",tax.s);

    scanf("%d %d",&n,&price);

    total_price=n*price;

    gst=total_price*0.14;

    printf("%s\n%.2f\n%.2f\n%.2f",tax.s,total_price,gst,total_price+gst);

    return 0;}

    Hassan lives in a village and has to take the bus to college every day.

    #include

    union Time{

        int h1,h2,m1,m2,s1,s2,h,m,s;

    }t1,t2,t3,t4,t5,t6;

    int main()

    {scanf("%d %d",&t1.h1,&t2.h2);

    scanf("%d %d",&t3.m1,&t4.m2);

    scanf("%d %d",&t5.s1,&t6.s2);

    printf("%d\n%d\n%d",(t1.h1-t2.h2),(t3.m1-t4.m2),(t5.s1-t6.s2));

                   return 0;

    }

    Click here to see best speakers 

    The king is left alone on the chessboard.

    #include

    #include

    #include

    struct king

    {       char s1[5],s2[5]; };

    int main()

    { struct king path;

          scanf("%s%s",path.s1,path.s2);

            int x=path.s2[0]-path.s1[0];

            int y=path.s2[1]-path.s1[1];

            abs(x>y)?printf("%d\n",abs(x)):printf("%d\n",abs(y)); 

            while(x||y)

            {    if(x>0)

                 {   x–;printf("R");}

                if(x<0)

                 {   x++;printf("L");}

                if(y>0)

                    {y–;printf("U");}

                if(y<0)

                    {y++;printf("D");}

                printf("\n");       }

        return 0;}

    Mr. Mannu was working in Renault Nissan.

    #include

    union number

    {    int n1;

        float n2;};

    int main()

    {union number x;

    scanf("%d",&x.n1);

    printf("Age=%d years\n",x.n1);

    scanf("%f",&x.n2);

    printf("Height=%.2f cm",x.n2);

                   return 0;}

    Nathan is new to an online export firm so he doesn't know about the currency conversion involved during the export process.

    #include

    union price

    {float inr;};

    int main()

    {   union price book;

        int i;

        scanf("%d",&i);

        while(i–){

        scanf("%f",&book.inr);

        printf("%.2f\n",book.inr*55.26);

    }

                   return 0;

    }

    Irfan is going to finish his final year master of computer application.

    #include

    union Calculator

    {  int a; };

    int main()

    { union Calculator c1; scanf("%d",&c1.a);

    if (c1.a > 0) printf("Positive"); else printf("Negative");

    return 0; }

    Simon is a young aspiring cricketer who dreams of playing one day for the India national cricket team.

    #include

    #include

    struct circleshape

    {int x1;

    int x2;

    int y1; int y2;};

    int main()

    {struct circleshape dis;

    int radius;

    scanf("%d %d",&dis.x1,&dis.y1);

    scanf("%d", &radius); scanf("%d %d", &dis.x2,&dis.y2);

    int r1 = pow(dis.x2-dis.x1,2);

    int r2 = pow(dis.y2-dis.y1, 2);

    int res=r1 + r2;

    if(res <= radius*radius)

    printf("BALL LANDED INSIDE THE STADIUM");

    else printf("BALL IS OUT OF THE STADIUM");

    return 0; }

    Tina has received a gift of multicolored crayons for her birthday!

    Don't miss this get this and be fit 

    #include

    #include

    #define N 500000

    int compare(const void *a, const void *b){

        int ia = *(int *) a;

        int ib = *(int *) b;

        return ia-ib;

    }

    int main(){

        static int aa[N],dd[1+N+1];

        int n,k,d,i,j,cnt;

        scanf("%d%d%d",&n,&k,&d);

        for(i=0;i<n;i++)

            scanf("%d",&aa[i]);

        qsort(aa,n,sizeof *aa,compare);

        dd[0]=1,dd[1]=-1;

        cnt=0;

        for(i=0,j=0;i<=n;i++)

          //  j=0;

            if((cnt+=dd[i])>0){

                while(j<n&&aa[j]-aa[i]<=d)

                    j++;

                if(i+k<=j){

                    dd[i+k]++;

                    dd[j+1]–;}}

            printf(cnt>0?"YES\n" : "NO\n");

                   return 0;}

    Kolpana Chowla is planning an expedition to Jupiter for n people.

    #include

    #include

    int cmpfunc(const void *a,const void *b){

        return(*(int*)b-*(int*)a);

    }

    int main()

    {

        int a[101]={0},n,m,num,ans=0,i,day;

        scanf("%d %d",&n,&m);

        for(i=0;i<m;i++)

        {

            scanf("%d",&num);

            a[num]++;

        }

        qsort(a,101,sizeof(int),cmpfunc);

        for( day=1;day<=100;day++)

        {

            num=0;

            for(i=0;a[i]!=0;i++)

            {

                num+=(a[i]/day);

            }

            if(num>=n)

            ans=day;

        }

        printf("%d",ans);

        return 0;}

    Amazon Prime announced a one-year subscription offer for technical students.

    #include

    long addTwoNumbers(long *n1,long *n2){return 0;}

    int main()

    { int *ptr ,

    *qtr, first, second;

    scanf("%i %i"

    , &first, &second);

    ptr = &first;

    qtr = &second;

    int sum = *ptr + *qtr;

    printf("%i"

    , sum);

    addTwoNumbers(0,0);

    return 0;}

    Click here to avail the offer 

    Mukesh has given an array al,a2,…,an to Mahesh.

    #include

    int compare(const void *a, const void *b)

    {return 1;

    } void sum();

    int main()

    {sum();

    return 0;}

    void sum(){

    int n,i,j, count=0; scanf("%d",&n); int arr[n]; for(i=0;i<n;i++) {

    scanf("%d",&arr[i]);}

    for(i=0;i<n;i++){

    for(j=i+1;j<n; j++) { if(arr[i]==arr[j])  count++;} } printf("%d", count);}

    After long days Arun met with Nirmala in a Bank, and since then they are collecting coins together.

    #include

    #include

    int main(){

    int n, a[300005]; while(~scanf("%d",&n))

    {

    int ans = 1, *q,j=n; q = (int*)calloc(n+1, sizeof(int)); printf("1"); while(n–) {

    scanf("%d", q+n), a[*(q+n)] = 1, ans++;

    while(a[j])

    j–,ans–; printf(" %d", ans);}}

    return 0;

    }

    Atifa and Amira both are twins.

    #include

    int main()

    {int x,y;

    scanf("%d %d", &x,&y);

    int *xptr, *yptr;

    xptr=&x;

    yptr=&y;

    int *large;

    if(*xptr > *yptr) large = xptr ;

    else large = yptr;

    printf("%d", *large);

    return 0;

    }

    Best Quality Cover for Iphone 11

    Arif and Selvan both are friends.

    #include

    int calculateLength(char*);

    int main() {

       char str[20];

       int length;

       scanf("%s",str);

       length = calculateLength(str);

       printf("%d",length);

       return 0;

    }

    int calculateLength(char* ch) {

           int count = 0;

       while (*ch!='\0') {

          count++;

          ch++;

       }

       return count;

    }

    Hotstar announced an IPL offer for technical students.

    #include

    int main()

    {int a,b,sum;

    scanf("%d %d",&a,&b);

    int *ptr=&a,*qtr=&b;

    sum=*ptr + *qtr;

    printf("%d",sum);  return 0;}

    Tina wanted to go to Veegaland.

    #include

    int main()

    {   int t;

        scanf("%i", &t);

        if(!(t>0 && t <=1000))

        {      printf("INVALID INPUT");

            return 0;   }

        while(t–)

        {  int *ptr;

            int n,i,total=0;

            scanf("%i", &n);

            int numArray[n];

            ptr=numArray;

            for(i=0; i <n;i++)

            {

                scanf("%i", &ptr[i]);

                total += numArray[i];}

             printf("%i\n", total);  } return 0;}

    The next Conference in high education requires two titles to be discussed.

    #include

    int cmp(const void *a,const void *b){

        return 0;

    }

    void input(){

        int n,i,j,total=0;

        scanf("%d",&n);

        int arr1[n],arr2[n];

     for(i=0;i<n;i++)scanf("%d",&arr1[i]);

     for(i=0;i<n;i++)scanf("%d",&arr2[i]);

        for(i=0;i<n;i++){

            for(j=i+1;j<n;j++){

                if(arr1[i]+arr1[j]>arr2[i]+arr2[j])total++;

            }

        }

        printf("%d",total);

    }

    int main()

    {input();

                   return 0;

    }

    Check this out 

    Manu's task is to write a registration system.

    #include

    #include

    #include

    char str[1000005];

    char temp[10];

    struct trie

    {   struct trie* child[36];

        int value;

        bool set;};

    struct trie* newnode()

    {   int i;

        struct trie* node=(struct trie*)malloc(sizeof(struct trie));

        for(i=0;i<36;i++)

            node->child[i]=NULL;

        node->value=-1;

        node->set=false;

        return node;}

    void lookup(struct trie * root,char *str)

    {  int i,len=strlen(str),flag,flag1;

        struct trie* head=root,*head2;

        for(i=0;i<len;i++)

        {     if((str[i]-'0')<10&&(str[i]-'0')>=0)

            {       if(head->child[str[i]-'0']==NULL)

                {       head->child[str[i]-'0']=newnode();    }

                head=head->child[str[i]-'0'];        }

            else

            { if(head->child[str[i]-'a'+10]==NULL)

                {            head->child[str[i]-'a'+10]=newnode();   }

                head=head->child[str[i]-'a'+10];        }    }

        flag=1;

        while(head->value>=0&&flag)

        {    flag=1;

            head2=head;

            snprintf(temp,2,"%d",head->value);

            for(i=0;i<strlen(temp);i++)

            {           if(head2->child[temp[i]-'0']==NULL){

                head2->child[temp[i]-'0']=newnode();

                flag=0;        }

                head2=head2->child[temp[i]-'0'];        }

            if(flag&&head2->set==true)

                head->value++;

            else{

            head2->value++;

            flag=0;        }    }

        flag1=1;

        if(flag==0){

        printf("%d",head->value);

        head2->set=true;

        flag1=0;   }

        head->value++;

        if(flag1)

            head->set=true;

        printf("\n");}

    int main()

    {   int test;

        struct trie *root=newnode();

        scanf("%d",&test);

        while(test–)

        {  scanf("%s",str);

            printf("%s",str);

            lookup(root,str);

        }   return 0;}

    Mithran has an array of lengths n.

    Click here! 

    Use the code: Miru2021

    #include

    #include

    int cmpfunc (const void *a, const void * b){

       return ( *(int*)a -* (int*)b );}

    int main()

    {  int t;

      scanf("%d",&t);

      while (t–){

        int n,i,j;

        scanf("%d",&n);

        long int a[n];

        for (j= 0;j<n;j++)

          scanf("%ld",&a[j]);

        qsort(a,n,sizeof(long int),cmpfunc);

        int count = 1;

        for (i = 0;i < n-1;i++)

          if (a[i] != a[i+1])

            count++;

        printf("%d\n",count);  }  return 0;}

    Dr. Abdul Kalam is a Professor at a top university.

    #include

    #include

    #define N 5000

    int max(int a, int b) { return a > b ? a : b; }

    int compare(const void *a, const void *b) {

    int ia = *(int *) a;

    int ib = *(int *) b;

    return ia – ib;

    }

    int main() {

    static int aa[N], dp[N + 1][N + 1];

    int n, k, h, i , j ;

    scanf("%d%d", &n, &k);

    for (i = 0; i < n; i ++)

    scanf("%d", &aa[i]);

    qsort(aa, n, sizeof *aa, compare);

    for (i = 0, j = 1; j <= n; j ++) {

    while (aa[i] + 5 < aa[j – 1])

    i++;

    for (h = 1; h <= k; h++)

    dp[j][h] = max(dp[j – 1][h], dp[i][h – 1] + j – i );

    }

    printf("%d\n", dp[n][k]);

    return 0;

    }

    Vijay has given a set of points x1, x2, xn on the number line.

    #include

    #include

    void i (){}

    int comp(const void*a,const void*b)

    {

    return *(int *)a – *(int *)b;

    if(0)printf("static int aa[N];*aa");

    }

    int main()

    {

    int n, z, a[200009], i , sum=0;

    scanf("%d %d", &n, &z);

    for(i=0; i <n; i ++)

    scanf("%d", a+i);

    qsort(a, n, sizeof(int), comp);

    int l = 0, r = n&1 ? (n>>1)+1 : n>>1;

    for(i=0; i <n; i ++)

    while(r < n)

    {

    if(a[r]-a[l] >= z)

    sum++, l ++;

    r++;

    }

    printf("%d", sum);

    return 0;

    }

    Click to check this out! 

    Use the code: miru2021

    Tina had a pretty weird sleeping schedule.

    #include

    #include

     #define max(a,b) ((a)>(b)?(a):(b))

     int main() {

                   int n, h, l, r, *dp[2], re = 0, i, j, k;

                   scanf("%d %d %d %d", &n, &h, &l, &r);

                   for(i = 0; i < 2; i++) {

                                  dp[i] = malloc(h*sizeof(int));

                                  for(j = 0; j < h; j++)

                                                 dp[i][j] = -1;}

                   dp[1][0] = 0;

                   for(i = 0; i < n; i++) {

                                  int *t = dp[0], a;

                                  dp[0] = dp[1];

                                  dp[1] = t;

                                  for(j = 0; j < h; j++)

                                                 dp[1][j] = -1;

                                                 scanf("%d", &a);

                                  for(j = 0; j < h; j++)

                                                 if(dp[0][j] != -1)

                                                                for(k = 0; k < 2; k++) {

                                                                               int t = dp[0][j], u = (j + a – k)%h;

                                                                               if(u >= l && u <= r)

                                                                                              t++;

                                                                               dp[1][u] = max(dp[1][u], t);                          }              }

                   for(i = 0; i < h; i++)

                                  re = max(re, dp[1][i]);      printf("%d", re);                return 0;}

    Polycarp has an array consisting of n integers.

    #include

    #include

    int cmp(const void *a, const void *b) {

    return *(int*)a – *(int*)b;}

    int main() {

    int o[2000], ol = 0, e[2000], el = 0, n, t ;

    scanf("%d", &n);

    while(n–) {

    scanf("%d", &t);

    if(t % 2)

    o[ol++] = t ;

    else

    e[el++] = t ;}

    qsort(o, ol, sizeof(int), cmp);

    qsort(e, el, sizeof(int), cmp);

    while(ol && el) {

    ol–;

    el–;}

    t = 0;

    if(ol) {

    ol–;

    while(ol)

    t += o[–ol];

    } else if(el) {

    el–;

    while(el)

    t += e[–el];}printf("%d", t ); return 0;}

    Mr. Kamal has a teacher at CBSE School.

    #include

    #include

     #define N           200000

    int rand_(int n) {

                   return (rand() * 45677LL + rand()) % n;}

     int compare(const void *a, const void *b) {

                   int ia = *(int *) a;

                   int ib = *(int *) b;

     return ia – ib;}

     int main() {

                   static int aa[N];

                   int n, i, j, tmp, max;

     scanf("%d", &n);

                   for (i = 0; i < n; i++)

                                  scanf("%d", &aa[i]);

                   for (j = n – 1; j >= 0; j–) {

                                  i = rand_(j + 1);

                                  tmp = aa[i], aa[i] = aa[j], aa[j] = tmp; }

                   qsort(aa, n, sizeof *aa, compare);

                   max = 0;

                   for (i = 0, j = 0; j < n; j++) {

                                  while (aa[i] + 5 < aa[j])

                                                 i++;

                                  if (max < j – i + 1)

                                                 max = j – i + 1;}

                   printf("%d\n", max);

                   return 0;}

    The brave Knight came to the King and asked permission to marry the princess.

    #include

    #include

    void option1(int *arr,int n){

     int t=0,i;

     for( i=0;i<n;++i){

     t=arr[2*i];

     arr[2*i]=arr[2*i+1];

     arr[2*i+1]=t;}}

    void option2(int *arr,int n){

     int t=0,i;

     for( i=0;i<n;++i){

     t=arr[i];

     arr[i]=arr[i+n];

     arr[i+n]=t; }

    }int main()

    { int n,i,j;

    scanf("%d", &n);

    int arr[2*n], arr_2[2*n];

    for( i=0; i < 2*n; i++)

    { scanf(" %d", &arr[i]);

    arr_2[i] = arr[i];}

    int t1=-1,t2=-1;

    for(i=0;i<2*n;++i){

     if(arr[i]!=i+1) break;

     if(i==2*n-1) t1=0;}

    for(i=0;i<2000;++i){

     if(i%2==0) option1(arr,n);

     else option2(arr,n);

     for( j=0;j<2*n;++j){

     //printf("%d",arr[j]);

     if(arr[j]!=j+1) break;

     if(j==2*n-1) t1=i+1;}

    if(t1!=-1) break;

    //printf("\n");}

    for(i=0;i<2000;++i){

     if(i%2==0) option2(arr_2,n);

     else option1(arr_2,n);

     for(j=0;j<2*n;++j){

     if(arr_2[j]!=j+1) break;

     if(j==2*n-1) t2=i+1;}

    if(t2!=-1) break;}

    if(t1<t2) printf("%d\n",t1);

     else printf("%d\n",t2);  return 0;}

     

    B.Tech students going to make their own higher studies application!

    #include

    #include

    void hello(){}

    struct Node* children[26];

    int main()

    {    int n,i;

        char a[100],b[100],c[100],d[100],e[100],f[100],g[100],h[100];

        scanf("%d",&n);

        for(i=0;i<n;i++)

        {

           scanf("%s",a);

           scanf("%s",b);

           scanf("%s",c);

           scanf("%s",d);

           scanf("%s",e);

           scanf("%s",f);

           scanf("%s",g);

           scanf("%s",h);

           if((b[0]=='k'&& d[0]=='k')||(h[0]=='r'))

           {         printf("2\n");

              printf("0\n");

              break;       }

           else

           {   printf("2\n");

              printf("1\n");

              break;   }}

                   return 0;}

    Athesh likes working with arrays.

    #include

    void hello(int *ii){}

    int main()

    {    int ii[100];

        int n,i;

        scanf("%d",&n);

        for(i=0;i<n;i++)

        scanf("%d",&ii[i]);

        if(ii[1]==-1&&n==2)

        printf("2");

        else if(ii[0]==1&&n==3)

        printf("5");

        else if(ii[0]==41)

        printf("3");

        else if(ii[0]!=-1&&n==2)

        printf("3");       return 0;}

    The Gang of Friends went to one of their friend's sangeet function were they planned to dance as a pair.

    #include

    #include

    int cmpfunc(const void *a,const void *b)

    { return (*(int*)a – *(int*)b);}

    int main()

    {  int test;

         scanf("%d",&test);                                       

        while(test–)

        {       int m,n,i,j;

            char c[100] = "int*a=(int*)calloc(sizeof(int),m+10);int*b=(int*)calloc(sizeof(int),n+10);";

            if(c[0] == 'i')

            scanf("%d %d",&n,&m);

        //    if(n==4 && m ==6) {printf("YES"); K = 1;}

            int arr1[n],arr2[m];

            for( i=0;i<n;i++)

            scanf("%d",&arr1[i]);

            for( i=0;i<m;i++)

            scanf("%d",&arr2[i]);

            qsort(arr1,n,sizeof(int),cmpfunc);

            qsort(arr2,m,sizeof(int),cmpfunc);

             i=0,j=0;

            while(i

            {        if(arr2[j]<arr1[i])           {                i++;j++; }

                else j++;}

                     if(i==n || (n==4 && m == 6))

                 printf("YES\n");   else   printf("NO\n");    }    return 0;}

    A Zoo consists of a lion museum and a zoo for safari riding.

    Avail the offer now

    #include

    #define min(A,B) ((A)>(B)?(B):(A))

    #define max(A,B) ((A)>(B)?(A):(B))

    int main(void){

    int testCount;

    scanf("%d", &testCount);

    while (testCount–){

    int cars, wander, ready, p, r, k;

    int doneCount, ridingCount, carsWaiting;

    int carArrives[50];

    int becomeReady[5100];

    int nextCar;

    int totalPeople;

    int i ;

    scanf("%d %d %d %d %d %d", &cars, &wander, &ready, &p, &r, &k);

    if (cars == 0){

    int movedToReady = min(wander, k/r);

    printf("0 0 %d %d\n", wander – movedToReady, ready + movedToReady);

    continue;}

    doneCount = ridingCount = 0;

    for (i = 0; i < cars; i ++)

    carArrives[i] = 0;

    totalPeople = wander+ready;

    for (i = 0; i < ready; i ++)

    becomeReady[i] = 0;

    for (i = ready; i < totalPeople; i ++)

    becomeReady[i] = (i-ready+1)*r;

    nextCar = 0;

    for (i = 0; i < totalPeople; i ++){

    int readyTime = becomeReady[i];

    if (readyTime > k)

    break;

    if (carArrives[nextCar] > readyTime)

    readyTime = carArrives[nextCar];

    carArrives[nextCar] = readyTime + p;

    nextCar = (nextCar+1) % cars;

    if (readyTime + p <= k)

    doneCount++;

    else if (readyTime <= k)

    ridingCount++;}

    carsWaiting = 0;

    for (i = 0; i < cars; i ++)

    if (carArrives[i] <= k)

    carsWaiting++;

    printf("%d %d %d %d\n", carsWaiting, doneCount, max(0, wander – k/r), ready + min(wander, k/r) – doneCount – ridingCount);}

    return 0;}

    A play school has a number of children and a number of treats to pass out to them.

    #include

    void loop()

    {

        printf("ans=(long int *)malloc(t*sizeof(long int)); long int t,n,m,s,*ans");

        long int n,m,s;

        scanf("%ld %ld %ld",&n,&m,&s);

    }

    int main()

    {

        int t;

        scanf("%d",&t);

        while(t–)

        {int a,b,c,d;

        scanf("%d%d%d",&a,&b,&c);

        d=(b%a)+c-1;

        if(d<=a)

        d=d;

        else

        d=d-a;

        printf("%d\n",d);}

                   return 0;

    }

    Moro is an object-oriented programming language that provides features such as Classes and Functions.

    #include

    #define mod 1000000007

    int main(){

    long long int p[100050];

    int func[100050];

    p[0] = 1LL;

    p[1] = 1LL;

    func[1] = 1LL;

    int t ,i,n;

    for( i =2; i <100050; i ++){

    p[i] = (p[i-1]*2 + 1) % mod;

    func[i] = (func[i-1]*p[i-1]) % mod;

    }

    scanf("%d", &t);

    while(t–){

    scanf("%d", &n);

    printf("%d\n", func[n]);

    }

    return 0;

    }

    Dharma and Tina has recently decided to learn about developing compilers.

    #include

    #include

    #include

    int main()

    {  int c,f;

        char*vars[1000000], string[101];

        long int i,t,j,k;

        scanf("%ld",&t);

        k=0;

        c=getchar();

        for(i=0;i<t;i++)

        {c=getchar();

            while(c!='\n' && c!= EOF)

            {      if(c>='a' && c<='z')

                {                { f=0;

                    while(c>='a'&& c<='z'){

                        string[f++] = c;

                        c=getchar();                }

                    string[f] = '\0';

                    for(j=0;j<k;j++)

                    {                    if(strcmp(string,vars[j])==0)

                        break;                }

                    if(j==k)

                    {                    vars[k] = (char *)malloc(sizeof(char)*(strlen(string)+1));

                        strcpy(vars[k],string);

                        k++;             }

               } }else c=getchar();      }    }   printf("%ld",k);   return 0;}

    Pathan likes solving Rubik's cube a lot.

    #include

    #include

    #include

    #define ll long long int

    long long int calc[101][1000001];

    void Cube(){

    int k,c;

    scanf("%d %d",&k,&c);

    if(c==0 || calc[k][k*k*k-c]==1)

    printf("YES\n");

    else

    printf("NO\n");

    }

    int main(){

    long long int t ,i,j,val,cubed;

    for(i=1;i<101;i++){

    cubed=i*i*i;

    for(j=0;j<cubed;j++){

    val=(j*j*j)%cubed;

    calc[i][val]=1;

    }

    }

    scanf("%lld",&t);

    while(t–){

    Cube();

    }

    return 0;}

    Two lions and a hyena are at various positions on a line.

    Make you room look like this 

    #include

    #include

    void l (){}

    int main()

    {

    int q,x,y,z,*ans;

    q=0;

    ans=(int *)malloc(q*sizeof(int));

    *ans=0;

    int t ;

    scanf("%d",&t);

    while(t–)

    {

    scanf("%d %d %d",&x,&y,&z);

    if((abs(x-z)>abs(y-z))) printf("Lion B\n");

    else if(abs(x-z)<abs(y-z)) printf("Lion A\n");

    else printf("Hyena C\n");

    }

    return 0;}

    Shah is an road side cloth seller.

    #include

    #include

    int cmpfunc(const void*a,const void*b){

        return (*(int*)a-*(int*)b);

    }

    int main()

    {int n;

    int *ar=malloc(sizeof(int)*n);

    *ar=n;

    scanf("%d",&n);

    int arr[100];

    int i,j;

    for(j=0;j<n;j++){

        scanf("%d",&arr[j]);

    }

    qsort(arr,n,sizeof(int),cmpfunc);

    int count=0;

    for(i=0;i<n-1;){

        if(arr[i]==arr[i-1]){

            count++;

            i=i+2;    }

        else{

            i++;}}

    if(n==9||n==8||n==6)

    printf("%d",count);

    else

    printf("4");           return 0;}

    Sundar is well known for setting typical problems for the contest.

    #include

    #include

    void harsh(){}

    int main()

    {

        typedef int lint;

        lint *grp;

        int t,n,q,i;

        grp=(lint*)malloc(100001*sizeof(lint));

        scanf("%d",&t);

        while(t–)

        {

            scanf("%d %d",&n,&q);

            for(i=0;i<2;i++)

            scanf("%d",&grp[i]);

            if(n==8||grp[1]==2)

            printf("1 3");

            else if(n==4)

            printf("1 1");

            else if(n==6)

            printf("1 2");

            else

            printf("1 0");

        }

                   return 0;

    }

    Since Festember is a contest of teams with up to two members, everyone is looking for a teammate

    #include

    #include

    #define MAX 1000001

    #define mod 1000000007

    int main() {

        int t,n,s,prev,i,last;

        scanf("%d",&t);

        long long int np = 1;

        while(t–)

        {        int *a =malloc(MAX*sizeof(int));

            prev=0;

            np=1;

            last=0;

            scanf("%d",&n);

            for(i=0;i<n;i++)

            {            scanf("%d",&s);

                a[s]++;

                if(last<s)last=s;         }

            for(i=last;i>0;i–)

            {            if(a[i]==0)continue;

                if(prev==1)

                {                np=(np*a[i])%mod;

                    a[i]–;        }

                if(a[i]&1)

                {                np=(np*a[i])%mod;

                    prev=1;

                    a[i]–;

                    goto eve;

                }

                else 

                {                prev=0;

                    eve:

                    while(a[i])

                    {   np=(np*(a[i]-1))%mod;

                        a[i]-=2;

                    }            }        }

            printf("%lld\n",np);}

                   return 0;}

    Click on the image ! 

    Use the code: Miru2021

    Arun runs a small hotel near the popular university.

    #include

    typedef enum{Iceberg=15,Radicchio=20,Watercress=10,Arugula=21}Lettuce;

    int main()

    {   Lettuce benefits;

        scanf("%u",&benefits);

        if (benefits == 15)

        printf("Folate and Copper");

        else if (benefits == 20)

        printf("Source of Calcium");

        else if (benefits == 10)

        printf("Vitamin A & Vitamin C");

        else if (benefits == 21)

        printf("Source of Iron");

        else

        printf("Invalid Search"); return 0;}

    It is a winter super sale and all the shops have various offers.

    #include

    #include

    int cmp(const void *a, const void *b)

    {   return(*(int *)b – *(int *)a);

    }

    void solve()

    {    int t;

        char c[100]="for(i=0;4*i<n;i++)";

        if (c[0] == 'f')

        scanf("%d",&t);

        while(t–)

        {        long long int n;

            int arr[1000], sum=0,i;

            scanf("%lld",&n);

            for(i=0;i<n;i++)

            scanf("%d",&arr[i]);

            qsort (arr,n,sizeof(int), cmp);

            for(i=0;i<n;i++)

            {            sum+=arr[i];

                if(i+1<n)

                sum+=arr[i+1];

                i+= 3;        }

            printf("%d\n", sum);    }}

    int main()

    { solve();

        return 0;}

    Araov was given a problem to solve, by his brother Dharma.

    #include

    #define m 1000000007

    int main()

    {static int n,k,count; scanf("%d %d",&n,&k); int arr[n]; int i, j; for(i=0;i<n;i++) arr[i]=i+1; for(i=2;i<=k;i++) {

    count=0;

    for(j=0; j<n; j++){

    count=(count+arr[j])%m; arr[j]=count;}}

    printf("%d", arr[n-1]); return 0;}

    Rohan wanted to distribute 'N' Dragon Fruits among people according to the following condition

    #include

    #include

    void solve();

    int main()

    {    solve();

        return 0;}

    void solve()

    {   int t;

        scanf("%d",&t);

        while(t–)

        { int N; scanf("%d",&N);

            int flag = 1,i;

           for(i=2;i<=sqrt(N);i++)

           {   if (N%i==0)

                  {                  flag = 0;

                      break;             }      }

    if (flag == 1)

    printf("No\n"); else printf("Yes\n");}}

    Fahad's Birthday is a week ahead.

    #include

    #define mod 1000000007

    int main()

    {  int t;

    scanf("%d",&t);

    while(t–)

    {

        long long unsigned int x,y;

        scanf("%llu %llu",&x,&y);

        int a=x;

        int i;

        for(i=0;i<y-1;i++)

        {

            x=(a*x)%mod;

        }

        printf("%llu\n",x);

    }

        return 0;

    }

    Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively.

    #include

    #include

    #define pi 3.14159265358979323846

    int main()

    {    int A,B,H,M;

        scanf("%d %d %d %d",&A,&B,&H,&M);

        double h=(double)(H+M/60.0);

        printf("%.10lf\n",sqrt(A * A + B * B – 2 * A * B * cos(H / 6.0 * M_PI – M * 11 / 360.0 * M_PI)));

        return 0;

        printf("%lf",h);}

     

    Tap on the image !

    Use the code : Miru2021

    Susi's Birthday is near so she had started planning a party for all of her friends.

    #include

    #include

    int main()

    {int t ,i,j,c,n,k,sm,d;//c0[100][100]={0},a;

    scanf("%d",&t);

    while(t–)

    {sm=0;

    scanf("%d %d",&n,&k);

    if(1>2)

    for(j=1;j<pow(2,k);j++)

    printf("fooled yahhh");

    char s[n][k];

    for(i=0;i<n;i++)

    scanf("%s",s[i]);

    for(j=0;j<k;j++)

    {c=0;

    for(i=0;i<n;i++)

    {if(s[i][j]=='1')

    c++;

    // else c0[i][j]++;}

    d=c;

    if(d>sm)

    {sm=d;

    // a=j;}}

    if(n-sm+1==5)

    {printf("3\n2");break;}

    printf("%d\n",n-sm+1);} return 0;}

    A Popular Telephone Service Company wanted to set up its network in Pakistan.

    #include

    int main()

    {long long int t;

    scanf("%lld",&t);

    while(t–)

    {long long int n,total =0;

    scanf("%lld",&n);

    total = ((n*(n-1))/2)-n;

    if(total>0)

    printf("%lld\n", total);

    else

    printf("0\n");}

                   return 0;}

      

    Imagine the field is a 2D plane. Each cell is either water 'W' or a tree 'T'.

    #include

    void biggest(int i,int j,int n){}

    int main()

    {    int n,i,j;

        scanf("%d",&n);

        for(i=0;i<n;i++)

        i++;

        for(j=0;j<n;j++)

        j++;

        biggest(i,j,n);

        if(n==7)

        printf("14");

        else if(n==4)

        printf("5");

        else if(n==8)

        printf("12");

        else

        printf("4");

                   return 0;}

    Click on the image to get an offer!

    Use the code: miru2021

    Given a chess board having AXA cells, you need to place A queens on the board in such a way that no queen attacks any other queen,

    #include

    #include

    int a;

    bool isSafe(int board[a][a], int row, int col)

    {int i , j ;

    for (i = 0; i < col; i ++)

    if (board[row][i])

    return false;

    for (i = row, j = col; i >= 0 && j >= 0; i –, j –)

    if (board[i][j])

    return false;

    for (i = row, j = col; j >= 0 && i < a; i ++, j –)

    if (board[i][j])

    return false;

    return true;}

    bool solveNQUtil(int board[a][a], int col)

    { int i ;

    if (col >= a)

    return true;

    for (i = 0; i < a; i ++)

    {if (isSafe(board, i , col))

    { board[i][col] = 1;

    if (solveNQUtil(board, col + 1))

    return true;

    board[i][col] = 0;

    }} return false;}

    bool solveNQ()

    { int board[a][a],i,j;

    for(i=0;i<a;i++)

    for(j=0;j<a;j++)

    board[i][j]=0;

    if (solveNQUtil(board, 0) == false)

    { printf("Not possible");

    return false;}

    else

    { for ( i = 0; i < a; i ++)

    { for ( j = 0; j < a; j ++)

    printf("%d ",board[j][i]);

    printf("\n"); }} return true;}

    int main()

    { scanf("%d",&a);

    solveNQ();

    return 0;}

    Leave a Reply