uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b6ab217f-22e0-44d1-9706-40bfc3578ce3 | NighthawkCode/node | src/nodelib.cpp | #include "node/nodelib.h"
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <ifaddrs.h>
#include <libexplain/libexplain.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <poll.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include... | WEB | 0.927828 | 3.914865 |
20e3c9ff-a479-4a1f-968f-7acf6c61ee9e | ishandutta2007/codeforces | yuu/normal/1706/B.cpp | #include <bits/stdc++.h>
using namespace std;
// clang-format off
namespace { // forbidden c++
// must be an operator that execute from left to right to make sense.
// need concept to use <<, >>, so we use | for now
#define PREFERED_OPERATOR operator|
enum general_operation_t {REVERSE, };
enum comparable_operation_t {... | ALGO | 0.999967 | 4.641653 |
86166028-a4ad-4e28-85b5-fb1595e992b1 | eloqdata/eloqdoc | src/mongo/util/text.cpp | // text.cpp
#include "mongo/platform/basic.h"
#include "mongo/util/text.h"
#include <boost/integer_traits.hpp>
#include <errno.h>
#include <iostream>
#include <memory>
#include <sstream>
#ifdef _WIN32
#include <io.h>
#endif
#include "mongo/platform/basic.h"
#include "mongo/util/allocator.h"
#include "mongo/util/mo... | TOOL | 0.967677 | 6.478142 |
6c8ba25e-e83d-47aa-b661-cbf4721bfc6d | Rahi-Ahmed/Competitive-Programming | Phase_00/Even_Number.cpp | #include<iostream>
using namespace std;
int main()
{
int n; cin >> n;
if(n > 1){
for(int i = 1; i <= n; i++){
if(i % 2 == 0){
cout << i << endl;
}
}
}else{
cout << -1 << endl;
}
}
| ALGO | 0.999902 | 4.481267 |
95c82bd1-fd9a-49f4-9ec9-1748457c0493 | yssgood/LeetCode-Premium | 1306-jump-game-iii/1306-jump-game-iii.cpp | class Solution {
public:
bool canReach(vector<int>& arr, int start) {
queue<int> q;
q.push(start);
vector<bool> visited(arr.size(),false);
while(!q.empty()){
int size = q.size();
for(int i = 0; i < size; i++){
int curr = q.front();
... | ALGO | 0.999991 | 5.550804 |
da4736bf-1873-464a-9f50-51f86730675e | divyapitta04/DBMS_Loader | updater.cpp | #include "header.h"
#include <iostream>
#include <pqxx/transaction.hxx>
#include <string>
#include <map>
typedef struct Authorname {
std::string fname;
std::string mname;
std::string lname;
bool operator<(const Authorname& smk) const
{
if (fname < smk.fname)
{
return true;
}... | TOOL | 0.867765 | 3.970062 |
8a8e8a81-d3fb-4e7e-ba85-e6c3581535ee | Sagar-Mondal/GFG-POTD | Difficulty: Medium/Longest Bounded-Difference Subarray/longest-bounded-difference-subarray.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> longestSubarray(vector<int>& nums, int limit) {
deque<int>dec,inc;
int n = nums.size();
int left = 0,right = 0;
// int ans = 0;
vector<int>ans... | ALGO | 0.99985 | 5.383574 |
79131a91-e1c9-4d5e-b6e9-940a6dff33bf | cordercorder/HDUOJ | 2191多重背包.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<deque>
#include<limits.h>
#include<bitset>
#include<ctime>
#define deb(x) cout<<"#---"<<#x<<"=="<<x<<endl
u... | ALGO | 0.999748 | 3.234016 |
7c9a8016-5995-46e0-b6a1-3ae8456accf6 | asdpresence/bustub_cmu15445 | third_party/libfort/examples/9-non_ascii_table.cpp | #include <algorithm>
#include <iostream>
#include <string.h>
#include "fort.hpp"
#if defined(FT_HAVE_UTF8)
/* Custom function to compute visible width of utf8 strings */
int u8strwid(const void *beg, const void *end, size_t *width)
{
const char *emojis[] = {"😃", "😍"};
const size_t sz = sizeof(emojis) / size... | TOOL | 0.890184 | 6.193584 |
3b369506-6151-4ac6-92e3-bb150c4ef509 | viraajp-ops/DSA | Mutable.cpp | #include<bits/stdc++.h>
using namespace std;
class NumArray{
public:
vector<int>a;
vector<int>tree;
int n;
NumArray(vector<int>nums){
a=nums;
n=nums.size();
tree.resize(4*n);
build(0,n-1,1);
}
void build(int first,int last,int node){
if (first==last){
... | ALGO | 0.999871 | 3.98774 |
f1803820-f618-46f0-afea-f111a3abf6d6 | ishandutta2007/codeforces | strawberryc/normal/1464/A.cpp | #include <bits/stdc++.h>
template <class T>
inline void read(T &res) {
res = 0; bool bo = 0; char c;
while (((c = getchar()) < '0' || c > '9') && c != '-');
if (c == '-') bo = 1; else res = c - 48;
while ((c = getchar()) >= '0' && c <= '9')
res = (res << 3) + (res << 1) + (c - 48);
if (bo) res = ~res + 1... | ALGO | 0.99996 | 4.989203 |
ab6cfdd1-c41e-47e4-b8c6-01895b88d838 | juribeparada/MMDVM_CM | NXDN2DMR/NXDNConvolution.cpp | #include "NXDNConvolution.h"
#include <cstdio>
#include <cassert>
#include <cstring>
#include <cstdlib>
const unsigned char BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7... | ALGO | 0.99874 | 4.917785 |
dcc54823-d09d-45d1-8980-96f433563346 | ducvu25/OOP-Cpp | struct co ban/10.cpp | #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int UCLN(int a, int b){
if(b == 0) return a;
return UCLN(b, a%b);
}
struct PhanSo {
int tu, mau;
};
void RutGon(PhanSo &x){
int ucln = UCLN(x.tu, x.mau);
x.tu /= ucln;
x.mau /= ucln;
}
PhanSo Nhap(){
PhanSo x;
ch... | ALGO | 0.999002 | 3.172478 |
c2bcdc59-8b38-45b0-bd46-c8f0c29e5d77 | Raghunandan16/Codes | topologicalSort.cpp | // https://practice.geeksforgeeks.org/problems/topological-sort/1
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
void dfs(int node, vector<int> adj[], vector<int> &vis, stack<int> &st)
{
vis[node] = 1;
for (auto it : adj[node]... | ALGO | 0.999931 | 6.799043 |
34efc5ec-637e-45c6-bf1e-c3baf2faa36f | sarum9in/lab_neuro | StochasticSupervisor.cpp | #include "StochasticSupervisor.hpp"
#include "Random.hpp"
#include "RandomSupervisor.hpp"
#include <QDebug>
#include <QCoreApplication>
namespace
{
qreal getError(const NeuralNetwork &neuralNetwork, const TrainingExample &example)
{
qreal e = 0;
const DataVector output = neuralNetwork.transfo... | ALGO | 0.870537 | 5.35237 |
fc483934-6002-489b-9b9e-7d78fd53a11e | ruturajlaad/Maths_Hackerrank | Handshakes.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
*The logic used here is pretty simple
*We just have to take summation of n-1 numbers.
*For eg:= There are n=7 people,then
* Handshakes will be Σ(n-1) i.e Σ(6)
* (1+2+3+4+5+6)=21(an... | ALGO | 0.999922 | 6.518094 |
b8905dab-4117-4362-a52a-29844fc79c7e | NavdeepKaurRupaul/IP-DSA | 13 TREES/Replace node with depth.cpp | template <typename T>
class TreeNode {
TreeNode<T>** children;
int childCount;
int maxChildCount;
public:
T data;
TreeNode(T data) {
this->data = data;
childCount = 0;
children = new TreeNode<T>*[10];
maxChildCount = 10;
}
int numChildren() {
return childCount;
}
void a... | ALGO | 0.999824 | 4.741285 |
76fc50d5-369a-4dc0-9c51-ae3cc5ba95a9 | S-K-Siva/geeksforgeeks_problem_solving | POTD/14Oct2024.cpp | class Solution {
public:
// Function to count nodes of a linked list.
int getCount(struct Node* head) {
int hs = 0;
while(head){
++hs;
head = head->next;
}
return hs;
}
};
| ALGO | 0.999438 | 4.253815 |
f9f4223f-7b65-4de7-b212-e919708075fc | ishandutta2007/codeforces | tute7627/normal/1687/A.cpp | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#... | ALGO | 0.999938 | 3.725247 |
1c5bb570-78ba-487f-862d-c81a9f994ee6 | yjm6560/BOJ | 1915/1915.cpp | /*
가장 큰 정사각형
DP
난이도 2.5
*/
#include <iostream>
#include <string.h>
#include <vector>
#define MAX 1000
using namespace std;
vector<string> board;
int n, m, dp[MAX][MAX];
int dx[3] = {1, 0, 1};
int dy[3] = {0, 1, 1};
const int INF = 987654321;
int solve(int x, int y){
if(dp[x][y])
return dp[x][y];
dp[x][y] = INF... | ALGO | 0.999653 | 3.807644 |
8706a5c1-53fc-4c50-a3b2-b0bcb58e0643 | KhannaGaming/FMP | C++ - FMP/opencv/sources/3rdparty/openexr/Imath/ImathRandom.cpp | //-----------------------------------------------------------------------------
//
// Routines that generate pseudo-random numbers compatible
// with the standard erand48(), nrand48(), etc. functions.
//
//-----------------------------------------------------------------------------
#include "ImathRandom.h"
#include "... | ALGO | 0.990713 | 5.358109 |
133c06b5-ca4d-4678-97bb-74fc7142423b | BruceLeesungho/Algorithm | 2342.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int DP[100001][5][5];
int mp[5][5] =
{
{0,2,2,2,2},
{0,1,3,4,3},
{0,3,1,3,4},
{0,4,3,1,3},
{0,3,4,3,1}
};
int main(void)
{
int n = 1;
int s = 1;
for (int k = 0; k... | ALGO | 0.99999 | 3.806543 |
84c929d1-4664-4681-ac43-7a41aa11f49e | Irfan-Ali01/Data-Structure-Labs | lab11_2.cpp | #include <iostream>
using namespace std;
void bubbleSort(int arr[], int size){
for (int i = 0; i < size - 1; i ++){
for (int j = 0; j < size - i - 1; j++){
if (arr[j] < arr[j + 1]){
swap (arr[j], arr[j+ 1]);
}
}
}
}
void print(int arr[], int size){
f... | ALGO | 0.999551 | 5.578017 |
c4b0c306-8f30-4160-b57f-fcb978f5d60d | Rlfxo/Algorithms | Study/2024/240907/28279/main.cpp | #include <iostream>
#include <deque>
#include <fstream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin.exceptions(ios::failbit);
fstream fin("input.txt", ios::in);
deque<int> d;
int N;
fin >> N;
for (int i = 0; i < N; i++)
{
int cmd;
... | ALGO | 0.998184 | 4.612633 |
18a8ea7e-cea2-467a-8115-e5be7e9bb1e8 | GabD-S/Desafios-C99-Cpp | CodeForces/div_4(2)/d.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
vector<pair<long long, long long>> arr_info;
long long total_internal = 0;
for (int i = 0; i < n; i++) {
long long s = 0, internal = 0;... | ALGO | 0.999848 | 4.292392 |
10b42b1a-3d19-4bd1-b260-090172b8d9ca | heavenMOJANG/ICPC | .history/programmes_C_Cpp/Codeforces/CF2114/B_20250530111304.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int n, k; cin >> n >> k;
string s; cin >> s;
vector<int> cnt(2, 0);
for (int i{}; i < n; ++ i) cnt... | ALGO | 0.999992 | 5.505588 |
9c3456fb-2822-4fd3-837f-9d7b885cfb4b | melodist/CodingPractice | src/programmers/MCCS1_Quad Compress.cpp | """
https://programmers.co.kr/learn/courses/30/lessons/68936
Using divide and conquer
"""
#include <string>
#include <vector>
using namespace std;
pair<int, int> func(int r_s, int r_e, int c_s, int c_e, vector<vector<int>> &arr) {
if (r_s == r_e) {
if (arr[r_s][c_s] == 0) {
return make_pai... | ALGO | 0.999747 | 4.979697 |
09cfac98-791a-44fc-9909-b745704871f1 | seunghye218/problem-solving | 프로그래머스/0/181898. 가까운 1 찾기/가까운 1 찾기.cpp | #include <vector>
using namespace std;
int solution(vector<int> arr, int idx) {
int answer = idx;
for (; idx < arr.size() && !arr[idx]; ++idx);
return idx == arr.size() ? -1 : idx;
} | ALGO | 0.998966 | 5.331916 |
535191c3-0647-4e52-9af7-d5306d1b30da | mahdizahin/Computer-graphics | Open code/Additional Codes/fanwithlight.cpp | #include <GL/glut.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
#define CTRL_COUNT 100
float _angle = 0.0;
float _cameraAngle = 0.0;
float _ang_tri = 0.0;
float _angle_2 = 90;
float i = 0.0f;
int ctrlPointsCount;
int ctrlPointsX[CTRL_COUNT], ctrlPointsY[CTRL_COUNT];
int X1[3]={0.0... | ALGO | 0.989198 | 4.107039 |
f9182f7e-bd6c-483c-a010-271117b3e0ec | Abhinav-Chdhary/strivers-sde-sheet-challenge-2023 | Arrays-4/SubarraysWithXOR.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
// Brute force approach
int subarraysXorBruteForce(vector<int> &arr, int x)
{
int cnt = 0, n = arr.size();
for (int i = 0; i < n; i++)
{
int mask = 0;
for (int j = i; j < n; j++)
{
mask =... | ALGO | 0.999911 | 6.086526 |
fab3bcf8-bffe-4652-a220-5212c353df57 | dashjim/learnCocosSamples | frameworks/cocos2d-x/cocos/platform/winrt/sha1.cpp | #include "sha1.h"
/*
* Define the SHA1 circular left shift macro
*/
#define SHA1CircularShift(bits,word) \
(((word) << (bits)) | ((word) >> (32-(bits))))
/* Local Function Prototyptes */
void SHA1PadMessage(SHA1Context *);
void SHA1ProcessMessageBlock(SHA1Context *);
/*
* SHA1Reset
*
* Descri... | ALGO | 0.986074 | 7.002469 |
c85e8308-ed7b-4c8e-bec1-c6384012d76a | juanjuanShu/apriori | apriori.cpp | // apriori.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
// ConsoleApplication1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <set>
#include <vector>
#include <fstream>
#include<algorithm>
#include <unordered_map>
#include <map>
#include "trie.h"
#include <string>
#include <sstream>
#include <chrono>... | ALGO | 0.997321 | 3.043517 |
c6898a60-ba3e-4e56-bf3b-809bbb5a218a | hal-uw/gpu_variability_sc22_artifact | sec5c_lammps/src/USER-OMP/thr_data.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
per-thread data management for LAMMPS
------------------------------------------------------------------------- */
#include "thr_data.h"
#include <string.h>
#include <stdio.h>
#include "memo... | TOOL | 0.964439 | 6.665342 |
7b1de61b-f9e1-461c-bd57-0cb71dc2bc74 | Adii-Khandelwal/LeetCode-Solutions | 0809-expressive-words/0809-expressive-words.cpp | class Solution {
public:
int expressiveWords(string s, vector<string>& words) {
int res=0;
for(auto &w:words)
if(w.size()<=s.size())
{ int i,j;
for(i=0, j=0;j<s.size();j++)
{
if(w[i]==s[j])
i++;
... | ALGO | 0.999955 | 5.9956 |
5e08da86-77a4-46d5-b818-e7a8f1e11fe0 | Neelothpal/DSA-Notes | Arrays/single number.cpp | //Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space.
class Solution {
public:
int singleNumber(vector<int>& nums) {
int x = 0;
for(auto i :nums)... | ALGO | 0.999462 | 5.597424 |
8d2c4dfe-97c2-456a-b311-795896e6b86b | raxvab/Practice-questions | bit strings.cpp | //search for RAXVAB once
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define li long int
#define fi first
#define se second
#define pop _builtin_popcount
#define ve vector<ll>
#define mp make_pair
#define pr pair<ll, ll>
#define rep(i, n) for (ll i = 0; i < n; i++)
#defin... | ALGO | 0.999974 | 3.890705 |
ee6d988b-3c15-4668-b340-a2bc5c7f410a | anilmeran09/CppCode | ArraySum.cpp | #include<iostream>
using namespace std;
int main()
{
int n,i,sum=0;
int a[10];
cout<<"Enter the Value of n->";
cin>>n;
for(i=0; i<n; i++)
{
cin>>a[i];
}
for(i=0; i<n; i++){
sum=a[i]+sum;
}
cout<<"Sum is: "<<sum<<endl;
}
| ALGO | 0.997747 | 3.121547 |
ff1e9102-1c7b-4543-8c8d-e60771f31dde | tonyz74/CompetitiveProgramming | Problems/USACO/Bronze/JustStalling.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long i64;
int n_lteq(const vector<i64>& vec, i64 val) {
int x = 0;
for (int i = 0; i < (int) vec.size(); i++) {
if (vec[i] <= val) x++;
}
return x;
}
int main(void) {
int N; cin >> N;
vecto... | ALGO | 0.999894 | 3.805931 |
e01d39d2-4014-447b-87ee-181f7b4606cc | cthbst/Competitive-Programming | zerojudge/a289.cpp | #include<stdio.h>
int main(){
int dp[30][3] ;
dp[0][1]=1 ;dp[0][2]=0 ;
dp[1][1]=0 ;dp[1][2]=1 ;
while (~scanf("%d%d",&dp[0][0] ,&dp[1][0]) ){
int t=2 ;
while (1){
int d=dp[t-2][0]/dp[t-1][0] ;
dp[t][0]=dp[t-2][0]%dp[t-1][0] ;
dp[t][1]=dp[t-2][1]-d*dp... | ALGO | 0.99998 | 3.139037 |
3798eab7-af18-4cad-8f94-b7aeabe94cb2 | amitsvg/Leetcode-submissions | 0054-spiral-matrix/0054-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> ans;
int r1=0,r2=matrix.size() - 1;
int c1=0, c2 = matrix[0].size() - 1;
while(r1 <= r2 && c1 <= c2){
//move left
for(int i=c1; i<=c2; i++){
... | ALGO | 0.999998 | 6.283783 |
de2cad52-0f17-4216-bcc1-082bb4f908e3 | Saber7X/DaiMaDaQuan | T179699 找横.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int num[100]={0};
num[1]=1;
num[2]=1;
num[4]=1;
num[5]=1;
num[7]=1;
cin>>n;
while(n--)
{
string s;
cin>>s;
int cnt=0;
for(int i=0;i<s.length();i++)
{
int m=(s[i]-'0');
cnt+=num[m];
}
cout<<cnt<<endl;
}
return 0;
}
| ALGO | 0.999849 | 4.105855 |
113287fe-4449-4836-9cea-27d163e26054 | NayeemHR/DSA_Lab | das2_lab/FinalCode/GreedySearch/jobsequencing.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
// Structure to represent a job
struct Job {
int id; // Job ID
int profit; // Profit for completing the job
int deadline;// Deadline by which the job must be completed
};
// Comparator function to sort jobs by profit in... | ALGO | 0.999998 | 6.835183 |
98c0016b-6d42-437e-a7a7-50738f74dcd2 | nikz9/skycast | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
9adcf46b-0bf1-43da-bac0-311129a84424 | Jikky1618/AtCoder | ABC/ABC050-099/ABC091/b.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
int N;
cin >> N;
vector<string> s(N);
for(int i = 0; i < N; i++) cin >> s[i];
int M;
cin >> M;
vector<string> t(M);
... | ALGO | 0.999973 | 5.064197 |
f4564ee0-0ed4-44bc-895e-ba938aeff3f3 | shohansk/codeforces | 236 A. Boy or Girl.cpp | #include <iostream>
#include<bits/stdc++.h>
#include <string>
using namespace std;
int main()
{
string s;
int n=0;
cin>>s;
sort(s.begin(),s.end());
for(int i=0;i<s.size();i++)
{
if(s[i]!=s[i+1])
{
n++;
}
}
if(n%2==0)
{
cout<<"CHAT WITH HER... | ALGO | 0.999906 | 3.785791 |
f3ffad84-7f90-4119-ae2a-5c5fa5242c5a | Autumnal-Joy/leetcode | 1001-2000/1955/main.cpp | #include <bits/stdc++.h>
using namespace std;
static auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
return 0;
}();
#ifdef LEETCODE
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
explicit TreeNode(const int x) : val(x), left(nullptr), right(nullptr) {}
};
TreeN... | ALGO | 0.999989 | 5.618633 |
31b6b97d-945e-4815-a407-5abb7c79eff9 | imulan/procon | yukicoder/216.cpp | #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
using namespace std;
typedef l... | ALGO | 0.999789 | 3.398238 |
3ee7e3d1-8795-43c6-b130-072ee85e190b | rt3310/algorithm | baekjoon/14466.cpp | #include <iostream>
#include <deque>
using namespace std;
int n, k, r;
int land[101][101];
int cows[101][2];
char path[101][101];
char visited[101][101];
constexpr int d[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
constexpr int U = 1, D = 2, L = 3, R = 4;
int order = 1;
int result = 0;
void search() {
deque<pair<... | ALGO | 0.999877 | 3.833818 |
e1a2b2b8-cb6f-441b-936f-27971e589f0a | cbennett94/KnightsTour | KnightsTour/KnightsTour/board.cpp | #include "board.h"
Board::Board(int x, int y)
{
cur = 1;
rows = x;
cols = y;
spaces = new int* [rows];
for (int i = 0; i < rows; i++)
{
spaces[i] = new int[cols];
}
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
spaces[i][j] = -1;
}
}
}
void Board::reset()
{
cur = 1;
for (int... | ALGO | 0.98545 | 4.934757 |
1c7bc2c9-4ac3-4274-84cb-20bc6c17c2c6 | arihantJ24/DSA-with-Arih | 2306-create-binary-tree-from-descriptions/create-binary-tree-from-descriptions.cpp | class Solution {
public:
TreeNode* createBinaryTree(vector<vector<int>>& descriptions) {
unordered_map<int,TreeNode*>mp;
unordered_set<int>childVal;
for(vector<int> & v : descriptions){
int parent = v[0];
int child = v[1];
int isLeft = v[2];
... | ALGO | 0.999926 | 6.653883 |
794af71f-988a-4172-ac8c-51b3b083ff0e | violetDelia/test_and_practice | c/Leecode/530. 二叉搜索树的最小绝对差.cpp | #include <iostream>
#include <vector>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(... | ALGO | 0.999966 | 5.797221 |
137cab22-bd6b-40e8-bc48-a5c750afb159 | luismoax/Competitive-Programming---luismo | CSES/Graph Algorithms/Message Route.cpp | /*
Author: Luis Manuel Díaz Barón (LUISMO)
Problem: Message Route
Link: https://cses.fi/problemset/task/1667/
Online Judge: CSES
Idea: BFS. Basic implementation of a BFS.
*/
#include<bits/stdc++.h>
// Types
#define ll long long
#define i64 unsigned long long
#define ld long double
// IO
#define sf scanf
#define pf... | ALGO | 0.999968 | 4.172301 |
ebbc4517-fbf4-4d09-9502-b1ccc2b1c537 | S-Mazigh/painless | libs/eigen-3.4.0/unsupported/test/levenberg_marquardt.cpp | // FIXME: These tests all check for hard-coded values. Ideally, parameters and start estimates should be randomized.
#include <stdio.h>
#include "main.h"
#include <unsupported/Eigen/LevenbergMarquardt>
// This disables some useless Warnings on MSVC.
// It is intended to be done for this test only.
#include <Eigen/sr... | TEST | 0.852527 | 6.978281 |
808b803c-4b9f-4c96-9cf5-4697fa0bab88 | lucas-daher/desafios | CF/551/D.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll leafs = 0;
void calc(ll pos, unordered_map<ll, vector<ll>>& kids, vector<ll>& parents, vector<int>& nodes, vector<ll>& ord) {
if (ord[pos] != -1) return;
if (kids.find(pos) == kids.end()) {
leafs++;
ord[pos] = 1;
re... | ALGO | 0.999857 | 4.04951 |
51985801-4307-47dc-8dba-21ad9c226a63 | ARNOB663/LeetCode-Solutions | 1. Two Sum/using_sorting.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
vector<int> targetIndices(vector<int>& nums, int target) {
vector<pair<int, int>> numWithIndex;
for (int i = 0; i < nums.size(); i++) {
numWithIndex.push_back({n... | ALGO | 0.99998 | 6.453382 |
e6cdc6e2-b3c2-457f-8d0b-2899505166a6 | pepepper/llvm-temple | llvm/lib/MC/MCCodeView.cpp | #include "llvm/MC/MCCodeView.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC... | TOOL | 0.854072 | 7.253677 |
41cd0c86-14e7-42c9-abeb-411363422281 | jwGitHub9860/Lidar_Obstacle_Detection | src/quiz/ransac/ransac2d.cpp | /* \author Aaron Brown */
// Quiz on implementing simple RANSAC line fitting
#include "../../render/render.h"
#include <unordered_set>
#include "../../processPointClouds.h"
// using templates for processPointClouds so also include .cpp to help linker
#include "../../processPointClouds.cpp"
pcl::PointCloud<pcl::PointX... | ALGO | 0.987822 | 6.268219 |
d6a94b21-1cd9-4b3a-94cd-075185e8b22c | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/CodeLlama/top0-100/maximize-the-minimum-powered-city-Solution.maxPower/177865_DoS.cpp | PatternMatch(char *pat, int patdashes, char *string, int stringdashes)
{
char c,
t;
if (stringdashes < patdashes)
return 0;
for (;;) {
switch (c = *pat++) {
case '*':
if (!(c = *pat++))
return 1;
if (c == XK_minus) {
patdashes--;
for (;;) {
while ((t = *strin... | ALGO | 0.999123 | 4.528219 |
b1f7c924-b5c7-4eda-b3b4-26fa49a15384 | sohardforaname/ACM_ICPC_practice | Gym/101630/101630B.cpp | #include <bits/stdc++.h>
using namespace std;
int check(int a, int b, int c, int w, int h)
{
if (2 * a + 2 * c <= w && 2 * a + b <= h || 2 * a + 2 * c <= h && 2 * a + b <= w)
return 1;
else if (a + b + c <= w && 2 * a + b + c <= h || a + b + c <= h && 2 * a + b + c <= w)
return 1;
else if (a... | ALGO | 0.999942 | 3.50439 |
0b5e3c08-43a1-4168-a88a-1037a157187e | Soham210104/Codes | Revision/Array/MaximumSubarrayProduct.cpp | class Solution{
public:
// Function to find maximum product subarray
long long maxProduct(vector<int> arr, int n) {
// code here
if(n==1) return arr[0];
long long product = 1;
long long maxP = INT_MIN;
for(int i=0;i<n;i++){
product = 1;
for(int j=i;j<n;j++){
... | ALGO | 0.999992 | 5.933024 |
48f3a55a-4748-4990-be88-e1b675cdfb09 | Zu-rin/yukicoder | 0110.cpp | #include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30
using namespace std;
... | ALGO | 0.999955 | 3.727538 |
7e89e347-b468-407b-ad3a-084759d247e3 | lineagech/LintCode | Flip_String_to_Monotone_Increasing.cpp | class Solution {
public:
int minFlipsMonoIncr(string S) {
int n = S.size();
vector<vector<int>> dp(2, vector<int>(n, INT_MAX));
if( n == 0 ) return 0;
if( S[0]=='0' ) {
dp[0][0] = 0;
dp[1][0] = 1;
}
else {
dp[0][0] = 1;
... | ALGO | 0.999969 | 6.207514 |
a1c144f1-8ac1-4ef1-8203-8ecc8f45ff1f | tfysekis/data-structures | Ordered_Array.cpp |
#include <iostream>
#include "Ordered_Array.h"
using namespace std;
#include <ctime>
#include <ratio>
#include <chrono>
#include <fstream>
using namespace std::chrono;
Ordered_Array::Ordered_Array(long num) : Unordered_Array(num) {
orarr = new string[getN()];
}
/**
* Εναλλαγή δυο στοιχείων του πίνακα
* @pa... | ALGO | 0.997348 | 4.271284 |
eb57600d-eadd-4ff9-92a2-e32b2cdaa5c8 | sif69/codeforces-solution-by-sif_69 | codeforces/1878/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lg long long
#define fi(i,L,R) for (ll i = L ; i <= R ; i++)
#define fd(i,R,L) for (ll i = R ; i >= L ; i--)
#define s1 string
#define p_b push_back
#define st(n) sort(a,a+n)
#define rev reverse(a,a+n)... | ALGO | 0.999574 | 3.710711 |
c1e736ed-abfc-4d10-879c-86c2dbca3a46 | Rhee-site/Programmers-Algorithm | lv2_스킬트리.cpp | #include <string>
#include <vector>
using namespace std;
int solution(string skill, vector<string> skill_trees) {
int answer = 0;
for(int index = 0; index < skill_trees.size(); index++){
string strTarget = skill_trees[index];
string strResult;
int nLastOrder = 0;
... | ALGO | 0.999909 | 5.066327 |
060900f3-56ce-46ea-bb12-a8532bc12925 | dushimsam/deep-dive-into-algorithms | graph-pheory/graph-traversal/applications/connectivity_check.cpp | #include <bits/stdc++.h>
using namespace std;
/***
* APPROACH
* 1. Apply Depth search that visits all the nodes of the graph
* Then if one of the nodes is found not have been visited
* it means that the graph is not strong ly connnected.
*
***/
class Graph
{
vector<bool> visited;
int n;
... | ALGO | 0.999931 | 5.574116 |
b8281373-fa96-4892-b9d7-f5b665f9423e | yadzhang/boost | libs/thread/example/fib_task_region.cpp | #include <boost/config.hpp>
#if ! defined BOOST_NO_CXX11_DECLTYPE
#define BOOST_RESULT_OF_USE_DECLTYPE
#endif
#define BOOST_THREAD_VERSION 4
#define BOOST_THREAD_PROVIDES_EXECUTORS
#include <boost/thread/experimental/task_region.hpp>
#include <iostream>
#if ! defined BOOST_NO_CXX11_RANGE_BASED_FOR && ! defined BOO... | ALGO | 0.984165 | 6.389928 |
f3e62831-2351-4074-a560-abcc9ee025e9 | Shubhams-2002/SdeSheet | BinarySearchTrees/recover-BST-after-2nodes-got-swapped.cpp | #include<bits/stdc++.h>
class Solution {
TreeNode* prev=NULL;
TreeNode* first=NULL;
TreeNode* second=NULL;
TreeNode* last=NULL;
public:
void inorder(TreeNode* root) {
if(!root) return;
inorder(root->left);
if(prev && prev->val > root->val) {
... | ALGO | 0.999996 | 5.994451 |
ce834532-6923-468c-be0c-20d2eac74a36 | ciakpey/MediaSniffer | linux_gui/entry.cpp | #include "../MediaSniffer/MediaSniffer.h"
#include "configdlg.h"
#include "update.h"
#include "uicommon.h"
#include <gdk/gdkkeysyms.h>
#include <stdlib.h>
#include <string>
using namespace std;
#define DATADIR PREFIX"/share"
#define LIBDIR PREFIX"/lib"
#define SYSCONFDIR PREFIX"/etc"
#define DLG_TITLE "Media Sniffe... | TOOL | 0.970991 | 5.546305 |
e7a40db7-e752-4edc-b9cc-5dda937c2f8f | ishandutta2007/codeforces | shoemakerjo/normal/886/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int sum = 0;
int nums[6];
for (int i = 0; i < 6; i++) {
cin >> nums[i];
sum += nums[i];
}
bool ok = false;
for (int i = 0; i < 6; i++) {
for (int j = i+1; j < 6; j++) {
for (int k = j+1; k < ... | ALGO | 0.999624 | 3.597053 |
a3b0e26a-b9ca-4980-ad50-d251db89d811 | YuanyaoZHU/AbaqusDll_vs_2022 | eigen-3.4.0/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.999614 | 4.531452 |
a612a5ac-412c-40e7-a37f-7633f285d897 | COPEL-BigData/opencv_contrib | modules/bioinspired/samples/cpp/OpenEXRimages_HDR_Retina_toneMapping_video.cpp | #include <iostream>
#include <stdio.h>
#include <cstring>
#include "opencv2/bioinspired.hpp" // retina based algorithms
#include "opencv2/imgproc.hpp" // cvCvtcolor function
#include "opencv2/highgui.hpp" // display
#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
static void help(std::string ... | TOOL | 0.852344 | 5.074901 |
f2a1177c-96f2-469a-afb1-0909a0d43e6c | agodin3z/dlp2017 | ExPractico_01/PlanoCartesiano.cpp | /* Author: agodin3z */
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(){
double x, y;
cout << "Programa para conocer la ubicacion de un punto en el plano cartesiano\n";
cout << "Ingrese el valor de X: ";
cin >> x;
cout << "Ingrese el valor de Y: ";
cin >> y;
if (x > 0 && y > 0){
cout... | ALGO | 0.997343 | 3.896285 |
724a4cac-b83d-42a5-89e3-78c06b508960 | MartinFabianIonut/University | Year 3/Parallel and Distributed Programming/Laboratory 2 in Class/Laboratory2.cpp | #include <iostream>
#include <thread>
#include <random>
#include <chrono>
using namespace std;
void sumArrays(int *a, int *b, int *c, int start, int end)
{
for (int i = start; i < end; i++)
{
c[i] = a[i] + b[i];
}
}
void sumCyclicArray(int id, int *a, int *b, int *c, int n, int p)
{
for (int i... | ALGO | 0.998708 | 4.026667 |
ed2a4b94-3763-4757-8aaa-a54666ee8bc7 | Android4SAM/platform_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/cbsearch.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/cbsearch.c
Functions: D_plsf_3
Date: 01/31/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description:
(1) Removed "count.h" and "basic_op... | ALGO | 0.999987 | 6.068127 |
aadf7055-5af1-403b-9a80-c4672b7813c2 | rinkaaixu/2022c | 上學期/week13/week13-2.cpp | #include <stdio.h>
int a[50];
int main()
{
a[0]=0;
a[1]=1;
for (int i=2;i<45;i++)
{
a[i]=a[i-1]+a[i-2];
}
for (int i=0;i<45;i++)
{
printf("%d ",a[i]);
}
}
| ALGO | 0.999842 | 3.11538 |
6d0126d2-adea-42ac-91dc-e9f31687a453 | gitubanana/codetree-TILs | 240715/돌아가는 팔각 의자/rounding-eight-angle.cpp | #include <iostream>
enum e_space
{
NORTH = '0',
SOUTH
};
enum e_idx
{
UP = 0,
RIGHT = 2,
LEFT = 6
};
struct t_chair
{
static const int SIZE = 8;
int start;
char arr[SIZE + 1];
t_chair(void) : start(0) { }
inline void clockWise(void)
{
start = (start == 0 ? SIZE ... | ALGO | 0.999901 | 4.786065 |
34fb0168-5f69-45ad-8773-0d5fc7eb7966 | mehul02/Competitive-Programming | Codeforces Round #599 (Div. 2) by User mehul_02/B1 - Character Swap (Easy Version).cpp |
1243 B1 - Character Swap (Easy Version).cpp GNU C++17 Accepted
///==================================================///
///
/// Ir0nic_ ///
/// MEHUL BHUTALIA ///
/// Indian Institute Of Information Technology and Management,Gwalior. ///
///
///==================================================///
#include <bits/... | ALGO | 0.999972 | 4.632004 |
dcb0a19f-a096-4699-8b6d-f5a184f227b2 | LouisNguyen25/NGCP_Software_2021_2022 | opencv-master/3rdparty/carotene/src/convolution.cpp | #include "common.hpp"
#include "saturate_cast.hpp"
namespace CAROTENE_NS {
bool isConvolutionSupported(const Size2D &size, const Size2D &ksize,
BORDER_MODE border)
{
return isSupportedConfiguration() && size.width >= 8 &&
(border == BORDER_MODE_CONSTANT ||
border ==... | ALGO | 0.992198 | 6.337611 |
f1de8015-038b-48d6-bcaa-44e3e816f3e4 | yeohj0710/old-solutions | 02000s/2921.cpp | #include <stdio.h>
int main()
{
int n, sum = 0;
scanf("%d", &n);
for(int i=0; i<=n; i++)
for(int j=0; j<=i; j++) sum += i+j;
printf("%d", sum);
}
| ALGO | 0.999801 | 3.967804 |
19c9b66f-a962-4831-8bac-a0dbbd0544fd | CVliner/accelerating-cuda-with-concurrent-streams | mem_cpu_streams.cpp | #include <cstdint>
#include <iostream>
#include "helpers.cuh"
#include "encryption.cuh"
void encrypt_cpu(uint64_t * data, uint64_t num_entries,
uint64_t num_iters, bool parallel=true) {
#pragma omp parallel for if (parallel)
for (uint64_t entry = 0; entry < num_entries; entry++)
data... | ALGO | 0.998557 | 6.594262 |
ac0ac8ca-1372-4785-964a-59507c0260f9 | ZiyeTang/Data-Structure-Projects | mp_traversals/imageTraversal/BFS.cpp | #include <iterator>
#include <cmath>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include "../cs225/PNG.h"
#include "../Point.h"
#include "ImageTraversal.h"
#include "BFS.h"
using namespace cs225;
/**
* Initializes a breadth-first ImageTraversal on a given `png` image,
* starting at `star... | ALGO | 0.999388 | 4.074493 |
513458da-a8f7-4fda-8b58-f46e49d952c1 | IDA-TUBS/CC_LinkMonitor | thirdparty/boost_1_73_0/libs/graph/example/edge_basics.cpp | #include <boost/config.hpp>
#include <iostream>
#include <algorithm>
#include <boost/graph/adjacency_list.hpp>
using namespace std;
using namespace boost;
/*
Edge Basics
This example demonstrates the GGCL Edge interface
There is not much to the Edge interface. Basically just two
functions to access the sour... | ALGO | 0.994409 | 6.388031 |
608b2516-3336-48d0-8fd0-5797d235dc11 | koushik395/LeetCodeProblems | 0867-transpose-matrix/0867-transpose-matrix.cpp | class Solution {
public:
vector<vector<int>> transpose(vector<vector<int>>& matrix) {
int M = matrix.size(), N = matrix[0].size();
vector<vector<int>> B(N, vector<int>(M, 0));
for (int j = 0; j < N; j++)
for (int i = 0; i < M; i++)
B[j][i] = matrix[i][j];
... | ALGO | 0.999985 | 6.141887 |
4fbd2539-6281-4475-af9d-605d6f3913dd | QuietkidAniket/codeforces | level_1600/1843E.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF (int)1e18
#define f first
#define s second
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
void Solve()
{
int n,m; cin>> n>>m;
vector<pair<int,int>> a(m);
for(auto& x : a)cin>>x.f >> x.s;
int q; ci... | ALGO | 0.999931 | 4.472211 |
faad8681-84e7-4b42-bc6d-6d0972587da4 | ChromesDuzez/GameOfFifteen | GameOfFifteen/libraries/boost_1_81_0/libs/graph/example/boykov_kolmogorov-eg.cpp | #include <boost/config.hpp>
#include <iostream>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/boykov_kolmogorov_max_flow.hpp>
#include <boost/graph/read_dimacs.hpp>
#include <boost/graph/graph_utility.hpp>
// Use a DIMACS network flow file as stdin.
// boykov_kolmogorov-eg < max_flo... | ALGO | 0.99823 | 6.098911 |
b1004b68-af4b-4cdb-9f91-155f4ee8cc33 | yfliu017258/CPP_programs | Kattis/AC/simplearithmetic.cpp | #include<iostream>
using namespace std;
using ll = long long;
ll a, b, c;
ll floatPoint;
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cin >> a >> b >> c;
cout << a * b / c << '.';
floatPoint = (a * b % c);
for(int i = 0; i < 18; i++){
floatPoint *= 10;
cout << fl... | ALGO | 0.999952 | 3.725287 |
290fffb1-c23b-4dd0-9089-12e0966e37aa | DeepInMind12345/UEToonShading | Engine/Plugins/Experimental/GeometryCache/Source/GeometryCache/Private/FloatCompression.cpp | #include "FloatCompression.h"
#include "HuffmanTable.h"
#include "Serialization/BitReader.h"
#include "Serialization/BitWriter.h"
//#include "RequiredProgramMainCPPInclude.h"
DEFINE_LOG_CATEGORY_STATIC(LogBlankProgram, Log, All);
//IMPLEMENT_APPLICATION(BlankProgram, "BlankProgram");
/**
Move data to an 16 byte la... | TOOL | 0.871037 | 5.80117 |
0a2ffc39-e1f9-40f0-b496-4ab451ff54d4 | lacram/study | Baekjoon/save3/12852.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <set>
#define endl '\n'
#define INF 2000000000
using namespace std;
int n;
int dp[1000001];
int record[1000001];
void print() {... | ALGO | 0.999973 | 3.670961 |
b715471a-ee52-497b-80a4-68ddac440f88 | Leejunho/algorithm_dong-a | al21.cpp | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <iterator>
#define MOD 1000000007
using namespace std;
int tails[100001];
int t[200001];
int dp[100001];
const int Num = 100000;
int n;
std::vector<int> arr(n, 0);
void update(int i, int va... | ALGO | 0.999899 | 3.691199 |
e9a09114-6f8b-4f40-8ec8-32821326b3a3 | lyx9823/CodingNotes | Code/LeetCode/349. 两个数组的交集.cpp | class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
vector<int> nums_count(1000, 0);
unordered_set<int> nums_res;
for(int i=0; i<nums1.size(); i++) {
nums_count[nums1[i]]++;
}
for(int i=0; i<nums2.size(); i++) {
... | ALGO | 0.99991 | 5.62468 |
23e9dd27-6a7c-403a-847e-2ec0bdbfc152 | vjjaat63/NITW-Assingments | 8.cpp | #include<iostream>
using namespace std;
int perimeter(int l,int b)
{
return 2*(l+b);
}
int Area(int l, int b)
{
return l*b;
}
int main()
{
int l,b;
cout<<"Enter the length and breadth of rectangle : ";
cin>>l>>b;
int area = Area(l,b);
int peri = perimeter(l,b);
if(area>peri)
cout<<"Area is greater";
else if(peri>ar... | ALGO | 0.999441 | 3.717132 |
a35008c0-07b5-4423-8783-e087a1c9db94 | MineQihang/CQUACMChallenge2023 | code/F.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<string> a(n);
for(int i = 0; i < n; i ++) cin >> a[i];
int x0, y0, x, y;
cin >> x0 >> y0 >> x >> y;
x0 --, y0 --;
int x1 = x0, y1 = y0;
vector<int> ans;
set<int> st;
do {
int t = (a[x1][y1] - '0') * 10 + (a[(x1 + (... | ALGO | 0.999954 | 3.480862 |
180c57a0-98dd-4a1d-a911-818bf8627b27 | wuxiao889/bustub-2022 | src/optimizer/order_by_index_scan.cpp | #include <algorithm>
#include <memory>
#include "binder/bound_order_by.h"
#include "catalog/catalog.h"
#include "catalog/column.h"
#include "catalog/schema.h"
#include "common/exception.h"
#include "common/macros.h"
#include "execution/expressions/column_value_expression.h"
#include "execution/expressions/constant_val... | ALGO | 0.995584 | 7.500335 |
88187c7f-ecc9-492d-b371-6b946b82c759 | chirag24j/Codeforces | Question/B_Team_Composition_Programmers_and_Mathematicians.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
long long int a, b;
cin >> a >> b;
long long int sum = a + b;
long long int teams = floor(sum / 4);
if (a < teams)
cout << a << endl;
else if (b < teams)
... | ALGO | 0.999779 | 4.287524 |
1172dd0d-ebe9-4f19-b1e8-d5a10585aea7 | MarcoBertocco/ASD-C-PLUSPLUS | Strutture Dati/Tree/Algorithms/Exercises/maxHeap.cpp | #include <iostream>
#include <vector>
using namespace std;
void max_heapify(vector<int> &A, int heap_size, int i) // T(n) = O(h) = O(log n) whr h is Height Heap
{
int massimo = i;
int l = i * 2 + 1;
int r = i * 2 + 2;
if (l < heap_size && A[l] > A[massimo])
{
massimo = l;
}
if (r <... | ALGO | 0.999874 | 4.481376 |
13747353-ab3a-43f8-8cee-05c939a30c77 | ishandutta2007/codeforces | ljc00118/normal/1468/K.cpp | #include <cstdio>
#include <cstring>
int t,n;
char s[5001];
bool check(int nx,int ny){
if(!nx&&!ny)return 0;
int x=0,y=0;
// puts("");
for(int i=1;i<=n;i++){
// printf("%d %d\n",x,y);
if(s[i]=='L'){
if(!((x-1)==nx&&y==ny))--x;
}
else if(s[i]=='R'){
if(!((x+1)==nx&&y==ny))++x;
}
else if(s[i]=='D')... | ALGO | 0.999975 | 3.106098 |
f2319e92-25f1-4e77-987e-08563fd71777 | mahim007/Online-Judge | uva/12700.cpp | #include<bits/stdc++.h>
using namespace std;
string s;
#define ll long long int
int main(){
ll BD,WWW,i,j,k,ln,tie,A,T,t,n;
scanf("%lld",&T);
for(t=1;t<=T;t++){
BD=0;
WWW=0;
tie=0;
A=0;
scanf("%lld",&n);
s.clear();
cin>>s;
ln=s.size();
... | ALGO | 0.998616 | 4.006168 |
702da665-098c-4c2a-bee6-d647ff11d9f0 | CPU-Code/c_plus_plus | type/remainder.cpp | /*
* @Author: cpu_code
* @Date: 2020-05-29 18:20:43
* @LastEditTime: 2020-05-29 18:31:45
* @FilePath: \ccourse\2_type\12_remainder.cpp
* @Gitee: https://gitee.com/cpu_code
* @CSDN: https://blog.csdn.net/qq_44226094
*/
//% 取余数
#include <iostream>
int main()
{
using namespace std;
const int Lbs_per_stn... | ALGO | 0.987848 | 3.588926 |
5a52e64c-46ae-4ff2-87d0-9e1a612fc3c5 | SanthoshK2003/My_LeetCode_Solutions | 2058-concatenation-of-array/2058-concatenation-of-array.cpp | class Solution {
public:
vector<int> getConcatenation(vector<int>& nums) {
int n=nums.size();
vector<int>ans;
for(int i=0;i<n;i++)
{
ans.push_back(nums[i]);
}
int index=n;
for(int i=0;i<n;i++)
{
ans.push_back(nums[i]);
}... | ALGO | 0.99877 | 5.173822 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.