#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int t,count=0;
scanf("%d",&t);
for(int a0 = 0; a0 < t; a0++){
count=0;
int n;
int k;
scanf("%d %d",&n,&k);
int a[n];
for(int a_i = 0; a_i < n; a_i++){
scanf("%d",&a[a_i]);
}
for(int a_i = 0; a_i < n; a_i++){
if(a[a_i]<=0)
count++;
}
if(count<k)
printf("YES\n");
else
printf("NO\n");
//count=0;
}
return 0;
}
C language
Angry professor
Telegram- https://t.me/Coding_human
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int t,count=0;
scanf("%d",&t);
for(int a0 = 0; a0 < t; a0++){
count=0;
int n;
int k;
scanf("%d %d",&n,&k);
int a[n];
for(int a_i = 0; a_i < n; a_i++){
scanf("%d",&a[a_i]);
}
for(int a_i = 0; a_i < n; a_i++){
if(a[a_i]<=0)
count++;
}
if(count<k)
printf("YES\n");
else
printf("NO\n");
//count=0;
}
return 0;
}
C language
Angry professor
Telegram- https://t.me/Coding_human
#include<stdio.h>
#include<math.h>
int isPerfectSquare(int number)
{
int iVar;
float fVar;
fVar=pow(number,1.0/3.0);
iVar=(int)fVar;
if(iVar==fVar)
return number;
else
return 0;
}
@Coding_human
int main()
{
int n;
scanf(ā%dā,&n);
int arr[n];
int i;
for(i = 0; i < n; i++)
{
scanf("%d",&arr[i]);
}
int count = 0;
for(i = 0; i < n; i++)
{
if(isPerfectSquare(arr[i]))
count++;
}
printf("%d",count);
return 0;
}
E-Commerce
Telegram - https://t.me/Coding_human
#include<math.h>
int isPerfectSquare(int number)
{
int iVar;
float fVar;
fVar=pow(number,1.0/3.0);
iVar=(int)fVar;
if(iVar==fVar)
return number;
else
return 0;
}
@Coding_human
int main()
{
int n;
scanf(ā%dā,&n);
int arr[n];
int i;
for(i = 0; i < n; i++)
{
scanf("%d",&arr[i]);
}
int count = 0;
for(i = 0; i < n; i++)
{
if(isPerfectSquare(arr[i]))
count++;
}
printf("%d",count);
return 0;
}
E-Commerce
Telegram - https://t.me/Coding_human
#include <iostream>
using namespace std;
// Function to find and print pair
bool chkPair(int A[], int size, int x) {
for (int i = 0; i < (size - 1); i++) {
for (int j = (i + 1); j < size; j++) {
if (A[i] + A[j] == x) {
cout << "Pair with a given sum " << x << " is (" << A[i] << ", " << A[j] << ")"
<< endl;
return 1;
}
}
}
return 0;
}
@Coding_human
int main(void) {
int A[] = {0, -1, 2, -3, 1};
int x = -2;
int size = sizeof(A) / sizeof(A[0]);
if (chkPair(A, size, x)) {
cout << "Valid pair exists" << endl;
}
else {
cout << "No valid pair exists for " << x << endl;
}
return 0;
}
C++
This C++ program tells if there exists a pair in array whose sum results in x.
Telegram - https://t.me/Coding_human
#include <stdio.h>
int fact(int num){
if(num>1){
return num*fact(num-1);
}@Coding_human
else if(num<=1){
return 1;
} }
int main() {
int n,p,res;
scanf("%d",&n);
scanf("%d",&p);
res = fact(n)/(fact(p)*fact(n-p));
printf("%d",res);
return 0;
}
Pollution code
@Coding_human
@Coding_human
@Coding_human
@Coding_human
int fact(int num){
if(num>1){
return num*fact(num-1);
}@Coding_human
else if(num<=1){
return 1;
} }
int main() {
int n,p,res;
scanf("%d",&n);
scanf("%d",&p);
res = fact(n)/(fact(p)*fact(n-p));
printf("%d",res);
return 0;
}
Pollution code
@Coding_human
@Coding_human
@Coding_human
@Coding_human
#include<stdio.h>
int main(){
int a,b[20];
@Coding_human
scanf("%d",&a);
scanf("%d",&b);
if(a==5){
printf("No");
else
printf("Yes");
return 0;
}
C programming
John code @Coding_human
int main(){
int a,b[20];
@Coding_human
scanf("%d",&a);
scanf("%d",&b);
if(a==5){
printf("No");
else
printf("Yes");
return 0;
}
C programming
John code @Coding_human
#include<stdio.h>
int main()@Coding_human
{
int a,b[20];
scanf("%d",&a);
scanf("%d",&b);
if(a==5){
printf("No");
else
printf("Yes");
return 0;
}
C programming
Research Lab
š
@Coding_human
@Coding_human
int main()@Coding_human
{
int a,b[20];
scanf("%d",&a);
scanf("%d",&b);
if(a==5){
printf("No");
else
printf("Yes");
return 0;
}
C programming
Research Lab
š
@Coding_human
@Coding_human
#include <stdio.h>
int main() {
int a[1000],n,i,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
@Coding_human
}
for(i=0;i<n;i++)
{
if(a[i]<0)
sum++;
}
printf("%d",sum);
return 0;
}
Space world
Wipro
Telegram- @Coding_human
int main() {
int a[1000],n,i,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
@Coding_human
}
for(i=0;i<n;i++)
{
if(a[i]<0)
sum++;
}
printf("%d",sum);
return 0;
}
Space world
Wipro
Telegram- @Coding_human
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
set<int> s;
for(int i=0;i<=n;i++)
{
int x;
cin>>x;
s.insert(x);
}
cout<<s.size();
return 0;
}
Primes with a twist Code
š Telegram: @Coding_human
šUnmute this channel to never miss any updates
using namespace std;
int main() {
int n;
cin>>n;
set<int> s;
for(int i=0;i<=n;i++)
{
int x;
cin>>x;
s.insert(x);
}
cout<<s.size();
return 0;
}
Primes with a twist Code
š Telegram: @Coding_human
šUnmute this channel to never miss any updates
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
string str;
cin >> str;
int n = str.length(), ans = 0;
for(int i = 0; i < n; i++){
if(str[i] == '5' || str[i] == '6')
continue;
else
ans += 1;
}
cout << ans << endl;
}
return 0;
}
Beautiful Number
Telegram:- https://t.me/Coding_human
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
string str;
cin >> str;
int n = str.length(), ans = 0;
for(int i = 0; i < n; i++){
if(str[i] == '5' || str[i] == '6')
continue;
else
ans += 1;
}
cout << ans << endl;
}
return 0;
}
Beautiful Number
Telegram:- https://t.me/Coding_human
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll solve(ll n)
{
ll position = 1;
ll m = 1;
while (!(n & m)) {
m = m << 1;
position++;
}
return position;
}
int main() {
// your code goes here
ll n,p;
cin>>n;
vector<int> ans(n);
for(int i=0;i<n;i++)
{
cin>>p;
ans[i] = solve(p+1);
}
for(int i=0;i<n;i++)
cout<<ans[i]<<"\n";
return 0;
}
C++
Telegram:-https://t.me/Coding_human
using namespace std;
#define ll long long int
ll solve(ll n)
{
ll position = 1;
ll m = 1;
while (!(n & m)) {
m = m << 1;
position++;
}
return position;
}
int main() {
// your code goes here
ll n,p;
cin>>n;
vector<int> ans(n);
for(int i=0;i<n;i++)
{
cin>>p;
ans[i] = solve(p+1);
}
for(int i=0;i<n;i++)
cout<<ans[i]<<"\n";
return 0;
}
C++
Telegram:-https://t.me/Coding_human
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int count=0;
int num=arr[0];
for(int i=1;i<n;i++)
{
if(num!=arr[i])
count++;
}
printf("%d",count);
}
Paper and alice
C Language ā ā
Telegram - https://t.me/Coding_human
int main()
{
int n;
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
int count=0;
int num=arr[0];
for(int i=1;i<n;i++)
{
if(num!=arr[i])
count++;
}
printf("%d",count);
}
Paper and alice
C Language ā ā
Telegram - https://t.me/Coding_human
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
int n1,n2,i,j,c;
cin>>n1>>n2;
int a[n1],b[n2];
set<int> s;
for(i=0;i<n1;i++)
{
cin>>a[i];
s.insert(a[i]);
}
for(i=0;i<n2;i++)
{
cin>>b[i];
s.insert(b[i]);
}
vector<int> v(s.begin(),s.end());
c=s.size();
if(c%2==1)
{
c=c/2;
cout<<v[c];
}
else
{
n1=c/2;
n2=n1-1;
float q=(v[n1]+v[n2])/2.0;
cout<<q;
}
return 0;
}
C++ Language
Storeroom code
Telegram - https://t.me/Coding_human
#include<bits/stdc++.h>
using namespace std;
int main() {
int n1,n2,i,j,c;
cin>>n1>>n2;
int a[n1],b[n2];
set<int> s;
for(i=0;i<n1;i++)
{
cin>>a[i];
s.insert(a[i]);
}
for(i=0;i<n2;i++)
{
cin>>b[i];
s.insert(b[i]);
}
vector<int> v(s.begin(),s.end());
c=s.size();
if(c%2==1)
{
c=c/2;
cout<<v[c];
}
else
{
n1=c/2;
n2=n1-1;
float q=(v[n1]+v[n2])/2.0;
cout<<q;
}
return 0;
}
C++ Language
Storeroom code
Telegram - https://t.me/Coding_human
#include<stdio.h>
int main()
{
int n,i,dis,c=0;
scanf("%d %d",&n,&dis);
int order[n];
for(i=0;i<n;i++)
{
scanf("%d",&order[i]);
if(order[i]>0 && dis%order[i]==0)
c++;
}
printf("%d",c);
}
E-commerce code
TG: https://t.me/Coding_human
int main()
{
int n,i,dis,c=0;
scanf("%d %d",&n,&dis);
int order[n];
for(i=0;i<n;i++)
{
scanf("%d",&order[i]);
if(order[i]>0 && dis%order[i]==0)
c++;
}
printf("%d",c);
}
E-commerce code
TG: https://t.me/Coding_human