uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3ffdc9ab-a45e-4a2f-8e20-f41c09561404 | baoqg9104/Codeforces | A_Elephant.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int ans = n/5;
if (n%5 > 0) {
ans++;
}
cout<<ans;
return 0;
} | ALGO | 0.999818 | 4.183509 |
28cb4edd-b907-4387-85d7-cccd8b36ec30 | HimanshiNayak/GFG-Solutions | Difficulty: Basic/Implement Queue using array/implement-queue-using-array.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
struct QueueNode
{
int data;
QueueNode *next;
};
class MyQueue {
private:
int arr[100005];
int front;
int rear;
public :
MyQueue(){front=0;rear=0;}
void push(int);
int pop();
};
int main()
{
int T;
cin>>T;
... | ALGO | 0.9959 | 5.636713 |
545dde1c-3606-4d2d-8554-9b9c4cd6988d | Kawser-nerd/CLCDSA | Source Codes/AtCoder/agc027/C/3201948.cpp | #include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
using namespace std;
typedef l... | ALGO | 0.999994 | 4.446385 |
fe617f14-f33c-476a-9853-ce834806ece1 | kkartikk95/dicee_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
e7d56ef9-a1d6-4654-8f84-2745637fff11 | anugoyal998/DSA | CSES/Range Queries/Salary_Queries.cpp | #include <bits/stdtr1c++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
/*** Needs C++11 or C++14 ***/
/// Treap supporting duplicating values in set
/// Maximum value of treap * ADD must fit in long long
struct Treap{ /// hash = 9681... | ALGO | 0.999724 | 4.314936 |
5afd2492-bb7c-4d7f-be06-4a39cc6fcd40 | Himanshuyadav24/unacademydsa | findsubArrays0sum.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int main()
{
int arr[] = {4, 2, -3, 1, 6};
int n = 5;
vector<int> prefixSum(n);
int sum = 0;
for (int i = 0; i < n; i++)
{
sum = sum + arr[i];
prefixSum[i] = sum;
}
int count = 0;
u... | ALGO | 0.999963 | 4.834963 |
9aa6b0f3-63fd-426e-91e6-13bdd00d0d36 | Nekregor1/Schildt_Git | Lesson7/demo_void.cpp | #include <iostream>
using namespace std;
void print_vertical(char* str);
void demo_void(int argc, char* argv[])
{
if (argc==2)
print_vertical(&argv[1][0]);
}
void print_vertical(char* str)
{
while (*str)
cout << *(str++) << '\n';
}
| TOOL | 0.941505 | 4.623442 |
16b7e025-ad83-4333-89ba-01b2ac1f9367 | AshwiniTokekar/Codes | SPOJ/programs/OLOLO.cpp | #include<cstdio>
using namespace std;
int main()
{
int nop;
long long int result=0,temp;
scanf("%d",&nop);
for(int i=0;i<nop;i++)
{
scanf("%lld",&temp);
result=result^temp;
}
printf("%lld\n",result);
return 0;
}
| ALGO | 0.999886 | 3.753911 |
0e1a36be-36ea-404c-b228-90e3394cf24b | ishandutta2007/codeforces | kaitokid/normal/1430/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,t;
string s;
int main()
{
ios::sync_with_stdio(0);
cin>>t;
while(t--)
{
vector<int>v;
cin>>n>>s;
int u=1;
for(int i=1;i<n;i++)
if(s[i]!=s[i-1]){v.push_back(u);u=1;}
else u++;
v.push_back(u);
... | ALGO | 0.999952 | 3.980705 |
aae2b7a0-6ada-4610-957f-996db9b3d3b0 | GlodonOpenSrc/Qt5.9.5_Glodon | qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/processing/src/backgrounddetection/BackgroundDetection.cpp | #include "BackgroundDetection.h"
WELSVP_NAMESPACE_BEGIN
#define LOG2_BGD_OU_SIZE (4)
#define LOG2_BGD_OU_SIZE_UV (LOG2_BGD_OU_SIZE-1)
#define BGD_OU_SIZE (1<<LOG2_BGD_OU_SIZE)
#define BGD_OU_SIZE_UV (BGD_OU_SIZE>>1)
#define BGD_THD_SAD (2*BGD_OU_SIZE*BGD_OU_SIZE)
#define BGD_THD_ASD_UV (4... | ALGO | 0.99271 | 5.985975 |
6a745a48-9166-42e5-b2db-b331906bf8fa | DEmmaRL/CPP | A_First_Grid.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
//typedef
typedef long long int lli ;
//fore
#define fore(i, a, b) for(int i = (a); i <= (b); ++i)
//ESTRUCTURAS
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vi vector<int>
#define vll vec... | ALGO | 0.999957 | 4.16393 |
1b84c67f-e96f-4a87-b18c-9e2e50e288cd | SnehilVukkusila/graph-resources | Leetcode Daily Challenge/January-2021/15. Get Maximum in Generated Array.cpp | /*
Get Maximum in Generated Array
===============================
You are given an integer n. An array nums of length n + 1 is generated in the following way:
nums[0] = 0
nums[1] = 1
nums[2 * i] = nums[i] when 2 <= 2 * i <= n
nums[2 * i + 1] = nums[i] + nums[i + 1] when 2 <= 2 * i + 1 <= n
Return the maximum integer ... | ALGO | 0.999986 | 6.853754 |
283f4dee-425e-4d0f-9092-7c5c9af6f879 | anuyo32/ss_seminar | src/addition_protocol.cpp | #include "addition_protocol.hpp"
std::vector<u_int32_t> Add(std::vector<u_int32_t> shares1, std::vector<u_int32_t> shares2, u_int32_t fieldSize){
std::vector<u_int32_t> result(2);
for(int i = 0; i < 2; i++)
{
result[i] = (shares1[i] + shares2[i] )% fieldSize;
}
return result;
}
| ALGO | 0.996165 | 5.142357 |
f9a1ca95-2aae-49aa-865c-0bea511f5ccd | greenbeanpie/OI-training | NOIP2023-ZJ/ZJ-0157/run/run.cpp | #include <bits/stdc++.h>
#define int long long
#define lp (p<<1)
#define rp (p<<1|1)
using namespace std;
int read() {
int x=0, f=0; char c=getchar();
while (!isdigit(c)) f|=c=='-', c=getchar();
while (isdigit(c)) x=(x<<3)+(x<<1)+(c^48), c=getchar();
return f ? -x : x;
}
const int N=1e5+10;
int n, m, k, d, t[N<<... | ALGO | 0.999852 | 4.712137 |
2db29c68-9005-47c8-b94a-6c19b8156406 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/October/answer_20201006182238.cpp | #include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int findIndex(int a[], int n, int x, int p) {
int min = 100000000, minp;
for(int i=0;i<n;i++){
if(a[i] == x) {
if(abs(p-i) < min) {
min = abs(p-i);
minp = i;
}
}
}
return minp;... | ALGO | 0.999913 | 3.885036 |
2cd1ce8b-dec5-4151-986c-5a7cc6d4f745 | morris821028/UVa | volume115/11569 - Lovely Hint.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
int main() {
char cmd[300];
int dp[300], way[300];
gets(cmd);
while(gets(cmd)) {
int cnt[26] = {}, i, j;
for(i = 0; cmd[i]; i++) {
if(cmd[i] >= 'A' && cmd[i] <= 'Z')
cnt[cmd[i]-'A']++;
}
... | ALGO | 0.998891 | 3.4276 |
ae2617e8-55da-49ba-b4eb-24d85f9fa4d4 | KeiKeiZuihaoYa/Git-repository | vsc-c++/oj/hdu/2412.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int, int> Pii;
const int inf = (1 << 30) + 1;
const int N = 210;
int dp[N][2], f[N][2], n;
map<string, int> mp;
vector<int> edge[N];
void dfs(int u)
{
dp[u][0] = 0;
dp[u][1] = 1;
for (auto v : edge[u])
{
dfs(v);
... | ALGO | 0.999975 | 4.361243 |
8fdcca71-866f-47a0-8324-c6a087333fc9 | Ayush1906saxena/dsaWithCpp | firstUniqueCharacter.cpp | // Example 1:
// Input: s = "codingminutes"
// Output: 0
// Example 2:
// Input: s = "aabb"
// Output: -1
#include <bits/stdc++.h>
#define ayush
using namespace std;
int firstUniqChar(string s) {
unordered_map<char, int> map;
for(int i = 0; i < s.size(); i++){
if(map.count(s[i]) != 0)... | ALGO | 0.999847 | 5.673253 |
b803dfef-acb8-41b4-a266-4275b6973c09 | ishandutta2007/codeforces | dmga44/normal/1442/B.cpp | #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops","omit-frame-pointer","inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,fma,tune=native")
#pragma GCC option("arch=native","no-zero-upper") //Enable AVX
#include <bits/stdc++.h>
#define db(x) cout << (x) << '\n';
#de... | ALGO | 0.999974 | 4.521074 |
46575a4b-4c9e-4191-b4e7-d471d935b11f | frcteam195/FRC2018 | Old/PolynomialRegressionCpp/third_party/eigen/doc/examples/Tutorial_ArrayClass_addition.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(3,3);
ArrayXXf b(3,3);
a << 1,2,3,
4,5,6,
7,8,9;
b << 1,2,3,
1,2,3,
1,2,3;
// Adding two arrays
cout << "a + b = " << endl << a + b << endl << endl;
// Subt... | ALGO | 0.970126 | 3.642258 |
5fe0e9ab-9f31-4764-89d1-257053a73bb6 | phrock/acm | spoj/OAE/1.cpp | #include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstr... | ALGO | 0.999837 | 4.554945 |
e3f94f03-30dc-4d1b-9a6f-aa2b8a4d67f1 | liuhb86/leetcode | Implement strStr.cpp | class Solution {
public:
char *strStr(char *haystack, char *needle) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if (needle == NULL) return NULL;
int len = strlen(needle);
if (len == 0 ) return haystack;
int *T = new int[len... | ALGO | 0.999849 | 5.09837 |
3b95a004-09f6-4761-9fca-05247aefc8a7 | Armaan42/College-Training-Program | Day-10/mergeSort.cpp | /*
The algorithm for merge sort:
Divide the unsorted list into n sublists, each containing one element (a list of one element is considered sorted).
Repeatedly merge sublists to produce new sorted sublists until there is only one sublist remaining. This will be the sorted list.
The merge operation works as fo... | ALGO | 0.99999 | 6.281323 |
e3f666e0-44b6-4de0-a481-4e012574ba6c | R3nch00/CodeForces | Remove Duplicates.cpp | // mes que un club //
#import <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n; int a[n]; vector<int> v;
for(int i=0;i<n;i++) cin>>a[n-i-1];
for(int i=0;i<n;i++){
if(find(v.begin(), v.end(), a[i])==v.end())v.push_back(a[i]);
}
n=v.size(); cout<<n<<endl;
for(int i=n-1;i>=0;i--) cout<<v[i]<<" ";
... | ALGO | 0.999949 | 3.351274 |
92ea7df4-b7f9-42d2-91af-ad6359b686d5 | nikhilmantri99/Interviewbit-questions-solution | backtracking/permute.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
void print_vector(vector <int> &x){
for(int i=0;i<x.size();i++){
cout<<x[i]<<" ";
}
cout<<endl;
}
void update_answer(vector<vector<int>> &ans, vector <int> &temp, vector <bool> &status, vector <int> &A){
//cout<<"called"<<endl;
if(temp.size()==... | ALGO | 0.999906 | 4.743881 |
6240ecb4-96c1-4066-8e89-246d1fe85936 | hamdashahid/Console-Notepad | main.cpp | #include<iostream>
#include <ncurses.h>
#include <fstream>
#include<string>
using namespace std;
struct ListNode{
ListNode* next;
ListNode* prev;
char data;
ListNode(char d = '\0' , ListNode* n = NULL , ListNode* p = NULL){
data = d;
next = n;
prev = p;
}
};
struct AVLnod... | ALGO | 0.903615 | 3.385724 |
4750896c-d337-42d8-9947-6f0cf42ea0f2 | its-coder5128/leetcode | my-folder/problems/maximal_network_rank/solution.cpp | class Solution {
public:
int maximalNetworkRank(int n, vector<vector<int>>& roads) {
vector<int> cities(n,0);
set<pair<int,int>> road_set;
for(int i=0;i<roads.size();i++)
{
int u = roads[i][0];
int v = roads[i][1];
road_set.insert({u,v});
... | ALGO | 0.999932 | 5.739963 |
6a166771-0ec1-4fdf-89ea-e7fc2ab0a668 | ishandutta2007/codeforces | m_99/normal/1743/F.cpp | #include <stdio.h>
#include <bits/stdc++.h>
#include <cassert>
#include <numeric>
#include <type_traits>
#ifdef _MSC_VER
#include <intrin.h>
#endif
#include <utility>
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
constexpr long long safe_mod(long long x, long long m) {
x... | ALGO | 0.999929 | 4.301252 |
eadecf79-c552-409a-9348-25631b915c1e | KrystianWasil/Algorithms | Dynamic.cpp | #include <iostream>
#include <algorithm>
class Comparator {
public:
bool operator()(const std::pair<int, int>& a, const std::pair<int, int>& b) const {
return a.second < b.second;
}
};
int main() {
int t, n;
Comparator comp;
std::cin >> t;
for (int i = 0; i < t; ++i) {
std::ci... | ALGO | 0.999939 | 5.83964 |
339a5f7a-99d2-4594-bf50-dd18b6422ede | ishandutta2007/codeforces | hank55663/normal/1290/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) mems... | ALGO | 0.999954 | 3.636829 |
3cd4ba0b-e513-4145-9bf6-e39064ba95ce | itish-agarwal/CP-submissions | CodeChef/C++17/ITGUY60/41038136.cpp | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
const int nax = 1e5 + 555;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
vector<string> ret;
for(int i = 1; i < nax; i++) {
string s = "";
int t = i;
while(t) {
if(t % 2) {
s += '1';
} else {
s... | ALGO | 0.999951 | 4.62299 |
0ac80261-bc0b-4779-ad1e-f5dff60463fe | L1ghtError/politek_sem | spz_labs/src/lab_one/main.cpp |
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
// ะกัััะบัััะฐ ะดะปั ะฟะตัะตะดะฐัั ะฐัะณัะผะตะฝััะฒ ั ััะฝะบััั ะฟะพัะพะบั
struct ThreadArgs {
int *array; // ะะธะฝะฐะผััะฝะธะน ะผะฐัะธะฒ
int array_size; // ะ ะพะทะผัั ะผะฐัะธะฒั
int max;
};
// ะคัะฝะบััั ะฟะพัะพะบั ะดะปั ะพะฑะตััะฐะฝะฝั ะผะฐัะธะฒั
DWORD WINAPI reverseArray(LPVOID lpParam) {
struc... | ALGO | 0.999467 | 4.645575 |
30accf61-6dfb-4f76-83e1-5898feedc719 | hasan2733/Data_structure-Algorithm | graph_representation_by_matrix.cpp | #include<iostream>
#include<vector>
#include<iomanip>
using namespace std;
void add_edge(vector<vector<int>>&adjmat,int u,int v,int wt)
{
adjmat[u][v]=wt;
adjmat[v][u]=wt;
}
void del_edge(vector<vector<int>>&adjmat,int u,int v,int wt)
{
adjmat[u][v]=0;
adjmat[v][u]=0;
}
int main()
{
... | ALGO | 0.999965 | 4.292199 |
5ee7190b-a1a0-444c-8942-13f1034955df | xiaozhedesu/luogu-solution | code-P/P5704.cpp | #include <stdio.h>
int main() {
char letter;
scanf("%c", &letter);
printf("%c", letter - 32);
return 0;
}
| ALGO | 0.974005 | 3.22956 |
349d7c58-9520-4429-8054-ec208ce318de | Madness-D/CodeUp | 4 ็ฎๆณๅๆญฅ/4.1 ๆๅบ/D ๅญ็ฌฆไธฒๅ
ๆๅบ.cpp | //่พๅ
ฅไธไธชๅญ็ฌฆไธฒ๏ผ้ฟๅบฆๅฐไบ็ญไบ200๏ผ็ถๅๅฐ่พๅบๆๅญ็ฌฆ้กบๅบๅๅบๆๅบๅ็ๅญ็ฌฆไธฒใ
//ๆณจๆ่พๅ
ฅ็ๅญ็ฌฆไธฒไธญๅฏ่ฝๆ็ฉบๆ ผใ
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
string str;
while(getline(cin,str)){
sort(str.begin(),str.end());
cout<<str<<endl;
}
return 0;
}
| ALGO | 0.998938 | 4.384219 |
9841fb09-9320-447e-a57c-623b1fdcc3f6 | bhagyo/faltu-code | soft pagol/uva 10699 - Count the factors.cpp | /****** HAREE KRISHNA ******/
//#include<bits/stdc++.h>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<stack>
#include<list>
// ASCII Vlaue
// A=65,Z=90,a=97,z=122,0=48... | ALGO | 0.999245 | 3.505026 |
59afd92d-2786-4383-81c9-115ee4fffbad | willcassella/Penumbra | newton-dynamics-2.36/physics/dgMeshEffect3.cpp | #include "dgPhysicsStdafx.h"
#include "dgBody.h"
#include "dgWorld.h"
#include "dgMeshEffect.h"
#include "dgCollisionConvexHull.h"
#include "dgMeshEffectSolidTree.h"
// based of the paper Hierarchical Approximate Convex Decomposition by Khaled Mamou
// with his permission to adapt his algorithm so be more efficient.
... | ALGO | 0.998786 | 3.630511 |
da21b757-6ccc-4a09-88f1-1c7397edda7a | sunnysetia93/competitive-coding-problems | LeetCode/All/cpp/88.merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int i = m-1, j = n-1, k = m+n-1;
while (i >= 0 && j >= 0) nums1[k--] = (nums1[i] >= nums2[j] ? nums1[i--] : nums2[j--]);
while (j >= 0) nums1[k--] = nums2[j--];
}
}; | ALGO | 0.999968 | 5.594429 |
cf5655ed-31b2-4e40-8b51-e2cfdbda2779 | alexpessoajr/programming-challenges | Solutions/SPOJ-BR/bsearch1.cpp |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, q, x;
int v[100010] = { 0 };
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> v[i];
}
for (int i = 0; i < q; i++) {
cin >> x;
int l = 0;
int r = n - 1;
int m;
while (l <= r) {
m = (l + r) / 2;
... | ALGO | 0.999988 | 4.885291 |
23f0d357-ae36-443c-81b5-b60cc1b97487 | LeoKuo-0223/Algorithm | HW11/manhattenMST.cpp | #include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
class Edge{
public:
int cost,u,v;
};
class DisjointSets{
public:
int *parent, *rnk;
int n;
DisjointSets(int n){
this->n = n;
parent = new int[n+1];
rnk = new int[n+1];
for (int i = 0; i <= n; i++){
rnk[i] = 0;
p... | ALGO | 0.999869 | 4.435543 |
1c87faa8-2fde-46b9-9630-e60bbd0f75cd | wrr606/OJ_Code | Zerojudge/Uva้กๅบซ/e635.cpp | //e635. 12908 - The book thief
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define ll long long
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll n,dp;
while(cin>>n&&n){
int i=2;
dp=1;
while... | ALGO | 0.999736 | 3.810238 |
57ff4d9e-49f2-4040-943f-e292a8802912 | limkskr/cpp | 5_Queue/HambergerSim.cpp | #include <iostream>
#include <time.h>
#include <stdlib.h>
#include "CircularQueue.h"
#define CUS_COME_TERM 15
#define CHE_BUR 0
#define BUL_BUR 1
#define DUB_BUR 2
#define CHE_TERM 12
#define BUL_TERM 15
#define DUB_TERM 24
int main1()
{
int makeProc=0;
int cheOrder=0, bulOrder=0, dubOrde... | TOOL | 0.945767 | 3.747633 |
79f05f5d-d98c-4ca3-acf4-cf1e038f7ff1 | Shadab9/DSA-problems | middle-of-the-linked-list/middle-of-the-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* middleNode(... | ALGO | 0.999881 | 5.884769 |
2acccd5a-5193-40df-83a1-f54766698b21 | anthonyclyan/Beginning_CPP_Programming | Section05-Structure_of_a_CPP_Program/section05_source_code/Comments/main.cpp | // Section 5
// Comments
/*****************************************************
* author Frank
*
* 11/11/2017 Frank - fixed bug in ...
* 11/13/2017 Joe - Added function to...
*
****************************************************/
#include <iostream>
// This is a comment
/* This is a multiple
line
... | TOOL | 0.980316 | 3.257314 |
54a709a7-3d64-45ad-aa2d-535c55f164ac | itsme3030/codeForces | codeforces/1443/C.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int ll
typedef tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ordset;
int mod = 1e9 + 7;
// numberTheory nt;
cl... | ALGO | 0.999979 | 5.244431 |
2d95f01c-da9a-438f-a94e-10a089d4a22e | D-01576/Leetcode | 0039-combination-sum/0039-combination-sum.cpp | class Solution {
private:
vector<vector<int>> ans;
void solve(vector<int>& candidates, int start, vector<int>& current, int target) {
if (target == 0) {
ans.push_back(current);
return;
}
for (int i = start; i < candidates.size(); ++i) {
i... | ALGO | 0.999993 | 6.853685 |
74ca2f90-889c-47a4-96d5-a6b8f525e8ab | tazbin/problem-solving | implementations/Viral Advertising.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int shared = 5;
int liked = 0;
int cumulative = 0;
int n;
cin >> n;
for( int i=0; i<n; i++ )
{
liked = shared / 2;
cumulative += liked;
shared = liked*3;
}
cout << cumulative << endl;
return 0... | ALGO | 0.999967 | 3.389668 |
bd9b28bf-62a9-40ff-8914-57d84a4ad19a | sarvex/leetcode-solidity | solution/0200-0299/0244.Shortest Word Distance II/Solution.cpp | class WordDistance {
public:
WordDistance(vector<string>& wordsDict) {
for (int i = 0; i < wordsDict.size(); ++i) {
d[wordsDict[i]].push_back(i);
}
}
int shortest(string word1, string word2) {
auto a = d[word1], b = d[word2];
int i = 0, j = 0;
int ans = I... | ALGO | 0.999905 | 6.239474 |
4a832b30-5e7b-4bbb-96c7-ac21650dbb5e | VestigesH/C | ็ปไน ไปฃ็ /่ฟไผผๆฑPI็ๅผ.cpp | #include <math.h>
#include <stdio.h>
main()
{
int s = 1;
float t, n, pi;
t = 1;
n = 1.0;
pi = 0;
while(fabs(t) >= 1e-6)
{
pi += t;
n += 2;
s = -s;
t = s / n;
}
pi *= 4;
printf("pi=%f",pi);
}
| ALGO | 0.999969 | 3.319735 |
10f1bc04-889a-460c-9926-d9a8bce5acd2 | Gonagi/Algorithm | ๋ฐฑ์ค/49_๋ฐ์ค_๋๋๊ธฐ_๊ฒ์_11867.cpp | // ๋ฐ์ค ๋๋๊ธฐ ๊ฒ์
// 11867
/*
#include <iostream>
int main()
{
int N, M;
std::cin >> N >> M;
if (N % 2 == 0 || M % 2 == 0)
std::cout << 'A' << '\n';
else
std::cout << 'B' << '\n';
return 0;
}
*/ | ALGO | 0.99998 | 4.485797 |
48dda01b-a646-4eaa-b632-9674a86aee46 | RotterYkrn/atcoder | typical90/019/main.cpp | #ifdef __TEMPLATE__
#pragma region template
#endif
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
// ใใพใใชใ
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
struct Init { Init() { ios::sync_w... | ALGO | 0.999935 | 5.476216 |
0520e0f6-08a0-4b2e-9e99-7d0cdaa09faa | shivika24/UCA-WORK | power_of_2.cpp | int Solution::power(string A) {
//long long int k=stoll(A);
int k,sum=0,num=0,i;
for(i=0;i<A.length();i++)
{
num=A[i]-'0';
sum=sum*10+num;
}
if(sum==1)
return 0;
if(((sum)&(sum-1))==0)
return 1;
return 0;
}
| ALGO | 0.999805 | 4.360672 |
58007d86-03bc-42c0-91ca-cd51518d62d4 | samardzzziska/FINKI | ะกัััะบัััะฝะพ ะฟัะพะณัะฐะผะธัะฐัะต/ะัะพั ะบะพะปะพะบะฒะธัะผ/Exercises for second midterm and exams/zad3.cpp | /* Let A = {a1, a2, .. a_n} is an array of integers. The size of the array n and the elements of the array are read from SI.
* Write a program that will transform the array so each element of the original array is replaced with the number of appearance
* of the least significant digit (the right most) in the number i... | ALGO | 0.999888 | 5.6333 |
f33a23a7-0c36-4c93-a847-fc8ea1c5517d | PurreCoder/competitive-programming | Yandex Trainings 5.0/Contest 1/G.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <string>
#include <stack>
#include <iomanip>
#include "inttypes.h"
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end... | ALGO | 0.999933 | 4.321496 |
ce4cb4a8-2d82-43c3-9653-347ae68691b5 | gvpHactober/HactoberfestAccepted | DSA Problems/C++/RatInAMaze.cpp | #include <stdio.h>
// Maze size
#define N 4
bool solveMazeUtil(
int maze[N][N], int x,
int y, int sol[N][N]);
void printSolution(int sol[N][N])
{
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++)
printf(" %d ", sol[i][j]);
printf("\n");
}
}
bool isSafe(int maz... | ALGO | 0.999975 | 4.754774 |
7815c81b-6b57-42b4-b799-ec3b8a26d4da | anj501/CS010C | Lab_3_Function_Template_and_Exception_Handling/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <stdexcept>
using namespace std;
template <typename T>
unsigned min_index(const vector<T> &vals, unsigned index) {
unsigned i;
for (i = index + 1; i < vals.size(); ++i) {
if (vals.at(i) < vals.at(index)) {
index = i;
}... | ALGO | 0.99771 | 5.135802 |
40708d60-6a58-40a7-a20f-8392f9053ff8 | romsaejao/Lab22. | lab22_3.cpp | #include<iostream>
using namespace std;
//Write function count() here.
int main(){
int data[] = {1,2,4,5,4,8,2,1,2,4,6,1,4,4,4,2,1,0,12};
cout << "There are " << count(data,sizeof(data)/sizeof(int));
cout << " different numbers in data.";
return 0;
}
| ALGO | 0.997703 | 3.810478 |
f354a057-a1b5-47e2-ac22-a53d1c0c7f0b | shubh-zs/C---Mac | Array/element_sear.cpp | #include<iostream>
using namespace std;
void uni(int arr[],int s){
int i,a,b,c,d,e,f;
cout<<"1. Unique elements \n"<<"2. Duplicate elements\n";
cin>>i;
cout<<"\n";
int ar1[100];
for(a=1;a<s+1;a++){
ar1[s]=a;
}
for(a=0;a<s;a++){
}
}
int main(){
int a,b,c,d;
... | ALGO | 0.970795 | 3.456712 |
f302b26e-432c-4778-8009-bd4cbed1a6b7 | kanieldim/CU-Boulder---CS | CSCI 2270 - Data Structures/Recitation/rec10/Lab10/MinHeap.cpp | #include "MinHeap.hpp"
#include <limits.h>
using namespace std;
/*
Swaps two integer values
*/
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
/*
Constructor for our MinHeap implementation
*/
MinHeap::MinHeap(int cap)
{
currentSize = 0;
capacity = cap;
heapArr = new int[capacity];
}
/*
F... | ALGO | 0.999307 | 4.530393 |
7775b0ca-594b-4d38-b16a-d66d53625eb2 | 123shahan/CPP-questions- | pattternrhombus.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
int N, row=1;
cin>>N;
while(row<=N)
{
int i=1;
while(i<=N-row)
{
cout<<'\t';
i=i+1;
}
int j=1, op1=row, other_part;
while(j<=(2*row)-1)
{
if(op1<=(2*row)-1)
{
cout<<op1<<'\t';
op1=op1+1;
other_part=op1-2;
}... | ALGO | 0.999683 | 3.068845 |
2ed1df9a-ab51-4e20-b26a-2ac51051e57d | ancloudie/InsertionSort_120 | InsertionSort/InsertionSort.cpp | #include <iostream>
using namespace std;
int arr[20]; // Membuat array panjang data 20
int n; // Membuat variabel inputan n
void input()
{ // Procedure Input
while (true)
{
cout << "Masukan Jumlah Data Pada Array : "; // Membuat Inputan Jumlah Element Array
cin >> n; // Memanggil Varia... | ALGO | 0.999198 | 3.661895 |
5c33e546-42c4-423c-86e9-f371eda25c15 | vfolunin/archives-solutions | UVa Online Judge/352.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
void dfs(vector<string> &a, int i, int j) {
static const int di[] = { -1, -1, -1, 0, 1, 1, 1, 0 };
static const int dj[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
a[i][j] = '0';
for ... | ALGO | 0.994695 | 4.645289 |
0312c08f-b630-414a-9ad4-0c0032a6d907 | anorouzi/sector | sector-sphere/tags/release-2.0/examples/mrsort.cpp | #include <sector.h>
#include <conf.h>
#include <sys/time.h>
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char** argv)
{
if (1 != argc)
{
cout << "usage: mrsort" << endl;
return 0;
}
Sector client;
Session s;
s.loadInfo("../conf/client.conf");
if (cli... | ALGO | 0.98906 | 3.53956 |
4f22ad67-3903-4ec6-b6bf-1dbc75bcb978 | ferid60433/coastalme | src/do_beach_within_polygon.cpp | #include <assert.h>
#include <cmath>
#include <cfloat>
#include <iostream>
using std::cout;
using std::endl;
#include "cme.h"
#include "simulation.h"
#include "coast.h"
/*===============================================================================================================================
Does within-poly... | ALGO | 0.998359 | 5.552469 |
f6d520a5-3854-46d7-a983-eeb4e4ccbf5a | Salabh2k2/Leetcode_Solution | 1332-count-vowels-permutation/count-vowels-permutation.cpp | class Solution {
public:
int countVowelPermutation(int n) {
const int MOD = 1e9 + 7;
long long a = 1, e = 1, i = 1, o = 1, u = 1;
for (int j = 1; j < n; j++) {
long long a_next = e;
long long e_next = (a + i) % MOD;
long long i_next = (a ... | ALGO | 0.999973 | 7.022593 |
2b574dbb-0df5-4b99-877a-6f56b4ee9340 | ChoiGunHee/Algorithm_with_C_plus | Backjoon_total/Problem_015000/Problem_015400/Problem_0015439.cpp | /**
* 2021. 09. 23
* Creater : Gunhee Choi
* Problem Number : 15439
* Title : Vera and Outfits
* Problem :
Vera owns N tops and N pants. The i-th top and i-th pants have colour i, for 1 โค i โค N, where all N colours are different from each other.
An outfit consists of one top and one pants. Vera likes outfits where th... | ALGO | 0.999317 | 4.856196 |
6a0253aa-b680-44c8-9c4d-58d9c23dab6a | arshsaini15/cpp-language | Linked List/linkedlist19.cpp | // merge using recursion
#include<iostream>
using namespace std;
class node{
public:
int data;
node* next;
node* prev;
node(int val){
data = val;
next = NULL;
prev = NULL;
}
};
void insertathead(node* &head,int val){
node* n = new node(val);
n->next=head;
... | ALGO | 0.999944 | 4.626558 |
9c5f96e0-2109-46c8-a8cc-a6ab3710e017 | nccaiteam/histopathology_annotation_nia | libs/opencv-4.5.1-vc14_vc15/opencv/sources/modules/imgproc/src/spatialgradient.cpp | #include "precomp.hpp"
#include "opencv2/core/hal/intrin.hpp"
#include <iostream>
namespace cv
{
/* NOTE:
*
* Sobel-x: -1 0 1
* -2 0 2
* -1 0 1
*
* Sobel-y: -1 -2 -1
* 0 0 0
* 1 2 1
*/
template <typename T>
static inline void spatialGradientKernel( T& vx, T& vy... | ALGO | 0.993642 | 6.386929 |
ce29bdaa-5ac0-4144-b18e-a50ef330feaf | Faisal-123/Data_Structure | DSA/Tree/fenwicktree.cpp | #include <iostream>
#include <vector>
using namespace std;
#define int long long
const int MAXN=1e6+10;
int bit[MAXN];
int n;
int Sum(int i)
{
i++;
int ans=0;
while(i>0){
ans+=bit[i];
i-=(i&(-i));
}
return ans;
}
void Update(int i,int x)
{
int j=0;
i++;
while(i<=n)
{
bit[i]+=x;
i+=(i&(-i));
}
}
main... | ALGO | 0.999696 | 4.063423 |
547e1d44-93b2-49b1-b4d3-f00227c9e0e9 | 1janana1/FuncLed | Dependencies/opencv/sources/modules/core/src/matrix_operations.cpp | #include "precomp.hpp"
#include "opencv2/core/mat.hpp"
#include "opencv2/core/types_c.h"
#include "opencl_kernels_core.hpp"
#undef HAVE_IPP
#undef CV_IPP_RUN_FAST
#define CV_IPP_RUN_FAST(f, ...)
#undef CV_IPP_RUN
#define CV_IPP_RUN(c, f, ...)
/**************************************************************************... | ALGO | 0.980494 | 3.259969 |
a836694d-4e22-48a5-9457-e07471ab0006 | Kan19990810/Cpp | HOT100/31-40/largestRectangleArea.cpp | class Solution
{
public:
int largestRectangleArea(vector<int> &heights)
{
// i ๅทฆไพง็ฌฌไธไธชไฝไบheights[i]
// i ๅณไพง็ฌฌไธไธชไฝไบheights[i]
int n = heights.size();
vector<int> lowLeft(n);
vector<int> lowRight(n);
stack<int> s;
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999976 | 6.21097 |
88c84f04-ce6c-4ca3-9698-509be9f75255 | ishandutta2007/codeforces | tutis/normal/1619/B.cpp | /*input
6
10
1
25
1000000000
999999999
500000000
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_sta... | ALGO | 0.999884 | 4.868789 |
3120fbd6-5841-4446-8fdf-b456ea950509 | ankursinghbisht/DSA_CheatSheet | C++/BackTracking/09_knight_walks.cpp | /*
Idea:
have 2D array to keep track of visited cells, and using BFS to find the shortest path.
using a queue to store all possible cells of knight. and iterating each till final cell is reached
*/
//{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
private:
... | ALGO | 0.999905 | 6.014754 |
b0496c14-bb11-4e9e-a743-069a7030d09d | migalha212/code | PROG/QP06/normalise-vector.cpp | #include <iostream>
#include "print_vector.h"
#include <string>
using namespace std;
template <typename T>
void normalise(vector<T>& v, const T& min, const T& max){
for(long unsigned int i = 0; i < v.size(); i++){
if(v[i] < min) v[i] = min;
else if(v[i] > max) v[i] = max;
}
} | TOOL | 0.85389 | 4.510139 |
c5681f51-885c-45a6-8025-94827a92bae2 | deepam20050/competitive-programming | solutions/CF1015D.cpp | #include "bits/stdc++.h"
using namespace std;
#define sz(x) int((x).size())
#define all(x) begin(x), end(x)
#define eb emplace_back
#define em emplace
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define lb lower_bound
#define ub upper_bound
using lli = lo... | ALGO | 0.999995 | 3.395082 |
a10c9577-d3de-473a-bccd-9a52cf35ab88 | hellomyworld11/learnAlgorithm | helloAlg/chapter_array_and_linkedlist/array.cpp | /**
* File: array.cpp
* Created Time: 2022-11-25
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* ้ๆบ่ฎฟ้ฎๅ
็ด */
int randomAccess(int *nums, int size) {
// ๅจๅบ้ด [0, size) ไธญ้ๆบๆฝๅไธไธชๆฐๅญ
int randomIndex = rand() % size;
// ่ทๅๅนถ่ฟๅ้ๆบๅ
็ด
int randomNum = nums[randomIndex];
return randomNum;
}
/... | ALGO | 0.94612 | 4.848577 |
f86f0705-072c-4a66-9ffc-79e7d33a01d6 | YNCris/SBeA_release | SBeA_mapper/BeA_v0.7.1/lib/aca/src/seg/aca/acaBack.cpp | #include "mex.h"
#include "string.h"
/*
* function seg = acaBack(k, sOpt, cOpt)
*
* History
* create - Feng Zhou, 08-23-2009
* modify - Feng Zhou, 08-23-2009
*/
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
// k
int k = int(*mxGetPr(prhs[0]));
// sOpt
d... | ALGO | 0.999956 | 4.19773 |
e4378925-7c78-45a2-abbb-9d6219113f69 | brownvc/shapefromtracing | rebuild_topology.cpp | #include "rebuild_topology.h"
#include "vector.h"
#include <map>
#include <cstring>
#include <vector>
#include <cassert>
// https://github.com/mitsuba-renderer/mitsuba/blob/master/src/librender/trimesh.cpp#L468
// TODO: this can be parallelize by sorting & segmented reduction
struct VertexUV {
Vector3f p;
Ve... | ALGO | 0.999515 | 5.254168 |
7d0db12e-bc64-42e6-ac7b-336475e4cb1c | equadras/CompetitiveProgramming | icpc/fasezero24/g.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int MAX = 2e5 + 2;
const int INF = 1.05e9;
const int INFM = -1.05e9;
const long long INFLL = 4.5e18;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;
struct SegTree {
pair<ll,int> merge(pair<ll,int> a, pair<ll,int... | ALGO | 0.999781 | 4.059023 |
9165e44f-648a-41db-9be7-8798551b62f7 | SuperBigFive/Charming_XCPC | Algorithm/Graph/ๅๆนๆ /ๅๆนๆ _ๆ ๅๅพๅญๅจ็ฎๅ่ทฏๅพ็ป่ฟ็ไธๅ
็ป็ไธชๆฐ.cpp | #include <bits/stdc++.h>
#define ll long long
#define int ll
using namespace std;
const int N = 2e5 + 5;
struct RoundSquareTree {
int n, tot, bcc_cnt;
vector <int> dfn, low, siz;
vector <vector <int> > G, nG;
RoundSquareTree (int n, vector <vector <int> > &G) {
this -> n = n, tot = bcc_cnt = 0;
dfn = low = v... | ALGO | 0.999938 | 4.703583 |
c161dc91-27e0-4c3f-8b4c-6d139928e0d0 | Yadira-Sainz/data-structure | bsort/bsort/main.cpp | //
// main.cpp
// bsort
//
// Created by Yadira Sainz on 07/03/23.
//
#include <iostream>
#include <cstdlib>
#include <ctime>
int *crear(int n){
int *p = new int[n];
for(int i = 0; i < n; i++) p[i] = rand() % (10 * n) + 1;
return p;
}
void print(int *a, int n) {
printf("[ ");
for(int... | ALGO | 0.998832 | 4.916611 |
0f74188f-1e65-4e44-8c1c-940e51f30e8d | AhmadMoussa/OpenGLRotation-Translation | rotator.cpp | #include "rotator.hpp"
#include "rotationReader.hpp"
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
#include <math.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
// Takes a struct that contains our intial vertices and rotates them ... | ALGO | 0.864305 | 3.947855 |
ea6c8840-a4ac-42b4-be8a-cede9323ce87 | Amishk599/Data-Structure-Algorithm | Binary Seach Tree/Insertion/insertion.cpp | #include <bits/stdc++.h>
using namespace std;
//structre of BST node
struct node
{
int data;
struct node *left, *right;
};
//new node creation
node *getNewNode(int data)
{
node *newNode = new node;
newNode->data = data;
newNode->left = newNode->right = NULL;
return newNode;
}
//function to i... | ALGO | 0.999982 | 5.306302 |
75b8172f-8871-4b4c-b3d1-8d7fdce2d8ea | illuz/WayToACM | ACM_CODE/FZU/11th/B.cpp | /*
* Author: illuz <iilluzen[at]gmail.com>
* File: B.cpp
* Create Date: 2014-04-27 13:22:23
* Descripton:
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1000010;
int t, m, n, x[N], s[N];
int main()
{
while (~scanf("%d%d", &n, &m)) {
for (int i =... | ALGO | 0.999977 | 3.31052 |
9c6514cb-8134-4e09-9aa7-70a7d1c1af08 | AmolMavuduru/GraphAlgorithms- | Graphs and Algorithms/Graph.cpp | #include <stdio.h>
#include "Graph.h"
#include "Point.h"
#include "AdjacencyList.h"
#include "vector"
Graph::Graph()
{
size = 0;
}
bool Graph::isEmpty() const
{
return (graphList.size() == 0);
}
Graph::Graph(std::vector<AdjacencyList> list)
{
for(int i = 0; i < list.size(); i++)
{
graphList.... | ALGO | 0.918335 | 4.215287 |
c297c80c-a72f-4f70-af94-be5dc2c3be82 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00119/explore/explore.cpp | #include<bits/stdc++.h>
using namespace std;
int t,n,m,k,x,y,d;
char a[1001][1001];
bool dist[1001][1001];
int main(){
freopen("explore.in","r",stdin);
freopen("explore.out","w",stdout);
scanf("%d",&t);
for(int l=1;l<=t;l++){
memset(dist,false,sizeof(dist));
scanf("%d%d%d",&n,&m,&k);
... | ALGO | 0.999876 | 4.042074 |
80f51573-4b4a-4172-b7d5-6f3f63571721 | Willthecoder1617/CPSC221-PA3 | pa3/stats.cpp |
#include "stats.h"
#include <cmath>
#include <utility>
#include <vector>
#include <iostream>
using namespace cs221util;
stats::stats(PNG& im) {
sumRed.resize(im.width());
sumBlue.resize(im.width());
sumGreen.resize(im.width());
sumsqRed.resize(im.width());
sumsqBlue.resize(im.width());
sumsq... | TOOL | 0.919307 | 4.974881 |
2a53fcd3-daea-4900-9bcc-20a1d46d900a | brightlaboratory/llvm-project | lld/ELF/CallGraphSort.cpp | #include "CallGraphSort.h"
#include "OutputSections.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include <numeric>
using namespace llvm;
using namespace lld;
using namespace lld::elf;
namespace {
struct Edge {
int from;
uint64_t weight;
};
struct Cluster {
Cluster(int sec, size_t s) : next(sec), prev(sec... | ALGO | 0.999239 | 6.330102 |
0b3c19ee-5448-468a-8624-6080fdfcbae1 | StolasIn/leetcode_Submissions | content/maximum-sum-circular-subarray/Wrong Answer/2-18-2022, 12_00_43 PM/Solution.cpp | // https://leetcode.com/problems/maximum-sum-circular-subarray
class Solution {
public:
int maxSubarraySumCircular(vector<int>& nums) {
int m = nums.size();
int now = 0;
int ans = -1e9;
for(int i=0;i<nums.size();i++){
now+=nums[i];
ans = max(ans,now);
... | ALGO | 0.999966 | 5.948601 |
8affa39f-b0d3-424d-a3a4-6f2c4dd79815 | FrankMuti/project_euler | src/p_1_50/p_32.cpp | #include <bits/stdc++.h>
int main() {
std::string s = "123456789";
int n = 9;
std::unordered_set<long long> st;
long long sum = 0;
do {
for (int i = 1; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
int l1 = i, l2 = j - i + 1, l3 = n - j + 1;
... | ALGO | 0.999976 | 4.18838 |
c33cf059-59a2-42a0-bf1e-8fa5cbdc7c27 | cslev/p4_double_precision | behavioral-model/src/bm_sim/crc_map.cpp | /*
* Antonin Bas (<EMAIL>)
*
*/
#include "crc_map.h"
#include <bm/bm_sim/calculations.h>
#include <bm/bm_sim/data.h>
#include <string>
namespace bm {
namespace {
template <typename T>
using crc_config_t = detail::crc_config_t<T>;
template <typename T>
struct CustomCrcName { };
template <>
struct CustomCrcNam... | TOOL | 0.901939 | 7.007688 |
66831d26-a95d-40ee-96f0-c0c23cc89da0 | UranusZS/machine_learning_study | perception/dual_perception/utils.cpp | #include "utils.h"
//ๅ้็็น็งฏ
double dot_product(std::vector<double>& a, std::vector<double>& b) {
if(a.size() != b.size()) return 0;
double res = 0;
for(int i = 0 ; i < a.size(); ++ i){
res +=a[i]*b[i];
}
return res;
}
| TOOL | 0.98902 | 3.919112 |
cf958884-5a8b-42f5-a679-169d4d951816 | nasimstg/cp_templates_and_implementation | Graph/Graph Traversing_DFS.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#... | ALGO | 0.999906 | 5.495142 |
9fede267-9b95-4dda-b7c9-903b9b9d027e | Naautilus/wfc2 | src/waveformCollapse.cpp | #include "cellDefinitions.cpp"
long hash_sub(long hash, int input) { // baby's first hash
int HASH_MULTIPLIER = 26347859;
hash += input;
hash *= HASH_MULTIPLIER;
hash %= INT_MAX;
return hash;
}
// Custom hash function for cellGrid
namespace std {
template<>
struct hash<cellGrid> {
size_t operator()(... | ALGO | 0.999935 | 4.478681 |
ca5e2c16-a679-4985-96af-e44077b54b41 | pravinargade18/CP-world | CodeStudio/Stack_Problems/Next_Greater_Element.cpp | #include<bits/stdc++.h>
vector<int> nextGreater(vector<int> &arr, int n) {
vector<int>ans;
stack<int>st;
for(int i=n-1;i>=0;i--){
while(!st.empty() && st.top()<=arr[i]){
st.pop();
}
if(st.empty()){
ans.push_back(-1);
... | ALGO | 0.999848 | 4.368919 |
47e0c4c6-739f-4787-b4fb-9c0e2678fb24 | Hyuk-II/Algorithms-Study | 03. class2-1/10_2775_๋ถ๋
ํ์ฅ.cpp | // 2024.03.25
// k์ n์ ๋ํด k์ธต์ nํธ์๋ ๋ช ๋ช
์ด ์ด๊ณ ์๋์ง ์ถ๋ ฅํ๋ผ. ๋จ, ์ํํธ์๋ 0์ธต๋ถํฐ ์๊ณ ๊ฐ์ธต์๋ 1ํธ๋ถํฐ ์์ผ๋ฉฐ, 0์ธต์ iํธ์๋ i๋ช
์ด ์ฐ๋ค.
// k-1์ธต์ 1ํธ๋ถํฐ nํธ๊น์ง ์ฌ๋ ์ฌ๋์์ ํฉ
#include <iostream>
using namespace std;
int main()
{
int T, k, n;
cin >> T;
for (int i = 0; i < T; i++) {
cin >> k;
cin >> n;
k++;
int** arr ... | ALGO | 0.998848 | 4.270971 |
7cb5f089-8b78-4657-9916-5d9ce821fa32 | touyou/CompetitiveProgramming | lib/mincostflow.cpp | #include <cstdio>
#include <climits>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;
#define max_v 1000000
#define inf INT_MAX/2
struct edge { int to, cap, cost, rev; };
typedef pair<int, int> P;
int V;
vector<edge> G[max_v];
int h[max_v];
int dist[max_v... | ALGO | 0.999118 | 4.117588 |
dc9c250f-1e2e-4ab6-87ef-d3337ca0a43d | shubham-pilivkar/Cpp-Code | 04_Conditional and loops/02_switch.cpp | #include<iostream>
using namespace std;
int main(){
int day;
cout<<"Enter a day: ";
cin>>day;
switch(day){
case 1:
cout<<"Today is Monday"<<endl;
cout<<"Go to your work"<<endl;
break;
case 2:
cout<<"Today is Tuesday"<<endl;
cout<<"Its your choic... | TOOL | 0.978433 | 3.101359 |
e8e34bec-3b80-49b1-a9b4-50f8510588ee | CFOP2357/competitive_programing | codeforces/Codeforces Round #625 (Div. 2, based on Technocup 2020 Final Round)/D.cpp | #include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<... | ALGO | 0.999864 | 3.999283 |
85a97bf2-be13-4729-9e16-632a733fbd44 | easy297/Algorithms-and-Data-Structures | heapSort/heapSort/main.cpp | //
// main.cpp
// heapSort
//
// Created by Izim on 12.12.2021.
//
#include <iostream>
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
| ALGO | 0.998999 | 4.700496 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.