Skip to content

Commit 4ba97df

Browse files
authored
Revert "Moving zeroes to end"
1 parent be8d389 commit 4ba97df

File tree

784 files changed

+68568
-23
lines changed

Some content is hidden

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

784 files changed

+68568
-23
lines changed

CP.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
body
2+
{
3+
padding: 0;
4+
margin: 0;
5+
}
6+
.first
7+
{
8+
min-height: 96vh;
9+
}
10+
.list-group-item a
11+
{
12+
font-size: 20px;
13+
}
14+
.list-group-item a:hover
15+
{
16+
text-decoration: none;
17+
}
18+
.list-group-item:hover
19+
{
20+
background-color: #eee;
21+
}
22+
footer
23+
{
24+
height: 35px;
25+
padding-top: 10px;
26+
background-color: rgba(214, 241, 239, 0.75);
27+
font-size: 15px;
28+
font-weight: 200;
29+
30+
}
31+
footer p
32+
{
33+
opacity: 0.825;
34+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
using namespace std;
7+
typedef long long ll ;
8+
typedef set<pair<int,int>> spi;
9+
typedef set<pair<ll,ll>> spl;
10+
typedef vector<pair<int,int>> vpi;
11+
typedef vector<int> vi;
12+
typedef vector<ll> vl;
13+
typedef vector<bool> vb;
14+
typedef vector<char> vc;
15+
typedef vector<pair<ll,ll>> vpl;
16+
typedef vector<string> vs;
17+
typedef map<int,int>mi;
18+
typedef map<ll,ll> ml;
19+
typedef set<string> ss;
20+
typedef set<char>sc;
21+
typedef set<int> si;
22+
typedef set<ll> sl;
23+
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
24+
// define values.
25+
#define mod 1000000007
26+
#define phi 1.618
27+
/* Bit-Stuff */
28+
#define get_set_bits(a) (__builtin_popcount(a))
29+
#define get_set_bitsll(a) ( __builtin_popcountll(a))
30+
#define get_trail_zero(a) (__builtin_ctz(a))
31+
#define get_lead_zero(a) (__builtin_clz(a))
32+
#define get_parity(a) (__builtin_parity(a))
33+
/* Abbrevations */
34+
#define ff first
35+
#define ss second
36+
#define mp make_pair
37+
#define line cout<<endl;
38+
#define pb push_back
39+
#define Endl "\n"
40+
// loops
41+
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
42+
#define loop0(num) for(ll i=0;i<ll(num);i++)
43+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
44+
// Some print
45+
#define no cout<<"NO"<<endl;
46+
#define yes cout<<"YES"<<endl;
47+
#define cc ll test;cin>>test;while(test--)
48+
// sort
49+
#define all(V) (V).begin(),(V).end()
50+
#define srt(V) sort(all(V))
51+
#define srtGreat(V) sort(all(V),greater<ll>())
52+
// function
53+
54+
ll power(ll x,ll y)
55+
{
56+
ll res=1;
57+
while(y>0)
58+
{
59+
if(y%2==1)res*=x;
60+
y/=2; x*=x;
61+
}
62+
return res;
63+
}
64+
/* ascii value
65+
A=65,Z=90,a=97,z=122
66+
*/
67+
/* -----------------------------------------------------------------------------------*/
68+
69+
70+
int main()
71+
{
72+
ll n;
73+
cin>>n;
74+
ll mini=LONG_LONG_MAX;
75+
vl v(n,0);
76+
forin(v,n);
77+
ll total=0;
78+
total = accumulate(v.begin(),v.end(),total);
79+
for(ll i=0;i<1<<n;i++)
80+
{
81+
ll sum=0;
82+
loop(j,0,n)
83+
{
84+
if(i&1<<j)
85+
sum+=v[j];
86+
}
87+
ll diff=abs(total-2*sum);
88+
mini=min(mini,diff);
89+
}
90+
cout<<mini<<endl;
91+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
using namespace std;
7+
typedef long long ll ;
8+
typedef set<pair<int,int>> spi;
9+
typedef set<pair<ll,ll>> spl;
10+
typedef vector<pair<int,int>> vpi;
11+
typedef vector<int> vi;
12+
typedef vector<ll> vl;
13+
typedef vector<bool> vb;
14+
typedef vector<char> vc;
15+
typedef vector<pair<ll,ll>> vpl;
16+
typedef vector<string> vs;
17+
typedef map<int,int>mi;
18+
typedef map<ll,ll> ml;
19+
typedef set<string> ss;
20+
typedef set<char>sc;
21+
typedef set<int> si;
22+
typedef set<ll> sl;
23+
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
24+
// define values.
25+
#define mod 1000000007
26+
#define phi 1.618
27+
/* Bit-Stuff */
28+
#define get_set_bits(a) (__builtin_popcount(a))
29+
#define get_set_bitsll(a) ( __builtin_popcountll(a))
30+
#define get_trail_zero(a) (__builtin_ctz(a))
31+
#define get_lead_zero(a) (__builtin_clz(a))
32+
#define get_parity(a) (__builtin_parity(a))
33+
/* Abbrevations */
34+
#define ff first
35+
#define ss second
36+
#define mp make_pair
37+
#define line cout<<endl;
38+
#define pb push_back
39+
#define Endl "\n"
40+
// loops
41+
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
42+
#define loop0(num) for(ll i=0;i<ll(num);i++)
43+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
44+
// Some print
45+
#define no cout<<"NO"<<endl;
46+
#define yes cout<<"YES"<<endl;
47+
#define cc ll test;cin>>test;while(test--)
48+
// sort
49+
#define all(V) (V).begin(),(V).end()
50+
#define srt(V) sort(all(V))
51+
#define srtGreat(V) sort(all(V),greater<ll>())
52+
// function
53+
54+
ll power(ll x,ll y)
55+
{
56+
ll res=1;
57+
while(y>0)
58+
{
59+
if(y%2==1)res*=x;
60+
y/=2; x*=x;
61+
}
62+
return res;
63+
}
64+
/* ascii value
65+
A=65,Z=90,a=97,z=122
66+
*/
67+
/* -----------------------------------------------------------------------------------*/
68+
69+
ll power_mod(ll n)
70+
{
71+
ll ans=1;
72+
loop(i,0,n)
73+
{
74+
ans=(ans*2)%mod;
75+
}
76+
return ans;
77+
}
78+
int main()
79+
{
80+
ll n;
81+
cin>>n;
82+
cout<<power_mod(n)<<endl;
83+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
using namespace std;
7+
typedef long long ll ;
8+
typedef set<pair<int,int>> spi;
9+
typedef set<pair<ll,ll>> spl;
10+
typedef vector<pair<int,int>> vpi;
11+
typedef vector<int> vi;
12+
typedef vector<ll> vl;
13+
typedef vector<bool> vb;
14+
typedef vector<char> vc;
15+
typedef vector<pair<ll,ll>> vpl;
16+
typedef vector<string> vs;
17+
typedef map<int,int>mi;
18+
typedef map<ll,ll> ml;
19+
typedef set<string> ss;
20+
typedef set<char>sc;
21+
typedef set<int> si;
22+
typedef set<ll> sl;
23+
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
24+
// define values.
25+
#define mod 1000000007
26+
#define phi 1.618
27+
/* Bit-Stuff */
28+
#define get_set_bits(a) (__builtin_popcount(a))
29+
#define get_set_bitsll(a) ( __builtin_popcountll(a))
30+
#define get_trail_zero(a) (__builtin_ctz(a))
31+
#define get_lead_zero(a) (__builtin_clz(a))
32+
#define get_parity(a) (__builtin_parity(a))
33+
/* Abbrevations */
34+
#define ff first
35+
#define ss second
36+
#define mp make_pair
37+
#define line cout<<endl;
38+
#define pb push_back
39+
#define Endl "\n"
40+
// loops
41+
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
42+
#define loop0(num) for(ll i=0;i<ll(num);i++)
43+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
44+
// Some print
45+
#define no cout<<"NO"<<endl;
46+
#define yes cout<<"YES"<<endl;
47+
#define cc ll test;cin>>test;while(test--)
48+
// sort
49+
#define all(V) (V).begin(),(V).end()
50+
#define srt(V) sort(all(V))
51+
#define srtGreat(V) sort(all(V),greater<ll>())
52+
// function
53+
54+
ll power(ll x,ll y)
55+
{
56+
ll res=1;
57+
while(y>0)
58+
{
59+
if(y%2==1)res*=x;
60+
y/=2; x*=x;
61+
}
62+
return res;
63+
}
64+
/* ascii value
65+
A=65,Z=90,a=97,z=122
66+
*/
67+
/* -----------------------------------------------------------------------------------*/
68+
69+
70+
int main()
71+
{
72+
cc
73+
{
74+
ll a,b;
75+
cin>>a>>b;
76+
if(a<b)
77+
swap(a,b);
78+
if(a>2*b)
79+
no
80+
else
81+
{
82+
if((a+b)%3==0)
83+
yes
84+
else
85+
no
86+
}
87+
}
88+
89+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
using namespace std;
7+
typedef long long ll ;
8+
typedef set<pair<int,int>> spi;
9+
typedef set<pair<ll,ll>> spl;
10+
typedef vector<pair<int,int>> vpi;
11+
typedef vector<int> vi;
12+
typedef vector<ll> vl;
13+
typedef vector<bool> vb;
14+
typedef vector<char> vc;
15+
typedef vector<pair<ll,ll>> vpl;
16+
typedef vector<string> vs;
17+
typedef map<int,int>mi;
18+
typedef map<ll,ll> ml;
19+
typedef set<string> ss;
20+
typedef set<char>sc;
21+
typedef set<int> si;
22+
typedef set<ll> sl;
23+
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
24+
// define values.
25+
#define mod 1000000007
26+
#define phi 1.618
27+
/* Bit-Stuff */
28+
#define get_set_bits(a) (__builtin_popcount(a))
29+
#define get_set_bitsll(a) ( __builtin_popcountll(a))
30+
#define get_trail_zero(a) (__builtin_ctz(a))
31+
#define get_lead_zero(a) (__builtin_clz(a))
32+
#define get_parity(a) (__builtin_parity(a))
33+
/* Abbrevations */
34+
#define ff first
35+
#define ss second
36+
#define mp make_pair
37+
#define line cout<<endl;
38+
#define pb push_back
39+
#define Endl "\n"
40+
// loops
41+
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
42+
#define loop0(num) for(ll i=0;i<ll(num);i++)
43+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
44+
// Some print
45+
#define no cout<<"NO"<<endl;
46+
#define yes cout<<"YES"<<endl;
47+
#define cc ll test;cin>>test;while(test--)
48+
// sort
49+
#define all(V) (V).begin(),(V).end()
50+
#define srt(V) sort(all(V))
51+
#define srtGreat(V) sort(all(V),greater<ll>())
52+
// function
53+
54+
ll power(ll x,ll y)
55+
{
56+
ll res=1;
57+
while(y>0)
58+
{
59+
if(y%2==1)res*=x;
60+
y/=2; x*=x;
61+
}
62+
return res;
63+
}
64+
/* ascii value
65+
A=65,Z=90,a=97,z=122
66+
*/
67+
/* -----------------------------------------------------------------------------------*/
68+
69+
70+
int main()
71+
{
72+
string s;
73+
cin>>s;
74+
srt(s);
75+
string check=s;
76+
vector<string> v;
77+
v.pb(s);
78+
while(1)
79+
{
80+
next_permutation(s.begin(),s.end());
81+
if(s==check)
82+
break;
83+
else
84+
v.pb(s);
85+
}
86+
cout<<v.size()<<endl;
87+
for(auto s:v)
88+
cout<<s<<endl;
89+
90+
}

0 commit comments

Comments
 (0)