Skip to content

Commit ff4b90c

Browse files
committed
cf round 696
1 parent fc9d9a2 commit ff4b90c

37 files changed

+4381
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
*/
5+
#include <bits/stdc++.h>
6+
#include <ext/pb_ds/assoc_container.hpp>
7+
#include <ext/pb_ds/tree_policy.hpp>
8+
using namespace std;
9+
using namespace __gnu_pbds;
10+
typedef long long ll ;
11+
typedef vector<ll> vl;
12+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
13+
/* Abbrevations */
14+
#define ff first
15+
#define ss second
16+
#define mp make_pair
17+
#define line cout<<endl;
18+
#define pb push_back
19+
#define Endl "\n"
20+
// loops
21+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
22+
// Some print
23+
#define no cout<<"NO"<<endl;
24+
#define yes cout<<"YES"<<endl;
25+
// sort
26+
#define all(V) (V).begin(),(V).end()
27+
#define srt(V) sort(all(V))
28+
#define srtGreat(V) sort(all(V),greater<ll>())
29+
// some extra
30+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
31+
#define precision(x) cout<<fixed<<setprecision(x);
32+
#define sz(V) ll(V.size())
33+
// template
34+
template <typename T>
35+
T mymax(T x,T y)
36+
{
37+
return (x>y)?x:y;
38+
}
39+
// function
40+
// void kickstart()
41+
// {
42+
43+
// }
44+
ll power(ll x,ll y,ll mod)
45+
{
46+
ll res=1;
47+
// x=x%mod;
48+
while(y>0)
49+
{
50+
if(y%2==1)
51+
{
52+
res*=x;
53+
// res=res%mod;
54+
}
55+
y/=2; x*=x; // x=x%mod;
56+
}
57+
return res;
58+
}
59+
ll str_to_num(string s)
60+
{
61+
return stoi(s);
62+
}
63+
64+
string num_to_str(ll num)
65+
{
66+
return to_string(num);
67+
}
68+
// datatype definination
69+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
70+
class Point
71+
{
72+
public:
73+
ll x;
74+
ll y;
75+
ll z;
76+
ll getsum()
77+
{
78+
return x+y+z;
79+
}
80+
};
81+
/* ascii value
82+
A=65,Z=90,a=97,z=122
83+
*/
84+
/* -----------------------------------------------------------------------------------*/
85+
// to run ctrl+b
86+
87+
ll solve()
88+
{
89+
ll n,k;
90+
cin>>n>>k;
91+
ll ans=0;
92+
map<ll,ll> m;
93+
ll temp;
94+
for(ll i=0;i<n;i++)
95+
{
96+
cin>>temp;
97+
m[temp]++;
98+
}
99+
for(ll i=0;i<1000000000;i++)
100+
{
101+
if(k<=0)
102+
break;
103+
else
104+
{
105+
if(m[i]<k)
106+
{
107+
k--;
108+
ans+=i;
109+
i--;
110+
}
111+
}
112+
}
113+
cout<<ans<<endl;
114+
return 0;
115+
}
116+
117+
int main()
118+
{
119+
speed;
120+
/* #ifndef ONLINE_JUDGE
121+
freopen("input.txt","r",stdin);
122+
freopen("output.txt","w",stdout);
123+
#endif */
124+
ll TestCase=1;
125+
// cin>>TestCase;
126+
while(TestCase--)
127+
{
128+
solve();
129+
}
130+
}
131+
132+
/* stuff you should look before submission
133+
* int overflow
134+
* special test case (n=0||n=1||n=2)
135+
* don't get stuck on one approach if you get wrong answer
136+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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<ll,ll> ml;
18+
typedef set<string> ss;
19+
typedef set<char>sc;
20+
typedef set<int> si;
21+
typedef set<ll> sl;
22+
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
23+
// define values.
24+
#define mod 1000000007
25+
#define phi 1.618
26+
/* Bit-Stuff */
27+
#define get_set_bits(a) (__builtin_popcount(a))
28+
#define get_set_bitsll(a) ( __builtin_popcountll(a))
29+
#define get_trail_zero(a) (__builtin_ctz(a))
30+
#define get_lead_zero(a) (__builtin_clz(a))
31+
#define get_parity(a) (__builtin_parity(a))
32+
/* Abbrevations */
33+
#define ff first
34+
#define ss second
35+
#define mp make_pair
36+
#define line cout<<endl;
37+
#define pb push_back
38+
#define Endl "\n"
39+
// loops
40+
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
41+
#define loop0(num) for(ll i=0;i<ll(num);i++)
42+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
43+
// Some print
44+
#define no cout<<"NO"<<endl;
45+
#define yes cout<<"YES"<<endl;
46+
#define cc ll test;cin>>test;while(test--)
47+
// sort
48+
#define all(V) (V).begin(),(V).end()
49+
#define srt(V) sort(all(V))
50+
#define srtGreat(V) sort(all(V),greater<ll>())
51+
// function
52+
53+
ll power(ll x,ll y)
54+
{
55+
ll res=1;
56+
while(y>0)
57+
{
58+
if(y%2==1)res*=x;
59+
y/=2; x*=x;
60+
}
61+
return res;
62+
}
63+
/* ascii value
64+
A=65,Z=90,a=97,z=122
65+
*/
66+
/* -----------------------------------------------------------------------------------*/
67+
ll solve()
68+
{
69+
ll d,t,s;
70+
cin>>d>>t>>s;
71+
if((s*t)>=d)
72+
cout<<"Yes"<<endl;
73+
else
74+
cout<<"No"<<endl;
75+
return 0;
76+
}
77+
78+
int main()
79+
{
80+
//freopen("input.txt"a, "r", stdin);
81+
// cc
82+
// {
83+
solve();
84+
// }
85+
}
+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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<ll,ll> ml;
18+
typedef set<string> ss;
19+
typedef set<char>sc;
20+
typedef set<int> si;
21+
typedef set<ll> sl;
22+
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
23+
// define values.
24+
#define mod 1000000007
25+
#define phi 1.618
26+
/* Bit-Stuff */
27+
#define get_set_bits(a) (__builtin_popcount(a))
28+
#define get_set_bitsll(a) ( __builtin_popcountll(a))
29+
#define get_trail_zero(a) (__builtin_ctz(a))
30+
#define get_lead_zero(a) (__builtin_clz(a))
31+
#define get_parity(a) (__builtin_parity(a))
32+
/* Abbrevations */
33+
#define ff first
34+
#define ss second
35+
#define mp make_pair
36+
#define line cout<<endl;
37+
#define pb push_back
38+
#define Endl "\n"
39+
// loops
40+
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
41+
#define loop0(num) for(ll i=0;i<ll(num);i++)
42+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
43+
// Some print
44+
#define no cout<<"NO"<<endl;
45+
#define yes cout<<"YES"<<endl;
46+
#define cc ll test;cin>>test;while(test--)
47+
// sort
48+
#define all(V) (V).begin(),(V).end()
49+
#define srt(V) sort(all(V))
50+
#define srtGreat(V) sort(all(V),greater<ll>())
51+
// function
52+
53+
ll power(ll x,ll y)
54+
{
55+
ll res=1;
56+
while(y>0)
57+
{
58+
if(y%2==1)res*=x;
59+
y/=2; x*=x;
60+
}
61+
return res;
62+
}
63+
/* ascii value
64+
A=65,Z=90,a=97,z=122
65+
*/
66+
/* -----------------------------------------------------------------------------------*/
67+
ll solve()
68+
{
69+
string s,t;
70+
cin>>s>>t;
71+
ll maxo=1000001;
72+
ll count=1000001;
73+
for(ll i=0;i<s.length();i++)
74+
{
75+
if(ll(i+t.length())<=ll(s.length()))
76+
{
77+
// cout<<"hi "<<endl;
78+
count=0;
79+
ll pos=0;
80+
for(ll j=i;j<ll(i+t.length());j++)
81+
{
82+
if(s[j]!=t[pos])
83+
count++;
84+
pos++;
85+
}
86+
}
87+
// cout<<count<<endl;
88+
maxo=min(maxo,count);
89+
}
90+
cout<<maxo<<endl;
91+
return 0;
92+
}
93+
94+
int main()
95+
{
96+
//freopen("input.txt"a, "r", stdin);
97+
// cc
98+
// {
99+
solve();
100+
// }
101+
}

0 commit comments

Comments
 (0)