aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Magdy <omar.professional8777@gmail.com>2022-04-30 01:13:40 +0200
committerOmar Magdy <omar.professional8777@gmail.com>2022-04-30 01:13:40 +0200
commita0d7b8320a8996eee0ed957b79c3a882f8b47146 (patch)
tree76242ae2b19bad00796ed6d0104da8a0e4a99abe
downloadcompetitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.tar.xz
competitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.zip
Added all current problems
-rw-r--r--.gitignore1
-rw-r--r--08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob1
-rw-r--r--08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob1
-rwxr-xr-x08-03-2022(Div.3)/Abin0 -> 18880 bytes
-rw-r--r--08-03-2022(Div.3)/A.cpp25
-rwxr-xr-x08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Lettersbin0 -> 18664 bytes
-rw-r--r--08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp37
-rwxr-xr-x08-03-2022(Div.3)/Bbin0 -> 17688 bytes
-rw-r--r--08-03-2022(Div.3)/B.cpp23
-rw-r--r--08-03-2022(Div.3)/B_DIV_MOD.cpp23
-rw-r--r--08-03-2022(Div.3)/C.cpp22
-rw-r--r--08-03-2022(Div.3)/D.cpp20
-rw-r--r--08-03-2022(Div.3)/E.cpp9
-rwxr-xr-x08-03-2022(Div.3)/tempCodeRunnerFilebin0 -> 18640 bytes
-rwxr-xr-x21-04-2022(Div.4)/Abin0 -> 17792 bytes
-rw-r--r--21-04-2022(Div.4)/A.cpp23
-rwxr-xr-x21-04-2022(Div.4)/Bbin0 -> 47400 bytes
-rw-r--r--21-04-2022(Div.4)/B.cpp30
-rwxr-xr-x21-04-2022(Div.4)/Ebin0 -> 24728 bytes
-rw-r--r--21-04-2022(Div.4)/E.cpp25
-rwxr-xr-x21-04-2022(Div.4)/Fbin0 -> 22712 bytes
-rw-r--r--21-04-2022(Div.4)/F.cpp7
-rwxr-xr-xAlternatingCharachters.py12
-rw-r--r--CamelCase.cpp16
-rw-r--r--Diagonal_Difference.cpp30
-rw-r--r--Equalize_the_array.cpp19
-rw-r--r--Flipping_bits.cpp16
-rw-r--r--LisaWorkbook.cpp25
-rw-r--r--LonelyInteger.cpp12
-rw-r--r--Luck_balance.cpp37
-rw-r--r--MarcCakwalk.cpp18
-rw-r--r--MinDiffInArray.cpp19
-rw-r--r--RecursiveDigitSum.py14
-rw-r--r--SequenceEquation.cpp25
-rw-r--r--ThePowerSum.cpp36
-rw-r--r--chocolateFeast.cpp43
-rw-r--r--chocolateFeastRevised.cpp19
-rw-r--r--cutTheSticks.cpp63
-rw-r--r--cutTheSticksJoe.cpp21
-rw-r--r--cutTheSticksRevised.cpp10
-rw-r--r--iceCreamParlor.cpp38
-rwxr-xr-xpython/FindDigits.py21
-rwxr-xr-xpython/Kaprekar.py20
43 files changed, 761 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e935fd3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+binaries
diff --git a/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob b/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob
new file mode 100644
index 0000000..52ce51e
--- /dev/null
+++ b/08-03-2022(Div.3)/.cph/.A_Deletions_of_Two_Adjacent_Letters.cpp_691f772586c92182cd3ca9396098375f.prob
@@ -0,0 +1 @@
+{"name":"A. Deletions of Two Adjacent Letters","group":"Codeforces - Codeforces Round #776 (Div. 3)","url":"https://codeforces.com/contest/1650/problem/0","interactive":false,"memoryLimit":256,"timeLimit":2000,"tests":[{"id":1646751197936,"input":"5\nabcde\nc\nabcde\nb\nx\ny\naaaaaaaaaaaaaaa\na\ncontest\nt","output":"YES\nNO\nNO\nYES\nYES"},{"id":1646853307171,"input":"1\nqjjyzcsjy\ns","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ADeletionsOfTwoAdjacentLetters"}},"batch":{"id":"b130b25d-3d3d-4fce-9d67-8671131df21f","size":1},"srcPath":"/home/peng/test/Problem_Solving/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp"} \ No newline at end of file
diff --git a/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob b/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob
new file mode 100644
index 0000000..7eca9cb
--- /dev/null
+++ b/08-03-2022(Div.3)/.cph/.B_DIV_MOD.cpp_276b8c89d227db4a79dee1685b9c289c.prob
@@ -0,0 +1 @@
+{"name":"B. DIV + MOD","group":"Codeforces - Codeforces Round #776 (Div. 3)","url":"https://codeforces.com/contest/1650/problem/B","interactive":false,"memoryLimit":256,"timeLimit":2000,"tests":[{"id":1646752657834,"input":"5\n1 4 3\n5 8 4\n6 10 6\n1 1000000000 1000000000\n10 12 8","output":"2\n4\n5\n999999999\n5"},{"id":1646833131418,"input":"1\n1 100 1","output":"100"}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BDIVMOD"}},"batch":{"id":"18dc3187-28ba-42e4-adb6-b241bf475a66","size":1},"srcPath":"/home/peng/test/Problem_Solving/08-03-2022(Div.3)/B_DIV_MOD.cpp"} \ No newline at end of file
diff --git a/08-03-2022(Div.3)/A b/08-03-2022(Div.3)/A
new file mode 100755
index 0000000..a2ce84f
--- /dev/null
+++ b/08-03-2022(Div.3)/A
Binary files differ
diff --git a/08-03-2022(Div.3)/A.cpp b/08-03-2022(Div.3)/A.cpp
new file mode 100644
index 0000000..741b57a
--- /dev/null
+++ b/08-03-2022(Div.3)/A.cpp
@@ -0,0 +1,25 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int tt;
+ cin >> tt;
+ while(tt--){
+ string word;
+ char ch;
+ cin >> word;
+ cin >> ch;
+ int len = word.length();
+ if(word[len/2 + 1] == ch){
+ cout << word[len/2 + 1] << endl;
+ cout << ch << endl;
+ cout << "YES" << "\n";
+ }
+ else{
+ cout << "NO" << "\n";
+ }
+ }
+
+ return 0;
+} \ No newline at end of file
diff --git a/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters b/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters
new file mode 100755
index 0000000..c79eb1d
--- /dev/null
+++ b/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters
Binary files differ
diff --git a/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp b/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp
new file mode 100644
index 0000000..3f7daa2
--- /dev/null
+++ b/08-03-2022(Div.3)/A_Deletions_of_Two_Adjacent_Letters.cpp
@@ -0,0 +1,37 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+void findMultOcc(vector<int> &indices, string str, char ch){
+ for(int i = 0; i < str.length();i++){
+ if(str[i] == ch){
+ indices.push_back(i);
+ }
+ }
+}
+
+string solve(vector<int> indices){
+ for(int i = 0; i < indices.size(); i++)
+ {
+ if(indices[i] >= 0 && indices[i] % 2 == 0){
+ return "YES";
+ }
+ }
+ return "NO";
+}
+
+int main(){
+ int tt;
+ cin >> tt;
+ while(tt--){
+ vector<int> indices;
+ string word;
+ char ch;
+ cin >> word;
+ cin >> ch;
+ findMultOcc(indices, word, ch);
+ cout << solve(indices) << '\n';
+ }
+
+ return 0;
+}
diff --git a/08-03-2022(Div.3)/B b/08-03-2022(Div.3)/B
new file mode 100755
index 0000000..b11c838
--- /dev/null
+++ b/08-03-2022(Div.3)/B
Binary files differ
diff --git a/08-03-2022(Div.3)/B.cpp b/08-03-2022(Div.3)/B.cpp
new file mode 100644
index 0000000..dd8bb54
--- /dev/null
+++ b/08-03-2022(Div.3)/B.cpp
@@ -0,0 +1,23 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int modDiv(int r, int a){
+ // law r % a == 0, return r-1 % a + r-1 /a, else return r % a + r /a;
+ if(r % a == 0){
+ return (r-1) % a + (r-1)/a;
+ }
+ return r % a + r / a;
+}
+
+int main(){
+ int tt;
+ while(tt--){
+ cout << "tt: " << tt;
+ int l, r, a;
+ cin >> l >> r >> a;
+ cout << modDiv(r, a);
+ }
+
+ return 0;
+} \ No newline at end of file
diff --git a/08-03-2022(Div.3)/B_DIV_MOD.cpp b/08-03-2022(Div.3)/B_DIV_MOD.cpp
new file mode 100644
index 0000000..f861b3b
--- /dev/null
+++ b/08-03-2022(Div.3)/B_DIV_MOD.cpp
@@ -0,0 +1,23 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int modDiv(int r, int a){
+ // law r % a == 0, return r-1 % a + r-1 /a, else return r % a + r /a;
+ if(r % a == 0){
+ return (r-1) % a + (r-1)/a;
+ }
+ return r % a + r / a;
+}
+
+int main(){
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int l, r, a;
+ cin >> l >> r >> a;
+ cout << modDiv(r, a) << endl;
+ }
+
+ return 0;
+}
diff --git a/08-03-2022(Div.3)/C.cpp b/08-03-2022(Div.3)/C.cpp
new file mode 100644
index 0000000..f63ebcd
--- /dev/null
+++ b/08-03-2022(Div.3)/C.cpp
@@ -0,0 +1,22 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int tt;
+ cin >> tt;
+ while(tt--){
+ list<int> ls;
+ int len;
+ int x;
+ cin >> len;
+ for(int i = 0; i < len; i++){
+ cin >> x;
+ ls.push_back(x);
+ }
+
+
+ }
+
+ return 0;
+} \ No newline at end of file
diff --git a/08-03-2022(Div.3)/D.cpp b/08-03-2022(Div.3)/D.cpp
new file mode 100644
index 0000000..0572f03
--- /dev/null
+++ b/08-03-2022(Div.3)/D.cpp
@@ -0,0 +1,20 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int solve()
+{
+
+}
+
+int main(){
+ int tt;
+ cin >> tt;
+ while(tt--){
+
+
+ }
+
+
+ return 0;
+}
diff --git a/08-03-2022(Div.3)/E.cpp b/08-03-2022(Div.3)/E.cpp
new file mode 100644
index 0000000..2601cd5
--- /dev/null
+++ b/08-03-2022(Div.3)/E.cpp
@@ -0,0 +1,9 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int tt;
+
+ return 0;
+} \ No newline at end of file
diff --git a/08-03-2022(Div.3)/tempCodeRunnerFile b/08-03-2022(Div.3)/tempCodeRunnerFile
new file mode 100755
index 0000000..9154686
--- /dev/null
+++ b/08-03-2022(Div.3)/tempCodeRunnerFile
Binary files differ
diff --git a/21-04-2022(Div.4)/A b/21-04-2022(Div.4)/A
new file mode 100755
index 0000000..58be759
--- /dev/null
+++ b/21-04-2022(Div.4)/A
Binary files differ
diff --git a/21-04-2022(Div.4)/A.cpp b/21-04-2022(Div.4)/A.cpp
new file mode 100644
index 0000000..35c326e
--- /dev/null
+++ b/21-04-2022(Div.4)/A.cpp
@@ -0,0 +1,23 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int tt, x;
+ cin >> tt;
+ while(tt--){
+ cin >> x;
+ if(x >= 1900){
+ cout << "Division 1" << '\n';
+ }
+ else if(x >= 1600 && x <= 1899){
+ cout << "Division 2" << '\n';
+ }
+ else if(x >= 1400 && x <= 1599){
+ cout << "Division 3" << '\n';
+ }
+ else{
+ cout << "Division 4" << '\n';
+ }
+ }
+}
diff --git a/21-04-2022(Div.4)/B b/21-04-2022(Div.4)/B
new file mode 100755
index 0000000..6a9b6ab
--- /dev/null
+++ b/21-04-2022(Div.4)/B
Binary files differ
diff --git a/21-04-2022(Div.4)/B.cpp b/21-04-2022(Div.4)/B.cpp
new file mode 100644
index 0000000..d1b3e98
--- /dev/null
+++ b/21-04-2022(Div.4)/B.cpp
@@ -0,0 +1,30 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+auto solve(map<int, int> m){
+ for(auto x : m){
+ if(x.second >= 3){
+ return x.first;
+ }
+ }
+ return -1;
+}
+
+int main(){
+ int tt, x, n;
+ cin >> tt;
+ while(tt--){
+ map<int, int> frq;
+ vector<int> v;
+ cin >> n;
+ for(int i = 0; i < n; i++){
+ cin >> x;
+ frq[x]++;
+ }
+ // for(auto &x : frq){
+ // v.push_back(x.second);
+ // }
+ cout << solve(frq) << endl;
+ }
+}
diff --git a/21-04-2022(Div.4)/E b/21-04-2022(Div.4)/E
new file mode 100755
index 0000000..0e57ed4
--- /dev/null
+++ b/21-04-2022(Div.4)/E
Binary files differ
diff --git a/21-04-2022(Div.4)/E.cpp b/21-04-2022(Div.4)/E.cpp
new file mode 100644
index 0000000..7fac1a5
--- /dev/null
+++ b/21-04-2022(Div.4)/E.cpp
@@ -0,0 +1,25 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int tt, n, count;
+ cin >> tt;
+ while(tt--){
+ string str;
+ cin >> n;
+ count = 0;
+ vector<string> v(n);
+ for(int i = 0; i < n; i++){
+ cin >> v[i];
+ }
+ for(int i = 0; i < v.size(); i++){
+ for(int j = i+1; j < v.size()-1; j++){
+ if(v[i][0] != v[j][0] || v[i][1] != v[j][1]){
+ count++;
+ }
+ }
+ }
+ cout << count << endl;
+ }
+}
diff --git a/21-04-2022(Div.4)/F b/21-04-2022(Div.4)/F
new file mode 100755
index 0000000..b87fe94
--- /dev/null
+++ b/21-04-2022(Div.4)/F
Binary files differ
diff --git a/21-04-2022(Div.4)/F.cpp b/21-04-2022(Div.4)/F.cpp
new file mode 100644
index 0000000..4ab1a8c
--- /dev/null
+++ b/21-04-2022(Div.4)/F.cpp
@@ -0,0 +1,7 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+
+}
diff --git a/AlternatingCharachters.py b/AlternatingCharachters.py
new file mode 100755
index 0000000..cb0a56c
--- /dev/null
+++ b/AlternatingCharachters.py
@@ -0,0 +1,12 @@
+#!/bin/python3
+t = int(input())
+for i in range(t):
+ s = input()
+ count = 0
+ for j in range(len(s) - 1):
+ # print(s[j] == s[j + 1])
+ if s[j] == s[j + 1]:
+ count += 1
+ print(count)
+
+
diff --git a/CamelCase.cpp b/CamelCase.cpp
new file mode 100644
index 0000000..bbcef3a
--- /dev/null
+++ b/CamelCase.cpp
@@ -0,0 +1,16 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ string s;
+ int count = 0;
+ cin >> s;
+ for(auto ch : s) {
+ if(isupper(ch)) {
+ count++;
+ }
+ }
+ cout << count + 1 << '\n';
+ return 0;
+}
diff --git a/Diagonal_Difference.cpp b/Diagonal_Difference.cpp
new file mode 100644
index 0000000..cb7c2f2
--- /dev/null
+++ b/Diagonal_Difference.cpp
@@ -0,0 +1,30 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int n;
+ cin >> n;
+ vector<int> v1(n);
+ vector<vector<int>> v2;
+ for(int i = 0; i < n; i++){
+ for(auto &x : v1){
+ cin >> x;
+ cout << "x: " << x << endl;
+ }
+ v2.push_back(v1);
+ }
+ int dg1 = 0, dg2 = 0;
+ for(int i = 0; i < n; i++){
+ dg1+=v2[i][i];
+ }
+ for(int i = 0; i < n; i++){
+ dg2+=v2[i][n-i-1];
+ }
+ cout << abs(dg2 - dg1) << endl;
+
+
+ return 0;
+
+}
+
diff --git a/Equalize_the_array.cpp b/Equalize_the_array.cpp
new file mode 100644
index 0000000..89af0d8
--- /dev/null
+++ b/Equalize_the_array.cpp
@@ -0,0 +1,19 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int n, x;
+ cin >> n;
+ map<int, int> mp;
+ vector<int> freq;
+ for(int i =0; i < n; i++){
+ cin >> x;
+ mp[x]++;
+ }
+ for(auto x : mp){
+ freq.push_back(x.second);
+ }
+ cout << n - *max_element(freq.begin(), freq.end()) << '\n';
+ return 0;
+}
diff --git a/Flipping_bits.cpp b/Flipping_bits.cpp
new file mode 100644
index 0000000..e06235b
--- /dev/null
+++ b/Flipping_bits.cpp
@@ -0,0 +1,16 @@
+#include<bits/stdc++.h>
+
+
+using namespace std;
+
+int main(){
+ int n, x=pow(2, 31) - 1;
+ cin >> n;
+ cout << n ^ x;
+ // 0 0 -> 1 -> 0
+ // 1 1 -> 0 -> 1
+ // 1 1 -> 0 -> 1
+ // 1 1 -> 0 -> 0
+
+ return 0;
+}
diff --git a/LisaWorkbook.cpp b/LisaWorkbook.cpp
new file mode 100644
index 0000000..6d8532c
--- /dev/null
+++ b/LisaWorkbook.cpp
@@ -0,0 +1,25 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main()
+{
+ int n, k;
+ cin >> n >> k;
+ int pg = 1, res = 0;
+ for (int i = 0; i < n; i++) {
+ int np;
+ cin >> np;
+ for (int j = 1; j <= np ; j++) {
+ if (j == pg) {
+ res++;
+ }
+ if (j % k == 0 && j < np) {
+ pg++;
+ }
+ }
+ pg++;
+ }
+ cout << res << endl;
+ return 0;
+}
diff --git a/LonelyInteger.cpp b/LonelyInteger.cpp
new file mode 100644
index 0000000..a5ce4a4
--- /dev/null
+++ b/LonelyInteger.cpp
@@ -0,0 +1,12 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main(){
+ int n, x = 0, k;
+ cin >> n;
+ for(int i = 0; i < n; i++){
+ cin >> k;
+ x ^= k;
+ }
+ cout << x;
+ return 0;
+}
diff --git a/Luck_balance.cpp b/Luck_balance.cpp
new file mode 100644
index 0000000..403b53f
--- /dev/null
+++ b/Luck_balance.cpp
@@ -0,0 +1,37 @@
+#include<bits/stdc++.h>
+using namespace std;
+bool comparePair(pair<int, int> p1, pair<int, int> p2){
+ if(p1.second >= p2.second && p1.first > p2.first){
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+int main() {
+ int n, k, sum = 0, cn=0;
+ cin >> n >> k;
+ vector<pair<int, int>> vp(n);
+ for(auto &x : vp){
+ cin >> x.first >> x.second;
+ }
+ sort(vp.begin(), vp.end(), comparePair);
+ cout << "-----------------------------------";
+ cout << endl;
+ for(auto x : vp){
+ cout << x.first << " " << x.second << endl;
+ }
+ for(int i = 0; i < n; i++){
+ if(vp[i].second == 1){
+ cn++;
+ }
+ if(cn != k - 1){
+ cout << "vp[" << i << "]" << vp[i].first << endl;
+ sum+=vp[i].first;
+ }
+ }
+ sum -= vp[cn].first;
+ cout << sum << endl;
+ return 0;
+}
diff --git a/MarcCakwalk.cpp b/MarcCakwalk.cpp
new file mode 100644
index 0000000..91884fd
--- /dev/null
+++ b/MarcCakwalk.cpp
@@ -0,0 +1,18 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main(){
+ int n;
+ long sum;
+ cin >> n;
+ vector<long> v(n);
+ for(auto &x : v){
+ cin >> x;
+ }
+ sort(v.begin(), v.end());
+ for(int i = 0; i < n; i++){
+ cout << "v[" << i << "] = " << v[i] << " * " << "2^" << n - i - 1 << endl;
+ sum += v[i] * pow(2, n - i - 1);
+ }
+ cout << sum << endl;
+ return 0;
+}
diff --git a/MinDiffInArray.cpp b/MinDiffInArray.cpp
new file mode 100644
index 0000000..5440d03
--- /dev/null
+++ b/MinDiffInArray.cpp
@@ -0,0 +1,19 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main(){
+ int n;
+ cin >> n;
+ vector<int> v(n);
+ vector<int> res;
+ for(auto &x : v){
+ cin >> x;
+ }
+ sort(v.begin(), v.end());
+ for(int i = 0; i < n - 1; i++){
+ // 1 2 3 4 5 6 7
+ res.push_back(abs(v[i] - v[i+1]));
+ }
+ cout << *min_element(res.begin(), res.end()) << endl;
+ return 0;
+}
+
diff --git a/RecursiveDigitSum.py b/RecursiveDigitSum.py
new file mode 100644
index 0000000..4d7dbd7
--- /dev/null
+++ b/RecursiveDigitSum.py
@@ -0,0 +1,14 @@
+x,n = map(int, input().split())
+x = str(x)
+x = x * n
+print(x)
+def recursive_digit_sum(x):
+ y = 0
+ if len(x) == 1:
+ return x;
+ else:
+ for i in x:
+ y += int(i)
+ print("y: ", y)
+ return recursive_digit_sum(str(y))
+print(recursive_digit_sum(x))
diff --git a/SequenceEquation.cpp b/SequenceEquation.cpp
new file mode 100644
index 0000000..1714728
--- /dev/null
+++ b/SequenceEquation.cpp
@@ -0,0 +1,25 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int n, count = 1;
+ cin >> n;
+ vector<int> v(n);
+ map<int, int> mp;
+ for(auto &x : v){
+ cin >> x;
+ mp[x] = count;
+ count++;
+ }
+ for(auto x : mp){
+ auto it = find(v.begin(), v.end(), x.second);
+ cout << "value: " << x.first << " Index: " << x.second << endl;
+ cout << it - v.begin() + 1<< endl;
+ }
+
+
+
+
+ return 0;
+}
diff --git a/ThePowerSum.cpp b/ThePowerSum.cpp
new file mode 100644
index 0000000..7f7e032
--- /dev/null
+++ b/ThePowerSum.cpp
@@ -0,0 +1,36 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int power(int base, int p){
+ if(p == 0) {
+ return 1;
+ }
+ return base * (power(base, p - 1));
+}
+
+vector<int> ans;
+
+int powerSum(int x, int n, int lastDigit) {
+ if (x == 0) {
+ for(int x : ans) {
+ cout << x << "^" << n << " + ";
+ }
+ cout << endl;
+ return 1;
+ }
+ int sum = 0;
+ for(int i = lastDigit; x - power(i, n) >= 0; i++) {
+ ans.push_back(i);
+ sum += powerSum(x - power(i, n), n, i + 1);
+ ans.pop_back();
+ }
+ return sum;
+}
+
+int main() {
+ int x, n, count = 0;
+ cin >> x >> n;
+ cout << powerSum(x, n, 1) << endl;
+ return 0;
+}
diff --git a/chocolateFeast.cpp b/chocolateFeast.cpp
new file mode 100644
index 0000000..b7c6fcc
--- /dev/null
+++ b/chocolateFeast.cpp
@@ -0,0 +1,43 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main(){
+ int n, c, m, rem=0, wrap, result, tt, choc;
+ cin >> tt;
+ while(tt--){
+ cin >> n >> c >> m;
+ rem = 0;
+ choc = n / c;
+ rem += n % c;
+ result = choc;
+ wrap = choc;
+ while(wrap >= m){
+ wrap = wrap / m;
+ result += wrap;
+ rem += wrap % m;
+ }
+ rem += wrap % m;
+ result += rem / m;
+ cout << result << endl;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chocolateFeastRevised.cpp b/chocolateFeastRevised.cpp
new file mode 100644
index 0000000..edaa983
--- /dev/null
+++ b/chocolateFeastRevised.cpp
@@ -0,0 +1,19 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ int n, c, m;
+ cin >> n >> c >> m;
+ long long ans = n / c, cur = ans;
+ while (cur >= m) {
+ ans += cur / m;
+ cur = (cur % m) + (cur / m);
+ }
+ cout << ans << '\n';
+ }
+ return 0;
+}
diff --git a/cutTheSticks.cpp b/cutTheSticks.cpp
new file mode 100644
index 0000000..5c2c700
--- /dev/null
+++ b/cutTheSticks.cpp
@@ -0,0 +1,63 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+bool vectorZero(vector<int>& v);
+int secondSmallest(vector<int>& v);
+
+int main(){
+ int vsize;
+ int count=0;
+ vector<int> vec;
+ cin >> vsize;
+ vector<int> result;
+ for(int i = 0; i < vsize; i++){
+ int element;
+ cin >> element;
+ vec.push_back(element);
+ }
+ sort(vec.begin(), vec.end());
+ int mn = *min_element(vec.begin(), vec.end());
+ for(int i = 0; i < vsize; i++){
+ if(vec[i] != 0){
+ vec[i]-= mn;
+ }
+ }
+ cout << vsize;
+ while(!vectorZero(vec)){
+ int ss = vec[secondSmallest(vec)];
+ count = 0;
+ for(int x : vec){
+ cout << x << " ";
+ }
+ cout << endl;
+ for(int i = 0; i < vsize; i++){
+ if(vec[i] != 0){
+ vec[i] -= ss;
+ count++;
+ }
+ }
+ cout << count << endl;
+ }
+ return 0;
+}
+
+
+bool vectorZero(vector<int>& v){
+ int count = 0;
+ for(int i = 0; i < v.size(); i++){
+ if(v[i] == 0){
+ count++;
+ }
+ }
+ return count == v.size();
+}
+
+int secondSmallest(vector<int>& v){
+ for(int i = 0; i < v.size(); i++){
+ if(v[i] != *min_element(v.begin(), v.end())){
+ return i;
+ }
+ }
+ return -1;
+}
diff --git a/cutTheSticksJoe.cpp b/cutTheSticksJoe.cpp
new file mode 100644
index 0000000..4504062
--- /dev/null
+++ b/cutTheSticksJoe.cpp
@@ -0,0 +1,21 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ ios::sync_with_stdio(false);
+ cin.tie(0);
+ int n;
+ cin >> n;
+ map<int, int> mp;
+ for (int i = 0; i < n; i++) {
+ int x;
+ cin >> x;
+ ++mp[x];
+ }
+ for (auto p : mp) {
+ cout << n << '\n';
+ n -= p.second;
+ }
+ return 0;
+}
diff --git a/cutTheSticksRevised.cpp b/cutTheSticksRevised.cpp
new file mode 100644
index 0000000..0d63fb4
--- /dev/null
+++ b/