uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
70d9f3e8-f76b-430b-89f2-2606649c78e0 | DenizIsikli/Codeforces | Problemsets/Rating900/XORAverage1758B.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <functional>
using namespace std;
// Macros and optimizations
#pragma GCC optimize... | ALGO | 0.99884 | 4.495549 |
30f07427-0f94-46dc-844c-a50fc418bf89 | fenatan/URI-Online-Judge | 1162.cpp | #include <stdio.h>
int main(){
int n,l,aux;
scanf("%d", &n);
int t[51];
for(int i =0; i < n; i++){
int cont = 0;
scanf("%d",&l);
for(int j = 0; j < l; j++)
scanf("%d", &t[j]);
for(int j = 0; j < l; j++){
for(int k = j; k < l; k++){
... | ALGO | 0.999855 | 3.071453 |
1c454a76-797e-4e27-9f1c-b28092fa6be9 | keshavgautam03/leetcode | 0100-same-tree/0100-same-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999977 | 6.282132 |
80e28ac7-fc4a-44a0-b230-159d394bf618 | xuchong/LeetCode | NumberofIslands/main.cpp | class Solution {
private:
void change(vector<vector<char>>&grid,int x,int y)
{
grid[x][y]=0;
if(x-1>=0&&grid[x-1][y]=='1')
{
change(grid,x-1,y);
}
if(x+1<grid.size()&&grid[x+1][y]=='1')
{
change(grid,x+1,y);
}
if(y-1>=0&&grid[x][y-1]=='1')
{
change(grid,x,y-1);
... | ALGO | 0.999916 | 6.480828 |
3b98e34a-ca53-49ff-87f5-90c543558f31 | FLalor/1E3-TCD-Engineering | task2.cpp | #include<iostream>
using namespace std;
int main()
{
int n, i, a=0, b=1, c;
//input
cout << "How many fibs:";
cin >> n;
//display Fibonacci Series
for (i=a; i<=n; i++)
{
cout << a << " ";
c=a+b;
a=b;
b=c;
}
return 0;
}
| ALGO | 0.999783 | 3.848871 |
4fc451c1-bf47-4b13-977c-17f9bf9ea109 | bmana21/Algorithms-and-Data-Structures | Graphs/DSU.cpp | const int N = 2e5 + 1;
vector<int> par(N);
void make_sets(int n) {
for (int i = 1; i <= n; i++) {
par[i] = i;
}
}
int find_set(int v) {
if (par[v] == v) {
return v;
} else {
return par[v] = find_set(par[v]);
}
}
void union_sets(int a, int b) {
a = find_set(a);
b =... | ALGO | 0.999736 | 5.031809 |
771e0126-b321-4adf-9048-f81b065db17d | abhishek0405/Data-Structures | Stacks/ReverseStack.cpp | #include <iostream>
#include<stack>
using namespace std;
//O(N^2) using 2 stacks. O(N) if 3 stacks
int main() {
stack<int> og;
stack<int> rev;
int i,n,x,c;
cin>>n;
for(i=0;i<n;i++){
cin>>x;
og.push(x);
}
for(i=0;i<n;i++){
//fetch top element from og stack
x... | ALGO | 0.999983 | 4.208214 |
0a3c8442-af08-4d90-bbc9-5104f3441c47 | ganghe74/algo | baekjoon/1864_๋ฌธ์ด ์ซ์.cpp | #include <bits/stdc++.h>
using namespace std;
int f(char x) {
if (x == '-') return 0;
if (x == '\\') return 1;
if (x == '(') return 2;
if (x == '@') return 3;
if (x == '?') return 4;
if (x == '>') return 5;
if (x == '&') return 6;
if (x == '%') return 7;
return -1;
}
int main() {
... | ALGO | 0.997761 | 3.203511 |
0139faec-174a-4a11-b6d8-0971e0481fde | hm-harry/blackhouse-foundation | 20ๆ้ซ็ผ็จ/STL-ๅธธ็จ็ฎๆณ/P255ๅธธ่งๆท่ดๅๆฟๆข็ฎๆณcopy.cpp | #include<iostream>
#include<string>
using namespace std;
#include<vector>
#include<algorithm>
void myPrint(int val)
{
cout << val << " ";
}
void test01(){
vector<int> v1;
for(int i = 0; i < 10; i++){
v1.push_back(i);
}
vector<int> v2;
v2.resize(v1.size());
copy(v1.begin(), v1.end(), ... | ALGO | 0.98367 | 3.830726 |
dbf01ab0-6972-4c21-9766-f496cd071e7b | xyzyzl/compprog | probs/gcj/kickstart/2022/a/d.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int a, b; cin >> a >> b;
int num = 0;
for(int i = a; i <= b; i++)
{
int j = i;
int sod = 0, prod = 1;
while(j > 0)
{
sod += j % 10;
prod *= j % 10;
j /= 10;
}
if(prod % sod == 0) num++;
}
cout << num << endl;
}
int main()
{
int ... | ALGO | 0.999195 | 5.593008 |
ab74a0ad-51b2-428b-90d1-8364de6c1364 | ishandutta2007/codeforces | ashishgup/normal/794/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#defi... | ALGO | 0.999996 | 3.009928 |
b25837f4-39d5-409c-a528-e04fa2c9c78a | TrueStar02/Practice | Homework/(141) Matrix ไฝไธ - ็จๅบ่ฎพ่ฎกโ
ก(20่ฎก็ฎๆบ็ฑป3็ญ)/163953 [Classes and Objects]Array/Standard Answer/main.cpp | #include "array.hpp"
#include <iostream>
int main() {
int n;
std::cin >> n;
array a(n);
for (int i = 0; i < n; i++) {
std::cin >> a.data()[i];
}
std::cout << "array size:" << a.max_size() << std::endl;
std::cout << "array front:" << a.front() << std::endl;
std::cout << "array back:" << a.b... | TOOL | 0.942492 | 3.607443 |
8a607dac-73bc-4528-b5b4-ff6b7d19ba4a | zpoint/Algorithms | LeetCode/merge-two-sorted-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLis... | ALGO | 0.999935 | 5.711992 |
87b73f32-8edc-48ca-a6c5-3ceda964fded | pallavikamboj123/DSA-Algo | graph/rotting-oranges.cpp | class Solution {
public:
int X[4] = {0,-1,0,1};
int Y[4] = {-1,0,1,0};
int orangesRotting(vector<vector<int>>& grid) {
queue<pair<int,int>> q;
int n = grid.size();
if(n == 0){
return 0;
}
int m = grid[0].size();
for(int i = 0;i<n;i++){
... | ALGO | 0.999967 | 6.064383 |
40436d60-739e-40d6-b77a-cf6f3ea61427 | ishandutta2007/codeforces | romawhite/normal/144/B.cpp | //#pragma comment(linker,"/STACK:16777216")
#include <iostream>
#include <vector>
#include <set>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define MP make_pair
#define ALL(a) ((a).be... | ALGO | 0.999854 | 3.299429 |
b32d0e0e-98a2-4945-ad59-025cc1d8c67a | Mccrae15/Unreal-engine- | Engine/Source/ThirdParty/Intel/ISPC/ispc-1.18.0/examples/xpu/mandelbrot/mandelbrot.cpp | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define NOMINMAX
#pragma warning(disable : 4244)
#pragma warning(disable : 4305)
#endif
#include "timing.h"
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string.h>
// ispcrt
#include "ispcrt.hp... | ALGO | 0.935309 | 5.756495 |
c571a84b-4215-45f3-9fe6-61319e949287 | ankit-0369/CP-Questions | Codechef Contest/starters119-div2/A.cpp | #include<bits/stdc++.h>
#define pb push_back
#define pp pop_back
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define mii map<int,int>
#define mib map<int, bool>
#define mic map<int,char>
typedef long long ll;
typedef long long int lli;
#define loop(i, j, k) for (int ... | ALGO | 0.999725 | 3.399607 |
c524e51f-5a0a-44f4-a6f3-4873a66ce217 | javalosv/files | eigen-eigen-b30b87236a1b/doc/examples/TutorialLinAlgInverseDeterminant.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 1,
2, 1, 0,
-1, 1, 2;
cout << "Here is the matrix A:\n" << A << endl;
cout << "The determinant of A is " << A.determinant() << endl;
cout << "The inverse of A is:\n... | ALGO | 0.999621 | 4.186114 |
f23c613c-2d7f-4a3a-95b9-381c316a7832 | baizhu0414/CppFiles | T43_46_NumberSequence.cpp | #include<bits/stdc++.h>
using namespace std;
// ฯฐ4.6 (ิฃะถ[ฦฅ])
//สฝ#include<regex>
int main() {
int n;
vector<string> strs;// ะกะดึท
vector<string> strsOrigin;
vector<string>searchs;
while(cin>> n) {
string str;
string search;// ฤฃสฝa[bc2]c
for(int i=0; i<n; i++) {
cin>> str;
strsOrigin.push_back(str);
s... | ALGO | 0.998127 | 3.139883 |
4a6724c7-562f-42c6-be63-1ed8c47bc675 | rajnikhar29/CRACKTHEPLACEMENT | 0049-group-anagrams/0049-group-anagrams.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
vector<vector<string>>ans;
unordered_map<string,vector<string>>mp;
for(int i=0;i<strs.size();i++){
string temp=strs[i];
sort(temp.begin(),temp.end());
mp[temp].push_back... | ALGO | 0.999993 | 6.42911 |
02248f2c-5aa4-4dc0-9abe-59be111c89a9 | tin10401/CodeForces | CodeForces/Segment_Cost.cpp | //โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
//โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// __________________
// | ________________ |
// || ____ ||
// ||... | ALGO | 0.999983 | 5.440479 |
b81f5c40-6697-4323-ad50-c1c7aa2c8187 | Slava/competitiveProgramming | codeforces/cdf_122C_810431.cpp | #include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
vector<long long> lucky;
void dfs(long long v) {
if (v > 7777777777LL)
return;
if (v) lucky.push_back(v);
dfs(... | ALGO | 0.999582 | 3.795703 |
ec1dd56c-f100-4ee4-a18a-60961d0d3ebf | AlexLazareva/university-c | university-c/app4.cpp | #include "stdio.h"
#include "string.h"
#include "conio.h"
#include "windows.h"
struct team {
char name[15], city[15], teamlead[15], rate[15];
} a[100];
struct search {
char notValue[15], d[15];
} search[2];
int i = 0,
mount = 0;
void addTeam() {
i = mount;
printf("Enter name of team: ")... | TOOL | 0.950247 | 3.021038 |
eb5cc1cf-525e-4a39-b2e7-9445924090b5 | ArielCoinOrg/arielcoin | src/psbt.cpp | #include <psbt.h>
#include <util/check.h>
#include <util/strencodings.h>
PartiallySignedTransaction::PartiallySignedTransaction(const CMutableTransaction& tx) : tx(tx)
{
inputs.resize(tx.vin.size());
outputs.resize(tx.vout.size());
}
bool PartiallySignedTransaction::IsNull() const
{
return !tx && inputs.... | ALGO | 0.958264 | 7.291023 |
4eb2c9a4-122c-4499-ac85-5280a3544628 | yous/automated-software-testing | hw4/llvm/lib/Analysis/ValueTracking.cpp | #include "llvm/Analysis/ValueTracking.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instru... | ALGO | 0.985645 | 7.648097 |
f5456380-6d77-4b5a-9d9c-847c3ae132b5 | UMANG-GAKHAR/Challenges-Bitmasking | Unique Number-II.cpp | #include<iostream>
using namespace std;
int main() {
int n;
int a[100005];
cin>>n;
int no;
int res=0;
for(int i=0;i<n;i++){
cin>>no;
a[i]=no;
res = res^no;
}
//xor=a^b
int temp=res;
int pos=0;
while((temp&1)!=1){
pos++;
temp=temp>>1;
}
int mask=(1<<pos);
//find those number which contain set ... | ALGO | 0.999936 | 3.51813 |
e3c8b84f-96d8-4084-aecd-2fca9fc06e46 | sivaramsk/cplusplus | hackerrank/warmup/beautiful-binary.cpp | #include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#inc... | ALGO | 0.999692 | 3.944866 |
2129a000-8dfa-4fdd-80cd-49cdcf4143a8 | areian13/PS_BOJ | 2. Silver/Silver 2/[S2] 27724 ํํ ์๋ค.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
using namespace std;
int main()
{
FastIO;
int n, m, k;
cin >> n >> m >> k;
int result = min(log2(k) + m, log2(n));
cout << result << '... | ALGO | 0.99994 | 4.063878 |
02d2e9ab-0baf-41e5-b541-73838d58a5b1 | keithhearne/VSTPlugins | SchroederReverbImproved/JuceLibraryCode/modules/juce_graphics/geometry/juce_EdgeTable.cpp | const int juce_edgeTableDefaultEdgesPerLine = 32;
//==============================================================================
EdgeTable::EdgeTable (const Rectangle<int>& area,
const Path& path, const AffineTransform& transform)
: bounds (area),
maxEdgesPerLine (juce_edgeTableDefaultE... | TOOL | 0.978198 | 5.749533 |
cee9c161-e7c5-4ae8-ac07-343c0360438d | enuguru/algorithms_and_datastructures | datastructures/trees/working/expressiontree.cpp |
// C++ program for expression tree
#include<bits/stdc++.h>
using namespace std;
// An expression tree node
struct et
{
char value;
et* left, *right;
};
// A utility function to check if 'c'
// is an operator
bool isOperator(char c)
{
if (c == '+' || c == '-' ||
c == '*' || c == '/' ||
... | ALGO | 0.999957 | 5.971653 |
86e31999-de0a-438d-a075-41ba7bfecfc8 | AliHossamTesla/CP-Training | Graph/Shortest Path/BellmanFord.cpp | /*
* Description : Bellman - ford Algorithm
* Shortest Path w/ negative edge weights + find Negative Cycle if exist .
* source : @Tesla
* Verification :
* 1 - https://cses.fi/problemset/task/1197/
* 2 - https://open.kattis.com/problems/shortestpath3
*/
struct BellmanFord{
struct Edge{
int u , v , w ;
Edge()... | ALGO | 0.999875 | 4.53988 |
4813243a-428a-409d-b71d-62aef59bac55 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3184_9.cpp | #include <bits/stdc++.h>
using namespace std;
signed long long S, F, T;
int N;
signed long long A[101010], B[101010];
void solve() {
int i, j, k, l, r, x, y;
string s;
cin >> S >> F >> T >> N;
signed long long p = S;
for (i = 0; i < (N); i++) {
cin >> A[i];
B[i] = max(p, A[i]);
p = B[i] + T;
}
... | ALGO | 0.99991 | 3.570589 |
8d8c31c9-89e3-4518-bb40-92740863dd22 | Muhamed4/LeetCode | Number of Operations to Make Network Connected.cpp |
// Link Of Problem
// https://leetcode.com/problems/number-of-operations-to-make-network-connected/
// 1319. Number of Operations to Make Network Connected
class Solution {
void DFS(vector<vector<int>>&adj, vector<int>&vis, int node){
vis[node] = 1;
for(auto child: adj[node]){
if(!vi... | ALGO | 0.999814 | 5.915714 |
d3411d30-15f8-413d-b2ba-2f546d516d6f | ishandutta2007/codeforces | mofk/normal/1616/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int ntest;
cin >> ntest;
while (ntest--) {
int n;
cin >> n;
map<int, int> a;
while (n--) {
int x;
cin >> x;
++a[abs(x)... | ALGO | 0.99957 | 4.348705 |
a9ffa31e-6244-4b10-9793-a7819e70f96c | zasonwong/Fighter | Bullet/cocos2d/extensions/Particle3D/PU/CCPUParticleFollower.cpp | #include "CCPUParticleFollower.h"
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
NS_CC_BEGIN
// Constants
const float PUParticleFollower::DEFAULT_MAX_DISTANCE = 3.40282e+038f;
const float PUParticleFollower::DEFAULT_MIN_DISTANCE = 10.0f;
//-----------------------------------------------------------------... | TOOL | 0.938468 | 6.547683 |
24409ab1-845d-490a-8714-08cb8e7c20f4 | farhanfuad02/practice | Module 3 - DFS/1_dfs.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
vector<int>v[N];
bool vis[N];
void dfs(int src)
{
cout << src << " ";
vis[src] = true;
for(int child : v[src])
{
if(!vis[child])
{
dfs(child);
}
}
}
int main()
{
int n,e;
cin >> n >> e;
... | ALGO | 0.999964 | 4.050428 |
66809d0c-342a-4107-9638-1c8411a377f9 | sangajapatel06/6Companies30Days | Amazon/Longest Mountain .cpp | int longestMountain(vector<int> &arr)
{
int n = arr.size();
int i = 0, j = 0, cnt = 0, longtmt = 0;
for (i = 1; i < n - 1; i++)
{
if (arr[i] > arr[i - 1] and arr[i] > arr[i + 1])
{
j = i;
cnt = 1;
while (j > 0 and arr[j - 1] < arr[j])
... | ALGO | 0.999939 | 5.250393 |
751b9875-b845-475e-aa5b-311ef1bc8deb | erwi/qlc3d | tests/cpp/initial-lc-orientation-tests.cpp | #include <catch.h>
#include <qlc3d.h>
#include <lc-representation.h>
#include <geom/coordinates.h>
#include <geom/vec3.h>
#include <inits.h>
#include <test-util.h>
#include <memory>
#include <alignment.h>
const double MARGIN = 1e-12;
TEST_CASE("Set initial LC orientation") {
double S0 = 0.55;
InitialVolumeOrienta... | TEST | 0.912203 | 7.471246 |
80511407-5ae9-4954-a67f-fa67c9796950 | bsarasij/Leetcode | 100-same-tree/same-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999977 | 6.37094 |
90a64f33-31e9-42a3-b178-cd8e0dd29b37 | bhuvanesvari/Coders-pack-cpp | task5.cpp | #include<iostream>
using namespace std;
int main()
{
int a[10];
int n,l,s;
cout<<"Enter the size of the array\n";
cin>>n;
cout<<"Enter the elements of the array\n";
for(int i=0;i<n;i++)
{
cin>>a[i];
}
l=a[0];
for(int i=1;i<n;i++)
{
if(l<a[i])
{
... | ALGO | 0.99961 | 3.233782 |
bac3f36a-5814-49a3-9858-e9dcbc4120fc | donusKim/Algorithm | baekjoon/DP/bj_12865.cpp | #include <stdio.h>
#define MAX(x,y) ((x>y)?(x):(y))
#define maxN 110
#define maxK 101000
int weights[maxN];
int values[maxN];
int visited[maxN];
int getMaxValues(int , int );
int n,k;
int max_sum;
int memoization[maxN][maxK];
int main(){
scanf("%d %d",&n,&k);
for (int i=0;i<n;i++){
scanf("%d %d",&weigh... | ALGO | 0.999996 | 3.569848 |
a6e46148-3bf8-459c-9137-b31284937f9c | kjm99d/VideoTalk | lib/opencv/sources/samples/cpp/tutorial_code/video/meanshift/meanshift.cpp | #include <iostream>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/video.hpp>
using namespace cv;
using namespace std;
int main(int argc, char **argv)
{
const string about =
"This sample demonstrates the means... | ALGO | 0.993634 | 5.497113 |
962c5e11-8d8f-464a-a635-c1efa0485dca | ou3slati/competitive-programming | Implementations/Codes (post IOI_21)/Winter Cup/A.cpp | //Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long ll;
#define int ll
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector... | ALGO | 0.999997 | 3.927834 |
32ea0dd1-09d3-4e68-ac02-e3e6275b4df8 | fwdzh/cp_code | Codeforces/2114/C.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++)
cin >> a[i];
int lst = -1, ans = 0;
for (int i = 1; i <= n; i++) {
if (lst + 1 < a[i]) {
lst = a[i];
ans+... | ALGO | 0.999409 | 5.151013 |
b386be60-69e4-4ce4-9c17-4a1959577255 | shuvo173025/URI-online-Judge-Solve | uri-online-judge-solve-master/uri1155.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int i;
double s=0,d=0;
for(i=1; i<=100; i++)
{
d = (1/(double)i);
s = s+d;
}
printf("%.2lf\n",s);
return 0;
}
| ALGO | 0.999585 | 3.801765 |
255beae7-746f-4b52-bf6b-7e36d6a8180b | yeasinzerothree/Codes | UVA/UVA 12502 Sol.cpp | #include <iostream>
#include <math.h>
using namespace std;
string reverse(string s);
int main() {
int t;
cin >> t;
for (int i = 1; i <= t ; ++i) {
float a, b, c, m;
cin >> a >> b >> m;
c = (a + b) / 3;
cout << round(((a - c) / c) * m) << endl;
}
} | ALGO | 0.999602 | 3.525558 |
968f9ff0-b1e4-4420-8fd8-e9a932cab491 | JLUNGOOD/flutter_plugin_pubdev | 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.998784 | 6.761023 |
df38a37e-3ebe-4894-badf-ee565c6e43dd | ReiAccept/Algorithm | vj/397060/D.cpp | #include<bits/stdc++.h>
#define ll long long
#define uint unsigned int
#define ull unsigned long long
using namespace std;
int qrd(){int a=0,b=1,c=getchar();while(c>'9'||c<'0'){if(c=='-')b=-1;c=getchar();}while(c>='0'&&c<='9')a=a*10+c-48,c=getchar();return a*b;}
int n,k;
int a[200003];
void Solve(ll ans=0)
{
n=qr... | ALGO | 0.999843 | 3.77012 |
24c689dd-2051-4bc2-88c1-ffb4fc851896 | solo-viber/LeetSyncHub | 0071-simplify-path/0071-simplify-path.cpp | class Solution {
public:
string simplifyPath(string path) {
string word;
stack<string> s;
for(int i = 0; i < path.length(); i++){
if(path[i]=='/'){
if(word!=""){
if(word==".."){
if(!s.empty()){
... | ALGO | 0.999934 | 5.81949 |
33f11f36-eaeb-4641-949b-73d8f038157e | hililyy/algorithm | baekjoon/24445.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
bool visited[100001] = {0};
int output [100001] = {0};
int cnt = 1;
vector <int> vec[100001];
queue <int> q;
void bfs (int v) {
q.push(v);
visited[v] = true;
while (!q.empty()) {
v = q.front();
... | ALGO | 0.999995 | 4.228296 |
b10e979f-87ba-4539-bb44-4f265ffe339f | gvnee/dataStructures-Algorithm | dataStructures/linkedListStruct.cpp | #include<stdlib.h>
#include<stdio.h>
struct Node{
int data;
Node* next;
};
void append(Node** head, int data){
Node* temp = new Node();
temp->data = data;
temp->next = *head;
*head = temp;
}
void insert(Node** head, int data, int index){
Node* newNode = new Node();
newNode->data = data... | ALGO | 0.999734 | 3.580692 |
92457e10-d69c-4e1c-bcfd-460fd5d9760d | aim-wip/frameworks_native | libs/cputimeinstate/cputimeinstate.cpp | #define LOG_TAG "libtimeinstate"
#include "cputimeinstate.h"
#include <bpf_timeinstate.h>
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <sys/sysinfo.h>
#include <mutex>
#include <numeric>
#include <optional>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include... | TOOL | 0.87611 | 7.240031 |
b9dc5cc7-e183-4b86-b2b5-c098753622cc | davisnguyen111195/Algorithm | 5_DongDuFibonacy/Hambosung13.cpp | // [Hร m, Lรฝ Thuyแบฟt Sแป]. Fibonacci 3
// Nhiแปm vแปฅ cแปงa bแบกn lร hรฃy tรฌm sแป thuแปc dรฃy sแป Fibonacci nhแป nhแบฅt lแปn hฦกn hoแบทc bแบฑng sแป N ฤรฃ cho. Biแบฟt mแปt sแป ฤแบงu tiรชn trong dรฃy Fibonacci lร : 1, 1, 2, 3, 5, 8, 13....
// Input Format
// Dรฒng duy nhแบฅt chแปฉa sแป nguyรชn dฦฐฦกng N
// Constraints
// 1<=N<=10^18
// Output Format
// In r... | ALGO | 0.999994 | 4.953287 |
3c36f6e6-e94d-4b35-b1d1-117101cd4efb | Mmaslach96/MyCode | METODY OBLICZENIOWE/ฤw 3/ฤw 3/ฤw 3.cpp | // w 3.cpp: Okrela punkt wejcia dla aplikacji konsoli.
#include "stdafx.h"
#include <iostream>
#include <math.h>
#include <iomanip>
#include <fstream>
const int literacji = 50; //liczba iteracji
const double e = 1e-12;
using namespace std;
double funkcja(double xn, int n)
{
if (n == 1)
{
return sin(xn / 4)*si... | ALGO | 0.999824 | 4.715568 |
798fe36f-8c81-4d0a-8a88-600957959686 | mendess/CG | src/engine/parser.cpp | #include "dependencies/rapidxml.hpp"
#include "engine/group.hpp"
#include "engine/render.hpp"
#include <algorithm>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <memory>
#include <vector>
namespace Parser {
using namespace std;
using namespace rapidxml;
string read_file(str... | TOOL | 0.924167 | 4.726873 |
b868a1ea-5faa-4cfc-9a52-e0b6f9a24bbf | ChrysKoum/Tichu-Game-Clone | Tichu code/smartplayer.cpp | #include <cstdlib>
#include "player.h"
#include "shuffler.h"
SmartPlayer::SmartPlayer(int index) : Player(index){
team = "Team 000"; // TODO: Change this to your team number e.g. "Team 150"
}
int SmartPlayer::setPhoenixValue(Table* table, PlayerStatus* playerStatuses, int* numberOfCardsPerPlayer, Combination* las... | ALGO | 0.955928 | 5.177256 |
482a9e4c-c851-47f2-ad5a-b1237645f572 | ajimenezh/Programing-Contests | ACM-ICPC/ICPC 2011 Pacific Northwest Regional/ProblemE.cpp | #include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>
using namespace std;
#define fo(i,n) for(int i=0;... | ALGO | 0.999858 | 4.304856 |
fd83322e-2236-49ef-bdc3-b4612b57bc38 | ShinSeungChul/BOJ | 1475/1475/์์ค.cpp | #include<iostream>
#include<cstdio>
#include<string.h>
#pragma warning(disable:4996)
using namespace std;
int main() {
long long roomNum;
int max, arr[10] = { 0 };
cin >> roomNum;
if (!roomNum)
arr[0]++;
while (roomNum) {
arr[roomNum % 10]++;
roomNum /= 10;
}
if ((arr[6] + arr[9]) % 2)
arr[6] = (arr[6... | ALGO | 0.997285 | 3.726233 |
b7c6f468-b4a4-44aa-969b-b981de874fb1 | jiaying1992/leet-code-jiaying | 015 Remove duplicates from sorted list.cpp | # Description
===========================================================================================
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.
---------------------------------------------... | ALGO | 0.999964 | 5.685008 |
522322ab-7fdf-4067-be8a-02e809317ba8 | ishandutta2007/codeforces | yyljkydr/normal/1496/B.cpp | #include<bits/stdc++.h>
using namespace std;
int T,n,k;
set<int>s;
int main()
{
scanf("%d",&T);
while(T--)
{
s.clear();
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
s.insert(x);
}
int mex=0;
... | ALGO | 0.999573 | 3.416876 |
a454ed0f-0fa7-4a26-87a6-e083f5df7f85 | Somya-Singhal/Leetcode-Daily-Practise | 1863-sum-of-all-subset-xor-totals/1863-sum-of-all-subset-xor-totals.cpp | class Solution {
public:
int solve(int i,int curr,vector<int>& nums)
{
if(i==nums.size())
return curr;
return solve(i+1,curr^nums[i],nums)+solve(i+1,curr,nums);
}
int subsetXORSum(vector<int>& nums) {
return solve(0,0,nums);
}
}; | ALGO | 0.999996 | 5.861344 |
da1a2633-43aa-42fe-94cc-af4350e55fee | YunshiuanOAO/CP | CSES/1083.cpp | //https://cses.fi/problemset/task/1083/
#include<bits/stdc++.h>
#define int long long int
#define Debug() cout << "Hello yunshiuan" << '\n';
using namespace std;
const int SIZE=2e5+7;
int p[SIZE];
void solve(){
int n;
cin >> n;
for(int i=1;i<=n-1;i++)
cin >> p[i];
sort(p+1,p+n);
for(int ... | ALGO | 0.999846 | 3.934263 |
fe1e5e92-f32e-4827-887f-ef0872645a3b | RaeesRaqeeb/Data_Structure_Code_Practice | Doubly_circular_linked_list.cpp | #include<iostream>
using namespace std;
class Nodes
{
public:
Nodes *next;
Nodes *prev;
int info;
Nodes(int value)
{
info= value;
next=NULL;
prev=NULL;
}
};
class Double_Circular_Linked_list
{
private:
int lengt... | ALGO | 0.998911 | 4.520389 |
d7838039-5e58-44db-8371-18ce903b6f27 | uditamujumdar/LeetCode | 1014-k-closest-points-to-origin/k-closest-points-to-origin.cpp | class Solution {
public:
static int comp(vector<int>& a, vector<int>& b){
int x=a[0]*a[0]+a[1]*a[1];
int y=b[0]*b[0]+b[1]*b[1];
return x<y;
}
vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {
sort(points.begin(), points.end(), comp);
vector<vector<... | ALGO | 0.999998 | 5.790828 |
3892f645-10ac-4486-bde4-b087150ee388 | Shwastya/MyTFMDescent | src/engine/system/geometry/geometry.cpp | #include "engine/system/geometry/geometry.hpp"
#include "engine/system/MHCore.hpp"
#include <glad/glad.h>
#include <glm/vec3.hpp>
#include <glm/vec2.hpp>
#include <glm/detail/func_geometric.inl>
#include <iostream>
namespace MHelmet
{
void Geometry::calcTangents(const float* positions, const float* uvs, const floa... | TOOL | 0.952849 | 5.796841 |
140b84c0-2462-4f80-85be-1eafe7fa284f | ammarGamal123/LeetCode | 1971-Find-if-Path-Exists-in-Graph.cpp | class Solution {
public:
vector<vector<int>> adjList; // N is the number of vertices
void buildGraph (vector<vector<int>> &edges) {
for (int i = 0; i < edges.size(); ++i) {
int u = edges[i][0];
int v = edges[i][1];
adjList[u].
push_back(v);
adjList[v].
... | ALGO | 0.999967 | 6.283139 |
a64e058d-f3da-4677-b572-fa4fb41d6c76 | ntpink/DSA | bai7.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void testcase(){
string s;
getline(cin, s);
for(int i = 0; i < s.size(); i++){
s[i] = tolower(s[i]);
}
stringstream ss(s);
string word;
vector<string> v;
while(ss >> word){
v.push_back(word);
}
for(auto &x : v){
x[0] = toupper(x[0]);
}
... | ALGO | 0.999332 | 4.623689 |
aa1a1469-befd-4220-8efd-468855da5f78 | 77Jonas77/CPP_Projects | zad1_dod/main.cpp | #include <vector>
#include <iostream>
//FILTROWANIE IMION - BRAK ROZWIAZANIA + NIE BYLO NA LEKCJI
std::vector<std::string> getNamesFrom(const std::vector<std::string>& strings) {
std::vector<std::string> names;
for (const auto& str : strings) {
if (isupper(str[0])) {
names.push_back(str);
... | ALGO | 0.972846 | 5.490875 |
dd7f686e-47c4-44e6-bc7c-94f5c4db9fe0 | pndaza/attha_nissaya_new | 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.998693 | 6.797273 |
98c96072-12c9-4345-af86-28379b590800 | joelottosson/cwg | src/players/tank_player_templates/tank_player_cpp/src/TankLogic.cpp | #include "TankLogic.h"
#include "GameMap.h"
#include "BfsHelper.h"
const std::wstring TankLogic::PlayerName = L"tank_player_cpp"; //TODO: change to your team name
void TankLogic::MakeMove(Consoden::TankGame::GameStatePtr gameState)
{
//-------------------------------------------------------
//Example of a stu... | ALGO | 0.965594 | 3.971542 |
7fcb304a-fab9-4e41-aed9-60a9bb5b9c90 | thegamer1907/Code_Analysis | contest/1542572485.cpp | #include <bits/stdc++.h>
using namespace std;
int mark[ 100100 ];
vector< int > values;
int main( ) {
int n, k; cin >> n >> k;
bool ok = false;
for( int i = 0; i < n; i ++ ) {
int val = 0;
for( int j = 0; j < k; j ++ ) {
int x; cin >> x;
val |= ( x << j );... | ALGO | 0.999918 | 3.857395 |
1f893559-5fbe-4037-8a17-fdf440a11c58 | mtai000/leetcode | cpp/70.็ฌๆฅผๆขฏ.cpp | /*
* @lc app=leetcode.cn id=70 lang=cpp
*
* [70] ็ฌๆฅผๆขฏ
*/
// @lc code=start
#include <math.h>
class Solution {
public:
int climbStairs(int n) {
int n1 = 1;
int n2 = 2;
if(n==1)return n1;
if(n==2)return n2;
int temp = 0;
for(int i =3 ; i<= n; i++)
{
... | ALGO | 0.999914 | 5.601649 |
513cf73b-4365-4979-87d1-2eea5174d906 | zhuwenboa/data_struct | data/leetcode/ๅๆoffer/65.cpp | #include<iostream>
//ไบ่ฟๅถ่ฟ็ฎ
class Solution
{
public:
int add(int a, int b)
{
//ๅฝไธ้่ฆ่ฟไฝๆถ้ๅบๅพช็ฏ
while(b != 0)
{
//้่ฆ่ฟไฝ็ๅ ่ดๆฐไธ่ฝ่ฟ่ก็งปไฝๆไฝ
int c = (unsigned int)(a & b) << 1;
//ไธ้่ฆ่ฟไฝ็ๅ
a ^= b;
b = c;
}
return a;
... | ALGO | 0.999804 | 4.494857 |
e0d1cb62-5a42-4b60-9817-6b538d48b8c0 | ShuvaDev/Compettive-Programming | Extra/A_Short_Sort.cpp | #include<bits/stdc++.h>
#define endl "\n"
#define sp " "
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
string str;
cin >> str;
if(str == "abc" || str == "bac" || str == "acb" || str == "cba") {
cout << "YES\n";
} else {
cout << "N... | ALGO | 0.999805 | 4.239505 |
ebb8ddf1-a5a9-4727-acce-2446760606c8 | artem-smola/RoadDirectionRecognition_AtDistance | src/road_recognition/manager.cpp | #include "manager.hpp"
#include "constant.hpp"
#include <filesystem>
#include <fstream>
Manager::Manager(Reader &reader, Writer &writer)
: reader_(reader), writer_(writer) {}
ManagerDRR::ManagerDRR(Reader &reader, Writer &writer,
DistantRoadRecognition &marker)
: Manager(reader, writer)... | TOOL | 0.982165 | 5.198353 |
b5a23f2d-5cd6-4b67-80e3-cc872e6ae48e | its-coder5128/leetcode | my-folder/problems/interleaving_string/solution.cpp | class Solution {
public:
bool solve(string s1, string s2, string s3,int i,int j,int n,int m,vector<vector<int>> &dp)
{
if(dp[i][j] != -1)
return dp[i][j];
if(i>=n && j>=m)
{
return dp[i][j]=true;
}
else if(i<n && s1[i] == s3[i+j] && j<m && s2[j] =... | ALGO | 0.999936 | 5.802114 |
6dfbc89b-f41e-4ea0-9723-d84dcdf2cea9 | astrixsanath14/repl.it | Renaissance-ProgrammingPathshala/Live_Class/17_Oct_2022/GCDOnBlackboard.cpp | #include <iostream>
#include <vector>
using namespace std;
long gcd(long a, long b)
{
if (a % b == 0)
return b;
return gcd(b, a % b);
}
int main()
{
int n;
cin >> n;
vector<long> prefixGCD(n, -1), arr(n);
int i = 0;
while (i < n)
{
cin >> arr[i];
if (i == 0)
... | ALGO | 0.999972 | 4.502765 |
1cf7ecab-3d05-470b-9f7f-995879944cb5 | souta-pqr/Program_Practice | c++/15/tmp1.cpp | #include<iostream>
using namespace std;
template <class T>
class Array{
private:
T data[5];
public:
void setData(int num, T d);
T getData(int num);
};
template <class T>
void Array<T>::setData(int num, T d)
{
if(num<0 || num>4)
cout << "It is beyond the scope of the array." << endl;
else
data[num] = d;
... | TOOL | 0.902478 | 4.451949 |
18c09c74-df37-4fb0-8ac5-059cbbc688a6 | Arshjeet-Singh/DSASheet2022 | Graph/Practice/Shortest path in an unweighted graph.cpp | #include<bits/stdc++.h>
vector<int> shortestPath( vector<pair<int,int>> edges , int n , int m, int s , int t){
unordered_map<int,list<int>> adj;
for(int i=0;i<edges.size();i++)
{
int u=edges[i].first,v=edges[i].second;
adj[u].push_back(v);
adj[v].push_back(u);
}
unordered_map... | ALGO | 0.999997 | 4.932684 |
998537ce-6a0d-40fb-943d-d8f0f5b17b08 | soomrack/MR2024 | Aksenov Maksim/Coursework/kahns.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <random>
#include <chrono>
#include <stdexcept>
using namespace std;
void validate_input(int num_nodes, int max_edges_per_node) {
if (num_nodes <= 0) {
throw invalid_argument("ะะพะปะธัะตััะฒะพ ะฒะตััะธะฝ ะดะพะปะถะฝะพ ะฑััั ะฟะพะปะพะถะธัะตะปัะฝัะผ.");
}
if (max_... | ALGO | 0.999692 | 7.11469 |
9208114b-0fe0-4271-b71d-b1a69b55eb81 | BryceBohlman/cs-303-assignment-1 | CS_303_Assignment_1/Main.cpp | #include "Assignment_1_Header.h"
void main()
{
string arrayInputFileName = "A1input.txt";
int myArray[100];
int modifiedValue;
ReadFileIntoArray(arrayInputFileName, myArray, sizeof(myArray));
cout << GetIndexPositionOfQueryNumber(15, myArray, sizeof(myArray)) << endl;
cout << GetIndexPositionOfQueryNumber(101, ... | ALGO | 0.929685 | 3.538832 |
e9ddcf7a-b1cf-406a-b6f3-cc2c135bac31 | TodorokiKohei/atcoder | 2020_08/07/asakatu/5.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define all(x) (x).begin(),(x).end() // ๆ้ ใฝใผใ
#define rall(v) (v).rbegin(), (v).rend() // ้้ ใฝใผใ
#define FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
ty... | ALGO | 0.999834 | 3.277114 |
dcb43b61-5b0d-4522-9af1-339082037f57 | FragmentedStudios/hleh | game/shared/achievements_hlx.cpp | #include "cbase.h"
#ifdef GAME_DLL
// this gets compiled in for HL2 + Ep(X) only
#if ( defined( HL2_DLL ) || defined( HL2_EPISODIC ) ) && ( !defined ( PORTAL ) ) && ( !defined( HL2MP ) )
#include "baseachievement.h"
#include "prop_combine_ball.h"
#include "combine_mine.h"
#include "basegrenade_shared.h"
#include "ba... | ALGO | 0.871913 | 6.141866 |
191ac736-612b-4c1e-b42e-a95fa23d8858 | PaperL/Data-Structure-2021-Homework | Homework-2/src/1101.cpp | //
// Created by Frank's Laptop on 2021/3/29.
//
#include <cstdio>
using namespace std;
namespace PTF {
// Here is PaperL's Template Function
// Version: 0.4
// Update Time: 2021.3.28
template<typename T1, typename T2>
struct sameType {
operator bool() { return false; }
};
template<typename... | ALGO | 0.999858 | 3.752903 |
2884f83b-57d6-46f7-833a-6a224e28d734 | n0IQ/Advanced-Data-Structures | Segment Tree/Point Update/Maximum and its Occurences.cpp | // Problem: Given an array a of size n and q queries of two types:
// 1: update the value at position x.
// 2: return the Maximum Number and its Occurences in Range L to R
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace ... | ALGO | 0.999791 | 5.171389 |
8d611103-3aea-459e-848a-2f0175fb7d88 | north-h/Match_code | 2023/Codeforces_-_Codeforces_Round_719_(Div_3)/B_Ordinary_Numbers.cpp | /*
* ==================================================================================
* Author: north_h
* Time: 2023-09-14 15:05:19
*
* Problem: B. Ordinary Numbers
* Contest: Codeforces - Codeforces Round 719 (Div. 3)
* URL: https://codeforces.com/contest/1520/problem/B
* MemoryL: 256 MB
* TimeL: ... | ALGO | 0.999603 | 5.212837 |
e3726b24-6b9e-40bb-87ce-9ecd8be093b1 | takayama013/3DProgaming | L06_Random/Src/Framework/Math/KdAnimation.cpp | #include "KdAnimation.h"
#include "../Direct3D/KdModel.h"
// ไบๅๆข็ดขใงใๆๅฎๆ้ใใๆฌกใฎ้
ๅ่ฆ็ด ใฎKeyIndexใๆฑใใ้ขๆฐ
// list โฆ ใญใผ้
ๅ
// time โฆ ๆ้
// ๆปใๅค โฆ ๆฌกใฎ้
ๅ่ฆ็ด ใฎIndex
template<class T>
int BinarySearchNextAnimKey(const std::vector<T>& list, float time)
{
int low = 0;
int high = (int)list.size();
while (low < high)
{
int mid = (low ... | ALGO | 0.980582 | 5.235437 |
abe4e2e4-c425-48fa-acb7-e7c3c305920a | Lim-YongKwan/Algorithm | ๋ฐฑ์ค/NCTEST_001.cpp | #include<iostream>
#include<map>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int dset[30];
string solution(string source) {
string answer = "";
int total = source.size();
for(int i = 0;i<source.size();i++){
dset[source[i]-'a']++;
// cout<<source[i] - 'a'<<en... | ALGO | 0.999988 | 4.655513 |
7c60f312-796d-4586-9f93-84f544619a42 | jeevanpuchakay/a2oj | Codechef/LongChallenges/April2019/Question2Optimised/main.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
char b;
ll eval(ll n)
{
ll tot=n*(n+1);
return (tot/=2);
}
vector<ll> find(vector<ll> pos,string inp,ll n)
{
for (ll i = 0; i < n; ++i) {
if(b==inp[i])
pos.push_back(i);
}
return pos;
}
int main()
{
ll t;... | ALGO | 0.999881 | 4.189037 |
b5f164a0-f8eb-4e3d-8e34-756a77e3fb77 | sarvex/leetcode-zig | solution/0100-0199/0109.Convert Sorted List to Binary Search Tree/Solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
/**
* Definition for a binary tree node.
* struc... | ALGO | 0.999998 | 6.459651 |
809b4631-af50-4ccd-9fcd-601c832abd69 | masonarchhsieh/Training_LeetC | binary-search/Accepted/1-19-2023, 4_07_55 PM/Solution.cpp | // https://leetcode.com/problems/binary-search
class Solution {
public:
int search(vector<int>& nums, int target) {
int left = 0, right = nums.size() - 1;
int index;
while (left <= right)
{
index = (left + right) / 2;
if (nums[index] == target)
... | ALGO | 0.999971 | 6.819526 |
0a3ae34a-3aa0-4907-8614-314c7deecd13 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p02587/p02587_num2_parsed.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
bool isPalindrome(string s) {
int i = 0, j = s.length() - 1;
while (i < j) {
if (s[i] != s[j]) {
return false;
}
i++;
j--;
}
return true;
}
int main() {
... | ALGO | 0.999682 | 5.092461 |
8aa8e6e4-3858-4c26-bf20-d25cf73b5808 | pingchungchang/CP | PE002.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll a = 1,b = 2,total = 0;
while(a<=4*1e6){
if(a%2 == 0)total += a;
swap(a,b);
b = a+b;
}
cout<<total;
}
| ALGO | 0.9997 | 3.139997 |
0e8bebfa-7eec-4b4e-bc63-ac06e8e7f179 | Bogzx/PBINFO | Problems/1366Aceeasi_paritate_2/main.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
long long n;
cin >> n;
int nr[200000],ma,contor=n;
for(int i=0;i<n;i++){
cin>>nr[i];
}
for(int i=0;i<n;i++){
cout<<nr[i]<<" ";
}
cout<<endl;
bool inseram;
do {
inseram=false;
... | ALGO | 0.999973 | 3.757866 |
0a54cc22-8677-44e7-82e8-0b92fd0db5ce | zjsxzy/binarysearch | Enclosed Islands/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
struct union_find{
int N;
vector<int> par, siz;
union_find(int n) : N(n){
par.resize(N);
siz.resize(N, 1);
for(int i=0; i<N; i++) par[i] = i;
}
int root(int X){
if(par[X] == X) return X;
retu... | ALGO | 0.99979 | 4.946362 |
44f611a2-5e7f-46a2-981c-d6ccfaeb6c94 | Mferrill/TrinityBotCore | dep/g3dlite/source/PrecomputedRandom.cpp | #include "G3D/PrecomputedRandom.h"
#include "G3D/System.h"
namespace G3D {
PrecomputedRandom::PrecomputedRandom(int dataSize, uint32 seed) :
Random((void*)NULL),
m_hemiUniform(NULL),
m_sphereBits(NULL),
m_modMask(dataSize - 1),
m_freeData(true) {
alwaysAssertM(isPow2(dataSize), "dataSize must be a power of... | ALGO | 0.959776 | 6.501557 |
9987b2a0-4c1c-45d8-981c-04f0e1827e48 | pacha2880/competitive_programming_codes | Throwing cards away II.cpp | #include <bits/stdc++.h>
#define PI acos(-1)
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define srt(a) sort(all(a))
#define mem(a, h) memset(a, (h), sizeof(a))
#define f first
#define s second
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -i... | ALGO | 0.999542 | 3.901652 |
406ab0db-c17a-4f56-8df6-7631e688d86e | raincross7/code-similarity | codes/train_code/problem095/problem095_298.cpp | /*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_... | ALGO | 0.99983 | 3.658239 |
b3aaa143-eef0-4a62-a34c-7b3a211dd800 | DhruvTotala/Leetcode | 118-pascals-triangle/pascals-triangle.cpp | class Solution {
public:
vector<vector<int>> generate(int numRows) {
vector<vector<int>> result(numRows);
for(int i = 0; i < numRows; i++) {
result[i] = vector <int> (i + 1, 1);
for(int j = 1; j < i; j++) {
result[i][j] = result[i - 1][j] + result[i - 1][j - 1... | ALGO | 0.999964 | 5.764514 |
340974d2-d534-4a32-9d74-3cdba09649b5 | Zapryanovx/FMI-SDA-2024-PREP | Week 07/Additional/LeetCode/0100. Same Tree/same_tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999983 | 6.711028 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.