uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
89c45b06-0efd-4dbd-9328-2326e7b35bd3 | karikay18/Leetcode-Solutions | 2213-find-all-people-with-secret/find-all-people-with-secret.cpp |
int now;
struct CompareTuple {
bool operator()(tuple<int, int, int>& lhs, tuple<int, int, int>& rhs) {
return get<2>(lhs) > get<2>(rhs);
}
};
void find(int curr, vector<int> &vis, unordered_map<int, vector<int>> &adj)
{
vis[curr] = now;
for(int i=0; i<adj[curr].size(); ++i)
{
... | ALGO | 0.999961 | 4.908957 |
c2412d9f-3c86-443f-ba6a-7eb69bc92bd9 | Courses-journey/cpp | assignments/047-054/09.cpp | #include <iostream>
using namespace std;
int main()
{
// Friends Array
string friends[] = {"Ahmed", "Mohamed", "Sayed", "Gamal"};
int friendsSize = size(friends);
// 01
// for (int i = 0; i < friendsSize; i++)
// {
// if (i == 1 || i == 2)
// {
// cout << friends[i] << "\n";
// }
// }
... | ALGO | 0.981358 | 3.715821 |
4864e6e1-4d24-4d8a-b8f8-4add241fe2fd | Rushikesh-18/DataStructure-and-Algos | Lec-30-33(KKushwah)Recursion/prerequisitnumber.cpp | #include<iostream>
using namespace std;
class examp
{
void number(int n)
{
n=1;
cout<<n;
number2(n);
}
void number5(int n)
{
n=5;
cout<<n;
}
void number4(int n)
{
n=4;
cout<<n;
number5(n);
}
void number3(int n)
{
n=3;
cout<<n;
number4(n);
}
void number2(i... | ALGO | 0.998144 | 3.199076 |
0a26b501-5628-42c0-9700-01877803aa73 | Youngwb/leetcode_cplusplus | 62/Unique_Paths_DP.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int uniquePaths(int m, int n) {
vector<vector<int>> ret(m,vector<int>(n,0));
for(int i=0;i<m;++i)
{
ret[i][n-1]=1;
}
for(int i=0;i<n;++i)
{
ret[m-1][i]=1;
}
... | ALGO | 0.99984 | 5.807675 |
7a83c295-92fc-4dae-a97f-58cd2485b98b | vossmalte/KIT-GPGPU | Assignment1/Assignment1/CSimpleArraysTask.cpp | /******************************************************************************
GPU Computing / GPGPU Praktikum source code.
******************************************************************************/
#include "CSimpleArraysTask.h"
#include "../Common/CLUtil.h"
#include <string.h>
using namespace std;
///////... | ALGO | 0.91933 | 4.937167 |
ccc117a7-2fd1-4306-a0aa-b143b2913f2b | ryankbr/CSCE-121 | labwork/lw3_debugging_craps/dump/craps.cpp | // Plays the game of craps.
#include <iostream>
#include <cstdlib>
#include <ctime>
using std::cout, std::cin, std::endl;
// function prototype / declarations
int rollDice();
int doGame(int, int);
int main()
{
/*
Normally, we would seed with time(NULL), however autograding
is hard to do with random resul... | ALGO | 0.979455 | 4.224443 |
73aa1a8c-d82d-49f5-9bc5-ac4f551c6f52 | KZX098/DSA | 11_ReversingANumber.cpp | # include <iostream>
using namespace std;
int main(){
int n,reverse=0;
cout<<"Enter a number:";
cin>>n;
while(n>0){
int lastDigit=n%10;
//will return 0 if the number is not in the range of int
if((reverse>INT_MAX/10)||(reverse<INT_MIN/10)){
return 0;
}
... | ALGO | 0.99925 | 4.501424 |
87e9041b-41c6-4612-9e3b-b236ec1d850d | subhasish/Algo | 09.BinaryTree/06.HasPathSum.cpp | /*
* 06.HasPathSum.cpp
*
* Problem: Find a root to leaf path with specified sum
*
* Created on: Jan 12, 2018
* Author: subha
*/
#include <bits/stdc++.h>
using namespace std;
// Solution: Classic preorder problem. Transfer the partial sum from parent to its children, then take decision at the leaf.
stru... | ALGO | 0.999959 | 5.690392 |
b3b9e20e-b85c-4752-8ebf-dc0a7cecd2c9 | January5480/RoboticsAssignments | 程序设计与算法课程设计/code/01Maze/01queuqlist.cpp | #include <iostream>
using namespace std;
//队列结点
typedef struct Node
{
int data;
struct Node* next;
} Node;
//队列
typedef struct Queue
{
Node* head; //队头
Node* tail; //队尾
} Queue;
//初始化队列
void initQueue(Queue* q)
{
q->head = q->tail = NULL;
}
//入队
void enqueue(Queue* q, int data)
{
Node* new_n... | ALGO | 0.999738 | 4.10701 |
670e0cb6-b774-45b8-bfd2-aff0f5785aeb | BurstFilterGroupCode/BurstFilter | src/run_burstyevent.cpp | /*
run_burstyevent.cpp
运行cm-pbe1,输出它的时间效率
将准确率输出到 tmp/burstyevent.res,将吞吐量输出到 tmp/burstyevent_throughput.res
(内存小时时间效率极低)
usage: ./run_burstyevent mem(KB)
*/
#include "sketch/burstyevent/BurstyEvent.h"
#include "sketch/newsketch/param.h"
#include "read_correct.h"
#include "util/read_dataset.h"
#include "util/tim... | ALGO | 0.99432 | 4.454588 |
9197d60c-81d2-492f-9af6-64aab554842b | snehkr/30Days-of-CPP | DAY-15-STL-Questions/Question5.cpp | #include <iostream>
#include <vector>
int main()
{
// Create a vector of integers
std::vector<int> numbers = {2, 4, 6, 8, 10};
// Use iterator to double each element in the vector
for (auto it = numbers.begin(); it != numbers.end(); ++it)
{
*it *= 2;
}
// Print the modified vector
for (const auto... | ALGO | 0.99624 | 6.070168 |
de6a360c-57f5-4c2a-ab46-3366aec703b5 | ishandutta2007/codeforces | aidos/normal/1490/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = (int)100200;
const ll inf = (1ll<<50);
int n;
int ask(int l, int r) {
cout << "? " << l << " " << r << endl;
int res;
cin >> res;
return res;
}
void solve() {
cin >> n;
vector<int>cnt(3, 0);
for(int i = 0... | ALGO | 0.999972 | 3.600498 |
7876b830-7dce-4cf1-9d99-c2f25ca01da6 | dkhonker/sysu | 数据结构/数据结构实验课文件/EXP13-EXAM02/for_test/source/20354058/count.cpp | #include <stdio.h>
#include <stdlib.h>
typedef struct BiTNode {
int data;
struct BiTNode *lchild, *rchild;
} BiTNode, *BiTree;
void CreateBiTree(BiTree &T){
char ch;
scanf("%c", &ch);
if('#' == ch) T = NULL;
else{
if(!(T = (BiTNode *)malloc(sizeof(BiTNode)))) exit(-1);
T->data=... | ALGO | 0.999754 | 3.630552 |
d38e934d-24e2-4fd1-bcf8-9798fd5ec7f6 | GaurishIIITNR/CP-Problems-III | A_321_like_Checker.cpp | // हर हर महादेव
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F first
#define S second
#define dbl double
#define pb push_back
#define ll long long int
#define uset unordered_set
#define umap unordered_m... | ALGO | 0.999988 | 3.976853 |
e328bca7-bcd8-4859-adf3-a8271a1152dd | codemonster57/Leetcode_soln | My-Leetcode-Solution-In-CPP/kth-smallest-product-of-two-sorted-arrays/kth-smallest-product-of-two-sorted-arrays.cpp | class Solution {
public:
// long long kthSmallestProduct(vector<int>& nums1, vector<int>& nums2, long long k) {
// }
#define ll long long
long long kthSmallestProduct(vector<int>& nums1, vector<int>& nums2, long long k) {
vector<int> &a=nums1;
vector<int> &b=nums2;
ll l=... | ALGO | 0.999959 | 5.16096 |
2af06058-76f8-4d7a-9613-9eb4542a8c71 | injoon149/codetree-TILs | 240513/이상한 진수 2/awkward-digits-2.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
int conversion(int num)
{
string binary;
binary = to_string(num);
int sum = 0;
for(int i = 0; i<(int)binary.size(); i++)
{
sum = sum * 2 + (binary[i] - '0');
}
return sum;
}
int main() {
... | ALGO | 0.999956 | 4.939391 |
672f4ca6-e180-436a-b63a-255bbd87b9ac | pl3li/chess-ai | src/pawn.cpp | #include "main.h"
using namespace std;
void pawn(Node& root, int row, int col, bool side){
char target;
// White's Move
if(0 == side){
target = root->board[row-1][col-1]; // Top Left Capture
if(' ' != target && 'x' != target && !same_side(side, target))
tree_insert(root, row, c... | ALGO | 0.999426 | 4.623135 |
15131818-a3ac-4a4e-a01a-30a1f8b55027 | Tahsin-Zaman-Jilan/Codeforce-Solutions-By-ZIlanJaman | Make it Divisible by 25.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int tcase;
cin>>tcase;
while(tcase--){
string a;
cin>>a;
int len=a.size();
int sum=len;
int ans;
for(int i=0;i<a.size();i++){
for(int j=i+1;j<a.size();j++){
... | ALGO | 0.999628 | 4.263196 |
b2d268a8-3856-49e9-9af4-baf2d2dad27b | himanshu-10/Sorting-Technique | mergeSort.cpp | #include<bits/stdc++.h>
using namespace std;
void merge(int *arr,int s,int e){
int mid = (s+e)/2;
int len1 = mid - s + 1;
int len2 = e - s;
// create two new array
int *first = new int[len1];
int * second = new int[len2];
// copy value to the new array
int k = s;
for(int i = 0;i... | ALGO | 0.999982 | 4.730078 |
5587d32c-0790-43e8-a469-51165bcc58b9 | kurgm/atcoder_submissions | abc047/C/Main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
char s[100000];
cin >> s;
char prev = s[0];
int ans = 0;
for (int i = 1; s[i]; i++) {
if (prev != s[i]) {
ans++;
prev = s[i];
}
}
cout << ans << endl;
return 0;
}
| ALGO | 0.999827 | 3.785421 |
d3bd52c4-f863-4eb9-91b6-ad9a894e6d9e | sspatari/PP-Siegen | Lab2/Initial_Code/Exercise5/solver-gauss.cpp | /*************************************************************************
** Iterative solver: Gauss/Seidel method
**
** Author: RW
**
*************************************************************************/
#include <stdlib.h>
#include <math.h>
#include "cond.h"
/*
** The iterative computation terminates, if ... | ALGO | 0.999997 | 6.344216 |
c82f05fb-bd45-4468-95b9-f5c44835c217 | kevinkchiou/MT_KT_mastereq_simulation | restart.cpp | #include "common.h"
#include "concentration.h"
#include "kinetochore.h"
void write_restart()
{
int ii;
FILE *restartfile;
char restartname[94];
fprintf(stderr, "writing restart\n");
sprintf(restartname, "restart/restart%6.6i", TRIALNUMBER);
restartfile = fopen(restartname, "w");
for(ii = 0; ii < left_res.size(); ii... | ALGO | 0.863815 | 3.269766 |
b803797b-3f77-426c-88d5-132ec92c241e | anshyyy/CPP | Codechef/Aorb.cpp | #include <bits/stdc++.h>
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define loop(i, a, n) for (int i = a; i < n; i++)
#define all(v) (v).begin(), (v).end()
#define all1(v) (v).begin() + 1, (v).end()
#define allr(v) (v).rbeg... | ALGO | 0.999878 | 4.986114 |
afbfa220-b523-455a-8ba1-872a0086173e | heavenMOJANG/ICPC | programmes_C_Cpp/AtCoder/abc406/A.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 a, b, c, d; cin >> a >> b >> c >> d;
if (c < a || (c == a && d < b)) cout << "Yes\n";
else cout <<... | ALGO | 0.999794 | 3.803589 |
471a43e1-cf36-4ba1-bfe3-0ff75005d945 | shyamal2411/DSA-Practice | leetcodePractice/Recursion/31NextPermutation.cpp | #include<bits/stdc++.h>
using namespace std;
// https://leetcode.com/problems/next-permutation/
class Solution {
public:
void nextPermutation(vector<int>& nums) {
next_permutation(nums.begin(), nums.end());
}
};
int main()
{
Solution s;
vector<int> nums{1,2,3};
s.nextPermutation(nums);... | ALGO | 0.999936 | 5.120761 |
7a0de9d6-793f-41c6-b1c9-4f4bb61db8fc | chemoontheshy/trackerTest | 3rd/include/eigen/bench/sparse_dense_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.998659 | 4.386305 |
cedd5f66-60fb-465a-8011-2a29b22285c3 | ArvidKristoffersson/Programmeringslosningar | Programmeringsolympiaden/träning/pellesarmhävningar.cpp | #include <iostream>
using namespace std;
int main(){
long long int input, pushups = 0, cPushups = 0;
cin >> input;
for (int i = 0; i < input; i++){
pushups++;
cPushups += pushups;
}
cout << cPushups << endl;
return 0;
}
| ALGO | 0.999756 | 3.530162 |
74d9c819-90ab-449c-bcb9-59755fab865c | bira37/problem-solving | Codeforces/Official Rounds/Educational Round 104/D.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#inc... | ALGO | 0.999598 | 4.577652 |
c976ca20-8fc4-45f0-a733-22ff4b857296 | Hexzenberg/University-Codes | TnP/Assignment-1/3.cpp | // Program to print nth prime number.
// Input: n=5
// Output: 11
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k=0,p;cin>>n;
for(int i=2;n>0;i++){
for(int j=1;j<=i;j++){
if(i%j==0)k++;
}if(k==2)n--;k=0;
p=i;
}cout<<p;
return 0;
} | ALGO | 0.999824 | 4.702966 |
03195570-ad59-4dbc-ab7a-a099ee5ee9a1 | luisccf/maratona | luis/uva-10130.cpp | #include <iostream>
#include <vector>
using namespace std;
int knapsack(int W, vector<int>weights, vector<int>prices) {
int n = weights.size();
int L[n+1][W+1];
for (int i = 0; i <= n; i++) {
for (int w = 0; w <= W; w++) {
if (!i || !w) {
L[i][w] = 0;
} else if (weights[i-1] <= w) {
L[i][w] = max(pri... | ALGO | 0.999799 | 4.155703 |
5099d32a-bbfb-4818-95a7-aa2b27e3e215 | gabriel-candeia/Competitive-Programming-Solutions | Codeforces/Codeforces Global Round 10/B.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll t, n, k;
vector<ll> a;
cin >> t;
while(t--){
cin >> n >> k;
a.assign(n,0);
for(int i=0;i<n;i++){
cin >> a[i];
}
ll mn=a[0], mx=a[0];
for(int i=0;i<n;i++){
... | ALGO | 0.999959 | 3.553924 |
470b0bdc-6e93-4c44-a261-d7d7314492e8 | gordon377/C_Plus_Plus_Projects | Red-Black-Tree/main.cpp | //Red-Black Tree
//Gordon Chen
//March 16, 2024
#include <iostream>
#include <cstring>
#include <fstream>
#include "node.h"
using namespace std;
//Function Prototypes
void PRINT(Node* currNode, int count, Node* rootNode, bool &active);
Node* SEARCH(Node* currNode, int inputNum);
//Insertion-Related Prototypes
void... | ALGO | 0.997649 | 3.974063 |
36db0bfd-f42e-4f5f-a003-01a8db2e2c8d | Harshsngh07/DataStructures_and_Algorithms | leetcode/AugustChallenge/Day11_Hindex.cpp | class Solution {
public:
int hIndex(vector<int>& citations) {
sort(citations.begin(),citations.end());
int n = citations.size();
if(n==0 || (n==1 && citations[0]==0)) return 0;
if(n==1 && citations[0]!=0) return 1;
int l(0),h(n-1);
while(l<=h)
... | ALGO | 0.999897 | 6.145542 |
9c6172f0-0e03-49e0-bb14-e322bcabcbc4 | arunxls/RDIT | LLVM/llvm/tools/llvm-vtabledump/llvm-vtabledump.cpp | #include "llvm-vtabledump.h"
#include "Error.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyS... | TOOL | 0.900249 | 7.389862 |
104482bb-f960-4d23-bc78-8b689cbe1965 | LionsWrath/maratona-treino | URI1551/1551.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <sstream>
using namespace std;
map<char, int> charToInt = { {'a', 0}, {'b', 1}, {'c', 2}, {'d', 3},
{'e', 4}, {'f', 5}, {'g', 6}, {'h', 7},
{'i', 8}, {'j', 9}, {'... | ALGO | 0.996284 | 4.455781 |
d0359a75-5664-48e7-ae5d-dee622cf807f | Konkumuttisandeepkumar/CPP-Programming | 5.Strings/5.Reverse_String.cpp | /***WAP to reverse a string***/
#include<iostream>
#define MAX_SIZE 1000
using namespace std;
void revstr(char str[],char rev[]);
int main()
{
char string[MAX_SIZE],reverse[MAX_SIZE];
cout<<"Enter a string: ";
cin>>string;
revstr(string,reverse);
cout<<"Reversed string is: "<<reverse<<endl;
return 0;
}
vo... | ALGO | 0.995497 | 3.898371 |
6ed9dece-d272-4798-99b5-9b428eee14ec | bww9641/Algorithm_Project | JUNGOL/2812.cpp | #include<stdio.h>
int main()
{
long long n,sum=0;
scanf("%lld",&n);
if(n<10){
printf("%lld",n);
return 0;
}
while(n>=10)
{
sum=0;
while(n)
{
sum+=n%10;
n/=10;
}
printf("%lld\n",sum);
if(sum>=10) n=sum;
}
return 0;
}
| ALGO | 0.999891 | 3.70778 |
759444e9-694e-4419-a970-3086b8120d6b | 4ian/GD-Extensions | CommonDialogs/dlib-17.49/examples/custom_trainer_ex.cpp | /*
This example program shows you how to create your own custom binary classification
trainer object and use it with the multiclass classification tools in the dlib C++
library. This example assumes you have already become familiar with the concepts
introduced in the multiclass_classification_ex.cpp ex... | DATA | 0.91144 | 7.82728 |
e13c63ad-10ad-4aff-90fb-0f2629e14c77 | ishandutta2007/codeforces | hydro-bot1/normal/221/A.cpp | // Hydro submission #6253c64248f7830132791d70@1649657410776
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
cin>>n;
printf("%d",n);
for(i=1;i<n;i++)
printf(" %d",i);
cout<<endl;
return 0;
} | ALGO | 0.998143 | 3.888094 |
fabc5b81-c948-4e15-9053-6acc2ea4896a | KZ1R2N/My-C-CPP-Programs | UVA Problems/UVA11530.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
long long test_case = 0;
cin >> test_case;
for (int i = 0; i <= test_case; i++)
{
string str = "\0";
int cnt = 0;
getline(cin, str, '\n');
for (int J = 0; J < str.length(); J++)
{
... | ALGO | 0.997807 | 4.125618 |
4f2674f5-6a35-4d9a-9a02-833994ab0815 | priyamanshu/priyamanshuWWC2024 | Documentary/DAY6/03. Krg Sum.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct T {
int i;
int j;
int sum;
};
class Solution {
public:
int kthSmallest(vector<vector<int>>& mat, int k) {
vector<int> row = mat[0];
for (int i = 1; i < mat.size(); ++i)
row = kSmallestPairSums(row, mat[i], k)... | ALGO | 0.999993 | 6.251391 |
2e4a9bff-25ae-4978-924e-39d29611552e | ishandutta2007/codeforces | briansu/normal/697/C.cpp | //{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef bri... | ALGO | 0.999832 | 3.676528 |
a27ca1f7-3dc4-4268-865a-85e2ad281563 | LeafOS-Project/android_external_libcxx | test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp | // <algorithm>
// template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
// constexpr bool // constexpr after C++17
// is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
// ForwardIterator2 first2, BinaryPredicate pred);
#include <algorithm>
#include <funct... | TEST | 0.97362 | 7.298746 |
53cfa63c-0172-4eb4-82f9-65dab71fcda3 | chhawinder/leetcode | 0091-decode-ways/0091-decode-ways.cpp | class Solution {
public:
int help(string s,int i,vector<int>&dp){
//base case
if(i>s.size())return 0;
if(i==s.size())return 1;
if(s[i]=='0')return 0;
if(dp[i]!=-1)return dp[i];
//take
int take=0,ntake=0;
ntake=help(... | ALGO | 0.999382 | 5.615458 |
ac50280c-271b-42ca-9657-81dfb07e80e9 | Prathamesh-chougale-17/Leetcode-solutions | 0485-max-consecutive-ones/0485-max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int count=0,maxi=0;
for(auto &i:nums){
if(i==1){
count++;
}
else{
count=0;
}
maxi = max(count,maxi);
}
return maxi;
... | ALGO | 0.999956 | 6.037653 |
d05c43b2-9314-493d-aaf3-cb28cf594696 | flowjiyun/algorithm_study | src/jaeyoung/0x05/05_boj_6198.cpp | #include <iostream>
#include <stack>
using namespace std;
stack<int> s;
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
long long int cnt;
int new_top;
int i;
cin >> n;
s.push(0);
cnt = 0;
i = 0;
while (i < n)
{
cin >> new_top;
while (!s.e... | ALGO | 0.999873 | 4.132697 |
5fdc62b4-0214-426c-8f52-788c1d10f951 | ShayanAhmed12/leetcode | 0846-hand-of-straights/0846-hand-of-straights.cpp | class Solution {
public:
bool isNStraightHand(vector<int>& hand, int groupSize) {
int min, count, flag=0, totalcount = 0, originalcount = hand.size(), group = hand.size();
for(int i = 0; i < hand.size();)
{
min = *min_element(hand.begin(), hand.end());
// flag=0;
... | ALGO | 0.999956 | 5.624576 |
deb6ebbe-fe6d-48f6-9dc5-91fff17e44e2 | rahulgrover99/Competitive | Standard Graph Problems/Message Route.cpp | #include<bits/stdc++.h>
#define FOR0(i,n) for(int i=0;i<n;i++)
#define FOR1(i,n) for(int i=1;i<=n;i++)
#define FORl(i,l,n) for(int i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst... | ALGO | 0.999994 | 3.86883 |
9de870fd-4762-463a-9723-bac866721cfd | ntanthedev/Cpp | Du Tuyen/CHATNP/NTSEQ.cpp | #include<bits/stdc++.h>
using namespace std;
signed main() {
freopen("NTSEQ.inp","r",stdin);
freopen("NTSEQ.out","w",stdout);
int n;
cin >> n;
vector<int> a(n);
for(auto &i : a)
cin >> i;
reverse(a.begin(), a.end());
vector<int> b;
b.push_back(a[0]);
for(int i = 1; i <... | ALGO | 0.999925 | 3.399376 |
b5f756b0-3da3-42e2-a6c4-cc0819dfa72b | MINAX2U/Judges_solves | Zero_judge/basic/g384.cpp | #include <iostream>
#include <string>
using namespace std;
string s;
int total;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>s;
for(char c:s){
total+=(c-'A'+1);
}
cout<<total<<"\n";
} | ALGO | 0.994781 | 4.024267 |
ad563e60-4933-4b03-bae4-05b8ad4ff9c4 | MaximovaIrina/DPCpp_practice | heterogeneous_image_blur/blur.cpp | #include "blur.h"
#include <CL/sycl.hpp>
#include "DiviceSelector.h"
using namespace cl::sycl;
constexpr access::mode dp_read = access::mode::read;
constexpr access::mode dp_write = access::mode::write;
#define GPU "UHD Graphics"
#define CPU "Core"
void blurParallel(const std::vector<float>& src, std::vector<float>... | ALGO | 0.911324 | 5.872805 |
dca3a1d4-9810-437e-b267-1511dc41e5e4 | nishantthedevill/Data-Structures-and-Algorithms | 0015-3sum/0015-3sum.cpp | class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
sort(nums.begin(),nums.end());
vector<vector<int>> ans;
set<vector<int>>res;
int n = nums.size();
for(int i=0;i<n;i++){
int j=i+1, k=n-1;
while(j<k){
if(nums[i]+... | ALGO | 0.999961 | 5.915305 |
cfd7c308-62f0-411d-954d-f400c216c60d | momchiltues19/Prog-Intro | Test2/task2b.cpp | #include <iostream>
using namespace std;
#define SIZE 100
int gcd(int,int);
int filter(int[SIZE], int);
int main()
{
int n, result = 1;
int arr[SIZE];
do
{
cout << "Input arr size: ";
cin >> n;
}while(n<1||n>20);
cout << endl << "Input "<< n << " real numbers:" << endl;
... | ALGO | 0.999716 | 4.174225 |
52674bc5-b040-418d-a4c5-c60b8efc6bd5 | glKarin/com.n0n3m4.diii4a | Q3E/src/main/jni/jk/codemp/qcommon/matcomp.cpp | #include "q_shared.h"
#include "matcomp.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <memory.h> // for memcpy
#define MC_MASK_X ((1<<(MC_BITS_X))-1)
#define MC_MASK_Y ((1<<(MC_BITS_Y))-1)
#define MC_MASK_Z ((1<<(MC_BITS_Z))-1)
#define MC_MASK_VECT ((1<<(MC_BITS_VECT))-1)
#define MC_SCALE_VECT ... | ALGO | 0.964349 | 4.539951 |
f5e3bc5a-d4ca-42aa-9c3c-98feecb79716 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_valid_47_20.cpp | #include <bits/stdc++.h>
using namespace std;
void swagWaalaFunction() {
long long int n, k;
cin >> n >> k;
auto query = [&](long long int l, long long int r, string type) {
long long int x;
cout << type << " " << l << " " << r << endl;
cin >> x;
return x;
};
vector<long long int> v(n + 1);
... | ALGO | 0.999851 | 3.898654 |
d76955bd-5eb4-4224-be85-9244a0abb58e | Mohammad-Sabbir-Ahmed/Competitive-Programming-1 | All Online Judge Problem/Codeforces/Codeforces Round #521 (Div. 3)/A - Frog Jumping.cpp | #include "bits/stdc++.h"
using namespace std;
int main()
{
int tc;
cin>>tc;
while(tc--){
long long a,b,k;
cin>>a>>b>>k;
if(k&1){
cout<<((a*(k/2))+a)-(b*(k/2))<<"\n";
}
else {
cout<<(a*(k/2))-(b*(k/2))<<"\n";
}
}
retur... | ALGO | 0.999834 | 4.004209 |
65400a2d-2fce-4745-8d67-ce7798104054 | UMich-CURLY/husky_inekf | src/estimator/body_estimator.cpp | #include "estimator/body_estimator.hpp"
namespace husky_inekf{
BodyEstimator::BodyEstimator() :
t_prev_(0), imu_prev_(Eigen::Matrix<double,6,1>::Zero()) {
// Create private node handle
ros::NodeHandle nh("~");
// Set debug output
nh.param<bool>("/settings/estimator_enable_debug", estimator_debug_... | ALGO | 0.978832 | 7.633539 |
afd4d2bb-310a-489b-9ab7-724e0976ffd5 | neonion12/Competitive-Programming | Codeforces/calculating_function.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,s=0;
cin>>n;
if(n%2==0)
{
s=s+n/2;
}
else{
s=s+(n/2)-n;
}
cout<<s;
return 0;
} | ALGO | 0.999631 | 3.228765 |
429bc69e-8721-4d27-bf64-18820079554d | Gurmeet-Singh657/StriverSDESheetChallenge | Stack_and_Queues_Part_2/Min_Stack.cpp | #include<bits/stdc++.h>
using namespace std;
// Implement class for minStack.
class minStack
{
int mini;
stack<int> st;
public:
minStack()
{
mini=INT_MAX;
}
// Function to add another element equal to num at the top of stack.
void push(int num)
{
if(st.empty())
... | ALGO | 0.999856 | 4.905747 |
9a91bf3f-d3c5-4655-a05a-80de69e4ff60 | Toufik-Islam/XPSC_Phitron | Week 5/Day 3/C_Hamiltonian_Wall.cpp | /*\~~~~~~~~~~~~~~~~~\
\ TOUFIK \
\ ISLAM \
\~~~~~~~~~~~~~~~~~\*/
#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 5;
const int M = (int)1e9 + 5;
const int md = (int)1e9 + 7;
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
... | ALGO | 0.999992 | 5.027305 |
74bde56a-e077-4146-b373-d91d1d62d4a4 | Zyanxin/Automan-hunter | Workspace/catkin_ws/3rdparty/opencv-3.4.0/3rdparty/carotene/src/warp_perspective.cpp | #include "remap.hpp"
namespace CAROTENE_NS {
bool isWarpPerspectiveNearestNeighborSupported(const Size2D &ssize)
{
#if SIZE_MAX > UINT32_MAX
return !(ssize.width > 0xffffFFFF || ssize.height > 0xffffFFFF) && // Restrict image size since internal index evaluation
... | ALGO | 0.988529 | 6.960533 |
7d7d8bfa-23a9-46a2-8bf1-e888977455ee | peterzheng98/gpu-memory | src/save/pytorch/third_party/eigen/bench/dense_solvers.cpp | #include <iostream>
#include "BenchTimer.h"
#include <Eigen/Dense>
#include <map>
#include <vector>
#include <string>
#include <sstream>
using namespace Eigen;
std::map<std::string,Array<float,1,8,DontAlign|RowMajor> > results;
std::vector<std::string> labels;
std::vector<Array2i> sizes;
template<typename Solver,type... | TOOL | 0.998767 | 6.326138 |
b8585408-c022-4992-be23-80f811659d64 | markgarcia-ai/cpluspluslearning | 04_Pointers/quizz/answer.cpp | //*Sample program for Pointers*/
#include<iostream>
#include<string>
int main()
{
std::string name;
int givenInt;
float givenFloat;
double givenDouble;
std::string givenString;
char givenChar;
int *pointerGivenInt;
int **pointerPointerGivenInt;
pointerGivenInt = &givenInt;
poin... | TOOL | 0.953397 | 3.496282 |
204a5961-7bc9-4838-81a8-d0b1f2495d6f | csulb-jondwoo/CECS-282 | OperatorOverload/upDate.cpp | #include "upDate.hpp"
#include <string>
#include <iostream>
int upDate::count = 0;
int jd;
int Greg2Julian(int year, int month, int day){
int i = year;
int j = month;
int k = day;
jd = k - 32075 + 1461 * (i + 4800 + (j - 14) / 12) / 4 + 367 * (j - 2 - (j - 14) / 12 * 12) / 12 - 3 * ((i + 4900 + (j... | TOOL | 0.893117 | 4.474771 |
22a4cdbe-fd1b-4ff8-b7ac-ea476b2c60de | lsgwr/algorithms | Part13算法竞赛宝典/第二部资源包/第五章 排序算法/常用排序法/src/快速排序法/sort.cpp | //sort
#include <iostream>
using namespace std;
#define N 100000
int a[N+1];
int n;
void QuickSort(int i,int j)
{
int m,n,temp;
int k;
m=i;
n=j;
k=a[(i+j)/2]; /*ѡȡIJ*/
while(m<=n)
{
while(a[m]<k&&m<j) m++; /* ұkԪ*/
while(a[n]>k&&n>i) n--; /* ҵұkСԪ*/
if(m<=n)
{ ... | ALGO | 0.999954 | 3.925555 |
94c2f502-44d2-4489-9dcb-febefed4cbd1 | rabelhmd/LeetCode | 2244-minimum-rounds-to-complete-all-tasks/2244-minimum-rounds-to-complete-all-tasks.cpp | class Solution {
public:
int minimumRounds(vector<int>& tasks) {
unordered_map <int, int> Mp;
for(auto &x: tasks) Mp[x] += 1;
int ret = 0;
for(auto [x, y]: Mp) {
if(y == 1) return -1;
ret += (y / 3) + (y % 3 != 0);
}
return ret;
}
... | ALGO | 0.999862 | 5.879154 |
4f356b93-29c5-4b7c-932a-512b2ccbda6a | Lrazerz/Labs_CPP_C | cpp/cpa_lab_2_9_8_(2)-C.cpp | #include <iostream>
using namespace std;
int main()
{
int banknotes[]= { 50, 20, 10, 5, 1 };
int clientMoney;
cout << "How much you need?\n";
cin >> clientMoney;
for(int i = 0; clientMoney > 0;)
{
if(clientMoney >= banknotes[i])
{
clientMoney -= banknotes[i];
... | ALGO | 0.997822 | 3.845623 |
ff9464b1-db48-4783-a059-7007f241e9b3 | Saqlainalyshah/GDG_London_DevCamp2024 | Session_7&8_Assignment/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.998321 | 6.763549 |
6efd4ec0-ebae-4880-ae54-43326aac99c8 | LOReD1ska/flutter_first_task | 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 |
78558170-1a39-48c4-8e19-085d97378b87 | FarhanTahmid/NSUPS-BOOTCAMP | CONTEST_WEEK1/G_Ecological_Premium.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
int farmers;
while(t--){
int sum=0;
cin>>farmers;
while(farmers--){
int farmSize,ownedAnimal,envFrnd;
cin>>farmSize>>ownedAnimal>>envF... | ALGO | 0.997273 | 3.465434 |
2aaa4ebc-a518-4683-9d9b-30c2a0bc23fe | sw-AhmedAdel/Data-structure-and-algorithms | 2-Arrays_Representations/1-2d_array/main.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
int x=1;
int arr[3][3] ;
for(int i=0 ; i<3 ; i++) {
for(int c=0 ;c<3 ; c++) {
arr[i][c] =x;
x++;
}
}
for(int i=0 ; i<3 ; i++) {
for(int c=0 ;c<3 ; c++) {
cout<<arr[i][c]... | ALGO | 0.932777 | 3.141443 |
e5b10e83-9050-4ad6-a66b-439947c12174 | Mulab11/cntt2016-hw1 | TC-SRM-557-div1-550/qj.cpp | #include <bits/stdc++.h>
using namespace std;
class Incubator {
static const int N = 50 + 10;
std::vector<std::string> s;
int n, match[N];
bool flag[N];
bool dfs(int a) {
if (flag[a]) return false;
flag[a] = true;
for (int b = 0; b < n; ++b) {
if (s[a][b] == 'N') continue;
if (match[... | ALGO | 0.999723 | 5.004781 |
69943eea-67ce-49a7-bd4d-49a5dbcdbb82 | Vanilla-chan-nya/Contest_Code | CodeForces/1945/B.cpp | /**************************************************************
* Problem:
* Author: Vanilla_chan
* Date:
* E-Mail: <EMAIL>
**************************************************************/
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#inc... | ALGO | 0.999275 | 3.762275 |
83e04d60-648e-4cf2-9333-9defed35900e | vmoudy/Hex-with-MCTS | hex_game.cpp | #include <iostream>
#include <random>
#include <iomanip>
#include <stack>
#include "hex_game.h"
default_random_engine generater(static_cast<int>(time(nullptr)));
//distributer for numbers from 1 to board size
uniform_int_distribution<int> tile_distributor(1, 11);
//return an int for tile selection
inline int which_t... | ALGO | 0.981039 | 3.78739 |
0bbab7e3-f740-453f-bf7c-91a9091aefbd | sharma18b/Algorithmic-Library | Dynamic Programming/Interleaving strings dp.cpp | // is C made of character from A&B
bool isinterleaved(string A,string B,string C)
{
int n = A.length();
int m = B.length();
vector<vector<bool>> dp(n+1,vector<bool> (m+1,false));
// int dp[n+1][m+1];
// memset(dp,0,sizeof(dp));
for(int i=0;i<=n;i++)
{
for(int j=0;j<=m;j++)
{
... | ALGO | 0.999575 | 3.617663 |
a7ae5856-3ba7-46c7-8027-2c2d445d67a0 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5975_14.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n;
struct Data {
int s, id;
bool operator<(const Data &a) const { return s < a.s; }
} da[N];
int a[N], b[N];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int s;
scanf("%d", &s);
da[i] = Data{s, i};
}
sort(da, ... | ALGO | 0.999981 | 3.191353 |
21cd6e19-adf7-4adf-b9f9-f6e6ece2d0f7 | 1mSSong/problems | ct9_4.cpp | #include <iostream>
#define INF 1e9
using namespace std;
int n, m;
int graph[101][101];
int main() {
cin >> n >> m;
// ʱȭ
for (int i = 0; i < 101; i++) {
fill(graph[i], graph[i] + 101, INF);
}
for (int a = 1; a <= n; a++) {
for (int b = 1; b <= n; b++) {
if (a == b) graph[a][b] = 0;
}
}
for (int i... | ALGO | 0.999968 | 4.070747 |
c9e01fe3-dafd-4a73-b6f9-43c0e6644b23 | za233/Polaris-Obfuscator | src/llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp | #include "llvm/CodeGen/GlobalISel/CSEMIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/IR/DebugInfoMetadata.h"
using namespace llvm;
bool CSEMIRBuil... | ALGO | 0.988413 | 7.889601 |
edab234c-d5f3-4a83-bea3-abcb11b78dea | Fraunhofer-AISEC/softboundcets-llvm-project | libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp | // <algorithm>
// template<class ForwardIterator, class Size, class T, class BinaryPredicate>
// constexpr ForwardIterator // constexpr after C++17
// search_n(ForwardIterator first, ForwardIterator last, Size count,
// const T& value, BinaryPredicate pred);
#include <algorithm>
#include <cassert>
... | TEST | 0.998108 | 7.341774 |
7a7eb166-f0a0-41e4-b729-ef90d88e58b2 | louipc/opennurbs | opennurbs_rand.cpp | /* $NoKeywords: $ */
#include "opennurbs.h"
#if !defined(ON_COMPILING_OPENNURBS)
// This check is included in all opennurbs source .c and .cpp files to insure
// ON_COMPILING_OPENNURBS is defined when opennurbs source is compiled.
// When opennurbs source is being compiled, ON_COMPILING_OPENNURBS is defined
// and t... | ALGO | 0.998566 | 5.651512 |
2726fba4-bf0e-4db2-b03e-a08f5fa8bc7e | Imtiaz-Rafi/Leetcode | 235-lowest-common-ancestor-of-a-binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
TreeNode* c... | ALGO | 0.999995 | 6.156477 |
b22aa2fd-0d7c-4bc4-aeb9-02d4c6eb30a8 | dinhphu2k1-gif/Algorithm | Problem/CodeForce/C++/A_Two_Subsequences.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
// freopen("input.txt", "r", stdin);
int t;
string s;
cin >> t;
while (t--){
cin >> s;
char x = s[0];
string y = "";
for (int i = 1; i < s.length(); i++){
if (s[i] < x) x = s[i];
}
... | ALGO | 0.999928 | 3.813317 |
2ed315f2-451c-4a7f-b331-10c27cec5ce0 | aredjil/euler_project | problem_930/.history/src/main_20250209182022.cpp | #include "gather.hpp"
std::random_device dv;
std::mt19937 gen(dv());
void step(std::vector<int> &balls, std::vector<int> &bowls)
{
int m = balls.size();
int n = bowls.size();
int rd_ball;
int rd_dir;
// Choosing a random ball
std::uniform_int_distribution<int> choose_ball(0, m - 1);
// P... | ALGO | 0.99986 | 5.432201 |
503b4fc0-2d8a-473f-acca-d5be1c8b0b40 | Harsh04Gautam/DSA | linked_list/DoublyLinkedList.cpp | #include <cstdlib>
template <typename E> class DNode {
private:
E elem;
DNode *prev;
DNode *next;
template <typename F> friend class DoublyLinkedList;
};
template <typename E> class DoublyLinkedList {
public:
DoublyLinkedList();
~DoublyLinkedList();
bool empty() const;
const E &front() const;
const E... | ALGO | 0.999067 | 5.614923 |
16767982-033b-41a3-a549-3d547c935d65 | confa-chat/confa-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 |
2e18c2d8-9db6-4adf-b0e0-5d4cdf9d86c1 | charneykaye/om-ios-experiments | SpaceGameStarterKit_v1_3/SpaceGame/SpaceGame/libs/Box2D/Collision/b2CollidePolygon.cpp | #include <Box2D/Collision/b2Collision.h>
#include <Box2D/Collision/Shapes/b2PolygonShape.h>
// Find the separation between poly1 and poly2 for a give edge normal on poly1.
static float32 b2EdgeSeparation(const b2PolygonShape* poly1, const b2Transform& xf1, int32 edge1,
const b2PolygonShape* poly2, const b2Tra... | ALGO | 0.999785 | 6.903707 |
01bc39ef-ddf1-4195-a534-57e92841ac2e | theodore/olympiads | HOJ/2013/go.cpp | #include <cstdio>
#include <algorithm>
typedef long long ll;
const int maxn = 620003;
const int mod = 1000000009;
int n, d;
int block[maxn];
int main()
{
scanf("%d%d", &n, &d);
for (int i = 0; i < n; ++i)
scanf("%d", block + i);
std::sort(block, block + n);
int ans = 1;
for (int i = 1, j = 0; i < n; ++i)
{
... | ALGO | 0.999932 | 4.419218 |
f391863d-b67f-4a84-8d14-4c36843722e2 | PowerSl1d3/algorithms | 4_sprint/B.broke_me_as_you_can/main.cpp | #include <iostream>
#include <string>
#include <cstdint>
#include <vector>
#include <algorithm>
uint64_t get_hash_value(const std::string& input_string, const uint64_t base, const uint64_t mod) {
if (input_string.empty()) {
return 0u;
} else if (input_string.size() == 1) {
return *input_str... | ALGO | 0.999544 | 4.823619 |
b9ceccc3-c630-4195-952d-ceb9c12be556 | AnishkaKesaria/PW_PPT | DSA/Array - 2 HW/6.cpp | #include <bits/stdc++.h>
using namespace std;
int search(vector<int>& nums, int target) {
int s = 0;
int e = nums.size()-1;
while(s<=e)
{
int mid = s +(e-s)/2;
if(nums[mid]==target)
return mid;
else if(nums[mid]<target)
s = mid + 1;
else
... | ALGO | 0.999694 | 5.677598 |
bc3ccd6c-94d7-4f9a-9aa7-fabcab4f59d1 | chakitg/cp_solutions | gfg-potd/Sum of XOR of all pairs.cpp | Given an array of N integers, find the sum of xor of all pairs of numbers in the array arr. In other words, select all possible pairs of i and j from 0 to N-1 (i<j) and determine sum of all (arri xor arrj).
Example 1:
Input : arr[ ] = {7, 3, 5}
Output : 12
Explanation:
All possible pairs and there Xor
Value: ( 3 ^ 5 ... | ALGO | 0.999991 | 5.865271 |
ca9111a8-c2fa-419c-8576-f276809994dc | bumee/Baekjoon_Storage | Silver/BOJ1149.cpp | #include <algorithm>
#include <iostream>
#include <queue>
#define fastcpp ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
int n, color;
int RGBList[1000][3];
int dp[1000][3];
void bfs(){
for (int i=0;i<3;i++) dp[0][i] = RGBList[0][i];
for (int i=1;i<n;i++){
for (int j=0;j<3;j++){
... | ALGO | 0.998654 | 4.922001 |
56adad2f-b674-4aef-a04e-c3cb67fdf506 | RezWaki/Sharp_Client | dlls/AI_BaseNPC_Schedule.cpp | //=========================================================
// schedule.cpp - functions and data pertaining to the
// monsters' AI scheduling system.
//=========================================================
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "animation.h"
#includ... | TOOL | 0.882191 | 6.097355 |
37a97840-ab23-421a-8989-f47eebc75eb0 | Sveta-1999/Sorting_algoritms | Bubble_sort/main.cpp | #include "utility.h"
#include <vector>
void bubble_sort(std::vector<int>& vec)
{
for(int i = 0; i < vec.size()-1; ++i )
{
bool swapped = false;
for(int j = 0; j < vec.size()-1-i; ++j)
{
if(vec[j] > vec[j+1])
{
swap(vec[j],vec[j+1]);
... | ALGO | 0.999607 | 4.92598 |
a72c9286-a945-4f63-ba03-63d0a29c157c | mahiamOmO/Courses-Learn | C++/cpp practice/user_input.cpp | #include <iostream>
using namespace std;
int main() {
int amount1;
cin >> amount1;
int amount2;
cin >> amount2;
int sum = amount1 + amount2;
cout << sum << endl;
return 0;
}
| ALGO | 0.986141 | 3.450078 |
a332445c-cf62-4478-9213-285edbc2d5df | littleDing/leetcode | Merge_Two_Sorted_Lists.cpp | //Attemp #1
//from 2013-09-12 01:37
//to 2013-09-12 02:01
//failed before small AC: CE*1 + RTE*1 + WA*1 + TLE*2
//failed before large AC: None
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution ... | ALGO | 0.999992 | 5.243611 |
67b5f156-0899-429b-9b91-636524dc48c0 | oxygenbytes/swordoffer | [剑指 Offer 57 - II]和为s的连续正数序列.cpp | /*
---
title: "[剑指 Offer 57 - II]和为s的连续正数序列"
date: 2021-02-18 11:46:13
draft: false
toc: true
tags:
- SwordOffer
- Leetcode
---
*/
//输入一个正整数 target ,输出所有和为 target 的连续正整数序列(至少含有两个数)。
//
// 序列内的数字由小到大排列,不同序列按照首个数字从小到大排列。
//
//
//
// 示例 1:
//
// 输入:target = 9
//输出:[[2,3,4],[4,5]]
//
//
// 示例 2:
//
// 输入:target =... | ALGO | 0.999957 | 5.283671 |
3fd81ff5-4672-477b-83ab-6b0040786d07 | filipeherculano/UVA_trash | 347.cpp | #include <bits/stdc++.h>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(a) a.begin(),a.end()
#define pb push_back
#define LSOne(S) (S & (-S))
typedef unsigned long long llu;
typedef long long ll;
typedef long double ld;
const int INF = 0x3f3f3f3f;
using name... | ALGO | 0.999845 | 3.873161 |
98436712-6254-4aff-ac55-fb0ba2ef9fda | GopherTeen/OJ_Code | Problems/Luogu/动态规划/基础部分/背包DP/P_1060_NOIP_2006_普及组_开心的金明.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
static constexpr int MOD = 1'000'000'007;
void solve() {
int tot, n;
cin >> tot >> n;
vector vec(n, vector<int>(2));
for (auto& v : vec) {
cin >> v[0] >> v[1];
}
vector<int> dp(tot + 1);
for (auto& v : vec) {
... | ALGO | 0.99985 | 4.62542 |
d1864554-c41c-45aa-835d-66185a52571b | ishubhoshaha/Programming-Interview | GraphTheory/TopSort_kahn.cpp | /*
* Time Complexity : O(node+edge)
* Reference : http://www.geeksforgeeks.org/topological-sorting-indegree-based-solution/
*/
#include<bits/stdc++.h>
using namespace std;
vector<int>graph[101];
int indegree[101];
void TopSort(int node){
int t = 0;
queue<int>q;
for(int i = 1;i<=node;i++){ ///Assume node sta... | ALGO | 0.999992 | 4.405718 |
2a1e488c-88df-4db9-bb8b-015b17be2dd2 | AlonsoPaulino/competitive-programming | Codeforces/141C - Queue.cpp | #include <bits/stdc++.h>
#define pi acos(-1)
#define sz(x) (int) x.size()
#define pii pair<int, int>
#define pill pair<int, long long>
#define mii map<int, int>
#define vi vector<int>
#define vll vector<long long>
#define vs vector<string>
#define vb vector<bool>
#define mp make_pair
#define pb push_back
#define fi fir... | ALGO | 0.999848 | 3.65558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.