uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
1a1b9ff8-176f-44cf-b745-36d5a60d85f4 | Jherlil/BitVetor | CryptoUtil/hash.cpp | #include"CryptoUtil.h"
#include<stdio.h>
#include <string.h>
static unsigned int endian(unsigned int x)
{
return (x << 24) | ((x << 8) & 0x00ff0000) | ((x >> 8) & 0x0000ff00) | (x >> 24);
}
unsigned int crypto::checksum(const unsigned int *hash)
{
unsigned int msg[16] = { 0 };
unsigned int digest[8] = { 0 };
// ... | TOOL | 0.973252 | 5.870633 |
2dc5848a-e7ee-44c9-88a2-dda41107a734 | RickiTaKa/RickiTaKa | AppliedAlgorithms/kerplop.cpp | #include <iostream>
#include <vector>
using namespace std;
int checkLetter(char l) {
int temp;
if (l == 'a') {
temp = 0;
}
else if (l == 'b') {
temp = 1;
}
else if (l == 'c') {
temp = 2;
}
else if (l == 'd') {
temp = 3;
}
else if (l == 'e') {
temp = 4;
}
else if (l == 'f') {
temp = 5;
}
els... | ALGO | 0.999398 | 4.276937 |
54cf7961-49e2-4fb8-a219-97f42aa0e7bd | vedanshmah/leetquestions | 2599-take-k-of-each-character-from-left-and-right/2599-take-k-of-each-character-from-left-and-right.cpp | class Solution {
public:
int takeCharacters(string s, int k) {
int n=s.length();
int co_a=0,co_b=0,co_c=0;
//pehle a b c ka count nikalo
for(int i=0;i<n;i++){
if(s[i]=='a'){
co_a++;
}
else if(s[i]=='b'){
co_b++;
... | ALGO | 0.99998 | 5.537297 |
3036e682-c5d9-45ce-b5b8-d8ef4124f858 | abhishek199526/DSA_Pratice | 1_Arrays.cpp | #include <iostream>
using namespace std;
class array
{
int size;
int data;
int *p = new int[size];
public:
void getdata()
{
cout << "Enter Size" << endl;
cin >> size;
cout << "Enter elements" << endl;
for (int i = 0; i < size; i++)
{
cin >> p[i]... | ALGO | 0.996949 | 3.507273 |
d13f7e88-7040-4ae2-baf8-50199569d614 | sinian666/codes_86_3 | cpp_副本3/chapter_sorting/radix_sort.cpp |
/**
* File: radix_sort.cpp
* Created Time: 2023-03-26
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 获取元素 num 的第 k 位,其中 exp = 10^(k-1) */
int digit(int num, int exp) {
// 传入 exp 而非 k 可以避免在此重复执行昂贵的次方计算
return (num / exp) % 10;
}
/* 计数排序(根据 nums 第 k 位排序) */
void countingSortDigit(vector<... | ALGO | 0.999947 | 5.788882 |
61d86675-a3d4-4753-82ee-4862a1ff5b49 | rical730/LeetCode | C++/347TopKFrequentElements.cpp | /*
* Leetcode347. Top K Frequent Elements
* Funtion: Given a non-empty array of integers, return the k most frequent elements.
* Example: Given [1,1,1,2,2,3] and k = 2, return [1,2].
* Author: LKJ
* Date:2016/7/21
* Hint:每一段单调递增区间的收益累加
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace... | ALGO | 0.999983 | 5.266953 |
7df32c0d-a2e5-4087-86df-db1bb7a10120 | SeacenLiu/LeetCode | 组合总和/main.cpp | /**
给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。
candidates 中的数字可以无限制重复被选取。
说明:
所有数字(包括 target)都是正整数。
解集不能包含重复的组合。
示例 1:
输入: candidates = [2,3,6,7], target = 7,
所求解集为:
[
[7],
[2,2,3]
]
示例 2:
输入: candidates = [2,3,5], target = 8,
所求解集为:
[
[2,2,2,2],
... | ALGO | 0.999932 | 6.12999 |
5d76e73d-42c2-4b9c-b5b7-0c6c900e3bb4 | yaswanth230755/neetcode-150-solutions | Coin Change.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
vector<int> dp(amount + 1, 1e6);
dp[0] = 0; // base case: 0 coins to make amount 0
for (int coin : coins) {
for (int j = coin; j <= amount; ++j) {
dp[j] = min(dp[j], 1 + dp[j - coin]);
... | ALGO | 0.999918 | 6.095669 |
d3e70d1d-86ae-4287-926e-56d43c3da5ac | iamrajee/drone_swarm | code/EGO-Planner-v2/swarm-playground/main_ws/src/uav_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/stiff_system.cpp | #include <iostream>
#include <fstream>
#include <utility>
#include <boost/numeric/odeint.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/core.hpp>
#include <boost/phoenix/operator.hpp>
using namespace std;
using namespace boost::numeric::odeint;
namespace phoenix = boost::phoenix;
//[ stiff_system_d... | ALGO | 0.996034 | 5.564837 |
d27e4f53-efde-4976-91f9-48ebdf497e42 | Tanshi-Mehra/LinkedList | traversalinLL.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node*next;
public:
Node(int data1,Node*next1)
{
data=data1;
next=next1;
}
Node(int data1)
{
data=data1;
next=nullptr;
}
};
Node* arr2LL(vector<int>&arr)
{
... | ALGO | 0.999597 | 4.944664 |
107b317b-fd1d-4164-a633-9c9f3921d474 | Tagore22/algorithmSolve | algorithmSolve/백준/32314.cpp | #include <iostream>
using namespace std;
int main()
{
int a, w, v;
cin >> a >> w >> v;
if (w / v >= a)
cout << 1 << '\n';
else
cout << 0 << '\n';
return 0;
} | ALGO | 0.999461 | 3.480577 |
2755b0f1-c9f0-4237-a9ca-b7fbada82576 | vidsinghal/Cornucopia | HashEnabledLLVM/clang/test/CodeCompletion/function-templates.cpp | namespace std {
template<typename RandomAccessIterator>
void sort(RandomAccessIterator first, RandomAccessIterator last);
template<class X, class Y>
X* dyn_cast(Y *Val);
}
class Foo {
public:
template<typename T> T &getAs();
};
template <typename T, typename U, typename V>
V doSomething(T t, const U &u, V ... | TOOL | 0.93495 | 6.07763 |
238826e0-3951-4de3-9c1e-e6086b80d724 | civinx/ACM_Code | Practice/HDU/2080 夹角有多大II/2080 夹角有多大II/main.cpp | #include <cstdio>
#include <cmath>
const double pi = acos(-1);
int main(){
int t; scanf("%d",&t);
while(t--){
double x1, y1, x2, y2;
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
double x = (x1*x2 + y1*y2) / (sqrt(x1*x1+y1*y1) * sqrt(x2*x2+y2*y2));
printf("%.2f\n",acos(x)*180/pi);
}... | ALGO | 0.999466 | 3.596553 |
93295306-5428-41ff-8845-17c04c868c45 | alexandraback/datacollection | solutions_1483488_0/C++/Navid/c.cpp | #include<iostream>
#include<set>
using namespace std;
typedef pair<int,int> pii;
set<pii> ans;
void getans(int x,int a, int b) {
//cerr<<"getans "<<x<<' '<<a<<' '<<b<<endl;
int pow1 = 1;
int pow2 = 1;
int temp = x;
while(temp>0) {
pow2 *=10;
temp/=10;
}
temp = x;
pow1 = 10;
temp/=10;
while(temp>0) {
... | ALGO | 0.999496 | 4.334452 |
9930d100-257b-4cc4-baaa-0a5bf5a55cfc | navyg18/dsa-tracker | LinkedList-2/IntersectionNode.cpp | ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode* t1=headA;
ListNode* t2=headB;
ListNode* temp1=headA;
ListNode* temp2=headB;
int size1=0,size2=0;
while(temp1!=NULL){
size1++;
temp1=temp1->next;
}
while(temp2!=NULL){
size2++;
temp... | ALGO | 0.999432 | 4.782711 |
434a5bfe-4394-41d1-971b-e6ea58ccfa60 | anproa31/ICPC | Self-Learn/CSES/missing_number.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define MAX 1e9 + 7
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);... | ALGO | 0.999877 | 3.485265 |
dc91c892-49c0-4b23-84bd-eabe9906333c | hihanghoeng33/One-Problem-a-day | 0326-power-of-three/0326-power-of-three.cpp | class Solution {
public:
bool isPowerOfThree(int n) {
if(n<=0){return false;}
int rem = n%3;
while(n!=1){
rem = n%3;
if(rem!=0){
return false;
}
n = n/3;
}
return true;
}
}; | ALGO | 0.999686 | 5.797388 |
5dcc61ca-4d62-4323-a8d1-f3ed49bf895b | VarunVeginati/leetcode | 1658-minimum-operations-to-reduce-x-to-zero/1658-minimum-operations-to-reduce-x-to-zero.cpp | class Solution {
public:
int minOperations(vector<int>& nums, int x) {
int total = 0;
for(int i=0; i<nums.size(); i++) {
total += nums[i];
}
int sum = total-x;
if(sum<0) return -1;
int left = 0;
int right = 0;
... | ALGO | 0.999969 | 5.904506 |
ca8d0979-4efd-4576-8e0d-69366fb1e897 | codgician/competitive-programming | HDUOJ/4699/stack_dp.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <iterator>
using namespace std;
#define SIZE 1000010
l... | ALGO | 0.999214 | 3.881439 |
c1c6c7b7-a6b7-49be-b49f-ecfce70068a4 | eosspark/eos-sidechain | SideChain/externals/binaryen/test/emscripten/tests/bullet/src/BulletDynamics/Dynamics/btContinuousDynamicsWorld.cpp | #include "btContinuousDynamicsWorld.h"
#include "LinearMath/btQuickprof.h"
//collision detection
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollisi... | ALGO | 0.960214 | 5.826431 |
8aa5cbfa-6f88-4d7d-9d68-3884e371ffdf | tarowatanabe/expgram | progs/expgram_vocab.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stdexcept>
#include <iterator>
#include <algorithm>
#include <expgram/Word.hpp>
#include <expgram/Vocab.hpp>
#include <expgram/Sentence.hpp>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <boost/algori... | DATA | 0.970644 | 7.436331 |
b1d38d95-c073-4c76-8792-19e1d212b99e | ishandutta2007/codeforces | turmax/normal/1288/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int p=(1e9+7);
vector <vector <int> > a;
int n,m;
pair <pair<int,int>,bool> go(int k)
{
vector <vector <int> > b;
b.resize(n);
set <vector<int> > d;
for(int i=0;i<n;++i)
{
b[i].resize(m);
}
for(int i=0;i<n;++i... | ALGO | 0.99999 | 3.844989 |
bad8540e-adb6-4120-ac44-f1dc85d1e476 | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/maximum-distance-in-arrays.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
int maxDistance(vector<vector<int>>& arrays) {
int result = 0;
int min_val = arrays[0].front(), max_val = arrays[0].back();
for (int i = 1; i < arrays.size(); ++i) {
result = max(result,
max(max_val ... | ALGO | 0.999933 | 5.908917 |
32c6c405-9127-42f1-ac23-a1e887057dca | ishandutta2007/codeforces | calabash_boy/normal/1046/A.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+100;
typedef long long ll;
struct Node{
int L,R,val;
}tree[maxn*50];
int cnt;
struct Segment_Tree{
int root = 0;
int newnode(){
++cnt;
tree[cnt].val = tree[cnt].L = tree[cnt].R = 0;
return cnt;
}
Segment_Tree(... | ALGO | 0.999608 | 3.453142 |
ba543388-c826-4144-9db0-d5fc45188d6c | NoiseProject/android_frameworks_av | media/libstagefright/codecs/amrwb/src/isp_isf.cpp | /*
------------------------------------------------------------------------------
Filename: isp_isf.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-----------------------------------------------------------------------------... | ALGO | 0.999315 | 5.655546 |
aba5b2bd-4da9-4cbd-b031-071501ad17e7 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12717_9.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int a[N], n, m, b[N];
int tomin(int now, int x) {
if (now + x >= m)
return 0;
else
return now;
}
bool check(int x) {
b[1] = tomin(a[1], x);
for (int i = 2; i <= n; i++) {
if (a[i] + x < b[i - 1]) return false;
if (a[i] + x == ... | ALGO | 0.999993 | 4.233687 |
a1d9db60-2d2f-4ad6-95b9-710d2a58f35d | Dhanushkagodage/fetch_jokes | 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 |
522fef25-40c4-450d-8be8-e239e36552d1 | Mahdi-IvI/smartlink-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.9988 | 6.76073 |
744a988c-c2c4-461c-8861-eddb1bc6e8a8 | luckcul/LeetCode | algorithms/Wildcard Matching/Wildcard Matching.cpp | class Solution {
public:
bool isMatch(string s, string p) {
int len1 = s.size();
int len2 = p.size();
vector<vector<bool>> dp(len2 + 1, vector<bool>(len1+1, false));
dp[0][0] = true;
for(int i = 1; i <= len2; i++) {
for(int j = 0; j <= len1; j++) {
... | ALGO | 0.999919 | 5.564755 |
3d3b95c8-6a99-4225-8fd5-256eef5b6208 | omnibor/llvm-omnibor | llvm-project/clang/lib/Analysis/LiveVariables.cpp | #include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/FlowSensitive/DataflowWorklist.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/raw_ostream.h... | TOOL | 0.969114 | 4.825477 |
02039de7-eaa9-45a9-b8e5-ebd93e32a42c | prabhat706/450-C- | doubleinsertlinkedlist.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *prev;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
this->prev = NULL;
}
};
int getlenght(Node *&head)
{
int len = 0;
Node *temp = head;
while (temp != N... | ALGO | 0.999825 | 4.453828 |
b2429d00-9c75-4fc9-a8f5-48e37c79f7ad | Hwangsangjin/CodeTree | 241125/굉장한 숫자/amazing-number.cpp | #include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
if ((N % 2 == 1 && N % 3 == 0) || (N % 2 == 0 && N % 5 == 0))
{
cout << "true";
}
else
{
cout << "false";
}
return 0;
} | ALGO | 0.999974 | 4.081872 |
7cc4ba97-099b-45b0-8846-446403214391 | Gongzihang6/Gongzihang6.github.io | site/blog/Computer Science/Algorithm/算法基础/code/dividing/dividing_1.cpp | #include <algorithm>
#include <cstring>
#include <iostream>
#if defined(_MSC_VER) && !defined(__clang__)
#include <immintrin.h>
#define __builtin_clz _lzcnt_u32
#endif
using namespace std;
using lld = long long;
int ti[2][17][131073];
int lowbit(int x) { return x & (-x); }
void fixup(int k, int x) {
for (; lowbit(... | ALGO | 0.999962 | 4.059644 |
21f5e732-87c1-4af7-bbe0-4c64428b7d93 | madhabdeb/Online-Judge-Problems | Most common problems/bubble-sort.cpp | #include<stdio.h>
int main()
{
int a,b,c,k,n,z,arr[100];
scanf("%d",&n);
for(a=1;a<=n;a++)
{
scanf("%d",&arr[a]);
}
for(a=1;a<n;a++)
{
b=1;
while(b<=n-a)
{
if(arr[b]>arr[b+1])
{
z=arr[b];
arr[b]=arr[b+1];
arr[b+1]=z;
}
b=b+1;
}
}
for(a=1;a<=n;a++)
{
printf("%d\n",arr[a... | ALGO | 0.999991 | 3.280373 |
14ba1d2e-a436-4059-9180-bb0a93942e98 | joeyjhg2/AiV_VisionSW_2 | opencv/sources/samples/cpp/dis_opticalflow.cpp |
#include "opencv2/core/utility.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/video.hpp"
using namespace std;
using namespace cv;
int main(int argc, char **argv)
{
CommandLineParser parser(argc, argv, "{ @video | vtest.avi | use video as inpu... | ALGO | 0.910484 | 4.780188 |
2027b98b-5d04-42a6-b5e1-b3c22ae4bc81 | DiegoInostroza/Practica-1-Estudio-NB-IoT | 5G-air-simulator/src/device/CqiManager/wideband-cqi-manager.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "wideband-cqi-manager.h"
#include "../NetworkNode.h"
#include "../../protocolStack/mac/AMCModule.h"
#include "../../utility/miesm-effective-sinr.h"
#include "../../load-parameters.h"
vector<int>
WidebandCqiManager::CalculateCqiFeedbacks (vecto... | ALGO | 0.940345 | 5.516095 |
c67f0b7c-5b78-405f-a9ca-2879265dd469 | hrishi7/techInterviewPrep | Data Structures(array, LL, stack,queue, etc..)/linked list problems/reArrangeList.cpp | #include<iostream>
using namespace std;
template <typename T>
class Node {
public:
T data;
Node* next;
Node(T data) {
next = NULL;
this->data = data;
}
~Node() {
if (next != NULL) {
delete next;
}
}
};
void printList(Node<int>* h){
Node<int>* t = h;
while... | ALGO | 0.999964 | 4.315866 |
8538309d-20ca-46ca-8e35-25d9c6aa9d26 | manikanta2901/ubuntu | .history/SRM/placementPractice/HackerRank/DataStructure/DetectCycle_20210310190414.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next;
};
void printList(struct Node *a){
cout << "List : ";
while(a != NULL){
cout << a->data << " ";
a = a->next;
}
cout << endl;
}
Node* GetInput(int size){
struct Node *temp,*head = NULL;
... | ALGO | 0.999309 | 3.293447 |
a0dad19a-0a57-4f0b-845e-5d3ffbdeed57 | utkarsh438-tech/codeforces_codes | E_Insane_Problem.cpp | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define vecc vector<vector<int>>
#define pb push_back
#define fr first
#... | ALGO | 0.999546 | 3.811423 |
31277c9b-df0b-4db4-a925-5a0a26cee598 | dngtundt/KTLT_NICE | chuong_4/BT_9_3_khuDeQuy.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int S3_iterative(int n) {
int sum = 0;
int partial_sum = 0;
for (int i = 1; i <= n; i++) {
partial_sum += i;
sum += partial_sum;
}
return sum;
}
int main() {
int n;
printf("Nhap n: ");
scanf("%d", &n);
printf("S3(n)... | ALGO | 0.998926 | 3.954007 |
97524774-ad2c-4e46-a9a6-4624659ae90d | raincross7/code-similarity | codes/train_code/problem419/problem419_432.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int dist=800;
for(int i=0;i<s.size()-2;i++){
int x=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
dist=min(dist,abs(753-x));
}
cout<<dist;
return 0;
}
| ALGO | 0.999693 | 3.395644 |
e977b76b-5ee8-4166-a498-5210386f34c6 | divyansh884/Leetcode | 1046-max-consecutive-ones-iii/1046-max-consecutive-ones-iii.cpp | class Solution {
public:
int longestOnes(vector<int>& nums, int k) {
deque<int> dq;
int i=0,j=0,n=nums.size(),ans=-1;
if(k==0){
int count=0;
for(int i=0;i<n;i++){
if(nums[i]==1)
count++;
else{
ans=max(count,... | ALGO | 0.999992 | 5.715463 |
87a46271-4698-411f-b63b-84061c816711 | mynametithi/W3_resource_exercise_DSA | 39_Practice.cpp | #include <iostream>
using namespace std;
int main()
{
int x, y;
cout << "Enter your first name:";
cin >> x;
cout << "Enter your last name:";
cin >> y;
cout << y << " " << x;
return 0;
} | TOOL | 0.871564 | 3.175451 |
b86059ce-bb6a-41a0-ae49-2ae0107df314 | saaadaliii/pf-lab | full pyramid.cpp | #include<iostream>
using namespace std;
int main()
{
int n = 5; // Number of rows for the pyramid
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n - i; j++) {
}
for (int j = 1; j <= 2 * i - 1; j++) {
cout << "*";
}
cout << endl;
}
return 0;
}
| ALGO | 0.999759 | 4.199663 |
7f65b246-e961-40bb-ae08-cc3d4c9bcc99 | hyturing/Competitive-Programming | Codeforces/DIV3-839/A.cpp | /**
* Author: hyturing
* Created:
**/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) ((int)(x).size())
#define all(x) x.begin(),x.end()
#define endl "\n"
#define pb push_back
const int MOD = 1e9+7;
const int MM = 998244353;
const int N = 1e5+5;
const long long INF = 1e18... | ALGO | 0.99957 | 5.242349 |
b123caa4-a43c-4bb3-9a58-796bd482a11c | zjhl2/ACM-template | 数学/O(n)逆元.cpp |
const int mo=1e9+7;
ll fac[N],inv[N],invfac[N];
ll C(int n,int m){
if (m>n) return 0;
return fac[n]*invfac[m]*invfac[n-m]%mo;
}
void init(int n){
fac[0]=invfac[0]=fac[1]=inv[1]=invfac[1]=1;
for (int i=2;i<N;i++){
fac[i]=fac[i-1]*i%mo;
inv[i]=(mo-mo/i)*inv[mo%i]%mo;
invfac[i]=invfac[i-1]*inv[i]%mo;
}
} | ALGO | 0.999712 | 3.962757 |
3c7bfb96-429d-4ea4-a733-f3c80b78a853 | paolaguarasci/domJudge | n72.cpp | #include <iostream>
using namespace std;
const int Studenti = 90;
const int Domande = 20 + 1;
const int Matricole = 9 + 1;
int punti(char [], char []);
int main() {
char sol[Domande];
cin.getline(sol, Domande);
char stud[Studenti][Matricole];
int pnt[Studenti] = {0};
int s = 0;
while(s < Studenti) {
cin >... | ALGO | 0.986201 | 3.305943 |
9c2ff9a9-6980-4b00-836a-b326d981e2f9 | KhaledSaiidi/Multi_Store_Ecommerce_Mobile_App | Multi_Store_Ecommerce_Mobile_App/Multi_Store_Ecommerce_Mobile_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.995464 | 6.797273 |
746dbf90-c989-4143-9ea8-160ae9290ae1 | shamiulriyad/codeforces | div 2/Codeforces Round 1039/A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(int tc)
{
int n,c;
cin >> n >> c;
vector<int>a(n);
}
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int tc, tt = 1;
cin >> tt;
for(tc = 1; tc <= tt; tc++)
{
solve(tc);
cout << endl;
}
return... | ALGO | 0.998606 | 3.263889 |
9861a32f-8f0c-472e-94ec-7baff50ad1de | dtr-beast/Data-Structures-and-Algorithms | LeetCode/CPP/75.sort-colors.cpp | /*
* @lc app=leetcode id=75 lang=cpp
*
* [75] Sort Colors
*/
#include <bits/stdc++.h>
using namespace std;
// @lc code=start
class Solution
{
public:
void sortColors(vector<int> &nums)
{
int i = 0, j = nums.size() - 1;
int k = 0;
while (i < j && k <= j && k < nums.size())
{
... | ALGO | 0.999646 | 6.16553 |
48b10467-55b0-434d-aa32-2334832d65ed | Code18Aryan/-CrackYourInternship | TREES/InorderTraversal.cpp | #include<bits/stdc++.h>
using namespace std;
class TreeNode{
public:
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int val){
this -> val = val;
this -> left = NULL;
this -> right = NULL;
}
};
class Solution {
public:
vector<int> inor... | ALGO | 0.999999 | 5.880338 |
1cd62444-62c7-461d-86bd-d21027e72503 | gilbertoalexsantos/judgesolutions | Solved/UVA/@UVA 452 - Project Scheduling/425 - Project Scheduling.cpp | //Author: Gilberto A. dos Santos
//Website: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=393
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
const int MAX = 26;
char w[50];
vector<int... | ALGO | 0.999542 | 3.890147 |
b0742c1d-ffdf-4ed3-820f-0ee24d910c5a | MayankKr8/InterviewBit_Solutions | Math/rearrange-array.cpp | void Solution::arrange(vector<int> &A) {
for(int i=0;i<A.size();i++) A[i] += A[A[i]%A.size()]*A.size();
for(int i=0;i<A.size();i++) A[i] /= A.size();
}
| ALGO | 0.999798 | 3.124693 |
1831e448-dda4-427e-ac96-7a4ded02a683 | zhenchen-jay/BezierDesigner | BezierCurves/Bezier/Eigen/unsupported/doc/examples/FFT.cpp | // To use the simple FFT implementation
// g++ -o demofft -I.. -Wall -O3 FFT.cpp
// To use the FFTW implementation
// g++ -o demofft -I.. -DUSE_FFTW -Wall -O3 FFT.cpp -lfftw3 -lfftw3f -lfftw3l
#ifdef USE_FFTW
#include <fftw3.h>
#endif
#include <vector>
#include <complex>
#include <algorithm>
#include <iterator>... | ALGO | 0.990862 | 6.121914 |
823a6bae-6a14-43b5-ab5e-692644a6d0a6 | yu2270977801/Huai-learning-process | 数据结构与算法/数据结构/双向链表.cpp | #include <iostream>
template <typename DataType> class DoubleList;
/***************˫㶨****************/
template <typename DataType> class DoubleListNode
{
private:
friend class DoubleList<DataType>; //ΪԪ
DoubleListNode() :m_pprior(NULL), m_pnext(NULL) {}
//캯ָʼΪ NULL
//캯ʼָ
DoubleListNode(const DataType item, Dou... | ALGO | 0.999298 | 3.934529 |
d9bc44ff-77e3-4650-a0d5-d4adbf31f3cc | tdye24/Algorithm | src/LeetCode/L62.cpp | /*
һλһ m x n Ͻ ʼͼбΪStart
ÿֻ»ƶһ
ͼﵽ½ǣͼбΪFinish
ܹжͬ·
*/
#include<bits/stdc++.h>
using namespace std;
int uniquePaths(int m, int n) {
int d[n][m];
fill(d[0], d[0]+n*m, 0);
for(int i=0; i<n; i++)
d[i][0] = 1;
for(int i=0; i<m; i++)
d[0][i] = 1;
for(int i=1; i<n; i++) {
for(int j=1; j<m; j++)
d[i][j] = d[i]... | ALGO | 0.999901 | 4.978203 |
0c04de09-8b61-47b2-bba8-78b138baf8e4 | Kasheesh-PrabhuDesai/Code-and-Learn-with-CPP | vectors/lower_bound_vectors.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n,q;
vector<int> iv,qv;
vector<int>::iterator low,up;
cin>>n;
for(int i=0;i<n;i++)
... | ALGO | 0.999943 | 4.014935 |
561c6c88-9b9a-4d0d-91d6-71fbaaecbd98 | tesla-69/Leetcode-Problems | 862-find-and-replace-in-string/find-and-replace-in-string.cpp | class Solution {
public:
string findReplaceString(string S, vector<int>& idx, vector<string>& src,
vector<string>& tg, string res = "") {
vector<pair<int, string>> r(S.size());
for (auto i = 0; i < idx.size(); ++i)
if (S.compare(idx[i], src[i].size(), src[i])... | ALGO | 0.99998 | 5.922647 |
4eaf397f-0a0c-429b-87d7-750f592426d3 | juandesant/AOflagger | src/strategy/algorithms/statisticalflagger.cpp | #include "statisticalflagger.h"
StatisticalFlagger::StatisticalFlagger()
{
}
StatisticalFlagger::~StatisticalFlagger()
{
}
bool StatisticalFlagger::SquareContainsFlag(Mask2DCPtr mask, size_t xLeft, size_t yTop, size_t xRight, size_t yBottom)
{
for(size_t y=yTop;y<=yBottom;++y)
{
for(size_t x=xLeft;x<=xRight;++x)... | TOOL | 0.942626 | 6.337712 |
5b6e53be-915e-45a1-be28-3087bd9eefda | icf/Code | C++ code/GpBCS_S.C.CPMC/SC_afqmcConstraintPathBP_3.1_ChargeContinuous_afqmclab_icf/include/eigen/lapack/cholesky.cpp | #include "lapack_common.h"
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf,(char* uplo, int *n, RealScalar *pa, int *lda, int *info))
{
*info = 0;
if(UPLO(*uplo)==INVALID) *info = -1;
else if(*n<0) ... | ALGO | 0.999772 | 6.004565 |
0a27d365-2246-40ff-96e1-4ed096a87d65 | ishandutta2007/codeforces | wxhtzdy/normal/1625/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
map<int, vector<int>> pos;
for (int i = 0; i < n; i++) {
... | ALGO | 0.999536 | 4.523678 |
014a0b80-d14c-4b89-9a95-18150305ff17 | PerfectoZ/effective-succotash | Problems Solved/AGAGA_XOR.cpp | // pick any 2 adjacent elements and replace them by their xor if all the elements same can be left in array print yes
#include<bits/stdc++.h>
#define ll long long int
#define pi 3.1415926535897932385
#define mod 1000000007
#define db double
#define pp(x) pair<x,x>
#define ff first
#define ss second
#define FIO ios_b... | ALGO | 0.999898 | 3.891577 |
6e6b035c-99f6-41a0-942d-5963ff61e680 | ISOLDE-Project/riscv-llvm | libc/src/stdbit/stdc_trailing_ones_uc.cpp | #include "src/stdbit/stdc_trailing_ones_uc.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/common.h"
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(unsigned, stdc_trailing_ones_uc, (unsigned char value)) {
return static_cast<unsigned>(cpp::countr_one(value));
}
} // namespace LIBC_NAMESPACE
| TOOL | 0.8935 | 6.750756 |
1c9e9b77-20a6-44f8-9208-f3070fc93a48 | vidalt/Districting-Routing | Evaluator/Solution-Cost-Evaluation/Polygon.cpp | /* C++ program to check if a given point lies inside a given polygon
From: https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/ */
#include "Polygon.h"
bool onSegment(Point p, Point q, Point r)
{
return (q.x < max(p.x, r.x) + MY_EPSILON && q.x > min(p.x, r.x) - MY_EPSILON && q.y < max(p.y, r... | ALGO | 0.999885 | 5.455264 |
f6868c2b-227b-4f5b-bf7e-d9ff299bf0cd | ManuelaBerrioCabeza/hw3 | hw3_tests/testing_utils/Utility.cpp | #include "Utility.h"
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <fstream>
// trim from start
std::string <rim(std::string &s)
{
s.erase(s.begin(), std::find_if(s.begin(), s.end(),
std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
// trim from end
std::str... | TOOL | 0.948993 | 5.694603 |
4a878f8e-650a-43a1-8497-b1190e555ea2 | viditrastogi11/DSA | practice/rotatematrixinbuilt.cpp |
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
vector<int> coins{1,2,3,4,5,6};
rotate(coins.begin(),coins.begin()+2,coins.end());
next_permutation(coins.begin(),coins.end());
for(int x:coins)
{
cout<<x;
}
}
| ALGO | 0.999385 | 3.504868 |
f5e3570e-0abe-47dc-a094-4e5a003d3027 | lIzworski/basics-of-C-Plus-Plus | najwiekszy wspolny dzielnik/nwd.cpp | // Lucjan Izworski
// zad NWD
#include <iostream>
using namespace std;
int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
int findGCD(int arr[], int n)
{
int result = arr[0];
for (int i = 1; i < n; i++)
{
result = gcd(arr[i], result);
if(result == 1)
... | ALGO | 0.999874 | 4.744697 |
e2270fdd-3f53-4592-9b89-f7adf46ffb58 | williamchenwl/ACMLibrary | Graph/MinmumCostFlowSPFA.cpp | const int inf = ~0U>>1;
const int N = 610;
const int M = N * 400;
int S,T;
struct Edge{
int from,to,next,cap,cost;
Edge(){}
Edge(int From,int To,int Next,int Cap,int Cost)
{
from=From,to=To,next=Next,cap=Cap,cost=Cost;
}
}e[M];
int head[N];
struct Mcmf{
int tot;
int dis[N],vi... | ALGO | 0.999868 | 3.591273 |
d114e70a-48ca-4bc4-93cc-94ec7e8b2dbd | saudjavaid2003/DSA-c-important-questions | ARRAYS AND MATRIX AND STRINGS/peak elemet.cpp | #include<iostream>
#include<vector>
using namespace std;
int peakindex(vector<int>&arr);
int main(){
vector <int> vect{1,2,3,4,5};
int ans;
ans=peakindex(vect);
cout<<ans<<endl;
return 0;
}
int peakindex(vector<int>&arr){
int max=arr[0];
int index;
for(int i=0;i<arr.size();i++){
if(arr[i]>max){
index=i;
... | ALGO | 0.999788 | 4.431079 |
6bc42e03-636e-4565-aff1-45750296f713 | Jotalz/apex_dma_kvm_pub | apex_dma/memory.cpp | #include "memory.hpp"
struct FindProcessContext
{
OsInstance<> *os;
const char *name;
ProcessInstance<> *target_process;
bool found;
};
bool find_process(struct FindProcessContext *find_context, Address addr)
{
if (find_context->found)
{
return false;
}
if (find_context->os->process_by_address(a... | TOOL | 0.891804 | 4.541429 |
d9a2618c-43f0-40b7-8382-24361a66ea0d | virttuall/ProgrammingContests | ProgrammingContests/src/uva/Uva_12671_DisjointWaterSupply.cpp | #include <bits/stdc++.h>
#define s(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define printInt(n) printf("%d\n", n)
#define maX(a,b) ( (a) > (b) ? (a) : (b))
#define miN(a,b) ( (a) < (b) ? (a) : (b))
using n... | ALGO | 0.978224 | 3.767462 |
03a30cf2-f057-4266-b61c-dcb95001885c | ZashJie/Cpp_Primer_Answer-personal-analysis | Chapter 10/10_25.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using std::string; using std::vector;
using namespace std::placeholders;
void elimdups(vector<string>& vs)
{
std::sort(vs.begin(), vs.end());
vs.erase(unique(vs.begin(), vs.end()), vs.end());
}
bool check_size(const ... | ALGO | 0.999463 | 5.47499 |
629e80f3-ce4a-436a-b965-72b15047f10b | MIT-SPARK/pose4dof | src/Pose4DoFSLAMExample.cpp | #include <gtsam/inference/Key.h>
#include <gtsam/nonlinear/GaussNewtonOptimizer.h>
#include <gtsam/nonlinear/LevenbergMarquardtOptimizer.h>
#include <gtsam/nonlinear/Marginals.h>
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
#include <gtsam/nonlinear/Values.h>
#include <gtsam/slam/BetweenFactor.h>
#include <gtsam/s... | ALGO | 0.999497 | 6.716612 |
c77b097b-7244-4ef5-a6bf-55d7a9b013e5 | we-are-kicking-lhx/xinxinalgorithm | L303. Range Sum Query - Immutable.cpp | class NumArray {
public:
vector<int> sum;
NumArray(vector<int>& nums) {
sum.resize(nums.size()+1);
for(int i=0;i<nums.size();i++)
sum[i+1]=sum[i]+nums[i];
}
int sumRange(int i, int j) {
return sum[j+1]-sum[i];
}
};
| ALGO | 0.999681 | 6.174214 |
3ab44935-3004-46ae-a6fc-6760c141c160 | Karthik-Ragunath/competitive_programming | HammingString.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
int main()
{
int testcases;
cin >> testcases;
for(int i = 0; i < testcases; i++)
{
int numberOfTerms;
cin >> numberOfTerms;
vector <int> vectorA(numberOfTerms);
... | ALGO | 0.999917 | 3.648665 |
f977cf0d-f878-4f02-b0e4-e89b033a44a7 | ishandutta2007/codeforces | rns3/normal/621/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define out(x) cerr << #x"=" << x << endl
long double x, y, z;
double dx, dy, dz;
long double val[13];
char s[][20] = {"", "x^y^z", "x^z^y", "(x^y)^z", "(x^z)^y",
"y^x^z", "y^z^x", "(y^x)^z", "(y^z)^x",
"z^x^y", "z^y^x", "(z^x)^y", "(z^y)^x"};
int main() {
scanf(... | ALGO | 0.999963 | 4.158585 |
855c2b33-02fa-498e-a355-6ab984f6bc12 | diaaserag/URI-ONLINE-JUDGE- | 1547 - Guess What.cpp | // main.cpp
// answer 1547 - Guess What uri online judge
// solved by diaa serag
// Try hard before using other programmers' codes
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int num,count,s,a[1000],temp=100000,resalt=0;
cin>>count;
while(count--)
{
cin>>num... | ALGO | 0.999748 | 3.066542 |
40e89222-1d6e-499d-8408-880fbac207e9 | ishandutta2007/codeforces | sumitacchan/normal/1209/B.cpp | #include <bits/stdc++.h>
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 gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tre... | ALGO | 0.999957 | 4.16811 |
45ae1208-e5d2-4e60-bf76-265d8f2cd8e2 | nhingthao1203/CSLT | Chuong5/BTH8/BT09.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
const int MS = 100;
using namespace std;
long DaThuc(int a[], int n, int x)
{
long reslt = 0;
for (int i = 0; i < n + 1; i++)
{
reslt += a[i] * pow(x * 1.0, i);
}
return reslt;
}
int main()
{
int a[MS], n, x;
cout << "Nhap ba... | ALGO | 0.99939 | 3.551367 |
a498049c-35c6-45a4-a911-bd92402374e5 | scloke/SegTest | bgslibrary/algorithms/LBSP/BackgroundSubtractorLOBSTER.cpp | #include <iostream>
#include <iomanip>
#include <opencv2/imgproc/imgproc.hpp>
#ifndef MEX_COMPILE_FLAG
#include <opencv2/highgui/highgui.hpp>
#endif
#include "BackgroundSubtractorLOBSTER.h"
#include "RandUtils.h"
using namespace bgslibrary::algorithms::lbsp;
BackgroundSubtractorLOBSTER::BackgroundSubtractorLOBSTER(... | ALGO | 0.995597 | 6.747607 |
a2d8909e-f24b-422c-be37-388b4f88fd50 | imulan/procon | yukicoder/94.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
struc... | ALGO | 0.999584 | 3.999256 |
48f0e90f-6c52-4c1e-bf1d-84a7fa013058 | florenciarimolo/LABS-IDI | exercicis_examen/ex10/Model/model.cpp | #define __MODEL__DEF__ 1
#include "model.h"
#include <fstream>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cassert>
using namespace std;
// === Local stuff:
static int material = 1;
static void loadMTL(std::string filename);
static int findMat(string material);
static void omplenormals(vector<Face... | TOOL | 0.910943 | 5.094295 |
85e91844-aec2-4d33-8321-897b04b45106 | Admiral-Fish/PokeFinderCore | RNG/RNGEuclidean.cpp | #include "RNGEuclidean.hpp"
// See https://crypto.stackexchange.com/a/10629 for how the following math works
// Uses Euclidean divison to reduce the search space (kmax) even further then RNGCache
// Only beneficial for smaller multipliers such as XDRNG
RNGEuclidean::RNGEuclidean(Method FrameType)
{
setupEuclidean... | ALGO | 0.924211 | 6.177426 |
3883d521-78b8-4c67-bbc1-d2ed89cf4087 | whtqh/cryptarithmetic | CryptPuzzleGame/cryptarithmetic/divide_formula.cpp | #include "divide_formula.h"
using namespace std;
divide_formula::divide_formula(string str_up, string str_down, string *str_in, string *str_remain, string str_ans)
{
answer = new int*[ANSWER_MAX_NUM];
answer_num = 0;
// Set Known Constant
constant = new symbol[10];
result = new symbol[10];
int k = str_dow... | ALGO | 0.999589 | 3.115854 |
172f601d-232f-492d-9fe6-3761c2da40c4 | ishandutta2007/codeforces | cqxym/normal/1359/A.cpp | #include<stdio.h>
int main(){
int t,n,m,k;
scanf("%d",&t);
for(register int i=0;i!=t;i++){
scanf("%d%d%d",&n,&m,&k);
int x=n/k,y;
x=x>m?m:x;
y=(m-x+k-2)/(k-1);
printf("%d\n",x-y);
}
return 0;
} | ALGO | 0.999857 | 3.083886 |
324bc91c-b71b-4164-9615-6cbd722dca75 | SaranshBangar/GeeksforGeeks-Solutions | Difficulty: Medium/The Celebrity Problem/the-celebrity-problem.cpp | class Solution {
public:
int celebrity(vector<vector<int>>& mat)
{
int n = mat.size();
// make popularity matrix
vector<int> popularity(n, 0);
for(int i = 0; i<n; i++){
for(int j = 0; j<n; j++){
popularity[j] += mat[i][j];
}
}
... | ALGO | 0.999054 | 5.675391 |
40660564-5ac6-4e99-9cff-e621f2392ef8 | kefengshi001/Aerospace_arm | src/my_ros_package/3rdparty/kdl/src/chainiksolvervel_wdls.cpp | // Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// URL: http://www.orocos.org/kdl
#include "chainiksolvervel_wdls.hpp"
#include "utilities/svd_eigen_HH.hpp"
namespace KDL
{
ChainIkSolverVel_wdls::Cha... | ALGO | 0.999757 | 5.976416 |
4ba9c6f7-f559-4e52-bd83-64ad18e87b73 | Aleksei12082001/week12 | week7/task2/src/main.cpp | #include <iostream>
#include <set>
#include <ctime>
#include <numeric>
#include <algorithm>
#include <vector> // Добавлено для использования std::vector
#include "../include/product.h"
#include "../include/customer.h"
#include "../include/order.h"
#include "../include/goods.h"
using namespace std;
int main() {
... | TOOL | 0.954919 | 6.568995 |
e29197f6-5244-4b5a-bda2-52e0ea30e000 | dhirajpatil2346/compitative | a20j/rank_list.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
map<int, vector<int>> m;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
m[x].push_back(y);
}
int p = 0, lp = 0, x = 0;
int cp = 0;
vector<int> vct;
for (auto &val ... | ALGO | 0.999976 | 4.133016 |
53f389bc-fbe4-4390-9cce-14406cc0e494 | lavanyasureshkannan/Leetcode-problems-cpp | stack/basic_calc_3.cpp | #include<iostream>
#include<stack>
#include <string.h>
using namespace std;
int calculate(string s)
{
// base case
if (s.size() == 0)
{
return 0;
}
stack<int> st;
char operation = '+';
long curr_num = 0;
int result = 0;
for (int i = 0; i< s.size(); i++)
{
... | ALGO | 0.999842 | 3.833903 |
ab18dc9c-b972-4467-9ed6-d1b70b931c87 | messyidea/ACM-Codes | 比赛/广东工业大学校赛/决赛/b.cpp | /***********************************************\
|Author: YMC
|Created Time: 2015/3/15 13:18:44
|File Name: b.cpp
|Description:
\***********************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#inc... | ALGO | 0.99982 | 3.376905 |
b9cb4df2-2833-4edc-a4be-275ecf1b0be8 | nishant25kr/DSA-codes | 0123-best-time-to-buy-and-sell-stock-iii/0123-best-time-to-buy-and-sell-stock-iii.cpp | class Solution {
public:
int f(int i, int buy, int cap, vector<int> &prices, int n, vector<vector<vector<int>>> &dp){
if(i == n || cap == 0) return 0;
if(dp[i][buy][cap] != -1) return dp[i][buy][cap];
if(buy == 1){
dp[i][buy][cap] = max(
-prices[i] + f(i+1, 0, c... | ALGO | 0.999973 | 6.109444 |
84d7ca58-1b35-4af4-804a-0fd805c0541a | leejseo/PS | UCPC/2020/Preliminaries/J.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, M;
vector<vector<int>> E;
int res[100005], org[100005], cur[100005];
int T[100005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N >> M;
for (int i=1; i<=M; i++){
int l; cin >> l;
ve... | ALGO | 0.999994 | 4.047675 |
34850164-6661-47e9-89e6-4c3e8c59c539 | welcomestone/C---Beginner | 022/main.cpp | #include <iostream>
#include <vector>
#include <set>
using namespace std;
//模版
//类模版
template<typename T> //定义一个 类模版 使用和函数模版移植
class Vector3
{
private:
T m_vec[3];
public:
Vector3(T v1, T v2, T v3){
m_vec[0] = v1;
m_vec[1] = v2;
m_vec[2] = v3;
};
T getMax();
... | TOOL | 0.949749 | 4.003558 |
d6fd5baf-c037-427f-9770-83911020d105 | msantana-01/Listao_C-- | quest_87.cpp | /*87) Foram anotadas as idades e alturas de 30 alunos. Faça um Programa que determine
quantos alunos com mais de 13 anos possuem altura inferior à média de altura desses
alunos.*/
#include<stdio.h>
#include<stdlib.h>
#include<locale.h>
#include<iostream>
#include<windows.h>
int main()
{
setlocale(LC_ALL, "pt_BR.... | TOOL | 0.990288 | 4.332645 |
196ff280-cbe2-46db-9bcb-6469db010d46 | Shreya-2022/Array | occ.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v(6);
for(int i = 0; i < 6; i++) {
cin >> v[i];
}
cout << "enter x: ";
int x;
cin >> x;
int occurrence = -1;
for(int i = 0; i < v.size(); i++) {
if(v[i] == x) {
occurrence ... | ALGO | 0.997885 | 4.466833 |
4cdce3ab-20b5-4b3f-976a-d566604643a7 | Raquelgr/ED-20232 | TP1/src/main.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <getopt.h>
#include <avaliacao.hpp>
#include <arvoreDeSatisfabilidade.hpp>
using namespace std;
#define TAMANHO_MAXIMO_FORMULA 1000000
#define TAMANHO_MAXIMO_VALORACAO 100
int main(int argc, char* argv[]) try {
int opt;
string formula;
str... | ALGO | 0.998434 | 5.465072 |
3675b986-6c33-46a7-a434-798778352c68 | abhijeet2096/cc | codechef/XORIER/p1.cpp | #include <bits/stdc++.h>
#define MAXSIZE 100000
using namespace std;
bool checkMyProp(int N,vector<int> allPrime,vector<int> primeHash);
void fillAllPrime(vector<int> &a,vector<int> &b,int N);
bool isPrime(int n);
int main()
{
int T;
cin >> T;
int N,cnt;
vector<int> allPrime;
vector<int> primeHa... | ALGO | 0.999848 | 4.432012 |
3112514e-0574-4dc8-b571-ee6b85ffe360 | GreengageDB/greengage | src/backend/gporca/libgpopt/src/engine/CEnumeratorConfig.cpp | #include "gpopt/engine/CEnumeratorConfig.h"
#include "gpos/base.h"
#include "gpos/error/CAutoTrace.h"
#include "gpos/io/COstreamFile.h"
#include "gpos/memory/CAutoMemoryPool.h"
#include "gpos/task/CAutoSuspendAbort.h"
#include "gpos/task/CTask.h"
#include "gpos/task/CWorker.h"
#include "gpopt/base/CIOUtils.h"
#includ... | ALGO | 0.884318 | 3.545447 |
30ec9512-eced-424c-a4e8-100961bb2ee3 | jy0205/CCF | CCF-2017-03/2.cpp | #include <iostream>
#include <list>
#include <algorithm>
using namespace std;
list<int> queue;
int main(){
int n,m,p,q;
cin >> n >> m;
for(int i = 0;i < n;i++){
queue.push_back(i+1);
}
for(int i = 0;i < m;i++){
cin >> p >> q;
auto iter = find(queue.begin(),queue.end(),p);
iter = queue.erase(iter);
if(q... | ALGO | 0.999988 | 3.446567 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.