uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6fb6f227-3c1a-4df3-98c7-a54e07f5909f | kitewu/datastructure_algorithm | UVA/算法竞赛入门经典(第二版) 源码/ch10/UVa1641.cpp | // UVa1641/LA5910 ASCII Area
// Rujia Liu
#include<cstdio>
int main() {
int h, w;
char s[999];
while(scanf("%d%d", &h, &w) == 2) {
int ans = 0, c = 0;
while(h--) {
scanf("%s", s);
int in = 0;
for(int i = 0; i < w; i++) {
if(s[i] == '/' || s[i] == '\\') { c++; in = !in; }
... | ALGO | 0.971437 | 3.293336 |
82093bb0-19a5-42a3-ba4b-328b4d227b00 | AlessandroScrem/Esercizi-cpp | C++17_STL_Cookbook/Es-ch-02. STL Containers/vector_erase_remove.cpp | /******************************************************************************
Using the erase-remove idiom on std::vector
*******************************************************************************/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> ... | ALGO | 0.987767 | 6.87074 |
7ef8de17-88f4-44f6-b805-8a6ef8ada5f1 | quakeN/CPP_School | School/Test_18.12.2017/03.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int day, month, year;
cin >> day;
cin >> month;
cin >> year;
switch(month)
{
case 1:
if(day > 31)
cout << "Invalid day" << endl;
else if (day < 31)
cout << day + 1 << "." << month << "." << year << endl;
else
cout... | TOOL | 0.998587 | 3.603108 |
240453b3-a5c8-4d29-a3bb-19738556a3a5 | hakomori64/atcoder | abc/095a.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
string s;
cin >> s;
cout << 700 + 100 * count(s.begin(), s.end(), 'o') << endl;
return 0;
}
| ALGO | 0.994898 | 3.536121 |
ca8b5df4-7862-4b02-b396-628224a8df0f | Sandigupta/AlgoZeneth_Premium- | Binary Search Applications 1/Painter_Panting_probleam.cpp | #include<bits/stdc++.h>
using namespace std;
int arr[100100];
int n, k;
int check(int mid){
int lastLeft = 0;
int needed = 0;
for (int i = 0; i < n; i++)
{
if(lastLeft>=arr[i]){
lastLeft -= arr[i];
}else{
needed++;
lastLeft = mid - arr[i];
}
... | ALGO | 0.999988 | 4.143074 |
2d0334e2-d8db-40b1-a250-da5d6ec04b9c | Nothing-avil/GFG_sol | Count_all_Possible_Path.cpp | class Solution {
public:
int isPossible(vector<vector<int>>paths){
for(int i=0;i<paths.size();i++)
{
int cnt=0;
for(int j=0;j<paths[0].size();j++)
cnt+=paths[i][j];
if(cnt&1)
return 0;
}
return 1;
}
};
| ALGO | 0.999612 | 5.470284 |
c1cda533-ed5b-4fdd-a0f3-b93488abb264 | ml1150258/CSC_CIS_5 | Lab/Work022224/DOD_NASA_Spending/main.cpp | /*
* File: main.cpp
* Author: Dr. Mark E. Lehr
* Created on Feb 22nd, 2024, 12:00 PM
* Purpose: Budget Percentages
*/
//System Libraries
#include <iostream> //Input-Ouput Library
using namespace std;
//User Libraries
//Global Constants - Math,Physics,Chemistry,Conversions
const float BILLION=1e9f;//1x10^9 ... | ALGO | 0.953439 | 3.868968 |
cdc6f7d2-2dbd-4ae5-8b93-ba519b01aba0 | 93Hong/Algorithms | 13301_Tile/Main.cpp | #include <cstdio>
#pragma warning(disable: 4996)
using namespace std;
long long int fibo[81];
int main() {
int N;
scanf("%d", &N);
fibo[0] = 1;
fibo[1] = 1;
for (int i = 2; i < N + 1; i++) {
fibo[i] = fibo[i - 1] + fibo[i - 2];
}
printf("%lld\n", fibo[N - 1] * 2 + fibo[N] * 2);
} | ALGO | 0.999895 | 3.624691 |
16ab40c2-1825-4009-a696-2266ec6baf09 | alexandraback/datacollection | solutions_6404600001200128_0/C++/fulvioabrahao/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t,ca = 1;
cin>>t;
while(t--){
printf("Case #%d: ",ca++);
int n;
cin>>n;
long long r1 = 0, r2 = 0;
long long v[n];
for(int i = 0;i<n;i++)
cin>>v[i];
long long maior = 0;
for(int i = 1;i<n;i++){
if(v[i]<v[i-1])
r1+=(v[i-1]-v[i])... | ALGO | 0.999125 | 3.452984 |
13cabd50-bf13-4815-8cdc-7eca12f858b8 | tomalbrc/ProceduralTerrainGeneration | Extern/bullet3/src/BulletSoftBody/btDefaultSoftBodySolver.cpp | #include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "btDefaultSoftBodySolver.h"
#include "BulletCollision/CollisionShapes/btCapsuleShape.h"
#include "BulletSoftBod... | ALGO | 0.900564 | 7.654786 |
4e754563-af32-4e6a-a93f-762b1d402383 | Lee-Duck-03/template_cp | codetumlumtala/back_ChinhHopKLap.cpp | #include <bits/stdc++.h>
#define MOD 1000000007
#define base 31
#define Pi 3.141592654
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 100006;
typedef map<int, int> mii;
typedef vector<int> vti;
int n, k, cnt = 1;
int ans[N];
void out(){
cout << cnt++ <<": ";
for(int i = 1;... | ALGO | 0.99997 | 3.307679 |
5afd5523-d258-4629-b955-005613b27878 | mr-umardev/Data-Structures-and-Algorithms | 0058-length-of-last-word/0058-length-of-last-word.cpp | class Solution {
public:
int lengthOfLastWord(string s) {
/**if(s.size()==NULL){
return 0;
}
istringstream stream(s);
while(stream>>s){
s.length();
}
return s.length();**/
if(s.size()==NULL){
return 0;
}
istrings... | ALGO | 0.994244 | 5.189983 |
a0152df5-d5d3-46d4-82ca-f423daa9ce31 | soolabettu/cp | code_forces/742_2/a.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<p... | ALGO | 0.999985 | 5.249775 |
5b12e738-392d-4b41-a3d7-7653cb8aa057 | omey-bhosale/sem7 | DAA/4_0-1_Knapsack.cpp | #include<iostream>
using namespace std;
int main(){
int capacity = 10;
int items = 4;
int price[items + 1] = {0, 3, 7, 2, 9};
int wt[items + 1] = {0, 2, 2, 4, 5};
int dp[items + 1][capacity + 1];
for(int i = 0; i <= items; i++){
for(int j = 0; j <= capacity; j++){
if(i... | ALGO | 0.999925 | 5.101155 |
c77c85f3-c6a4-48c2-aaa4-8a24b0ce68dc | ishandutta2007/codeforces | sohsoh/normal/1329/B.cpp | /*
Soheil Mohammadkhani
I found some quote instead of idk, so i will put that on my code template ;)
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define all(x) (x).begin(),(x).e... | ALGO | 0.999978 | 5.188206 |
4bafdca2-ffbe-4ac3-bbf4-d10c6f9eac70 | Erthraus/Cankaya-CENG | CENG241 Labs/Lab2/lab2q2.cpp | #include <iostream>
#include <string>
using namespace std;
int main(void)
{
string line, sub;
size_t pos;
cout << "Enter a string: ";
getline(cin, line);
cout << "Enter substring you want to search: ";
cin >> sub;
if((pos = line.find(sub)) != string::npos)
cout << "The substring [" + sub + "] is presen... | TOOL | 0.979525 | 5.027881 |
adbee132-c8aa-486d-9749-9652cc41bf5b | ravabhoir6/testing-phase | A_Hexadecimal_s_theorem.cpp | /*
*/
#include<iostream>
#include<vector>
#include<map>
#include<list>
#include<set>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<cmath>
#include<string>
#include<unordered_set>
#include<unordered_map>
#include<cstdlib>
using namespace std;
typedef unsigned long long int64;
#define N... | ALGO | 0.999956 | 3.237451 |
aa4ad0e2-8a6a-4474-9b44-a1ef76fc0de4 | ampl/coin | Cbc/Cgl/src/CglOddHole/CglOddHole.cpp | #include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cfloat>
#include <iostream>
#include "CoinPragma.hpp"
#include "CoinHelperFunctions.hpp"
#include "CoinPackedVector.hpp"
#include "CoinPackedMatrix.hpp"
#include "OsiRowCutDebugger.hpp"
#include "CglOddHole.hpp"
//#define CGL_DEBUG
// We may want to sort ... | ALGO | 0.998905 | 3.119387 |
a8d3bf67-e610-4fae-918b-9903efe5ec70 | Udbhav-Dubey/udcpp | ll9.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *next=nullptr;
Node(int data){
this->data=data;
this->next=nullptr;
}
};
void printy(Node *head){
Node *curr=head;
while(curr!=NULL){
cout << " " << curr->data;
curr=curr->next;
}
co... | ALGO | 0.999552 | 3.945638 |
16c1c3ee-c187-4fa7-93f5-550fc992c8b1 | marianagpp/cpp | S5 - sacar digitos.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
cin >> n;
while (n>0){
cout << n%10 << "\n";
n/=10;
}
return 0;
}
//sacar digitos
| ALGO | 0.999403 | 4.343487 |
8e086b73-0693-4c7e-90f4-2e0eb1288a6c | piyush4for/coding_ninja_DSA | LinkedList/ithNode.cpp | #include <iostream>
using namespace std;
#include "Node.cpp"
Node* takeinput(){
int data;
cin>>data;
Node *head=NULL;
Node *tail=NULL;
while(data!=-1){
Node *newNode = new Node(data);
if(head ==NULL){
head=newNode;
tail=newNode;
}
else {
tail->next=newNode;
tail=tail->next;
}
cin >>data;
... | ALGO | 0.999749 | 3.842837 |
067077e1-6a54-4174-accb-6d3ea3d3378a | Li-Li-Whu/Coarse2FineRoofPlane | include/igl/svd3x3_avx.cpp | #include <cmath>
#include <algorithm>
#undef USE_SCALAR_IMPLEMENTATION
#undef USE_SSE_IMPLEMENTATION
#define USE_AVX_IMPLEMENTATION
#define COMPUTE_U_AS_MATRIX
#define COMPUTE_V_AS_MATRIX
#include "Singular_Value_Decomposition_Preamble.hpp"
#pragma runtime_checks( "u", off ) // disable runtime asserts on xor eax,eax... | ALGO | 0.999179 | 6.630946 |
42414663-8912-4c84-93e6-102e5bb88d91 | ishandutta2007/codeforces | dhxh/normal/1073/E.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
long long n, m, t;
long long f[25][(1<<10)][11];
long long g[25][(1<<10)][11];
long long mod = 998244353;
long long ten[25];
int read(){
int x;
scanf("%d", &x);... | ALGO | 0.999835 | 4.870667 |
b86065c3-fd5d-4ae2-89fc-419ea20d1771 | Lophophora24/Quench_2.0 | thirdparty/boost_1_82_0/libs/bimap/example/tagged_simple_bimap.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | ALGO | 0.951184 | 5.955026 |
7b8771a5-6786-4974-a5c2-b8cea092618a | Edegare/3DEngine-CG | src/shared/src/fileUtils.cpp | #include "../include/fileUtils.hpp"
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#define DIR "../src/models/"
void saveToFile(const std::vector<Point>& points, const std::string& filepath) {
std::string fullPath = DIR + filepath;
std::cout << "Tentando salvar o... | TOOL | 0.902142 | 4.984199 |
7b27af2a-da8e-4895-90c3-1492bd7a3fb1 | apple/llvm-project-v5 | llvm/lib/Transforms/IPO/PartialInlining.cpp | #include "llvm/Transforms/IPO/PartialInlining.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#includ... | ALGO | 0.997757 | 7.951553 |
36c102f9-cd00-4764-b800-55c4df76cc9f | shuest/leetcode | 316.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<unordered_map>
using namespace std;
class Solution {
public:
string removeDuplicateLetters(string s) {
if(s.length() <= ... | ALGO | 0.999994 | 5.504542 |
ce9769b0-2f10-4bd3-a4a2-c674d7c543fe | Nasim-Imtiaz/UVA | UVA00551.cpp | #include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
bool openingBracket(char c){
if(c=='(' || c=='[' || c=='{' || c=='<'){
return true;
}
return false;
}
bool closingBracket(char c){
if(c==')' || c==']' || c=='}' || c=='>'){
return true;
}
return false;
}
int main(){
char s[3001];... | ALGO | 0.998971 | 3.533096 |
737f7a6f-f074-425f-a4fa-72930525a5f7 | mariapaulasaba/nature_code_oF | midterm/NOC_midterm_box2D/ofxBox2d/libs/Box2D/Dynamics/b2WorldCallbacks.cpp | #include "b2WorldCallbacks.h"
#include "b2Fixture.h"
// Return true if contact calculations should be performed between these two shapes.
// If you implement your own collision filter you may want to build from this implementation.
bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB)
{
const ... | TOOL | 0.916352 | 6.855665 |
2a3a12fd-f0dd-4db8-937a-90c2b07180ce | nemeshnorbert/huffman_code | src/main.cpp | #include <algorithm>
#include <iterator>
#include <iostream>
#include "huffman.h"
int run() {
std::ostream& out = std::cout;
std::istream& in = std::cin;
out
<< "Given a string we build its huffman encoding and the huffamn table .\n";
out << "Enter text for encoding: ";
auto text = std::string{};
in... | ALGO | 0.886288 | 4.949734 |
d4f11f21-5ad0-4581-b597-aaf2255eaadb | nachiketkanore/Problem-Solving | 1/271_A.cpp | #include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);
#define tie cin.tie(NULL);
#define endl "\n"
using namespace std;
int main(){
fastio tie
int y; cin>>y;
int a,b,c;
for(long int t=y+1;;t++){
int x=t;
a=x%10; x/=10;
b=x%10; x/=10;
c=x%10; x/=10;
... | ALGO | 0.99973 | 3.44641 |
c287e51a-6651-4e78-a723-d8a1c831fc25 | indrefi/Algorithms | Build Heap/Build Heap.cpp | /*
Indre Ionut
Comparatie intre BottomUp si Top-down Build Heap
Se poate observa ca abordarea de tip BottonUp este mai eficienta decat TopDown datorita
faptului ca are mai putine apeluri recursive si implicit mai putine operatii efectuate.
Referitor la complexitatea acestora se poate observa ca este aproximativ linea... | ALGO | 0.999712 | 4.770124 |
91366e5e-0516-4ea8-9bd6-53b6eb792edf | Monk5088/My-codes | solutionofeqn.cpp | #include<stdio.h>
#include<stdlib.h>
float* solution(float a1,float b1,float c1, float a2, float b2,float c2)
{
float a[2];
a[0]=(c1*b2-b1*c2)/(a1*b2-a2*b1);
a[1]=(a1*c2-a2*c1)/(a1*b2-a2*b1);
return a;
}
int main()
{
float a1,b1,c1,a2,b2,c2;
float* soln;
printf("enter coefficient of x,y & constant(for the form ... | ALGO | 0.999775 | 3.228453 |
6cb5f04c-4a23-4795-a7da-d72780c4e4f5 | Ashsifat1511/CP-Solves | Ekka_Dokka.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define forn for(int i = 0; i < n; i++)
const int N = 1e6+7;
typedef long long int ll;
#define pb push_back
#define cs cout<<"Case "<<tc<<": "
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t=1;
cin>>t;
for(i... | ALGO | 0.999651 | 3.577635 |
9d81e8d4-a61a-4d48-9f47-314967a1c8b4 | njs702/Algorithm | 강채영/BFS/백준_2589_0829.cpp | #include <iostream>
#include <queue>
using namespace std;
int h;
int w;
char map[50][50];
int visited[50][50];
int dist[50][50];
int dr[] = { 0,0,1,-1 };
int dc[] = { 1,-1,0,0 };
int maxlength;
struct Node
{
int y;
int x;
};
int bfs(int y, int x)
{
queue<Node> q;
q.push({ y,x });
visited[y][x] = 1;
dist[y][x]... | ALGO | 0.999197 | 3.694079 |
512715e9-72e7-4df3-b2a0-999beb888297 | sarvex/leetcode-guile | solution/1600-1699/1629.Slowest Key/Solution.cpp | class Solution {
public:
char slowestKey(vector<int>& releaseTimes, string keysPressed) {
char ans = keysPressed[0];
int mx = releaseTimes[0];
for (int i = 1, n = releaseTimes.size(); i < n; ++i) {
int d = releaseTimes[i] - releaseTimes[i - 1];
if (d > mx || (d == mx ... | ALGO | 0.999907 | 6.258623 |
ac5af0b4-2be6-4087-a27c-946fb41f14aa | k352ex/Problem-Solving | BOJ/10000 ~ 11000/10886.cpp | #include <iostream>
using namespace std;
int main() {
int one_count = 0;
int zero_count = 0;
int testcase, num;
cin >> testcase;
while(testcase--){
cin >> num;
if(num) ++one_count;
else ++zero_count;
}
if(one_count > zero_count) cout << "Junhee is cute!" << endl;
else cout << "Junhee is not cute!" << e... | ALGO | 0.99963 | 4.030014 |
21933321-b7ec-424d-b32c-51ca0c4c2222 | dexterrxx31/DataStructuresAlgorithms | binarySearch.cpp | #include <iostream>
using namespace std;
int binarySearch(int arr[], int leftIndex, int rightIndex, int searchElement)
{
if (rightIndex > 1)
{
int midIndex = leftIndex + ( rightIndex -1) / 2;
if (arr[midIndex] == searchElement)
{
return midIndex ;
}
if (arr[m... | ALGO | 0.999733 | 4.763526 |
bd66c558-166d-4899-a172-be8688749817 | pavan-patel-93/Data-Structures-and-Algorithms | Trees/13_sameTreeOrNot.cpp | #include<bits/stdc++.h>
using namespace std;
struct TreeNode{
int data;
TreeNode* left;
TreeNode* right;
TreeNode(int value){
data = value;
left = right = nullptr;
};
};
class Solution{
public:
bool isSameTree(TreeNode* p, TreeNode* q){
if(p == NULL || q == NULL) ... | ALGO | 0.999781 | 5.593369 |
a2562fdb-cecc-4170-ba9b-2dc232954edd | SubhamAdhikary2000/Assignment2 | q5.cpp | /*
The output will be:
3 4 5 6 7
13 14 15 16 17
23 24 25 26 27
Yes, it is valid to pass a 2D array to a function without passing the first dimension. Here’s why:
In C++, 2D arrays are stored in contiguous memory. The compiler needs to know the size of the second
dimension to correctly calculate the address of each ele... | ALGO | 0.997541 | 6.455623 |
bb1443a9-ecf5-41bb-94a2-2396c920bd9c | Shudhanshuarya09/DAA-codes | topologicalOrdering13.cpp | #include <bits/stdc++.h>
using namespace std;
void topologicalSortUtil(int v, vector<vector<int> >& adj, vector<bool>& visited,
stack<int>& Stack)
{
visited[v] = true;
for (int i : adj[v]) {
if (!visited[i])
topologicalSortUtil(i, adj, visited, Stack);
}
Stack.push(v);
}
void topologicalSort(vector<vector<int> >& adj,... | ALGO | 0.999983 | 5.592077 |
15ef5f3e-2095-4af9-abae-98ea94c62084 | MichalSzandar/University | sem1/wip/mastermind/solver.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <ctime>
using namespace std;
//this is my solver of popular game Mastermind
//it uses minmax algorithm to guess the code in the least number of turns
//it uses a set of 1296 possible codes and removes codes that would not give the same... | ALGO | 0.999832 | 4.890545 |
822ec19b-e52b-4b7c-bfa6-9b98b612b128 | cartcrypto/cart | src/utilstrencodings.cpp | #include "utilstrencodings.h"
#include "tinyformat.h"
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <limits>
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/evp.h>
static const std::string CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
... | TOOL | 0.975964 | 6.7604 |
f9a2944a-aa75-42ea-893a-e86e8c271076 | aajibade1/Circuit-Partition-Algorithm- | eigen/doc/examples/Tutorial_PartialLU_solve.cpp | #include <Eigen/Core>
#include <Eigen/LU>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vec... | ALGO | 0.999883 | 3.142099 |
213c3d83-917d-4047-bc37-7b5a0501b018 | Aty-0/S2DE | Libs/boost_1_76_0/libs/bimap/example/bimap_and_boost/property_map.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | TOOL | 0.878455 | 5.700279 |
23927668-5b35-40c5-a0d3-5fa95fd246b6 | pauldepalma/CPSC121CHS | older/2-OperCond/ex009.cpp | #include <iostream>
using namespace std;
int main()
{
int x, y, z;
cout << "The which is larger contest" << endl;
cout << "Enter and integer" << endl;
cin >> x;
cout << "Enter and integer" << endl;
cin >> y;
cout << "Enter and integer" << endl;
cin >> z;
if (x > y && x > z)
cout << x << " ... | ALGO | 0.996844 | 3.698779 |
429d0304-940a-44c9-af55-a1097644cf9e | hplp/ai-hardware-project-aibrawlers | FinalProjectMilestone/bryanTang-project-1_inferencing/src/edge-impulse-sdk/tensorflow/lite/micro/kernels/squared_difference.cpp | #include "edge-impulse-sdk/tensorflow/lite/c/common.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/binary_function.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/integer_ops/add.h"
#inclu... | ALGO | 0.967756 | 7.641786 |
729088a5-5898-4377-8f1a-86fc4f5ee8b2 | hamna741/CODILITY-TASKS | src/lesson3/frog_jump.cpp | #include<iostream>
int jumps(int x, int y, int d){
int current_position=x;
int jump_number=1;
if (x==y){
return 0;
}
else{
while(current_position<y){
current_position=x+(jump_number*d);
jump_number++;}
}
return jump_number-1;
}
int main(int argc, char* argv[]){
if(argc!=4){
std:... | ALGO | 0.999385 | 4.11672 |
fa694f41-0ec2-417e-85c3-2248b1095789 | sshamani/Cracking-the-Coding-Interview | chapter-8-recursion-and-Dynamic-Programming/8-9-parens.cpp | #include <iostream>
#include <string>
void print_all_parentheses_internal(size_t count, size_t opened, size_t closed, std::string arangement){
if(closed > opened){
return;
}
else if(opened > count){
return;
}
else if(arangement.size()==2*count){
std::cout << arangement << std::endl;
}
print... | ALGO | 0.998434 | 5.234982 |
d16c8e81-67e0-46a3-9698-f1de54de6487 | ishandutta2007/codeforces | ruchiose/normal/427/B.cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#define i64 long long
#define fortodo(i, f, t) for (i = f; i <= t; i++)
using namespace std;
const int MAXN = 210000;
int N, T, C, i, A[MAXN], dp[MAXN];
int main()
{
scanf("%d%d%d", &N, &T, &C);
fortodo(i, 1, N)
scanf("%d", &A[... | ALGO | 0.99998 | 3.738768 |
418f321d-0a87-4a9f-b08a-dafeaa93bffa | lychees/ACM-Training | Note/集训队作业/2015/作业2/jcvbcn_金策/5篇题解/kro/kro.cpp | #include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cstdio>
#include<iostream>
using namespace std;
int n,m;
struct edge{
int v,next,vis;
}e[1000005];int g[500005],etot;
void ae(int u,int v){
e[etot].v=v;e[etot].next=g[u];g[u]=etot++;
}
int U[250005],V[250005],val[250005]={0};
int stk... | ALGO | 0.999972 | 3.798751 |
5a588cdb-4fb6-4860-842e-43d6ea853201 | Henrik-Yao/NEUQ-ACM-Solution | week2/董淑睿/7-1.cpp | #include <bits/stdc++.h>
using namespace std;
const int _=1e3;
int read() {
int x=0,f=1;char s=getchar();
for(;s>'9'||s<'0';s=getchar()) if(s=='-') f=-1;
for(;s>='0'&&s<='9';s=getchar()) x=x*10+s-'0';
return x*f;
}
char a[3][_];
void f(int x,int now,int goal) {
if(x==1) {
if(now!=goal) print... | ALGO | 0.999997 | 4.138302 |
9a4973cb-a88c-414e-90c9-4c53f085b5cb | obelisk-planner/obelisk-backend | obelisk-quadratic-solve.cpp | #include <map>
#include <cfloat>
#include <tgmath.h>
#include <assert.h>
#include <x86_64-linux-gnu/cblas.h>
#include "obelisk-compressed-rrmat.hpp"
#include "obelisk-quadratic-solve.hpp"
using namespace std;
int swap_pointers(double** x, double** y) {
double* z = *x;
*x = *y;
*y = z;
return 0;
};
int ... | ALGO | 0.999976 | 4.017262 |
dee3a24f-e89a-4088-b25c-f6adffd04e33 | RajaKunalPandit1/Leetcode_Questions | 1970. Last Day Where You Can Still Cross.cpp | Output Status :
Runtime
815 ms
Beats
24.77%
Memory
188.4 MB
Beats
46.84%
class Solution {
public:
int latestDayToCross(int row, int col, vector<vector<int>>& cells) {
int left = 1, right = cells.size(), ans = 0;
while (left <= right) {
int mid = left + (right - left) / 2;
... | ALGO | 0.999923 | 6.488247 |
b896f0c3-13ea-4d09-a088-38a4e8887f93 | CrystaS15/CS-302 | cs302hw7/cs302hw7.cpp | /*
* Name: Kristy Nguyen, NSHE ID: 5006243601, Assignment 7
* Description: Analyze document containing words
* Input:
T (number of test cases)
Each test case will be denoted by 1/1+ lines (no more than 150 chars)
Last line contains 'END'
Assume document contains between 1 & 105 words
* Output:
Test Ca... | ALGO | 0.897694 | 4.569325 |
8918e19b-756d-4dea-9eb3-5403f05e556d | tianchaolangzi/prefix_beam_search_decoder_bpe | ctc_beam_search_decoder.cpp | #include "ctc_beam_search_decoder.h"
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <utility>
#include "ThreadPool.h"
#include "fst/fstlib.h"
#include "decoder_utils.h"
#include "path_trie.h"
using FSTMATCH = fst::SortedMatcher<fst::StdVectorFst>;
std::vector<st... | ALGO | 0.999641 | 7.386441 |
e2eacc95-e42b-4f1c-aa3a-e84c92a6568e | Mootikins/kattis | egypt/egypt.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<long long> nums( 3 );
cin >> nums[0] >> nums[1] >> nums[2];
while ( nums[0] != 0 ) {
sort( nums.begin(), nums.end() );
if ( abs( nums[0] * nums[0] + nums[1] * nums[1] - nums[2] * nums[2] ) <
0.001 ) {
cout << "right" << endl;
} else... | ALGO | 0.999938 | 3.652278 |
8fd4338e-a465-4d67-8c58-3c16a8aed99a | pavan-kalyan/competitive-coding | codeforces/contests/860/D.cpp | // Shocking Arrangement
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<unordered_map>
#define mod 1000000007
#define ll long long
using namespace std;
typedef vector<int> vi; typedef vector<ll> vl;
typedef pair<int, int> pii;
#define rep(i,n) for(int i=0;i<n;i++)
#define b... | ALGO | 0.999995 | 4.472246 |
03588d89-ef5d-4972-ac53-06db673ee5b4 | ishandutta2007/codeforces | johnkram/normal/1025/D.cpp | #include<bits/stdc++.h>
using namespace std;
bool f[705][705][2],g[705][705],ans;
int a[705],n,i,j,k,l;
int gcd(int x,int y)
{
if(!y)return x;
return gcd(y,x%y);
}
int main()
{
scanf("%d",&n);
for(i=1;i<=n;i++)scanf("%d",a+i);
for(i=1;i<=n;i++)for(j=1;j<=n;j++)g[i][j]=gcd(a[i],a[j])>1;
for(i=0;i<=n;i++)f[i+1][i][... | ALGO | 0.999996 | 3.48522 |
0d62c23e-97f0-49ee-97c9-d8220ff76312 | puruz14/CP-Practice | 24 Jan/CTEAMS.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
long long int y_R = 0, o_R = 0;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> old;
priority_queue<pair<int, int>> yng;
old.push({INT_MAX, 0});
yng.push({INT_MIN, 0});
for (int i... | ALGO | 0.999665 | 3.69603 |
8a1868f5-32a6-4c81-a03f-4b33e014911d | geekygirl8/Hacktoberfest_2022_DSA | C++/C++/create-maximum-number.cpp | // Time: O(k * (m + n + k)) ~ O(k * (m + n + k^2))
// Space: O(m + n + k^2)
// DP + Greedy solution.
class Solution {
public:
vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {
const int m = nums1.size(), n = nums2.size();
vector<vector<int>> max_numbers1(k + 1), max_numbers2(k... | ALGO | 0.999991 | 6.090777 |
5241ef18-b78c-4915-83c1-cf08840499b5 | soufiixarif/CPP | C++ module 08/ex01/Span.cpp | #include "Span.hpp"
Span::Span():N(100){
}
Span & Span::operator=(const Span &other){
if (this == &other)
return *this;
this->N = other.N;
return *this;
}
Span::Span(const Span &other){*this = other;}
Span::~Span(){}
Span::Span(unsigned int N){this->N = N;}
void Span::addNumber(int n){
if ... | ALGO | 0.952795 | 4.521703 |
ccc914a7-b9fa-4426-888b-509d80643b5e | razimantv/leetcode-solutions | Solutions/M/minimum-time-to-collect-all-apples-in-a-tree/Solution.cpp | // https://leetcode.com/problems/minimum-time-to-collect-all-apples-in-a-tree/
class Solution {
public:
int minTime(int n, vector<vector<int>>& edges, vector<bool>& hasApple) {
vector<vector<int>> adj(n);
for (const auto& e : edges) {
adj[e[0]].push_back(e[1]);
adj[e[1]].push_back(e[0]);
}
... | ALGO | 0.999915 | 6.479656 |
59eacf49-3dcf-4029-8018-f808698bb261 | AdoenLunnae/FISV | CameraCalibration/src/augReal.cpp | #include <iostream>
#include <opencv2/calib3d.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <vector>
using namespace cv;
std::vector<Point3f> createAxis(const float& length)
{
std::vector<Point3f> axis;
axis.emplace_back(0, 0, 0);
axis.emplace_... | ALGO | 0.963748 | 5.124614 |
519ff63b-30a1-40ec-abbe-49e0ee24ac7d | ZYSzys/ACM | Tree/Binary_Indexed_Tree/HDU 1166(敌兵布阵).cpp | //http://acm.hdu.edu.cn/showproblem.php?pid=1166
/*
敌兵布阵
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 94602 Accepted Submission(s): 39916
Problem Description
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况... | ALGO | 0.99354 | 3.792884 |
26de10d9-1893-4f4f-86f3-dc9d53b6f070 | ishandutta2007/codeforces | turmax/normal/1593/D2.cpp | #pragma GCC optimize("O3","Ofast","unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#define int int_fast32_t
const int maxn=2e6+10;
int cnt[maxn];
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--)
{
int... | ALGO | 0.999609 | 3.905967 |
20082c1e-8458-4fda-8447-21c838057264 | HaqqiSaefi/Kelompok_8 | JOB_P5_3_C_HAFIZAN_F1B022113.cpp | #include <stdio.h>
int main(){
int var1 = 20,var2 =30,var3=60;
int* varPtr1 = &var1;
int* varPtr2 = &var2;
int* varPtr3 = &var3;
printf("alamat dari var 1 : %x \n", &var1);
printf("Nilai yang ditunjukkan varPtr 1 : %x \n\n",varPtr1);
printf("alamat dari var 2 : %x \n", &var2);
printf("Nilai yang ditunjukkan... | TOOL | 0.951108 | 3.526475 |
35c3b877-9083-4808-9b7e-938e97a88688 | Feline-A/Kattis-competitive-programming | Job Expenses/Feline-JobExpenses.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int n, k, e;
cin >> n;
e = 0;
for(int i=1;i<=n;i++){
cin >> k;
if (k < 0){
e = e + k;
}
}
cout << abs(e) << "\n";
return 0;
}
| ALGO | 0.999826 | 3.615867 |
5b461f8f-fce0-4b46-9757-3c135ecdcd58 | AgrVanshit/DataStructures-and-Algorithms | ALL DP Concepts/3) DP on Subsequences/H) Target Sum.cpp | //*****https://leetcode.com/problems/target-sum/description/*****
//****Recursion and Memoization****
//T.C: O(n) + O(n * k);
//S.C: O(n * k) + O(n);
class Solution {
public:
int solve(int ind, int target, int n, vector<int>& nums, vector<vector<int>>& dp){
if(ind == 0){
if(target == 0 && nums[... | ALGO | 0.99999 | 6.186157 |
604911b5-c5ba-472f-9a2f-ea75a3ec1946 | HyeongDo/Algorithm | boj_10844_2.cpp | #include<iostream>
using namespace std;
#define mod 1000000000;
int n;
long long int dp[101][11],ans;
int main(void){
cin>>n;
for(int i=1;i<=9;i++){
dp[1][i]=1;
}
for(int i=2;i<=n;i++){
for(int j=0;j<=9;j++){
dp[i][j]=(dp[i-1][j-1]+dp[i-1][j+1])%mod;
}
}
for(int i=0;i<=9;i++){
ans+=dp[n][i];
}
cou... | ALGO | 0.999919 | 4.363244 |
2ecf8e62-4bae-4b70-8fbb-0cea31b7dc56 | vedullakiran/GFG | GFG/Tree/inorderNoRecursion.cpp | #include <iostream>
#include <stdio.h>
#include <malloc.h>
#include <stack>
using namespace std;
struct node{
int data;
struct node* left;
struct node* right;
};
node* newNode(int data)
{
struct node *Nnode=(node*)malloc(sizeof(node));
Nnode->data=data;
Nnode->left=NULL;
Nnode->right=NULL;
return Nnode;
}
v... | ALGO | 0.999965 | 5.237365 |
79fea6ce-d62e-4737-b74f-6de36af464e9 | vishalkushw/ArrayQuestion | Finde the higest of array.cpp | //write a program finde the higest of array
#include <iostream>
using namespace std;
int main(){
int A[6]={4,91,61,-3,120,5};
int high=A[0];
int low=A[0];
for (int i=1;i<6;i++){
if(A[i]>high){
high=A[i];
}
}
cout<<high<<endl;
}
| ALGO | 0.997528 | 4.015615 |
0e83dc15-c756-41f8-96f5-549d66199bdc | GuacheSuede/MSSubmission1234567890 | submission/macd/boost_1_69_0/libs/math/example/normal_misc_examples.cpp | // normal_misc_examples.cpp
// Example of using normal distribution.
// Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[normal_basic1
/*`
First we need some includes to access the normal distribution
(and some std output of course).... | ALGO | 0.996285 | 5.079186 |
9d5fe1aa-9d9a-4fb4-a8d9-a5f820954b8a | youngsam-byun/my-notes.github.io | leetcode/src/test/java/Greedy/1054.Distant-Barcodes/1054.Distant-Barcodes_v2.cpp | class Solution {
public:
vector<int> rearrangeBarcodes(vector<int>& barcodes)
{
unordered_map<int,int>Map;
for (auto x:barcodes)
Map[x]+=1;
priority_queue<pair<int,int>>pq;
for (auto x: Map)
pq.push({x.second, x.first});
vector<int>ret;
w... | ALGO | 0.999881 | 5.59371 |
0cdb6b1f-430b-49e7-b127-d0f1cac47d2c | ariadne-cps/ariadne | tests/geometry/test_affine_sets.cpp | #include <iostream>
#include "config.hpp"
#include "function/function.hpp"
#include "geometry/box.hpp"
#include "geometry/affine_set.hpp"
#include "geometry/function_set.hpp"
#include "geometry/grid_paving.hpp"
#include "io/figure.hpp"
#include "io/geometry2d.hpp"
#include "../test.hpp"
using namespace Ariadne;
usin... | TEST | 0.897203 | 7.587334 |
0356ac59-ca59-4788-8342-f7a9a9ccf25a | avlo2000/SatelliteMovementManager | SatteliteSimulator/third_party/eigen/doc/examples/DenseBase_template_int_middleRows.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.9677 | 3.231232 |
0be6e61a-c37e-4bdf-92f4-b9b68fbce615 | Xuding0829/CompetitiveProgramming | Src/Acwing/算法提高课/图论/最小生成树/最短网络.cpp | #include <bits/stdc++.h>
using i64 = long long;
constexpr int inf = 0x3f3f3f3f;
struct edge
{
int u, v, w;
bool operator<(const edge &t) const
{
return w < t.w;
}
};
struct DSU
{
std::vector<int> f, siz;
DSU(int n) : f(n), siz(n, 1)
{
std::iota(f.begin(), f.end(), 0);
... | ALGO | 0.999958 | 4.297205 |
126721d3-5169-4e82-aa75-bba21110682e | ishandutta2007/codeforces | dmitriy.belichenko/normal/898/A.cpp |
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <unordered_map>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <cstring>
#include <queue>
#include <set>
#define mp make_pair
#define pb push_back
#define fst first
#d... | ALGO | 0.99976 | 4.019487 |
2101683f-6500-487f-a1ae-f35b7c8f2eb1 | Bayrktr/generala_game | project/tasks/choose_who_start_first/choose_who_start_first.cpp | #include "choose_who_start_first.h"
#include "../print_score_sheet/print_score_sheet.h"
#include <iostream>
#include <cstdlib>
#define DICE_COUNT 5
#define DICE_START_COUNT 2
#define DICE_SIZE 6
void start_roll_dice(int dice[DICE_START_COUNT]) {
for (int i = 0; i < DICE_START_COUNT; i++) {
dice[i] = rand(... | ALGO | 0.996858 | 4.270087 |
b3a5c69a-9c62-4237-b7d9-c67f20370bd8 | huyprm/C-programming-language | src/BT7.cpp | //BAI TAP THUC HANH BUOI 3
//MAI VAN HUY
//N21DCCN129
//D21CQCN02-N
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
class ptb2 {
private:
float a, b, c;
public:
ptb2() {
a = 0;
b = 0;
c = 0;
}
float getA() {
return a;
}
void setA(float a) {
this->a = a;
}
float getB() {
ret... | ALGO | 0.997352 | 3.694846 |
45c3223b-3348-4d2f-90ce-4bd1f3b2b967 | Adarshsingh2k/Interview-Prepration | Hashing/smallerthancurrent.cpp | //https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/
class Solution {
public:
vector<int> smallerNumbersThanCurrent(vector<int>& nums) {
vector<int> v(101,0);
for(auto val:nums){
v[val]++;
}
vector<int> prefix(101,0);
... | ALGO | 0.999986 | 5.984715 |
85bf0c1d-759f-4590-8501-2e1ba83f1443 | SeanHsu-pub/kattis | CompetitiveProgramming01/Shattered_Cake.cpp | #include<bits/stdc++.h>
using namespace std;
int main(void){
int w, n, wi, li, t=0;
cin >> w >> n;
for(int i=0; i<n; i++){
cin >> wi >> li;
// for(int i=1;;i++){
// if(((i%wi == 0)&&(w%li == 0))||((w%wi == 0)&&(i%li == 0))){
// if(i>=maxa){
// maxa=i;
// }
// break;
// }
// }
t+=(wi*li);
}
c... | ALGO | 0.999682 | 3.789605 |
24ad15fb-b17e-4498-b424-7735bf16b2bb | codingClaire/DataStructure-and-Algorithm | FirstTime/83.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution
{
public:
ListNode* deleteDuplicates(ListNode* head)
{
if(head == NULL||head->next == NULL) return head;
ListNode *front=h... | ALGO | 0.999975 | 5.499057 |
b2c1ed18-86c6-41ac-a546-df71d70e291c | ishandutta2007/codeforces | thescrasse/normal/1358/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define INF (ll)1e18
ll i, i1, j, k, k1, t, n, m, res, flag, a, b;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
//ifstream cin("input.txt");
//ofstream cout("output.txt");
cin >> t;
while (t--) {
... | ALGO | 0.999858 | 5.074606 |
6702788c-6306-493c-8617-1e33d333b80e | SalahHassan202/assuit_sheet_solved_by_cpp | Sheet 06/A. Power Of Two.cpp | // A. Power Of Two
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
long long num;
cin>>num;
double res = log2(num)/log2(2);
if((res - (long long)res) != 0)
{
cout<<"NO"<<endl;
} else
{
cout<<"YES"<<endl;
}
return 0;
} | ALGO | 0.999689 | 4.061497 |
d3cc6f79-c694-4643-8b71-76553173006f | G-Gowtham/Programming | cpp/Convert_Ternary_Expression_to_Binary_Tree.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
struct Node
{
char data;
struct Node *left;
struct Node *right;
Node(char x){
data = x;
left = NULL;
right = NULL;
}
};
void preorder(Node *root){
if(root==NULL)
return;
cout<<root->data<<" ";
preorder(root->left);
preord... | ALGO | 0.99975 | 4.942481 |
0c54faa4-c570-416b-a358-f9f878940f85 | xela6134/leetcode | 211/add_and_search_word_data_structure.cpp | #include <iostream>
#include <string>
#include <vector>
#include <queue>
class WordDictionary {
class TrieNode {
public:
std::vector<TrieNode*> children{26, nullptr};
bool word = false;
};
public:
WordDictionary() {
root = new TrieNode();
}
void addWord(std::string ... | ALGO | 0.997546 | 5.726093 |
929c95b4-616e-4928-a42b-536d033b0601 | charles-pku-2013/CodeRes_Cpp | TICPP-2nd-ed-Vol-two/code/C06/FillGenerateTest.cpp | using namespace std;
int main() {
vector<string> v1(5);
fill(v1.begin(), v1.end(), "howdy");
print(v1.begin(), v1.end(), "v1", " ");
vector<string> v2;
fill_n(back_inserter(v2), 7, "bye");
print(v2.begin(), v2.end(), "v2");
vector<int> v3(10);
generate(v3.begin(), v3.end(), SkipGen(4,5));
print(v3.be... | TOOL | 0.861499 | 3.360267 |
7cdd47c6-39a2-4bc0-9afe-7718d0e849cb | vikas83pal/DSA-Using-Cpp | majorityElement.cpp | #include<bits/stdc++.h>
using namespace std;
int majorityElement(int arr[], int n) {
for (int i = 0; i < n; i++) {
int cnt = 0;
for (int j = 0; j < n; j++) {
if (arr[j] == arr[i]) {
cnt++;
}
}
if (cnt > n / 2) {
return arr[i];
... | ALGO | 0.999894 | 4.816591 |
0bb9e06c-f9bb-4332-a178-252509c3b1f4 | Vasamsiddhartha/AI-Self-Driving-Cars | self-driving-car-master/project_11_path_planning/src/Eigen-3.3/bench/benchmarkX.cpp | // g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
#include <iostream>
#include <Eigen/Core>
using namespace std;
using namespace Eigen;
#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif
#ifndef MATSIZE
#define MATSIZE 400
#endif
#ifndef REPEAT
#define REPEAT 100
#endif
int mai... | ALGO | 0.960856 | 3.370773 |
ecad2e07-3797-4971-8b8b-5a8366ccd893 | heromanba/Data-Structure-and-Algorithm | 数据结构(C++语言版)-邓俊辉/course_code/src/power/power1.cpp | __int64 power ( __int64 a, int n ) { //a^n㷨n >= 0
__int64 pow = 1; //O(1)
__int64 p = a; //O(1)
while ( 0 < n ) { //O(logn)
if ( n & 1 ) //O(1)
pow *= p; //O(1)
n >>= 1; //O(1)
p *= p; //O(1)
}
return pow; //O(1)
} //power()
| ALGO | 0.999456 | 4.895623 |
9e34364c-fcec-4626-8002-01c34425004b | yashss1/Sublime_CP | cf_1820_b.cpp | //YashS
#include <bits/stdc++.h>
using namespace std;
#define test int T;cin>>T;while(T--)
#define int long long
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pVec(v) for(auto e:v)cout<<e<<"... | ALGO | 0.999989 | 4.304792 |
ef38f088-df56-49e6-a95b-05d3e9462e0a | SeSACAlgorithm/AlgorithmStudy | 백준/그래프 탐색/7562) 나이트의 이동/석희.cpp | #include <iostream>
#include <queue>
using namespace std;
int n;
int I; // 한 변의 길이
int dx[] = {2, 1, -1, -2, -2, -1, 1, 2};
int dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
class point
{
public:
int x;
int y;
};
void bfs(point p_start, point p_end)
{
int check[301][301] = {
0,
};
queue<point> q... | ALGO | 0.999914 | 4.280246 |
40950a8c-89e2-492d-a13d-26b5b6a93929 | PacifiK2460/Problemas | OmegaUp/Problemas/Las Cartas del Dr. Lira (Adaptacion)/Las Cartas del Dr. Lira (Adaptacion).cpp | #include<iostream>
#include<utility>
using namespace std;
int main()
{
int n;
bool c[55],p[55],s[55],q[55],t[55];
cin>>n;
for (int i = 0; i <= n-1; i++)
{
cin>>c[i];
p[i] = c[i];
s[i] = c[i];
q[i] = c[i];
t[i] = c[i];
}
pair<int,int>m;
m.first = 0... | ALGO | 0.999992 | 3.568029 |
a4f392a0-9b14-470f-b243-e3b8a3031373 | alexanderommel/Competitive-Programming | Codeforces/Tear It Apart/main.cpp | #include <bits/stdc++.h>
#define pb push_back
#define vi vector<int>
#define ll long long
#define vll vector<long long>
#define pll pair<ll,ll>
using namespace std;
typedef std::tuple<int,int,int> mytuple;
int main(){
int t;
cin >> t;
while(t--){
string s;
cin >> s;
int ans=INT_MAX;... | ALGO | 0.999309 | 3.930517 |
75adbf5a-1f99-46c3-8da5-07053fbe8039 | kasa021/atcoder-archives | abc134/abc134_c_35769131_AC.cpp | /*
* Author: kAsA02
* Submission URL: https://atcoder.jp/contests/abc134/submissions/35769131
* Submitted at: 2022-10-18 09:53:45
* Problem URL: https://atcoder.jp/contests/abc134/tasks/abc134_c
* Result: AC
* Execution Time: 341 ms
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i =... | ALGO | 0.999984 | 3.920233 |
068b29d8-c8ec-4006-b8d2-9bd92822eb7c | yuanfei-hit/Identification | identifier/include/recog.cpp | #include "recog.h"
bool sortICPPair(pair<int, double> pair1, pair<int, double> pair2)
{
return pair1.second < pair2.second;
}
bool sortID(pair<int, double> pair1, pair<int, double> pair2)
{
return pair1.first < pair2.first;
}
bool sortPoint(PointT point1, PointT point2)
{
return (point1.z < point2.z);
}
bo... | ALGO | 0.944011 | 3.879745 |
7b786c52-f92c-471a-bb49-900e210628ce | radhikagpt1208/Data-Structures-Algorithms | 0.3. Functions/isPrime.cpp | #include<iostream>
using namespace std;
bool isPrime(int n)
{
for(int i=2; i<=n/2; i++)
{
if(n%i==0)
{
return false;
}
}
return true;
}
void allPrimes(int n)
{
for(int i=2; i<=n; i++)
{
if(isPrime(i))
{
cout<<i<<" ";
}
... | ALGO | 0.994418 | 4.139382 |
73b0ba34-1772-4688-8be4-15af1d0d15ae | ellynhan/challenge100-codingtest-study | splanky0314/Recursive_Function/15650_N과M(2).cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m;
vector<int> arr(10);
void f(int x) {
if(x==m) {
for(int i=0; i<m; i++) cout << arr[i] << " ";
cout << "\n";
}
else if(x==0) {
for(int i=1; i<=n; i++) {
arr[x] = i;
f(x+1);
}
}
... | ALGO | 0.999975 | 3.832449 |
2e45247a-9337-4a9f-a0a9-0d6dd279c25b | JyotiKumari2/Crack-Your-Placement | 144-binary-tree-preorder-traversal/144-binary-tree-preorder-traversal.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.99999 | 6.357284 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.