uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d80c71ed-22a7-44b8-a8a8-cc92a7619040 | SirWilliamsthefirst/COS-201 | week4/exercise1.cpp | //array example summing up the elements of an array
#include <iostream>
using namespace std;
int matrice1[3][3] = {0,1,2,3,4,5,6,7,8};
int matrice2[3][3] = {9,1,2,3,4,5,6,7,8};
int result[3][3];
int main()
{
for(int n=0 ; n<3 ; n++)
{
for (int i=0 ; i<3 ; i++)
{
result[n][i] = matr... | ALGO | 0.998083 | 3.69544 |
4e769820-c981-482d-914a-544debd7b3aa | Kostamirin/C-codes_laptopUpdates | C++_base__personal-learning/C++ (useful string methods)/C++(while loops)/tempCodeRunnerFile.cpp | #include <iostream>
int main(){
for(int i = 1; i <=3 ; i++){
for(int j =1 ; j <=10; j++){
std::cout <<j <<' ';
}
std::cout <<'\n';
}
return 0;
}
| TOOL | 0.865722 | 3.391414 |
3ce67432-74ca-4e5b-8c61-d406d0c2d9b5 | ZenglaiMa/algorithm-note | BasicAlgorithm/数据结构/树与二叉树/008-哈夫曼树(求WPL).cpp | /*
哈夫曼树(最优二叉树)
已知 n 个数, 寻找一棵树, 使得树的所有叶子结点的权值恰好为这 n 个数, 并且使得这棵树的带权路径长度最小.
这棵带权路径长度最小的树被称为哈夫曼树. 对同一组叶子结点来说, 哈夫曼树不唯一, 但最小带权路径长度一定唯一.
叶子结点的带权路径长度 = 叶子结点权值 * 路径长度.
树的带权路径长度(WPL) = 所有叶子结点的带权路径长度之和 = 所有非叶子结点的权值之和.
哈夫曼树的性质
1. 哈夫曼树中不存在度为 1 的结点;
2. 哈夫曼树的总结点数 = 2n-1 (n为叶... | ALGO | 0.999973 | 4.106299 |
52f065d9-2265-4d6e-a1bb-0fc73994901b | OpenCAXPlus/OpenCAXPlus | OpenDigitalTwin-main/tools/gmsh/Mesh/meshPartition.cpp | #include "GmshConfig.h"
#include "meshPartition.h"
#include "meshPartitionOptions.h"
#if defined(HAVE_CHACO) || defined(HAVE_METIS)
#include "GModel.h"
#include "meshPartitionObjects.h"
#include "MTriangle.h"
#include "MQuadrangle.h"
#include "MTetrahedron.h"
#include "MHexahedron.h"
#include "MPrism.h"
#include "MPy... | TOOL | 0.871658 | 6.399253 |
9818818d-b8cc-416c-ae9a-5b52ebd7a20a | thisismqj/cpp2 | luogu/basic/graph/P1127_82pts/main.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
string wd[1005];
vector<int> whead[26];
int st[1005];
int _sp=0;
bool vis[1005];
int _p=0;
bool dfs(char ch) {
char it[30], _itp=0;
memset(it, 0, sizeof(it));
if (ch=='*') {
for (int i=0; i<26; ++i) {
if (!whead[i].empty()) {
... | ALGO | 0.999911 | 4.038962 |
4d28654d-0003-4dc9-b7bd-667453906825 | OpenGVLab/PIIP | mmcv/mmcv/ops/csrc/pytorch/assign_score_withk.cpp | // Modified from
// https://github.com/CVMI-Lab/PAConv/tree/main/scene_seg/lib/paconv_lib/src/gpu
#include "pytorch_cpp_helper.hpp"
#include "pytorch_device_registry.hpp"
void assign_score_withk_forward_impl(int B, int N0, int N1, int M, int K, int O,
int aggregate, const Tensor& p... | DATA | 0.952743 | 6.103683 |
cebf32e6-2b6c-4d05-887d-1a6addd07881 | Bhagwankumarsingh/LeetCodeQuestions | 283-move-zeroes/move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int n=nums.size();
int i=0;
int j=nums.size();
int k=0;
while(k<j){
if(nums[k]!=0){
swap(nums[k],nums[i]);
i++;
}
k++;
}
}
}; | ALGO | 0.999951 | 6.357622 |
42ccc124-9933-43ea-9d37-37d19f1182e5 | Ww1ll/FATEC-Estrutura_de_dados | lista10/ex01.cpp | #include <stdlib.h>
#include <iostream>
using namespace std;
int mod(int x, int y){
if(y == 0){
return -1;
}
if(x > y){
return mod(x-y, y);
}
if(x < y){
return x;
}
if(x == y){
return 0;
}
}
int main(){
int x = 0;
int y = 0;
cout<<" ------Resto de divisao------ "<<endl;
cout<<"Informe... | ALGO | 0.999345 | 4.288834 |
7ab1d04e-1e49-465d-a2af-c49d474965ce | shhyonn/nwmaleok | c++/test wskaz.cpp | #include <iostream>
using namespace std;
int main(){
int telefon = 12345; //zmienna liczbowa
int *wsk = &telefon; //przypisanie wskaźnikowi adresu zmiennej telefon
cout << *wsk << endl; //wyświetlenie wyłuskanej wartości wskaźnika (12345)
cout << wsk << endl; //wyświetlenie adresu zmien... | ALGO | 0.96605 | 3.85114 |
cf305b90-8a58-4937-8360-3012aef056c0 | ishandutta2007/codeforces | rivalq/normal/493/D.cpp | #include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rep3(n) for(int i=0;i<n;i++)
#define ll long long
#define int long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define endl "\n"
#define eb emplace_back
#de... | ALGO | 0.999873 | 3.533653 |
df7838a2-8d2b-4ded-9b58-1bbf031bd018 | baoxuezhao/solution_set | leetcode/4Sum.cpp | class Solution {
public:
vector<vector<int> > fourSum(vector<int> &num, int target) {
const int n = num.size();
vector<vector<int> > res;
if(n < 4)
return res;
unordered_map<int, vector<pair<int, int> > > pairs;
std::sort(num.begin(), num.end... | ALGO | 0.999972 | 5.70705 |
0efffcb0-3e0c-477b-b234-7de4e160a910 | alif-ul-haque/DSA-2 | backtracking_map_color.cpp | #include <bits/stdc++.h>
using namespace std;
#define granite_state ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define line cout << "\n"
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define vsb (v).begin(),(v).end()
#define vse (v).rbegin(),(v).rend()
#define spc " "
#defi... | ALGO | 0.999975 | 4.311292 |
f3d87a54-25d9-4633-8471-a4af5910d05e | syed1israr/CPP-codes | Day_1_NQUEEN.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define inp(arr, n) for (int i = 0; i < n; i++) cin >> arr[i]
#define prr(v) for (const auto& elem : (v)) cout << elem << " "; cout << endl
int n, k;
vector<int> qu... | ALGO | 0.999994 | 5.41635 |
3f340dba-ac3c-4a2a-a35c-01bdff0b7cf9 | Struna1292/LeetCode | 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:
void reorderList(List... | ALGO | 0.999996 | 5.837621 |
e6c69dd9-3699-40e1-97ce-d5eee12c6daa | Omar-V2/Mandelbrot | src/C++/mandel.cpp | #include <iostream>
#include <fstream>
#include <complex>
#include <vector>
using namespace std;
int width = 1000, height = 1000, maxval = 255;
// Generates an evenly spaced vector over a specific interval
// Analgous to np.linspace from Python's NumPy
std::vector<float> linspace(float start, float end, int num_point... | ALGO | 0.924946 | 5.391734 |
b06dee06-9051-4a1a-80c5-74ed459564b3 | aliaaa909/CPP-Double-Linked-List-Node-Manipulation | Double Linked List - Adding A Node To The Tail.cpp | #include <iostream>
using namespace std;
//double linked list declaration
struct UserData{
string name, username, email, password;
UserData *prev, *next;
};
UserData *head, *tail, *cur, *newNode, *del;
void CreateDoubleLinkedList(string data[4]){
head = new UserData;
head->name = data[0];
head->... | ALGO | 0.979633 | 3.770635 |
e7295c77-abd4-46fc-afba-a9a480c090d1 | rayyanabubakr/Dynamic-Programming | Min Cost In Maze Traversal.cpp | // 1. You are given a number n, representing the number of rows.
// 2. You are given a number m, representing the number of columns.
// 3. You are given n*m numbers, representing elements of 2d array a, which represents a maze.
// 4. You are standing in top-left cell and are required to move to bottom-right cell.
// 5.... | ALGO | 0.99984 | 4.355606 |
9836b6f0-a27f-4968-9913-46555b5395f7 | ranjeetkumarmrj2005/LeetCode | math/rotate-array.cpp | void reverse( vector<int>&nums,int start,int end){
for(int i=start,j=end;i<j;i++,j--){
int temp=nums[i];
nums[i]=nums[j];
nums[j]=temp;
}
}
class Solution {
public:
void rotate(vector<int>& nums, int k) {
int n = nums.size();
k=k%n;
reverse( nums,0,n... | ALGO | 0.999992 | 5.812564 |
1cee05ae-f4c7-4ee3-a22b-8c5e7b71c458 | ayushdh96/Leetcode | Difficulty: Easy/Square Root/square-root.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Function to find square root
// x: element to find square root
class Solution {
public:
int floorSqrt(int n) {
// Your code goes here
int left=0, right=n,mid=0,ans=0;
while(left<=right){... | ALGO | 0.999942 | 5.753174 |
21d74f0a-5095-4904-b372-17d3de15199a | ishandutta2007/codeforces | oyjason/normal/1089/G.cpp | #include<bits/stdc++.h>
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<" "
#define el <<endl
#define LL long long
#define M
using namespace std;
namespace IO{
const int BS=(1<<23)+5; int Top=0;
char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1;
char Getchar(){if(HD==TL){TL=(HD=Buffer)... | ALGO | 0.999843 | 3.343462 |
16b60935-0b0c-48f9-86dd-ebd1dba49d7b | chaliuu/AmazingRaceMaps | libstreetmap/tests_old/path_verify.cpp | #include <vector>
#include <algorithm>
#include <cassert>
#include "StreetsDatabaseAPI.h"
#include "path_verify.h"
#include "m3.h"
namespace ece297test {
bool path_is_legal(const IntersectionIdx start_intersection, const IntersectionIdx end_intersection, const std::vector<StreetSegmentIdx>& path) {
std::vector<In... | ALGO | 0.928216 | 4.29405 |
def370e6-b1b5-4566-8548-cfe128bac3d1 | IRedDragonICY/Basic-Programming | Log Programming Diary/1 Input dan Output/Volume kerucut.cpp | #include <iostream>
#include <windows.h>
using namespace std;
int main()
{
HANDLE h= GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h,10);
cout<<"Volume kerucut V1.0\n";
cout<<"Program ini akan mencari volume kerucut\n";
cout<<"Di buat oleh ";
SetConsoleTextAttribute(h,15);
cout<<"Ndik\n\n\n";
sleep(... | TOOL | 0.901742 | 3.675625 |
50fd7ba5-4182-4b04-ac45-4280740b0ec5 | GANGESHOTTEOK/gukbbap | BINARY_SEARCH/1300/HONG/1300.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n, k, result;
int bigger_then(int m){
int sum = 0;
for(int i=1;i<=n;i++)
sum += min(n, m/i); // ???
return sum;
}
void find_arr_k(){
int left = 1, right = k, mid;
while(left<=right){
mid = (left+right)/2;
if... | ALGO | 0.999933 | 4.19586 |
d8a86c2e-f4e0-446c-82d1-2c43fe3a50ad | wuvei/algorithm | Algorithm/cpp/0380.InsertDeleteGetRandomO1/RandomizedSet.cpp | class RandomizedSet {
private:
unordered_map<int, int> hash; //哈希表储存元素值和对应下标,为了remove时实现O(1)
vector<int> dyArray; //vector可以作为动态数组,实现getRandom和insert的常数时间操作
public:
/** Initialize your data structure here. */
RandomizedSet() {}
/** Inserts a value to the set. Returns true if the set ... | ALGO | 0.998514 | 5.972908 |
c47354fd-5319-49f4-a190-1390fbdcfda5 | CakeForest/noip | 2016上课/test/9.17考试/info.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAX=120;
int fa[MAX],val[MAX];//άval[]飬ʾsum[i]-sum[fa[i]]=val[i]
void in(int n){
for(int i=0;i<=n;i++) fa[i]=i;
memset(val,0,sizeof(val));
}
int Getfather(int p){
if(fa[p]==p) return p;
int temp=fa[p];
fa[p]=Getfather(fa[p]);
... | ALGO | 0.999177 | 4.265156 |
1e785990-58d2-42c0-a8e0-22bfec23422a | legend507/CommonSense | SomethingAboutCoding/C/string_wildcardMatching.cpp | /*
GoogleTechDevGuide Q
10. Regular Expression Matching
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element. <- 这个注意,*要和*之前的char一起看
The matching should cover the entire inpu... | ALGO | 0.999055 | 5.048692 |
5e094045-e407-41b7-9c56-245f9732fbf4 | durgeshkk/Codeforces-Contests | Contest #799(DIV 4)/A_Marathon.cpp | #include<bits/stdc++.h>
#include<iomanip>
#include <deque>
#include <bitset>
#include <cstdint>
#define ll long long int
using namespace std;
ll mod = (ll)(1e9+7);
ll LCM(ll a,ll b){
ll ans = (a*b)/__gcd(a,b);
return ans;
}
bool isPrime(int n){
if (n <= 1)
return false;
for (int i = 2; i < n; i++... | ALGO | 0.999671 | 4.094508 |
04dcf3a0-2856-48ca-a505-7f9297bd45ab | Tech-Soft-24/RCNTV | 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.998799 | 6.776823 |
fea8641d-ddcf-4c71-bb58-be29664c5d1c | Viralore/unCode | Questions/791. Custom Sort String.cpp | /*
791. Custom Sort String
You are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously.
Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a
character y in order, then x shou... | ALGO | 0.999993 | 6.350162 |
99166b10-1c26-4e07-9813-284228a0e4f7 | reisryan/trabalho1_mp | velha.cpp | #include "velha.hpp"
/**
* @brief verifica situacao do jogo da velha
* @author Ryan Reis
* @param velha - verifica se X venceu, ou se é impossível pelas regras;
*/
int VerificaVitoria(int velha[3][3]) {
/* Verifica se há vitória em linhas j */
for (int j = 0; j <= 2; j++) {
if ((velha[j][0] == ... | ALGO | 0.997665 | 5.08836 |
980a3a28-4f88-4f7f-a89e-035e73328a5a | vvm1004/Algorithm | Selection_Sort.cpp |
#include <iostream>
using namespace std;
int selectionSort(int a[], int n){
for(int i = 0; i< n -1; i++){
int i_min = i;
int v_min = a[i];
for(int j=i; j<n; j++){
if(a[j] < v_min){
v_min = a[j];
i_min = j;
}
}
int temp... | ALGO | 0.999783 | 3.980628 |
13b3d190-c6c1-4f40-bb46-fc5186e33be6 | PureWhiteVK/DataStructure | test/test_bs_tree.cpp | #include "avl_tree.hpp"
#include "bs_tree.hpp"
#include "rb_tree.hpp"
#include <cassert>
#include <chrono>
#include <iostream>
#include <random>
#include <set>
#include <sstream>
struct bool_t {
bool _bool;
bool_t(bool b) : _bool(b) {}
explicit operator bool() const noexcept { return _bool; }
};
std::ostream ... | TEST | 0.951138 | 5.754149 |
c91a8d5d-ce37-4398-ae65-356d197a6f0b | HJY214/Code_Practise | repos/STL/common_algorithm/ergodic.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
//常用遍历算法 for_each
void print_(int val)
{
cout << val << " ";
}
//仿函数
class print02
{
public:
int operator()(int val)
{
cout << val << " ";
}
};
void test1()
{
vector<int> v;
for (int i = 0; i < 10; i++)
... | ALGO | 0.990179 | 4.773977 |
15f408b5-a4bc-46c3-b45a-58fa7f9f2f8a | Srinikal/Sriram_USACO_CF_Solutions | src/USACO/Silver/SnowBoots.cpp | #include <vector>
#include <string>
#include <iostream>
#include <numeric>
#include <algorithm>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
using namespace std;
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
int N,B, ti... | ALGO | 0.999389 | 3.623202 |
e6d42a9c-2c67-4f9c-a6b9-6220b7cf240a | ShivaBansfore-JGEC/Codeforces_Contest_Question | A,B and C problem/A_Little_C_Loves_3_I.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
int n;
cin>>n;
if(n%3==0){
cout<<1<<" "<<1<<" "<<n-2<<endl;
}else{
cout<<1<<" "<<2<<" "<<n-3<<endl;
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(NULL);
int t=1;
//cin>>t;
... | ALGO | 0.999597 | 3.567065 |
75e443f8-d69c-4ebf-81ee-2b6b278ba3d6 | ishandutta2007/codeforces | fop_zzz/normal/650/E.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<algorithm>
#define eps 1e-10
#define inf 1e9
#define For(i,j,k) for(int i=j;i<=k;++i)
#define Dow(i,j,k) for(int i=k;i>=j;--i)
#define ll long long
#define y1 orz
using namespace std;
inline ll read()
{
ll t=0,f=1;char c=ge... | ALGO | 0.999903 | 3.592255 |
a83deef4-0420-4ea5-8d8e-c916fc46ed5d | uafgeotools/mtuq_performance_tests | c_pseudo_code/get_synthetics.cpp |
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
// number of components
static int NC = 2;
// number of stations
static int NS = 20;
// number of time samples
static int NT = 950;
// number of Green's functions
static int NG = 6;
// number of moment tensors
static int NM = 50000;
st... | ALGO | 0.926746 | 3.573942 |
49a67e58-59e4-4364-a917-835dba3cd417 | mitshelle/object-oriented | cs202a4/boardTypeImp.cpp | /*
*Name: Michelle McGowan, 2001813382, CS 202-1004, Assignment 4
*Description: program to practice pointers, arrays, classes
*Input: numbers for magic square
*Output: magic square according to algorithm
*/
#include <iostream>
#include "boardType.h"
#include <iomanip>
using namespace std;
/*
* function_identif... | TOOL | 0.924942 | 5.147191 |
016fabbe-48c5-4d31-8861-a1acd212f1f9 | rzbdz/CanonicalHuffmanCode | FrequencyCount.cpp | #include "FrequencyCount.h"
#include <ctime>
FrequencyTable InitTable() {
FrequencyTable f = (FrequencyTable)malloc(sizeof(frequencyTable));
if (f == nullptr)return f;
f->length = 0;
for (int i = 0; i < BYTE_CHAR_UPPER_LIMIT; i++) {
f->isExist[i] = 0;
f->totalWeight = 0;
}
return f;
}
FrequencyTable BuildT... | ALGO | 0.992745 | 4.152617 |
e31395fa-6cff-4e18-9a1e-3dca44b5b8d6 | Unuse1ess/LeetCode | cpp_src/2300.咒语和药水的成功对数.cpp | /*
* @lc app=leetcode.cn id=2300 lang=cpp
*
* [2300] 咒语和药水的成功对数
*/
#include "utils.hpp"
using namespace std;
// 使用float会有精度损失导致WA。
// @lc code=start
class Solution {
public:
vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {
vector<int> ans(spells.size());
... | ALGO | 0.999801 | 5.757082 |
eb956042-42e6-4636-8548-fb7a9472b4da | KiwawaXC/frameworks_native | cmds/servicemanager/ServiceManager.cpp | #include "ServiceManager.h"
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <binder/BpBinder.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/Stability.h>
#include <cutils/android_filesystem_config.h>
#include <cutils/multiuser.h>
#include <thread>... | TOOL | 0.92023 | 7.349759 |
bb277417-0de0-40c1-a60e-8a9dbbb0aaab | Amitkumaramit118589/DSA-problems-Solution | Difficulty: Medium/Sum of all substrings of a number/sum-of-all-substrings-of-a-number.cpp | class Solution {
public:
int sumSubstrings(string &s) {
// code here
int n=s.size();
int sum=stoi(s);
for(int i=1;i<n;i++)
{
for(int j=0;j+i<=n;j++)
{
string s1=s.substr(j, i);
sum+=stoi(s1);
}
}
... | ALGO | 0.999872 | 5.491364 |
9f3b69fd-5ede-4c72-8b99-327c35edb9d4 | muhammadhasan01/MakeCPITBGreatAgain | Data Struktur/ImbaBerbarisV1/spec.cpp | #include <bits/stdc++.h>
#include <tcframe/spec.hpp>
using namespace std;
using namespace tcframe;
const int N1 = 1e5;
const long long INF = 1e9;
class ProblemSpec : public BaseProblemSpec {
protected:
int N;
vector<long long> U;
vector<long long> res;
void InputFormat() {
LINE(N);
L... | ALGO | 0.999892 | 4.438443 |
7487d357-ac20-4b96-b207-1094c9c8d9e5 | flameshimmer/leet2015 | Leet2015/Leet2015/JumpGameII.cpp | #include "stdafx.h"
//Given an array of non - negative integers, you are initially positioned at the first index of the array.
//
//Each element in the array represents your maximum jump length at that position.
//
//Your goal is to reach the last index in the minimum number of jumps.
//
//For example :
//Given array ... | ALGO | 0.999881 | 5.073621 |
7e5f45b4-6c52-4513-8008-0bb02b1c356e | sarvex/leetcode-beef | solution/2500-2599/2542.Maximum Subsequence Score/Solution.cpp | class Solution {
public:
long long maxScore(vector<int>& nums1, vector<int>& nums2, int k) {
int n = nums1.size();
vector<pair<int, int>> nums(n);
for (int i = 0; i < n; ++i) {
nums[i] = {-nums2[i], nums1[i]};
}
sort(nums.begin(), nums.end());
priority_que... | ALGO | 0.999988 | 5.132851 |
b93f74f5-e74a-4f32-a42f-6838e5fd6d55 | iwtwiioi/OnlineJudge | wikioi/Run_332838_Score_100_Date_2013-10-31.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double s, p, c, t, u;
cin >> s >> p >> c;
t = s/(p+c+(c-p)/(c+p)*p);
u = (c*t-p*t)/(c+p);
cout << setiosflags(ios::fixed) << setprecision(2) << 2*t+u;
return 0;
} | ALGO | 0.999573 | 3.593763 |
c3ba60bb-2dad-450a-87f0-a6e9e73ec1cf | francisvm/j2-llvm | lib/CodeGen/DFAPacketizer.cpp | #include "llvm/CodeGen/DFAPacketizer.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetS... | TOOL | 0.973877 | 7.585368 |
85d841a6-8e3e-42bb-99c9-4dbf9c5c1c2e | AhanafTahmid/DSA | CSES/Mathematics/number theory template/burnside_lemma.cpp | #define ll long long
int md = 1e9 + 7;
ll power(ll a, ll b, ll m) {
ll res = 1;
while (b > 0) {
if (b & 1)
res = (res * a)%m;
a = (a * a) %m;
b >>= 1;
}
return res;
}
ll inverse(ll i){
return power(i, md-2, md);
}
void burnside_lemma(ll N, ll M)
{
ll ans ... | ALGO | 0.999966 | 4.609909 |
f9eff8c4-d3f9-4481-bdef-690c1b80de87 | paullouisageneau/legio | src/impl/graph.cpp | #include "graph.hpp"
#include "node.hpp"
#include <algorithm>
#include <deque>
#include <iostream>
#include <iterator>
#include <queue>
namespace legio::impl {
Graph::Graph(Node *node) : Component(node), mRoutingTable(std::make_shared<RoutingTable>()) {
insert(State(node->ecdsaPair, mStateSequence - 1, mEcdh.public... | ALGO | 0.997741 | 6.520572 |
50074caf-d87a-4b2a-bfcc-8a2790c40f71 | eshnil2000/CarND-Path_Planning | src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_interop.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = (m.array() + 4).matrix() * m;
cout << "-- Combination 1: --" << endl << result << endl << e... | ALGO | 0.999445 | 4.531452 |
4c4d3478-f5be-48ed-835d-6580b6deb63e | deepakasu67/leetcode | Problems/1740. Find Distance in a Binary Tree .cpp | //
// Created by Deepak Sahu on 12/29/21.
//
#include <iostream>
#include "CreateATreeWithArray.h"
using namespace std;
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, int p, int q)
{
if(root == nullptr)
{
return nullptr;
}
if (root->val == p... | ALGO | 0.999858 | 6.076936 |
8bdf7af7-e124-4130-9b4a-b1be5528d780 | szekelytibi777/HackerRank | CPP/CountingValleys/CountingValleys.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'countingValleys' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER steps
* 2. STRING path
*/
int countingVa... | ALGO | 0.999971 | 5.683109 |
b8855d9b-a7e3-4da4-8edf-823577c93f62 | Shakila72/IT-1-after-mids | user defined mprograminium value.cpp | #include<iostream>
using namespace std;
// function declaration
int min(int num1, int num2);
int main () {
// local variable declaration:
int a , b;
int ret; //return value
cout<<"Enter firt number :";
cin>>a;
cout<<"Enter second value :";
cin>>b;
// calling a function to get max value.
ret = min(a, b);
cout <... | ALGO | 0.999926 | 4.674531 |
40713269-84b6-4e8d-b5da-06a59af1927a | TaviTruman/factplusplus | Kernel/CascadedCache.cpp | #include "Reasoner.h"
// uncomment the following line to debug cascaded caching
//#define TMP_CACHE_DEBUG
const modelCacheInterface*
DlSatTester :: createCache ( BipolarPointer p )
{
fpp_assert ( isValid(p) ); // safety check
const modelCacheInterface* cache;
// check if cache already calculated
if ( (cache = D... | ALGO | 0.99593 | 6.025167 |
9e5b9373-84c0-49d8-ac69-79f166ab3998 | Dishant2001/DSA_Practice | Arrays/rotate_array.cpp | class Solution {
public:
void rotate(vector<int>& nums, int k) {
int l=nums.size();
k=k%l;
reverse(nums.begin(),nums.begin()+l-k);
reverse(nums.begin()+l-k,nums.end());
reverse(nums.begin(),nums.end());
}
}; | ALGO | 0.999965 | 6.021511 |
a3a7192b-d4c7-40b6-acaa-1cb19549dcdf | delwar03/CF | B_Equal_XOR.cpp | #include <bits/stdc++.h>
#define int long long
// #define endl '\n'
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
... | ALGO | 0.999978 | 3.840791 |
db8ceb55-cb7a-418c-9710-ddc106f72a65 | BaharSlmn/storm-bn | feasibility_analysis/storm/src/storm-parsers/parser/MarkovAutomatonSparseTransitionParser.cpp | #include "MarkovAutomatonSparseTransitionParser.h"
#include "storm/settings/SettingsManager.h"
#include "storm/settings/modules/BuildSettings.h"
#include "storm/exceptions/WrongFormatException.h"
#include "storm/exceptions/FileIoException.h"
#include "storm-parsers/parser/MappedFile.h"
#include "storm-parsers/util/cst... | TOOL | 0.866502 | 6.524146 |
470d64ce-4a5b-447b-80de-f93fa993b9c7 | ishandutta2007/codeforces | jdurie/normal/1660/F2.cpp | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
template<class T, class S>
ostream& operator << (ostream &o, const pair<T, S> &p) {
return o << '(' << p.first << ", " << p.second << ')';
}
template<template<class, class...> cla... | ALGO | 0.999973 | 4.41488 |
449a3896-d6f0-403c-89ae-4f3a992af912 | jake3991/CarND-Highway-Path-Planning-Project | src/Eigen-3.3/doc/examples/class_FixedVectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived, 2>
firstTwo(MatrixBase<Derived>& v)
{
return Eigen::VectorBlock<Derived, 2>(v.derived(), 0);
}
template<typename Derived>
const Eigen::VectorBlock<const Derived, 2>
firstTwo(c... | TOOL | 0.870212 | 5.212729 |
2e93ad92-92b8-4e92-9cf9-488746d65120 | abelardojarab/ece585 | L3Set.cpp | /******************************************************************************
* AUTHORS: Sean Hendrickson, Khalid ALkhulayfi
* FILE: L3Set.cpp
* LAST MODIFIED: 11/24/2014
* DESCRIPTION: This file implements the L3Set class.
*****************************************************************************/
#include ... | ALGO | 0.946556 | 3.546572 |
bb52b79d-8dd4-42b5-a759-997d29b2f4f0 | ivabby/Competitive-Programming | LeetCode/LeetCode Practice Problems/92. Reverse Linked List II.cpp | class Solution {
public:
ListNode* reverseBetween(ListNode* head, int m, int n) {
ListNode* rev = new ListNode(1);
ListNode* t;
ListNode* a = rev;
int pos = 0;
while(head != NULL)
{
pos++;
if(pos>=m && pos<=n)
{
... | ALGO | 0.999987 | 5.998875 |
588836bd-81f8-4cdb-a4ba-bad86d152143 | RonaldPerez7-7/Fuction-CalcNormsV | GL Code/Model.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include <time.h> //libreria de tiempo
#include <GL/glut.h>
#include "Model.h"
double vert_[5][3] = { { 0.5, 0.0, -0.5},
{-0.5, 0.0, -0.5},
{-0.5, 0.0, 0.5},
{ 0.5, 0.0, 0.5},
... | TOOL | 0.981855 | 3.236345 |
766e84f1-0930-4071-8602-be2981662f77 | sarvex/leetcode-rockstar | solution/0500-0599/0568.Maximum Vacation Days/Solution.cpp | class Solution {
public:
int maxVacationDays(vector<vector<int>>& flights, vector<vector<int>>& days) {
int n = flights.size();
int K = days[0].size();
int f[K + 1][n];
memset(f, -0x3f, sizeof(f));
f[0][0] = 0;
for (int k = 1; k <= K; ++k) {
for (int j = 0... | ALGO | 0.999869 | 5.454934 |
aae499bc-d06d-4913-8546-5ac6b1fff3d2 | ishandutta2007/codeforces | rama_pang/normal/1428/E.cpp | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
void Main() {
int n, k;
cin >> n >> k;
vector<lint> a(n);
lint tot = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
tot += a[i] * a[i];
}
// const auto Check = [&](lint mn) {
// lint cnt = 0;
// lint res = 0;
// for... | ALGO | 0.999949 | 4.767195 |
431b16d4-4d7e-46aa-b2ea-e2017012adb5 | ugeneunipro/ugene-old | src/plugins_3rdparty/umuscle/src/muscle/finddiags.cpp | #include "muscle.h"
#include "profile.h"
#include "diaglist.h"
#include "muscle_context.h"
#define TRACE 0
const unsigned KTUP = MuscleContext::finddiags_struct::KTUP;
const unsigned KTUPS = MuscleContext::finddiags_struct::KTUPS;
/*//MOVED TO TLS
const unsigned KTUP = 5;
const unsigned KTUPS = 6*6*6*6*6;
static unsig... | ALGO | 0.952836 | 5.174438 |
8aaee8c6-160a-4383-9fc2-9dd77e4d8d51 | Viet281101/ITLMAU | Semestre_6_L3/IA_pour_les_jeux/Exmples/Exemples_IA_Breakthrough/BreakthroughSolver/src/pawns.cpp | #include <algorithm>
#include <cassert>
#include "bitboard.h"
#include "pawns.h"
#include "position.h"
#include "thread.h"
namespace {
#define V Value
#define S(mg, eg) make_score(mg, eg)
// Pawn penalties
constexpr Score Backward = S( 9, 24);
constexpr Score BlockedStorm = S(82, 82);
constexpr Sc... | ALGO | 0.999603 | 7.535264 |
3f434028-3aa3-4c02-bd88-2526d4d6d560 | polossk/Standard-Code-Library-of-Algorithm-Competition | raw/二维RMQ.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn = 310;
int N;
int val[maxn][maxn];
//2D RMQ
//dp[row][col][i][j] 表示[row,row+2^i-1]x[col,col+2^j-1] 二维区间内的最小值.
//dp[row][col][i][j] =
// min( dp[row][col][i-1][j], dp[row + (1<<(i-1))][col][i-1][j] )
// ... | ALGO | 0.999903 | 3.9679 |
cd86085c-6c91-4ea8-a75e-cecc981f1dfb | Origami404/OI_Code | LGP1363.cpp | #include <cstdio>
#include <cstring>
#define MAXN 1507
using namespace std;
int n, m;
char map[MAXN][MAXN];
const int IS_VIS = 2, X_IND = 0, Y_IND = 1;
int vis[MAXN][MAXN][3];
bool succ = false;
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
inline int abs_mod(int a, int n) {
int t = a % n;
return t < 0 ? t... | ALGO | 0.999941 | 3.997795 |
9d895a45-820c-4bb6-aac4-1704ff0bf343 | Code-Learn-Work/Data-Structures | Recursion/powerRec.cpp | #include<iostream>
using namespace std;
int power(int a,int b){
// Base Case
if(a==0){
return 0;
}
if(b==0){
return 1;
}
else if(b==1){
return a;
}
// Recursive Case
return a*(power(a,b-1));
}
int main(){
int a;
int b;
cin>>a>>b;
cout<<powe... | ALGO | 0.999973 | 5.153792 |
13f38c0e-d295-4560-bf2a-4cc1fdef16c9 | shlusiak/Freebloks-3D | src/ki.cpp | #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef WIN32
#include <windows.h>
#endif
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#endif
#include "ki.h"
#include "spiel.h"
#include "timer.h"
#define BIGGEST_X_STONES 9
// fast identisch mit der CPlayer::calculate_possible_turns
void CKi::calculate_possible_turn... | ALGO | 0.999137 | 3.134335 |
26cb7453-31a6-4fe6-8627-6697150f6559 | DevashishPathrabe/LeetCode | LeetCode Solutions/LeetCode 75 Study Plan to Ace Interviews/Level 2/Day 15 Tree/Symmetric 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.999855 | 6.57734 |
831b270e-2a31-41dc-bdab-4778d8d8fb81 | pumfit/PracticeForCodingTest | CodingTestExProject/CodingTestExProject/프로그래머스/MaxAndMin.cpp | /*
ִ ּڰ
ڿ ٷ stoi to_string Ȱ
*/
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
string solution(string s) {
string answer = "";
vector<int> v;
int sidx = 0;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == ' ')
{
v.push_back(stoi(s.substr(sidx, i - sidx)));
sidx = i +... | ALGO | 0.999839 | 4.332215 |
ef688099-8817-401d-892c-f5eeb4e3ff93 | CiderCan/SW_Algorithm_Test | 31090.cpp | #include <iostream>
#include <queue>
using namespace std;
queue<pair<int, int>> snake;
bool apple[101][101];
int dx[4] = { 0,0,-1,1 };
int dy[4] = { -1,1,0,0 };
int N, K, L;
int direction = 3;
queue<pair<int, char>> q;
int chgDirection(int mx, int my, char c) {
// 0 : U ? 1 : D ? 2 : L ? 3 : R
switch (c) {
case 'D... | ALGO | 0.999889 | 4.604511 |
f7da85ea-bf2b-494b-9af0-ab318e1d1689 | oojamchaudhary/Leetcode | 0459_RepeatedSubstringPattern.cpp | #include <bits\stdc++.h>
using namespace std;
class Solution {
public:
bool repeatedSubstringPattern(string s) {
for(int i = s.length()/2; i >= 1; i--){
if(s.length() % i != 0) continue;
string sub = s.substr(0, i);
int j = i;
bool success = true;
... | ALGO | 0.999878 | 5.0469 |
41719f90-2197-4fd9-a5ad-c257b6b76e87 | crparse/Top-Interview-150-Leetcode | 57-insert-interval/insert-interval.cpp | class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {
vector<vector<int>> ans; // Initialize a vector to store the merged intervals
// Iterate through each interval in the given intervals
for(auto interval : intervals){
/... | ALGO | 0.999992 | 6.50827 |
f268bbf9-8966-4cc8-b023-be5f57d4267f | anuraghaldey/Data-Structures-Laboratory-Semester-3 | Assignment 5_String Operation/assignment5.cpp | //Name- Anurag Haldey
//Roll no- 2215055
//Batch-B
/*problem statement- A matrix of m x n order is said to have a saddle point; if some
entry at a[i][j] is the smallest value in row i and the largest value in j. Write C++ function that
determines the location of a saddle point if it exists.*/
#include <stdio.h>
#inclu... | ALGO | 0.999698 | 3.585047 |
d56eefa8-ed66-4913-aaa5-b61f074e559d | itsnithyananthanagaraj/C_Internship | Odd or Even.cpp | #include <stdio.h>
int main()
{
int num;
printf("\n Enter an integer: ");
scanf("%d", &num);
if(num % 2 == 0)
printf("\n %d is Even Number. \n\n", num);
else
printf("\n %d is Odd Number. \n\n", num);
return 0;
}
| ALGO | 0.999233 | 3.503701 |
1252c977-ff35-4a23-9ece-b49c1d2d10d6 | DuyMinh0102/My_Work | String - 30-10-24/chair/main.cpp | #include <iostream>
using namespace std;
const int maxn = 5e5;
int n, a[maxn + 5], curr;
int main()
{
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
sort(a+1, a+n+1);
for (int i = 1; i <= n; i++){
curr = 0;
for (int j = i + 1; j <= n; j++){
}
}
return 0;
}
| ALGO | 0.999842 | 3.448467 |
3a07ae3a-7ff6-4772-8f7d-632a46aa308b | knh4735/Algorithm | Baekjoon/Fibonacci_2748_fibonacci.cpp | // 2748 피보나치수2 시간복잡도
#include <stdio.h>
int main(){
int n;
long long a[2] = {0ll, 1ll};
int idx = 2, f;
scanf("%d", &n);
if(n == 0){
printf("0");
return 0;
} else if(n == 1){
printf("1");
return 0;
}
for(int i = 2; i <= n; i++)
a[i%2] = a[0] + a[1];
printf("%lld", a[n%2]);
return 0;
}
| ALGO | 0.999998 | 3.915678 |
56aa1b05-4efa-4ce9-a0a9-2bd7737d460f | mihaimoga/XMLSitemap | boost/libs/graph/example/reachable-loop-tail.cpp | /*
IMPORTANT!!!
~~~~~~~~~~~~
This example uses interfaces that have been deprecated and removed from
Boost.Grpah. Someone needs to update it, as it does NOT compile.
*/
#include <boost/config.hpp>
#include <iostream>
#include <fstream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_f... | ALGO | 0.994015 | 6.601401 |
f312b6f1-7e8e-456d-a794-89f71e7d032d | InputWindy/Flora | 3rdparty/vcglib/eigenlib/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.99844 | 4.659281 |
e14a4fbb-9ee9-486b-9fb3-cb77faae48fb | SpiNoice01/PPB_Fadhila_Agil_Permana_2211104006_SE601 | PRAKTIKUM/12_Maps/Unguided/peta/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.997546 | 6.76775 |
221f2837-956e-4f1d-b5e6-4c6672f4eb25 | vijaymanikantareddy/LeetCode_GFG_solved | 0997-find-the-town-judge/0997-find-the-town-judge.cpp | class Solution {
public:
int findJudge(int n, vector<vector<int>>& trust) {
vector<int> outdeg(n+1, 0), indeg(n+1, 0);
for(auto it: trust){
outdeg[it[0]]++;
indeg[it[1]]++;
}
for(int i = 1 ; i <= n ; i++){
if(outdeg[i] == 0 && indeg[i] == n-1) retu... | ALGO | 0.999865 | 5.382359 |
dab3042a-3c58-4a5c-bf3b-ae0fc89d1d3b | deadlyaman0000/MyCode | recursion/r3-factorial-of-n.cpp | #include<iostream>
using namespace std;
int fact(int n ){
if(n == 0){
return 1 ;
}
return n * fact(n-1);
}
int main()
{
int n = 5;
cout << fact(n) ;
return 0;
} | ALGO | 0.999882 | 4.519689 |
9b141042-9a21-4867-808f-e2e0b8ac2d78 | ikyyy777/jeknyong_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 |
aaf1dfaa-6a4c-4771-8343-2a46ebcae5e9 | alexleeucsc/cse216proj | firrtl-sig-klee/kleetests2/kleetests/klee_concat/generated_cpp_files/klee_concat_11_24.cpp |
#include <array>
#include "uint.h"
#include "sint.h"
#include <iostream>
#include "klee.h"
#include <assert.h>
#include <algorithm>
template<int w1, int w2>
void callconcat()
{{
uint64_t a;
uint64_t b;
klee_make_symbolic(&a, sizeof(a), "a");
klee_make_symbolic(&b, sizeof(b), "b");
a = a & ((1 <<... | TEST | 0.896704 | 3.743092 |
342f2ad2-142c-4e40-805a-c887cc68a872 | huangjunhao2019/leetcode-tencent | bishi/3.26/test2.cpp | #include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
using namespace std;
int solve(vector<int> &nums,int n,int k){
unordered_map<int,int> locMp;
for(int i=0;i<n;++i){
locMp[nums[i]]=i;
}
int res=0;
vector<int> newNums(nums.begin(),nums.end());
sort(newNums.beg... | ALGO | 0.999887 | 3.821133 |
8508d1b7-30bf-421f-af0e-c9dba5024234 | Algurina/Algurina | kr 2 2 zad.cpp | /*
В бинарном файле записаны целые числа.Изменить содержимое файла,
записав после серии полряд идущих чисел кол-во их повторений.
*/
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <locale.h>
using namespace std;
int main()
{
char* FileName1="work.bin";
int v_Count;
int v_Numb... | ALGO | 0.973161 | 3.027066 |
5506fb4e-b921-4ae2-8329-906d70875aa6 | mingwzhang/Queens-College-CS-Projects | CSCI 211 (Object-Oriented Programming in C++)/MainAssignments/EightNumberOnCross.cpp | #include <iostream>
using namespace std;
bool ok(int q[], int c)
{
int adj[8][5] = {
{-1},
{0, -1},
{0, -1},
{0, 1, 2, -1},
{0, 1, 3, -1},
{1, 4, -1},
{2, 3, 4, -1},
{3, 4, 5, 6, -1},
};
for (int i = 0; adj[c][i] != -1; i++)
{
if ... | ALGO | 0.999986 | 4.134112 |
970a0d74-a837-4043-8555-97c327fcb94f | sbthakare/PG-DAC | Cpp/code/inheritance_pure_virtual_method.cpp | #include<iostream>
using namespace std;
//virtual method/pure virtual method
//method that makes override must in derived class
//way to enforce certain method to be there is a class
class human
{
public:
virtual void live()=0;
virtual void study()=0;
virtual void eat()=0;
};
//one who inherits human must i... | ALGO | 0.941044 | 5.146451 |
4833799c-4525-4878-9b30-58d8e5f1b7d4 | Ilanlivne/Zero-estimators-for-signal-estimation-in-a-model-free-setting | Naive/zero_terms_functions.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
double func(DoubleVector vec1, DoubleVector vec2, DoubleVector vec3) {
int n = vec1.size();
long double sum=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
for(int k=0;k<n;k++)
{
if(i!=j && j!=k && k!=i) sum += vec1[i]*vec2... | ALGO | 0.99983 | 4.539443 |
1ad300ff-64cc-435d-adb3-d08877ff24b6 | Admer456/ioq3-burek | code/server/sv_world.cpp | // world.c -- world query functions
#include "server.hpp"
#include "Maths/Vector.hpp"
/*
================
SV_ClipHandleForEntity
Returns a headnode that can be used for testing or clipping to a
given entity. If the entity is a bsp model, the headnode will
be returned, otherwise a custom box tree will be constructed... | TOOL | 0.896247 | 4.160932 |
bde442a0-ac00-4a32-be76-b79633606beb | duonguwu/IT001-Of-Duong | Bài tập tại lớp/Buổi 5/themKmang.cpp | #include <iostream>
using namespace std;
void nhapmang(int a[], int &n){
cin >> n;
for (int i = 0; i < n; i++){
cin >> a[i];
}
}
int main (){
int a[1000], n;
nhapmang(a,n);
int x,k;
cin >> x >> k;
n++;
for (int i = n-1; i > k; i--){
a[i] = a[i-1];
}
a[k]... | ALGO | 0.999985 | 3.423043 |
3c9be0d3-cdcd-46d0-b039-4e8ab6769dc2 | Fss7/dataset | AtCoder dataset/abc082/B/2789500.cpp | #include <iostream>
#include <string>
int main() {
std::string S, T;
std::cin >> S >> T;
std::sort(S.begin(), S.end());
std::sort(T.begin(), T.end(), std::greater<char>());
std::cout << (S < T ? "Yes" : "No") << std::endl;
} | ALGO | 0.999994 | 5.603323 |
436ef842-76b9-4c5c-a49e-c449fe55fc1f | chrisotto6/cps212 | Week2/Week2/Week2.cpp | // Week2.cpp : main project file.
// Chris Otto - Week 2 - CPS212
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
// Function prototypes
int lowestNumber(int [], int);
int largestNumber(int [], int);
int totalOfNumbers(int [], int);
int averageOfNumbers(int, int);
in... | TOOL | 0.959987 | 3.90658 |
014be974-ee69-4e3a-8a3c-fe99b4c84ece | bhawnajoshi1304/DSA | DP old/004_count_of_subsets_with_given_sum.cpp | #include <bits/stdc++.h>
using namespace std;
// Given an array and a sum count the number of subsets with a given sum.
// Multiple subsets can contain same element
// Assuming a array of 6 elememts and given a sum 10
// Count 3 : [{2,8}, {2,3,5}, {10}]
// arr | 0 1 2 3 4 5 6 7 8 9 10 - sum
// | - - - - - - - - - -... | ALGO | 0.999971 | 5.237232 |
b9069b9d-3edd-41f2-8458-e2c6827a6f0d | ishandutta2007/codeforces | aghatizi/normal/1076/G.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define bit(a , b) (((a)>>(b))&1)
#define int ll
const int maxn = 2e5 + 20;
const int maxm = 5;
struct node
{
int sz , dp[1 << maxm][2] , lazy;
node()
{
memset(dp , 0 , sizeof dp);
sz = 0;
lazy = 0;
}
};
node seg[maxn *... | ALGO | 0.999868 | 4.385383 |
8332b78c-5d43-448d-9711-457b411fe215 | Rainmaker2627/cp-solutions | cses/graph algorithms/shortest_routes_I.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> plli;
const ll inf = 1e18;
int n, m;
ll p[100000];
vector<pair<int, int>> e[100000];
int main() {
cin.tie(0)->sync_with_stdio(false);
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int a, b, c;
cin >> a >> b >> c;
e[a-1].... | ALGO | 0.999978 | 4.106281 |
049ebf38-a906-4f65-b24b-2cd309a7f9b3 | PTR-projects/PTR_GroundStation_firmware | src/GNSS.cpp | #include "Arduino.h"
#include <math.h>
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#include <MicroNMEA.h>
#include "BOARD.h"
#include "GNSS.h"
//------ GNSS -------------
SFE_UBLOX_GNSS myGNSS;
char nmeaBuffer[100];
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
//----- Global vars --------
float myLat = 0... | TOOL | 0.880395 | 5.292163 |
a4dd394d-e4d1-4cca-a531-b33accf45695 | Manav0111/week2-DP1-CipherSchools | video16/minimumnoofswapstomakestringbalance.cpp | #include<bits/stdc++.h>
using namespace std;
int minSwaps(string s)
{
int n = s.length();
stack<char> st;
for(int i=0; i<n; i++)
{
if(s[i] == '[')
st.push(s[i]);
else
{
if(!st.empty() && st.top() == '[')
st.pop();
else
st.push(s[i]);
}
}
int m = st.size();
int n1 = 0;... | ALGO | 0.999529 | 4.075148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.