uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9bde4fa7-d103-4e8a-81b8-58040e6ddfe2 | king-yyf/cpcode | google/codejam/round1a_2022/2.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define sor(x) sort(all(x))
#define f0(e) for(int i=0;i<(e);++i)
#define f1(e) for(int i=1;i<=(e);++i)
#define f2(i,e) for(int i=0;i<(e);++i)
#define f3(i,e) for(i... | ALGO | 0.99975 | 3.434218 |
ff6c74d0-0ed1-4d5b-8228-09428e362061 | Mahbub20/Codeforces-Coding-Solutions | A. Dice Rolling.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int dice[6] = {2,3,4,5,6,7};
int i,t,x,tmp,res;
cin >> t;
while(t--)
{
cin >> x;
tmp = x;
res = 0;
for(i = 0;i<6;i++)
{
if(tmp%dice[i]!=1)
{
res += tmp/dice[i];
cout << "res: " << res << endl;
... | ALGO | 0.999471 | 3.162588 |
7f90cadf-a91d-4dec-b943-89471966e2b6 | molecule03/Leetcode-Solutions | 538-convert-bst-to-greater-tree/538-convert-bst-to-greater-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.999884 | 6.185621 |
33abd617-a107-4b55-8712-08b8e574c8e5 | DLR-RM/SID-SLAM | classes/Tracker/Tracker.cpp | //
// Created by font_al on 1/31/20.
//
#include "../../include/Tracker/Tracker.h"
#include "../../utils/informationFunctions.h"
void IDNav::Tracker::trackFrame(typeFrame& trackedFrame_, unordered_map<size_t,typeFrame>& keyframes_, typeFrame& refKeyframe_,
const Pose& pose0_ , const vec6& ... | ALGO | 0.983599 | 5.828656 |
69d09b5a-4528-4565-b8d6-8fdf17e04217 | its-kumar-yash/Operating-System-Practicals | Exp_4/CriticalSection.cpp | // The program defines two functions process1 and process2, which are two threads that will execute concurrently. Each thread contains a for loop that executes the critical section of code. In this case, the critical section is simply a print statement that displays a message on the console.
// The main function promp... | ALGO | 0.999967 | 6.098305 |
102a4bb1-d5f3-4c3b-b434-40daf7feca6e | Atanu0341/0-to-dsa | patterns-III/upper-lower-pyramid-star-pattern/solution.cpp | #include<iostream>
using namespace std;
int main() {
int num;
cout<<"Enter the number of rows for the pattern: ";
cin>>num;
for(int row = 1; row<=num; row++){
// space print
for(int cols = 1; cols<=num-row; cols++){
cout<<" ";
}
// star print
fo... | ALGO | 0.999782 | 4.924809 |
50aae524-b5e9-477a-bfcf-53e61c428a67 | Oudarja/C-plus-plus | using class finding area of 1 circle with an member func that can change value of input.cpp | #include<iostream>
#include<cctype>
using namespace std;
class circle
{
public:
double radius;
void set_radi(void)
{
cout<<"Give new input\n";
double r;
cin>>r;
radius=r;
}
void show(void)
{
cout<<3.1416*radius*radius;
}
};
int main()
{
char ch... | ALGO | 0.984093 | 3.303158 |
1b8475d1-b8b7-497a-827c-2d0b146032b8 | lzhou835/leetcode | 201.Bitwise_AND_of_Numbers_Range.cpp | class Solution {
public:
int rangeBitwiseAnd(int m, int n) {
int mask=INT_MAX;
while((m&mask) != (n&mask)){
mask=mask<<1;
}
return m&mask;
}
};
| ALGO | 0.999951 | 5.961039 |
90da1e41-e1c1-41d5-a8de-205136bf0c31 | Aqiu16717/leetcode | 714.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int maxProfit(vector<int>& prices, int fee) {
int n = prices.size();
if (n < 2) {
return 0;
}
vector<vector<int>> dp(n, vector<int>(2));
dp[0][0] = 0;
dp[0][1] = -prices... | ALGO | 0.999859 | 6.030877 |
5fc29c63-4e19-4ea4-b9bc-7c1c1ae47930 | junes7/CPPalgorithm | KOISTUDY/0097.cpp | // ์คํ๊ณผ์ ๋ฝ๊ธฐ
// choose sugar snacks
// ๋ถ๋ชจ๋๊ณผ ํจ๊ป ์ ์์ง์ ๋๋ฌ๊ฐ ์์ผ์ด๋ ์คํ๊ณผ์(์คํ์ ๋
น์ฌ ๋ฌผ๊ณ ๊ธฐ ๋ฑ์
// ๋ชจ์์ ๋ง๋ ๊ฒ)๋ฝ๊ธฐ๋ฅผ ๋ณด๊ฒ ๋์๋ค. ๊ธธ์ด๊ฐ ๋ค๋ฅธ ๋ช ๊ฐ์ ๋ง๋๋ฅผ ๋ฐ๋ํ๊ณผ
// ๊ฐ์ ๊ฒฉ์ํ์ ๋๋๋ฐ, ๋ง๋์ ์๋ ์คํ๊ณผ์ ์ด๋ฆ ์๋์ ์๋ ๋ฒํธ๋ฅผ
// ๋ฝ์ผ๋ฉด ์คํ๊ณผ์๋ฅผ ๊ฐ์ ธ๊ฐ๋ ๊ฒ์์ด์๋ค.(์์ด, ๋ถ์ด, ์ฉ ๋ฑ ์ฌ๋ฌ ๊ฐ์ง๊ฐ
// ์ ํ์๋ค.)
// ๊ฒฉ์ํ์ ์ธ๋ก(h), ๊ฐ๋ก(w), ๋ง๋์ ๊ฐ์(n), ๊ฐ ๋ง๋์ ๊ธธ์ด(l), ๋ง๋๋ฅผ
// ๋๋ ๋ฐฉํฅ(d:๊ฐ๋ก๋ 0, ์ธ๋ก๋ 1)๊ณผ ๋ง๋๋ฅผ ๋๋ ๋ง๋์ ๊ฐ์ฅ ์ผ์ชฝ ๋๋
// ์์ชฝ... | ALGO | 0.999296 | 3.67013 |
dd0fdd55-a689-49a1-aded-88902c14bb33 | ambushidozho/technopark_dz_algorithms | deque_with_cycled_buffer/main.cpp | #include <iostream>
template<typename T>
class Deque
{
public:
Deque()
{
buff = nullptr;
head = 0;
tail = 0;
size_ = 0;
capacity = 0;
}
~Deque()
{
if (buff)
{
delete[] buff;
}
}
void push_back(T value)
{
if (capacity == 0)
{
create_buf();
}
if (size_ + 1 == capacity)
{
realloc... | ALGO | 0.999964 | 4.272335 |
d4a8112d-9b6c-433f-8ef6-73d5ba2212c5 | nguyendo24/introduction_cpp_tselikis | Chapter_13/13_08.cpp | #include <iostream> // 13.8
using namespace std;
struct Complex
{
double re; // .
double im; // .
};
Complex operation(Complex a1, Complex a2, char sign);
int main()
{
char sign;
Complex z1, z2, z;
cout << "Enter real and imaginary part of the first complex number: ";
cin >> z1.re >> z1.im;
co... | ALGO | 0.967961 | 4.670408 |
bae3232c-fd93-42da-abb2-e73b360f8fae | dohoon0122/LeetCode | 3194-find-words-containing-character/3194-find-words-containing-character.cpp | class Solution {
public:
vector<int> findWordsContaining(vector<string>& words, char x) {
vector<int> ans;
for(int i=0; i<words.size(); i++)
{
for(auto& c: words[i])
{
if(c==x)
{
ans.push_back(i);
... | ALGO | 0.99981 | 5.896925 |
6d3517e2-90be-4a35-b6c3-868dc6f695f1 | a7mddra/CompetitiveProgramming | Codeforces/Round 174 (Div. 2)/B.cpp | /**********************************************
https://codeforces.com/contest/2069/problem/B
***********************************************/
#include "bits/stdc++.h"
#define ll long long
using namespace std;
void solve() {
ll n, m;
cin >> n >> m;
vector<vector<ll>> grid(n, vector<ll>(m));
for (ll i ... | ALGO | 0.999938 | 5.784016 |
575f705b-f78a-4ea5-b24e-1258605b4b6e | thalyson004/solutions | leetcode/1275_FindWinnerAnATicTacToeGame.cpp | class Solution {
public:
bool check(vector<vector<char>> &grid, char op){
for(int i = 0; i < 3; i++){
int flag = 1;
for(int j = 0; flag and j < 3; j++){
flag = flag and (grid[i][j]==op);
}
if(flag) return true;
}
f... | ALGO | 0.999927 | 6.432729 |
fd4f9e99-459c-46e0-ae41-e02c3ec94aa0 | rabeeadelbeabesh/Competitive-programming | geeksforgeeks/geeksforgeeks complement3911.cpp | class Solution{
public:
vector<int> findRange(string str, int n) {
int D[n+9];
D[0] = 0;
int c = 0;
for (int i = 1; i <= n; ++i){
(str[i - 1] == '1') ? c = -1 : c = 1;
D[i] = max(c + D[i - 1], c);
}
int dx = 1, mx = -1;
for (int i = 1; i <= n; ++i)
if (D[i] > mx){
mx = D[i]; dx = i;
}
if (mx<0) ret... | ALGO | 0.99995 | 5.558592 |
94b8b14c-eb8d-450b-8e45-e016567693dd | blockspacer/bootstrap-redux | ext/boost-1.70.0/libs/compute/perf/perf_stl_prev_permutation.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | ALGO | 0.994811 | 5.424448 |
935d4ae7-8199-4f54-b264-8e13e19655b2 | tmuttaqueen/MyCodes | Online Judge Code/codeforces/IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2)/653D.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;
const double pi = 3.141592653589793;
#define xx first
#define yy second
#define mp make_pair
#define intl long long
#define ... | ALGO | 0.999911 | 4.720178 |
36aa2343-190a-498f-a373-1c42894032c8 | cou929/topcoder | PlanarGraphShop.cpp | // BEGIN CUT HERE
// END CUT HERE
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
using namespace std;
class PlanarGr... | ALGO | 0.999775 | 4.898023 |
36267268-364e-4491-a6c3-f84eea452a08 | dilip43/DSA--CODE | 10. Binary_Tree/13-Zig-Zag_tree.cpp | #include<bits/stdc++.h>
#include"BinaryTreeNode.h"
using namespace std;
BinaryTreeNode<int>* takeInputLevelWise() {
cout << "Enter root data" << endl;
int rootData; cin >> rootData;
if (rootData == -1) {
return NULL;
}
BinaryTreeNode<int>*root = new BinaryTreeNode<int>(rootData);
queue<BinaryTreeNode<int>*> p... | ALGO | 0.999841 | 4.655438 |
d8e64e6f-78b6-441d-9cab-28eeb23e347c | Dipto-shaha/LeetCode-Daily-Challenge | 0143-reorder-list/0143-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:
ListNode* lastNode(Li... | ALGO | 0.999969 | 5.969511 |
188e6ff8-ec39-455c-a966-163490c170cc | joncampbell123/openwatcom-hackipedia | bld/plustest/regress/stl.94/examples/parsrtc1.cpp | // This example compiles using the new STL<ToolKit> from ObjectSpace, Inc.
// STL<ToolKit> is the EASIEST to use STL that works on most platform/compiler
// combinations, including cfront, Borland, Visual C++, C Set++, ObjectCenter,
// and the latest Sun & HP compilers. Read the README.STL file in this
// directory ... | ALGO | 0.999384 | 4.021398 |
0e7ba8ec-4e3f-4b64-b993-e77912138695 | Regis-1/cpp-aoc-2021 | day3/day3.cpp | #include <fstream>
#include <unordered_map>
#include <sstream>
#include "day3.hpp"
const DiagData extractInputData(const std::string filePath) {
std::ifstream fd(filePath);
if (!fd)
throw std::system_error(std::error_code(), "Invalid file or file path.");
DiagData result;
std::string line;
... | ALGO | 0.997943 | 5.868659 |
59b01094-cc2a-4484-9f98-1f235b73ea98 | suryansh639/STRIVER_SDE_SHEET_CHALLENGE_2023 | Day-25 Dynamic programming/LCS.cpp | #include<bits/stdc++.h>
using namespace std;
int lcs(int i, int j , string s1 , string s2,vector<vector<int>> &dp){
if(i>=s1.size() || j>=s2.size()){
return 0;
}
if(dp[i][j]!=-1){
return dp[i][j];
}
if(s1[i]==s2[j]){
return 1+lcs(i+1,j+1,s1,s2,dp);
}
else{
int left = lcs(i+1,j,s1,s2,dp);
... | ALGO | 0.999996 | 4.828465 |
8db1aec2-c45a-4667-81b7-f3ebc240e2f3 | nthu-pllab/llvm9-project-rvp | libcxx/test/std/algorithms/alg.nonmodifying/alg.find.first.of/find_first_of_pred.pass.cpp | // <algorithm>
// template<InputIterator Iter1, ForwardIterator Iter2,
// Predicate<auto, Iter1::value_type, Iter2::value_type> Pred>
// requires CopyConstructible<Pred>
// constexpr Iter1 // constexpr after C++17
// find_first_of(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Pred pred);
#incl... | TEST | 0.990009 | 6.48284 |
587af23f-c7b1-4798-a01a-f25052b7fbc8 | sampritipanda/IOI_Repository | Codechef/CONI2015/CN01.cpp | // Dollar Game
#include <stdio.h>
#include <math.h>
#include <string.h>
int main() {
long long X; scanf("%lld", &X);
char seq[1010]; scanf(" %s", seq);
int len = strlen(seq);
for(int i = 0; i < len; i++){
if(seq[i] == 'W') X = X*2 + 11;
else {
if(X % 2 == 0) X /= 2;
else X = X/2 + 1;
... | ALGO | 0.999919 | 3.607003 |
84056130-fe6e-4faa-9049-ff854d18a9d2 | nvnamsss/leetcode | assesments/0623/q1.cpp | /*
A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatenation.
For example, "", "()", "(())()", and "(()(()))" are all valid parentheses strings.
A valid parentheses string s is primitive if it is nonempty, and there does n... | ALGO | 0.999628 | 6.281183 |
35495871-ec02-4b60-b23d-73640d3454fc | alexandraback/datacollection | solutions_5751500831719424_0/C++/Grandrogue/main.cpp | #include <cstdlib>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
ifstream fin("A-small-attempt0.in");
ofstream fout("out.txt");
string s[100];
string exam,ex2;
int sums[100];
int abs(int a) {
if (a<0) return 0-a;
return a;
}
int main() {
int... | ALGO | 0.998909 | 3.993915 |
b6ce3e45-9ec9-49ab-ba3d-71a56741f9fb | fxwl/Yuzu-vanced | src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_set_predicate.cpp | #include "common/bit_field.h"
#include "common/common_types.h"
#include "shader_recompiler/frontend/maxwell/translate/impl/common_funcs.h"
#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
namespace Shader::Maxwell {
namespace {
void FSETP(TranslatorVisitor& v, u64 insn, const IR::F32& src_b) {
u... | ALGO | 0.911695 | 7.344147 |
15fd5306-6285-428b-b8ba-f67cc5037a25 | Lesords/LanQiao | ๅฎๆน็ปไน ็ณป็ป/็ฎๆณ่ฎญ็ป/็ฎๆณ่ฎญ็ป P1101.cpp | #include<iostream>//ac
#include<cstdio>
#include<string>
using namespace std;
int main() {
int n;
double ans = 0,money,num;
string name;
cin>>n;
while(n--) {//nameึปสฝรปสต
cin>>name>>money>>num;
ans += money*num;
}
printf("%.6f",ans);//6ฮปะก
return 0;
}
| ALGO | 0.971868 | 3.153535 |
b8a9dc56-c225-45e0-91b6-f5d971ddd837 | anjali726/coding-questions | task2(d31).cpp | //task2 day31
//Problem Link :
class NumArray {
public:
vector<int> temp;
int n;
NumArray(vector<int>& nums) {
n=nums.size();
for(int i=0;i<nums.size();i++){
temp.push_back(nums[i]);
}
for(int i=1;i<n;i++){
temp[i]=temp[i]+temp[i-1];
}
}
... | ALGO | 0.999829 | 6.141129 |
ca5dbf9d-1607-4ae9-b68a-b082a8fe9059 | K1XE/LeetCode | 10.ๅพ่ฎบ/15.ๅนถๆฅ้็่ฎบๅบ็ก/128.ๆ้ฟ่ฟ็ปญๅบๅ.cpp | /*
* @lc app=leetcode.cn id=128 lang=cpp
*
* [128] ๆ้ฟ่ฟ็ปญๅบๅ
*/
// @lc code=start
#pragma once
#include <bits/stdc++.h>
#include <ranges>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#define ALL(v) v.begin(), v.end()
#define For(i, _) for (int i = 0, i##end = _; i < i##end; ++i)
... | ALGO | 0.999956 | 5.773606 |
7e9d0ff7-3f2c-4726-a2b4-2791c30a3b95 | itzmk06/Conquer | DSA/Stacks/Questions/ReversingString.cpp | #include<iostream>
#include<stack>
using namespace std;
stack<char>st;
int main(){
string s="Manoj";
for(int i=0;i<s.length();i++){
st.push(s[i]);
}
for(int i=0;i<s.length();i++){
cout<<st.top()<<" ";
st.pop();
}
return 0;
}
| ALGO | 0.999396 | 3.766237 |
40c4cb8f-f8bb-4711-9da8-ea02d1f34a42 | DeeptangshuSaha/Sharingan | source code/dlib-19.24/dlib/test/ranking.cpp | #include "tester.h"
namespace
{
using namespace test;
using namespace dlib;
using namespace std;
logger dlog("test.ranking");
// ----------------------------------------------------------------------------------------
template <typename T>
void brute_force_count_ranking_inversions (
... | TEST | 0.893595 | 6.982072 |
69025734-27ea-497f-8a85-2e7352c64337 | mittalswastik/ttex_implementation | llvm/lib/Support/IntEqClasses.cpp | #include "llvm/ADT/IntEqClasses.h"
#include <cassert>
using namespace llvm;
void IntEqClasses::grow(unsigned N) {
assert(NumClasses == 0 && "grow() called after compress().");
EC.reserve(N);
while (EC.size() < N)
EC.push_back(EC.size());
}
unsigned IntEqClasses::join(unsigned a, unsigned b) {
assert(NumC... | ALGO | 0.974884 | 6.404566 |
98e60cdc-9143-49db-a878-519cdad36974 | lnangong/fusionfs-cache | src/zht/examples/benchmark_client.cpp | //#include <kchashdb.h>
//#include <kcprotodb.h>
#include <string>
#include <cstring>
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
//#include "d3_transport.h"
//#include "meta.pb.h"
#include <signal.h>
#include <sys/time.h>
#include <stdlib.h>
#include <stdio.h>
#include <list>
#inclu... | TOOL | 0.907164 | 3.96736 |
a47b6c48-7f07-4805-8a7a-e71aa3d61a85 | followmsi/platform_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_crc.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_crc.cpp
Functions:
getbits_crc
calculate_crc
Date: 09/21/2007
------------------------------------------------------------------------------
REVI... | TOOL | 0.999292 | 6.677954 |
0246f881-573d-4408-943f-2c047309d8de | kunal-j10/My-DSA | 10. Dynamic Programming/Edit Distance.cpp | class Solution {
public:
int editDistance(string s, string t) {
int n=s.length();
int m=t.length();
int dp[n+1][m+1];
for(int i=0;i<=n;i++)
dp[i][0]=i;
for(int j=0;j<=m;j++)
dp[0][j]=j;
for(int i=1;i<=n;i++)
{
for(int j=1;... | ALGO | 0.999985 | 5.931074 |
5cd78c0b-23d3-47ce-96fb-a843a243f897 | janParamo/LogicaAlgoritmoG4 | EstructurasSelectivas23/ejercicio4.cpp | /* El director de una escuela, estรก organizando un viaje de estudios, y requiere determinar, cuรกnto debe cobrar a cada alumno, y cuรกnto debe pagar a la compaรฑรญa de
viajes por el servicio. La forma de cobrar es la siguiente: si son 100 alumnos o mรกs, el
costo por cada alumno es de $60.00; de 50 a 99 alumnos, el costo e... | TOOL | 0.892073 | 5.207113 |
2c6bc87f-ac0a-4970-b7a9-bf55a080737a | zhangchunbao515/leetcode | leetcode-02/684. Redundant Connection/s1.cpp | // OJ: https://leetcode.com/problems/redundant-connection/
// Author: github.com/lzl124631x
// Time: O(N)
// Space: O(N)
class UnionFind {
private:
vector<int> id, rank;
int cnt;
public:
UnionFind(int cnt) : cnt(cnt) {
id = vector<int>(cnt);
rank = vector<int>(cnt, 0);
for (int i = 0; i < cnt; ++i) id... | ALGO | 0.999883 | 5.869126 |
e4bd70f7-f294-419c-8341-6d223445bebc | vasu-ramanujam/naturalized_spr | story_parser.cpp | //story_parser.cpp
//task: take in regular stories. split it by some criteria. add paragraph tags.
//great idea. task for later. i could technically do this by hand.
#include <getopt.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
//#include "xcode_redirect.hpp"
#include <cstdint>
#... | TOOL | 0.881417 | 4.272262 |
6a42fb17-7b2b-4cbf-93ed-d4fc0f8c340f | johnHaloWang/cs003A | nodelistfunctions.cpp | #include "nodelistfunctions.h"
/*
Create a simple program where you create, display,
search, delete elements within a linked list.
Watch your function arguments. Pointer parameters are passed by
reference to some functions and by value to others.
*/
/* Prints the items in list. Uses setw( ) to space the items on the ... | ALGO | 0.999881 | 3.931901 |
fc03b08b-8dd6-4d77-9771-d369912f2974 | phrock/acm | codeforces/9a/1.cpp | #include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstr... | ALGO | 0.998468 | 3.97183 |
dfcb6536-001b-44e1-a20a-d82a4555d4f8 | 0xC0000054/sc4-more-building-styles | src/StringViewUtil.cpp | #include "StringViewUtil.h"
#include "boost/algorithm/string.hpp"
#include <charconv>
bool StringViewUtil::EqualsIgnoreCase(const std::string_view& lhs, const std::string_view& rhs)
{
return lhs.length() == rhs.length()
&& boost::iequals(lhs, rhs);
}
bool StringViewUtil::StartsWithIgnoreCase(const std::string_view... | TOOL | 0.931495 | 7.154939 |
6e7b1180-c592-41d9-80b3-23aa155548a8 | adityaa30/programs | Trees/CompleteBinaryTree.cpp | #include <bits/stdc++.h>
#define li long long int
using namespace std;
struct Node {
li data;
Node *left, *right;
Node(li data) {
this->data = data;
left = NULL;
right = NULL;
}
};
li CountNodes(Node *node) {
if(node == NULL) return 0;
else return 1 + CountNodes(node->... | ALGO | 0.999509 | 5.140788 |
8c259b85-53e0-44d5-93f6-4a195181968a | thisisrv/CodingNinjas | Stack/Assignment/reverseQueue.cpp | void reverseQueue(queue<int> &input) {
//Base case
if(input.size() == 1 || input.size() == 0)
return ;
//Rec call
int first_element = input.front();
input.pop();
reverseQueue(input);
//Small calc
input.push(first_element);
} | ALGO | 0.999864 | 4.875095 |
eb53595f-4a39-4c73-a355-d1ebb5f023c2 | hossamhassan16/plantify | 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.998756 | 6.772262 |
5129d243-6475-4140-9d38-b2c627fa1cd4 | roeas/GAMES101-Premake | Frame/Source/ThirdParty/opencv/samples/cpp/3calibration.cpp | /*
* 3calibration.cpp -- Calibrate 3 cameras in a horizontal line together.
*/
#include "opencv2/calib3d.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/utility.hpp"
#include <stdio.h>
#include <string.h>
#include <time.h>
using namespace c... | TOOL | 0.99766 | 5.627276 |
2484ef36-cae2-475c-8145-11f2340e7204 | ROS-CCPP-Research/Comple-Coverage-Path-Planning | full_coverage_path_planner/src/full_coverage_path_planner.cpp | #include <list>
#include <vector>
#include "full_coverage_path_planner/full_coverage_path_planner.h"
/* *** Note the coordinate system ***
* grid[][] is a 2D-vector:
* where ix is column-index and x-coordinate in map,
* iy is row-index and y-coordinate in map.
*
* Cols [ix]
* ____________... | ALGO | 0.965134 | 6.364575 |
60baf700-c71c-4b32-bfbf-2312cfa753f7 | avidLearnerInProgress/leetcode-solutions | 30-days-of-code-may/08.checkPointsOnLine.cpp | class Solution {
public:
bool checkStraightLine(vector<vector<int>>& coordinates) {
if(coordinates.size() <= 2) return true;
int x1 = coordinates[0][0];
int y1 = coordinates[0][1];
int x2 = coordinates[1][0];
int y2 = coordinates[1][1];
for(int i=2;i<coordina... | ALGO | 0.999942 | 5.597129 |
ee742223-9cbe-4b0f-a9e7-04741d4c545f | rusticmystic/demo_sources | design_patterns/structural/Decorator.cpp | /** from sourcemaking.com
* Attach additional responsibilities to an object dynamically.
* Decorators provide a flexible alternative to subclassing for extending functionality.
*
* You want to add behavior or state to individual objects at run-time.
* Inheritance is not feasible because it is static and applie... | TOOL | 0.886192 | 5.880739 |
b007da62-862c-4a0b-b56d-c20f983f21b4 | CodeTrans-Research/RefuTra | result/translate/starchat/java2cpp/c++/FINDING_POWER_PRIME_NUMBER_P_N_1.cpp | int f_gold ( int n, int p ) {
int ans = 0;
int temp = p;
while ( temp <= n ) {
ans += n / temp;
temp *= p;
}
return ans;
} | ALGO | 0.999931 | 3.703496 |
94904547-9bb9-441b-89ed-3750336793b9 | DebashisGanguly/gpgpu-sim_UVMSmart | src/intersim2/allocators/separable_input_first.cpp | // $Id: separable_input_first.cpp 5188 2012-08-30 00:31:31Z dub $
// ----------------------------------------------------------------------
//
// SeparableInputFirstAllocator: Separable Input-First Allocator
//
// ----------------------------------------------------------------------
#include "separable_input_first.... | ALGO | 0.932803 | 6.366887 |
8c2be927-833d-448b-8bc2-c2236db8c5b9 | kapoorz/cpptopics | graphs/bellman.cpp | #include <bits/stdc++.h>
using namespace std;
#define inf 1e9
struct Edge
{
int src, dest, wt;
};
class Graph
{
public:
int v, e;
Edge *ea;
Graph(int v, int e) : v(v), e(e)
{
ea = new Edge[e];
}
void addedge(int u, int v, int w, int count)
{
ea[count].src = u;
... | ALGO | 0.999976 | 4.222062 |
c13a5f7a-1584-48c4-bb10-e77c0102bbba | VINODvoid/DSA-Journal | Week-04/bubblesort.cpp | #include <iostream>
using namespace std;
void bubble_sort(int arr[], int n)
{
// for(int i=n-1;i>=1;i--)
// {
// for(int j=0;j<=i-1;j++)
// {
// if(arr[j]>arr[j+1])
// {
// swap(arr[j],arr[j+1]);
// }
// }
// } // Time complexi... | ALGO | 0.999756 | 4.35253 |
378e9f23-8772-4ea1-a9d0-954b8520e840 | liangyh911/ATTNChecker | pytorch/third_party/ideep/mkl-dnn/src/cpu/matmul/ref_sparse_matmul.cpp | #include "common/dnnl_thread.hpp"
#include "common/math_utils.hpp"
#include "common/type_helpers.hpp"
#include "cpu/matmul/ref_sparse_matmul.hpp"
namespace dnnl {
namespace impl {
namespace cpu {
namespace matmul {
status_t ref_sparse_matmul_t::execute(const exec_ctx_t &ctx) const {
status_t status = status::suc... | TOOL | 0.887113 | 6.809078 |
2be54249-7236-4bd1-8bb6-c67c51540966 | bbannier/ROOT-svn-import | interpreter/llvm/src/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | #include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/Target/TargetLowering.h"
using namespace llvm;
namespace {
class VectorLegalizer {
SelectionDAG& DAG;
const TargetLowering &TLI;
bool Changed; // Keep track of whether anything changed
/// LegalizedNodes - For nodes that are of legal width, and that have m... | ALGO | 0.963829 | 6.391127 |
a6fe5ea4-63a5-4f61-8962-874b8a3a41f9 | NEWBEE108/algos_CPP | Graph Algorithms/Kruskal's Algorithm.cpp | /*
Petar 'PetarV' Velickovic
Algorithm: Kruskal's Algorithm
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <complex>
#define MAX_N 100001
... | ALGO | 0.999937 | 4.612819 |
a47c291d-e7b3-4f46-af43-320bc832692f | ishandutta2007/codeforces | hellkitsune/normal/176/A.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct mp
{
int dif, count;
mp(int a, int b)
{
dif = a;
count = b;
}
};
bool operator < (const mp &a, const mp &b)
{
return a.dif < b.dif;
}
int n, m, k, mx = 0;
int a[10][100], b[10... | ALGO | 0.999964 | 3.626921 |
e62bf1c2-d710-42d7-a1ec-b082556a2dde | Dav124/UAS_06TPLM006_DAVID_201011400448 | 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 |
91222f8d-5110-494b-9fbb-faaa1d253868 | Inverstar/CPPStudy-One-Hour-A-Day | Project8/8.11 Pointers_ArrayVar_IsAddressOfFirst.cpp | #include <iostream>
using namespace std;
int main()
{
// Static array of 5 integers
int myNumbers[5];
myNumbers[0] = 0;
// Pointer initialized to array
int* pointToNums = myNumbers;
// Display address contained in pointer
cout << "pointToNums = 0x" << hex << pointToNums << endl;
cout << "Nums ... | ALGO | 0.985921 | 4.103175 |
d1250cb4-de91-4be2-8f76-a1dc88c18f53 | abmishra1234/Leetcode | 323_Medium_NumberOfConnectedComponent.cpp | using namespace std;
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<list>
#include<forward_list>
#include<stack>
#include<queue>
#include<algorithm>
#include<cstring>
#define FORREF
#ifndef FORREF
class Solution {
public:
/... | ALGO | 0.999795 | 6.099226 |
e46c49c4-e741-46ae-a034-4c069342e0c3 | mmsoftware100/korea-myanmar-dictionary | 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.998764 | 6.762122 |
c4c025e9-f4c6-4c21-9580-4dc663faf015 | vijaykumarrpai/mca-code | 2nd Sem/C++/Programs/areas.cpp | #include <iostream>
#define PI 3.1415
using namespace std;
class Cylinder{
float area, r;
public:
void calc();
};
void Cylinder::calc()
{
printf("Enter radius of cylinder: \n");
scanf("%f", &r);
area = (1.0 / 3.0) * PI * r * r;
cout << "Area of cylinder: " << area << endl;
}
class... | ALGO | 0.951651 | 3.441728 |
5a03efd7-39c6-41b3-81cd-5d66a4fe05e6 | manqing321/IAlgorithm | leetcode/longest_alternating_subarray.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>
using std::max;
using std::vector;
int longest_alternating_subarray(vector<int> &nums, int threshold)
{
int res = 0;
int cnt = 0;
for (int i = 0; i < nums.size(); i++)
{
if (nums[i] <= threshold)
{
... | ALGO | 0.999944 | 5.589124 |
584a5908-ec9c-40f8-b7d9-293df1f9a177 | BychkovArthur/algorithms | leetcode/121_1.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
vector<int> maxs(n);
maxs[n - 1] = prices[n - 1];
for (int i = n - 2; i >= 0; --i) {
maxs[i] = max(maxs[i + 1], prices[i]);
}
int res = 0;
for (int i = 0; i < n; ... | ALGO | 0.999767 | 6.226385 |
0df26180-abec-4ac0-9e4e-cf34e7b115dd | umangja/CompetitiveProgrammingSolution | codeforces/1362/B.cpp | /*input
*/
// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.... | ALGO | 0.999852 | 4.434687 |
94c44a97-2b39-492f-a40b-f2f4a21e3dfd | hhoulei/MRSL | src/DFS.cpp | #include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
#include <iostream>
#include <bits/stdc++.h>
#include <list>
#include <stack>
using namespace std;
using namespace arma;
using namespace Rcpp;
// Class to represent a graph
class Graph {
// No. of vertices'
int V;
int* orderdfs[1000];
// Pointer... | ALGO | 0.999809 | 6.247294 |
ef57b663-4b17-4dd2-b11a-9959a33dbe13 | plasmatic1/dmoj-solutions | cpp/ccc22s3.cpp | #include "bits/stdc++.h"
using namespace std;
using P = pair<string, string>;
using ll = long long;
const ll INF = 0x3f3f3f3f, LLINF = 0x3f3f3f3f3f3f3f3f;
const int MN = 1e6 + 10;
int N, M,
A[MN];
ll K;
void die() {
cout << "-1\n";
exit(0);
}
int main() {
ios_base::sync_with_stdio(false);
cin.ti... | ALGO | 0.999976 | 3.534902 |
2e310985-7544-4599-bb39-c2cbde903ae7 | VincePuc99/UNIPR-Vincenzo_Puca | Fondamenti di Programmazione (C++)/Esame Puca_Vincenzo_297113/main.cpp | //
// main.cpp
// Puca_Vincenzo_297113
//
// Created by Vincenzo Puca on 06/07/21.
//
#include <iostream>
#include <fstream>
#include <stdio.h>
#include "graph.h"
#include <string.h>
#include "item.h"
#include "llist.h"
#include <list>
#include "graphutil.h"
#include "grlist.h"
using namespace std;
void showlist(... | ALGO | 0.978979 | 4.128558 |
6d6a2bbb-423e-4088-b8f2-5ccab6df4c54 | olofer/qtreehat | test-index.cpp | /*
* Basic test of C++ interface for fixed-maximum-size (by template parameters) treecode.
* Similar to test-index.c but goes a little further and also tests the target point eval() member.
*
* BUILD: g++ -std=c++14 -Wall -o test-index++.exe -O2 test-index.cpp
* clang++ -std=c++14 -Wall -o test-index++.exe... | TEST | 0.991134 | 7.250384 |
95a6828f-a85a-4a84-a6eb-75e66c180947 | Mahfuzpust/UVa-Problem-solutions | UVa Problem Solving-2021/UVa-11152.cpp | #include <stdio.h>
#include <math.h>
int main() {
long long a, b, c;
while(scanf("%lld %lld %lld", &a, &b, &c) == 3) {
double roses, violets, sunflowers;
double r, R, s = (a+b+c)/2.0;
violets = sqrt(s*(s-a)*(s-b)*(s-c));
r = violets*2/(double)(a+b+c);
roses = r*r*acos(-1... | ALGO | 0.998976 | 3.589034 |
ad8a3c95-3988-47e9-8f69-1f7a98683f7c | lucianayahuita/PRACTICA_01 | Ejercicio_01_20.cpp | // Autor: Luciana Cecilia Yahuita Lazarte
// Fecha creacin: 23/08/2023
// Fecha modificacin: 23/08/2023
// Numero de ejericio: 20
// Problema planteado: Leer tres nmeros enteros y si son diferentes entre s determine con algn mensaje el
//menor
#include <iostream>
using namespace std;
int main(){
int numero1, nume... | ALGO | 0.998312 | 3.685323 |
17b8e1a3-c0ea-43a3-8bb6-482cd14b6f26 | PerfectLifeG/Algorithm-Competition | PracticeMakesPerfect/2023Winter/12.30/t22.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=10010;
int main(){
int t;cin>>t;
while(t--){
int n,k;scanf("%d%d",&n,&k);
int len=k;
int mx=n,mn=1;
while(mx>=mn){
for(int i=1;i<=len-1&&mx>=mn;i++){
printf("%d ",mx--);
}
... | ALGO | 0.999916 | 3.691299 |
686b4c1a-1cba-4faf-b86a-e3c352257974 | mailcourses/technosphere_deep_cpp | lesson-08/src/2021_01/priority_queue.cpp | #include <queue>
#include <vector>
#include <iostream>
int main()
{
int k = 3;
std::vector<int> arr = {1, 8, 5, 6, 0, 9, 7};
// O(n log n)
std::sort(std::rbegin(arr), std::rend(arr));
//std::sort(arr.begin(), arr.end());
for (size_t i = 0; i < k; ++i) {
std::cout << arr[i] << ", ";
... | ALGO | 0.999318 | 4.649457 |
f62d30cc-b46f-4302-9c60-920be10a21d6 | SuperHellCat/https-github.com-EpicGames-UnrealEngine | Engine/Source/ThirdParty/IntelTBB/IntelTBB-4.4u3/examples/task/tree_sum/SimpleParallelSumTree.cpp | #include "common.h"
#include "tbb/task.h"
class SimpleSumTask: public tbb::task {
Value* const sum;
TreeNode* root;
public:
SimpleSumTask( TreeNode* root_, Value* sum_ ) : root(root_), sum(sum_) {}
task* execute() {
if( root->node_count<1000 ) {
*sum = SerialSumTree(root);
}... | ALGO | 0.999489 | 5.586175 |
655ec2b1-169c-4985-8f32-f53a1301b7e2 | yinyunqiao/qtbase | src/gui/graphicsview/qgraphicssceneindex.cpp | /*!
\class QGraphicsSceneIndex
\brief The QGraphicsSceneIndex class provides a base class to implement
a custom indexing algorithm for discovering items in QGraphicsScene.
\since 4.6
\ingroup graphicsview-api
\internal
The QGraphicsSceneIndex class provides a base class to implement
a ... | TOOL | 0.916266 | 6.724369 |
9f2e9cca-61b7-415a-9f77-1b0d5b1bd2bb | raincross7/code-similarity | codes/train_code/problem217/problem217_491.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int a,flag=0;
cin >> a;
vector<string> b(a);
for(int i = 0;i<a;i++) cin >> b.at(i);
for(int i = 0;i<a-1;i++){
for(int j = i+1;j<a;j++){
if(b.at(i)==b.at(j)) flag = 1;
}
}
for(int i = 0;i<a-1;i++){
string c,d;
... | ALGO | 0.999974 | 3.836999 |
25d9ca92-5233-4f94-9515-14e15729d0a8 | Yallaswamy/gfg_solved | Easy/Brothers From Different Roots/brothers-from-different-roots.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str)
{
// Corn... | ALGO | 0.999889 | 6.411501 |
1ce01c41-321c-4f30-94f0-45398510c56d | KapilAgrawal2005/DSA | binarySearch/findMinInRotated.cpp | #include <bits/stdc++.h>
using namespace std;
int findMinInRotated(int a[], int n)
{
int s = 0;
int e = n - 1;
int m = 0, ans = a[0];
while (s <= e)
{
m = s + (e - s) / 2;
if (a[m] >= a[0])
{
s = m + 1;
}
else if (a[m] < a[0])
{
... | ALGO | 0.999969 | 5.270943 |
d7b18b33-82c2-44d6-b039-3dc87dd5350f | pawelplodzpl/TH3D_UnifiedFirmware_Sovol_SV06_custom | buildroot/share/PlatformIO/variants/MARLIN_F103VE_LONGER/variant.cpp | #include "pins_arduino.h"
#ifdef __cplusplus
extern "C" {
#endif
// Digital PinName array
const PinName digitalPin[] = {
PA_0, //D0
PA_1, //D1
PA_2, //D2
PA_3, //D3
PA_4, //D4
PA_5, //D5
PA_6, //D6
PA_7, //D7
PA_8, //D8
PA_9, //D9
PA_10, //D10
PA_11, //D11
PA_12, //D12
PA_13, //D... | CONFIG | 0.884534 | 4.590548 |
8f8462b5-0a2e-40ee-93da-98f189492c13 | AteamVentures/CREATABLE_D3 | Firmware/Marlin/qr_solve.cpp | #include "qr_solve.h"
#ifdef ACCURATE_BED_LEVELING
#include <stdlib.h>
#include <math.h>
#include <time.h>
//# include "r8lib.h"
int i4_min ( int i1, int i2 )
/******************************************************************************/
{
int value;
if ( i1 < i2 )
{
value = i1;
}
else
{
va... | TOOL | 0.99992 | 5.146761 |
2d6db08f-397e-42e4-83e7-beb90ed47f45 | peterclemenko/Forque3D-FPSTutorial | Engine/source/ts/arch/tsMeshIntrinsics.sse4.cpp | #if defined(TORQUE_CPU_X86) && (_MSC_VER >= 1500)
#include "ts/tsMeshIntrinsics.h"
#include <smmintrin.h>
void m_matF_x_BatchedVertWeightList_SSE4(const MatrixF &mat,
const dsize_t count,
const TSSkinMesh::BatchData::BatchedVertWeight * __restric... | ALGO | 0.948119 | 4.734809 |
d97ce3ae-403a-4bbb-8548-054004a1c10b | WillPen/leetCode | code/344. ๅ่ฝฌๅญ็ฌฆไธฒ-E/main.cpp | /*
็ผๅไธไธชๅฝๆฐ๏ผๅ
ถไฝ็จๆฏๅฐ่พๅ
ฅ็ๅญ็ฌฆไธฒๅ่ฝฌ่ฟๆฅใ่พๅ
ฅๅญ็ฌฆไธฒไปฅๅญ็ฌฆๆฐ็ป s ็ๅฝขๅผ็ปๅบใ
ไธ่ฆ็ปๅฆๅค็ๆฐ็ปๅ้
้ขๅค็็ฉบ้ด๏ผไฝ ๅฟ
้กปๅๅฐไฟฎๆน่พๅ
ฅๆฐ็ปใไฝฟ็จ O(1) ็้ขๅค็ฉบ้ด่งฃๅณ่ฟไธ้ฎ้ขใ
*/
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;//ไฝฟ็จๆ ๅๅฝๅ็ฉบ้ด
class Solution {
public:
void reverseString(vector<char>& s... | ALGO | 0.999057 | 4.711961 |
b72f090c-7e4a-41f3-9c14-9db90504fb16 | Qkrwlgn1/14-th-exercise-v3 | 14-th-exercise-re/Library/PackageCache/com.unity.ide.visualstudio@2.0.23/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call m... | TOOL | 0.944573 | 6.933585 |
a33dcd96-4ab2-4641-9c35-1f1db1509e6d | Sumanth-NR/CompetitiveProgramming | Platforms/SPOJ/Solutions/00002_PRIME1_PrimeGenerator.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
void solve()
{
int m, n;
cin >> m >> n;
// (1 <= m <= n <= 1000000000, n-m<=100000)
// Code starts here
int ans = 0;
// Special Cases
// n = 1 or m = 1
if (n == ... | ALGO | 0.999971 | 4.406988 |
985049ed-8396-4914-b875-2d95114b4bc0 | ProBeta1/DST_Lab | 25-01-19/Index Number.cpp | //LIT2018038
#include <stdio.h>
int main()
{
int t, n, k;
scanf("%d", &t);
while(t--) {
scanf("%d", &n);
int arr[n + 1];
for (int i = 1; i <= n; i++) {
scanf("%d", arr + i);
}
scanf("%d", &k);
int b = 1;
for (int i = 1; i <= n; i++) {
... | ALGO | 0.999684 | 3.854285 |
c0df8d6a-4b09-4515-abcc-f4c138c9f6e1 | RandoNandoz/cs12 | CLion/caesarcipher/main.cpp | // randy zhu
// 2021-11-23
// encrypts caesar cipher of any shift
#include <iostream>
#include <fstream>
int main() {
std::ifstream in("./input.txt");
std::ofstream out("./output.txt");
char c = -1;
int shift = -1;
while (!((shift >= 0) && (shift <= 26))) {
std::cin >> shift;
}
w... | ALGO | 0.998398 | 5.082416 |
ded86b8f-d432-4417-91b7-e5e46457d21e | Alok-Khansali/Lets-LeetCode | Easy/Move_Zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums)
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int j=0;
for(int i=0;i<nums.size();i++)
if(nums[i]!=0)
nums[j++] = nums[i];
for(;j<nums.size();j++)
nums[j]=0;... | ALGO | 0.999942 | 5.948932 |
439bfe38-3774-470e-944e-bc309544d2e6 | SampathKumar-Kasanagottu/cpp | Data Structures/Trees/Binary Trees/DepthOrLevelOfNode.cpp | #include<iostream>
#include<queue>
using namespace std;
/*PROGRAM TO FIND THE LEVEL OF A NODE or DEPTH OF A NODE from root
1) Depth- depth of a node is the length of path from root to that node, or from that node to the root,
or simply the number of edges between that node and root of tree. This can also be used to f... | ALGO | 0.999932 | 3.616053 |
56e14071-e63a-462e-b176-62a08a5d432c | FWWKCS/codetree-TILs | 250417/ํน์ ์กฐ๊ฑด์ ๋ง๊ฒ K๊ฐ ์ค์ 1๊ฐ๋ฅผ N๋ฒ ๋ฝ๊ธฐ/n-permutations-of-k-with-repetition-under-constraint.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
set<vector<int>> S;
// vector<int> arr;
int K, N;
void dfs(int depth, vector<int> arr) {
if (depth == N) {
S.insert(arr);
return;
}
for (int i = 1; i <= K; i++) {
arr[depth] = i;
dfs(depth+1, arr);
... | ALGO | 0.999982 | 3.964392 |
46331958-85b1-430d-a8bc-09a35911e667 | nikakogho/codeforces | Problems/567C.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
long long arr[n];
long long answer = 0;
map<int, int> left;
map<long long, int> right;
for(int i = 0; i < n - 1; i++)
{
int x;
cin >> x;
arr[i] = x;
auto it = left.find(x);
if(it == left.end()) left.insert( { x, 1 }... | ALGO | 0.999622 | 3.525851 |
f0840b6b-d372-40ae-aef4-c0c7f0106146 | EcutDavid/oj-practices | codeforces/545/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef double f64;
typedef long long i64;
typedef int i32;
typedef pair<i32, i32> pi32;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef vector<i32> vi32;
typedef deque<i32> di32;
#define all(c) (c).begin(), (c).end()
#define REP(i, a, b) for (auto i = a... | ALGO | 0.999938 | 4.145926 |
97ed1bc3-f766-4e61-8d22-f43ae1b9a558 | parteek2813/Leetcode | 1930-unique-length-3-palindromic-subsequences/1930-unique-length-3-palindromic-subsequences.cpp | class Solution {
public:
int countPalindromicSubsequence(string s) {
int n=s.length();
int result=0;
vector<pair<int,int>>indi(26,{-1,-1});
for(int i=0;i<n;i++){
char ch=s[i];
int idx=ch-'a';
if(indi[idx].first==-1){
indi[idx].first=i;
}
... | ALGO | 0.99986 | 6.327193 |
2c4ca145-d1ca-4938-b453-c1274b73e658 | vishal-sharma-369/dsa-with-cpp | graphs/l86.cpp | #include <iostream>
#include <unordered_map>
#include <list>
#include <vector>
#include <queue>
#include <bits/stdc++.h>
using namespace std;
// Representation of graphs:
// Adjacency matrix
// Adjacency list
// Implementation of graphs using adjacency matrix
// class graph
// {
// int **arr;
// int n;
// pub... | ALGO | 0.999906 | 6.10534 |
5183cd92-1f65-4d22-bedf-8435caaad51e | arc-l/3d_coverage | cumulative_quality.cpp | #include "Solution.h"
void Solution::precompute_3_1(){
//*********************************************
// precompute for quality with respect to max(0, cos / r^2)
//*********************************************
FILE* fp = fopen("precomputevis_plus.bin", "wb");
vector<vector<float>> inter(num_of_loc... | ALGO | 0.999884 | 4.078587 |
11d3dacb-f657-45b0-8f70-27d47223e2d2 | tanvirtareq/precode | moqsad sir/RMQ using sparse table.cpp | #include<bits/stdc++.h>
using namespace std;
int sparseTable[1000][20];
void makeSparseTable(int ar[], int sz)
{
int x=log2(sz);
int z=1;
for(int i=0;i<=x;i++)
{
for(int j=1;j<=sz;j++)
{
if(i==0)
{
sparseTable[j][i]=ar[j];
}
... | ALGO | 0.999956 | 3.893116 |
e0181ed0-7e29-4596-97d7-a27a6125479a | ishandutta2007/codeforces | krk/normal/1279/A.cpp | #include <bits/stdc++.h>
using namespace std;
int t;
int r, g, b;
int main()
{
scanf("%d", &t);
while (t--) {
scanf("%d %d %d", &r, &g, &b);
if (r > g) swap(r, g);
if (g > b) swap(g, b);
if (r > g) swap(r, g);
if (r + g >= b - 1) printf("Yes\n");
else printf("No... | ALGO | 0.999959 | 4.018797 |
edea9f31-c743-4100-a892-2ab1dc2848f4 | InSange/BaekJoon | BaekJoon/BaekJoon/1026.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int N;
int A[51];
int B[51];
int main()
{
cin.tie(NULL);
ios::sync_with_stdio(false);
cin >> N;
for (int i = 0; i < N; i++)
{
cin >> A[i];
}
for (int i = 0; i < N; i++)
{
cin >> B[i];
}
sort(A, A + N);
sort(B, B + N);
int result = 0;
... | ALGO | 0.999987 | 3.287118 |
82ea1db1-e839-4962-8a3b-cce87e38890a | muhfarozii/tugas_pert4 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.