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 |
|---|---|---|---|---|---|---|
812ebd34-36bb-4f74-8d7b-4d49c2e15258 | xoyojank/nebula3 | code/extlibs/OGDF/src/energybased/EnergyFunction.cpp | /*
* $Revision: 2552 $
*
* last checkin:
* $Author: gutwenger $
* $Date: 2012-07-05 16:45:20 +0200 (Do, 05. Jul 2012) $
***************************************************************/
#include <ogdf/internal/energybased/EnergyFunction.h>
namespace ogdf {
EnergyFunction::EnergyFunction(const String &funcna... | ALGO | 0.991354 | 6.285431 |
f6f430f4-f432-445a-b19d-e94f7ea88faf | AsLoLoks-0/Cpp | archived/2324/dziedziczenie/zadanie z maturt/zadanie nawiasy/Nawiasy.cpp | #include"iostream"
#include"fstream"
using namespace std;
int main(){
ifstream data("dane2_4.txt");
int line_caunt=30;
for(size_t i=0;i<line_caunt;i++) {
string line;
data>>line;
int depth=0;
int max_depth=0;
bool correct=1;
for(size_t i=0;i<line.size();i++) {
if(line[0]==']' || line[lin... | ALGO | 0.997364 | 3.741237 |
7ac9b0bf-68ea-463b-a647-dce0f2cb024f | ngoyal2707/SPOJ-solutions | NFURY.cpp | #include<iostream>
#include<cmath>
#include<cstring>
#define MAX 1010
using namespace std;
int main(){
int result[MAX];
memset(result,0,sizeof(result));
for(int i=1;i*i<=1000;i++){
result[i*i]=1;
}
for(int i=2;i<=1000;i++){
if(result[i]!=1){
result[i]=2000;
for(int j=1;j*j<=i;j++){
result[i]=min(res... | ALGO | 0.999474 | 3.658484 |
4ebf3c8c-5516-46f1-b6fa-a2954ded2bf9 | Sosuke23/CSES | Dynamic Programming/1745.cpp | // Problem Link: https://cses.fi/problemset/task/1745
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> money(n);
for (auto &x : money) {
cin >> x;
}
int max_sum = n * 1000;
vector<vector<bool>> Dp(n + 1, vector<bool> (max_sum + 1, false));
... | ALGO | 0.999952 | 4.47366 |
e2c7a50e-7678-4e6d-a1b2-03e8244f1e04 | Mominul36/problem-Solving | LeetCode/66. Plus One.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& a)
{
vector<int> c;
reverse(a.begin(),a.end());
//print(a);
int car=1;
for(int i=0;i<=a.size();i++)
{
if(i==a.size() && car==0 )
break;
if(i==a.size() && car!=0){
c.push_back(car);
break;
}
c.push_back((a[... | ALGO | 0.999791 | 5.463549 |
9111c0e5-0f9f-4ff6-b765-f6417e246602 | mohamed179/compititive-programing-template | problems/uva/100_1999/500_599/599/sol.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;
#define UNVISITED 0
#define VISITED 1
#define MAX 100000+10
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<string> vs;
int t, n, e, countVisited, lastCountVisited, visited[MAX]... | ALGO | 0.99952 | 3.801751 |
84e0fa73-1773-49d5-a6fe-93e4539590bd | alexvelea/competitive | contests/codeforcesRound325/a.cpp | //Problem a @ 06-10-2015
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int inf = 0x3f3f3f3f, kMaxN = 4005;
#define int64 long long
int n;
bool inLine[kMaxN];
int64 v[kMaxN], p[kMaxN], d[kMaxN];
void cry(int ind, int64 val) {
inLine[ind] = false;
for (... | ALGO | 0.999991 | 3.272851 |
28684ec1-5008-4d38-a6da-e21fac56cd64 | gavin971/CPP_Learning | Cpp-Primer/ch15/ex15.21.22/main.cpp | /***************************************************************************
* @file main.cpp
* @author Alan.W
* @date 23 Jan 2014
* @remark This code is for the exercises from C++ Primer 5th Edition
* @note
***************************************************************************/
//
... | TOOL | 0.930744 | 4.216632 |
9f397f3d-7646-4d41-acb2-6c6162ee6c83 | iagorrr/Competitive-Programming-Solutions | submissions/ICPC/2024 ICPC Gran Premio de Mexico 1ra Fecha/G. Granitus Stone Towers.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
set<int> a;
for(int i = 0; i <n ; i++) {
int x;
cin >>x;
a.insert(x);
}
int win = 0, nxt = 1;
for (auto x : a) {
if(x == nxt) win^=1, nxt++;
}
cout << (win... | ALGO | 0.999937 | 4.815026 |
c7008fd9-879f-4a1d-a6f1-eb28f48f7527 | Nezz7/Competitive-programming | Codeforces/#574 (Div. 2)/B.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define LL long long
#define LD long double
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
int const MAXN = 2e6 + 9;
int n, k;
LL che... | ALGO | 0.999924 | 4.501276 |
81475ddd-aa1e-4f6f-8119-73de3d1a48e3 | MithleshKr-Pro/DSA | Stacks/valid_parenthesis.cpp | #include <iostream>
#include <stack>
using namespace std;
bool match_parenthesis(stack<char> s1)
{
if (s1.top() == ')' || s1.top() == '}' || s1.top() == ']')
{
return true;
}
else
{
return false;
}
}
bool valid_parenthesis(string s)
{
int i = 0;
stack<char> s1;
while... | ALGO | 0.991288 | 4.411276 |
970d3247-209d-403a-89ec-09846de9a3bb | UQ-PAC/RG_Gen | existing-tools/horn-ice/z3-4.7.1/src/smt/smt_for_each_relevant_expr.cpp | #include "smt/smt_context.h"
#include "smt/smt_for_each_relevant_expr.h"
#include "ast/ast_pp.h"
#include "ast/ast_ll_pp.h"
namespace smt {
bool check_at_labels::check(expr* n) {
m_first = true;
return count_at_labels_pos(n) <= 1;
}
unsigned check_at_labels::count_at_labels_lit(expr* n, b... | ALGO | 0.969671 | 7.393499 |
70f837e0-8e24-4af0-a76e-161d12277fe0 | ishandutta2007/codeforces | littlebeetle/normal/134/B.cpp | // luogu-judger-enable-o2
#include<cstdio>
int n,i,a,b,o,s=1<<30;
int main(){
scanf("%d",&n);
for(i=1;i<=n;i++){
a=i;b=n;o=0;
while(a%b&&b%a){
if(a>b)
o+=a/b,a%=b;
else
o+=b/a,b%=a;
}
if(a==1||b==1){
if(a>b)
o+=a-1;
else
o+=b-1;
s=o<s?o:s;
}
}
printf("%d",s);
} | ALGO | 0.999951 | 3.326574 |
c81cc935-afb6-49ab-ad7b-5519ee57e0fa | devanshV18/DSA | Leetcode & GFG/Strings/validPalindrome.cpp | #include<iostream>
#include<algorithm>
#include<cctype> // for isalnum function
using namespace std;
//Brute force and string building method -> takes extra space and memory
bool validPalindrome(string s){
string newStr = "";
//picking each character from the string and checking if it is alphanumeric, if it i... | ALGO | 0.999801 | 5.861521 |
5e3f9325-bfdb-486c-b5f5-233011aec0b4 | muthu165/C-Plus-Plus-programs-and-Data-Structures | coin-greedy.cpp | #include<bits/stdc++.h>
using namespace std;
int fun(vector<int>&v,int k,int n){
if(k==0) return 0;
else if(k<v[n-1]) return -1;
else{
for(int i=0;i<n;i++){
if(v[i]>k) continue;
else{
return 1+fun(v,k-v[i],n);
}
}
}
}
int main(){
int n;
cin>>n;
vector<int>v;
// No of element to be stored in vec... | ALGO | 0.999953 | 3.878121 |
4b6c022d-f46b-4744-9388-16951bf226a0 | bsunobs-github-io/square | interpreter/llvm/src/tools/clang/lib/Driver/ToolChains/XCore.cpp | #include "XCore.h"
#include "CommonArgs.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Options.h"
#include "llvm/Option/ArgList.h"
#include <cstdlib> // ::getenv
using namespace clang::driver;
using namespace clang::driver::toolchains;
using namespace clang;
using name... | TOOL | 0.896365 | 6.101585 |
7bb90e82-618e-407e-98ae-af9a331cb320 | streichgeorg/meshless_deformations | extern/libigl/python/py_igl/py_fit_rotations.cpp | m.def("fit_rotations", []
(
const Eigen::MatrixXd& S,
const bool single_precision,
Eigen::MatrixXd& R
)
{
return igl::fit_rotations(S, single_precision, R);
}, __doc_igl_fit_rotations,
py::arg("S"), py::arg("single_precision"), py::arg("R"));
m.def("fit_rotations_planar", []
(
const Eigen::MatrixXd& S,
Eig... | ALGO | 0.931639 | 6.320322 |
4081747c-d098-4836-9862-0a4490827206 | raincross7/code-similarity | codes/train_code/problem329/problem329_199.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);... | ALGO | 0.999946 | 3.287765 |
1cbe634f-edd2-41a3-ab18-0384ddff496a | mdfaizan2101/DSA-Problem | 04_Directory.cpp | #include<bits/stdc++.h>
using namespace std;
class TrieNode
{
public:
char data;
TrieNode* children[26];
bool isTerminal;
TrieNode(char ch)
{
data = ch;
for (int i = 0; i < 26; i++)
{
children[i] = NULL;
}
... | ALGO | 0.999924 | 5.548378 |
9eafe0a4-2ac9-4cd6-93c2-dae3fac9d0f1 | SamrithaShree/data-structures-lab | Lab04/linkedlist1.cpp | //program to perform functions of List ADT - Linked List implementation
#include<stdio.h>
#include<stdlib.h>
class LinkedList{
private:
struct node{
int data;
struct node *next;
}*head;
public:
LinkedList(){
head = NULL;
}
void InsBeg(int);
void InsEnd(int);
... | ALGO | 0.999801 | 4.335889 |
e274684b-0999-4266-ad4e-fa16cf1912f0 | Ivan-71-ua/Competitive-Programming | school/contest4/Anansis_Cobweb.cpp | #include <bits/stdc++.h>
#define fast std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
int cc = 0;
std::vector <int> parent;
void setup(int n)
{
parent.resize(n + 1);
for (int i = 1; i <= n; i++)
{
parent[i] = i;
}
}
int getParent(int v)
{
if (parent[v] == v)
{
... | ALGO | 0.999937 | 4.217977 |
d7a7ba1a-99bf-4751-a0a8-a6ce837b8cf7 | khushDhillonGit/C--Practice | KMPAlgo.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
};
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(... | ALGO | 0.999946 | 5.047774 |
72a3230c-eec4-4ee4-9003-f14ae2ed8ddc | umaidansari12/CP | previous_codes/motivation.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool comp(pair<int, int> &a, pair<int, int> &b)
{
return a.second > b.second;
}
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin >> t;
while (t--)
{
int n, x, ans;
cin >> n >> x;
vector<pair<in... | ALGO | 0.999984 | 4.847672 |
744c3836-f9fa-46b0-a9ee-d29628d8cf7c | abdullahmunirr/leetcode-solutions | 135. Candy.cpp | // Algorithm
// A max function to find max
// Create an array for candies for each child
// Add one candy for each child
// If a child has more rating than his previous one, his candies = previous child's candies + 1
// If a child has more rating than his next one, compare his candies with 1+ his next one's
// and his ... | ALGO | 0.999999 | 6.200876 |
2526d2dd-f733-40f6-a10d-25829ebb5655 | raincross7/code-similarity | codes/train_code/problem434/problem434_255.cpp | #include <bits/stdc++.h>
#define LL long long
#define P pair<int, int>
#define Fengexian cout<<"WZY%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl
const LL N = 1e5 + 10;
const LL mod = 998244353;
const LL inf = 0x3f3f3f3f;
const double eps = 1e-9;
using namespace std;
template <typename tp>
inline void read(tp &x)
{
x = ... | ALGO | 0.999973 | 3.628515 |
7de89116-ce4f-4aaa-9f0e-3a62e0305f13 | BhavyaBhalla-27/DSA-Supreme- | DSA_Sheet_Love Babbar/Arrays/22. Factorial of a large number/Simple_Solution.cpp | #include <iostream>
#include<algorithm>
#include <vector>
using namespace std;
void factorial(int n)
{
vector<int> ans;
// Initially push 1 to the ans
ans.push_back(1);
int carry = 0;
// For factorial multiplication
for (int i = 2; i <= n; i++)
{
// For storing the answer
for... | ALGO | 0.999973 | 5.528481 |
a3ae85b9-3b16-4ac8-8a8c-e201f8283b3b | Zivallo/Algorithm | ETC/MIN/DP/TOP_DP_01_피보나치 수열.cpp | #include <iostream>
using namespace std;
int n, memo[40] = { 0,0,1 };
int fibo(int th) {
if (th == 1) return 0;
if (th == 2) return 1;
if (memo[th] > 0) return memo[th];
int a = fibo(th - 1);
int b = fibo(th - 2);
memo[th] = a + b;
return a + b;
}
int main() {
cin >> n;
cout << fibo(n);
return 0;
} | ALGO | 0.999977 | 4.73481 |
07003767-d799-4b3e-9f03-9de199e16fcc | sjx95/codeforces | 1796/p1796c.cpp | #include <cstdint>
#include <ios>
#include <iostream>
#include <cmath>
using namespace std;
const int64_t magic = 998244353;
void solve() {
int l, r;
cin >> l >> r;
int size = 1;
for (int x = r / l; (x=x/2) > 0; ++size);
if (size == 1) {
cout << 1 << ' ' << (r - l + 1) << endl;
return;
}
int sp1 = r, sp2... | ALGO | 0.99968 | 4.726216 |
ee61a6ee-00d9-46d8-bd79-b01577b6c2b3 | Istimam/phitron_code | 2.C++ For Data Structure/Week01 Introduction to C++/Module04 Mid Term Exam/q_3d.cpp | #include<bits/stdc++.h>
using namespace std;
class Person
{
public:
char name[100];
float height;
int age;
Person(char* nam,float h,int a)
{
strcpy(name,nam);
height=h;
age=a;
}
};
int main()
{
char name1[100]="Isti";
Person* Isti = new Person(name1,5... | TOOL | 0.895809 | 3.618794 |
62e15a45-ab6e-4bc5-9b4b-9bfb8ba1981d | gskabdwal/LeetCode | 2730-maximum-or/2730-maximum-or.cpp | class Solution {
public:
long long maximumOr(vector<int> &A, int k) {
int n = A.size(), left = 0;
vector<int> right(n);
long res = 0;
for (int i = n - 2; i >= 0; --i) {
right[i] = right[i + 1] | A[i + 1];
}
for (int i = 0; i < n; i++) {
res = m... | ALGO | 0.99996 | 5.007945 |
eed9d872-0777-471e-993a-4ef81cfd100e | hoanxuanbach/Competitive-Programming | ICPC/Regional + Team Contest/SWERC 2022/H.cpp | #include<bits/stdc++.h>
using namespace std;
set<int> s;
void f(int x,int y){
int g=__gcd(x,y);
for(int i=1;i<=sqrt(g);i++){
if(g%i==0){s.insert(i);s.insert(g/i);}
}
}
void solve(){
s.clear();
int w,l;cin >> w >> l;
f(w-1,l-1);f(w-2,l);f(w,l-2);
s.insert(2);
cout << (int)s.size()... | ALGO | 0.999848 | 3.74172 |
8eec28f0-05f4-46e1-80db-71f5f5697d3c | BRUTEUdesc/AlmanaqueBrute | Codigos/String/Trie/trie.cpp | struct trie {
map<char, int> trie[100005];
int value[100005];
int n_nodes = 0;
void insert(string &s, int v) {
int id = 0;
for (char c : s) {
if (!trie[id].count(c)) trie[id][c] = ++n_nodes;
id = trie[id][c];
}
value[id] = v;
}
int get_valu... | ALGO | 0.999874 | 4.758959 |
91c66351-53ba-4dd6-9e41-8f719f132469 | Rakesh9100/365-Days-Of-Code-Scaler | Day15.cpp | // Templates
// https://www.interviewbit.com/problems/templates-1/
/*
#include <iostream>
using namespace std;
*/
// Your code goes here
template <class T>
int index_of_largest(T a[], int n) {
T mx = INT_MIN;
int idx;
for(int i = 0; i < n; i++) {
if(a[i] > mx) {
mx = a[i];
... | ALGO | 0.997918 | 4.951526 |
16d560f5-5160-487e-9641-8b5364927728 | Aryan-Jadon18/solved-dsa-questions | leetcode/easy/add_two_numbers.cpp | /*
https://leetcode.com/problems/add-two-numbers/
Problems:
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers d... | ALGO | 0.999888 | 6.382946 |
071cd853-af6d-4026-8ce9-43154f8f108d | Chandra-Sekhar-Dutta/Data-Algorithms | Linear search in Array by recursion.cpp | #include <iostream>
using namespace std;
int LinearSearch(int target, int size, int arr[]){
if(arr[size-1]==target){
return size-1;
}
if(size<0){
return -1;
}
return LinearSearch(target,size-1,arr);
}
int main()
{
int arr[]={1,2,3,4,5,6,7,8,9};
int size=sizeof(ar... | ALGO | 0.998951 | 5.236355 |
70134f8e-dd7f-4b1f-b730-40363db34289 | Rohitrky2021/JavaSourceCode | =C--P/Aditya Verma/Aditya-verma-youtube-playlist-code-main/Dynamic Programming/21 Longest Palindromic Subsequence.cpp | #include <bits/stdc++.h>
using namespace std;
int LCS(string X, string Y, int n, int m) {
int dp[n + 1][m + 1]; // DP - matrix
// base case of recursion --> for initialization of dp - matrix
for (int i = 0; i <= n; i++)
for (int j = 0; j <= m; j++)
if (i == 0 || j == 0)
dp[i][j] = 0;
for (int i = 1; i <... | ALGO | 0.999994 | 5.471522 |
4979a995-8fea-43d5-a824-ac3f39579307 | Jatinsuroshi/OPPs-Assignment | Assignment 3/Practical/Q93.cpp | //93. Write a class Time with member functions to add, subtract, and compare time values.
#include <iostream>
using namespace std;
class Time {
private:
int hours, minutes, seconds;
void normalize() {
if (seconds >= 60) {
minutes += seconds / 60;
seconds %= 60;
}
... | ALGO | 0.99798 | 5.772614 |
f097daf0-318c-485a-a882-0b55885d77b6 | eswar2005/leetcode | 2308-divide-array-into-equal-pairs/2308-divide-array-into-equal-pairs.cpp | class Solution {
public:
bool divideArray(vector<int>& nums) {
int sum=0;
int n=nums.size();
unordered_map<int,int> ans;
for(int i=0;i<n;i++){
ans[nums[i]]++;
}
for( auto s: ans){
if(s.second%2!=0){
return false;
}
... | ALGO | 0.999828 | 5.531445 |
037a54dc-e39d-40cc-9175-d05b65b2218d | phoenixx1/Competitive-Programming-Solutions | HackerRank-30-Days-of-Code/Day 24.cpp | // More Linked Lists
// author @Nishant
#include <cstddef>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int d){
data=d;
next=NULL;
}
};
clas... | ALGO | 0.999965 | 5.0333 |
865762e7-b09e-4e09-9ccf-936aa1dd5237 | Hussainaquib/OOPs-using-C- | Largest_Between_Three.cpp | // C++ Program to Find Largest of Three Numbers Using Functions
#include <iostream>
using namespace std;
// User-defined function
int LargestNumber(int a, int b, int c)
{
int max;
if(a >= b && a >= c)
{
max = a;
}
else if(b >= a && b >= c)
{
max = b;
}
else
{
max = c;
}
return max;
}
int main(){... | ALGO | 0.99938 | 5.578583 |
c4b8a56d-2dc1-42fb-af8f-c4450c6fe343 | samuelAttah/working-with-C- | Initial/trial.cpp | #include <iostream>
#include <cmath>
using namespace std;
int cubeNum(float num){
int result = pow(num, 3);
return result
}
int main()
{
cout << cubeNum(4.0) << endl;
return 0;
}
| TOOL | 0.993298 | 3.859873 |
8f7ff043-0052-4149-a441-66db63402a3d | phoenixx1/Competitive-Programming-Solutions | CodeForces/443A-Anton and Letters.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
char x;
set<char> st;
while (cin >> x)
{
if (isalpha(x))
st.insert(x);
}
cout << st.size();
return 0;
} | ALGO | 0.996322 | 3.912094 |
e3070b5f-274b-40c9-a84d-8232f6076631 | lekimson/lekimsonmocC_cuoiki | Chapter 10/challengs/challengs16.cpp | #include <iostream>
#include <string>
using namespace std;
string pig_latinize(const string &word) {
// Lấy chữ cái đầu tiên của từ
char first_letter = word[0];
// Tạo một chuỗi mới bao gồm phần còn lại của từ
string remaining_word = word.substr(1);
// Thêm chữ cái đầu tiên vào cuối chuỗi mới
remaining_... | TOOL | 0.907387 | 5.753061 |
a1f9c174-637a-4822-9dcc-997ffe0230ef | ShantanuN8/Pointers | Pointer_Swap.cpp | #include<iostream>
using namespace std;
void increment(int *a)
{
(*a)++;
}
void swap(int *a, int *b)
{
int t;
t=*a;
*a=*b;
*b=t;
}
int main()
{
int b=2;
increment(&b);
cout<<b<<endl;
int c=15;
int d=20;
cout<<"c:"<<c<<endl;
cout<<"d:"<<d<<endl;
swap(&c,&d);
cout<<"After swapping:"<<endl... | ALGO | 0.999341 | 4.315578 |
b874e023-005c-4572-985b-6e7b91e9e872 | chlos/yandex-cpp | yandex-cpp-02-yellow/w02/bus-starter.cpp | #include <string>
#include <iostream>
#include <cassert>
#include <vector>
#include <map>
using namespace std;
enum class QueryType {
NewBus,
BusesForStop,
StopsForBus,
AllBuses
};
struct Query {
QueryType type;
string bus;
string stop;
vector<string> stops;
};
istream& operator >> (istream& is, Que... | ALGO | 0.923489 | 5.722505 |
d9893dc8-6884-48bf-b7a1-7e4c1d5f9276 | Bluesbreaker45/Competitive-programming | CodeForces/Educational142/T4.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n, m;
int p[50005][12];
int b[50005];
int beauty(int p[12], int q[12]) {
int i = 1;
for (; i <= m; i++) {
if (q[p[i]] != i) break;
}
return i - 1;
}
int main() {
int t;
cin >> t;
for (int _ = 0; _ < t; _++) {
... | ALGO | 0.999958 | 4.304948 |
ff7c95ae-75cc-4286-9985-af5a51af3658 | VAC10/C-Application | fonksiyonla recursive yapmadan faktoriyel hesaplatma.cpp | //fonksiyonla faktoriyel hesaplama
#include <iostream>
using namespace std;
int f =1;
int faktoriyel (int s)
{
for(int i=1;i<=s;i++){
f=f*i;
cout<<i<<"sayisinin faktoriyeli = "<<f<<endl;
}
return f;
}
int main (){
int sayi;
cout<<"lutfen klavyeden bir sayi giriniz = ";
cin>>sayi;
cout<<"girdiginiz sayinin fakt... | ALGO | 0.997421 | 3.948842 |
04317af5-71bd-4a7f-aecc-654d03b344ef | msitni1337/cpp-pool | day02/ex03/main.cpp | #include "Point.hpp"
bool bsp(Point const a, Point const b, Point const c, Point const point);
int main(void)
{
Point a(0.0f, 10.0f);
Point b(7.0f, 0.0f);
Point c(-5.0f, 0.0f);
Point point1(0.0f, 0.0f);
std::cout << "a = " << a << ",b = " << b << ",c = " << c << " the point " << point1 << " is" <<... | ALGO | 0.9803 | 4.631116 |
92a0558c-1d7b-46ea-b37a-a033fe76dfc2 | HaCK3R322/ITMO_algroritms_and_data_structures | C.cpp | #include <iostream>
#include <fstream>
#include <unordered_map>
#include <stack>
#include <string>
#include <list>
int main() {
const int MAGIC = 1000000001;
std::unordered_map<std::string, int> values_map;
std::stack<std::list<std::pair<std::string, int>>> scope_changes_stack;
std::ifstream fin("input.txt");
s... | ALGO | 0.988613 | 4.737633 |
49ce3de8-af49-4238-a806-38a6352c685b | abdultechs/pd-lab-4 | task02.cpp | #include<iostream>
using namespace std;
void reverse(string n);
main()
{
string n;
cout << "Enter either true or false: ";
cin >> n;
reverse(n);
}
void reverse(string n)
{
if (n == "true" || n == "TRUE")
{ cout << "false" ;}
if (n == "false" || n == "FALSE")
{ cout << "true";}
} | TOOL | 0.993259 | 3.320002 |
8b6346f6-5b03-4242-a89e-82673f66ed86 | noobie7/CodeBank | HackerEarth/HackerEarthDSA/A.cpp | /*
"An anomaly, I'm Muhammad Ali
Cause I know one day I'm gonna be the"
- Greatest, Eminem
*/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false); cin.tie(NULL)... | ALGO | 0.999971 | 3.826227 |
12294686-53a1-4cc1-bbe1-6b818deefe3e | Rashedul2001/PROGRAMS | DSA_CPA/CP_Course/inputGraphWithAdjacencyMatrixAndList.cpp | #include <iostream>
#include <vector>
#include <utility>
const int N = 1e3 + 10;
int graph1[N][N];
std::vector<std::pair<int, int>> graph2[N];
int main()
{
int n, m;
std::cin >> n >> m;
for (int i = 1; i <= m; i++)
{
int v1, v2, wt;
std::cin >> v1 >> v2 >> wt;
graph1[v1][v2] = wt;
graph1[v2][v2] = wt;
g... | ALGO | 0.999898 | 4.645392 |
0dd82332-0444-48ad-bbde-d2213c292633 | sammysun0711/data_structures_fundamental | week1/process_packages/process_packages.cpp | #include <iostream>
#include <queue>
#include <vector>
struct Request {
Request(int arrival_time, int process_time):
arrival_time(arrival_time),
process_time(process_time)
{}
int arrival_time;
int process_time;
};
struct Response {
Response(bool dropped, int start_time):
d... | ALGO | 0.999877 | 5.254761 |
732a42c3-65a7-4455-9dfa-e0e78acc86c6 | KanishAnand/CompetitiveCoding | Algorithms/FFT.cpp | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define fr(va, beg, end) for (lli va = beg; va < end; va++)
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const double PI = acos(-1);
... | ALGO | 0.999908 | 3.197458 |
5aec612e-571c-43e4-a7cb-32c7ee729e56 | sky8c9/Prac | AtCoder/ABC/251/F.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<vector<int>> adjL;
vector<pair<int, int>> ans;
vector<bool> seen;
void dfs(int u, int p) {
seen[u] = true;
for(int v : adjL[u]) {
if (v == p || seen[v]) continue;
ans.emplace_back(u, v);
dfs(v, u);
}
}
void bfs(int u) {
queu... | ALGO | 0.999992 | 5.013865 |
980a6bdc-d15a-4031-8263-2cb39e25ccfd | mohitmallick17/LeetCodeSolutions | 2366-minimum-replacements-to-sort-the-array/2366-minimum-replacements-to-sort-the-array.cpp | class Solution {
public:
long long minimumReplacement(vector<int>& nums) {
cout << (4%5)<<' ';
long long ans = 0;
int prev = nums.back();
for(int i=nums.size()-2;i>=0;i--){
long k = ceil(nums[i]/(double)prev);
ans += k-1;
prev... | ALGO | 0.999961 | 5.107032 |
5634eb19-bb3f-4822-8fef-d990315bbe8e | Halimazz/struktur-data | tgs_dll_231122.cpp | #include <iostream>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include<string.h>
using namespace std;
struct Film{
string judul, sutradara;
int tahun;
Film *next;
Film *prev;
};
Film *head,*tail,*current,*nodeBaru;
void Awal(string jdlFilm, string stdFilm,int thnFilm){
head=new Film();
he... | TOOL | 0.993208 | 3.395825 |
36858c9d-1257-41cc-8441-0ffe3d895e69 | vinnyshin/algorithm | Heapsort.cpp | //2017029870_신호중
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
void MaxHeap(int arr[], int num, int integer)
{
int p = integer;
int left = 2*integer + 1;
int right = 2*integer + 2;
if (left < num && arr[left] > arr[p])
p = left;
if (right < num && arr[right] > arr[p])
p =... | ALGO | 0.999994 | 3.221334 |
39b7edc2-325c-4710-835c-f5be7ccffdc4 | SingleKnife/Miku | bulletnative/src/main/cpp/bullet/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp | #include "btOptimizedBvh.h"
#include "btStridingMeshInterface.h"
#include "LinearMath/btAabbUtil2.h"
#include "LinearMath/btIDebugDraw.h"
btOptimizedBvh::btOptimizedBvh()
{
}
btOptimizedBvh::~btOptimizedBvh()
{
}
void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantizedAabbCompression, const b... | ALGO | 0.986581 | 6.759803 |
44443727-5f73-442b-939a-07bbd0d76703 | rui314/mold-sandbox | third-party/tbb/examples/parallel_for/tachyon/src/triangle.cpp | /*
* triangle.cpp - This file contains the functions for dealing with triangles.
*/
#include "machine.hpp"
#include "types.hpp"
#include "vector.hpp"
#include "macros.hpp"
#include "intersect.hpp"
#include "util.hpp"
#define TRIANGLE_PRIVATE
#include "triangle.hpp"
static object_methods tri_methods = { (void (*)(... | ALGO | 0.98006 | 7.799855 |
18f26d97-7e7c-4afe-9286-4d0c1511cc59 | Haridasbankar/DSA-in-CPP | passByReference.cpp | #include<iostream>
using namespace std;
int changeArr(int arr[],int size){
cout<<"change function\n";
for(int i=0;i<size;i++){
arr[i]= 2*arr[i];
}
}
int main(){
int arr[] = {1,2,3};
changeArr(arr,3);
cout<<"in main\n";
for(int i=0;i<3;i++){
cout<<arr[i]<<" ";
}... | ALGO | 0.996849 | 4.523573 |
49d10d5e-a7d4-46df-be39-4d47e1d4a2e2 | MikheevD/Labs_PSTU_IVT-22-1B | LABS-2-semestr/Sort/mergeSort.cpp | // Pro1.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
#include <cstdlib>
#include <iostream>
#include <time.h>
#include <stdlib.h>
using namespace std;
void merge(int list[], int start, int end, int mid);
void mergeSort(int list[], int start, int end)
{
int mid;
if ... | ALGO | 0.999449 | 3.614672 |
1162d074-2d38-4849-a244-56330b30c15d | maiklarooij/AoC-2024 | day2/2b.cpp | /* https://adventofcode.com/2024/day/2#part2 */
#include <iostream>
#include <fstream>
#include <list>
#include <vector>
#include <string>
using namespace std;
/* Splits a string based on delimiter into a list of ints */
vector<int> split(string s, string delim) {
size_t pos_start = 0, pos_curr = 0;
string s... | ALGO | 0.999162 | 5.90259 |
00ee0609-2ebb-46e1-a74c-bbc3ba775e89 | C1ouDreamW/Cpp_Study | VScode/2065A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
string s;
cin >> s;
s.pop_back();
s.pop_back();
s += 'i';
cout << s << endl;
}
signed main() {
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
} | ALGO | 0.991916 | 3.899201 |
216491bb-b5ac-437e-af83-d3e2aa94ac8c | Sarang8080/Geeks-For-Geeks | Dynamic Programming/Medium/MaximumTip.cpp | /*
Rahul and Ankit are the only two waiters in Royal Restaurant. Today, the restaurant received N orders. The amount of tips may differ when handled by different waiters, if Rahul takes the ith order, he would be tipped Ai rupees and if Ankit takes this order, the tip would be Bi rupees.
In order to maximize the total ... | ALGO | 0.999988 | 4.034479 |
a41ffd93-b936-47bc-bd77-a9cbcd3a059c | lcnzg/lammps-pi | src/npair_half_nsq_newtoff.cpp | #include "npair_half_nsq_newtoff.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "group.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
NPairHalfNsq... | ALGO | 0.999815 | 5.632381 |
079afcfa-126c-44c2-898d-17dfab7037fc | Khretons/College-Projects | Semester 1/C++/Luas segitiga.cpp | //Timmothy James Wijaya 32200010
#include <iostream>
using namespace std;
void LuasSegitiga()
{
int a, t, N;
float luas (float a, float t);
cout << "Total segitiga yang akan dihitung : ";
cin >> N;
for( int i = 1; i <= N; i++){
cout << "----------------------------" << endl;
cout << "Masukkan panjang alas : ... | ALGO | 0.997117 | 4.891728 |
fe036ba1-9a52-42a5-bbc4-718439c28493 | Belise-dot/Mobile-App-with-Flutter | mdc_100_series/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.998789 | 6.785645 |
8958bb19-22be-4396-b275-2778207e7820 | anonInode/mesa | src/compiler/glsl/opt_dead_code_local.cpp | /**
* \file opt_dead_code_local.cpp
*
* Eliminates local dead assignments from the code.
*
* This operates on basic blocks, tracking assignments and finding if
* they're used before the variable is completely reassigned.
*
* Compare this to ir_dead_code.cpp, which operates globally looking
* for assignments to... | ALGO | 0.974586 | 7.863487 |
6abcc19a-ae38-479e-b18d-f96b9849beb3 | Eeman1113/Leetcode | Problems/1441.cpp | class Solution {
public:
int minTime(int n, vector<vector<int>>& edges, vector<bool>& hasApple) {
vector<vector<int>> graph(n);
for (const vector<int>& edge : edges) {
const int u = edge[0];
const int v = edge[1];
graph[u].push_back(v);
graph[v].push_back(u);
}
return dfs(gr... | ALGO | 0.998719 | 6.233298 |
32186c27-514a-459b-b961-e0e959bc9067 | 99hgz/Algorithms | Problems/bzoj/2152.cpp | #include <cstdio>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef long long ll;
bool visited[20010];
struct Node
{
int to, w;
};
vector<Node> vec[20010];
int f[20010][3];
int G, b, ans, fm, u, v, w, n;
void addedge(int u, int v, int w)
{
vec[u].push_bac... | ALGO | 0.999857 | 4.030982 |
3bbccef9-2c68-421a-8328-62116e81c11e | Pulkith/Competitive | other/word-game/parse.cpp | /**
* author: DespicableMonkey
* created: 07.05.2021 16:12:28
* Potatoes FTW!
**/
#include<bits/stdc++.h>
#if LOCAL
#include <DespicableMonkey/Execution_Time.h>
#include <DespicableMonkey/Debug.h>
#define debug_active 1
#endif
using namespace std;
#define pb push_back
#define f first
#define s secon... | ALGO | 0.99811 | 4.336839 |
35e5bb29-cb41-436a-ba45-6a397238adec | STEllAR-GROUP/blaze | blazemark/src/boost/DVecSVecOuter.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | ALGO | 0.996507 | 5.207817 |
b1faac62-9038-4f85-bde5-f8a1e618a6ac | jiangnanboy/CPPCorrector | src/core/spelling/Tokenizer.cpp |
//Created by sy on 2023/12/8 22:29.
#include <filesystem>
#include <iostream>
#include <fstream>
#include "../../../include/Tokenizer.h"
#include "../../../include/util.h"
void Tokenizer::initTokenizer(Segment seg, const string wordFreqPath, map<string, int> customWordFreq, map<string, string> customConfusion) {
... | TOOL | 0.85047 | 4.266992 |
3f531e34-e1e2-4172-88b6-831dc087583a | theArshGupta/to_do | 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 |
497fe06e-41ec-455b-a144-1b719b73ac95 | m4oughi/100DaysofCode | pureCPP/0037. Day 37/Standard Template Library Basics/015. Associative Containers - Multiset/014. Calculating Difference Between Two Multisets/main.cpp | #include <iostream>
#include <set>
#include <algorithm>
int main() {
std::multiset<int> set1 = {1, 2, 2, 3};
std::multiset<int> set2 = {2, 3, 4};
std::multiset<int> difference;
std::set_difference(set1.begin(), set1.end(), set2.begin(), set2.end(),
std::inserter(difference, dif... | ALGO | 0.998623 | 4.876436 |
ddfb5cfc-2ba4-4956-80a2-7d9397af37a1 | learner-Pankaj/cpp_practice | sortVectorArray.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> v;
int num;
for(auto i=0; i<N; i++){
cin >> num;
v.push_back(num);
}
sort(v.begin(), v.end());
for... | ALGO | 0.999734 | 4.23471 |
d16bf1d2-a8ee-450b-aca2-712ef34ec349 | sugiyem/LeetCode | medium/Majority Element II/Solution.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
vector<int> ans;
int target = nums.size() / 3;
unordered_map<int, int> freq;
for (int x : nums) {
++freq[x];
}
for (auto u : freq) {
if (u.second > target) {
... | ALGO | 0.999977 | 5.814054 |
fdaf3d1f-dd54-4a3f-90ba-3c000e75ff75 | mihaimoga/XMLSitemap | boost/libs/sort/example/int64.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace boost::sort::spreadso... | ALGO | 0.984131 | 4.607142 |
7a8c77b9-97c2-4c5e-9283-5075b4583d2e | josepadial/UGR_GII_FP | Prácticas/Sesión 4/Subir sueldo -dos subidas salariales compatibles.cpp | /*Nombre: Jos Antonio Padial Molina
Curso: 1C
Fecha: 12/10/2016
Sesin 4 Ejercicio 6
*/
#include<iostream>
using namespace std;
int main(){
// Vamos a declarar las variables
double salario_hora, satisfaccion, paga_final, paga;
int horas, casos;
int const minimo_casos = 30;
double const minimo_satisfaccion = ... | ALGO | 0.997053 | 3.75203 |
833ff25d-2946-49b3-96e0-d5cbfddaf67d | profornnan/Problem-Solving | BOJ/누적 합/9027-Stadium.cpp | #include <iostream>
#include <algorithm>
using namespace std;
constexpr long long INF = 2e18;
constexpr int MAX_N = 100'000;
int T, N;
long long pos[MAX_N + 1];
long long psum[MAX_N + 1];
long long ppsum[MAX_N + 1];
int main(void) {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> T;
while (T--) {
cin >> N;
... | ALGO | 0.999972 | 4.431816 |
a0544b3d-d0e3-41e7-9ffa-6a39e853fb61 | sapra14/linkedin_llm | llama.cpp/llama.cpp/ggml/src/ggml-sycl/element_wise.cpp | #include "common.hpp"
#include "ggml.h"
#include "element_wise.hpp"
static void acc_f32(const float * x, const float * y, float * dst, const int ne,
const int ne10, const int ne11, const int ne12,
const int nb1, const int nb2, int offset, const sycl::nd_item<3> &item_ct1) {
const int i = item_ct1.get_local... | TOOL | 0.917408 | 6.745254 |
07eec883-d4ed-4c08-b12f-ba719c2c9b71 | ishandutta2007/codeforces | rafi22/normal/1464/C.cpp | #include <bits/stdc++.h>
#define int long long
#define double long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
double PI=3.14159265359;
int inf=1000000000000000007;
int mod=1000000007;
int mod1=998244353;
const bool multi=0;
int ... | ALGO | 0.999986 | 5.050136 |
2ad00560-692a-47b7-87e6-c8017ff637dd | ParasAnxi/DSA-Practice | Lec044 Linked List 1/Singly_LinkedList.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data){
this-> data = data;
this->next = NULL;
}
~Node(){
int value = this->data;
if(this->next != NULL){
delete next;
this->next=NULL;
... | ALGO | 0.998453 | 3.755257 |
a1633745-b9bf-44c2-bbb8-5ec35a133d33 | suc1/CodeTestLib | HackerRank/TheBombermanGame.cpp | /*
!!利用题目例子来调试!!
按照题目顺序, 第2秒种, 第3秒爆炸
不能计数加一同时爆破,因为"3211"会少算一格
爆破邻居增长方向为3不能爆破, 因为"3311"会少算一格
换一个思路: 比较两个矩阵算爆炸
//12 timeout
只有四种结果:
1. if(n<=1) return 原始grid
2. if n in [2,4,6,8...] 充满grid
3. if n in [3,7,11,15...]一种情况: 因为炸弹延时就两种情况,而且每次都充满
4. if n in [5,9,13,17...]一种情况
5. 情况3 & 4 是互补的,因为爆炸是+字, 爆炸充满两次就恢复原状
*/
#if 0 ... | ALGO | 0.999573 | 4.904762 |
decac63a-2241-4f89-80d4-c01a3d584ebc | Mayank-Chourasia77/DSA_CPP | strings/7_validAnagram.cpp | #include<bits/stdc++.h>
using namespace std;
bool validAnagram(string s , string t){
if(s.length() != t.length()) return false;
int hash[26] = {0};
for(int i=0;i<s.size();i++){
hash[s[i]-'a']++;
}
for(int i=0;i<s.size();i++){
hash[t[i]-'a']--;
}
for(auto it : hash){
if(... | ALGO | 0.999994 | 4.925478 |
f9261379-2b29-41b8-b120-400019bce227 | WiseCow/algorithm | BOJ/종교.cpp | //#include <stdio.h>
//#include <stdlib.h>
//
//typedef struct jin{
// int vertex;
// struct jin * link;
//}jin;
//
//jin*arr[50001];
//int count = 0;
//int visit[50001] = { 0, };
//
//void insert_node(int n1, int n2)
//{
// jin*w = NULL;
//
// jin*node_n1 = (jin*)malloc(sizeof(jin));// Ҵ
// jin*node_n2 = (jin*)mallo... | ALGO | 0.999816 | 4.663012 |
7e366d8a-734b-4b3c-8051-60a038a5dca4 | luckyIITR/dsa450solved | Array/Jump Game Problems/Frog Jump.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
// bfs ... tle
bool canCross(vector<int> &stones)
{
int n = stones.size();
queue<pair<int, int>> que;
map<int, bool> mp;
for (int i = 0; i < n; i++)
{
mp[stones[i]] = true;
}
... | ALGO | 0.999953 | 5.170039 |
9915f824-5c4e-47f8-8d91-4e9af1f3785d | ishandutta2007/codeforces | rubikun/normal/1515/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define ... | ALGO | 0.999963 | 3.591968 |
0c5a1e63-0f16-4f46-8e55-47999d66497b | 0Daxx/DSA | dsaFoundation/linkedList/main.cpp | #include <iostream>
using namespace std;
class Node{
public:
int val;
Node* next;
Node(int data){
val = data;
next = NULL;
}
} ;
// Q insertion at kth position in a singly linked list
void insertAtHead(Node* &head, int val){
Node* new_node = new Node(val);
new_node->nex... | ALGO | 0.996254 | 4.166845 |
4ca21ec5-c12c-465b-90d9-ce26348a56d6 | arafatdayan005/XPSC | Week - 9/Day - 1/A - Playlist.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> v(n);
set<int> set;
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
int i = 0, j = 0, ans = 0;
while (i < n && j < n)
{
while (j < n && !set.count(v[j]))... | ALGO | 0.999935 | 4.510131 |
7a3a0059-4bbf-4b2b-9976-d79b4a3e0e7e | masc-ucsc/termwave | source/parser.cpp | #include "parser.h"
#include <algorithm>
#include <iomanip>
#include <climits>
/**
* \brief Splits the given string by space in a vector
* \param str string to be splitted
* \return A vector containing the the splitted line_
*/
std::vector<std::string> SplitBySpace(std::string str) {
std::string buf;
std::string... | TOOL | 0.930602 | 5.431012 |
419f6c54-8ad1-4744-bbf8-abfca04b8f39 | adarshdbg/LeetCode | Leetcode Graph/number-of-operations-to-make-network-connected.cpp | static const auto _____ = []()
{
// fast IO code : this I understand
ios::sync_with_stdio(false);
cin.tie(0);
return 0;
}();
class Solution {
public:
int find(vector<int>&parent,int x)
{
return parent[x]=parent[x]==x?x:find(parent,parent[x]);
}
int makeConnected(int n, vecto... | ALGO | 0.999883 | 5.472588 |
29809150-e235-4b7a-980f-ac425767761c | nguyenchiemminhvu/DSA | Problems/ReverseCharactersBetweenParentheses/main.cpp | /**
https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses/
You are given a string s that consists of lower case English letters and brackets.
Reverse the strings in each pair of matching parentheses, starting from the innermost one.
Your result should not contain any brackets.
Example 1:
... | ALGO | 0.999865 | 6.581481 |
cbf8de98-8fd3-4120-9cfe-532fc53e762a | adityak54/cp | before-aug-24/B_Comparison_String.cpp |
#define pi pair<int,int>
#define ll long long int
#include <bits/stdc++.h>
using namespace std;
ll meraceil(ll a,ll b){
if(a%b==0) return a/b;
return (a/b)+1;
}
struct cmp{
bool operator()(pi a,pi b){
if(a.first>b.first) return true;
if(a.first==b.first){
if(a.second<b.second) return true;
}
retu... | ALGO | 0.999825 | 4.460336 |
bdde1b06-d061-459b-a243-75d6d6e19f3b | MiyamuP/AtCoder | ABC249/d.cpp | #include <iostream>
#include <vector>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
vector<ll> an(200001, 0);
int main()
{
ll n;
cin >> n;
ll a[n];
rep(i, n)
{
ll num;
cin >> num;
a[i] = num;
an[num]++;
}
return 0;
} | ALGO | 0.999673 | 3.635752 |
82ea683c-a77b-4617-8bc8-1234e3131ade | AyushMaheshwari2002/LeetCode | 1832. Check if the Sentence Is Pangram.cpp | /* A pangram is a sentence where every letter of the English alphabet appears at least once.
Given a string sentence containing only lowercase English letters, return true if sentence is a pangram, or false otherwise.
Example 1:
Input: sentence = "thequickbrownfoxjumpsoverthelazydog"
... | ALGO | 0.999709 | 6.217215 |
68e8c8b5-f162-45af-bcc4-f598cf6abfb4 | ut0s/atcoder | lib/utils.cpp | /**
@file utils.cpp
@brief utils
**/
template <class T>
void show(vector<T>& v) {
for (uint i = 0; i < v.size(); i++) {
cout << v[i] << " ";
}
cout << "\n";
}
template <class T1, class T2>
void show(vector<pair<T1, T2>>& v, int x) {
if (x == 1) {
for (uint i = 0; i < v.size(); i++) {
cout <<... | TOOL | 0.98076 | 4.733764 |
92158ef8-a39f-4f5f-aa1f-4bf7a5aff300 | atharvakej/Repo_of_Codes | CF_Contests/Codeforces Round 978 (Div. 2)/C_Gerrymandering.cpp | #include <bits/stdc++.h>
using namespace std;
#define POP pop_back
#define MOD 1e7+10
#define PI 3.1415926535897932
#define PB push_back
#define MP make_pair
#define pb push_back
#define ppb pop_back
int power(int a, int b){
int r=1;
while(b){
if(b&1)r=(r*a);
a=(a*a); b/=2;
}
return r;
}
typedef long long ... | ALGO | 0.99996 | 4.230712 |
b858225c-1a6c-4b4c-b662-0b9f61e1e02a | ixray-team/ixray-1.5-stcs | sdk/sources/MagicSoftware/FreeMagic/Source/Interpolation3D/MgcInterp3DBSplineUniform.cpp | #include "MgcInterp3DBSplineUniform.h"
using namespace Mgc;
//----------------------------------------------------------------------------
Interp3DBSplineUniform::Interp3DBSplineUniform (int iDegree, const int* aiDim,
Real* afData)
:
InterpBSplineUniform(3,iDegree,aiDim,afData)
{
}
//----------------------... | ALGO | 0.988749 | 7.109612 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.