This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <cassert> | |
| using namespace std; | |
| string s = | |
| "08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08\n\ | |
| 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00\n\ | |
| 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65\n\ | |
| 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91\n\ | |
| 22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80\n\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <cassert> | |
| using namespace std; | |
| int main() { | |
| int n = 2e6; | |
| long long sum = 2; | |
| for (int i = 3; i < n; i += 2) { | |
| bool prime = true; | |
| for (int j = 2; j * j <= i; j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| // find two numbers who's squares, when added, equal a number whose square root, plus those two numbers equals 1000 | |
| int main() { | |
| cout << []{ | |
| int n = 1000; | |
| for (int a = 1; a <= n; a++) { | |
| for (int b = a + 1; b <= n; b++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| string num = "73167176531330624919225119674426574742355349194934\ | |
| 96983520312774506326239578318016984801869478851843\ | |
| 85861560789112949495459501737958331952853208805511\ | |
| 12540698747158523863050715693290963295227443043557\ | |
| 66896648950445244523161731856403098711121722383113\ | |
| 62229893423380308135336276614282806444486645238749\ | |
| 30358907296290491560440772390713810515859307960866\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <cassert> | |
| using namespace std; | |
| int main() { | |
| int n = 10001; | |
| int limit = n/2; | |
| vector<int> prime; | |
| while (true) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <cassert> | |
| using namespace std; | |
| int main() { | |
| int n = 100; | |
| int result = (n * (n + 1) * (3 * n * (n + 1) - 2 * (2 * n + 1)))/12; | |
| cout << result; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <cassert> | |
| using namespace std; | |
| int main() { | |
| int n = 40; | |
| while (true) { | |
| bool found = true; | |
| for (int i = 2; i <= 20; i++) { | |
| if (n % i != 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <cassert> | |
| using namespace std; | |
| using ll = long long; | |
| int sieve() { | |
| ll n = 600851475143; | |
| ll sz = sqrt(n); | |
| vector<bool> prime(sz, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<vector> | |
| #include<functional> | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| enum ScalarType { | |
| UINT8, | |
| Float, | |
| Byte, | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <utility> | |
| #include <string> | |
| #include <tuple> | |
| #include <print> | |
| #include <functional> | |
| #include <concepts> | |
| #include <memory> | |
| #include <iostream> | |
| namespace detail { |
NewerOlder