uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3ee358d3-46e6-4574-907d-bb9e6c609603 | alexfilatov2000/PriorityQueue | var.cpp |
#include "var.h"
using namespace std;
void push(pqueue& que, int value, int priority) {
Node *temp = new Node;
temp->data = value;
temp->next = NULL;
temp->prior = priority;
if (!que.head) {
que.head = temp;
return;
}
Node *cursor = que.head,
*prev = NULL;
while (c... | ALGO | 0.999659 | 3.687174 |
86a69b88-dcdf-4104-ba60-bb49f265cc26 | ishandutta2007/codeforces | riantkb/normal/1468/H.cpp | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int t;
cin >> t;
rep(zz,t){
int n,k,m;
cin >> n >> k >> m;
vector<int> a(m+2);
a[0] = 0;
a[m+1] = n+1;
rep(i... | ALGO | 0.999942 | 3.394846 |
45c25ad6-768d-4a6f-acda-e49f89a1a306 | vochi/core-intern-test | effect_sandbox/3rd/opencv_contrib/modules/ximgproc/src/paillou_filter.cpp | #include "precomp.hpp"
#include <math.h>
#include <vector>
#include <iostream>
/*
If you use this code please cite this @cite paillou1997detecting
Detecting step edges in noisy SAR images: a new linear operator IEEE Transactions on Geoscience and Remote Sensing (Volume:35 , Issue: 1 ) 1997
Equation xx pyyy mean eq... | ALGO | 0.998737 | 5.126089 |
dd308f24-a709-4972-a771-8d24b27d5f21 | andreasaronsson/misccpp | cpplab1/queries.cpp | #include "queries.h"
#include "compare.h"
#include <sstream>
#include <iomanip>
/* Vilka album gavs ut r X? */
void query1(vector<Song *>& songs, int key_y) {
CmpYear yearcmp;
CmpArtist artistcmp;
CmpAlbum albumcmp;
pair<vector<Song *>::iterator, vector<Song *>::iterator> p;
Song *key;
string key_s = "Year... | TOOL | 0.947498 | 4.099886 |
350376a8-5324-4838-bd91-cfb3168143dd | ishandutta2007/codeforces | noimi/normal/1065/E.cpp | #include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#def... | ALGO | 0.999882 | 3.836578 |
f8c15611-7880-4315-a0c3-cf452087eb4e | umer1730/conditions | task11.cpp | #include<iostream>
using namespace std;
main()
{
string name1,name2,name3;
int age1,age2,age3;
cout<<"Ente the name age of the first brother:";
cin>>name1>>name1;
cout<<"Enetr the name and age of the second brother:";
cin>>name2>>age2;
cout<<"Enetr the name and age of the third brother:";
... | ALGO | 0.902531 | 3.579895 |
cd667c9d-1067-4e6e-946a-773e53146c3b | Double-T1/leetcode | 600-800/721. Accounts Merge/solution.cpp | class Solution {
public:
typedef unordered_map<string,int> omsi;
typedef vector<vector<string>> vvs;
vector<vector<string>> accountsMerge(vector<vector<string>>& accounts) {
omsi e2p; //[email: parent]
int n = accounts.size(), m;
int parent[n];
for (int i=0; i<n; i++) {
... | ALGO | 0.999991 | 6.007314 |
77bb9497-747a-4cda-a2dd-1ffc1f640303 | lewisKit/txt_torcs | vtorcs-RL-color/src/drivers/olethros/strategy.cpp | /*
Very simple stategy sample implementation.
*/
#include "strategy.h"
#include "opponent.h"
#ifdef USE_OLETHROS_NAMESPACE
namespace olethros
{
#endif
const float SimpleStrategy::MAX_FUEL_PER_METER = 0.0008f; // [kg/m] fuel consumtion.
const int SimpleStrategy::PIT_DAMMAGE = 1000; // [-]
SimpleStrategy::SimpleS... | ALGO | 0.962066 | 6.26669 |
58180c8d-751c-4d9e-a136-ece26b170dbd | sarincr/Data-Science-with-CPP | Data Structures/01.BubbleSort/main.cpp | #include<iostream>
using namespace std;
int main ()
{
int i, j,temp= 0;
int a[10] = {1,11,6,3,10,9,2,7,5,14};
cout <<"Input list = .\n";
for(i = 0; i<10; i++)
cout <<a[i]<<"\t";
for(i = 0; i<10; i++)
{
for(j = i+1; j<10; j++)
{
if(a[j] < a[i])
{
temp = a[i];
a[i] =... | ALGO | 0.9998 | 3.669227 |
c51117db-9d2c-411a-be1e-919851277b18 | peteralfonso/platform_frameworks_base | tools/aapt/FileFinder.cpp | // File Finder implementation.
// Implementation for the functions declared and documented in FileFinder.h
#include <utils/Vector.h>
#include <utils/String8.h>
#include <utils/KeyedVector.h>
#include <dirent.h>
#include <sys/stat.h>
#include "DirectoryWalker.h"
#include "FileFinder.h"
//#define DEBUG
using android... | TOOL | 0.859553 | 6.150002 |
146eab2d-81d6-414b-ad07-50f874d53f3f | zer0deck/parallel_algorithms | MPI/Lab_14.cpp | #include <stdio.h>
#include <iostream>
#include "mpi.h"
#define n 1000
using namespace std;
void smod5(void *a, void *b, int *l, MPI_Datatype *type)
{
int i;
for (i = 0; i < *l; i++)
((int *)b)[i] = (((int *)a)[i] + ((int *)b)[i]) % 5;
}
void max(void *a, void *b, int *l, MPI_Datatype *type)
{
... | ALGO | 0.999912 | 3.513155 |
ae80289d-021c-4576-8c38-eb31f799c4c2 | sudheesh001/Project-Euler | Q13.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <sstream>
#include <cassert>
using namespace std;
int main(int argc, char *argv[])
{
ifstream ifs("13.txt");
vector<string> v;
for(int i = 0; i < 100; i++){
string line;
getline(ifs, line);
v.... | ALGO | 0.999401 | 4.099526 |
40acd088-1ddc-4607-8584-50043c888304 | wust-lzy/algorithm | Improvement/1.动态规划/背包模型/数字组合.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
//01背包求方案数
using namespace std;
const int N = 10010;
int f[N];
int main()
{
int n, m;
cin >> n >> m;
f[0] = 1;
for (int i = 1; i <= n; i++)
{
int v;
cin >> v;
for (int j = m; j >= v; j--)
f[j] += f[j - v... | ALGO | 0.999976 | 3.764773 |
8de7fcf6-aebe-4e09-ab1e-667701f2cecd | ao333/CPP | ICL Coursework/Practice/Exercises/struct.cpp | #include <iostream>
#include <cstring>
using namespace std;
struct Student {
char name[80];
int age;
double mark;
Student *partner;
};
struct University {
Student students[100];
};
int main() {
Student susan = {"Susan",25,75,NULL}, bob= {"Bob",25,35,&susan};
strcpy(susan.name, "Susan");
susan.age ... | TOOL | 0.887987 | 3.277765 |
b744d6da-4e3f-46bf-9fda-72a52efaa19e | zixinren/cocos2dx3.6- | cocos/3d/CCOBB.cpp | #include "3d/CCOBB.h"
NS_CC_BEGIN
#define ROTATE(a,i,j,k,l) g=a.m[i + 4 * j]; h=a.m[k + 4 * l]; a.m[i + 4 * j]=(float)(g-s*(h+g*tau)); a.m[k + 4 * l]=(float)(h+s*(g-h*tau));
static Mat4 _getConvarianceMatrix(const Vec3* vertPos, int vertCount)
{
int i;
Mat4 Cov;
double S1[3];
double S2[3][3];
S... | ALGO | 0.99765 | 6.076499 |
1395cbf0-b5ad-42a9-aab0-d99f3fafc90b | bptigg/CovidSim | Source/Actor.cpp | #include "Actor.h"
double Actor::matrix_distance(node& start_node, node& end_node, Matrix<int> tile_matrix)
{
std::pair<int, int> start_location = { 0,0 };
int start_tile = std::get<2>(start_node.location);
std::pair<int, int> end_location = { 0,0 };
int end_tile = std::get<2>(end_node.location);
int row = std:... | ALGO | 0.971087 | 4.223209 |
5354c879-5998-464c-9d60-43790a934f44 | strengthen/LeetCode | C++/429.cpp | __________________________________________________________________________________________________
sample 144 ms submission
/*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _chi... | ALGO | 0.999986 | 6.068347 |
2db86697-5e97-4dd9-8772-a0776244cc15 | andrewsmith1996/C-Plus-Plus-Tasks | recursion.cpp | #include <iostream>
using namespace std;
void half(float number){
if(number >= 1){
cout << number << endl;
number /= 2;
half(number);
}
}
int main(){
float number;
cout << "Enter a Float" << endl;
cin >> number;
half(number);
return 0;
}
| ALGO | 0.997655 | 3.436178 |
7f7df86d-930c-4753-bd2b-723604e78d96 | pedrohenmuniz/cntCode | Visualizador/source/Visualizer/Forest.cpp | #include "Forest.h"
#include <iostream>
#include <fstream>
#include <sstream>
#define PrecumputedPoints 500
namespace Library
{
Forest::Forest(DrawableSpheres *attractor, DrawableSpheres *anchor, DrawableSpheres *control, int exec, double graphCriticalDistance) :
mContacts(NULL),
mAttractorSpheres(attractor),... | ALGO | 0.991369 | 3.003516 |
3744ff9d-d329-4add-a971-cad3a688dd81 | benoxo/ds-in-mooc | 8/prim.cpp | /* ڽӾ洢 - PrimС㷨 */
Vertex FindMinDist( MGraph Graph, WeightType dist[] )
{ /* δ¼distС */
Vertex MinV, V;
WeightType MinDist = INFINITY;
for (V=0; V<Graph->Nv; V++) {
if ( dist[V]!=0 && dist[V]<MinDist) {
/* Vδ¼dist[V]С */
MinDist = dist[V]; /* С */
MinV = V; /... | ALGO | 0.999997 | 4.014636 |
db510f8c-4ac5-433d-8d42-e89a0d0396bc | Kinghoz/ARMSparse | eigen-3.3.9/unsupported/doc/examples/MatrixLogarithm.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
using std::sqrt;
MatrixXd A(3,3);
A << 0.5*sqrt(2), -0.5*sqrt(2), 0,
0.5*sqrt(2), 0.5*sqrt(2), 0,
0, 0, 1;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "... | ALGO | 0.998548 | 3.621207 |
66fc660c-3b60-4dbd-891b-d239b5d75367 | skanishk19/ASSIGNMENT- | Module 3/18.cpp | #include<iostream>
using namespace std;
class calculator
{
public:
int sum(int num1,int num2)
{
return num1+num2;
}
int sub(int num1,int num2)
{
return num1-num2;
}
int multi(int num1,int num2)
{
return num1*num2;
}
int div(int num1,int num2)
{
... | TOOL | 0.957616 | 3.372661 |
6ae517e8-23c2-4028-972a-bf7410c58dd7 | AsmaaAladawi/flutter_task | 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.998733 | 6.76775 |
164bf172-afb1-492f-83a4-b0988c3b73f5 | La165/cpp | uni.cpp | #include<iostream>
using namespace std;
class counter
{
int count;
public:
counter()
{
count=0;
}
counter (int c)
{
count=c;
}
int get_count()
{
return count;
}
counter operator++()
{
return counter( ++count);
}
counter operator++(int)
{
return counter (count++);
}
};
int main()
{
counter c1,... | ALGO | 0.915012 | 4.088127 |
fd752860-7b2a-4432-b49f-7b08caad673b | ChoiCube84/baekjoon-solutions | 5670/source.cpp | #include <bits/stdc++.h>
using namespace std;
struct TrieNode {
bool endOfWord;
int next[26];
int nextLetters;
TrieNode() : endOfWord(false), nextLetters(0) {
for (int i = 0; i < 26; i++) {
next[i] = -1;
}
}
};
struct Trie {
vector<TrieNode> nodes;
Trie() {
nodes.push_back(TrieNode());
}
void ad... | ALGO | 0.999201 | 5.1625 |
b629447d-b63f-4c9e-b1d7-059dbfa1d451 | payal15604/Data_Structures | Greedy/Boats To Save People.cpp | class Solution {
public:
int numRescueBoats(vector<int>& people, int limit) {
int n = people.size();
int l = 0, r = n - 1;
int res = 0;
sort(people.begin(), people.end());
while(l<=r)
{
int remain = limit - people[r];
r--;
res++;
... | ALGO | 0.999987 | 5.876262 |
7571ed02-30a9-4041-87bc-3a67aa1a4892 | raincross7/code-similarity | codes/train_code/problem246/problem246_473.cpp | #include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#incl... | ALGO | 0.999969 | 3.611902 |
7b0f8add-8693-4cba-98c7-a92f7742d94c | thegamer1907/Code_Analysis | CodesNew/3504.cpp | #include <bits/stdc++.h>
using namespace std;
int n,m,ans,Max,i,a[10010];
int main()
{
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
sort(a+1,a+n+1);
int v=m;
for(i=1;i<=n;++i) v-=a[n]-a[i];
if(v<=0)
cout<<a[n];
else
cout<<(v%n?a[n]+v/n+1:a[n]+v/n);
cout<<" "<<a[... | ALGO | 0.999995 | 3.278174 |
bce36325-cb72-4389-b6fc-576b2c1c7205 | CPTSCoin/wallet-init | src/consensus/merkle.cpp | #include "merkle.h"
#include "hash.h"
#include "utilstrencodings.h"
/* WARNING! If you're reading this because you're learning about crypto
and/or designing a new system that will use merkle trees, keep in mind
that the following merkle tree algorithm has a serious flaw related to
duplicate tx... | ALGO | 0.999906 | 7.644841 |
7a4ee63d-cc53-4e33-9224-83c825fb20a8 | hy125245/leetcode | 35.搜索插入位置.cpp | /*
* @lc app=leetcode.cn id=35 lang=cpp
*
* [35] 搜索插入位置
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// @lc code=start
class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
int left = 0;
int right = nums.size();
if( nums[right - 1] ... | ALGO | 0.999955 | 6.401721 |
f4df865b-c43b-4027-b30a-fa6eaf0466e0 | alexandraback/datacollection | solutions_1673486_1/C++/smt23/main.cpp | #include <iostream>
#include <fstream>
double error_exp(double *probs, int num_typed) {
double c = 1;
for(int i = 0; i < num_typed; ++i)
c *= probs[i];
return 1-c;
}
using namespace std;
double calc_exp(int t_key, double *probs, int num_typed) {
double e = error_exp(probs,num_typed);
return ((1-e)*(1+t_key-n... | ALGO | 0.975646 | 3.604325 |
79d01b82-ad89-49c4-92a6-469eebf1cdb5 | hack-parthsharma/LeetCode | 1640-check-array-formation-through-concatenation/1640-check-array-formation-through-concatenation.cpp | class Solution {
public:
bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {
unordered_map<int, vector<int>> map;
for (int i = 0; i < pieces.size(); i++) {
map[pieces[i][0]] = pieces[i];
}
int i = 0;
while (i < arr.size()) {
if (map[arr[... | ALGO | 0.999817 | 5.871489 |
6f1604bf-c2ae-43c9-9972-9e6ee8144bbf | EmptyDust/Algorithm-Codes-and-writeups | codes/-0x30_competition/-0x33_codeforces/953/A.cpp | #include <bits/stdc++.h>
using i64 = long long;
constexpr int MAXN = 1e6 + 10, inf = 1e9, mod = 1e9 + 7;
int n;
using pii = std::pair<int, int>;
void solve() {
std::cin >> n;
std::vector<int> nums(n);
for (int i = 0;i < n;++i)std::cin >> nums[i];
int ans = nums[n - 1];
ans += *std::max_element(nums... | ALGO | 0.999832 | 5.270755 |
9f690aad-ab64-44ef-9f3f-6889a412b0f1 | Rajkumar992199/C-Plus-Plus | codeforces/900/160A_Twins.cpp | #include <bits/stdc++.h>
using namespace std;
int coin() {
int n;
cin >> n;
int a[n], sum[n + 1], sum_all = 0, ans = 0;
sum[n] = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum_all += a[i];
}
sort(a, a + n);
for (int i = n; i > 0; i--) {
sum[i - 1] = sum[i] + a... | ALGO | 0.999179 | 3.801533 |
f404cb98-544a-4190-a8e8-56ec76c3aa24 | dTCTb/my_path_to_conquer_c_cpp | how_to_program_cpp/ch15/15.16.cpp | // Fig. 15.16: fig15_16.cpp
// Standard Library set class template
#include <algorithm>
#include <array>
#include <iostream>
#include <iterator>
#include <set>
int main() {
constexpr size_t SIZE{5};
std::array<double, SIZE> a{2.1, 4.2, 9.5, 2.1, 3.7};
std::set<double, std::less<double>> doubleSet{a.begin()... | TEST | 0.972775 | 6.695181 |
1b5f9619-12e9-4030-bafe-86f7a2f427c1 | s1lent18/Sem-3 | Notes/Linked-Lists/Mid-1.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node * next;
Node()
{
}
Node(int data)
{
this->data = data;
}
};
class LinkedList
{
public:
Node * head;
int size(Node * T)
{
... | ALGO | 0.999896 | 4.577982 |
a9214625-13bd-46d7-971f-d77aa0db3e87 | Extractcoin/Extractcoin | src/ecwrapper.cpp | #include "ecwrapper.h"
#include "serialize.h"
#include "uint256.h"
#include <openssl/bn.h>
#include <openssl/ecdsa.h>
#include <openssl/obj_mac.h>
namespace {
/**
* Perform ECDSA key recovery (see SEC1 4.1.6) for curves over (mod p)-fields
* recid selects which key is recovered
* if check is non-zero, additional... | TOOL | 0.959127 | 7.256937 |
6b897fed-f537-4721-9eaf-2b9eaab822f2 | omkarg6651/Development | 242-valid-anagram/242-valid-anagram.cpp | class Solution {
public:
bool isAnagram(string s, string t) {
vector<char>sv;
vector<char>st;
int i = 0;
for(i=0;i<s.length();i++)
{
sv.push_back(s[i]);
}
for(i=0;i<t.length();i++)
{
st.push_back(t[i]);
}
... | ALGO | 0.999997 | 6.308878 |
da69ae41-c81d-48bc-9b9f-7e84047f6a60 | nervmor/pdf_hit_detector | code/third/boost_1_58_0/libs/math/minimax/f.cpp | #define L22
//#include "../tools/ntl_rr_lanczos.hpp"
//#include "../tools/ntl_rr_digamma.hpp"
#include <boost/math/bindings/rr.hpp>
#include <boost/math/tools/polynomial.hpp>
#include <boost/math/special_functions.hpp>
#include <boost/math/special_functions/zeta.hpp>
#include <boost/math/special_functions/expint.hpp>
... | ALGO | 0.956285 | 3.604196 |
99fe2ea3-b3a8-4794-80fb-f54f07e00659 | ryankert01/Programming_lectures_Assignments | cpp_concepts/queue.cpp | #include<iostream>
using namespace std;
size_t max = -1;
template < class T >
class Node {
public:
using value_type = T;
using size_type = unsigned int;
using iterator = value_type*;
int data;
Node* link;
};
template < class T >
class queue {
public:
using value_type = T;
using size_type = unsigned int;
usin... | ALGO | 0.998159 | 3.659691 |
8f3fe7ef-e145-4624-9e72-b47e8ee0eecc | thisisharsh7/LeetCode_ProblemsSolution | 260-single-number-iii/260-single-number-iii.cpp | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
vector<int> ans;
unordered_map<int,int> m;
for(int i=0;i<nums.size();i++){
m[nums[i]]++;
}
int cnt=0;
for(auto it=m.begin();it!=m.end();it++){
if(it->second==1 and cnt<2){
... | ALGO | 0.999975 | 5.432275 |
ceaba7e3-957f-4fdd-80c3-7f53824d5af9 | sangminns/Programmers-Algorithm | level2-더맵게.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int solution(vector<int> scoville, int K) {
int answer = 0;
int tmp;
priority_queue<int, vector<int>, greater<int>> pq; // 오름차순
for(int i=0; i<scoville.size(); i++) {
pq.push... | ALGO | 0.999896 | 5.302836 |
1c4c0ee3-c366-4458-a84d-5bf5dc7aa113 | csd81/code | algos/4/4.01.2.cpp | // c++11
// 4.1.2. Írjon függvényt, amely a lista első elemét törli! Írjon függvényt, amely ellenőrzi, hogy az tömb konzisztens-e, vagyis a benne lévő indexek a megengedett tartományban vannak-e, a start elemtől indulva nem jelentkezik kör!
#include <iostream>
#include <vector>
#include <unordered_set>
#include <ioma... | ALGO | 0.980801 | 6.110758 |
7d2178b2-6696-4bfe-b2e5-d1a361b1329a | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9388_2.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int m, n, c, x, t, l, r, tc, k;
cin >> tc;
while (tc--) {
vector<long long int> v;
cin >> n >> m;
k = 0, t = INT_MAX, c = 0;
while (n--) {
cin >> l >> r;
k = max(k, l);
v.push_back(l - r);
}
sort(v.begin... | ALGO | 0.999963 | 3.962833 |
3594fe0a-da33-4a3a-8ac8-6513b3ebf7a1 | syedmahihossen/luvlearning | class9/Generate_Parentheses.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> final;
void generate(string &s, int open, int close)
{
// cout << s << "\n";
if (open == 0 && close == 0)
{
final.push_back(s);
return;
}
if (open > 0)
{
s.push_back('(');
generate(s, open - 1, close);
... | ALGO | 0.999648 | 4.280802 |
4c59e0fa-16ec-4b8b-b656-aa4cb3faf70d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7529_18.cpp | #include <bits/stdc++.h>
using namespace std;
long long day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
long long dx[] = {0, 1, 0, -1};
long long dy[] = {1, 0, -1, 0};
struct edge {
long long to, cost;
};
bool isupper(char c) {
if ('A' <= c && c <= 'Z') return 1;
return 0;
}
bool islower(char c) {
i... | ALGO | 0.99998 | 3.818219 |
dc3b8eee-7a34-4dd2-a1e5-0c2d75a81ee4 | Kartik-Mathur/LVCPPJune21 | Lecture-13/Check7.cpp | // Check7.cpp
#include <iostream>
using namespace std;
bool Check7(int *a, int n) {
// base case
if (n == 0) {
return false;
}
// recursive case
if (a[0] == 7) {
return true;
}
bool ans = Check7(a + 1, n - 1);
return ans;
}
int first7(int *a, int n, int i) {
// base case
if (i == n) {
return -1;
}
... | ALGO | 0.998364 | 4.550148 |
f8ff0fa4-6e48-4a00-9e72-00818e93affc | unc-chr/study | nowcoder/algorithm/oral_quiz_top101/BM100.cpp | #include <iostream>
#include <map>
#include <vector>
#include "ads.h"
using namespace std;
struct ListNodeDu {
int key;
int val;
ListNodeDu* pre;
ListNodeDu* next;
ListNodeDu(int key, int val) {
this->key = key;
this->val = val;
pre = nullptr;
next = nullptr;
}... | ALGO | 0.999262 | 4.681638 |
57f14e07-a763-477a-8216-93cfcbc43505 | vanhhn/Data_Structures_and_Algorithms_Code_PTIT | CTDL035.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int t;
cin>>t;
while(t--){
ll L,R;
cin>>L>>R;
for(int k=40;k>=0;k--){
ll l=0,r=(ll)(pow(R,1.0/k)+10);
while(l<r){
ll z=1;
ll m=(l+r)/2;
for(int i=0;i<k;i++){
z*=m;
if(z>=L) break;
}
if(z>=L) r=m;
... | ALGO | 0.999763 | 3.898538 |
53c2682f-2fa0-4102-b7bf-5eef3d2d9ad3 | Aman149/LeetCode-Questions | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int newSize = 0;
for(int i=1; i<nums.size(); i++) {
if(nums[newSize] != nums[i])
nums[++newSize] = nums[i];
}
return newSize+1;
}
}; | ALGO | 0.999815 | 6.173939 |
5f6eea3e-01c5-46ad-988e-70a11b5d39b8 | sarvex/leetcode-elm | solution/1000-1099/1027.Longest Arithmetic Subsequence/Solution.cpp | class Solution {
public:
int longestArithSeqLength(vector<int>& nums) {
int n = nums.size();
int f[n][1001];
memset(f, 0, sizeof(f));
int ans = 0;
for (int i = 1; i < n; ++i) {
for (int k = 0; k < i; ++k) {
int j = nums[i] - nums[k] + 500;
... | ALGO | 0.999982 | 5.362423 |
18f423a0-a509-4cbc-81c8-8693115657dc | seclab-fudan/SyzDirect | source/llvm-project-new/llvm/lib/CodeGen/RegisterScavenging.cpp | #include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveRegUnits.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeG... | ALGO | 0.935217 | 6.898769 |
497a2b34-6311-4cb8-9601-3f96190d8160 | sngvahmed/Problem | solving problem/greedy/kings poker_DONE.cpp | #include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
int main(void) {
while (true) {
int x[3];
scanf("%d %d %d", &x[0], &x[1], &x[2]);
if (x[1] == 0 && x[1] == 0 && x[2] == 0)
return 0;
bool check2 = false, check = false;
int a, b, c, num;
sort(x, x + 3);
a = x[0], b = x[1],... | ALGO | 0.999921 | 3.094849 |
10348a8c-dea8-4d2d-98f1-f4725ff28cc9 | libigl/libigl-legacy | tutorial/608_LIM/main.cpp | #include <igl/avg_edge_length.h>
#include <igl/per_vertex_normals.h>
#include <igl/readOFF.h>
#include <igl/lim/lim.h>
#include <igl/opengl/glfw/Viewer.h>
#include <iostream>
#include "tutorial_shared_path.h"
using namespace igl::lim;
// Mesh
Eigen::MatrixX3d V0;
Eigen::MatrixX3d V1;
Eigen::MatrixXi F;
Eigen::Spars... | ALGO | 0.997793 | 6.052225 |
ab571040-edf3-45a7-a418-c296df2c6cfd | NayeemHossenJim/DSA | 1. Basics/4. Basic Recursion/PallinDrome.cpp | #include <iostream>
using namespace std;
bool isPalindrome(int i, string& s)
{
if(i>=s.length()/2) return true;
if(s[i]!=s[s.length()-i-1]) return false;
return isPalindrome(i+1,s);
}
int main() {
string s = "madam";
cout<<isPalindrome(0,s);
cout<<endl;
return 0;
} | ALGO | 0.999958 | 4.027514 |
dc2c2ee3-159e-4b88-ba8f-d33a2945b803 | rpask00/codeforces_cpp | dp_cpp/C_k_Tree.cpp | #include <iostream>
using namespace std;
int main()
{
int dp[103][2]{};
int mod = 1000000007;
int n, k, d;
cin >> n >> k >> d;
dp[0][0] = 1;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= min(i, k); j++) // j - len of arm witch will be added now
{
if (j ... | ALGO | 0.999927 | 4.721517 |
0c809893-7b2c-4f35-8775-5b3caf1d60c6 | handong32/tailbench | moses/moses/Search.cpp |
#include "Manager.h"
#include "SearchCubePruning.h"
#include "SearchNormal.h"
#include "SearchNormalBatch.h"
#include "UserMessage.h"
namespace Moses
{
Search *Search::CreateSearch(Manager& manager, const InputType &source,
SearchAlgorithm searchAlgorithm, const TranslationOptionCollecti... | ALGO | 0.995299 | 5.951425 |
5ca18e4c-7798-43b1-9bfd-ea40d3e9a0bd | keatshackon/Scaler_DSA | Graph/day83H1.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve(int i, int j, vector<vector<int>>&A, vector<vector<int>>&visited) {
visited[i][j] = 1;
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1};
for (int k = 0; k < 8; k++) {
int nrow = i + dx[k];
int ncol ... | ALGO | 0.999908 | 5.317666 |
79ee0bfd-0149-4dbe-a2d0-0f32172b4a03 | BadagalaAdarsh/SdeSheetChallenge | Day_26/Compare_Version_Numbers.cpp | int compareVersions(string a, string b)
{
// Write your code here
int i=0,j=0, aLen = a.length(), bLen = b.length();
while(i<aLen || j<bLen)
{
long long n1 = 0,n2 = 0;
while(i<aLen && a[i] != '.')
{
n1 = n1 * 10 + 1ll*(a[i] - '0');
i++;
}
while(j<bLe... | ALGO | 0.999614 | 3.689759 |
31dfcc9f-985a-4c77-b389-03628c64007e | amjed77/cashair-app-ui | 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.998859 | 6.785645 |
da3c57ef-9967-4d85-939c-aa00d9c6311f | fairywreath/sorting-visualizer-cpp | sorting_visualizer/mergesort.cpp | #include "mergesort.hpp"
#include <iostream>
MergeSort::MergeSort(const unsigned delayTime) {
sleepTime = delayTime;
name = "Merge Sort";
}
std::vector<SortView> MergeSort::slice(std::vector<SortView>& array, int first, int last) {
auto start = array.begin() + first;
auto end = array.begin() + last;
std::vector... | ALGO | 0.990563 | 5.183407 |
cf45d701-11a5-4670-a578-f5f0e84e3be4 | Edu92337/CodeForces | 408B.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define fo(i,n) for(int i = 0; i < n; i++)
int main() {
string vasya;
string girlanda;
int area = 0;
cin >> vasya;
cin >> girlanda;
map<char,int>qnt_vasya,qnt_guirlanda... | ALGO | 0.999984 | 4.176782 |
47367541-c3b2-4c3e-a716-5f88b560ea36 | ishandutta2007/codeforces | huah/normal/1139/D.cpp | #include <cstring>
#include <iostream>
typedef long long int int_t;
using std::cin;
using std::cout;
using std::endl;
const int_t mod = 1e9 + 7;
const int_t LARGE = 1e5;
int_t inv[LARGE + 1];
int_t m;
int_t mu[LARGE + 1];
int_t factor[LARGE + 1];
bool isPrime[LARGE + 1];
int main() {
memset(isPrime, 1, sizeof(isP... | ALGO | 0.99999 | 5.172369 |
e4beae88-dd2f-4912-a0eb-98579e2b6daf | ishandutta2007/codeforces | qingyu/normal/1492/D.cpp | #include <bits/stdc++.h>
const int N = 1e6 + 50;
int A[N], B[N];
template<int T>
struct fast_io
{
char p[T], q[T], *p1, *p2, *q1, *q2;
fast_io()
{
p1 = p2 = p;
q1 = q, q2 = q + T;
}
inline char gc()
{
return p1 == p2 && (p2 = (p1 = p) + fread(p, 1, T, stdin), p1 == p2) ? EOF : *p1++;
}
inline void p... | ALGO | 0.999979 | 3.003489 |
52638f03-50c4-4b25-9be2-d33a49df5b2a | oscarlaaaa/fun-algo-stuff | LeetCode/Medium/1391_Check_If_Theres_a_Valid_Path_in_Grid/Solution.cpp | // 2022-12-05
class Solution {
public:
bool hasValidPath(vector<vector<int>>& grid) {
/*
input: grid of different types of streets
output: whether there's a valid path
notes:
- 1 = left->right
- 2 = top->bottom
- 3 = left->bottom
... | ALGO | 0.99993 | 6.431143 |
5b66573e-b29e-4606-b213-fd6a38516c1f | Anubhav-Tomar/DSA-Solution | 0543-diameter-of-binary-tree/0543-diameter-of-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999927 | 6.67616 |
dc6e569b-60b6-4f72-b767-464f18fc9fe6 | koushik395/LeetCodeProblems | 1422-maximum-score-after-splitting-a-string/1422-maximum-score-after-splitting-a-string.cpp | class Solution {
public:
int maxScore(string s) {
int zeros = 0, ones = 0, maxi = INT_MIN;
for(int i=0;i<s.size();i++) {
if(s[i] == '0') zeros++; else ones++;
if(i != s.length()-1) maxi = max(zeros - ones, maxi);
}
return maxi + ones;
}
}; | ALGO | 0.999906 | 5.700658 |
79909644-7a5c-4e5e-966b-f92e241ae082 | ishandutta2007/codeforces | mangooste/normal/1245/A.cpp | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
using ll = long long;
using namespace std;
namespace Debug {
template<class A, class B>
ostream& operator << (ost... | ALGO | 0.999618 | 5.22099 |
58209410-b93c-4127-b374-ef6ef357d11f | tic40/atcoder | algo-method/529/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;
int n;
vector<vector<int>> g;
vector<int> d;
void dfs(int pos = 0, int pv = -1, int depth = 0) {
d[pos]... | ALGO | 0.99985 | 4.649264 |
9d6a7b56-31ff-45b2-b437-b6d169caecef | ishandutta2007/codeforces | oipotato/normal/1700/A.cpp | #include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<map>
#include<cassert>
#include<string>
using namespace std;
#define pb push_back
#define mp make_pair
#defin... | ALGO | 0.999861 | 3.926908 |
1abb7e2f-cdb3-4ad1-8efd-580622a62b2d | TING2938/locker | leetcode/hot100/492.构造矩形.cpp | /*
* @lc app=leetcode.cn id=492 lang=cpp
*
* [492] 构造矩形
*/
#include "vector_utils.h"
// @lc code=start
class Solution
{
public:
vector<int> constructRectangle(int area)
{
int m = sqrt(area);
while (area % m != 0) {
m--;
}
return {area / m, m};
}
};
// @lc cod... | ALGO | 0.993285 | 6.544263 |
9c29346c-9b3f-44be-ab2d-14b1a4d2867f | AnkitJha13/practice | CDAC/C++/Arrays/matrixOperations.cpp | #include <iostream>
using namespace std;
const int SIZE = 10;
void inputMatrix(int mat[SIZE][SIZE], int row, int col) {
cout << "Enter matrix elements:\n";
for (int i = 0; i < row; i++)
for (int j = 0; j < col; j++)
cin >> mat[i][j];
}
void displayMatrix(int mat[SIZE][SIZE], int row, int ... | ALGO | 0.961733 | 4.480012 |
4a1614e5-128f-46d7-af92-f49039209862 | collisionl/CCFxidian | CCF201703-1.cpp | /*
在同一行声明变量时,分开赋值
*/
#include <iostream>
using namespace std;
int main()
{
int num = 0, weight = 0;
cin >> num >> weight;
int *list = new int[num]();
for (int i = 0; i < num; ++i)
{
cin >> list[i];
}
int person = 0;
int sum = 0;
for (int i = 0; i < num; ++i)
{
if (sum >= weight){
person++;
sum = 0;
... | ALGO | 0.999924 | 3.436567 |
0bc1fbb9-f832-46cc-8f12-622e0ddb7e18 | tr1ten/DNA | 2062D.cpp | #include <bits/stdc++.h>
using namespace std;
#define ss second
#define ff first
#define int long long
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define tkv(vec,sz) rep(i,0,sz) cin>>vec[i]
#define srv(vec) sort(vec.begin(), vec.end())
#define all(x) x.begin... | ALGO | 0.999792 | 4.19323 |
0ffa76dd-b902-46c0-80ec-90f0f863de78 | ishandutta2007/codeforces | nikarabika/normal/354/E.cpp | //sobskdrbhvk
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
#define PB push_back
#define MP make_pair
#define L first
#define R second
#define sz(x) ((int)(x).size())
#define smax(x, y) ((x) = max((x), (y)))
#define smin(x, y) ((x) = min... | ALGO | 0.999375 | 4.024996 |
a4734c6c-0ddd-4560-a115-31829984a887 | ash1852/llvm-15-compat-pinpoint | libc/src/math/aarch64/floorf.cpp | #include "src/math/floorf.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, floorf, (float x)) {
float y;
__asm__ __volatile__("frintm %s0, %s1\n\t" : "=w"(y) : "w"(x));
return y;
}
} // namespace __llvm_libc
| ALGO | 0.994794 | 5.268323 |
7d6a7974-39ea-447f-8ebc-4fdac39d5cac | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1094_5.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n;
vector<long long> pre;
cin >> n;
pre.resize(n + 1, 0);
for (int i = 1; i <= n; i++) cin >> pre[i];
sort(pre.begin(), pre.end());
for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + pre[i];
int mid = 1, len = 0;
long... | ALGO | 0.999985 | 3.292166 |
b40c23fa-c7c0-4042-835d-9399010649a7 | mayanjain/LeetCode-Solutions | 318-maximum-product-of-word-lengths/318-maximum-product-of-word-lengths.cpp | class Solution {
public:
int maxProduct(vector<string>& words) {
int n=words.size();
vector<set<char>> v(n);
int ans=0;
for(int i=0 ; i<n ; i++){
for(auto& j:words[i])v[i].insert(j);
for(int j=0 ; j<i ; j++){
bool ok=1;
for(auto... | ALGO | 0.999931 | 5.750714 |
e5f1a573-b82e-4086-a01d-953e1d80966c | Dv1de29/Tema3Lab_SD | prob_timbre.cpp | #include <fstream>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
std::ifstream fin("timbre.in");
std::ofstream fout("timbre.out");
int N,M,K;
struct Interval{
int m, cost;
};
struct Compare{
bool operator()(const Interval& a, const Interval& b){
retur... | ALGO | 0.999838 | 4.018944 |
05e6f9a4-1dac-4798-b64d-8aa88a289d2b | nesmahussein/chat_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.998859 | 6.785645 |
6bea0413-f12f-4cab-a43c-5f220fc076a3 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_367_6.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1010, D = 12;
int n, d, MOD;
long long dp[N][D][N], inv[D];
long long power(long long a, int b) {
long long res = 1;
while (b) {
if (b & 1) res = 1ll * res * a % MOD;
a = 1ll * a * a % MOD;
b >>= 1;
}
return res;
}
int main() {
cin >> n >... | ALGO | 0.999971 | 5.400622 |
4b8cea0d-7fe5-4fdc-968a-0758488bff9e | unbeatable-bot/bproLoan | 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 |
c5d3e5f9-c041-4011-8712-1f146b879304 | dscoder1/Class-Assignment | VowelConsonant.cpp | #include <iostream>
using namespace std;
int main()
{
string Sentence;
int Vowel = 0, Consonant = 0;
cout << "\nEnter Your Sentence: " << endl;
getline(cin, Sentence);
cout << "Your Sentence Is : " << Sentence << endl;
for (int i = 0; i < Sentence.size(); i++)
{
if (Sentence[i] == 'a... | ALGO | 0.997232 | 4.702663 |
e00203dd-fcb8-4a83-ad0e-5fa7c9c5ffa2 | kapil4457/Contests | AtCoder Contests/AtCoder Beginner Contest 303/.history/temp3_20230527210624.cpp | #include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007ll //998244353ll
#define mii map<int, int>
#define pii pair<int, int>
#define TEST int t;cin >>t;while(t--)
int power(int a,int b){int result =1; while(b>0){if(b%2) result*=a; a*=a;b/=2;} return result;}
using namespace std;
v... | ALGO | 0.999767 | 5.233755 |
ed582564-3a7c-4838-9da2-0bd91583c237 | KrepakVitaly/MIPT_CSciense_course | Double-linked list/double_list.cpp | /// \brief
///
/// \description doubly-linked list
/// \author zorroxied 016
///
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <windows.h>
#include <assert.h>
//------------------------------------------------------------------------------
//------Constants-----------... | ALGO | 0.979786 | 3.409049 |
92a5a888-f24d-4d7e-9411-eb15d1141175 | junrushao/ACM-Training-Tasks-2014 | 2014.07.28/Solutions/A.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1000 + 1;
const int M = 20 + 1;
int c, n, teamID[N], problemID[N], submitTime[N], isAccepted[N], order[N];
int wrongTrialCount[N][M], acceptedTime[N][M], totalSolved[N], penalty[N];
bool compare(int i, int j) {
return su... | ALGO | 0.999953 | 3.563082 |
6185409b-d18c-4df1-bebf-b01aeaa5375f | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/shortest-common-supersequence-Solution.shortestCommonSupersequence/177799_Overflow.cpp | _XcursorReadImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
XcursorChunkHeader chunkHeader;
XcursorImage head;
XcursorImage *image;
int n;
XcursorPixel *p;
if (!file || !fileHeader)
return NULL;
if (!_XcursorFileReadChunkHeader (file, fileHeader, ... | TOOL | 0.963143 | 4.678794 |
5e49f6af-1f3a-4067-aba2-6221443900b4 | Ryb7532/AtCoder | submissions/abc345/d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep3(i,s,e) for (int i=(int)s; i<(int)e; i++)
#define rep2(i,n) rep3(i,0,n)
#define rep1(n) rep2(_,n)
#define rep(...) GET_MACRO(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define ... | ALGO | 0.999909 | 4.011374 |
f96ebec2-8223-462a-af15-853b9444c66b | AkshatJain2021/basic-codes | Strings/adv/version_numbers.cpp | class Solution {
public:
int compareVersion(string version1, string version2) {
int leng1=version1.length();
int leng2=version2.length();
int i=0,j=0;
while(i<leng1 || j<leng2)
{
int num1=0,num2=0;
while(i<leng1 && version1[i]!='.' )
{
... | ALGO | 0.99989 | 5.406478 |
d1f1497a-5710-4f84-865a-39c9a6131168 | star-platinum127/uva | gjb014.cpp | #include <iostream>
#include<vector>
#include<algorithm>
#include<cstring>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
char a[3][101];
int sum[3]={0,0,0};
int sum1=0;
for(int i=0;i<3;i++){
cin.getline(a... | ALGO | 0.999074 | 3.278466 |
40874374-371b-432c-883b-730ba2e9e989 | erikcrossdev/C-HowToProgramStudy | 5thEdition/BookExamples/examples/ch06/exercises/ex06_10.cpp | // Exercise 6.10 Solution: ex06_10.cpp
// Inline function that calculates the volume of a sphere.
#include <iostream>
#include <cmath>
using namespace std;
const double PI{3.14159}; // define global constant PI
// calculates volume of a sphere
inline double sphereVolume(const double radius) {
return 4.0 / 3.0 * PI... | ALGO | 0.998743 | 6.861776 |
e1702723-01a2-4b15-b67e-6ea5a91fb4e3 | Kenedw/Pipeline_Computer_Graphics_UFPB | lib/glm/test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#define LE 1 // 1 for little-endian, 0 for big-endian.
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0... | ALGO | 0.998228 | 3.531706 |
18c33c3b-6da2-418f-b296-90e50382f85c | Jargon4072/DS-ALGO_implementations | c++/trie/insert&search.cpp | #include<bits/stdc++.h>
using namespace std;
#define CHAR_TO_INDEX(c) ((int)c - (int)'a')
//TODO: implement it again. https://github.com/Jargon4072/DS-ALGO_implementations/issues/13 id:12
struct trienode{
trienode *children[26];
bool isleaf;
};
trienode* getnode(void){
trienode* new_node=NULL;
... | ALGO | 0.999902 | 4.951642 |
0db7a548-53c1-46b3-b95a-6f34eb491d87 | eyu8nz/homework06-eyu8nz | trap2.cpp | #include <stdio.h>
#include <math.h>
double trapRule2(double (*f)(double, double), double minX, double minY, double maxX, double maxY, int nSteps);
double function(double x, double y) {
return exp(cos(x + y)) * exp(sin(x));
}
const int nSteps = 10000;
int main() {
double result = 0.0;
double xMin = 0.0;
dou... | ALGO | 0.999478 | 4.47005 |
a091f303-9858-4f47-a7a9-fb14519149cd | divyadhimaan/leetcoding | 210-course-schedule-ii/210-course-schedule-ii.cpp | class Solution {
public:
vector<int> findOrder(int numCourses, vector<vector<int>>& prerequisites) {
vector<int> ans;
vector<vector<int>> adjList(numCourses);
for(int i=0;i<prerequisites.size();i++)
{
adjList[prerequisites[i][1]].push_back(prerequisites[... | ALGO | 0.999966 | 6.264836 |
06872664-82b9-420e-8ea1-dfae156c3360 | albertec1/Development | Physics2_class3 - handout/Box2D/Box2D/Dynamics/Contacts/b2CircleContact.cpp | #include <Box2D/Dynamics/Contacts/b2CircleContact.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Collision/b2TimeOfImpact.h>
#include <new>
b2Contact* b2CircleContact::Create(b2Fixture*... | ALGO | 0.934113 | 6.984516 |
4e52d294-67ee-44c3-8c84-aa60d6c62d34 | unicode-Ind/DSA_Final_Prep | 1.01 Algo's/Dutch_National_Flag.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
#define fo(i,n) for(i=0;i<n;i++)
#define fok(i,k,n) for(i=k;i<n;i++)
//const double PI=acos(-1);
#define vint vector<int>
#define vfloat vector<float>
#define pb push_back
const long long mod=1e9;
#define PI 3.14159
#define vint... | ALGO | 0.99998 | 3.879952 |
13552113-4921-48bc-80f4-84c3654e2c6d | samadhiprarthana/cpp-fundamentals | 4.cpp | //4. Write C++ program to check even or odd using functions
#include<iostream>
using namespace std;
void findevenodd(int num) {
if (num % 2 == 0) {
cout << num << " is a even number";
}
else {
cout << num << " is a odd number ";
}
}
int main() {
int num;
cout << "Enter the number... | ALGO | 0.996014 | 5.540874 |
fe891084-65c4-4794-a85d-6aadc4e4784e | NirViaje/softart | eflib/src/math.cpp | #include <eflib/include/math/math.h>
namespace eflib{
vec2 normalize2(const vec2& v)
{
float length = v.length();
if(equal<float>(length, 0.0f)){
length = 1.0f;
}
float inv_length = 1.0f / length;
return v * inv_length;
}
vec3 normalize3(const vec3& v)
{
float length = v.length();
if(equal<float... | ALGO | 0.995001 | 5.431447 |
e0606fee-2a7f-42a1-b8be-fba12dfd700f | Stele1203/C_plus | test./string2/zad7.cpp | #include <iostream>
#include <string>
using namespace std;
//Napisati funkciju void umetniCifru(string& s) koja transformiše taj string s tako što
//nakon svake cifre veće od 0 u stringu umetne cifru za jedan manju, a nakon cifre 0
//umetne cifru 9. Na primjer, unijeti string s = "ab2c9#03", funkcija treba da transform... | ALGO | 0.99863 | 4.349345 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.