uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7884fdc3-2bd1-4273-9555-46c26c24791a | fuqinho/GoogleCodeJam | 2011_1C/B/main.cpp | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<(n);++i)
LL solve(int L, LL t, int N, int C, vector<int>& a) {
// a[i]: necessary time without booster
REP(i, C) a[i] *= 2;
vector<pair<int, int> > count(C);
REP(i, C) count[i] =... | ALGO | 0.999805 | 3.338237 |
4aad7fd6-5660-4f75-b7c5-2a4b2d99306a | EshaanSeth/Competitive_Coding | Algorithms/Graphs/Dijkstra/dijkstra.cpp | #include <cstdio>
#include <cstdlib>
#include <queue>
#include <vector>
using namespace std;
#define MAXN 105
#define INF 1<<30
typedef struct node{
int t, c;
node(){}
node(int T, int C) : t(T), c(C){}
bool operator < (const node &x) const{
return c < x.c;
}
}No;
vector<No> adj[MAXN];
int mark[MAXN];
int ... | ALGO | 0.999767 | 4.191106 |
c0e8e692-2ba4-4864-a9de-dc4b2a5f18ac | KratosMultiphysics/KratosLegacyApplications | StabilizedCFDApplication/custom_elements/dss_fic.cpp | #include "utilities/math_utils.h"
#include "dss_fic.h"
#include "custom_utilities/turbulence_statistics_container.h"
#include "includes/cfd_variables.h"
namespace Kratos
{
///////////////////////////////////////////////////////////////////////////////////////////////////
// Life cycle
template< unsigned int TDim >
... | ALGO | 0.958943 | 5.635905 |
f7c80c66-c522-4116-9c3e-c51524cf28fb | beelisais2793/FX | Synthesizer/Waves/PhysicalModel/Physically-based-modelling/RigidBodySimulation/RigidBodySimulation/include/eigen-eigen-323c052e1731/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
m << 1,-2,
-3,4;
cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
<< " == " << m.colwise().lpNorm<1>().maxCoeff() << endl;
cout << "infty-norm(m... | ALGO | 0.999637 | 4.076589 |
b8936cc7-b193-4735-83ba-6895d40a778e | Mohak327/ADA_Sem5 | exp 1/1a.cpp | #include<bits/stdc++.h>
using namespace std;
void bubbleSort(vector<int> &arr, int n) {
for (int i = 0; i < n - 1; i++) {
bool swaps = false;
int j = 0;
for (int j = 0; j < n - 1 - i; j++) {
while (arr[j] > arr[j + 1]) {
swap(arr[j], arr[j + 1]);
swaps = true;
}
}
if (!swaps)
return ;
}
r... | ALGO | 0.999899 | 4.940145 |
0080b493-53e1-47bb-9a10-d6f1e9b80039 | ishandutta2007/codeforces | firecrystal/normal/1467/A.cpp | #include <cstdio>
#include <iostream>
using namespace std;
typedef long long LL;
int n;
int main() {
int T; scanf("%d", &T);
while (T--) {
scanf("%d", &n);
int a = 9;
for (int i = 1; i <= n; i++) {
putchar(a + '0');
if (i == 1) a = 8;
else a = (a + 1) % 10;
}
puts("");
}
return 0;
} | ALGO | 0.998678 | 3.979123 |
846b91aa-e95e-488f-aba6-a7e6121643dc | Didk0/Design-And-Analysis-Of-Algorithms-Practicum | Graphs/GraphTraversal/Famous/Famous.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <string>
#include <set>
using namespace std;
const int MAX = 1005;
int n, m, f, k;
vector<int> graph[MAX];
int calls[MAX]; // number of messages for every person (+k if he/she is famous from the start)
queue<int> q;
unordered_ma... | ALGO | 0.999988 | 4.636357 |
306b0e21-856f-490f-b0c8-c8ed1bb36183 | about-anuj/Leetcode-Solutions | 59-spiral-matrix-ii/59-spiral-matrix-ii.cpp | class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>>v(n,vector<int>(n,0));
int l=0,t=0,b=n-1,r=n-1,j=1;
while(l<=r and t<=b)
{
//->
for(int i=l;i<=r;i++)
v[t][i]=j++;
t++;
//d... | ALGO | 0.999983 | 5.883951 |
af4d1641-5db7-44d7-8850-f6216277e89e | KarishmaSaurabh/LeetcodeSolutions | Trees/Construct Binary Tree from Inorder and Postorder Traversal.cpp | class Solution {
public:
unordered_map<int,int> m;
TreeNode* solve(vector<int>& postorder,int &postIn,int i,int j){
if(i>j){
return NULL;
}
TreeNode *p=new TreeNode(postorder[postIn--]);
int inRoot=m[p->val];
p->right=solve(postorder,postIn,inRoot+1,j);
... | ALGO | 0.999991 | 6.106071 |
3145a188-8971-4c3d-97cf-c74d28bbe2be | BorisPenchev1/Informatics-competitive | D group/Binary Search/Lower and Upper/boxing.cpp | #include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll MAXN = 1e7 + 7;
ll n, k;
ll X, Y, Z, M;
ll a[MAXN];
ll prefix[MAXN];
void generate()
{
for (ll i = 3 ; i <= n ; i++)
{
a[i] = (a[i - 2] * X + a[i - 1] * Y + Z) % M;
}
}
ll calcSum(ll l, ll r)
{
re... | ALGO | 0.999884 | 3.642176 |
bb39c41d-7faa-4554-99ce-e5fdf43288b1 | margotduek/estructuraDeDatos | Segundo Parcial/EstructurasLineales/Tarea4/Ejercicio2/main.cpp | /*
Margot Duek
Tarea 4
Ejercicio 2
simulacion de Token Ring
*/
#include "CircularLinkedList.h"
#include "Token.h"
#include "Node.h"
using namespace std;
bool ping(Token token, CircularLinkedList<Computadora> * red);
void recibido(Token token, CircularLinkedList<Computadora> * red);
//void ping(Computadora de, Compu... | TOOL | 0.995162 | 3.804648 |
cd7564cb-e195-4f84-ac3f-9fb5ca5920f1 | Sharpless298/CompetitiveProgramming | Codeforces/2090C.cpp | #include <bits/stdc++.h>
using namespace std;
int f(int x, int y) {
if (x % 3 == 2 && y % 3 == 2)
return x + y + 2;
return x + y;
}
struct node {
int x, y;
bool operator<(const node &a) const {
if (f(x, y) != f(a.x, a.y))
return f(x, y) < f(a.x, a.y);
if (x != a.x)
return x < a.x;
return y < a.y;
}... | ALGO | 0.999877 | 3.702208 |
1af92a1a-4ac5-47cf-bdc5-49826463f1fc | cchiragjain/leetcode-solutions | 820-find-eventual-safe-states/find-eventual-safe-states.cpp | class Solution {
private:
bool dfs(int src, vector<bool>& visited, vector<bool>& visitedInPath, vector<bool>& safe, vector<vector<int>>& adj){
visited[src] = true;
visitedInPath[src] = true;
// traverse adjancent nodes
for(int neighbour: adj[src]){
... | ALGO | 0.999957 | 5.784395 |
cc922e86-f884-429d-acf7-259eefb4fc93 | joseaponte/QuantNet_Certification | Part VI Computational Finance/Level 9/HW/Groups A&B/PerpAmericanOption.cpp | //PerpAmericanOption.cpp is a source file that defines
//and implements the class for Perpetural American options,
//which represents solutions to Perpetual American Options
#include "PerpAmericanOption.hpp"
PerpAmericanOption::PerpAmericanOption() : r(0.05), sig(0.2), K(110), b(r), opt_type('C'), und_as("UNKWN") {}... | ALGO | 0.953657 | 6.725053 |
a0c3352d-591d-4aea-91b1-a9ba142b6711 | Altu-Bitu-2/Altu_Bitu | stackqueuedequeue/ab23.cpp | #include <iostream> //입출력받기
#include <deque> //덱 사용
#include <vector> //vector 사용
#include <algorithm> //reverse()사용
//문제 18115
using namespace std; //std namespace 사용중
deque<int> cardGame(int n, vector<int>& cmd) {
deque<int> dq; //int형 deque 선언
for (int i = 1; i <= n; i++) { //놓여 있는 위의 카드부터 검사 1,... | ALGO | 0.999979 | 4.855348 |
d4bb903f-7107-4092-86f5-41ccdff20886 | yoon-yk/LeetcodeSubmission | 64-minimum-path-sum/64-minimum-path-sum.cpp | class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
int n=grid.size(), m=grid[0].size();
int curMin;
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) {
if (i==0 && j==0) continue;
curMin = INT_MAX;
if (i>0) curMin... | ALGO | 0.999944 | 6.109694 |
bd95a375-7d31-431f-a6ac-0b46f4e68986 | Ambareen09/leetcode-pods | 1162-as-far-from-land-as-possible/1162-as-far-from-land-as-possible.cpp | class Solution {
public:
int maxDistance(vector<vector<int>>& grid) {
int dx[] = {-1,1,0,0};
int dy[] = {0,0,-1,1};
queue<pair<int,int>> q;
for(int i = 0 ; i < grid.size() ; i++){
for(int j = 0 ; j < grid[0].size() ; j++){
if(grid[i][j] == 1) q.push({i,j})... | ALGO | 0.999914 | 5.643068 |
d4aa5664-4cfb-42e8-84a7-94db65297350 | chenshuyuhhh/STCA_weekly_coding | card/maxScore.cpp | #include <vector>
using namespace std;
int maxScore(vector<int> &cardPoints, int k) {
if (k > cardPoints.size()) return 0;
int passScore[k + 1];
int sum = 0;
for (int i = 0; i < k; ++i) {
sum += cardPoints[i];
passScore[i] = sum;
}
int score = 0;
sum = 0;
for (int i =... | ALGO | 0.999409 | 5.337038 |
d2808bd0-11c9-4fdb-8e0b-6d5f0a3be04a | sarvex/leetcode-clisp | solution/0500-0599/0556.Next Greater Element III/Solution.cpp | class Solution {
public:
int nextGreaterElement(int n) {
string s = to_string(n);
n = s.size();
int i = n - 2, j = n - 1;
for (; i >= 0 && s[i] >= s[i + 1]; --i)
;
if (i < 0) return -1;
for (; s[i] >= s[j]; --j)
;
swap(s[i], s[j]);
... | ALGO | 0.99996 | 5.497602 |
14a4e1ec-ec31-4e36-b472-694d2e02853b | Adi2209/DSA | Detect cycle in an undirected graph - GFG/detect-cycle-in-an-undirected-graph.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
private:
bool dfs(int node,int parent,vector<int> adj[],vector<int>& vis){
vis[node]=1;
for(auto adjnode:adj[node]){
if(!vis[adjnode]){
if(dfs(adjnode,node,adj,v... | ALGO | 0.999974 | 6.225092 |
b503a79a-d55c-414b-9ca7-20967ff37572 | Twilightoo/Data-Structure-and-Database | Hash.cpp | #include<stdio.h>
#include<stdlib.h>
#include<process.h>
#include<math.h>
#define M 13
#define p 13
typedef struct node{
int key;
struct node *next;
}*HashNode,HNode;
void print1(int HT1[]){
int i;
for(i=0;i<M;i++){
printf("%d",HT1[i]);
printf(" ");
}
printf("\n");
}
void print2(HashNode HT2[]){
int i;
... | ALGO | 0.998771 | 3.377352 |
0487c3ee-b91c-467c-bc46-2f3fa707ba4e | heonilp/study | boj study/4179 불.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <queue>
#include <string>
using namespace std;
struct st_XY
{
int y;
int x;
int cnt;
};
char str[1001][1001];
int visit[1001][1001];
int n, m;
queue<st_XY> q; //불의큐
int jx, jy;
void F_bfs()
{
// 불이 번지는 위치에 걸린 시간을 기입.
while (!q.empty... | ALGO | 0.999948 | 4.044493 |
3c87cfe0-9011-4090-ab3c-8b3c06ca55b0 | chinmay-2002/leetcode_answers | Mathematics/509Fibonacci.cpp | /*
The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence,
such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
*/
// Recursion
class Solution {
public:
int fib(int n) {
... | ALGO | 0.999985 | 6.095931 |
58d5e85c-2420-46b9-81ce-884627432a32 | WhiteCells/code | algo/daily/weekly_contest/356/t2.cpp | #include "../../head_file.h"
// https://leetcode.cn/problems/count-complete-subarrays-in-an-array/
// 原状
// O(n^2)
class Solution {
public:
int countCompleteSubarrays(vector<int>& nums) {
int cnt = 0; // 统计 nums 中不同的元素个数
int a[2001]{};
for (auto& num : nums) {
if (!a[num]) {
... | ALGO | 0.999945 | 5.910838 |
d9d5da34-518a-4adb-8be6-0027586c2755 | abdullah-124/xpsc | Week-9/day-6/C_ABBB.cpp | #include<bits/stdc++.h>
#define fastread() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define ll long long
using namespace std;
void solve(){
string s; cin>>s;
int n = s.size();
stack<char>st;
for(int i=0;i<n;i++){
if(st.empty() or s[i]=='A')st.push(s[i]);
else if((!st... | ALGO | 0.999106 | 5.016563 |
911557ac-3aa6-40ae-a8c5-2f503e399eb7 | Cope-Ali/cplus | week13/maze.cpp | /***********************************************************************
* Component:
* Assignment 12, Maze
* Brother Helfrich, CS 235
* Author:
* Br. Helfrich
* Summary:
* Draw and solve a maze
************************************************************************/
#include <iostream>
#include <... | ALGO | 0.99747 | 5.14053 |
b488333e-ee9e-483a-93bb-8f80019e6315 | Yisus83/SomeKattisProblems | bokforing.cpp | #include<iostream>
#include<map>
using namespace std;
int main() {
int n, m;cin >> n >> m;
int x = 0, y, z;string s;
map<int,int>v;
while (m--) {
cin >> s;
if (s == "SET") {
cin >> y >> z;
v[y] = z;
}
else if (s == "RESTART") {
cin >> x... | ALGO | 0.996378 | 3.830485 |
85a5d0f4-b74a-4256-a4b2-e4f45ac759d1 | monhime/atcoder_charter | virtual_asa/210116/A.cpp | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define FOR(i, a, b) for (in... | ALGO | 0.999803 | 4.62956 |
24281b74-67a7-4b4c-b6a8-3deb014c8a19 | tanmaytarwade/c-assignments-code | arrayandstring.cpp | /*1. Write a program create a menu as
1. One Dimensional Array
2. String
In First case
Scan array for 10 Elements
Sort the Array Elements and stored in new array.Print original and sorted array.
In Second case
Scan string and stored in reverse format in new string. print both string.*/
#include<iostream>
usin... | ALGO | 0.994228 | 3.37139 |
a70f3b56-d36a-44bd-97f9-9434fb064d34 | THU-DSP-LAB/llvm-project | llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp | #include "llvm/Transforms/Scalar/CallSiteSplitting.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses... | ALGO | 0.9355 | 7.847132 |
9bda8a26-d77a-424c-bed1-62d051ae250e | samyakkhabiya/Leetcode | 700-search-in-a-binary-search-tree/700-search-in-a-binary-search-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.999996 | 6.091083 |
b8d3387a-fb3d-4c71-9c8c-ca8afa2f6c2d | mollah2022/code | emni.cpp | #include <iostream>
using namespace std;
int main() {
int n1, n2, hcf;
cout << "Enter two numbers: ";
cin >> n1 >> n2;
// swapping variables n1 and n2 if n2 is greater than n1.
if ( n2 > n1) {
int temp = n2;
n2 = n1;
n1 = temp;
}
for (int i = 1; i <= n2; ++i) {
if (n1 % i == 0 &... | ALGO | 0.995422 | 4.061081 |
ede20ce9-a6f1-4593-897d-ccc45f04998e | sarvinshrivastava/Cpp.Leetcode | P-2577.cpp | class Solution {
#define pip pair<int,pair<int,int>>
public:
int minimumTime(vector<vector<int>>& grid) {
vector<int> dir = {-1,0,1,0,-1};
int m=grid.size();
int n=grid[0].size();
if(grid[0][1]>1+grid[0][0] and grid[1][0]>1+grid[0][0])
return -1;
vector<vecto... | ALGO | 0.999977 | 5.829756 |
6e322a48-dee0-4c58-ae46-3c3329fc4b4c | lkt9899/algo | BOJ/GOLD/5430/5430.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#define fio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define i1(a) cin >> a
#define i2(a, b) cin >> a >> b
#define i3(a, b, c) cin >> a >> b >> c
#define fi0(e) for (int i = 0; i < e; i++)
#define fi1(e) for (int i = 1; i <= e; i+... | ALGO | 0.99994 | 4.899925 |
46266499-8c7c-4d50-9092-bbf714e1e602 | Amunem0/Leetcode | Medium/2696. Minimum String Length After Removing Substrings.cpp |
//APPROACH 1
class Solution {
public:
int minLength(string s) {
stack<char> st;
for (int i = 0; i < s.length(); i++) {
if (!st.empty()) {
if (st.top() == 'A' && s[i] == 'B' ||
st.top() == 'C' && s[i] == 'D') {
st.pop();
... | ALGO | 0.99994 | 6.313012 |
bc46b88a-908d-4af9-8670-950c6ca6a4a4 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/cmap/distance_search/train/bd459a69-b2a4-4e73-9c47-4b80160b1f53.cpp | #include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
class PointSet {
public:
PointSet(const vector<pair<int, int> >& points) : points_(points) {}
double FindClosestPair() {
sort(points_.begin(), points_.end());
set<pair<int, int>, YComparator> interesting_poi... | ALGO | 0.999733 | 4.882931 |
4b252398-32f9-4bdc-8cf8-f59abb7e3c32 | swanandjoshi30/SPPU-Data-Structure-Assignments | Assignment_E31.cpp | #include<iostream>
using namespace std;
#define SIZE 5
class Dequeue {
int arr[SIZE], front, rear, count;
public:
Dequeue();
void addToFront(int);
void addToRear(int);
void deleteFromFront();
void deleteFromRear();
void display();
};
Dequeue::Dequeue() {
front = -1;
rear = -1;
... | ALGO | 0.997864 | 5.982133 |
83f1119a-8779-4090-8425-e21f5fa9a04f | sangmin7b/algorithm | problems/1113.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
int N, M;
vvi board;
vvi visited;
int dr[4] = {1, -1, 0, 0};
int dc[4] = {0, 0, 1, -1};
int bfs(int r, ... | ALGO | 0.999287 | 4.537902 |
ab2524ba-7075-483e-83c1-817c3ef7aaa4 | doyamd/competitive-programming | Remove Nth Node from End.cpp | /*
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Example 2:
Input: head = [1], n = 1
Output: []
Example 3:
Input: head = [1,2], n = 1
Output: [1]
Constraints:
The number of nodes in the list is sz.
1 <= sz <= 3... | ALGO | 0.999953 | 6.284542 |
a97e4bac-caff-4179-8ed4-b7530d79366a | swarali1105/LPV | dfs2.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <omp.h>
#include <random>
#include <iomanip>
using namespace std;
class Graph {
int V;
vector<vector<int>> adj;
public:
Graph(int vertices) : V(vertices) {
adj.resize(V);
}
void addEdge(int u, int v) {
adj[u].pus... | ALGO | 0.999804 | 6.792372 |
ecbf55aa-0e4b-482e-aa2e-c3b97927dd1e | VC6378/Codeforces | B_Playing_with_GCD.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll lcm(ll a, ll b)
{
ll g = __gcd(a, b);
return (a * b / g);
}
void solve()
{
ll n;
cin >> n;
vector<ll> a(n + 2, 1);
for (ll i = 1; i <= n; i++)
{
cin >> a[i];
}
vector<ll> b(n + 2, 1);
for (ll i = 1; i <... | ALGO | 0.999851 | 4.094728 |
8165a2d4-9e17-4c4d-9c56-52898089a812 | Aimee888/C-C-directory | Fibonacci_study/Fibonacci_study/Fibonacci_study.cpp | // Fibonacci_study.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include "method.h"
using namespace std;
bool isZero(int x);
bool isZero(double x);
bool isZero(char x);
void isZero_start();
typedef bool(*FUN_PTR) (int a, int b);
//boo... | ALGO | 0.999605 | 4.583246 |
c313a62d-74cd-4f2c-8b04-edd99e2b7c62 | tatsukawa/contest | srm/588/GameInDarknessDiv2.cpp | #include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <cstring>
using namespace std;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
struct Point {
int x, y;
Point(int y = 0, int x = 0) : x(x), y(y) {}
};
Point operator+(Point a, Point... | ALGO | 0.999688 | 4.689232 |
cbf37d9d-e75a-4b3b-b8db-6de499359d3e | raincross7/code-similarity | codes/train_code/problem304/problem304_102.cpp | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#de... | ALGO | 0.999953 | 4.145449 |
58a71ea6-6e3d-49fa-a0fa-78b8754f07ec | KhoiBui16/28Tech_Code_Online | Data structure algorithm/Source Code DSA Contest/SapXepTimKiem/B30_DenLong.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = 1e9;
int main()
{
ll n , l ; cin >> n >> l;
ll a[n] ; for(ll &x : a) cin >> x;
sort(a , a + n);
ld res = max(a[0] , l - a[n - 1]);
for(int i = 1 ; i < n ; i ++)
{
... | ALGO | 0.99964 | 3.146145 |
b43eb454-d255-4ea1-a3c0-566e7d97c19b | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc077/A/2935908.cpp | #include <iostream>
using namespace std;
int main()
{
char c[2][3] = {};
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
cin >> c[i][j];
}
}
cout << (c[0][0] == c[1][2] && c[0][1] == c[1][1] && c[0][2] == c[1][0] ? "YES" : "NO") << endl;
return 0;
} | ALGO | 0.999968 | 3.536455 |
5c0f660c-34fc-4bce-9797-b4f728bc3b66 | SifatAli008/C_Plus_Plus_and_DSA1 | Recursion Related Problem Set/Tarak/P2.cpp | //Calculate the sum of numbers from 1 to n.
// Created by Sifat Ali on 1/8/2024.
//
#include <iostream>
using namespace std;
int PrintN(int n){
if(n==0){
return 0;
} else{
return n+=PrintN(n-1);
}
}
int main(){
int n;
cout<<"Enter a value : ";
cin>>n;
cout<<"Total : "<<Pri... | ALGO | 0.999295 | 4.976818 |
2cb5c3d7-79d3-42ef-bc40-37b09f95dda3 | ishandutta2007/codeforces | bohun/normal/1621/D.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, b, a) for (int i = b; i >= a; i--)
#define cat(x) cerr << #x << " = " << x << "\n";
using ll = long long;
using namespace std;
const int N = 600;
int n, a[N][N];
void solve() {
cin >> n;
rep(i, 1, 2 * n)
rep(j, 1, 2 * n)
... | ALGO | 0.999912 | 3.887261 |
38006ca5-3d67-4ae7-8056-9bc4c0c2c062 | hieu-ln/IT02-03 | BaiTapCaNhan_CaoNguyenThuy/CodeC2_CaoNguyenThuy/C2_bai7.cpp | //chuong 2 bai 7
#include <iostream>
#include <conio.h>
using namespace std;
int const MAXSIZE = 100;
int front;
int rear;
void init(int a[], int &front, int &rear)
{
front = -1;
rear = -1;
}
bool isFull(int a[], int rear)
{
if(rear == MAXSIZE - 1)
return true;
return false;
}
bool isEmpty(int a[], int front, in... | ALGO | 0.987437 | 3.420351 |
4a55fb20-171c-4d25-8edc-5b6d07ebe53f | AyeshathHafeeza/AEC | 8th prog.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, y, s, t;
cin >> x >> y >> s >> t;
int p, d;
// p is horizontal distance, d is the max distance horizontally or vertically
p = t -(y - 1);
if(s + 1 < p) {
d = s + 1;
}
else {
d = p;
}
int count = 0;
for(int i = y; i<=y + d - 1; i++) {
... | ALGO | 0.999234 | 3.418029 |
130959cb-71a6-42fd-9bda-903adbc7751e | Lawrenceh/AC_Monster | Google/OJ - leetcode/698. Partition to K Equal Sum Subsets.cpp | /* recursion dfs (optimization needed to avoid TLE) */
/* 1st version (TLE): using a[] to keep track of numbers, duplicate failure search because no difference among 1st~kth bucket */
class Solution {
public:
bool check(int a[], int k, int target) {
for (int i = 0; i < k; i ++) {
if (a[i] != ta... | ALGO | 0.999998 | 5.713711 |
fb5f17fc-df84-40ab-9354-9b2c42ebada0 | LineVall/linevall_system_extras | simpleperf/event_type.cpp | #include "event_type.h"
#include <inttypes.h>
#include <unistd.h>
#include <algorithm>
#include <string>
#include <vector>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include "ETMRecorder... | TOOL | 0.869602 | 6.259065 |
e489a695-0f8d-4860-9349-2fde4c3c0303 | ishandutta2007/codeforces | orzdevinwang/normal/802/N.cpp | #include<bits/stdc++.h>
#define L(i, j, k) for(int i = j, i##E = k; i <= i##E; i++)
#define R(i, j, k) for(int i = j, i##E = k; i >= i##E; i--)
#define ll long long
#define db double
#define pii pair<int, int>
#define mkp make_pair
#define db double
using namespace std;
const int N = 1e6 + 7;
int n, m, cnt;
ll sum, a[N... | ALGO | 0.999988 | 3.576605 |
6feb759a-3e5a-402b-94ac-f19e2d737942 | awa-Orz-Ljy/LJYCODE-VSCODE | 算法模板分类总结/-StarryCoding/7并查集、最短路/64图的遍历dsf(1).cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
vector<int> g[N];//邻接表
set<pair<int, int> > st;//存放的是一对,线段,细节空格避开>>歧义
bitset<N> vis;//bool数组记录搜索过的边
//输出从1出发能够到达的所有点
/*
void dfs(int x)
{
cout<< x <<' ';
if(g[x].size()){
for(auto &i:g[x]){
dfs(i);
}
}
}
*/
//这里不需要输出出点... | ALGO | 0.999994 | 3.99968 |
9add66c8-b358-4941-b194-27af2390f922 | raynorpat/cake3 | code/libs/bullet/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp | //#include <stdio.h>
#include "BulletCollision/CollisionShapes/btConvexShape.h"
#include "BulletCollision/CollisionShapes/btTriangleShape.h"
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h"
#include "BulletCollision/NarrowPhaseCo... | ALGO | 0.982544 | 5.729293 |
b7e0a8a4-6250-4669-89ec-12ccc911c87d | RabbyXQ/RupshaOCR | tesseract4android/src/main/cpp/tesseract/src/src/ccmain/osdetect.cpp | #include <tesseract/osdetect.h>
#include "blobbox.h"
#include "blread.h"
#include "colfind.h"
#include "fontinfo.h"
#include "imagefind.h"
#include "linefind.h"
#include "oldlist.h"
#include "qrsequence.h"
#include "ratngs.h"
#include "tabvector.h"
#include "tesseractclass.h"
#include "textord.h"
#include <algorithm>... | ALGO | 0.918538 | 5.365857 |
f9fd375b-5509-4386-8bed-64f0a93a5708 | Host-Vedas/DSA-WITH-C-PLUS-PLUS | Phase 1/L9 Array/1_MaxMinInBuiltFn.cpp | #include <iostream>
using namespace std;
// for max value
int getMax(int num[], int n)
{
int maximum = INT_MIN;
for (int i = 0; i < n; i++)
{
maximum = max(maximum,num[i]);
}
return maximum;
}
// for minimum value
int getMin(int num[], int n)
{
int mini = INT_MAX;
for (int i = 0; i < ... | ALGO | 0.999707 | 4.302801 |
a7433012-d837-41d4-9bb9-4a746322d722 | ishandutta2007/codeforces | grt_2018/normal/1132/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define ST first
#define ND second
const int INF = 1000*1000*1000;
const int MAXN = 1000*1000+10;
int n,k,id=1,R,log2n;
pair<int,int>o_o[MAXN];
vector<int>V[MAXN];
int a[MAXN];
stack<pair<int,int> >S;
struct Node {
int g,f;
};
Node T[(1<<21)];
void propagate(int x) {... | ALGO | 0.999988 | 3.415593 |
0f93e6c9-6ed3-4acb-a043-c898f4cc3e28 | swatii2002/100daysOfcode | day63.cpp | class Solution {
public:
int maximumUnits(vector<vector<int>>& boxTypes, int truckSize) {
for(int i=0;i<boxTypes.size();i++){
swap(boxTypes[i][0],boxTypes[i][1]);
}
sort(boxTypes.begin(),boxTypes.end());
int ans=0;
for(int i=boxTypes.size()-1;i>=0;i--){
... | ALGO | 0.999904 | 6.560959 |
0a7d0d3a-eda4-4d06-a9b1-07dd2c6b0ffe | nakib1948/Competitive-programming | A_Prison_Break.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,n) for(i=0;i<n;i++)
#define debug cout<<"debug"<<endl;
#define heyyoo ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int main()
{
///"Bismillahir Ra... | ALGO | 0.999834 | 4.440486 |
79f1c2fe-e118-4fbb-86f7-16cc51017b71 | harsh3055/CPP-questions | DP/fractional_knapsack.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n,va;
cin>>n>>va;
vector<int>val,weight;
for(int i = 0; i<n; i++){
int a; cin>>a;
val.push_back(a);
}
for(int i = 0; i<n; i++){
int a; cin>>a;
weight.push_back(a);
}
for(int i = 0; i<n; i++){
val[i]=val[i]/weight[i];
}
int... | ALGO | 0.999992 | 3.470209 |
650fa4a2-8178-413c-a033-d9e70504c968 | felipesdias/Extractor-URI-Online-Judge | URI-ES/PRINCIPIANTE/2551 - New Record.cpp | // Autor: Felipe Souza Dias <<EMAIL>>
// Nome: New Record
// Nível: %d
// Categoria: PRINCIPIANTE
// URL: https://www.urionlinejudge.com.br/judge/es/problems/view/2551
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
double a, b, recorde;
while(scanf("%d", &n) > 0)
{
recor... | ALGO | 0.999331 | 3.880642 |
26aabf92-0e37-45c8-88f2-484609ba0863 | kacper-ziemecki/Competitive-Programming | Codeforces Problems/1343A.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define ull unsigned long long
#define ld long double
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#define dbg(...) cout << "(" << #__VA... | ALGO | 0.999882 | 4.525901 |
a37ff69f-ba3b-4c3b-8588-eea564a34952 | QIDITECH/QIDIStudio | src/libigl/igl/copyleft/cork/mesh_boolean.cpp | template <
typename DerivedVA,
typename DerivedFA,
typename DerivedVB,
typename DerivedFB,
typename DerivedVC,
typename DerivedFC>
IGL_INLINE void igl::copyleft::cork::mesh_boolean(
const Eigen::PlainObjectBase<DerivedVA > & VA,
const Eigen::PlainObjectBase<DerivedFA > & FA,
const Eigen::PlainObjectBa... | ALGO | 0.950187 | 6.907867 |
a405eb3c-791f-48ad-86cb-b8c98d7eec58 | xyuan/VegaFEM_lib | src/integrator/centralDifferencesSparse.cpp | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include "performanceCounter/performanceCounter.h"
#include "insertRows/insertRows.h"
#include "integrator/centralDifferencesSparse.h"
CentralDifferencesSparse::CentralDifferencesSparse(int numDOFs, double timestep, SparseM... | ALGO | 0.999015 | 4.746906 |
9b058ce5-cd24-4c82-9141-9f6339190b5f | MuhammedAshrafSaleh/certification-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 |
afe67a7a-f52c-4875-b570-10e86f926150 | syys96/AlphaGomoku | src/Eigen/bench/eig33.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Matrix, typename Roots>
inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
con... | ALGO | 0.999658 | 5.613888 |
53b94ac7-a3f1-4a35-88ba-b7bb92a1e59f | varun-thota27/Leetcoding | 3335-total-characters-in-string-after-transformations-i/3335-total-characters-in-string-after-transformations-i.cpp | class Solution {
public:
int lengthAfterTransformations(string s, int t) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
const int MOD = 1e9 + 7;
vector<long long> dp(26, 0);
for(char x:s)
dp[x-'a']++;
while(t--)
{
vector<long lon... | ALGO | 0.999988 | 6.038162 |
e6726164-ae0d-453f-a7fc-12e67590d072 | sahilwep/DSA-Workspace | Leetcode/Medium/1091_Shortest_Path_in_Binary_Matrix.cpp | /*
// 1091. Shortest Path in Binary Matrix
// Problem Statement:
-> Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1.
-> A clear path in a binary matrix is a path from the top-left cell (i.e., (0, 0)) to the bottom-right cel... | ALGO | 0.999987 | 6.550924 |
c5cd2be1-0c98-49d9-ac1c-1241610fdf40 | ishandutta2007/codeforces | wxhtzdy/normal/609/F.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
... | ALGO | 0.999832 | 4.276068 |
fbe67228-d429-454b-a86b-00d7bd4b3d4e | sujal16/DSA-leetcode | Search in a Binary Search Tree_700.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.999992 | 5.509839 |
67c7b414-2bbe-4ca4-b19d-a133daeb8d19 | Haoxiang310/CSCI550_mongo | src/mongo/db/s/dist_lock_manager_replset.cpp | #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kSharding
#include "mongo/platform/basic.h"
#include "mongo/db/s/dist_lock_manager_replset.h"
#include "mongo/db/repl/replica_set_aware_service.h"
#include "mongo/db/s/type_lockpings.h"
#include "mongo/db/s/type_locks.h"
#include "mongo/logv2/log.h"... | TOOL | 0.878509 | 5.160456 |
36fea358-5a28-4679-b5bf-158ec846e800 | AbdulMalek-swe/problem_solving_club | weak-13/day-2/index.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n, q;
cin >> n >> q;
vector<int> a(n), prefix(n + 1);
for (int i = 0;i < n;i++) {
cin >> a[i];
}
sort(a.rbegin(), a.r... | ALGO | 0.999936 | 3.969234 |
f3eeb58c-c50e-473f-958e-fa02273bfa20 | archishmanghos/DSA-Functions | Sorting-For-Interviews/Heap-Sort/code.cpp | #include <bits/stdc++.h>
using namespace std;
class HeapSort {
public:
void heapSort(vector<int> &A, int N) {
buildMaxHeap(A, N);
for (int i = N - 1; i >= 0; i--) {
swap(A[0], A[i]);
N -= 1;
heapify(0, A, N);
}
}
private:
void buildMaxHeap(vector<int> &A, int N) {
for (int i = (N / 2) - 1; i >= 0;... | ALGO | 0.99989 | 5.033432 |
fb99598f-2f59-417b-84b2-c364610ab884 | ayush-yadav-4/leetcode-solutions | 0679-24-game/0679-24-game.cpp | class Solution {
public:
bool judgePoint24(vector<int>& cards) {
vector<double> nums(cards.begin(), cards.end());
return solve(nums);
}
bool solve(vector<double>& nums) {
if (nums.size() == 1) {
return abs(nums[0] - 24.0) < 1e-6;
}
// Try every pair of n... | ALGO | 0.998304 | 6.047935 |
ea883219-4277-40ba-a492-57f1a27ad492 | ctosp/frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_framedecoder.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_framedecoder.cpp
Functions:
pvmp3_framedecoder
pvmp3_InitDecoder
pvmp3_resetDecoder
Date: 09/21/2007
--------------------------------------------------... | ALGO | 0.915777 | 6.103362 |
40adadfb-b7fb-434a-8cad-a71328a7a7a8 | sinian666/codes_102_3 | 1cpp_副本3/chapter_searching/two_sum.cpp | /**
* File: two_sum.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 方法一:暴力枚举 */
vector<int> twoSumBruteForce(vector<int> &nums, int target) {
int size = nums.size();
// 两层循环,时间复杂度 O(n^2)
for (int i = 0; i < size - 1; i++) {
for (int j = i + 1; j ... | ALGO | 0.999877 | 6.093446 |
00f1e0d0-f1c7-4697-88b3-8f8dabbaae60 | kmjp/procon | leetcode/biweekly/001-040/012/1246.cpp | typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) me... | ALGO | 0.999973 | 4.766404 |
c9cc8263-eb5f-4642-89f4-f8e3c824af00 | gfg-course/dsa-hyd-2 | class-2/countDigitsIn1ToN.cpp | #include<bits/stdc++.h>
using namespace std;
// TC: O(log(n))
int countDigits1ToN(int n) {
int result = 0;
// j = 10^(i - 1)
for (int j = 1; j - 1 < n; j*=10) {
result += (n - (j - 1));
}
return result;
}
int main() {
cout << countDigits1ToN(10) << endl;
cout << countDigits1... | ALGO | 0.999364 | 5.330335 |
08f599d9-6083-4b7c-b669-230fc1a49388 | Naslanas/blog_app_frondend | 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 |
e40f1ff9-3d80-4693-8249-92e7309d575d | alexandraback/datacollection | solutions_5688567749672960_0/C++/Yak/a.cpp | // Cygwin clang++ 3.4.2 with -std=c++1y
#include <iostream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <utility>
#include <limits>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <un... | ALGO | 0.999551 | 4.587547 |
65fbe093-3645-4c03-9715-bcec06321e0e | LEEYOONJONG/Algorithm_mac | pattern/bruteforce/15661_링크와스타트.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int board[21][21];
int n;
vector<int> teamA;
vector<int> teamB;
int minimum = 9876543210;
void dfs(int person, int cnt){
if (cnt==n){
if (teamA.size()==0 || teamB.size()==0) return;
// teamA
in... | ALGO | 0.999953 | 4.124126 |
a480999d-9c16-4b5e-aaf1-43eb0d9d09ba | corgi1118/test | 0417/0417/0417.cpp | // 0417.cpp : 此檔案包含 'main' 函式。程式會於該處開始執行及結束執行。
//
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "請輸入一個月份";
cin >> n;
switch (n) {
case 3:
case 4:
case 5:
cout << "春天" << endl;
break;
case 6:
case 7:
case 8:
cout << "夏天" << endl;
... | TOOL | 0.992182 | 4.896329 |
efa16080-1da2-470c-a27e-365d6337f123 | khusanbek/DSA_CAU24 | week 7/Tree.cpp | #include<iostream>
using namespace std;
//structure to define a node in the binary tree
struct TreeNode {
int value;
struct TreeNode* left;
struct TreeNode* right;
//constructor to initialize the node with a value
TreeNode(int val) {
value = val;
left = NULL;
right = NU... | ALGO | 0.999989 | 6.531809 |
0c9da64a-3f25-4ea7-b8b2-6722c0acc801 | GopiPallapu/MYLEETCODESOLUTIONS | 54-spiral-matrix/spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
int m = matrix.size();
int n =matrix[0].size();
int left =0;
int right = n-1;
int top = 0;
int bottom = m-1;
vector<int> ans;
while(left <= right && top <=bottom){
... | ALGO | 0.999998 | 6.210857 |
f880f0f5-df68-47fc-b389-22ceee1196c8 | HongLabInc/HongLabAlgorithmsPart2 | Ex1910_KMP/Ex1910_KMP.cpp | #include <vector>
#include <iostream>
#include <string>
using namespace std;
vector<int> ComputePrefixFunction(string pat)
{
int M = int(pat.size());
vector<int> lps(pat.size()); // lps: longest proper prefix and suffix (가장 긴 진접두사 이자 진접미사)
lps[0] = 0; // 길이가 0인 문자열의 LPS는 0
int k = 0; // LPS는 0에서 시작
for (int i... | ALGO | 0.999771 | 5.606544 |
0d3778d6-cbc1-4cea-be74-6493ed36887c | Blueshifty/Algoritma-Analizi-Ornek-Kodlar | Final Exam/map/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <map>
using namespace std;
/*Kelime Class'im, Hem Kelimeyi Hemde Bulundugu Satiri Barindiriyor*/
class kelime{
public:
string kelime;
int satir;
int getSatir();
string getKelime();
};
int kelime:: getSatir(){
return this->satir;
}
string kelime:... | TOOL | 0.975504 | 4.200589 |
845ca160-ffd0-4b8c-93aa-9a106ee18f08 | fepaf/Competitive-Programming | Resoluções OJ/Neps Academy/2161.cpp | #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#define INF 0x3f3f3f3f
#define MAX (1<<20)
#define OUT MAX
#define MOD 1000000007
#define i64 long long
#define all(x) (x).begin() , (x).end()
#define sz(x) (int)(x).size()
#define ii pair<int, int>
... | ALGO | 0.999818 | 3.798836 |
cad94533-86bd-4008-a3db-b13579a478d9 | raincross7/code-similarity | codes/train_code/problem315/problem315_476.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
string s,g;
cin>>s>>g;
int fi=s.find(g[0]);
string k=s.substr(fi,s.size())+s.substr(0,fi);
cout<<((g... | ALGO | 0.999986 | 3.531349 |
6c6ce2d7-7feb-43a7-8c63-ec5dd9af9c94 | shubhansu-kr/CSE205-Data-Structure-and-Algorithms | 02_LinkedList/05_CircularLinkedList.cpp | // Circular LinkedList
#include <bits/stdc++.h>
using namespace std ;
struct ListNode
{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int val) : val(val), next(nullptr) {}
ListNode(int val, ListNode *next) : val(val), next(next) {}
};
ListNode * createCLL () {
int n;... | ALGO | 0.999685 | 5.297462 |
f3d8baa0-277c-4a15-87bc-51efb4af89be | joat28/DSA-problems | Graphs/shortestPathUnweighted.cpp | #include <bits/stdc++.h>
using namespace std;
void Bfs(vector<int> adj[], int node, bool *visited, int *dist)
{
queue<int> q;
q.push(node);
dist[node] = 0;
visited[node] = true;
while (!q.empty())
{
int front = q.front();
q.pop();
// cout << front << " ";
for (in... | ALGO | 0.99994 | 4.732167 |
4cbd0b7a-c525-4035-a5a8-7d0b95d48621 | hpc-ulisboa/NDPmulator | src/systemc/tests/systemc/misc/v1.0/dash4/speed.cpp | /*****************************************************************************
speed.cpp -- Definition of the speedometer.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*************************************************************... | ALGO | 0.897585 | 6.056402 |
3c1a6f47-d92c-45f0-8dbf-476f749a379c | Kabita0403/C-CPP-Training-Assignments | function3.cpp |
#include<iostream>
using namespace std;
template <class T, class U>
bool arr_equal(T a, U b)
{
return(a==b);
}
int main(){
if(arr_equal(10,10.0))
cout<<" X and Y are equal \n";
else
cout<<" X and Y are not equal \n";
} | ALGO | 0.995543 | 3.288604 |
dc9884d5-e713-45b9-bb1f-39508ed88c48 | MayankSaxena2214/LEETHUBV3 | 0011-container-with-most-water/0011-container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int n=height.size();
int s=0,e=n-1;
int ans=INT_MIN;
while(s<e){
int sh=height[s];
int eh=height[e];
int h=min(sh,eh);
int l=e-s;
ans=max(ans,l*h);
if(s... | ALGO | 0.999985 | 6.770257 |
05e02bbd-75e2-4152-913c-a1c268b2b33b | JakinChan200/Practice | LeetCode/Medium/128-LongestConsecutiveSequence.cpp | //128
//Given an unsorted array of integers, return the length of the longest consecutive elements
#include <bits/stdc++.h>
using namespace std;
// int longestConsecutive(vector<int> &nums){
// if(nums.size() <= 1){
// return nums.size();
// }
// set<int> numSet;
// for(int i = 0; i < nums.... | ALGO | 0.999851 | 4.983853 |
7a08b0e6-2994-4d73-a17c-09e0c483db28 | sarvinshrivastava/Cpp.Leetcode | P-779.cpp | class Solution {
public:
int kthGrammar(int n, int k) {
int j = pow(2, n - 1) - 1, i = 0;
int cur = 0;
while (i != j) {
int m = i + (j - i) / 2;
if (m >= k - 1)
j = m;
else {
cur = 1 - cur;
i = m + 1;
... | ALGO | 0.999993 | 6.250833 |
91743a73-50ff-4882-b8b1-fa1517a08aad | Saboti/Core3 | MMOCoreORB/src/terrain/layer/filters/FilterFractal.cpp | /*
* FilterFractal.cpp
*
* Created on: 21/12/2010
* Author: victor
*/
#include "FilterFractal.h"
#include "../../TerrainGenerator.h"
float FilterFractal::process(float x, float y, float transformValue, float& baseValue, TerrainGenerator* terrainGenerator, FilterRectangle* rect) {
if (mfrc == nullptr) {
... | TOOL | 0.90611 | 4.66439 |
0e97d965-7646-4c8f-b938-36c95df4ddfd | topurayhan007/Cplusplus | Hacker Rank/CamelCase.cpp | #include <bits/stdc++.h>
using namespace std;
// Complete the camelcase function below.
int camelcase(string s) {
int count = 0;
for (int i =0; i<s.length(); i++) {
if(int(s[i]) >= 65 && int(s[i]) <= 90){
++count;
}
}
return count+1;
}
int main()
{
ofstream fout(getenv... | ALGO | 0.999531 | 5.089004 |
a22de054-739e-4e79-a29f-c814ac7b17ea | haoping0901/LeetCode-Practice-Records | 1679-max-number-of-k-sum-pairs/1679-max-number-of-k-sum-pairs.cpp | class Solution {
public:
int maxOperations(vector<int>& nums, int k) {
unordered_map <int, int> rec;
int cnt=0;
for (const int& num: nums) {
if (rec.count(k-num) == 0) {
if (rec.count(num) == 0) {
rec[num] = 1;
} else {
... | ALGO | 0.999933 | 6.364289 |
232c158d-c96f-48a5-a3af-2c16d30f1687 | Andwerpz/Competitive-Programming-Practice | - cpp -/hamburgers.cpp |
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll nb, ns, nc, pb, ps, pc, r, b, s, c;
bool isValid(ll amt){
ll rb = b * amt;
ll rs = s * amt;
ll rc = c * amt;
rb -= nb;
rs -= ns;
... | ALGO | 0.998472 | 3.83505 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.