uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
829a6889-43fc-472e-9e8c-3fc0f3b4a5ad | superdun/cg | dx/d3d12book-master/Chapter 8 Lighting/LitWaves/Waves.cpp | #include "Waves.h"
#include <ppl.h>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace DirectX;
Waves::Waves(int m, int n, float dx, float dt, float speed, float damping)
{
mNumRows = m;
mNumCols = n;
mVertexCount = m*n;
mTriangleCount = (m - 1)*(n - 1) * 2;
mTimeStep = dt... | ALGO | 0.998698 | 5.801816 |
2ad06936-77f4-44c5-8df7-ba631e22cad1 | anukalpbhardwaj/DSA | c++ tutorial/sqrtbinary.cpp | #include<iostream>
using namespace std;
long long int sqrtInteger( int n){
int s = 0;
int e = n;
long long int mid = s + (e-s)/2;
long long int ans = -1;
while(s<=e){
long long int square = mid * mid;
if(square == n){
return mid;
}
if(square <mid){
ans = mid;
s = mid+1;... | ALGO | 0.999945 | 4.581964 |
bb0c6b23-a8dc-4005-9277-9fb8f75dacb9 | Luc1d1ty/DataStructures_Algorithms | CPP/problem_solving/cf/practice/59A.cpp | #include <bits/stdc++.h>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define endl "\n"
using namespace std;
int main(void)
{
int isCap = 0, isSmall = 0;
string word;
cin >> word;
for (int i = 0; i < word.length(); i++)
{
if (isupper(... | ALGO | 0.999963 | 5.481663 |
2da41340-6f24-4057-8db6-ecd52a5be97b | novostary/codes | LeetCode/Stack/simplify-path.cpp | #include <string>
#include <sstream>
#include <stack>
#include <vector>
using std::string;
using std::stringstream;
using std::stack;
using std::vector;
class Solution {
public:
string simplifyPath(string path) { // Runtime: 8 ms
stringstream ss(path);
string sTmp, ret;
vector<string> v;
while (getline(ss, sT... | ALGO | 0.999618 | 5.739192 |
2fe40d7b-e8ae-45ff-8d80-db79865af012 | mmakash/phitron | C++ for DSA/Module-2/dynamic_array.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int *a = new int[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
for (int i = 0; i < n; i++)
{
cout << a[i] << endl;
}
} | ALGO | 0.999009 | 3.169401 |
9c4e0b6c-03f8-4ba3-92b9-0becf6fd2979 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p02773/p02773_num7_parsed.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
int main() {
int N;
std::cin >> N;
std::map<std::string, int> votes;
for (int i = 0; i < N; i++) {
std::string vote;
std::cin >> vote;
votes[vote]++;
}
int maxCount = 0;... | ALGO | 0.999963 | 6.150869 |
8cde81db-0e06-4904-8b8e-733ffe2599d0 | zjunior06/frameworks_av | media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "VectorArithmetic.h"
/**********************************************************************************
FUNCTION From2i... | TOOL | 0.887475 | 4.355818 |
89b52202-543d-41fe-b19f-48f8a4a471b5 | IliaKani/flutter_application_1 | 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 |
e4b291fe-9b48-4bca-99f3-4b4f03fb505c | AshHyun/BOJ | 5622.cpp | #include<iostream>
#include<string>
using namespace std;
int main() {
int arr[26] = { 3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10 };
string s;
cin >> s;
int t = 0;
for (int k = 0; k < s.length(); k++) {
t += arr[s[k] - 'A'];
}
cout << t;
} | ALGO | 0.999766 | 3.533975 |
ff167d10-80b5-44a4-8717-1467792fcd5e | heyx3/WFCpp | WFC++/src/Simple/State.cpp | #include "../../include/Simple/State.h"
#include <unordered_set>
using namespace WFC;
using namespace WFC::Simple;
void State::Reset(Vector2i newOutputSize)
{
//Re-initialize the output array.
//Set the pixel frequencies for every pixel to the frequencies of the input image itself.
const auto& colorFrequencies =... | ALGO | 0.999514 | 6.142888 |
b77f41e0-5735-425e-9d4b-22839c9f12ab | Anik-36/coding_in_laptop | c++/Codeforces_problem/A_rating_800/Day_17/A_Destroying_Bridges.cpp | #include<bits/stdc++.h>
#define endl '\n'
#define ll long long
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int i,b;
cin>>i>>b;
if(b>=(i-1)){
cout<<"1"<<endl;
}else{
cout<<i<<e... | ALGO | 0.999873 | 3.555822 |
37a45525-c925-48b3-8566-b3cf2b598d90 | Amrutha26/A2OJ-Ladder-12 | 118A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
for(int i=0; i<s.size(); i++) {
s[i] = tolower(s[i]);
if(s[i] != 'a' && s[i] != 'e' && s[i] != 'i' && s[i] != 'o' && s[i] != 'u' && s[i] != 'y') {
cout << '.' << s[i];
}
}
cout << end... | ALGO | 0.992748 | 3.244475 |
ad053629-e993-44e0-a2b8-34d11eafedc2 | ishandutta2007/codeforces | golovanov399/normal/963/D.cpp | #include <bits/stdc++.h>
#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define random_shuffle(...) shuffle(__VA_ARGS__, rng)
#define rand() rng()
using namespace std;
inline int nxt() {
int x;
// scanf("%d", &x);
cin >> x;
... | ALGO | 0.999862 | 4.393637 |
623f969b-a2ac-43b6-aad0-be0b8a2c2d77 | anjalidevi1/DSA- | vowel and consonent.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
// Function to check if a character is a vowel
bool isVowel(char ch) {
ch = tolower(ch);
return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
// Function to check if a character is a consonan... | TOOL | 0.942546 | 5.915717 |
13fa74ae-6692-42b1-88de-d8c41ad6cfbf | AdamCooperMarfei/CPP- | Leetcode/线性表/数组/permutationSequence.cpp | #include<vector>
#include<string>
using namespace std;
class Solution1{
public:
string getPermutation(int n, int k){
string s(n, '0');
for(int i = 0;i < n; ++i){
s[i] += i + 1;
}
for(int i = 0; i < k; ++i){
next_permutation(s.begin(), s.end());
}
}... | ALGO | 0.999946 | 5.724461 |
26326262-ae83-474f-892f-eaf1c91cd5af | Ravikisha/CodeArchive | LeetCode/cpp/LRUCache.cpp | class LRUCache
{
public:
class node
{
public:
int key;
int val;
node *next;
node *prev;
node(int _key, int _val)
{
key = _key;
val = _val;
}
};
node *head = new node(-1, -1);
node *tail = new node(-1, -1);
int ... | ALGO | 0.999497 | 6.181124 |
da54a3bb-e96d-40c3-a76a-218731dc730c | asu-crypto/mpsica | libOPRF/Hashing/SimpleHasher1.cpp | #include "SimpleHasher1.h"
#include "Crypto/sha1.h"
#include "Crypto/PRNG.h"
#include <random>
#include "Common/Log.h"
#include "Common/Log1.h"
#include <numeric>
namespace osuCrypto
{
SimpleParam1 k2n24s40SimpleParam1
{ { 1.11,0.17 },{ 3,2 },{ 31,63 },{5,6} };
SimpleParam1 k2n20s40SimpleParam1
{ { 1.12,0.17 },{ ... | ALGO | 0.963418 | 4.890791 |
9d9fd89f-3d52-47f9-ba6c-b60920a4f3f9 | Jyotishmoy12/Binarytree | zigzagtraversal.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.999991 | 6.484484 |
1cf0bbc1-abc2-4834-8247-4f5b6800a545 | yct66612/DS | 2.4队列—循环队列/SqQueue2.cpp | #include <iostream>
#define MaxSize 50 //定义队列中最大元素个数
using namespace std;
typedef struct {
int data[MaxSize]; // 存放队列元素
int front, rear; // 队头指针和队尾指针
int size; // 队列当前元素个数
} SqQueue;
// 初始化队列
void InitQueue(SqQueue& Q) {
Q.front = 0;
Q.rear = 0;
Q.size = 0;
}
// 队列判空
bool QueueEmpty(SqQueue& Q) ... | ALGO | 0.982226 | 3.902931 |
c92191f9-af7d-4bff-abae-fab111f5abb0 | wcyyyooooo/algorithm | 板子/哈夫曼树.cpp | #include <iostream>
#include <vector>
#include <queue>
std::priority_queue<int, std::vector<int>, std::greater<int>> que;
int n;
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
std::cin >> n;
for(int i = 0; i < n; i++){
int v;
std::cin >> v;
que.push(v);
}
... | ALGO | 0.999984 | 4.213989 |
60ed472b-4a4e-454c-a6a3-0104300e55a5 | tejastn1211/online_delivery_system | Ooad_project/Ooad_project/network.cpp | #ifndef network_cpp
#define network_cpp
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <fstream>
using namespace std;
#include "customer.cpp"
#include "utilities.cpp"
using namespace std;
namespace Network
{
string sms_otp(string ... | TOOL | 0.882486 | 4.150168 |
d1eae69c-ccc5-415a-998f-afd2b4ca1689 | 2019202009ankush/competetive_programmin_with_stl | tree/print_path_with_specific_SUM.cpp | /* Path Print with specific sum root to leaf
Written By:ANkush Mitra
Date:18.12.19 Time:00:08*/
void help(TreeNode* A,int B,int CurSum,vector<vector<int> > K,vector<int>temp)
{
if(!A)
return;
CurSum=CurSum+(A->val);
temp.push_back(A->val);
if(!A->left&&!A->right)
... | ALGO | 0.999901 | 5.115213 |
35f24c12-071c-4898-a876-e873c4c57ced | luisreyes55/CPCFI | NumberingRoads.cpp | #include <iostream>
using namespace std;
#define endl '\n'
#define FO(i, b) for (int i = 0; i < (b); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rFOR(i, a, b) for (int i = (a); i > (b); i--)
#define TR(v, arr) for(auto& (v) : (arr))
#define pint(x) printf("%d\n... | ALGO | 0.994524 | 3.652479 |
1758526f-b152-4e2b-b557-b454f90cab91 | ishandutta2007/codeforces | adamant/normal/1142/C.cpp | #include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define int int64_t
using namespace std;
struct pt {
int x, y;
};
bool cmp (pt a, pt b) {
return (a.x < b.x) || (a.x == b.x && a.y < b.y);
}
bool cw (pt a, pt b, pt c) {
return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y) < 0;
}
bool ccw (pt a, pt b, pt c) ... | ALGO | 0.999918 | 5.097403 |
6c236999-4069-4c8b-9317-c83901a13097 | AniketKul/CMPS229_OpenLambda_Ceph | experiments/single-node/docker/boost/libs/iterator/example/reverse_iterator.cpp | #include <boost/iterator/reverse_iterator.hpp>
#include <boost/cstdlib.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
int x[] = { 1, 2, 3, 4 };
boost::reverse_iterator<int*> first(x + 4), last(x);
std::copy(first, last, std::ostream_iterator<int>(std::cout, " "));
std::cout << s... | TOOL | 0.896895 | 4.15839 |
e805ef6e-5e7f-40f6-8ff3-c83092307577 | Wataru-Oshima-Tokyo/gtsam_4.0.1 | gtsam/3rdparty/GeographicLib/src/CircularEngine.cpp | #include <GeographicLib/CircularEngine.hpp>
namespace GeographicLib {
using namespace std;
Math::real CircularEngine::Value(bool gradp, real sl, real cl,
real& gradx, real& grady, real& gradz) const
{
gradp = _gradp && gradp;
const vector<real>& root( SphericalEngine:... | ALGO | 0.999141 | 6.18468 |
f1f7f90f-b4a7-4ece-8fe8-08334bdab6fc | error-raga-008/MY_Works | C++/const function.cpp | //Constatnt function is a function that is declared as constant with the help of const keyword.
//The object of constant function can not be modified.
#include <iostream>
using namespace std;
class student
{
private:
int a;
char n[20];
public:
void in()
{
cout << "Enter Your Name" << endl;
... | TOOL | 0.978464 | 4.715375 |
a9b937c5-1c71-4601-8175-1df54bd61499 | alexandraback/datacollection | solutions_2749486_0/C++/Fudo/B.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <list>
using namespace std;
struct state_Pos
{
long long x,y;
char d;
state_Pos *prev;
};
//int max_num = 2*200;
long long mo[8] = {1,0,0,1,-1,0,0,-1};
... | ALGO | 0.999985 | 4.202905 |
0550e96f-655e-4d6d-94a2-faee437c9d96 | ishandutta2007/codeforces | ljc00118/normal/771/E.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
template <typename T>
inline void read(T &f) {
f = 0; T fu = 1; char c = getchar();... | ALGO | 0.999973 | 3.313473 |
60eba555-dfc9-48ae-98b8-fae28413b341 | MustangYM/ShelbyObfuscator | llvm/lib/CodeGen/LiveIntervals.cpp | #include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervalCalc.h"
#include "llvm/CodeGe... | TOOL | 0.988839 | 4.90427 |
b6fadea1-13bc-4396-b2a4-71d77ff95839 | lekimson/lekimsonmocC_cuoiki | Chapter 11/program/program14.cpp | // This program demonstrates an enumerated data type.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
enum Water { FREEZING = 32, BOILING = 212 };
int waterTemp; // To hold the water temperature
cout << "Enter the current water temperature: ";
cin >> waterTemp;
if (waterT... | TOOL | 0.916429 | 3.129118 |
2951173d-304c-4b02-94a7-8f3a221e9def | menstoo121/leet_code_PS | 2379-minimum-recolors-to-get-k-consecutive-black-blocks/2379-minimum-recolors-to-get-k-consecutive-black-blocks.cpp | class Solution {
public:
int minimumRecolors(string blocks, int k) {
int ans = 101;
for(int i = 0; i <= blocks.size()-k; i++){
int cnt = 0;
for(int j = i; j < i+k; j++){
if(blocks[j] == 'W')
cnt++;
}
ans = min(ans, c... | ALGO | 0.999855 | 5.344289 |
4fe54545-49c4-4645-a310-5ed97bc0459e | AtelierMizumi/C---Exercise | 5 Loops and Files/5.10.cpp | #include <iostream>
using namespace std;
int main() {
int num, reversedNum = 0, remainder, originalNum;
cout << "Enter an integer: ";
cin >> num;
originalNum = num;
// reversed integer is stored in reversedNum
while (num != 0) {
remainder = num % 10;
reversedNum = reversedNum... | ALGO | 0.999533 | 4.790622 |
22258d05-f550-42d7-a1bc-bbedcee409af | PhilippSchuette/projecteuler | cpp_src/problem019.cpp | /* For a given date year/month/day this algorithm returns
the weekday of that date (1 = Monday, 2 = Tuesday, etc.)
For details see https://en.wikipedia.org/wiki/Zeller%27s_congruence */
#include "fmt/format.h"
#include "problem019.hpp"
#include <omp.h>
unsigned zellers_congruence(unsigned day, unsigned month, unsign... | ALGO | 0.999458 | 6.222716 |
07487b1d-7993-4637-8334-bd1cc491b0c6 | prableen14/DSA-own-practice- | Leetcode/Arrays/908. Smallest Range I.cpp | /*
You are given an integer array nums and an integer k.
In one operation, you can choose any index i where 0 <= i < nums.length and change nums[i] to nums[i] + x where x is an integer from the range [-k, k].
You can apply this operation at most once for each index i.
The score of nums is the difference between the ma... | ALGO | 0.999867 | 5.752531 |
082e8ed7-4c6a-492e-840c-bbf692f72e8d | fakuraa/awesome_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.998733 | 6.76775 |
4a60f7c7-e311-4c0a-83a1-9694eb77e2a4 | irori-gthb/atcoder | abc1xx/abc124/abc124_c.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int main() {
string S;
cin >> S;
int a1 = 0;
int a2 = 0;
rep(i, S.size()) {
if (i % 2 == S[i] - '0')
a1++;
else
a2++;
}
cout << min(a1, a2) << endl;
return 0;
} | ALGO | 0.99961 | 3.859936 |
6923dceb-bd4d-40dc-95cb-e50e8e374346 | HRithIkGowDA/Placement_Preperation | leetcode/countingBits.cpp | /*
338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.
Example:
For num = 5 you should return [0,1,1,2,1,2].
*/
class Solution {
public:
vector<int> countBits(int num) {
... | ALGO | 0.999943 | 5.968699 |
899050a3-78a3-49fa-94df-5ffe7f3132d7 | InHng/solution | B_Word_Cut.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;
signed main() {
int k, x = 0;
string start, end;
cin >> start >> end >> k;
int n = start.size();
// dp[i][0] 表示分割 i 次变成了 end 的方案数
// dp[i][1] 表示分割 i 次没变成 end 的方案数
int dp[k + 1][2];
memset(dp, ... | ALGO | 0.999992 | 4.449354 |
fdc3d916-3a86-47ab-b2d6-d2855f1987d9 | routb68/Leetcode-pratice | 0938-range-sum-of-bst/0938-range-sum-of-bst.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.999997 | 6.522788 |
9bd2a72a-1a3c-411c-ac1e-b3e3f98da1b3 | Ryushi-tech/factory | library/DataStructure/DSU.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vp = vector<pii>;
using vvi = vector<vi>;
#define rep(i, a, b) for (int i = a; i < (int) (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (int) (b); i--)
#define fore(i... | ALGO | 0.999769 | 4.129712 |
ff8dccbd-fbe7-4db1-a333-5781a1424692 | Nakib-Arman/CSE318---ArtificialIntelligence | 3.ChainReaction/.history/2105128/2105128_20250624115735.cpp | #include <bits/stdc++.h>
using namespace std;
#define DEPTH 2
class Cell {
int orb_num;
int critical_mass;
char color;
public:
Cell() {
this->orb_num = 0;
this->color = 'W';
this->critical_mass = 4;
}
// Cell(int orb_num, char color) {
// this->orb_num = orb_... | ALGO | 0.999151 | 4.544129 |
110a3a0e-a634-4302-a68a-864d665edf5c | Bigcheese/libcxx | test/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T>
// requires OutputIterator<Iter, RvalueOf<Iter::reference>::type>
// && HasEqualTo<Iter::value_type, T>
// Iter
// remove(Iter first, Iter last, const T& value);
#include <algorithm>
#include <cassert>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#in... | TEST | 0.923168 | 6.685624 |
2bdae607-728f-4799-9b45-ab5d72d2ded6 | schencoding/gpu-graph-anns | cpp/bench/ann/src/hnswlib/hnswlib_graph_analysis.cpp | #include <hnswlib/hnswlib.h>
#include <memory>
int main()
{
int dim = 100;
std::string index_file =
"/usr3/jiangyinzuo_data/cuvs-bench-dataset/glove-100-inner/index/hnswlib.M24.efConstruction512";
auto space = std::make_shared<hnswlib::L2Space>(dim);
hnswlib::HierarchicalNSW<float, true> hnsw_alg(space.get... | ALGO | 0.982189 | 3.283698 |
e46a31a5-e214-4e2a-8085-d2f0fe695b01 | Altu-Bitu/Altu_Bitu_somin | 9월 21일 - 브루트 포스/20055.cpp | #include <iostream>
#include <vector>
using namespace std;
struct info{ // 내구도와 로봇 존재 여부
int power; // 내구도
bool is_on; // 로봇 존재 유무
};
vector<info> belt; // 컨베이너 벨트 정보(내구도, 로봇여부)
int zero_power; // 내구도가 0인 벨트 칸의 개수
// 인덱스 감소 싵키기 (방향-> 오른쪽)
int minusPosition(int n, int pos) {
if (--pos >= 0) return pos; /... | ALGO | 0.999974 | 4.786798 |
d3ce4d98-376c-4541-99f3-07d749111470 | enigma19971/ossim | ossim/src/ossim/matrix/sort.cpp | //$$ sort.cpp Sorting
#define WANT_MATH
#include <ossim/matrix/include.h>
#include <ossim/matrix/newmatap.h>
#ifdef use_namespace
namespace NEWMAT {
#endif
#ifdef DO_REPORT
#define REPORT { static ExeCounter ExeCount(__LINE__,13); ++ExeCount; }
#else
#define REPORT {}
#endif
/**********... | ALGO | 0.999922 | 5.878793 |
f78ca0a6-7a8e-486d-8e72-cc6dfc84a5eb | VadimKutovoi/LabStack | TStack/TCalculator.cpp | #include "TCalculator.h"
void TCalculator::SetInf(string str)
{
inf = str;
}
string TCalculator::GetPost()
{
return post;
}
int TCalculator::StCheck()
{
StC.Clr();
for (int i = 0; i < inf.size(); i++)
{
if (inf[i] == '(') StC.Push('(');
if (inf[i] == ')')
{
if (StC.IsEmpty()) return 0;
StC.Pop();
... | ALGO | 0.998031 | 3.593296 |
83aac4f2-6670-4823-96ef-4881a7b77f5b | minh47857/CPlusPlus | DoiTuyenTinh/20-10-2022/numpalin.cpp | #include<bits/stdc++.h>
#define ll long long
#define pi pair<int , int>
#define fi first
#define se second
#define Bit(x , k) ((x >> k) & 1)
using namespace std;
const int N = 1e6 + 5 , MOD = 1e9 + 7 , inf = 1e9;
void file() {
freopen("numpalin.inp" , "r" , stdin);
freopen("numpalin.out" , "w" , stdout);
ios::sync... | ALGO | 0.999956 | 3.601962 |
e5befd6e-e1ad-4e31-923e-b35f35c79a89 | AliOsm/CompetitiveProgramming | CodeForces/979C. Kuro and Walking Route.cpp | #include <bits/stdc++.h>
using namespace std;
int const N = 3e5 + 1;
int n, x, y, p[N], cnt;
bool vis[N];
vector<int> path;
vector<vector<int> > g;
queue<int> q;
int BFS() {
q.push(x);
p[x] = x;
vis[x] = true;
while(!q.empty()) {
int fr = q.front();
q.pop();
for(int i = 0; i < g[fr].size(); ++i... | ALGO | 0.999931 | 4.021107 |
97f2d2fb-069b-405f-a001-f292106d4247 | Sukku4/SSAS | src/pid_control.cpp | #include "pid_control.h"
PIDController::PIDController(float kp, float ki, float kd) {
this->kp = kp;
this->ki = ki;
this->kd = kd;
this->previousError = 0;
this->integral = 0;
}
float PIDController::calculate(float error) {
integral += error;
float derivative = error - previousError;
f... | TOOL | 0.888444 | 4.985559 |
1f26e7de-175f-4023-ad9c-55072dfa2a21 | SharathHebbar/Programs | dsa/greedy/smallesNum.cpp | /*
The task is to find the smallest number with given sum of digits as S and number of digits as D.
Example 1:
Input:
S = 9
D = 2
Output:
18
Explanation:
18 is the smallest number
possible with sum = 9
and total digits = 2.
Example 2:
Input:
S = 20
D = 3
Output:
299
Explanation:
299 is the smallest number
possible... | ALGO | 0.999227 | 6.259081 |
0c2d7cd7-4d6e-460a-a77f-d2199b5e97f8 | xkelvinx666/Algorithm | uva_judge/151_Power_Crisis.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
int N, m, turnoff;
while (scanf("%d", &N) != EOF && N != 0) {
N--;
for (m = 1; m < N; m++) {
turnoff = 0;
for (int i = 1; i <= N; i++) turnoff = (turnoff + m) % i;
if ... | ALGO | 0.999799 | 3.501616 |
f49bb0a8-ae7a-49a6-9f92-0b6de7bebddb | Pratool/accelerated-cpp | ch03/distinct.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
string x;
vector<string> words;
cout << "Enter words separated by spaces (EOF to stop):\n";
while (cin >> x)
words.push_back(x);
cout << words.size() << endl;
int num_unique =... | ALGO | 0.997365 | 5.080157 |
73947cc5-7cd1-4a14-ae05-0f99540bce35 | uchihaada/DS-ALGORITHM | Queue/387. First Unique Character in a String.cpp |
// link:https://leetcode.com/problems/first-unique-character-in-a-string/description/
class Solution {
public:
int firstUniqChar(string s) {
map<char,int>mp;
queue<char>q;
for(int i=0;i<s.size();i++){
if( !mp[s[i]]){
mp[s[i]]=i+1;
q.push(s[i]);
... | ALGO | 0.999808 | 5.824334 |
cfd1a2db-f8c3-407b-9bc8-b946b63fac5b | Shayden-CPT/Achieverse1---- | 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 |
5f0bd541-c691-460d-a627-1e7c4bd5bcb8 | Rahul-Palahwat/LeetCode_Problems | 0222-count-complete-tree-nodes/0222-count-complete-tree-nodes.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.999985 | 6.477314 |
ad07ddaf-0bef-4722-bf9b-0d26dd3e50c8 | michimani/atcoder | abc/101-200/193/cpp/a.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double a, b;
cin >> a >> b;
cout << fixed << setprecision(3) << ((a - b) / a) * 100.00 << endl;
return 0;
} | ALGO | 0.995973 | 4.010422 |
d47d65d9-dd9f-487d-9ec8-6c5dfae26de4 | ishandutta2007/codeforces | aarr/normal/1077/B.cpp | #include <iostream>
using namespace std;
int a[103];
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i ++)
{
cin >> a[i];
}
int s = 0, k = 0, i = 0;
while(i < n)
{
if(a[i] == 0)
{
i ++;
k = 0;
}
else
{
if(i + 2 < n && a[i + 1] == 0 && a[i + 2] == 1)
{
i += 2;
k ++;
}
... | ALGO | 0.999993 | 3.734267 |
4614fc3f-239b-4133-bbe2-b87b1ce55830 | ishandutta2007/codeforces | pranjal.ssh/normal/920/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(int i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <int>... | ALGO | 0.999964 | 4.519332 |
5ce7cbf9-ca71-4423-afb8-14d575c3a5b8 | het875/CPP | Cout & Cin/Control_flow/Jum_statement_BREACK_COUNTINUE_GOTO/GoTo/simple_ex_1.cpp | #include<iostream>
using namespace std;
int main (){
int i = 0;
jump:
if (i <= 10) {
i++;
cout<<"\n"<< i;
goto jump;
}
}
/*
1
2
3
4
5
6
7
8
9
10
11
*/ | ALGO | 0.99868 | 3.084963 |
f5a1aa19-244d-4f65-9847-87169d6dae01 | Niloyb34/OOP-Object-oriented-programming- | Exercise 25 page.cpp | /*Create a function called sroot() that returns the square root of its argument. Overloadsroot() three ways: have it return the square
root of an integer, a long integer, and a double.To actually compute the square root, you can use the standard library function sqrt()*/
#include<bits/stdc++.h>
#include<iostream>
#incl... | TOOL | 0.907987 | 3.574687 |
db114071-47f5-4a61-b3fc-8e5fbcde0895 | 01anuraganand/DSA | Graphs/Rotten Orages.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
int rottenOrages(vector<vector<int>> &grid)
{
int n = grid.size();
int m = grid[0].size();
// {{row, col}, time}
queue<pair<pair<int, int>, int>> q;
vector<vector<int>> visited(n, vector<int>(m,0));
int countFresh = ... | ALGO | 0.99986 | 5.285285 |
7bdf8f5e-9037-4783-b406-33047d0697ee | FFFFFancy/High-Performance-Computing-Course | lab2/matrix_multiply.cpp | #include<stdlib.h>
#include "matrix_multiply.h"
double** matrix_multiply(double** matA, double** matB, int m, int n, int k)
{
double** ans = (double**)malloc(sizeof(double*)*m);
for(int i=0;i<m;i++){
ans[i]=(double*)malloc(sizeof(double)*k);
}
for(int i=0;i<m;i++){
for(int j=0;j<k;j++){
... | ALGO | 0.999631 | 4.040886 |
a0958fa2-c32f-4e12-9250-7a4bdea2d2ad | yanshiwei/leetcode-go | cpp/909_bfs_150.cpp | class Solution {
/*
题目:
一个N*N的棋盘,起点是左下角,一次可以走 1-6步
从左下角开始棋盘编号从下往上蛇形递增
7 8 9
6 5 4
1 2 3
如上图(其实不是图)所示:
起点是 1,终点是 9(N*N) (1-9为棋盘编号)
每格棋盘单元格内容一般是-1
如果棋盘单元格内容不是-1,而是一个数字,
则如果跳到这里,就要传送到指定数字编号的棋盘单元格中,横行传送称为蛇,纵向传送称为梯
如果该位置... | ALGO | 0.999919 | 6.342321 |
91eeb3c9-2629-4926-b931-5598d7631566 | oud3noida/BOJ | 13023/main.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int N, M;
vector<vector<int>> adj;
vector<bool> visited;
int find_five_friends(int cur, int depth) {
if (depth == 5) return 1;
visited[cur] = true;
int ret = 0;
for (int neighbor : adj[cur]) {
if (visited[neighbor])... | ALGO | 0.999308 | 5.074435 |
c70648fc-80cf-4ab3-bd52-bdea9e8da126 | Abhijit-wagh2/DS | Greedy/4.Minimum number of Coins.cpp | class Solution{
public:
vector<int> minPartition(int N)
{
// code here
vector<int> arr {2000,500,200,100,50,20,10,5,2,1};
vector<int> nums {1, 2, 5, 10, 20, 50, 100, 200, 500, 2000};
int index = 0;
for(int i=0;i<nums.size();i++) if(nums[i] == N) return {N};
... | ALGO | 0.99988 | 4.867729 |
6ce5d34c-0187-4baa-9a23-07632fffb8ca | selineminova/HW | Zadacha3.cpp | #include<iostream>
using namespace std;
int main()
{
int number,rem,counter=0;
cin>>number;
while(number!=0)
{
rem=number%10;
number=number/10;
counter++;
}
cout<<counter<<endl;
}
| ALGO | 0.999874 | 3.712207 |
118b424e-5d5c-4e9e-be6c-1c7683e80136 | sosamsony/Leetscode-solutions | 108-convert-sorted-array-to-binary-search-tree/108-convert-sorted-array-to-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.999994 | 6.893615 |
66861fdf-88b1-42d6-8984-5fd3a56ad7d3 | kpeel5839/LeetCode | 1255-maximum-score-words-formed-by-letters/1255-maximum-score-words-formed-by-letters.cpp | class Solution {
public:
vector<string>words;
map<char,int>sco;
map<char,int>cnt;
map<char,int>letterCnt;
int answer=0;
void good(int score){
for(auto v:cnt){
if(letterCnt[v.first]<v.second){
return;
}
}
answer=max(answer,score);
... | ALGO | 0.999955 | 5.53054 |
2752b397-36c0-474a-8e8f-49524c4e21d2 | hfinkel/llvm-project-csp | libcxx/test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp | // <numeric>
// UNSUPPORTED: c++98, c++03, c++11, c++14
// template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
// OutputIterator
// inclusive_scan(InputIterator first, InputIterator last,
// OutputIterator result,
// BinaryOperation binary_o... | TEST | 0.98337 | 7.08558 |
f1af0e71-2bb3-427d-9ea5-a99802e954f7 | mohsystem/llm-generated-code-c-cpp | source/output/gpt4o/cpp/Task193_OPENAI_gpt-4o.cpp | #include <iostream>
#include <vector>
bool xorGame(std::vector<int>& nums) {
int xorValue = 0;
for (int num : nums) {
xorValue ^= num;
}
return xorValue == 0 || nums.size() % 2 == 0;
}
| ALGO | 0.999903 | 5.795262 |
d56658e2-a639-40cb-83ae-666204be205c | LordTardquaad69/tardcoin | src/sync.cpp | #include "sync.h"
#include "util.h"
#include <boost/foreach.hpp>
#ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
{
printf("LOCKCONTENTION: %s\n", pszName);
printf("Locker: %s:%d\n", pszFile, nLine);
}
#endif /* DEBUG_LOCKCONTENTION */
#ifdef DEBUG_LOC... | TOOL | 0.97413 | 5.7469 |
d574999c-c840-4cd1-87f1-0eebd8e62597 | Chep-Code-lo/LUYEN_CODE | NHAP_MON_LAP_TRINH_UTE_OJ/Chuoi.cpp | #include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
string s, word, res = "", ans = "", result = "";
int main(){
getline(cin, s);
stringstream ss (s);
while(ss >> word){
if(word.size() > ans.size())
ans = word;
res += word + " ";
}
... | ALGO | 0.99994 | 3.197928 |
74830af4-7a40-4a34-846f-b7e5f04492c2 | URSec/Silhouette-Compiler-Legacy | tools/llvm-rc/ResourceScriptCppFilter.cpp | #include "ResourceScriptCppFilter.h"
#include "llvm/ADT/StringExtras.h"
#include <vector>
using namespace llvm;
namespace {
class Filter {
public:
explicit Filter(StringRef Input) : Data(Input), DataLength(Input.size()) {}
std::string run();
private:
// Parse the line, returning whether the line should be i... | TOOL | 0.917284 | 6.948372 |
3b3ec52d-449e-4dae-aa9a-a5aa7e400bb2 | RajAmbekar191094/Reproduced_UAF | Synthetic_bugs/PTHREAD_VERSION/Thread_creation_Patterns/Thread_in_loop/gpt.cpp | #include <iostream>
#include <thread>
#include <vector>
using namespace std;
std::vector<std::thread> threads; // Vector to hold threads
void runFunc1(int x)
{
cout << "Value of data received when pass by value: " << x << endl;
}
void runFunc2(int *x)
{
cout << "Value of data received when pass by reference:... | TOOL | 0.923726 | 5.35822 |
3f515f52-6c26-474e-adfe-9ed08733a1aa | alfior73/Programming1 | compoundInterest.cpp | // File Name: compoundInterest.cpp (named raymonda41.cpp for C programming class)
// Written by: Alfio Raymond ©2015 Alfio Raymond
// Description: write a compound interest program where interest grows over 30 years
// Challenges: making sure the formula is correct
// Time Spent: 45 minutes
// Given Input: (3 sets) ... | ALGO | 0.964055 | 3.738224 |
6700d08c-9567-4d91-af2d-b24665128f40 | Rakesh2908/Leetcode | 1738-maximal-network-rank/maximal-network-rank.cpp | class Solution {
public:
int maximalNetworkRank(int n, vector<vector<int>>& roads)
{
unordered_map<int,int>mp;
vector<vector<bool>> linked(n, vector<bool>(n, false));
for (auto it: roads)
{
mp[it[0]]++;
mp[it[1]]++;
linked[it[0]][it[1]] = t... | ALGO | 0.999931 | 5.898255 |
185eff2c-c2e1-4864-9480-1fc87104e30a | RRFreitas/Competitive-Programming | Geometry/implicit_sweep_line.cpp | struct node {
pair<ll,ll> val;
ll lazy;
node *esq, *dir;
node(ll l, ll r) {
val = {0,r-l+1};
lazy = 0;
esq = dir = NULL;
}
};
pair<ll,ll> merge(pair<ll,ll> q1, pair<ll,ll> q2) {
if(q1.F == q2.F) return MP(q1.F, q1.S + q2.S);
else return min(q1, q2);
}
void doLazy(no... | ALGO | 0.99986 | 4.263649 |
8bf7b5fa-5968-456c-b687-7ab632667724 | MichaelEBurton/PPP_Cpp | Chapter5/Exercises/exercise13.cpp | // This is not working properly as of 5/24/20
// Not sure how to prevent repeating numbers
#include "../../../std_lib_facilities.h"
bool is_bull(vector<int> bc, int x, int index){
if(bc[index] == x) return true;
return false;
}
bool is_cow(vector<int> bc, int x, int index){
for(int i = 0; i < bc.size(); ++... | ALGO | 0.987574 | 5.072904 |
6257ef86-96cb-49ff-ba15-d78931f1f9f6 | Vipin-Kamaraju/LearnCpp | src/CodilityLessons/03_TimeComplexity/02_TapeEquilibrium.cpp |
/*
Codility Tasks:
A non-empty array A consisting of N integers is given. Array A represents numbers on a tape.
Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P - 1] and A[P], A[P + 1], ..., A[N - 1].
The difference between the two parts is the value of: |(A[0] + A... | ALGO | 0.999942 | 6.16515 |
c60fa410-e889-4806-8694-95f20432aac1 | Jovwu/dsacpp | median1/main.cpp | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include "_share/util.h"
#include "UniPrint/print.h"
#include "vector/vector.h"
#include "random/randomSortedVector.h"
#include "trivialMedian.h"
#include "median.h"
/*******************************************************************************... | TEST | 0.998351 | 5.274266 |
ad726f4f-b9d8-4de6-88fa-d9773f4e81fb | 0000King/CPP | pattern16.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter number of rows" << endl;
cin >> n;
int i, j;
for(i = n; i >= 1; i--)
{
for(j = 1; j <= i; j++)
cout << (char)('A' + j - 1);
cout << endl;
}
return 0;
} | ALGO | 0.995946 | 3.638184 |
eaf05375-7b56-4ddf-af04-75f3c1f8aa98 | Airwaves1/AirwaveEngine | engine/third_party/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>
#ifdef NDEBUG
#define LE 1 // 1 for little-endian, 0 for big-endian.
static int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x ... | ALGO | 0.99846 | 3.319975 |
83736482-90e7-4476-b25c-ae7af89b12d6 | Habiba-Moataz/codeforcesProblemSolving | using c ++ /1807A - Plus or Minus.cpp | #include<iostream>
using namespace std;
int main()
{
int t,a,b,c,mins,pls;
cin>>t;
while(t--){
cin>>a>>b>>c;
mins=a-b;
pls=a+b;
if(mins==c)
cout<<"-"<<endl;
else
cout<<"+"<<endl;
}
return 0;
}
| ALGO | 0.999874 | 3.848974 |
c30d8d07-0dae-4c53-9a2a-d0d0c17c21d6 | bozoslav/CSES-Solutions | Introductory Problems/Tower of Hanoi.cpp | #include <bits/stdc++.h>
using namespace std;
void f(int i, int j, int k)
{
if (k == 0)
{
cout << i << ' ' << j << '\n';
return;
}
int nx = 6 - i - j;
f(i, nx, k -= 1);
cout << i << ' ' << j << '\n';
f(nx, j, k);
return;
}
int main()
{
int n;
cin >> n;
co... | ALGO | 0.999906 | 3.841602 |
a0e97d37-a09f-4368-946c-f749a6104721 | madamskip1/LeetCode_solutions | 682 - Baseball Game/iterative.cpp | class Solution {
public:
int calPoints(vector<string>& operations) {
auto records = std::vector<int>{};
for (const auto& operation : operations)
{
if (operation[0] == '+')
{
records.push_back(records[records.size() - 1] + records[records.size() - 2]);... | ALGO | 0.999809 | 6.993879 |
a9281b5f-a886-414a-8a4b-2495bcf13265 | dat20026969/programming-technique | Week 01/Bai03/Ham3.cpp | #include <iostream>
#include <iomanip>
#include "Ham3.h"
using namespace std;
int main() {
int n;
cin >> n;
cout << Fibo(n) << endl;
return 0;
} | ALGO | 0.999989 | 4.156575 |
2ce2886f-294a-4237-8b91-3741af1b09f9 | raincross7/code-similarity | codes/train_code/problem338/problem338_260.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int I... | ALGO | 0.999965 | 4.23083 |
6c037c61-5162-4bef-8ebc-758774771f15 | tarekrahamn/Codeforces-Problem-solve | Codeforces Round 887 (Div. 2)/A_Desorting.cpp | /*
Starting with the name of almighty ALLAH
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**
In the name of Allah, Most Gracious, Most Merciful
লা ইলাহা ইল্লাল্লাহু মুহাম্মাদুর রাসুলুল্লাহ
Author: Tarek R... | ALGO | 0.999927 | 4.224627 |
8797c2d1-0e4d-4da8-a7fe-4a365c0ec7aa | realingy/opencv_examples_cpp | src/CH9/2_Histogram2/Histogram2.cpp | // һάֱͼĻ
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include "path.h"
using namespace cv;
using namespace std;
int main()
{
Mat srcImage = imread(MediaPath+"CH9/Histogram2.jpg", 0);
imshow("ԭͼ",srcImage);
if(!srcImage.data) {cout << "fail to load image" << endl; return 0;}
... | TOOL | 0.8814 | 3.334765 |
379a96a5-cf85-4539-92b5-7b39efdff866 | Karaokruk/sia_td5 | ext/nanogui/ext/eigen/bench/eig33.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Matrix, typename Roots>
inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
con... | ALGO | 0.999739 | 5.583963 |
5a2be6df-c2a9-45fe-bace-53f62b2adf03 | ishandutta2007/codeforces | sfiction/normal/102/A.cpp | /*
ID: Sfiction
OJ: CF
PROB: 101A
*/
#include <cstdio>
const int MAXN=100+10;
const int INF=1<<30;
char map[MAXN][MAXN];
int price[MAXN];
int n,m;
void Init(){
int i,u,v;
scanf("%d%d",&n,&m);
for (i=1;i<=n;++i)
scanf("%d",&price[i]);
for (i=1;i<=m;++i){
scanf("%d%d",&u,&v);
map... | ALGO | 0.999875 | 3.897398 |
2f1a90a2-cd00-49c5-989c-da7ac4a66258 | apslodhi23/DailyLeetcode | 173-binary-search-tree-iterator/173-binary-search-tree-iterator.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.999967 | 6.311513 |
e5759630-f932-4ea3-8bc3-c28dd8f10d84 | beckylum0216/MLPNN_Test | Convolution.cpp | //
// Created by becky on 16/01/2019.
//
#include "Convolution.h"
Convolution::Convolution(ImageHeader imgHdr)
{
gaussConvolution = new GLdouble * [imgHdr.imgWidth]();
maxPool = new GLdouble * [imgHdr.imgWidth]();
for (int ii = 0; ii < imgHdr.imgHeight; ii +=1)
{
gaussConvolution[ii] = new GL... | ALGO | 0.926814 | 4.26166 |
344d1559-fedd-473e-bb72-8ef059172319 | itlezy/eMule-mods-archive | eMule-0.50a-Xtreme-8.1-src/cryptopp/twofish.cpp | // twofish.cpp - modified by Wei Dai from Matthew Skala's twofish.c
// The original code and all modifications are in the public domain.
#include "pch.h"
#include "twofish.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
// compute (c * x^4) mod (x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1)
// over GF(256)
sta... | ALGO | 0.999723 | 6.902135 |
c62020d1-c10d-4db2-9414-bfb859b5ffb4 | Sowmik23/CompetitiveProgramming | CP-Algorithms/Algebra/3_Number-theoretic functions/1_uva_13132 - Laser Mirrors.cpp | #include <bits/stdc++.h>
using namespace std;
/// interesting problem
void solve(int n){
int res = n;
for(int i=2;i*i<=n;i++){
if(n%i==0){
while(n%i==0) {
n/=i;
}
res -= res/i;
}
}
if(n>1) res -= res/n;
cout<<res<<endl;
}
int main(){
int t, n;
cin>>t;
while(t--){
cin>>n;
solve(n... | ALGO | 0.999896 | 5.444591 |
2f1b5116-9898-42bf-b9cf-d581e20a7567 | Decatf/platform_frameworks_av | media/libstagefright/codecs/amrnb/dec/src/lsp_avg.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/lsp_avg.c
Functions:
Date: 04/14/2000
------------------------------------------------------------------------------
REVISION HISTORY
Description: Removed the functions lsp_avg_init and lsp_avg... | ALGO | 0.974533 | 6.647949 |
82002ba9-4831-476e-9c5e-0b99edb2328d | KortylaAdrianAGH/AGH_MITP | to unpa/zad18.cpp | #include <iostream>
#include <cstring>
#include "sort.h"
#include "date.h"
using namespace std;
void printUsecase() {
cout << "usage: zad16 -n name";
cout << endl << endl;
cout << "name: " << endl;
cout << "bubble - for bubble sort" << endl;
cout << "selection - for selection sort" << endl;
}
i... | ALGO | 0.995489 | 4.454564 |
16a6ffc7-cb3b-47f8-a8f7-2144a07ed6ca | Mohit2352002/LeetCode_Solved | 0046-permutations/0046-permutations.cpp | static auto _ = [](){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
class Solution {
void helper(vector<int>&nums, int i, int &n,vector<vector<int>>&ans){
if(i==n){
ans.push_back(nums);
return;
}
helper(nums,i+1... | ALGO | 0.999999 | 6.293977 |
68edbb60-9e9a-4fec-ab27-ac9ed680161b | Kshitij722/Dsa-journey | comparisonstring.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
int count=1;
int flag=1;
for(int i=0;i<n;i++){
count = max(count,flag);
if(s[i]!=s[i+1]){
fla... | ALGO | 0.999972 | 3.705708 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.