aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xAlmostTernaryMatrix/mainbin0 -> 22624 bytes
-rw-r--r--AlmostTernaryMatrix/main.cpp20
-rw-r--r--AlmostTernaryMatrix/main_input0.txt4
-rw-r--r--AlmostTernaryMatrix/main_input1.txt2
-rw-r--r--AlmostTernaryMatrix/main_output0.txt8
-rwxr-xr-xDifferenceOperations/mainbin0 -> 27368 bytes
-rw-r--r--DifferenceOperations/main.cpp23
-rw-r--r--DifferenceOperations/main_input0.txt9
-rw-r--r--DifferenceOperations/main_input1.txt3
-rw-r--r--DifferenceOperations/main_input2.txt105
-rw-r--r--DifferenceOperations/main_input3.txt153
-rw-r--r--DifferenceOperations/main_output0.txt4
-rw-r--r--DifferenceOperations/main_output1.txt1
-rw-r--r--DifferenceOperations/main_output2.txt52
-rw-r--r--DifferenceOperations/randomInput.txt154
-rwxr-xr-xFunkyNumbers/mainbin0 -> 40528 bytes
-rw-r--r--FunkyNumbers/main.cpp24
-rw-r--r--FunkyNumbers/main_input0.txt1
-rw-r--r--FunkyNumbers/main_input1.txt1
-rw-r--r--FunkyNumbers/main_input2.txt1
-rw-r--r--FunkyNumbers/main_output0.txt1
-rw-r--r--FunkyNumbers/main_output1.txt1
-rw-r--r--FunkyNumbers/main_output2.txt1
-rwxr-xr-xTheThirdThreeNumberProblem/mainbin0 -> 22680 bytes
-rw-r--r--TheThirdThreeNumberProblem/main.cpp20
-rw-r--r--TheThirdThreeNumberProblem/main_input0.txt6
-rw-r--r--TheThirdThreeNumberProblem/main_output0.txt5
-rwxr-xr-xcodechef/sticks/mainbin0 -> 85968 bytes
-rw-r--r--codechef/sticks/main.cpp42
-rw-r--r--codechef/sticks/main_input0.txt5
-rw-r--r--codechef/sticks/main_input1.txt7
-rw-r--r--codechef/sticks/main_output0.txt2
-rw-r--r--codechef/sticks/main_output1.txt3
-rw-r--r--contests/Round#809/A/B/C/D/E/F/main.cpp13
-rw-r--r--contests/Round#809/A/B/C/D/E/main.cpp13
-rw-r--r--contests/Round#809/A/B/C/D/main.cpp13
-rw-r--r--contests/Round#809/A/B/C/main.cpp13
-rwxr-xr-xcontests/Round#809/A/B/mainbin0 -> 31808 bytes
-rw-r--r--contests/Round#809/A/B/main.cpp58
-rw-r--r--contests/Round#809/A/B/main_input0.txt13
-rw-r--r--contests/Round#809/A/B/main_input1.txt3
-rw-r--r--contests/Round#809/A/B/main_input2.txt3
-rw-r--r--contests/Round#809/A/B/main_input3.txt3
-rw-r--r--contests/Round#809/A/B/main_output0.txt6
-rw-r--r--contests/Round#809/A/B/main_output1.txt1
-rw-r--r--contests/Round#809/A/B/main_output2.txt1
-rw-r--r--contests/Round#809/A/B/main_output3.txt1
-rwxr-xr-xcontests/Round#809/A/mainbin0 -> 42488 bytes
-rw-r--r--contests/Round#809/A/main.cpp35
-rw-r--r--contests/Round#809/A/main_input0.txt13
-rw-r--r--contests/Round#809/A/main_output0.txt6
-rwxr-xr-xstrangeAddition/mainbin0 -> 46808 bytes
-rw-r--r--strangeAddition/main.cpp51
-rw-r--r--strangeAddition/main_input0.txt2
-rw-r--r--strangeAddition/main_input1.txt2
-rw-r--r--strangeAddition/main_output0.txt2
-rw-r--r--strangeAddition/main_output1.txt2
-rwxr-xr-xtestGenerator.py13
58 files changed, 925 insertions, 0 deletions
diff --git a/AlmostTernaryMatrix/main b/AlmostTernaryMatrix/main
new file mode 100755
index 0000000..e0e1fa7
--- /dev/null
+++ b/AlmostTernaryMatrix/main
Binary files differ
diff --git a/AlmostTernaryMatrix/main.cpp b/AlmostTernaryMatrix/main.cpp
new file mode 100644
index 0000000..b12f974
--- /dev/null
+++ b/AlmostTernaryMatrix/main.cpp
@@ -0,0 +1,20 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int n, m;
+ cin >> n >> m;
+ for(int i = 0; i < n; i++) {
+ for(int j = 0; j < m; j++) {
+ cout << ((((i + 1) / 2 + (j + 1) / 2)) % 2) << " ";
+ }
+ cout << '\n';
+ }
+ }
+}
diff --git a/AlmostTernaryMatrix/main_input0.txt b/AlmostTernaryMatrix/main_input0.txt
new file mode 100644
index 0000000..1cb1a53
--- /dev/null
+++ b/AlmostTernaryMatrix/main_input0.txt
@@ -0,0 +1,4 @@
+3
+2 4
+2 2
+4 4
diff --git a/AlmostTernaryMatrix/main_input1.txt b/AlmostTernaryMatrix/main_input1.txt
new file mode 100644
index 0000000..1c253ac
--- /dev/null
+++ b/AlmostTernaryMatrix/main_input1.txt
@@ -0,0 +1,2 @@
+1
+8 8 \ No newline at end of file
diff --git a/AlmostTernaryMatrix/main_output0.txt b/AlmostTernaryMatrix/main_output0.txt
new file mode 100644
index 0000000..8231c12
--- /dev/null
+++ b/AlmostTernaryMatrix/main_output0.txt
@@ -0,0 +1,8 @@
+1 0 0 1
+0 1 1 0
+1 0
+0 1
+1 0 1 0
+0 0 1 1
+1 1 0 0
+0 1 0 1
diff --git a/DifferenceOperations/main b/DifferenceOperations/main
new file mode 100755
index 0000000..808f4b1
--- /dev/null
+++ b/DifferenceOperations/main
Binary files differ
diff --git a/DifferenceOperations/main.cpp b/DifferenceOperations/main.cpp
new file mode 100644
index 0000000..7594a5c
--- /dev/null
+++ b/DifferenceOperations/main.cpp
@@ -0,0 +1,23 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ int n;
+ cin >> n;
+ vector<int> v(n);
+ for (int &x : v)
+ cin >> x;
+ bool ok = true;
+ for (int i = 1; i < n; ++i) {
+ if (v[i] % v[0])
+ ok = false;
+ }
+ cout << (ok ? "YES" : "NO") << endl;
+ }
+}
diff --git a/DifferenceOperations/main_input0.txt b/DifferenceOperations/main_input0.txt
new file mode 100644
index 0000000..a34da86
--- /dev/null
+++ b/DifferenceOperations/main_input0.txt
@@ -0,0 +1,9 @@
+4
+2
+5 10
+3
+1 2 3
+4
+1 1 1 1
+9
+9 9 8 2 4 4 3 5 3
diff --git a/DifferenceOperations/main_input1.txt b/DifferenceOperations/main_input1.txt
new file mode 100644
index 0000000..984e61f
--- /dev/null
+++ b/DifferenceOperations/main_input1.txt
@@ -0,0 +1,3 @@
+1
+3
+1 1 2 \ No newline at end of file
diff --git a/DifferenceOperations/main_input2.txt b/DifferenceOperations/main_input2.txt
new file mode 100644
index 0000000..55ea267
--- /dev/null
+++ b/DifferenceOperations/main_input2.txt
@@ -0,0 +1,105 @@
+52
+2
+1 1
+3
+1 1 1
+3
+1 1 2
+3
+1 1 3
+3
+1 1 4
+3
+1 1 5
+2
+1 2
+3
+1 2 1
+3
+1 2 2
+3
+1 2 3
+3
+1 2 4
+3
+1 2 5
+2
+1 3
+3
+1 3 1
+3
+1 3 2
+3
+1 3 3
+3
+1 3 4
+3
+1 3 5
+2
+1 4
+3
+1 4 1
+3
+1 4 2
+3
+1 4 3
+3
+1 4 4
+3
+1 4 5
+2
+1 5
+3
+1 5 1
+3
+1 5 2
+3
+1 5 3
+3
+1 5 4
+3
+1 5 5
+2
+2 1
+3
+2 1 1
+3
+2 1 2
+3
+2 1 3
+3
+2 1 4
+3
+2 1 5
+2
+2 2
+3
+2 2 1
+3
+2 2 2
+3
+2 2 3
+3
+2 2 4
+3
+2 2 5
+2
+2 3
+3
+2 3 1
+3
+2 3 2
+3
+2 3 3
+3
+2 3 4
+3
+2 3 5
+2
+2 4
+3
+2 4 1
+3
+2 4 2
+3
+2 4 3 \ No newline at end of file
diff --git a/DifferenceOperations/main_input3.txt b/DifferenceOperations/main_input3.txt
new file mode 100644
index 0000000..fe89f7c
--- /dev/null
+++ b/DifferenceOperations/main_input3.txt
@@ -0,0 +1,153 @@
+76
+9
+52 65 14 59 16 52 62 71 90
+8
+66 88 27 98 28 49 48 50
+3
+24 57 99
+7
+51 43 76 90 36 61 97
+9
+86 23 91 42 57 79 38 30 31
+4
+77 10 84 76
+9
+48 89 76 43 47 57 51 71 23
+5
+63 56 17 89 16
+2
+33 45
+4
+34 64 63 48
+10
+92 88 59 78 84 34 64 64 55 61
+4
+52 43 84 43
+9
+13 39 57 62 35 59 10 60 1
+9
+84 89 30 55 33 56 4 18 64
+4
+24 17 78 2
+4
+85 40 7 67
+2
+84 92
+7
+100 3 36 17 46 28 82
+9
+38 2 45 28 32 50 18 92 18
+2
+1 41
+10
+62 85 34 100 40 54 88 31 77 4
+2
+95 86
+2
+72 36
+9
+24 5 98 3 7 22 15 45 67
+3
+22 71 85
+8
+81 51 59 59 89 99 87 18
+10
+5 89 7 19 62 8 31 24 9 86
+10
+1 46 77 90 71 38 34 23 58 10
+3
+60 71 84
+4
+11 16 30 33
+6
+87 91 35 39 4 22
+8
+70 30 39 53 19 23 54 17
+8
+10 95 25 95 20 34 52 11
+9
+74 49 64 24 21 76 63 81 35
+10
+4 64 83 21 85 77 60 65 94 74
+7
+88 53 39 2 29 93 80
+5
+73 3 99 31 10
+8
+54 90 58 48 2 12 16 81
+2
+5 29
+5
+15 97 35 49 7
+10
+9 13 35 59 85 12 26 35 28 81
+10
+15 77 48 56 43 49 68 37 7 37
+2
+76 87
+7
+72 62 21 12 69 42 76
+6
+55 40 45 91 33 25
+10
+71 67 50 78 13 85 90 45 33 51
+7
+81 64 62 88 48 100 82
+10
+45 16 64 85 7 79 18 81 52 95
+6
+84 49 36 20 32 69
+4
+16 47 28 48
+7
+24 93 53 31 78 64 90
+7
+84 68 92 53 8 94 53
+8
+38 54 83 10 80 69 32 25
+8
+17 64 28 81 52 94 85 39
+2
+29 97
+6
+85 26 1 7 75 67
+10
+17 7 11 74 28 44 89 13 69 87
+8
+32 98 15 73 26 32 90 43
+6
+36 88 84 10 60 22
+6
+40 6 26 61 87 85
+9
+95 44 35 39 1 43 16 44 49
+2
+43 98
+3
+6 38 12
+2
+29 96
+4
+52 66 58 66
+2
+61 92
+2
+16 74
+6
+78 53 79 80 99 63
+9
+64 66 71 28 73 4 72 1 61
+9
+27 22 52 20 95 70 69 66 25
+7
+27 86 37 20 48 53 77
+8
+40 92 63 33 91 23 94 37
+3
+17 21 9
+10
+1 30 17 6 12 75 63 71 3 70
+6
+65 74 6 41 10 6
+7
+51 70 8 94 100 64 8
diff --git a/DifferenceOperations/main_output0.txt b/DifferenceOperations/main_output0.txt
new file mode 100644
index 0000000..4d34574
--- /dev/null
+++ b/DifferenceOperations/main_output0.txt
@@ -0,0 +1,4 @@
+YES
+YES
+YES
+NO
diff --git a/DifferenceOperations/main_output1.txt b/DifferenceOperations/main_output1.txt
new file mode 100644
index 0000000..d2bb323
--- /dev/null
+++ b/DifferenceOperations/main_output1.txt
@@ -0,0 +1 @@
+YES \ No newline at end of file
diff --git a/DifferenceOperations/main_output2.txt b/DifferenceOperations/main_output2.txt
new file mode 100644
index 0000000..a31ba10
--- /dev/null
+++ b/DifferenceOperations/main_output2.txt
@@ -0,0 +1,52 @@
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+NO
+YES
+NO
+YES
+NO
+YES
+YES
+YES
+YES
+YES
+YES
+YES
+NO
+YES
+NO \ No newline at end of file
diff --git a/DifferenceOperations/randomInput.txt b/DifferenceOperations/randomInput.txt
new file mode 100644
index 0000000..44573bc
--- /dev/null
+++ b/DifferenceOperations/randomInput.txt
@@ -0,0 +1,154 @@
+76
+9
+52 65 14 59 16 52 62 71 90
+8
+66 88 27 98 28 49 48 50
+3
+24 57 99
+7
+51 43 76 90 36 61 97
+9
+86 23 91 42 57 79 38 30 31
+4
+77 10 84 76
+9
+48 89 76 43 47 57 51 71 23
+5
+63 56 17 89 16
+2
+33 45
+4
+34 64 63 48
+10
+92 88 59 78 84 34 64 64 55 61
+4
+52 43 84 43
+9
+13 39 57 62 35 59 10 60 1
+9
+84 89 30 55 33 56 4 18 64
+4
+24 17 78 2
+4
+85 40 7 67
+2
+84 92
+7
+100 3 36 17 46 28 82
+9
+38 2 45 28 32 50 18 92 18
+2
+1 41
+10
+62 85 34 100 40 54 88 31 77 4
+2
+95 86
+2
+72 36
+9
+24 5 98 3 7 22 15 45 67
+3
+22 71 85
+8
+81 51 59 59 89 99 87 18
+10
+5 89 7 19 62 8 31 24 9 86
+10
+1 46 77 90 71 38 34 23 58 10
+3
+60 71 84
+4
+11 16 30 33
+6
+87 91 35 39 4 22
+8
+70 30 39 53 19 23 54 17
+8
+10 95 25 95 20 34 52 11
+9
+74 49 64 24 21 76 63 81 35
+10
+4 64 83 21 85 77 60 65 94 74
+7
+88 53 39 2 29 93 80
+5
+73 3 99 31 10
+8
+54 90 58 48 2 12 16 81
+2
+5 29
+5
+15 97 35 49 7
+10
+9 13 35 59 85 12 26 35 28 81
+10
+15 77 48 56 43 49 68 37 7 37
+2
+76 87
+7
+72 62 21 12 69 42 76
+6
+55 40 45 91 33 25
+10
+71 67 50 78 13 85 90 45 33 51
+7
+81 64 62 88 48 100 82
+10
+45 16 64 85 7 79 18 81 52 95
+6
+84 49 36 20 32 69
+4
+16 47 28 48
+7
+24 93 53 31 78 64 90
+7
+84 68 92 53 8 94 53
+8
+38 54 83 10 80 69 32 25
+8
+17 64 28 81 52 94 85 39
+2
+29 97
+6
+85 26 1 7 75 67
+10
+17 7 11 74 28 44 89 13 69 87
+8
+32 98 15 73 26 32 90 43
+6
+36 88 84 10 60 22
+6
+40 6 26 61 87 85
+9
+95 44 35 39 1 43 16 44 49
+2
+43 98
+3
+6 38 12
+2
+29 96
+4
+52 66 58 66
+2
+61 92
+2
+16 74
+6
+78 53 79 80 99 63
+9
+64 66 71 28 73 4 72 1 61
+9
+27 22 52 20 95 70 69 66 25
+7
+27 86 37 20 48 53 77
+8
+40 92 63 33 91 23 94 37
+3
+17 21 9
+10
+1 30 17 6 12 75 63 71 3 70
+6
+65 74 6 41 10 6
+7
+51 70 8 94 100 64 8
+
diff --git a/FunkyNumbers/main b/FunkyNumbers/main
new file mode 100755
index 0000000..8b7a093
--- /dev/null
+++ b/FunkyNumbers/main
Binary files differ
diff --git a/FunkyNumbers/main.cpp b/FunkyNumbers/main.cpp
new file mode 100644
index 0000000..9c5234d
--- /dev/null
+++ b/FunkyNumbers/main.cpp
@@ -0,0 +1,24 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int n;
+ cin >> n;
+ n = n * 2;
+ set<long long> st;
+ for (int i = 1; i * i <= n; i++) {
+ st.insert(i * (i + 1));
+ }
+ bool ok = false;
+ for (auto x : st) {
+ cerr << x << endl;
+ if(st.count(n - x)) {
+ ok = true;
+ break;
+ }
+ }
+ cout << (ok ? "YES" : "NO") << endl;
+}
diff --git a/FunkyNumbers/main_input0.txt b/FunkyNumbers/main_input0.txt
new file mode 100644
index 0000000..9183bf0
--- /dev/null
+++ b/FunkyNumbers/main_input0.txt
@@ -0,0 +1 @@
+256
diff --git a/FunkyNumbers/main_input1.txt b/FunkyNumbers/main_input1.txt
new file mode 100644
index 0000000..4d0e90c
--- /dev/null
+++ b/FunkyNumbers/main_input1.txt
@@ -0,0 +1 @@
+512
diff --git a/FunkyNumbers/main_input2.txt b/FunkyNumbers/main_input2.txt
new file mode 100644
index 0000000..7bed022
--- /dev/null
+++ b/FunkyNumbers/main_input2.txt
@@ -0,0 +1 @@
+828 \ No newline at end of file
diff --git a/FunkyNumbers/main_output0.txt b/FunkyNumbers/main_output0.txt
new file mode 100644
index 0000000..f033a50
--- /dev/null
+++ b/FunkyNumbers/main_output0.txt
@@ -0,0 +1 @@
+YES
diff --git a/FunkyNumbers/main_output1.txt b/FunkyNumbers/main_output1.txt
new file mode 100644
index 0000000..5e35d1b
--- /dev/null
+++ b/FunkyNumbers/main_output1.txt
@@ -0,0 +1 @@
+NO
diff --git a/FunkyNumbers/main_output2.txt b/FunkyNumbers/main_output2.txt
new file mode 100644
index 0000000..d2bb323
--- /dev/null
+++ b/FunkyNumbers/main_output2.txt
@@ -0,0 +1 @@
+YES \ No newline at end of file
diff --git a/TheThirdThreeNumberProblem/main b/TheThirdThreeNumberProblem/main
new file mode 100755
index 0000000..4d2eb59
--- /dev/null
+++ b/TheThirdThreeNumberProblem/main
Binary files differ
diff --git a/TheThirdThreeNumberProblem/main.cpp b/TheThirdThreeNumberProblem/main.cpp
new file mode 100644
index 0000000..656b3df
--- /dev/null
+++ b/TheThirdThreeNumberProblem/main.cpp
@@ -0,0 +1,20 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int n;
+ cin >> n;
+ if(n % 2) {
+ cout << -1 << endl;
+ } else {
+ cout << "0" << " " << n / 2 << " " << n / 2 << endl;
+ }
+
+ }
+}
diff --git a/TheThirdThreeNumberProblem/main_input0.txt b/TheThirdThreeNumberProblem/main_input0.txt
new file mode 100644
index 0000000..8cc752e
--- /dev/null
+++ b/TheThirdThreeNumberProblem/main_input0.txt
@@ -0,0 +1,6 @@
+5
+4
+1
+12
+2046
+194723326
diff --git a/TheThirdThreeNumberProblem/main_output0.txt b/TheThirdThreeNumberProblem/main_output0.txt
new file mode 100644
index 0000000..35b1415
--- /dev/null
+++ b/TheThirdThreeNumberProblem/main_output0.txt
@@ -0,0 +1,5 @@
+3 3 1
+-1
+2 4 6
+69 420 666
+12345678 87654321 100000000
diff --git a/codechef/sticks/main b/codechef/sticks/main
new file mode 100755
index 0000000..ebd7c57
--- /dev/null
+++ b/codechef/sticks/main
Binary files differ
diff --git a/codechef/sticks/main.cpp b/codechef/sticks/main.cpp
new file mode 100644
index 0000000..b5fae0e
--- /dev/null
+++ b/codechef/sticks/main.cpp
@@ -0,0 +1,42 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ int n;
+ cin >> n;
+ vector<int> v(n);
+ map<int, int> mp;
+ for (int &x : v) {
+ cin >> x;
+ mp[x]++;
+ }
+ vector<int> pair;
+ set<int> vis;
+ int sq = 0;
+ sort(v.begin(), v.end());
+ for(int i = v.size() - 1; i > 0; i--) {
+ int elem = v[i];
+ if(mp[elem] >= 4) {
+ sq = elem;
+ }
+ if(mp[elem] >= 2 && !vis.count(elem)) {
+ if(pair.size() == 2) {
+ break;
+ }
+ pair.push_back(elem);
+ vis.insert(elem);
+ }
+ }
+ if(pair.size() == 2) {
+ cout << max(pair[0] * pair[1], sq * sq) << endl;
+ } else {
+ cout << -1 << endl;
+ }
+ }
+}
diff --git a/codechef/sticks/main_input0.txt b/codechef/sticks/main_input0.txt
new file mode 100644
index 0000000..c12bf91
--- /dev/null
+++ b/codechef/sticks/main_input0.txt
@@ -0,0 +1,5 @@
+2
+5
+1 2 3 1 2
+4
+1 2 2 3
diff --git a/codechef/sticks/main_input1.txt b/codechef/sticks/main_input1.txt
new file mode 100644
index 0000000..636b9ba
--- /dev/null
+++ b/codechef/sticks/main_input1.txt
@@ -0,0 +1,7 @@
+3
+6
+1 1 2 2 3 3
+10
+1 1 3 3 4 4 5 5 5 5
+1
+1 \ No newline at end of file
diff --git a/codechef/sticks/main_output0.txt b/codechef/sticks/main_output0.txt
new file mode 100644
index 0000000..4bbcfcf
--- /dev/null
+++ b/codechef/sticks/main_output0.txt
@@ -0,0 +1,2 @@
+2
+-1
diff --git a/codeche