diff --git a/Codeforces/codeforces.cpp/.vs/ProjectSettings.json b/Codeforces/codeforces.cpp/.vs/ProjectSettings.json new file mode 100644 index 0000000..b11371a --- /dev/null +++ b/Codeforces/codeforces.cpp/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": "No Configurations" +} \ No newline at end of file diff --git a/Codeforces/codeforces.cpp/.vs/VSWorkspaceState.json b/Codeforces/codeforces.cpp/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..9568b22 --- /dev/null +++ b/Codeforces/codeforces.cpp/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/Codeforces/codeforces.cpp/.vs/codeforces.cpp/v17/.suo b/Codeforces/codeforces.cpp/.vs/codeforces.cpp/v17/.suo new file mode 100644 index 0000000..99819cf Binary files /dev/null and b/Codeforces/codeforces.cpp/.vs/codeforces.cpp/v17/.suo differ diff --git a/Codeforces/codeforces.cpp/.vs/codeforces.cpp/v17/Browse.VC.db b/Codeforces/codeforces.cpp/.vs/codeforces.cpp/v17/Browse.VC.db new file mode 100644 index 0000000..ca268a3 Binary files /dev/null and b/Codeforces/codeforces.cpp/.vs/codeforces.cpp/v17/Browse.VC.db differ diff --git a/Codeforces/codeforces.cpp/.vs/slnx.sqlite b/Codeforces/codeforces.cpp/.vs/slnx.sqlite new file mode 100644 index 0000000..80c8881 Binary files /dev/null and b/Codeforces/codeforces.cpp/.vs/slnx.sqlite differ diff --git a/Codeforces/codeforces.cpp/1.cpp b/Codeforces/codeforces.cpp/1.cpp new file mode 100644 index 0000000..c6270fc --- /dev/null +++ b/Codeforces/codeforces.cpp/1.cpp @@ -0,0 +1,21 @@ + +#inciude +using namespace std; +int main() { + int rating; + cin >> rating + if (rating <= 1399) { + cout << 'Division 4' + } + elseif(1400 <= rating <= 1599) { + cout << 'Division 3' + } + elseif(1600 <= rating <= 1899) { + cout << 'Division 4' + } + else(1900 <= rating) { + cout << 'Division 1' + } + return 0; +} + \ No newline at end of file diff --git a/Codeforces/codeforces.cpp/2code.cpp/.vs/2code.cpp/v17/.suo b/Codeforces/codeforces.cpp/2code.cpp/.vs/2code.cpp/v17/.suo new file mode 100644 index 0000000..58f917d Binary files /dev/null and b/Codeforces/codeforces.cpp/2code.cpp/.vs/2code.cpp/v17/.suo differ diff --git a/Codeforces/codeforces.cpp/2code.cpp/.vs/2code.cpp/v17/Browse.VC.db b/Codeforces/codeforces.cpp/2code.cpp/.vs/2code.cpp/v17/Browse.VC.db new file mode 100644 index 0000000..ddfd36c Binary files /dev/null and b/Codeforces/codeforces.cpp/2code.cpp/.vs/2code.cpp/v17/Browse.VC.db differ diff --git a/Codeforces/codeforces.cpp/2code.cpp/.vs/ProjectSettings.json b/Codeforces/codeforces.cpp/2code.cpp/.vs/ProjectSettings.json new file mode 100644 index 0000000..b11371a --- /dev/null +++ b/Codeforces/codeforces.cpp/2code.cpp/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": "No Configurations" +} \ No newline at end of file diff --git a/Codeforces/codeforces.cpp/2code.cpp/.vs/VSWorkspaceState.json b/Codeforces/codeforces.cpp/2code.cpp/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..8776c97 --- /dev/null +++ b/Codeforces/codeforces.cpp/2code.cpp/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\Source1.cpp", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/Codeforces/codeforces.cpp/2code.cpp/.vs/slnx.sqlite b/Codeforces/codeforces.cpp/2code.cpp/.vs/slnx.sqlite new file mode 100644 index 0000000..13687d8 Binary files /dev/null and b/Codeforces/codeforces.cpp/2code.cpp/.vs/slnx.sqlite differ diff --git a/Codeforces/codeforces.cpp/2code.cpp/Source1.cpp b/Codeforces/codeforces.cpp/2code.cpp/Source1.cpp new file mode 100644 index 0000000..5628ab8 --- /dev/null +++ b/Codeforces/codeforces.cpp/2code.cpp/Source1.cpp @@ -0,0 +1,19 @@ +#inciude +using namespace std; +int main() { + int rating; + cin >> rating + if (rating <= 1399) { + cout << 'Division 4' + } + elseif(1400 <= rating <= 1599) { + cout << 'Division 3' + } + elseif(1600 <= rating <= 1899) { + cout << 'Division 4' + } + else(1900 <= rating) { + cout << 'Division 1' + } + return 0; +} diff --git a/Codeforces/codeforces.cpp/68.c b/Codeforces/codeforces.cpp/68.c new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/Codeforces/codeforces.cpp/68.c @@ -0,0 +1 @@ + diff --git a/Codeforces/codeforces.cpp/A. Array Coloring.c b/Codeforces/codeforces.cpp/A. Array Coloring.c new file mode 100644 index 0000000..9b14fee --- /dev/null +++ b/Codeforces/codeforces.cpp/A. Array Coloring.c @@ -0,0 +1,20 @@ +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + int arr[n]; + int sum=0; + for(i:arr){ + cin>>arr[i]; + } + for(int i=0; i +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + int arr[n]; + int sum=0; + for(i:arr){ + cin>>arr[i]; + } + for(int i=0; i +#include + +using namespace std; + +string decryptString(string s) { + string result = ""; + + for (int i = 0; i < s.length(); i += 2) { + result += s[i]; + } + + return result; +} +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + string s; + cout << "Enter the encrypted string: "; + cin >> s; + + string decryptedString = decryptString(s); + cout << "Decrypted string: " << decryptedString << endl; + + return 0; + } +} diff --git a/Codeforces/codeforces.cpp/A. Cipher Shifer1.exe b/Codeforces/codeforces.cpp/A. Cipher Shifer1.exe new file mode 100644 index 0000000..7158d3d Binary files /dev/null and b/Codeforces/codeforces.cpp/A. Cipher Shifer1.exe differ diff --git a/Codeforces/codeforces.cpp/A. Cipher Shifer1.o b/Codeforces/codeforces.cpp/A. Cipher Shifer1.o new file mode 100644 index 0000000..631952d Binary files /dev/null and b/Codeforces/codeforces.cpp/A. Cipher Shifer1.o differ diff --git a/Codeforces/codeforces.cpp/A. Divisible Array.cpp b/Codeforces/codeforces.cpp/A. Divisible Array.cpp new file mode 100644 index 0000000..1995284 --- /dev/null +++ b/Codeforces/codeforces.cpp/A. Divisible Array.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + cout< +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + if(n==2 || n==99) cout<<"Bob"< +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int x,k; + cin>>x>>k; + if(x +#include +#define ll long long +using namespace std; + +int main() { + int t; + cin >> t; + while (t--) { + long long n, k, x; + cin >> n >> k >> x; + ll sum = 0; + + if (k > n || k - 1 > x) { + cout << -1 << endl; // Print -1 when conditions are not met + } + else { + for (int i = 1; i < k; i++) { + sum+=i; + } + if(k>=x){ + for (int j = 0; j < n - k; j++) { + sum+= (k-1); + } + } + else{ + for (int l = 0; l < n-k; l++) { + sum += x; + } + } + cout << sum << endl; // Corrected to add 'n' to the sum + } + } + return 0; +} diff --git a/Codeforces/codeforces.cpp/A. MEXanized Array.exe b/Codeforces/codeforces.cpp/A. MEXanized Array.exe new file mode 100644 index 0000000..ce97f02 Binary files /dev/null and b/Codeforces/codeforces.cpp/A. MEXanized Array.exe differ diff --git a/Codeforces/codeforces.cpp/A. MEXanized Array.o b/Codeforces/codeforces.cpp/A. MEXanized Array.o new file mode 100644 index 0000000..d8afab6 Binary files /dev/null and b/Codeforces/codeforces.cpp/A. MEXanized Array.o differ diff --git a/Codeforces/codeforces.cpp/A. Musical Puzzle.cpp b/Codeforces/codeforces.cpp/A. Musical Puzzle.cpp new file mode 100644 index 0000000..c5b2889 --- /dev/null +++ b/Codeforces/codeforces.cpp/A. Musical Puzzle.cpp @@ -0,0 +1,15 @@ +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n, i, j; + cin>>n; + string s; + cin>>s; + int count=0; + + } + return 0; +} diff --git a/Codeforces/codeforces.cpp/A. Musical Puzzle.exe b/Codeforces/codeforces.cpp/A. Musical Puzzle.exe new file mode 100644 index 0000000..aa7d51e Binary files /dev/null and b/Codeforces/codeforces.cpp/A. Musical Puzzle.exe differ diff --git a/Codeforces/codeforces.cpp/A. Musical Puzzle.o b/Codeforces/codeforces.cpp/A. Musical Puzzle.o new file mode 100644 index 0000000..72c1d51 Binary files /dev/null and b/Codeforces/codeforces.cpp/A. Musical Puzzle.o differ diff --git a/Codeforces/codeforces.cpp/A. Twin Permutations.cpp b/Codeforces/codeforces.cpp/A. Twin Permutations.cpp new file mode 100644 index 0000000..6110ab6 --- /dev/null +++ b/Codeforces/codeforces.cpp/A. Twin Permutations.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n, a[n], b[n]; + cin>>n; + for(int i=0; i>a[i]; + } + for(int j=0; j +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + string s; + cin>>s; + int a[n+1]; + a[0]=1; + for(int i=0;i +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + string s; + cin>>s; + int ind, wid; + for(int i=0;i' || s[i]=='<'){ + cout<') || (s[i]=='>' && s[i+1]=='<')){ + cout<<2; + } + } + for(int j=0;j'){ + ind=i; + } + else if(s[i]=='>' && s[i+1]=='<'){ + wid=i; + } + } + for(int k=i;k +#include +#include + +using namespace std; + +pair findMinMaxX(int n, int m, vector& a, vector& b) { + int min_x = a[0]; + int max_x = a[0]; + + int or_b = 0; + for (int bj : b) { + or_b |= bj; + } + + min_x |= or_b; + max_x |= or_b; + + return make_pair(min_x, max_x); +} + +int main() { + int t; + cin >> t; + + while (t--) { + int n, m; + cin >> n >> m; + vector a(n), b(m); + + for (int i = 0; i < n; ++i) { + cin >> a[i]; + } + + for (int i = 0; i < m; ++i) { + cin >> b[i]; + } + + pair result = findMinMaxX(n, m, a, b); + + cout << result.first << " " << result.second << endl; + } + + return 0; +} diff --git a/Codeforces/codeforces.cpp/B. Permutation Swap.c b/Codeforces/codeforces.cpp/B. Permutation Swap.c new file mode 100644 index 0000000..b64ee56 --- /dev/null +++ b/Codeforces/codeforces.cpp/B. Permutation Swap.c @@ -0,0 +1,12 @@ +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n, i, j; + cin>>n; + + } + return 0; +} diff --git a/Codeforces/codeforces.cpp/Between_the_Offices.cpp b/Codeforces/codeforces.cpp/Between_the_Offices.cpp new file mode 100644 index 0000000..9b07f0b --- /dev/null +++ b/Codeforces/codeforces.cpp/Between_the_Offices.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + int main(){ + int N, i, j, NofSF=0, NofFS=0; + string s; + cin>>N; + cout<>s; + for(i=0;iNofFS){ + cout<<"YES"; + } + else if(NofSF<=NofFS){ + cout<<"NO"; + } + return 0; + } diff --git a/Codeforces/codeforces.cpp/Between_the_Offices.exe b/Codeforces/codeforces.cpp/Between_the_Offices.exe new file mode 100644 index 0000000..1058d8c Binary files /dev/null and b/Codeforces/codeforces.cpp/Between_the_Offices.exe differ diff --git a/Codeforces/codeforces.cpp/Between_the_Offices.o b/Codeforces/codeforces.cpp/Between_the_Offices.o new file mode 100644 index 0000000..969a793 Binary files /dev/null and b/Codeforces/codeforces.cpp/Between_the_Offices.o differ diff --git a/Codeforces/codeforces.cpp/Cards.cpp b/Codeforces/codeforces.cpp/Cards.cpp new file mode 100644 index 0000000..ca950e7 --- /dev/null +++ b/Codeforces/codeforces.cpp/Cards.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; + +int main(){ + int N,i,j; + string s; + cin>>N; + cout<>s; + int num_of_z=0; + int num_of_n=0; + + for(i=0;i +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n,k,x=0,y=0; + cin>>n>>k; + for(int i=0;i<=n/2;i++){ + for(int j=0;j<=n/k;j++){ + if(2*i + k*j == n){ + cout<<"YES"; + break; + } + + if(2*i + k*j != n){ + cout<<"NO"; + break; + } + } + } + } + + return 0; +} diff --git a/Codeforces/codeforces.cpp/Coins.exe b/Codeforces/codeforces.cpp/Coins.exe new file mode 100644 index 0000000..a1b2cf5 Binary files /dev/null and b/Codeforces/codeforces.cpp/Coins.exe differ diff --git a/Codeforces/codeforces.cpp/Coins.o b/Codeforces/codeforces.cpp/Coins.o new file mode 100644 index 0000000..c9b022f Binary files /dev/null and b/Codeforces/codeforces.cpp/Coins.o differ diff --git a/Codeforces/codeforces.cpp/Fafa and his Company.cpp b/Codeforces/codeforces.cpp/Fafa and his Company.cpp new file mode 100644 index 0000000..bc082f2 --- /dev/null +++ b/Codeforces/codeforces.cpp/Fafa and his Company.cpp @@ -0,0 +1,13 @@ +#include +using namespace std; + +int main(){ + int N, i, No_of_factor=0; + cin>>N; + for(i=1;i<=N;i++){ + if(N%i==0){ + No_of_factor++; + } + } + cout< +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int a,b, jumps; + cin>>a>>b; + if(b%a!=0 || (a==1 && b==1) || (a==1 && b==2) || (a==2 && b==1)){ + cout<<1; + jumps=1; + } + else if(b%a==0 || a%b==0){ + cout<<2; + jumps=2; + } + else(cout<<0); + + if(jumps==1){ + cout< +using namespace std; + +int main(){ + int n; + cin>>n; + string brr[6] = {} + string arr[]; + cout<<(6-n); + for(i=0;i>arr[i]; + cout< +using namespace std; + +int main(){ + int n; + cin>>n; + if(n%2==0){ + cout<<"Mahmoud"; + } + else if(n%2!=0){ + cout<<"Ehab"; + } + return 0; +} diff --git a/Codeforces/codeforces.cpp/Mahmoud and Ehab and the even-odd game.exe b/Codeforces/codeforces.cpp/Mahmoud and Ehab and the even-odd game.exe new file mode 100644 index 0000000..d1bdf99 Binary files /dev/null and b/Codeforces/codeforces.cpp/Mahmoud and Ehab and the even-odd game.exe differ diff --git a/Codeforces/codeforces.cpp/Mahmoud and Ehab and the even-odd game.o b/Codeforces/codeforces.cpp/Mahmoud and Ehab and the even-odd game.o new file mode 100644 index 0000000..20c783b Binary files /dev/null and b/Codeforces/codeforces.cpp/Mahmoud and Ehab and the even-odd game.o differ diff --git a/Codeforces/codeforces.cpp/Pens and Pencils.cpp b/Codeforces/codeforces.cpp/Pens and Pencils.cpp new file mode 100644 index 0000000..4693037 --- /dev/null +++ b/Codeforces/codeforces.cpp/Pens and Pencils.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int a, b, c, d, k, num1, num2; + cin>>a>>b>>c>>d>>k; + + if(a>c){ + //cout<d){ + //cout< +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int n,m,i =0,j= 0; + cin>>n; + cin>>m; + int a[n]; + int b[m]; + //cin>>a[n]; + for(int i=0; i>a[i]; +} + //cin>>b[m]; + for(int j=0; i>b[i]; +} + sort(a.begin(),a.end()); + sort(b.begin(),b.end()); + + while(m<=n){ + a[i] = b[m-i+1]; + i++; + } + cout << accumulate(a, a + n, 0); + return 0; + +} diff --git a/Codeforces/codeforces.cpp/Scarborough Fair.cpp b/Codeforces/codeforces.cpp/Scarborough Fair.cpp new file mode 100644 index 0000000..8f0d473 --- /dev/null +++ b/Codeforces/codeforces.cpp/Scarborough Fair.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + +int main(){ + int n, m, l, r, i, j; + char c1, c2; + cin>>n>>m; + cout<>s; + cout<>l>>r>>c1>>c2; + for(j=l-1;j<=r-1;j++){ + if(s[j]==c1){ + s[j]=c2; + } + } + } + cout< +using namespace std; + +int main(){ + int x; + cin>>x; + if(x%4==1){ + cout<<0<<" "; + cout<<'A'; + } + else if(x%4==3){ + cout<<2<<" "; + cout<<'C'; + } + else if(x%4==2){ + cout<<1<<" "; + cout<<'B'; + } + +} diff --git a/Codeforces/codeforces.cpp/Tokitsukaze and Enhancement.exe b/Codeforces/codeforces.cpp/Tokitsukaze and Enhancement.exe new file mode 100644 index 0000000..5a4e1f5 Binary files /dev/null and b/Codeforces/codeforces.cpp/Tokitsukaze and Enhancement.exe differ diff --git a/Codeforces/codeforces.cpp/Tokitsukaze and Enhancement.o b/Codeforces/codeforces.cpp/Tokitsukaze and Enhancement.o new file mode 100644 index 0000000..8bcafd2 Binary files /dev/null and b/Codeforces/codeforces.cpp/Tokitsukaze and Enhancement.o differ diff --git a/Codeforces/codeforces.cpp/Untitled2.cpp b/Codeforces/codeforces.cpp/Untitled2.cpp new file mode 100644 index 0000000..c28fa79 --- /dev/null +++ b/Codeforces/codeforces.cpp/Untitled2.cpp @@ -0,0 +1,35 @@ +#include +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int n,m,i =0,j= 0; + cin>>n; + cin>>m; + int a[n]; + int b[m]; + //cin>>a[n]; + for(int i=0; i>a[i]; +} + //cin>>b[m]; + for(int j=0; i>b[i]; +} + sort(a, a + n); + sort(b, b + n); + + while(m<=n){ + a[i] = b[m-i+1]; + i++; + } + int sum = 0; + sum = accumulate(a, a+n, sum); + cout< +using namespace std; + +int main(){ + int a, b, c; + cin>>a>>b>>c; + if(b>=a && c>=a){ + cout<<"Yes"; + } + else(cout<<"No"); +} diff --git a/Codeforces/codeforces.cpp/Vus the Cossack and a Contest.exe b/Codeforces/codeforces.cpp/Vus the Cossack and a Contest.exe new file mode 100644 index 0000000..4301f77 Binary files /dev/null and b/Codeforces/codeforces.cpp/Vus the Cossack and a Contest.exe differ diff --git a/Codeforces/codeforces.cpp/Vus the Cossack and a Contest.o b/Codeforces/codeforces.cpp/Vus the Cossack and a Contest.o new file mode 100644 index 0000000..977a520 Binary files /dev/null and b/Codeforces/codeforces.cpp/Vus the Cossack and a Contest.o differ diff --git a/Codeforces/codeforces.cpp/array2.c b/Codeforces/codeforces.cpp/array2.c new file mode 100644 index 0000000..c2d6dc3 --- /dev/null +++ b/Codeforces/codeforces.cpp/array2.c @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + int arr[n]; + //cin >> arr[i]; + for(i=0;i>arr[i]; + } + +} + return 0; +} + diff --git a/Codeforces/codeforces.cpp/bs.cpp b/Codeforces/codeforces.cpp/bs.cpp new file mode 100644 index 0000000..e47b305 --- /dev/null +++ b/Codeforces/codeforces.cpp/bs.cpp @@ -0,0 +1,17 @@ +#include +using namespace std; +int main(){ + char arr[7] = {c, o, d, e, f , r, s} + + int t; + cin>>t; + while(t--){ + char n; + cin>>'n'>>endl; + + + + } + return 0; +} + diff --git a/Codeforces/codeforces.cpp/ee.cpp.c b/Codeforces/codeforces.cpp/ee.cpp.c new file mode 100644 index 0000000..8f33fc5 --- /dev/null +++ b/Codeforces/codeforces.cpp/ee.cpp.c @@ -0,0 +1,35 @@ +#include +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int n,m,i =0,j= 0; + cin>>n; + cin>>m; + int a[n]; + int b[m]; + //cin>>a[n]; + for(int i=0; i>a[i]; +} + //cin>>b[m]; + for(int j=0; i>b[i]; +} + sort(a.begin(),a.end()); + sort(b.begin(),b.end()); + + while(m<=n){ + a[i] = b[m-i+1]; + i++; + } + int sum = 0; + sum = accumulate(a, a+n, sum); + cout< +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int n,m,i =0,j= 0; + cin>>n; + cin>>m; + int a[n]; + int b[m]; + //cin>>a[n]; + for(int i=0; i>a[i]; +} + //cin>>b[m]; + for(int j=0; i>b[i]; +} + sort(a.begin(),a.end()); + sort(b.begin(),b.end()); + + while(m<=n){ + a[i] = b[m-i+1]; + i++; + } + int sum = 0; + sum = accumulate(a, a+n, sum); + cout< +using namespace std; + +int main(){ + int salary[]; + int n = salary.size(); + int min = *min_element(salary, salary + n); + int max = *max_element(salary, salary + n); + for(int i=0;i +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int a,b,c; + cin>>a>>b>>c; + int maxi = max(a,max(b,c)); + int mini = min(a,min(b,c)); + if(a!=maxi && a!=mini) cout<=b){ + if(b>=c){ + cout<=b){ + cout<=a){ + if(a>=c){ + cout< +#define ll long long  + using namespace std; + + class phonedirectory{ + public: + sets ; + void insert_num(ll int num){ + s.insert(num); + } + bool check(ll int num){ +     set :: iterator itr = s.find(num) ; +     if(*itr >= 0 && *itr < s.size() ){ +         return true; +     } +     return false ; + } + void release_num(){ + if(s.empty() == 1){ +     cout<<"No numbers in slots"< :: iterator itr=v.begin(); +      auto it = itr ; +      cout<<" New Number "<<*it<> num_of_slot ; +         for(int i=0; i < num_of_slot ;i++){ +             cin>>number ; +         phone_num.insert_num(number); +         } +          + cout<<"if you want new number please Enter 'X' else 'N'  " <>new_num ; + if(new_num == 'X'){ + +     phone_num.release_num(); + } + char to_check; + cout<<"if you want to check number please Enter 'Y' else 'N' " <>to_check ; + + if(to_check == 'Y'){ +     cout<<"Enter Number to Check "<>mob_num ; +     if(phone_num.check(mob_num)){ +         cout<<"Number is present in slots"< +#define ll long long  +using namespace std; + + class phonedirectory{ + public: + + vector v; + for(int i=0 ; i>num; + v.push_back(num); + } + bool check(ll num){ + + for(int i=0; i < v.size(); i++){ + if(v[i]==num){ +         return true; +      } +      return false ; + } +} + void release_num(){ + if(v.empty() == 1){ +     cout<<"No numbers in slots"< :: iterator it; +      auto it = itr ; +      cout<<" New Number "<<*it<> num_of_slot ; +         for(int i=0; i < num_of_slots ;i++){ +             cin>>number ; +         phone_num.insert_num(number); +         } +          + cout<<"For new number please Enter 'X' else 'N'  " <>new_num ; + if(new_num == 'X'){ + +     phone_num.release_num(); + } + char to_check; + cout<<"To check number please Enter 'Y' else 'N' " <>to_check ; + + if(to_check == 'Y'){ +     cout<<"Enter Number to Check "<>mob_num ; +     if(phone_num.check(mob_num)){ +         cout<<"Number is present in slots"< +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int n,m,i =0,j= 0; + cin>>n; + cin>>m; + int a[n]; + int b[m]; + //cin>>a[n]; + for(int i=0; i>a[i]; +} + //cin>>b[m]; + for(int j=0; i>b[i]; +} + sort(a.begin(),a.end()); + sort(b.begin(),b.end()); + + while(m<=n){ + a[i] = b[m-i+1]; + i++; + } + int sum = 0; + sum = accumulate(a, a+n, sum); + cout< + +using namespace std; + +int main(){ + int t; + cin>>t; + while(t--){ + int n; + vector v; + reverse(sort(v.begin(),v.end())); + c = min(a,b); + int a[26]; + sort(a,a+26); + d = max(a,b); + + } + return 0; +} diff --git a/Codeforces/codeforces.cpp/string1.cpp b/Codeforces/codeforces.cpp/string1.cpp new file mode 100644 index 0000000..18fc9c2 --- /dev/null +++ b/Codeforces/codeforces.cpp/string1.cpp @@ -0,0 +1,34 @@ +/*In order to write a string, Atilla needs to first learn all letters that are contained in the string. + +Atilla needs to write a message which can be represented as a string s. He asks you what is the minimum alphabet size required so that one can write this message. + +The alphabet of size x (1≤x≤26) contains only the first x Latin letters. For example an alphabet of size 4 contains only the characters a, b, c and d. +*/ + +#include +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n; + cin>>n; + + string s; + cin>>s; + int a[26]={0}; + for(int i=0;i=0;i--){ + if(a[i]>0){ + cout< +using namespace std; + +int main(){ +int i,n; +cin >> n; +int arr[n]; +int sum=0; +for(i=0;i> arr[i]; + sum += arr[i]; +} +cout << sum; +return 0; +} diff --git a/Codeforces/codeforces.cpp/sumofArray.exe b/Codeforces/codeforces.cpp/sumofArray.exe new file mode 100644 index 0000000..2f7bdb0 Binary files /dev/null and b/Codeforces/codeforces.cpp/sumofArray.exe differ diff --git a/Codeforces/codeforces.cpp/sumofArray.o b/Codeforces/codeforces.cpp/sumofArray.o new file mode 100644 index 0000000..276fbfb Binary files /dev/null and b/Codeforces/codeforces.cpp/sumofArray.o differ diff --git a/Codeforces/codeforces.cpp/task1.cpp b/Codeforces/codeforces.cpp/task1.cpp new file mode 100644 index 0000000..b17f89e --- /dev/null +++ b/Codeforces/codeforces.cpp/task1.cpp @@ -0,0 +1,38 @@ +void help(vector>&image,int &n,int &m){ + + if(x>=n || y>=m || image[x][y]==nc)return; + + int oc=image[x][y]; + + image[x][y]=nc; + + if(x+1=0 && image[x-1][y]==oc){ + + help(image,x-1,y,nc,n,m); + + } + + if(y-1>=0 && image[x][y-1]==oc){ + + help(image,x,y-1,nc,n,m); + + } + + if(y+1 +using namespace std; +int main(){ + int t; + cin>>t; + while(t--){ + int n,m; + cin>>n>>m; + string a, b, c; + cin>>a; + cin>>b; + int i; + int flag = 1; + reverse(b.begin(), b.end()); + c = a + (b); + for(i=0;i<=n+m-3;i++){ + if(c[i] == c[i+1] && c[i+1] == c[i+2]){ + flag = 0; + break; + } + } + if(flag == 0){ + cout<<"NO"< +using namespace std; + +int main() { + + int N,D; + cin>>N>>D>>[&n&]; + int count1=0; + int count2=0; + int a[N]; + for(int i=1;i<=N;i++){ + cin>>a[i]; + } + for(int j=1; j<=N; j++){ + if (a[j]>=80 || a[j]<=9){ + count1++; + } + else { + count2++; + } + } + float f1=count1/D; + int m1=count1/D; + int count11=0; + int count22=0; + + float f2=count2/D; + int m2=count2/D; + if(f1>m1){ + count11++; + } + if(f2>m2){ + count22++; + } + int a1=count1+count11; + int a2=count2+count22; + int k1=a1/D; + int k2=a2/D; + if(a1%D!=0 && a2%D!=0){ + cout<