Skip to content

Commit 042cdff

Browse files
committed
added extention
2 parents 5883945 + b346fce commit 042cdff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1404
-76
lines changed

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at larissalages7@gmail.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CodeChef_problems/Chef and Serves.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
int main(){
4+
int t;
5+
cin>>t;// number of test cases
6+
while(t--)
7+
{
8+
int s,p1,p2,k;
9+
cin>>p1>>p2>>k;
10+
s=int((p1+p2)/k); //no. of times serves will change
11+
if(s%2==0) //check if that number is even or odd
12+
cout<<"CHEF"<<endl;
13+
else
14+
cout<<"COOK"<<endl;
15+
}
16+
17+
}
18+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include<bits/stdc++.h>
2+
#define ll long long
3+
#define N 100000
4+
using namespace std;
5+
6+
vector<ll>adj[N];
7+
vector<ll>vis(N);
8+
void dfs(ll curr)
9+
{
10+
vis[curr]=1;
11+
for(auto neb:adj[curr])
12+
{
13+
if(vis[neb]==0)
14+
dfs(neb);
15+
}
16+
}
17+
int main()
18+
{
19+
ll n,m;
20+
cin>>n>>m;
21+
ll z;
22+
cin>>z;
23+
for(ll i=0;i<m;i++)
24+
{
25+
ll u,v;
26+
cin>>u>>v;
27+
adj[u].push_back(v);
28+
adj[v].push_back(u);
29+
}
30+
for(ll i=0;i<n;i++)
31+
vis[i]=0;
32+
vis[z]=1;
33+
if(z==0)dfs(1);
34+
else
35+
dfs(0);
36+
ll flag=0;
37+
for(ll i=0;i<n;i++)
38+
{
39+
if(!vis[i])
40+
{
41+
flag=1;
42+
break;
43+
}
44+
}
45+
if(flag==0)
46+
cout<<"yes\n";
47+
else
48+
cout<<"no\n";
49+
50+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// nb_9960
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
#define fi(i,a,n) for (ll i=a; i < n; i++)
5+
#define ll long long
6+
7+
int main()
8+
{
9+
ios_base::sync_with_stdio(0);
10+
cin.tie(0);
11+
cout.tie(0);
12+
13+
ll t = 1;
14+
cin >> t;
15+
16+
while (t--) {
17+
ll n;
18+
cin>>n;
19+
ll a[n];
20+
int flg=0;
21+
ll prev;
22+
fi(i,0,n){
23+
cin>>a[i];
24+
}
25+
prev = a[0];
26+
fi(i,1,n){
27+
if(a[i]!=prev){
28+
flg=1;
29+
break;
30+
}
31+
//break;
32+
}
33+
if(flg)
34+
cout<<1<<endl;
35+
else cout<<n<<endl;
36+
}
37+
return 0;
38+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// nb_9960
2+
#include <bits/stdc++.h>
3+
#include<math.h>
4+
using namespace std;
5+
#define MOD 1000000007
6+
#define ll long long int
7+
#define fi(i,a,n) for(ll i=a;i<n;i++)
8+
#define fd(i,a,n) for(ll i=a;i>=n;i--)
9+
#define pb push_back
10+
#define fv(i,a) for(auto i:a)
11+
#define vi vector<int>
12+
13+
int main() {
14+
ll t=1;
15+
cin>>t;
16+
while(t--){
17+
ll n,k;
18+
cin>>n>>k;
19+
ll a[n],b[n],c[n];
20+
ll max=INT_MIN;
21+
ll min=INT_MAX;
22+
fi(i,0,n){
23+
cin>>a[i];
24+
if(a[i]>max){
25+
max=a[i];
26+
}
27+
if(a[i]<min){
28+
min=a[i];
29+
}
30+
}
31+
fi(i,0,n){
32+
b[i]=max-a[i];
33+
c[i]=(max-min)-b[i];
34+
}
35+
if(n==1){
36+
cout<<0;
37+
}else if(k%2==0){
38+
fi(i,0,n){
39+
cout<<c[i]<<" ";
40+
}
41+
}else{
42+
fi(i,0,n){
43+
cout<<b[i]<<" ";
44+
}
45+
}
46+
cout<<"\n";
47+
48+
49+
}
50+
return 0;
51+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// nb_9960
2+
#include <bits/stdc++.h>
3+
#include<math.h>
4+
using namespace std;
5+
#define MOD 1000000007
6+
#define ll long long int
7+
#define fi(i,a,n) for(ll i=a;i<n;i++)
8+
#define fd(i,a,n) for(ll i=a;i>=n;i--)
9+
#define pb push_back
10+
#define fv(i,a) for(auto i:a)
11+
#define vi vector<int>
12+
13+
int main() {
14+
ll t=1;
15+
cin>>t;
16+
while(t--){
17+
ll n;
18+
cin>>n;
19+
ll a[n],diff[n];
20+
fi(i,0,n){
21+
cin>>a[i];
22+
}
23+
fi(i,0,n-1){
24+
diff[i]=a[i]-a[i+1];
25+
}
26+
ll ans=0;
27+
fi(i,0,n-1){
28+
if(diff[i]>0){
29+
ans+=diff[i];
30+
}
31+
}
32+
cout<<ans<<endl;
33+
}
34+
return 0;
35+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// nb_9960
2+
#include<bits/stdc++.h>
3+
#define ll long long
4+
using namespace std;
5+
int main(){
6+
int t;
7+
cin>>t;
8+
while(t--){
9+
ll n;
10+
cin>>n;
11+
string s;
12+
cin>>s;
13+
int ans = 0,i=1,c=0,j;
14+
for(;i<n;i++){
15+
if(s[i] == s[i-1]);
16+
else break;
17+
}
18+
s=s+s+s;
19+
for(j = i;j<i+n;j++){
20+
if(s[j] == s[j-1] && s[j] == s[j+1])
21+
c++;
22+
else{
23+
ans+=ceil(c/3.0);
24+
c = 0;
25+
}
26+
}
27+
cout<<ans + ceil(c/3.0)<<endl;
28+
}
29+
}

InterviewBit/All_Factors.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
vector<int> Solution::allFactors(int A) {
2+
vector<int>v;
3+
for(int i=1;i<=sqrt(A);i++)
4+
{
5+
if(A%i==0)
6+
{
7+
v.push_back(i);
8+
if(i!=sqrt(A))
9+
{
10+
v.push_back(A/i);
11+
}
12+
}
13+
}
14+
sort(v.begin(),v.end());
15+
return v;
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
string Solution::findDigitsInBinary(int A) {
2+
if(A==0)
3+
{
4+
return "0";
5+
}
6+
string num;
7+
while(A>0)
8+
{
9+
string i=to_string(A%2);
10+
num+=i;
11+
A=A/2;
12+
}
13+
reverse(num.begin(),num.end());
14+
return num;
15+
}

0 commit comments

Comments
 (0)