Skip to content

Commit 5e1c64e

Browse files
committed
codeforces and atcoder contest
1 parent b7ade24 commit 5e1c64e

14 files changed

+2326
-0
lines changed
+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
Institute: National Institute of Technology, Uttarakhand
5+
*/
6+
#include <bits/stdc++.h>
7+
#include <ext/pb_ds/assoc_container.hpp>
8+
#include <ext/pb_ds/tree_policy.hpp>
9+
using namespace std;
10+
using namespace __gnu_pbds;
11+
typedef long long ll ;
12+
typedef vector<ll> vl;
13+
typedef vector<vector<ll>> vvl;
14+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
15+
/* Abbrevations */
16+
#define ff first
17+
#define ss second
18+
#define mp make_pair
19+
#define line cout<<endl;
20+
#define pb push_back
21+
// loops
22+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
23+
// Some print
24+
#define no cout<<"NO"<<endl;
25+
#define yes cout<<"YES"<<endl;
26+
// sort
27+
#define all(V) (V).begin(),(V).end()
28+
#define srt(V) sort(all(V))
29+
#define srtGreat(V) sort(all(V),greater<ll>())
30+
// some extra
31+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
32+
#define precision(x) cout<<fixed<<setprecision(x);
33+
#define sz(V) ll(V.size())
34+
// datatype definination
35+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
36+
37+
38+
ll ppow(ll n, ll m, ll mod){
39+
if(m==0) return 1;
40+
ll tmp=ppow(n, m/2, mod);
41+
tmp=tmp*tmp%mod;
42+
return m%2 ? tmp*n%mod: tmp;
43+
}
44+
namespace mod_operations{
45+
ll modInv(ll n, ll mod){
46+
return ppow(n,mod-2, mod);
47+
}
48+
ll modAdd(ll n, ll m, ll mod){
49+
n=(n%mod+mod)%mod; m=(m%mod+mod)%mod;
50+
return (n+m)%mod;
51+
}
52+
ll modMul(ll n, ll m, ll mod){
53+
n=(n%mod+mod)%mod; m=(m%mod+mod)%mod;
54+
return n*m %mod;
55+
}
56+
ll modSub(ll n, ll m, ll mod){
57+
n=(n%mod+mod)%mod; m=(m%mod+mod)%mod;
58+
return modAdd(n,-m, mod);
59+
}
60+
ll modDiv(ll n, ll m, ll mod){
61+
return modMul(n, modInv(m, mod), mod);
62+
}
63+
}
64+
using namespace mod_operations;
65+
66+
67+
class Atcoder
68+
{
69+
private:
70+
// read only variable
71+
const ll INF=1e18;
72+
const ll mod1=1e9+7;
73+
const ll mod2=998244353;
74+
75+
76+
public:
77+
Atcoder(){
78+
79+
}
80+
81+
ll power(ll x,ll y){
82+
ll result=1;
83+
while(y>0){
84+
if(y&1){
85+
result*=x;
86+
}
87+
y>>=1;
88+
x*=x;
89+
}
90+
return result;
91+
}
92+
93+
ll power(ll x,ll y,ll mod){
94+
ll result=1;
95+
x%=mod;
96+
while(y>0){
97+
if(y&1){
98+
result*=x;
99+
result%=mod;
100+
}
101+
y>>=1;
102+
x*=x;
103+
x%=mod;
104+
}
105+
return result;
106+
}
107+
108+
ll str_to_num(string s)
109+
{
110+
stringstream pk(s);
111+
ll num;
112+
pk>>num;
113+
return num;
114+
}
115+
116+
string num_to_str(ll num)
117+
{
118+
return to_string(num);
119+
}
120+
// Techniques :
121+
// divide into cases, brute force, pattern finding
122+
// sort, greedy, binary search, two pointer
123+
// transform into graph
124+
125+
// Experience :
126+
// Cp is nothing but only observation and mathematics.
127+
ll solve()
128+
{
129+
ll a,b;
130+
cin>>a>>b;
131+
if(b<=a){
132+
cout<<0<<endl;
133+
return 0;
134+
}
135+
else{
136+
ll temp=abs(b-a);
137+
cout<<(temp+9)/10<<endl;
138+
}
139+
return 0;
140+
}
141+
};
142+
143+
144+
/* --------------------MAIN PROGRAM----------------------------*/
145+
146+
int main()
147+
{
148+
speed;
149+
/* #ifndef ONLINE_JUDGE
150+
freopen("input.txt","r",stdin);
151+
freopen("output.txt","w",stdout);
152+
#endif */
153+
ll TestCase=1;
154+
// cin>>TestCase;;
155+
while(TestCase--)
156+
{
157+
Atcoder at;
158+
at.solve();
159+
}
160+
}
161+
/* -----------------END OF PROGRAM --------------------*/
162+
/*
163+
* stuff you should look before submission
164+
* constraint and time limit
165+
* int overflow
166+
* special test case (n=0||n=1||n=2)
167+
* don't get stuck on one approach if you get wrong answer
168+
*/
+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
/*
2+
written by Pankaj Kumar.
3+
country:-INDIA
4+
Institute: National Institute of Technology, Uttarakhand
5+
*/
6+
#include <bits/stdc++.h>
7+
#include <ext/pb_ds/assoc_container.hpp>
8+
#include <ext/pb_ds/tree_policy.hpp>
9+
using namespace std;
10+
using namespace __gnu_pbds;
11+
typedef long long ll ;
12+
typedef vector<ll> vl;
13+
typedef vector<vector<ll>> vvl;
14+
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
15+
/* Abbrevations */
16+
#define ff first
17+
#define ss second
18+
#define mp make_pair
19+
#define line cout<<endl;
20+
#define pb push_back
21+
// loops
22+
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
23+
// Some print
24+
#define no cout<<"NO"<<endl;
25+
#define yes cout<<"YES"<<endl;
26+
// sort
27+
#define all(V) (V).begin(),(V).end()
28+
#define srt(V) sort(all(V))
29+
#define srtGreat(V) sort(all(V),greater<ll>())
30+
// some extra
31+
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
32+
#define precision(x) cout<<fixed<<setprecision(x);
33+
#define sz(V) ll(V.size())
34+
// datatype definination
35+
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
36+
37+
38+
ll ppow(ll n, ll m, ll mod){
39+
if(m==0) return 1;
40+
ll tmp=ppow(n, m/2, mod);
41+
tmp=tmp*tmp%mod;
42+
return m%2 ? tmp*n%mod: tmp;
43+
}
44+
namespace mod_operations{
45+
ll modInv(ll n, ll mod){
46+
return ppow(n,mod-2, mod);
47+
}
48+
ll modAdd(ll n, ll m, ll mod){
49+
n=(n%mod+mod)%mod; m=(m%mod+mod)%mod;
50+
return (n+m)%mod;
51+
}
52+
ll modMul(ll n, ll m, ll mod){
53+
n=(n%mod+mod)%mod; m=(m%mod+mod)%mod;
54+
return n*m %mod;
55+
}
56+
ll modSub(ll n, ll m, ll mod){
57+
n=(n%mod+mod)%mod; m=(m%mod+mod)%mod;
58+
return modAdd(n,-m, mod);
59+
}
60+
ll modDiv(ll n, ll m, ll mod){
61+
return modMul(n, modInv(m, mod), mod);
62+
}
63+
}
64+
using namespace mod_operations;
65+
66+
67+
class Atcoder
68+
{
69+
private:
70+
// read only variable
71+
const ll INF=1e18;
72+
const ll mod1=1e9+7;
73+
const ll mod2=998244353;
74+
75+
76+
public:
77+
Atcoder(){
78+
79+
}
80+
81+
ll power(ll x,ll y){
82+
ll result=1;
83+
while(y>0){
84+
if(y&1){
85+
result*=x;
86+
}
87+
y>>=1;
88+
x*=x;
89+
}
90+
return result;
91+
}
92+
93+
ll power(ll x,ll y,ll mod){
94+
ll result=1;
95+
x%=mod;
96+
while(y>0){
97+
if(y&1){
98+
result*=x;
99+
result%=mod;
100+
}
101+
y>>=1;
102+
x*=x;
103+
x%=mod;
104+
}
105+
return result;
106+
}
107+
108+
ll str_to_num(string s)
109+
{
110+
stringstream pk(s);
111+
ll num;
112+
pk>>num;
113+
return num;
114+
}
115+
116+
string num_to_str(ll num)
117+
{
118+
return to_string(num);
119+
}
120+
// Techniques :
121+
// divide into cases, brute force, pattern finding
122+
// sort, greedy, binary search, two pointer
123+
// transform into graph
124+
125+
// Experience :
126+
// Cp is nothing but only observation and mathematics.
127+
ll solve()
128+
{
129+
ll l,r;
130+
cin>>l>>r;
131+
l--;
132+
r--;
133+
string s;
134+
cin>>s;
135+
reverse(s.begin()+l,s.begin()+r+1);
136+
cout<<s<<endl;
137+
return 0;
138+
}
139+
};
140+
141+
142+
/* --------------------MAIN PROGRAM----------------------------*/
143+
144+
int main()
145+
{
146+
speed;
147+
/* #ifndef ONLINE_JUDGE
148+
freopen("input.txt","r",stdin);
149+
freopen("output.txt","w",stdout);
150+
#endif */
151+
ll TestCase=1;
152+
// cin>>TestCase;;
153+
while(TestCase--)
154+
{
155+
Atcoder at;
156+
at.solve();
157+
}
158+
}
159+
/* -----------------END OF PROGRAM --------------------*/
160+
/*
161+
* stuff you should look before submission
162+
* constraint and time limit
163+
* int overflow
164+
* special test case (n=0||n=1||n=2)
165+
* don't get stuck on one approach if you get wrong answer
166+
*/

0 commit comments

Comments
 (0)