uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
cbff3013-a4e8-4710-986b-0eebffdac282 | PerthCharles/Coding | leetcode/C&C++/medium/PartitionList.cpp | /*
* Partition List
* Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
*
* You should preserve the original relative order of the nodes in each of the two partitions.
*
* For example,
* Given 1->4->3->2->5->2 and x ... | ALGO | 0.999998 | 5.508171 |
82cdec7d-fcc1-4476-8352-6bfa30726353 | dgpdec/course | Connection/src/HalfEdge.cpp | #include "HalfEdge.h"
#include "Mesh.h"
#include "Vector.h"
#include "Quaternion.h"
namespace DDG
{
double HalfEdge :: cotan( void ) const
{
if( onBoundary ) return 0.0;
Vector p0 = next->next->vertex->position;
Vector p1 = vertex->position;
Vector p2 = next->vertex->position;
Vec... | ALGO | 0.918996 | 6.330233 |
762571d7-89ec-4cb2-a92c-c6982b2ced18 | theVeryPulse/leetcode | NeetCode/00_arrays_and_hashing/04_top_k_elements_in_list/top_k_elements_in_list.cpp | #include <map>
#include <vector>
#include <iostream>
#include <algorithm>
struct CountNum
{
int count;
int num;
};
/**
* @brief Returns `true` if first argument is less
*
* @return true
* @return false
*/
bool compareCount(const CountNum& l, const CountNum& r)
{
return l.count < r.count;
}
class Sol... | ALGO | 0.999994 | 6.085229 |
22f49cd2-1474-4c68-bad4-4eb637ac5fb8 | firstfan119/first_fan-s-code-on-luogu | C++/CF656G.cpp | #include <bits/stdc++.h>
#define ri register int
#define ll long long
using namespace std;
int buc[666];//bucket
int read()
{
int num=0;
int flg=1;
char c=getchar();
while(!isdigit(c))
{
if(c=='-')
{
flg=-1;
... | ALGO | 0.999182 | 3.549675 |
1650de69-643a-49b6-af08-4015096b4bfe | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/DSA/STL/ChefOfTheYear_20200630212248.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printVect(vect,dataStruc... | ALGO | 0.999977 | 3.989844 |
03fc4adb-5532-446d-8801-af035a65a98d | nucleargezi/acm-icpc | codeforces/beta_round/40-49/41 cf_beta40 -ak/41B.cpp | #include "MeIoN_Lib/Z_H/MeioN.hpp"
#include "MeIoN_Lib/MeIoN_all.hpp"
// #define tests
void Yorisou() {
LL(n, b);
VEC(ll, a, n);
ll ans = b;
FOR(i, n) {
FOR(k, i + 1, n) {
chmax(ans, b / a[i] * a[k] + b % a[i]);
}
}
UL(ans);
}
#include "MeIoN_Lib/Z_H/main.hpp" | ALGO | 0.999765 | 4.281799 |
871bf6bc-77e4-409f-8c2a-213caf1ab97c | NEWPLAN/OJ | acm/BOOK/part1/chapter3/3.4/3.4.9exec/product/product.cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cctype>
using namespace std;
int main()
{
int a=0;
long long ans=1;
char c;
while((c=getchar())!=EOF) {
if(isdigit(c)) a=a*10+c-'0';
else if(c==' ') {ans*=a; a=0;}
if(ans==0) break;
}
ans*=a;
printf("%3lld\n",ans%1000);
return 0;
}
| ALGO | 0.999606 | 3.190883 |
e9e0c48f-53d6-4d45-be97-17385fce2a96 | AnsElwkel/DS-Course-Material | warm-up/complexity.cpp | #include <iostream>
using namespace std;
int main() {
// what is complexity
// why it's important
// what is "O" notation
// 9 7 18 0 1 2
// constant time O(1)
// O => order
// it will always run in constant time no matte how large the number is
int a=1000000,b=1345;
a + b;
cou... | ALGO | 0.96972 | 3.374445 |
9b31d059-086e-4b23-8bef-e9012d49a42c | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt35/Codenet/p02373/243736881/response_9.cpp | Optimization:
1. Use a `vector` instead of an array for `color`, `par`, `depth`, `top`, and `goUp`. This will reduce memory usage and improve cache locality.
2. Remove the unnecessary `tord` vector and use a single loop to iterate over the vertices in `tord` while decomposing the graph. This will reduce memory usage ... | ALGO | 0.999982 | 6.438182 |
835b88fb-bf20-45da-a922-964e740583b0 | raincross7/code-similarity | codes/train_code/problem227/problem227_148.cpp | #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
long long int gcd(long long int a,long long int b){
if(!b)return a;
return gcd(b,a%b);
}
int main(){
long long int A,B;
cin>>A>>B;
long long int ans=A*B/gcd(A,B);
cout<<ans<<endl;
ret... | ALGO | 0.999784 | 4.135476 |
27a2d1d7-e77b-4d96-8d3b-dc89357656b5 | ayush9h/DSA-Sheet | Arrays/countloss.cpp | class Solution {
public:
vector<vector<int>> findWinners(vector<vector<int>>& matches) {
unordered_map<int,int> lmap;
for(int i = 0;i<matches.size();i++)
{
int loss = matches[i][1];
lmap[loss]++;
}
vector<int> zero;
vector<int> one;
fo... | ALGO | 0.99988 | 5.751932 |
ff88838c-f96b-4738-a747-cfa82fd90f9f | md-jonayed/Phitron_Course | Semester 1/DSA/Module 19.5 (practice)/2.UnivaluedBinaryTree.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.999879 | 6.279158 |
d9dabc50-d58d-432f-bb4b-04c4a8cc21bd | patrikpihlstrom/Monotone-Chain-Convex-Hull | MonotoneChainConvexHull.cpp | #include <vector>
#include <algorithm>
#include <time.h>
typedef int coord_t;
typedef long long coord2_t;
struct Point
{
Point() :
m_x(0),
m_y(0)
{
}
Point(const coord_t & p_x, const coord_t & p_y) :
m_x(p_x),
m_y(p_y)
{
}
~Point()
{
}
coord_t m_x, m_y;
bool operator<(const Point & p_point... | ALGO | 0.999902 | 4.638662 |
fab12ae4-bc28-4d63-a876-a09f8438ad0c | 06suraj/GeekforGeeks-And-Leetcode | Weekly Contest 264/2050. Parallel Courses III.cpp | class Solution {
public:
int minimumTime(int n, vector<vector<int>>& relations, vector<int>& time) {
vector<int>adj[n];
vector<int>indeg(n,0);
for(auto i:relations){
adj[i[0]-1].push_back(i[1]-1);
indeg[i[1]-1]++;
}
vector<int>dist(n,0);
queue<in... | ALGO | 0.99994 | 6.288124 |
69939dda-67fa-4308-9e2a-191e3591c811 | devtanish/Daily-DSA | Reorder-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:
void reorderList(List... | ALGO | 0.999992 | 6.473023 |
5b8d1518-a38b-41b2-86aa-97cbbcd63394 | nkirov/nkirov.github.com | 2019/CITB205/labs/sources/4/find.cpp | #include <iostream>
#include <string>
#include <cstdlib>
#include <fstream>
using namespace std;
void err()
{
cout << "argc must be >= 3!" << endl;
exit(1);
}
void find1(istream &inf, char* argv[], string keyword, int i)
{
string line;
while(getline(inf, line))
{
size_t found = line.find(k... | TOOL | 0.953511 | 3.828861 |
4d560e45-647d-4019-8029-f7231af962c1 | agiletechvn/caffe-opencv4-macos | src/caffe/net.cpp | #include <algorithm>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#ifdef USE_HDF5
#include "hdf5.h"
#endif // USE_HDF5
#include "caffe/common.hpp"
#include "caffe/layer.hpp"
#include "caffe/net.hpp"
#include "caffe/parallel.hpp"
#include "caffe/proto/caffe.pb.h"
#include "caff... | DATA | 0.861717 | 4.232403 |
0b0a4644-17ee-406e-8b99-50eec0de1d5e | alifalhasan/CP-code-vault | Codeforces/Codeforces Round/Codeforces Round 769 (Div. 2)/E1 - Distance Tree (easy version)/144912328.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
vector<int> depth;
int max_dist;
int corr, curr;
void dfs1(int v, int p, int h) {
depth[v] = h;
for(int to : g[v]) {
if(to == p) {
continue;
}
dfs1(to, v, h + 1);
}
void dfs2(int v, int p, int h) {
i... | ALGO | 0.999506 | 5.035164 |
5fec4ed5-f10b-40a2-b1dc-a9fd20f5572e | ajimenezh/Programing-Contests | Codeforces/T3CHFESTPRoblem15.cpp | #include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>
using namespace std;
#define eps 10e-8
int latti... | ALGO | 0.999495 | 3.873125 |
432dfefc-ad21-42f0-a56d-41f7c17b387d | regindex/RegexpToAutomaton | gen_regexp.cpp | #include "internal/glushkov-automaton.hpp"
#include "internal/powerset-construction.hpp"
#include "internal/dfa-minimization.hpp"
const std::vector<char> DNA_vec{'a','c','g','t'};
// function that prints the instructions for using the tool
void print_help(char** argv) {
std::cout << std::endl <<
"Usage: ... | ALGO | 0.990918 | 3.59745 |
c1a1c733-868b-472b-be22-8a957ca06ccf | LMJW/DSA_UCSD | Algorithm_tool_box/week5/primitive_calculator.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using std::vector;
struct dpelement {
int value;
int op; // 0-> -1 operation; 1-> *2 operation; 2-> *3 operation
};
void threemin(int x, int y, int z, dpelement& p) {
int idx, v;
if (x > y) {
v = y;
idx = 1;
} else {
v = x;
idx = 0... | ALGO | 0.999996 | 4.367663 |
079a6227-9e28-4903-be2a-95e8ffaca7ff | UPBGE/upbge | intern/cycles/scene/tabulated_sobol.cpp | /* This file is based on the paper "Stochastic Generation of (t, s)
* Sample Sequences" by Helmer, Christensen, and Kensler.
*/
#include "scene/tabulated_sobol.h"
#include "util/hash.h"
CCL_NAMESPACE_BEGIN
void tabulated_sobol_generate_4D(float4 points[], const int size, const int rng_seed)
{
/* Xor values for g... | ALGO | 0.986214 | 6.783295 |
0c471199-42b9-49d8-9004-87e43b54270a | freezer-glp/leetcode-submit | src/Maximal Square.cpp | /*
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
Example:
Input:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output: 4
*/
class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int m = matrix.size();
if (m == 0) ... | ALGO | 0.999727 | 6.404548 |
b9ce5489-2386-4474-ab57-1d362fd7e13a | deldelda/Box2d-Mods | Box2D/Collision/b2BroadPhase.cpp | #include <Box2D/Collision/b2BroadPhase.h>
#include <cstring>
b2BroadPhase::b2BroadPhase()
{
m_proxyCount = 0;
m_pairCapacity = 16;
m_pairCount = 0;
m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair));
m_moveCapacity = 16;
m_moveCount = 0;
m_moveBuffer = (int32*)b2Alloc(m_moveCapacity * sizeof(int... | TOOL | 0.864454 | 6.944309 |
78d04a4e-3a4d-477a-ab45-8934de2e8aa4 | affanqureshi2/Projects | Data Structure Subject/Programs/Insertion in arrays_test/Source.cpp | #include <iostream>
#include <string>
using namespace std;
void insertion(int a[],int ln);
int main()
{
int arr[10] = { 1, 2, 3, 4, 5 };
cout << "An array contain five elements. And you have capacity of containing 10 elements.";
for (int i = 0; i < 5; i++)
{
cout<<arr[i]<<" ";
}
cout << endl;
insertion(arr,10)... | ALGO | 0.989787 | 3.213653 |
4b5ea4fa-c561-43eb-a350-b6055e10a832 | khitishpanigrahi98/codes | Acccurate_DFS_graph_traversal_completely_done_by_me.cpp | #include <bits/stdc++.h>
using namespace std;
#define I INT_MAX
void DFS(int mat[8][8])
{
int i,j,l;
stack<int> visit;
vector<int> comp,str;
visit.push(1);
str.push_back(1);
for(i=0;!visit.empty();i++)
{
int z=visit.top();
int entr=0,stkflg=0;
for(j=1;j<=7;j++)
... | ALGO | 0.99987 | 3.261549 |
d877bc13-0cd5-41cf-b12e-b8565ccf4038 | pabrowser/chromium-src | third_party/unrar/src/suballoc.cpp | /****************************************************************************
* This file is part of PPMd project *
* Written and distributed to public domain by Dmitry Shkarin 1997, *
* 1999-2000 *
* Cont... | TOOL | 0.962751 | 6.011486 |
6fe5ef06-14a8-47d9-9d4f-f9a448f28f6f | aniketshisodia/Interview-Bit | Largest-Area-Of-Rectangle-With-Permutations.cpp | int Solution::solve(vector<vector<int> > &A) {
int n = A.size();
if (n == 0) return 0;
int m = A[0].size();
vector<vector<int>> height(n, vector<int>(m, 0));
// Step 1: Build height matrix
for (int j = 0; j < m; ++j) {
for (int i = 0; i < n; ++i) {
if (A[i][j] == 0)
... | ALGO | 0.999827 | 6.539672 |
4f6e646a-abb7-4fc8-bf42-dc737730ffd8 | ishandutta2007/codeforces | riantkb/normal/1394/B.cpp | #include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int M = 1000000007;
bool check(const vector<int>& v, int x, const vector<vector<bool>>& ok) {
if (!ok[x][x]) return false;
for (const auto& i : v) {
if (!ok[i][x]) return false;
}
return true;
}
int dfs(int p, vector<... | ALGO | 0.999956 | 4.234286 |
aab77a19-95b5-4137-bbff-4eec24483e6c | ma-hei/CodingPuzzles | codeforces/roads_a.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
<<<<<<< HEAD
int n;
cin>>n;
int* arr = new int[n];
long long sum=0;
for (int i=0;i<n;i++){
cin>>arr[i];
sum+=arr[i];
}
long long res = 0;
int b=0;
long long temp = 0;
while(b<n && temp+arr[b] <= sum-(temp+arr[b])){
temp+=... | ALGO | 0.999811 | 3.411878 |
622f3e55-e3e4-49b0-b1f8-cba3bcc81bdb | Al73r/Leetcode | 3. Longest Substring Without Repeating Characters/longestSubstringWithoutRepeatingCharacters.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
const int MAX_CHAR = 256;
int pos[MAX_CHAR];
for(int i=0; i<MAX_CHAR; i++){
pos[i] = -1;
}
int i = 0, j = 0;
int rlt = 0;
while(j < s.length()){
if(pos[s[j]] >= i){
... | ALGO | 0.99958 | 6.023638 |
fe17a314-3ded-428d-ab8a-3de94511c965 | gutaussehend-Harshal/CPP-and-DSA-practice-questions | .vs/Practice/tut36.cpp | #include <bits/stdc++.h>
using namespace std;
int top = -1;
void push(int *arr, int n)
{
int x;
cout << "Enter data: ";
cin >> x;
if (top == n - 1)
{
cout << "Overflow" << endl;
}
else
{
top++;
arr[top] = x;
}
}
void pop(int *arr)
{
int x;
if (top =... | ALGO | 0.99648 | 3.841836 |
5a9b3135-5c67-47f8-b615-7f301dc0ce03 | daniel-ankit/Leetcode | 0108. Convert Sorted Array to Binary Search Tree.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
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),... | ALGO | 0.999992 | 6.50403 |
884cd131-4f51-4218-9187-d4aec2003ed9 | NguyenHuy2003/phone_store | 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.998784 | 6.761023 |
df323ee3-5425-4bac-b3df-29e8cafda610 | giongto35/CompetitveProgramming | CHEFZOT.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <que... | ALGO | 0.999981 | 4.047205 |
ea5ab7d4-fa62-48b9-a49d-1cd28ffaf382 | danshved/aoc | 2023/15/b.cpp | #include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <optional>
#include <queue>
#include <ranges>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include "collection... | ALGO | 0.998926 | 4.442132 |
a4652eeb-5330-48fe-9138-126d56b4def4 | masahiro-nakatani/robocon | gnupack4etrbcn/home/kaidan/2012_missions/Mission_Slope_Jiro.cpp | #if 0
// gpึ~!
#include "Mission.h"
#include "Technic.h"
#include "Robot.h"
#include "Debug.h"
#include "Navigator.h"
#include "CourseInfo.h"
#include "BezierCourseInfo.h"
#define DIST_STRAIGHT_BEFORE 250000//1061317
#define DIST_UP_SLOPE 361544.2
#define DIST_DOWN_SLOPE 1382616
class Mission_Slope : public Miss... | ALGO | 0.890168 | 3.641236 |
88956be9-55f5-4223-a2ae-bd163639bcba | sinian666/codes_102_3 | cpp_ๅฏๆฌ18/chapter_graph/graph_bfs.cpp | /**
* File: graph_bfs.cpp
* Created Time: 2023-03-02
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
#include "./graph_adjacency_list.cpp"
/* ๅนฟๅบฆไผๅ
้ๅ BFS */
// ไฝฟ็จ้ปๆฅ่กจๆฅ่กจ็คบๅพ๏ผไปฅไพฟ่ทๅๆๅฎ้กถ็น็ๆๆ้ปๆฅ้กถ็น
vector<Vertex *> graphBFS(GraphAdjList &graph, Vertex *startVet) {
// ้กถ็น้ๅๅบๅ
vector<Vertex *> res;
// ๅ... | ALGO | 0.999858 | 5.563282 |
171bcdd9-02bb-4a33-add4-6f18d39b0e19 | ihorlenko/ICPC | Math/5329 - Party.cpp | #include <iostream>
using namespace std;
int memo[126000];
int binomial_coefficient(int n, int k) {
int index = n * (n + 1) / 2 + k + 1;
if (k == 0 || n == k) {
memo[index] = 1;
return 1;
}
if (memo[index] != 0) return memo[index];
memo[index] = (binomial_coefficient(n - 1, k) + bi... | ALGO | 0.999958 | 5.23356 |
30dc4f67-a9c8-4237-85a3-298c8e7db258 | debsourav33/CodeForces-Problem-Solutions | 1363C - Game On Leaves.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//{
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b);
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define sl(a) scanf("%lld",&a)
#define sll(a,b)... | ALGO | 0.999058 | 4.235351 |
5fdb559a-5ec7-4082-84b4-446706165ead | wsyunine/ACM | 2023-2024/014 ๆญ็ต/004/I2.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdlib>
#include<ctime>
#include<bitset>
#include<vector>
#include<climits>
#include<iomanip>
using namespace std;
#define N 100010
template<typename T>
inline ... | ALGO | 0.999775 | 4.148412 |
578789c3-c15c-4225-a788-cdde0f9a46bb | mpflynnx/learnccp-quiz-solutions | chapter9-error-detection-and-handling/chapter9-x-quiz-question1/main.cpp | #include "Random.h" // defines Random::mt, Random::get(), and Random::generate()
#include <limits>
#include <iostream>
void ignoreLine();
int getInteger(int guessCount);
void game(int guesses);
void playAgain();
constexpr int guesses{ 7 }; // the user has this many guesses
int main()
{
game(guesses);
return 0... | TOOL | 0.878942 | 4.799455 |
bc50b71b-a936-4556-a279-2320f1923bea | AkshatAggarwal14/Competitive-Programming | CodeForces/1009/a.cpp | #ifdef LOCAL
// https://github.com/AkshatAggarwal14/Competetive-Programming
#include "Akshat.hpp"
#else
#include "bits/stdc++.h"
using namespace std;
#define dbg(...)
#endif
using ll = int64_t;
auto sz = [](const auto &container) -> ll { return container.size(); };
#define all(x) (x).begin(), (x).end()
template <class ... | ALGO | 0.999988 | 4.52213 |
80198331-b7d6-459a-bf2f-9e5639db4caa | nikminer4sv/Sem2 | OOP/10/2.5.cpp | #include <iostream>
#include <conio.h>
#include <ctime>
#include "Tree.h"
using namespace std;
template <typename T>
void task(Tree<T>& Test, int Number)
{
int Counter = 0;
Node<T>* Task = Test.Find(Test.getHead(), Number, Counter);
cout << "Amount of branches to goal: " << Counter << endl << endl;
Te... | TOOL | 0.855798 | 4.287704 |
3f26fa18-b05f-4e3d-9a69-d5bf2a8ab40b | Sy0307/Self_Practice_For_Algorithm | HDU 2022/HDU 02/D.cpp | #include <bits/stdc++.h>
#define sf(T) sizeof(T)
#define il inline
#define con const
using namespace std;
using sint = size_t;
using uint = unsigned int;
using ll = long long;
using ul = unsigned long long;
template<class T>
using Vec = vector<T>;
template<class T>
using Stk = stack<T>;
using Str = string;
con ul ULMAX... | ALGO | 0.999781 | 4.082982 |
400464e3-7bdf-414c-8002-14d1a44c636a | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/08/0817/personal_submission/cf993a_tsreaper.cpp | #include <bits/stdc++.h>
using namespace std;
int X[8], Y[8];
int main() {
for (int i = 0; i < 8; i++) {
scanf("%d%d", &X[i], &Y[i]);
X[i] *= 2; Y[i] *= 2;
}
int xa = 0, ya = 0;
for (int i = 0; i < 4; i++) xa += X[i], ya += Y[i];
xa /= 4; ya /= 4;
int xb = 0, yb = 0;
for ... | ALGO | 0.999879 | 3.212103 |
2913c372-7512-4993-84d6-5b718c0b168b | ikarrila/COMP.CS.110_2023 | student/06/sum/main.cpp | #include <iostream>
#include <string>
#include <vector>
#ifndef RECURSIVE_FUNC
#define RECURSIVE_FUNC
#endif
std::vector<std::string> split(const std::string& s, const char delimiter, bool ignore_empty = false){
std::vector<std::string> result;
std::string tmp = s;
while(tmp.find(delimiter) != std::string... | ALGO | 0.997278 | 6.459973 |
280c12cc-9cd1-449a-a9ba-6ccdf9cf3184 | mh-shihan/DSA | Phase-1/Char/palindrome-string-final-method.cpp | #include <iostream>
using namespace std;
bool isAlphabetic(char ch)
{
return ch >= '0' && ch <= '9' ||
ch >= 'A' && ch <= 'Z' ||
ch >= 'a' && ch <= 'z';
}
char toLowerCase(char ch)
{
if (ch >= 'A' && ch <= 'Z')
{
return ch - 'A' + 'a';
}
return ch;
}
bool isPalindrom... | ALGO | 0.999507 | 5.410724 |
836c9da1-8f3d-4e04-b281-98bfecb93a71 | Unmanned-Systems-Lab/ht_real_car_multi | hunter_ros/hunter_base/ascent/examples/airy/airy.cpp | #include "ascent/Ascent.h"
using namespace asc;
struct Airy
{
void operator()(const state_t& x, state_t& xd, const double t)
{
xd[0] = x[1];
xd[1] = -t*x[0];
}
};
int main()
{
state_t x = { 1.0, 0.0 };
double t = 0.0;
double dt = 0.1;
double t_end = 10.0;
RK4 integrator;
Airy ... | ALGO | 0.999619 | 5.699316 |
fdf3fee5-0bea-4846-9415-84c2acfb60db | qu-ngx/rng | PRNGs.cpp | #include <iostream>
uint LCG16()
{
static uint s_state{ 5323 };
// Generate the next number
//modify the state using large constants and intentionally make it hard to overflow
s_state = s_state * 8253729 + 2396403; //first modify the state
return s_state % 32768; //the new state to generate the n... | TOOL | 0.998865 | 4.578213 |
ae1086b1-3e3b-43a9-9b4e-a9282d25db94 | ihaagrawal/GFG-Problem-Of-The-Day | Day-0191: Count Inversions.cpp | // Count Inversions (MEDIUM)
// https://www.geeksforgeeks.org/problems/inversion-of-array-1587115620/1
class Solution {
public:
// Function to count inversions in the array.
int mergeAndCount(vector<int> &arr, int left, int mid, int right) {
vector<int> temp;
int i = left, j = mid + 1, invers... | ALGO | 0.999961 | 5.767026 |
d2057861-d2fa-4bc1-aec0-d4f46c0971d5 | Kapil706/GeeksForGeeks.Cpp- | InterchangeColumnsContinuously/main.cpp | #include <iostream>
#define size 50
using namespace std;
void ChangeColumns(int n, int m , int arr[size][size]){\
for(int i=0;i<n;i++){
for(int j=0;j<m/2;j++){
swap(arr[i][j],arr[i][m-1-j]);
}
}
}
void ChangeRows(int n, int m, int arr[size][size]){
for (int i = 0; i <n/2 ; ++i) {
for (int ... | ALGO | 0.999799 | 3.453791 |
4553a562-67c0-4f99-abba-5583648c97cf | mwashief/step | HackerEarth/oct-circuit/E.cpp | /*
Washief Hossain Mugdho
21 October 2021
HackerEarth oct-circuit E
*/
#ifndef __DEBUG__
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops, no-stack-protector")
#pragma GCC target("avx,avx2,fma")
#endif
#undef __INTERACTIVE__
#include <bits/stdc++.h>
#define pb push_back
#define mp mak... | ALGO | 0.999754 | 4.203478 |
245287a5-716a-477b-b618-5ad91296d964 | euyogi/Problemas-OBI | 2021_2/duplas_de_tenis.cpp | // 2021 Fase 2: Duplas de tรชnis (https://olimpiada.ic.unicamp.br/pratique/ps/2021/f2/tenis/)
#include <bits/stdc++.h>
using namespace std;
signed main() {
int a, b, c, d;
cin >> a >> b >> c >> d;
vector<int> xs {a, b, c, d};
sort(xs.begin(), xs.end());
cout << abs((xs[0] + xs[3]) - (xs[1] + xs[2... | ALGO | 0.999838 | 4.6117 |
64639ef2-f3fe-493d-824f-68e8f53a27df | MSC19950601/Templates | ่ขซ้ๅผ็่ง่ฝ/DLX่งฃๆฐ็ฌ.cpp | #include<bits/stdc++.h>
using namespace std;
//่งฃ 16*16 ๆฐ็ฌ
const int maxnode = 4096*4+100;
const int maxc = 1024+100;
const int maxr = 4096+100;
struct DLX
{
int n,sz; //ๅๆฐ๏ผ่็นๆปๆฐ
int S[maxc]; //ๅๅ่็นๆฐ
int row[maxnode],col[maxnode]; //ๅ็็น่กๅ็ผๅท
int L[maxnode],R[maxnode],U[maxnode],D[maxnode]; //ๅๅญ้พ่กจ
... | ALGO | 0.99974 | 4.297748 |
92b52e39-030e-4498-8ae8-f02ea5b4a92d | Sanchit011/leetcode | 1584 min cost to connect all.cpp | class Solution {
public:
int minCostConnectPoints(vector<vector<int>>& points) {
int n = points.size();
vector<vector<int>> arr(n, vector<int> (n, 0));
for(int i = 0; i<n; i++){
for(int j = i; j<n; j++){
if(i == j){arr[i][j] = 0;}
else{
... | ALGO | 0.999995 | 5.67936 |
fc4bb036-809b-4d38-9514-9cc4502ecc10 | fenwuyaoji/approx-vision | pipelines/common/MatrixOps.cpp | #include "MatrixOps.h"
using namespace std;
// Transpose a matrix
vector<vector<float>> transpose_mat (vector<vector<float>> inmat) {
// Get size of input
int in_width = inmat[0].size();
int in_height = inmat.size();
// Define vectors
vector<vector<float>> outmat (in_width, vector<float>(in_height));
... | ALGO | 0.991127 | 6.091618 |
cf08a5fb-66c2-47fb-9b43-d86efa127570 | Afif718/Debugging-My-Fears | 3_Basic_Data_Structures/20_Module_14_Queue_Implementation_and_STL/4_stl_queue.cpp | #include <bits/stdc++.h>
using namespace std;
/*
STL queue<int> Summary:
Operation Function Time Complexity
Insert push(val) O(1)
Remove pop() O(1)
Access front front() O(1)
Check empty empty() O(1)
Get size size() O(1)
*/
int main() {
// Declare a que... | ALGO | 0.998872 | 5.860608 |
1490586e-6b75-464b-b8f1-716f155104be | AatirNadim/cpp-solutions | Arrays/Sliding Window/sliding_window_max.cpp | /*
problem link --> https://leetcode.com/problems/sliding-window-maximum/
my solution link --> https://leetcode.com/problems/sliding-window-maximum/discuss/6153057/C%2B%2B-oror-Monotonic-Deque
*/
class Solution {
int findMaxIdx(vector<int>& arr, int left, int right) {
int maxval = arr[left],... | ALGO | 0.99999 | 6.360073 |
1f4d7193-4d01-44fc-8dca-6531de1bfe4b | RyanL123/Competitive-Programming | Codeforces/1333A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define inf 0x3f3f3f3f
int main() {
ios_base::sync_with_stdio(fals... | ALGO | 0.999615 | 3.701493 |
2ee0973e-9a78-4dea-b91a-740a1e925bac | clarabalcantara/competitive-programming | Maratona Mista I UFCG WCC/b_agrupamento.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n1, n2; cin>>n1>>n2;
vector<int> v1 = {1, 3, 5, 7, 8, 10, 12}; vector<int> v2 = {4, 6, 9, 11}; vector<int> v3 = {2};
bool agrupadoOuNem = false;
// find busca n1 e n2 no intervalo de cada vetor (v.begin(), v.end())
// se n achar o iterado... | ALGO | 0.999984 | 4.172288 |
cc87c028-3396-468c-a933-d90e1afd5ff8 | MadhavGupta2004/codeforces | horseshoe.cpp | #include<iostream>
#include<vector>
#include<limits.h>
#include<unordered_map>
#include<algorithm>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
unordered_map<int,int> mp;
mp[a]++;
mp[b]++;
mp[c]++;
mp[d]++;
int ans=0;
for(auto x:mp){
if(x.second>1)ans+=x.second-1;
}
cout<<ans;
} | ALGO | 0.999268 | 3.910711 |
2bff4ff1-4d63-42b4-8bbe-714396869d6b | danielvallejo237/MetodosNum2022 | Tarea9/problema1/problema1.cpp | /* Interpolacion mediante splines lineales
Los splines lineales es simplemente ajustar una recta a los datos con base en nuestros puntos
de interpolaciรณn
@Author Daniel Vallejo Aldana (danielvallejo237) on Github
*/
#include<omp.h>
#include<bits/stdc++.h>
using namespace std;
void PrintMat(const vector<vector<double... | ALGO | 0.998306 | 3.641154 |
d9963b06-5928-43ce-b8ea-f3ff0c216929 | mbikas/ACM | uva.onlinejudge.org/10943_new.cpp | #include <stdio.h>
#include <string.h>
long cache[105][105];
long sum(int N, int K)
{
int i;
long summ=0;
if(cache[N][K]!=-1) return cache[N][K];
if(N==0||K==0) return 1;
if(K==1) return 1;
if(K==2) return N+1;
for(i=0;i<=N;i++)
summ+=sum(N-i,K-1)%1000000;
cache[N][K]=... | ALGO | 0.999907 | 3.889815 |
039e0692-216e-48ca-8e79-d7647f693ddb | Garciat/competitive | leetcode/find-minimum-in-rotated-sorted-array-ii.cpp | // https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/
class Solution {
public:
int findMin(vector<int>& nums) {
int L = 0;
int R = nums.size() - 1;
while (L < R && nums[L] >= nums[R]) {
int M = L + (R - L) / 2;
if (nums[M] > nums[... | ALGO | 0.999989 | 6.759187 |
9cdd8097-d78c-422f-9420-b73d7ed991e3 | 30xfeihui/Online-Judge-Solution | Gym/101116/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define endl "\n"
#define LSONE(x) ((x) & -(x))
#define ONBIT(x,k) ((x) | (1<<k))
#define OFFBIT(x,k) ((x) & (~(1<<k)))
#define IFONBIT(x,k) ((x) & (1<<k))
/**
*
*
* 9xZER0
*
**/
/**
* https://codeforces.com/gym/102951/problem/B
**/
int32_t m... | ALGO | 0.999989 | 5.306592 |
42b0668b-8dcc-4ae6-a0b6-13b129ace65f | hjiang13/LLMs-in-IR | POJ-104/85/1466.cpp | #include <iostream>
using namespace std;
int main()
{
int n,i=1,j=0,l,c=0;
char s[100]={
'\0'}
;
cin >> "%d",&n);
for(i=1; i<=n; i++)
{
for(j=0; j<=99; j++)
s[j]='\0';
c=0;
cin >> "%s",s);
l=strlen(s);
if((s[0]>='0')&&(s[0]<='9'))
cout << "no\n");
else
{
for(j=0; j<=l-1; j++)
{
if(((s[j]>='0')&&(s[j]<='9'))||((s[j]>='a... | ALGO | 0.999464 | 3.501275 |
8f4b78c5-682c-4a94-8176-d2ceddf21b70 | Acasune/Atcoder | abc134_d.cpp | #include <bits/stdc++.h>
//----***ใในใผใใคใ***----
using namespace std;
#define int long long
//----***ๅๅฎ็พฉ***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef vector<int,vector<int>> vvec;
typedef long double ld;
typedef pair<int,int> P;
//----***Like ... | ALGO | 0.99998 | 3.626272 |
8c052b66-25f0-4720-8752-dc8ba06d4480 | hm03190814/Qt | QT_Thread/text_2/mythread.cpp | #include "mythread.h"
#include <QDebug>
#include <QElapsedTimer>
#include <QThread>
Generate::Generate(QObject *parent) : QObject(parent) {}
BubbleSort::BubbleSort(QObject *parent) : QObject(parent) {}
QuickSort::QuickSort(QObject *parent) : QObject(parent) {}
/// @brief ็ๆ้ๆบๆฐ_็ฑป
void Generate::working(int num)
{
... | TOOL | 0.954071 | 4.461474 |
9e1784ce-e625-41e1-98c8-443cf8dfec6d | jbuckmccready/CavalierContours | examples/polylineoffsetislands.cpp | #include "cavc/polylineoffsetislands.hpp"
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
// outer surrounding counter clockwise loop that surrounds the islands
// (not required, it is valid to pass in just clockwise loops to be offset)
cavc::Polyline<double> outerCCWLoop;
outerCCWLoop.addVerte... | ALGO | 0.99592 | 7.201935 |
fd08c958-b019-4048-a01a-52ec148c1cea | alisw/fastjet | fastjet/plugins/SISCone/siscone/siscone/vicinity.cpp | #include "vicinity.h"
#include <math.h>
#include <algorithm>
#include <iostream>
namespace siscone{
using namespace std;
/*************************************************************
* Cvicinity_elm implementation *
* element in the vicinity of a parent. *
* clas... | ALGO | 0.999441 | 5.864628 |
cbcec91b-8d2f-40e3-9525-2c1533241b77 | Ved257/Sales-website | C C++/Assignment - 3/q1.cpp | #include <iostream>
using namespace std;
int choice = -1, i = 0, j, a[100];
struct node
{
int data;
struct node *left;
struct node *right;
} *root = NULL;
struct node *ins(struct node *root, int x);
struct node *del(struct node *root, int x);
struct node *newNode(int x);
void inOrder(int[], struct node *roo... | ALGO | 0.999952 | 4.409706 |
2feb10d6-fbc3-486d-8125-7d0853b6f390 | bostinpo42/School-Projects | A) CSCI 140/Workspace/Development/2A/test.cpp | #include <iostream>
int main(int argc, char const *argv[])
{
int count{20};
int num1{0};
int num2{0};
int num3{0};
std::cout << "Please enter threee intergers: ";
std::cin >> num1 >> num2 >> num3;
if((num1 + num2 + num3) > 100)
{
std::cout << "Sum > 100: \n";
}
else
... | ALGO | 0.883543 | 3.721057 |
2fa80e26-5ce4-4415-a2bd-9dac884d1ec3 | MAKIYAMA-ma/AtCoder | ABC330/C.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#if 1
using mint = modint1000000007;
#else
using mint = modint998244353;
#endif
using ll = long long;
using ull = unsigned long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = v... | ALGO | 0.999861 | 3.967638 |
fb7e991a-07e4-4e64-886c-01c0828c43a6 | F-0728/atcoder | ABC/E/325E.cpp | #include <atcoder/all>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
using namespace std;
using namespace atcoder;
// using mint = modint1000000007;
using mint = modint998244353;
using ll = long long;
const ll inf = 1 << 30;
const ll INF = 1LL << 60;
#define rep(i, n) for (ll i ... | ALGO | 0.999861 | 4.375386 |
5acf9aa9-4ed0-4657-a962-0d4a4dca261f | ShriyasnhAgarwl/Leetcode-Submissions | 98-validate-binary-search-tree/98-validate-binary-search-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.999799 | 6.368632 |
6c063082-27c6-490e-95ff-4e1f1c9e5e8e | atuleu/debian-openni2 | Source/Core/OniContext.cpp | #include "OniContext.h"
#include "OniStreamFrameHolder.h"
#include <XnLog.h>
#include <XnOSCpp.h>
static const char* ONI_CONFIGURATION_FILE = "OpenNI.ini";
static const char* ONI_DEFAULT_DRIVERS_REPOSITORY = "OpenNI2" XN_FILE_DIR_SEP "Drivers";
#define XN_MASK_ONI_CONTEXT "OniContext"
ONI_NAMESPACE_IMPLEMENTATION_BE... | TOOL | 0.860964 | 7.341597 |
2b84a830-a6d1-47c5-9a79-dbbbf87f4c1f | Vipin0218/CodeChefSolutions | TaxChefLand.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--) {
int x;
cin>>x;
if(x<=100) {
cout<<x<<endl;
} else{
cout<<x-10<<endl;
}
}
return 0;
}
| ALGO | 0.999259 | 3.915794 |
d215e603-75d5-4550-b8e6-cc7ffd8e86fe | onecode369/CompetitiveProgramming | CodeChef/INOIPRAC/INOI2002.cpp | #include<bits/stdc++.h>
#define DEBUG(x) cerr << #x << " = " << x << endl
#define MOD 1000000007LL
#define INF INT_MAX
#define reset(arr,n,i) fill(arr, arr+n, i)
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
ios::sync... | ALGO | 0.99999 | 4.058884 |
4f01f9b2-e07a-4dcb-becd-a72f0f938b58 | kuang-jy/cpp-project | algorithm/ๆ็ดขๅๆบฏ/1217.cpp | #include <iostream>
using namespace std;
int n,k,ans,pos[10];
char board[10][10];
bool check(int row,int col){
for(int i = row;i >= 1 ;i--)
if(pos[i] == col || board[row][col] == '.') return false;
return true;
}
void dfs(int row,int num){
if(num == 0) ans++;
for(int i = row;i <= n;i++)
... | ALGO | 0.999083 | 3.626342 |
5c3aeca2-a70b-4f88-b63b-a4264b16d1a9 | txgcwm/code_study | cplusplus/boost/boost_1_63_0/libs/numeric/odeint/examples/stuart_landau.cpp | #include <iostream>
#include <complex>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
using namespace std;
using namespace boost::numeric::odeint;
//[ stuart_landau_system_function
typedef complex< double > state_type;
struct stuart_landau
{
double m_eta;
double m_alpha;
stuart_landau( ... | ALGO | 0.997705 | 5.941722 |
6e2ce84f-5668-49ca-a4b1-192c22e8b40b | chaman-aggarwal/DSA-Practice-CB-May | Session9/KthLargestElementInAnArray.cpp | https://leetcode.com/problems/kth-largest-element-in-an-array/
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
// min heap
priority_queue<int, vector<int>, greater<int>> pq;
for(int i:nums)
{
pq.push(i);
if(pq.size()>... | ALGO | 0.999948 | 5.240726 |
af3c6f8b-8f2b-430b-b6f6-6926db9ec91c | The-Shresth/Answers_to_codeforces | 2106A.cpp | #include<bits/stdc++.h>
using namespace std;
int num_1(string s, int index, int count, int num1){
if (index == s.length()) return count;
if(s[index] == '1') return num_1(s,index+1, count+num1-1, num1);
else return num_1(s,index+1, count+num1+1, num1);
}
int number(string s){
int num=0;
for(char c:s){
if(c==... | ALGO | 0.999917 | 4.202719 |
29cbb844-c065-40ff-a1b6-c8ea1d75f484 | iamsmitmaiyani/c-language | lecture 8.3/task4.cpp | #include <stdio.h>
#define SIZE 5
void printBoundary(int arr[][SIZE], int size)
{
for (int i = 0; i < size; ++i)
{
printf("%d ", arr[0][i]);
}
printf("\n");
for (int i = 1; i < size - 1; ++i)
{
printf("%d \n", arr[i][size - 1]);
}
for (int i = size - 1; i >= 0; --i)
{
... | ALGO | 0.999685 | 4.620039 |
acbdef25-e85c-4095-a527-a0e8dcb94482 | Saber033/cool-ninja | thirdparty/graphite/src/Decompressor.cpp | #include <cassert>
#include "inc/Decompressor.h"
#include "inc/Compression.h"
using namespace lz4;
namespace {
inline
u32 read_literal(u8 const * &s, u8 const * const e, u32 l) {
if (l == 15 && s != e)
{
u8 b = 0;
do { l += b = *s++; } while(b==0xff && s != e);
}
return l;
}
bool re... | ALGO | 0.955349 | 5.642631 |
3e6d48ae-5fd4-4457-8737-ecf49e40863c | SohagMollik/LeetCode | 2057-smallest-index-with-equal-value/2057-smallest-index-with-equal-value.cpp | class Solution {
public:
int smallestEqual(vector<int>& nums) {
int ans,i;
bool flag = false;
for(i=0;i<nums.size();++i){
if(i%10 == nums[i])
{
ans=i;
flag=true;
break;
}
}
if(flag==true)retur... | ALGO | 0.999783 | 5.604292 |
a368e8f2-a350-4d87-93ee-6a35b2e8c9c1 | thucdx/algorithm-solution | OTHER/OLD_UNCLASS/CATALAN.cpp | #include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <cstring>
using namespace std;
#define FOR(i, a, b) for (int i =... | ALGO | 0.999994 | 3.046737 |
56e87ec7-a297-46a5-9321-42cf2fd91774 | AlekseyKravchuk/cpp | Yandex_Practicum/sprint_04/03_ctor_initialization_list.cpp | #include <numeric>
using namespace std;
class Rational {
public:
Rational() = default;
Rational(int numerator) : _numerator(numerator), _denominator(1) {}
Rational(int numerator, int denominator) : _numerator(numerator), _denominator(denominator) {
Normalize();
}
int Numerator() cons... | ALGO | 0.919757 | 5.086994 |
4e8ad74e-c18b-44c3-a91e-34a97d2d9fb0 | nil-two/misc | yukicoder/cpp/N98.cpp | #include <iostream>
#include <cmath>
auto main() -> int {
int Xp, Yp;
std::cin >> Xp >> Yp;
double distance = std::sqrt(std::pow(Xp, 2) + std::pow(Yp, 2));
int r = distance*2 + 1;
std::cout << r << std::endl;
}
| ALGO | 0.999533 | 4.288563 |
2170f6f8-537f-41df-951f-e0b4fd9e0659 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11054_8.cpp | #include <bits/stdc++.h>
using namespace std;
int a[400005];
vector<int> v[20];
int sum[20][20];
long long dp[1 << 20];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
a[i]--;
v[a[i]].push_back(i);
}
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 20;... | ALGO | 0.999906 | 3.612696 |
7724346b-20f0-4e48-a1ba-455cf6457456 | ishandutta2007/codeforces | geniucos/normal/799/E.cpp | #include<bits/stdc++.h>
using namespace std;
int N, M, K, lg = 17, aib1[200009], where[200009], h[4][200009], l[4], ap[200009];
long long ans, tot, aib2[200009];
pair < int, int > a[200009];
void U (int pos, int v1, int v2){while (pos <= N){aib1[pos] += v1, aib2[pos] += v2;pos += pos - (pos & (pos - 1));}}
void adVa... | ALGO | 0.999981 | 3.20093 |
eaf52392-a63b-48f5-b170-d67b91fa5c09 | ishandutta2007/codeforces | feecie6418/normal/1705/F.cpp | //copied from https://www.luogu.com.cn/blog/1973224568qq/kao-shi-2021-coe-iii-d
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for (int i = 0, _n = n; i < _n; i++)
#define pb push_back
typedef vector <int> vi;
typedef vector <vi> vii;
vii A[15];
void gA(int m) {
if (m == 0) {
A[0] = {{... | ALGO | 0.999544 | 3.35742 |
c331b9ae-adee-49e6-b5d8-0da79980f7fa | xjubep/Problem-Solving | dp/boj_9465.cpp | // Stickers (์คํฐ์ปค)
// dp[i][j] (0: ๋ ๋ค ์ ๋ฏ์, 1: ์์ชฝ์ ๋ฏ์, 2: ์๋์ชฝ์ ๋ฏ์)
#include <bits/stdc++.h>
using namespace std;
const int MX = 100001;
int p[MX][3], dp[MX][3];
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int tc;
cin >> tc;
while (tc--) {
for (int i = 0; i < MX; i... | ALGO | 0.999944 | 4.051878 |
9060cbe5-0e8e-416b-900a-966ca2ab2867 | YongGyunKwon/OOP_Hanbat_2017 | Chap07/์์ 7-11.cpp | #include<iostream>
using namespace std;
class Power {
int kick;
int punch;
public:
Power(int kick = 0, int punch = 0) {
this->kick = kick;
this->punch = punch;
}
void show();
friend Power operator+(int op1, Power op2);
};
void Power::show() {
cout << "kick= " << kick << "punch= " << punch << endl;
}
Power o... | TOOL | 0.866189 | 4.799815 |
28a9f6fe-7c42-4066-b771-81012f003a53 | trailofbits/llvm-wedlock | libcxx/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.stable.pass.cpp | // UNSUPPORTED: c++98, c++03, c++11, c++14
// <algorithm>
// template <class PopulationIterator, class SampleIterator, class Distance,
// class UniformRandomNumberGenerator>
// SampleIterator sample(PopulationIterator first, PopulationIterator last,
// SampleIterator out, Distance n,
/... | TEST | 0.891097 | 7.494885 |
48137070-9552-4281-aa63-912ce028af74 | dk1242/LeetCode-Practice | 60-permutation-sequence/60-permutation-sequence.cpp | class Solution {
public:
string getPermutation(int n, int k) {
// string a;
// for(int i=0;i<n;i++){
// a+=to_string(i+1);
// }
// while(--k){
// next_permutation(a.begin(), a.end());
// }
// return a;
int fact=1;
vector<int>num... | ALGO | 0.999993 | 6.243249 |
fb707ad5-4f4c-45c0-a8e2-d545ef741689 | raincross7/code-similarity | codes/train_code/problem270/problem270_470.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int input=0;
int a[100];
int b[100][2];
for(int i=0;i<100;i++){
for(int j=0;j<2;j++){
b[i][j]=0;
}
}
int n=0;
while(cin>>input){
a[n]=input;
n++;
}
sort(a,a+n);
int i=0,j=0;
for(i=0;i<n;i++){
if(i==... | ALGO | 0.999992 | 3.425957 |
dc7f6f9f-3e21-45ed-99f1-b8e01cc6db97 | chetan0402/CodeForces | 2106/2106D.cpp | #include<iostream>
#include<vector>
#define int long long
using namespace std;
void solve(){
int n,m;cin>>n>>m;
vector<int> arr(n);
for(int i=0;i<n;i++) cin>>arr[i];
vector<int> brr(m);
for(int i=0;i<m;i++) cin>>brr[i];
vector<int> prefix(m,n);
int ptrArr=0;
int ptrBrr=0;
while(ptr... | ALGO | 0.999969 | 4.661121 |
a02ddfec-08ff-48f7-a0e5-80478a471a22 | CuongNgyn2005/DSA | Home_Work/Home_Work2/Reversed.cpp | /*###Begin banned keyword - each of the following line if appear in code will raise error. regex supported
define
include
class
struct
###End banned keyword*/
#include <iostream>
using namespace std;
struct Node{
int val;
Node* next;
};
struct List{
Node *head, *tail;
};
void list_initializing(List &l){... | ALGO | 0.999981 | 4.870989 |
797e830c-fcea-479e-b4e7-15021b4a4f5f | Akhileshramks/LeetCode_Solution | 0768-partition-labels/0768-partition-labels.cpp | class Solution {
public:
vector<int> partitionLabels(string s) {
unordered_map<char,int> lastOccurence;
int i = 0;
for(char c : s) lastOccurence[c] = i++;
int last = 0;
int end = -1;
vector<int> ans;
int n = s.size();
for(int i = 0;i < n;i++){
... | ALGO | 0.999496 | 6.319818 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.