uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f7408b0e-5a86-49df-90a2-10a819386c54 | sunnyajit/My_Leetcode_sol | 2516-take-k-of-each-character-from-left-and-right/2516-take-k-of-each-character-from-left-and-right.cpp | class Solution {
public: // code written by sunny
int takeCharacters(string s, int k) {
int n = s.length();
vector<int> total(3, 0);
for (char c : s) {
total[c - 'a']++;
}
if (total[0] < k || total[1] < k || total[2] < k) {
return -1;
}
... | ALGO | 0.999981 | 5.38957 |
9efdee12-cf90-4753-a43d-a97f5174e265 | RapidsAtHKUST/Efficient-DPP | obsolete/OpenMP/map.cpp | #include "functions.h"
#include <immintrin.h>
#include <offload.h>
#pragma offload_attribute(push, target(mic))
#include <immintrin.h>
#pragma offload_attribute(pop)
using namespace std;
//declare simd will make it faster from 188ms to 122ms
//change to intrinsic takes the same time as individual function
//individu... | ALGO | 0.999201 | 4.883682 |
f5b0a864-5734-40c8-8f37-71d2e739d8fc | nianheng/ICPC-codenv | solved/csp/csp26th/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define qmin(x, y) (x = min(x, y))
#define qmax(x, y) (x = max(x, y))
#define mp(x, y) make_pair(x, y)
inline int read() {
int tmp = 0, fh = 1;
char ch = getchar();
while(!isdi... | ALGO | 0.999786 | 4.070713 |
1d52f223-e5db-4376-8a8c-bcb459e0c5d4 | skavy359/Algorithmic-Huddle | CodeChef-Problems/Form a Triangle.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<long long> arr(n);
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
sort(arr.begin(), arr.end());
bool possible = f... | ALGO | 0.999791 | 4.951381 |
0432d490-cb49-444d-909d-92daa1e91489 | jiangxiaolhm/ACM | UVa/UVa400.cpp | #include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int N = 110;
const int L = 110;
const int S = 60;
int test;
int temp_l[N];
int length;
int row_n;
int col_n;
char str[N][L];
void initialize() {
memset(str,0,sizeof(str));
length = 0;
}
int compare(const void *a,const void *b) {
... | ALGO | 0.998438 | 3.734449 |
8a1e98e6-5cd5-48b2-92ca-256ade255a27 | davidjacobo/Competencias | Codechef/2015/may_challenge/set_diff.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#define MOD 1000000007
#define MAX_N 100001
using namespace std;
typedef long long ll;
int arr[MAX_N];
int main(){
int T, N, ans;
cin>>T;
while(T--){
cin>>N;
for(int i=0;i<N;++i){
cin>>arr[i];
}
sort(ar... | ALGO | 0.99992 | 4.094112 |
0726aa7b-4b82-483d-9bc9-71b8ea0cd8b8 | 543877815/cg_practise | includes/eigen3/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.984319 | 3.669638 |
f5467dff-9199-4926-8cfc-b3a9c0d7e4d3 | granddaifuku/library | test/aoj/GRL_5_C.test.cpp | #define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C&lang=en"
#include <bits/stdc++.h>
using namespace std;
#include "../../Graph/lowest_common_ancestor.cpp"
int main() {
int n, q;
cin >> n;
LCA<int> lca = LCA<int>(n);
for (int i = 0; i < n; ++i) {
int k;
... | ALGO | 0.999855 | 4.485504 |
73840431-ec08-43e6-a677-eadc877b0b7d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_8469_5.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = (int)5e3 + 10;
const int block = 400;
bool f[N][N];
int ff[N][N];
int n, q;
string s;
int main() {
cin >> s;
n = s.length();
for (int i = 0; i < n; ++i) {
for (int len = 0; i - len >= 0 && i + len < n; ++len)
if (s[i + len] == s[i - len])
... | ALGO | 0.999927 | 4.378197 |
044ce2bd-e2e1-41e0-becd-df0676d95059 | vedad-e/OOP | Zadace/zadaca2/hamming.cpp | #include <iostream>
int main(void)
{
std::string prvi,drugi;
std::cin >> prvi;
std::cin >> drugi;
int duzina=0;
if(prvi.size() != drugi.size()){
std::cout << "Stringovi moraju biti iste duzine" << std::endl;
exit(0);
}
for(int i=0; prvi[i]!=0; ++i)
if(prvi[i] != drugi[i])
++duzina;
... | ALGO | 0.998987 | 4.193023 |
eddd15be-9c14-4a78-af38-e86b9d550e16 | ishandutta2007/codeforces | zhukov_dmitry/normal/65/C.cpp | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define bublic public
#define clr(x) memset((... | ALGO | 0.999876 | 3.988063 |
e32b6ffd-bf92-425c-89de-454fc294cbc6 | dotSlash-Adwitiya/Problem-of-the-day | ThePalindromePattern.cpp | #include<bits/stdc++.h>
using namespace std;
string pattern(vector<vector<int>> &arr) {
int n = arr.size();
int endRow = n-1, idx = 0;
string ans = "";
for(int startRow = 0; startRow <= endRow; startRow++) {
bool isPalindrome = true;
int startCol = 0, endCol = n-1;
while(startCol <= endCol) {... | ALGO | 0.999879 | 4.382274 |
173bb98d-3436-4247-b7fd-a50a3ab311ca | zhh2005757/slambook2_in_Docker | slambook2/3rdparty/opencv-3.3.0/modules/ml/src/lr.cpp | ///////////////////////////////////////////////////////////////////////////////////////
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
// This is a implementation of the Logistic Regression algorithm in C++ in OpenCV.
// AUTHOR:
// Rahul Kavi rahulkavi[at]live[at]com
// # You are free to use, c... | DATA | 0.997117 | 3.437346 |
ded0da93-4171-47cc-9959-bcf484ddf1a5 | demmer/node-cassandra-native-driver | cpp-driver/src/murmur3.cpp | #include "murmur3.hpp"
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#if defined(_MSC_VER)
#define FORCE_INLINE __forceinline
#define ROTL32(x,y) _rotl(x,y)
#define ROTL64(x,y) _rotl64(x,y)
#define BIG_CONSTANT(x) (x)
// Other compilers
#else // defined(_MSC_VER)
#define FORCE_INLINE inline __att... | ALGO | 0.998228 | 6.555007 |
11ae378c-4df0-481c-8372-a03e71f6c339 | Linuxydable/Godot_STL | thirdparty/bullet/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp | #include "btMinkowskiSumShape.h"
btMinkowskiSumShape::btMinkowskiSumShape(const btConvexShape* shapeA, const btConvexShape* shapeB)
: btConvexInternalShape(),
m_shapeA(shapeA),
m_shapeB(shapeB)
{
m_shapeType = MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE;
m_transA.setIdentity();
m_transB.setIdentity();
}
btVector3 ... | ALGO | 0.983445 | 6.697566 |
5b774754-ce9c-4be5-a8e3-86524bccd8de | akhilchoudhary2k/Solutions-CSES-Problem-Set | array_description.cpp | #include<bits/stdc++.h>
using namespace std;
// #define int long long
int mod = 1e9+7;
int dp[100000][102];
void test_case(){
int n,m;
cin >> n >> m;
int a[n];
for(int i=0;i<n;i++) cin >> a[i];
memset(dp,0,sizeof(dp));
// dp[i][j] --> ways when ith index has value j
if(a[0]) dp[0][a[0]] = 1;
else for(int j... | ALGO | 0.999993 | 4.013495 |
0f9445b0-b63f-430e-913a-5cae26e99125 | Badar-Ur-Zaman/Leetcode | 1013-fibonacci-number/fibonacci-number.cpp | class Solution {
public:
int fib(int n) {
if(n == 2 || n == 1){
return 1;
}else if(n == 0){
return 0;
}
int curr = 1, prev = 0, sum = 0;
int iter = 1;
while(iter != n){
sum = curr + prev;
prev = curr;
curr = ... | ALGO | 0.999997 | 6.313485 |
ec1d8873-36c0-4322-9690-b42c2b1f6a1e | JehanneDussert/cpp | cpp_00/ex00/megaphone.cpp | #include <stdio.h>
#include <iostream>
#include <ctype.h>
#include <string.h>
int main (int argc, char **argv)
{
int i;
int j;
int k = 1;
int n;
if (argc == 1)
std::cout << "* LOUD AND UNBEARABLE FEEDBACK NOISE *";
for (j = 1; j < argc ; j++)
{
for (n = strlen(argv[j]) - 1; n >= 0 && argv[j][n] == ' '; n--)... | TOOL | 0.969661 | 3.69352 |
e24b02aa-9f4c-4f88-86bb-1b3fbb809bdb | HDU-Joey-Tan/CCF | 29-2.cpp | #include<bits/stdc++.h>
#define int long long
#define INF (0x3f3f3f3f3f3f3f3f)
using namespace std;
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m,k;
cin>>n>>m>>k;
vector<tuple<int,int>> v;
for (int i=0;i<n;i++)
{
int t,c;
cin>>t>>c;
v.empla... | ALGO | 0.999987 | 3.883214 |
498f83a3-6e38-4c6d-9acd-f366f0904c10 | gustavorw/URI | c++/2473.cpp | #include<iostream>
#define MAX 6
int main(){
int i, j, sorteio;
int acertos = 0;
int jogadas[MAX];
for(i = 0; i < MAX; i++){
std::cin>>jogadas[i];
}
for(i = 0; i < MAX; i++){
std::cin>>sorteio;
for ( j = 0; j < MAX; j++)
{
if(sorteio == jogadas[j]){
... | ALGO | 0.999601 | 3.71433 |
5f7f5c2e-a0ee-4470-b072-aece5047543c | helloMickey/Algorithm | leetCode/reserve_linked_list.cpp | struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution {
public:
ListNode* reverseBetween(ListNode* head, int m, int n) {
if (head == nullptr || head->next == nullptr)
return head;
ListNode *cur, *pre , *r, *breakPoint, *rebuildPoint;
ListNode *first = ... | ALGO | 0.99997 | 5.324584 |
a014bd80-acef-4a97-acd9-7029c5ab0c61 | DeepeshnotCool/LeetCode-Submissions | my-folder/problems/all_nodes_distance_k_in_binary_tree/solution.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void point_the_pointer(map<TreeNode*, TreeNode*> &m, TreeNode* root)
{
queue<TreeNo... | ALGO | 0.999997 | 5.972657 |
4ecdb8ff-e8d4-4d6c-8757-b8d7e875ed87 | DevashishPathrabe/LeetCode | LeetCode Solutions/Top Interview Questions(Hard Collection)/Array and Strings/Sliding Window Maximum.cpp | class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
deque<int> d;
vector<int> maxSlidingWindow;
for (int i=0; i<nums.size(); ++i){
while(!d.empty() && d.front() <= i-k){
d.pop_front();
}
while(!d.empty() && num... | ALGO | 0.99994 | 6.25811 |
95d466e3-a034-4159-8ac4-e345c7dd610a | ximik666/DE_Sprint | 1.7/2.cpp | //Написать программу, которая проверяет является ли год високосным.
#include <iostream>
using namespace std;
int main() {
int year;
cin >> year;
if (year%400==0){
cout << "Visokos";
}
else if (year%100==0) {
cout << "Ne visokos";
}
else if (year%4 == 0){
cout << "Vi... | ALGO | 0.999918 | 4.567946 |
b9c655fe-15b7-4b14-916b-d2883126f19a | Bin-raushan/CPP-DSA | CPP DSA/Patterns/pattern5.cpp | // Print Half Pyramid after 180 degree rotation
// *
// **
// ***
// ****
// *****
#include<iostream>
using namespace std;
int main(){
int row,i,j;
cout<<"Enter number of rows you want to print: ";
cin>>row;
for(i=1;i<=row;i++){
for(j=1;j<=row;j++){
if((i+j)<=row){
... | ALGO | 0.999827 | 4.227526 |
94c85232-23bf-47f9-a205-17003ed3a8e9 | jttoivon/moder2 | combinatorics.cpp | #include "combinatorics.hpp"
#include "common.hpp"
#include <cassert>
#include <cmath>
#include <boost/math/special_functions/factorials.hpp>
#include <boost/random/linear_congruential.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/random/uniform_real.hpp>
#include <boost/random/variate_generator.hpp>
... | ALGO | 0.99647 | 5.16895 |
339a5689-dd06-462a-acf3-893e95c9744e | Prachi-kumari-1111/DSA | LeetCodeEasyQ/CheckPrime.cpp | #include <iostream>
using namespace std;
bool isPrime(int n) {
if (n <= 1) return false;
for(int i = 2; i*i <= n; i++) {
if(n % i == 0)
return false;
}
return true;
}
int main() {
int num;
cout << "Enter a number: ";
cin >> num;
if(isPrime(num))
cout << num... | ALGO | 0.999149 | 4.067846 |
bd026b38-5ef4-46da-9ef2-ec37212fbf94 | yanzhang404/MyC | C编程技能训练作业/第九次作业/石子.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
const int N = 200005;
int n, m,ans;
int a[N];
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
{
scanf("%d", &a[i]);
}
if (n<=2 || n%2==0) {
printf("-1");
... | ALGO | 0.999984 | 3.655826 |
25ab8608-2497-4658-b489-ae9d62fbb666 | namnguyen16082008/VNOJ | fct028_fpainting.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll a,b,c,d,s=0,x[111]={};
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>a>>b>>c>>d;
for (ll i=a;i<=b;i++){
if (x[i]==0) s++;
x[i]=1;
}
for (ll i=c;i<=d;i++){
if (x[i]==0) s++;
... | ALGO | 0.999813 | 3.29793 |
ea97060b-f623-4094-85d8-a5b159b8d54a | pra11chit/competitive | handbook/MaxSubArraySum.cpp | //Algorithm 1: StraightForward
#include <iostream>
using namespace std;
int main() {
int n = 8;
int array[] = {-1, 2, 4, -3, 5, 2, -5, 2};
int best = 0;
for(int a = 0; a < n; ++a) {
int sum = 0;
for(int b = a; b < n; ++b) {
sum += array[b];
best = max(best, sum);... | ALGO | 0.999999 | 5.571199 |
0c3ffb13-c1d5-4dba-ace7-02fea97f9416 | gildasio167/fup | mercadov3.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main(){
int quantidade;
cin >> quantidade;
float chute_primeiro[quantidade];
char chute_segundo[quantidade];
float produtos[quantidade];
for(int i = 0; i < quantidade; i++){
cin >> produtos[i];
}
for(int i = 0; i <... | ALGO | 0.999984 | 4.399213 |
0658c3db-9250-4c13-8c1d-b52a407827b4 | dgaydukov/projecteuler | tasks/6.cpp | /*
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
Fin... | ALGO | 0.998043 | 5.356905 |
ef73a400-47ca-4a37-87f7-08e9e7b4faec | NandiniJanapati/Inverse-Kinematics-Chain-Links | src/main.cpp | #define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <fstream>
#include <string>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.... | ALGO | 0.900792 | 5.093315 |
8f266f28-40d0-4a7d-8b85-250910ffb1c4 | LokeshKumarkumawat/DSA | Graph/hello world/006 flood fill.cpp | //DFS
// https://leetcode.com/problems/flood-fill/
class Solution {
public:
bool isValid(vector<vector<int>>& image, int i, int j, int n, int m , int color){
if(i>=0 && i<n && j>=0 && j<m && image[i][j] == color)
return true;
return false;
}
void... | ALGO | 0.999806 | 6.580555 |
67150a62-7f13-4d79-9ac7-1b06c78be92b | Andrei-Bondarenko/malina | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
44a0b456-5761-4495-a468-fc4b9b9f41b0 | anuj1908/AAD | Flutter/Layouts/list/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.997647 | 6.76775 |
ab84340b-c06b-49c9-af9b-428fed4a8139 | RandomDeveloperM/UE4_Hairworks | Engine/Source/ThirdParty/CryptoPP/5.6.2/include/integer.cpp | // integer.cpp - written and placed in the public domain by Wei Dai
// contains public domain code contributed by Alister Lee and Leonard Janke
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "integer.h"
#include "modarith.h"
#include "nbtheory.h"
#include "asn.h"
#include "oids.h"
#include "words.h"
#include "al... | ALGO | 0.979536 | 6.034801 |
29898730-d8a2-4256-b91d-74f7045e1b37 | gitcodingrank/DSA_WITH_CPP | G10/Sprint 7/Day 3/program.cpp | #include <iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int value){
this->data = value;
this->next = NULL;
}
};
class LinkedList{
private:
Node* head;
Node* tail;
int size;
public:
//constructor
LinkedList(){
... | ALGO | 0.99851 | 4.621842 |
049a92e4-eb4e-4fa2-b2f8-d14cbf6c9e56 | Harini701/operating-system | 37.cpp | #include <stdio.h>
#include <stdbool.h>
#define MAX_FRAMES 10
int optimal_page_replacement(int pages[], int num_pages, int num_frames) {
int page_faults = 0;
int frames[MAX_FRAMES];
bool is_frame_full[MAX_FRAMES] = { false };
for (int i = 0; i < num_frames; i++) {
frames[i] = -1;
}
f... | ALGO | 0.999744 | 6.237641 |
2b9eb9d9-2ff5-4efa-93b7-8fcbd1b3d1e6 | xiongjun19/train_test | cuda_examples/6_Advanced/matrixMulDynlinkJIT/matrixMul_gold.cpp | ////////////////////////////////////////////////////////////////////////////////
// export C interface
extern "C"
void computeGold(float *, const float *, const float *, unsigned int, unsigned int, unsigned int);
////////////////////////////////////////////////////////////////////////////////
//! Compute reference dat... | ALGO | 0.993566 | 5.223782 |
c0f84626-f680-4ae4-9934-d4cae3a43a10 | wayandway/algorithms-cpp | BOJ/Graph/1937.cpp | #include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
const int MN = 501;
int dp[MN][MN];
int arr[MN][MN];
bool visit[MN][MN];
int N;
int di[4] = {1, 0, 0, -1};
int dj[4] = {0, 1, -1, 0};
int dfs(int i, int j) {
if(visit[i][j]) return dp[i][j];
... | ALGO | 0.999941 | 4.59431 |
f4b63f06-7205-488b-b64a-192740adc38b | alexjordan/otawa | otawa/src/cat/cat_CATBuilder.cpp | #include <elm/io.h>
#include <otawa/cat/CATBuilder.h>
#include <otawa/cache/LBlock.h>
#include <otawa/cache/LBlockSet.h>
#include <otawa/cfg.h>
#include <otawa/hard/CacheConfiguration.h>
#include <otawa/util/LBlockBuilder.h>
#include <otawa/hard/Platform.h>
#include <otawa/util/ContextTree.h>
#include <otawa/dfa/XCFGVi... | ALGO | 0.966082 | 4.982998 |
c693fcc9-bb18-45fd-bfae-31c988eb2510 | ZhenyingZhu/ClassicAlgorithms | src/CPP/src/epi/chapter5/ClosestIntSameBitCount.cpp | #include "../../epi/chapter5/ClosestIntSameBitCount.hpp"
#include <iostream>
#include <stdexcept>
#include "../../SmartPtr.h"
#include "../../SolutionCollection.h"
using std::invalid_argument;
namespace epi {
namespace chapter5 {
size_t ClosestIntSameBitCount::countBit(unsigned long x) {
size_t res(0);
... | ALGO | 0.999521 | 6.010717 |
d77667a1-d714-4554-aa5d-37eb5917c910 | imaiguo/VTK.9.3.0 | ThirdParty/libproj/vtklibproj/src/projections/tpeqd.cpp | #define PJ_LIB__
#include <errno.h>
#include "proj.h"
#include <math.h>
#include "proj_internal.h"
PROJ_HEAD(tpeqd, "Two Point Equidistant")
"\n\tMisc Sph\n\tlat_1= lon_1= lat_2= lon_2=";
namespace { // anonymous namespace
struct pj_opaque {
double cp1, sp1, cp2, sp2, ccs, cs, sc, r2z0, z02, dlam2;
double... | ALGO | 0.999358 | 5.620209 |
873214ea-34c6-464b-a7d5-5411b702373e | Sharknevercries/Online-Judge | POJ/1185 炮兵阵地.cpp | /* 14015116 840502 1185 Accepted 2720K 282MS G++ 1813B 2015-03-27 19:55:39 */
#include<bits\stdc++.h>
using namespace std;
int n, m;
int T[105];
int DP[105][70][70];
int state[70], digit[70], ptr;
bool check1(int state1){
if (state1 & (state1 << 1)) return false;
if (state1 & (state1 << 2)) return false;
return tru... | ALGO | 0.999794 | 3.512513 |
497ab760-8852-4555-89f6-41c9602c762d | Isaac-Graham/AlgorithmExercise | leetcode/1-20/2_Add_Two_Numbers.cpp |
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution
{
public:
ListNode *addTwoNumbers(ListNode *l1, ListNode *l2)
{
long long number1 = 0;
while (l1 != NULL)
... | ALGO | 0.999987 | 3.917524 |
4e2bedea-7370-4ad0-9908-63c8f7b29856 | Rajnandanikumari/STL | printsestring.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.983049 | 3.376151 |
d3092d79-7947-4bea-9638-94e6f0bcdb37 | RepoRogue123/DSA_Labs | DSA_labs/DSA_Lab_2/Question_5/Question_5.cpp | #include <bits/stdc++.h>
using namespace std;
class node {
public:
int val;
node* next;
node(int v = 0, node* nxt = NULL) {
val = v;
next = nxt;
}
};
class LinkedList {
public:
node* head;
LinkedList(node* h = NULL) {
head = h;
}
void insert(int val) {
... | ALGO | 0.999968 | 5.333326 |
5c1a3215-b6a9-4ccb-831a-d9298c38bbaa | Maryam593/Dive-In-cpp | Intro to cpp/Functions/Functions_in_cpp.cpp | #include<iostream>
using namespace std;
int sum(int a, int b){
return a+b;
}
//function overloading
int plusFuncInt(int x, int y) {
return x + y;
}
double plusFuncDouble(double x, double y) {
return x + y;
}
int main(){
//functions in cpp
cout<<"The sum of two number is "<<sum(5,6)<<endl;
int myNum1 ... | TOOL | 0.93189 | 4.664074 |
587bae10-f1ae-4383-9d8e-8153336cdf29 | weiii8708271688/UVA | UVA/798/30776475_AC_970ms_0kB.cpp | #include <vector>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <ctime>
using namespace std;
int w[11];
int h[11];
int num[11];
int W,H,n,ans;
bool grid[100][100];
bool drawtry(int x, int y, int tempw, int temph) {
if (x + tempw > W || y ... | ALGO | 0.999319 | 3.870957 |
73b32d68-742b-4d44-a88f-0adff27f544c | vivacejr/Competitive-Programming | Algorithms_and_StandardTricks/lazyPropagation.cpp | /*horrible queries spoj*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
ll tree[4*100000];
ll lazy... | ALGO | 0.996023 | 3.764917 |
6387f33c-a25a-4acd-9d0f-66012548f7f8 | MNivar/udemy | Section7/Challenge/main.cpp | /* Section 7
Challenge
Write a C++ program as follows:
Declare 2 empty vectors of integers named
vector1 and vector 2, respectively.
Add 10 and 20 to vector1 dynamically using push_back
Display the elements in vector1 using the at() method as well as its size using the size() met... | ALGO | 0.965217 | 3.89689 |
fb458198-0230-46bd-abfb-a0c64c3c92e4 | iamjhpark/BOJ | 1697.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
vector<bool> check = vector<bool>(200001, true);
int BFS(pair<int, int> p, int E) {
int count = 0;
queue<pair<int, int>> q;
q.push(p);
int first = p.first;
check[first] = false;
while (!q.empty())... | ALGO | 0.999646 | 3.692256 |
9b7768fe-6670-421a-84c0-bcf022b51ddc | Aman-Burnwal/dsa-basic-to-advance-using-cpp | self practice/009 pattern/pascal_traingle.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
int c = 1;
for (int j = 1; j <= i; j++) {
cout << c << " ";
// fourmula for pascal traingle
c = c * (i - j) / j;
}
cout << endl;
... | ALGO | 0.999973 | 4.053704 |
62ade070-95fb-4743-b494-2482f4ebc9af | KhangPham205/ControlStructeExercise | LTHAM/133/133.cpp | #include <iostream>
using namespace std;
void Nhap(float&);
void KiemTra(float, float, float);
void Xuat(float);
int main()
{
float x;
cout << "Nhap canh thu nhat: ";
Nhap(x);
float y;
cout << "Nhap canh thu hai: ";
Nhap(y);
float z;
cout << "Nhap canh thu ba: ";
Nhap(z);
cout << "Canh thu nhat: " << endl;... | ALGO | 0.950059 | 3.749047 |
9dc95e01-402e-44d6-a8da-86d147c5c3b8 | poravv/ruletaflutter | 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.998667 | 6.789978 |
656f1c9f-63f8-4e23-9026-0ea5cc221d2e | zz-fz-john/MY_OAT | oat-llvm40/tools/llvm-clang/lib/AST/VTableBuilder.cpp | #include "clang/AST/VTableBuilder.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Format.h"... | TOOL | 0.934111 | 7.185524 |
23876bd2-a6b7-4035-9072-a4538c7fe720 | HAIDER-NASIR9910/PROJECT | nv,.cpp | #include <iostream>
using namespace std;
string nam(char name[20])
{
if (name == '\0')
{
return 0;
}
else
{
cout<<name;
return nam(name-1);
}
}
int main()
{
int size;
cout<<"enter the size of the array"<<endl;
cin>>size;
char name[size];
cout<<"ENTER THE NAME"<<endl;
cin>>name;
cout<<"size of t... | TOOL | 0.903592 | 3.271311 |
8d9b95cf-7c36-4085-ace8-9135b7c1d1a1 | FeverDream-cy/Data_Structures_and_Algorithms_PTIT | Sort and Search/DSA06021 - TÌM KIẾM TRONG DÃY SẮP XẾP VÒNG.cpp | // Created by Nguyễn Mạnh Quân
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz size()
#define ll long long
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define F(i, a, b) for(int... | ALGO | 0.99998 | 4.726448 |
a9dd2f0e-0619-4162-b396-17448a8a2031 | Kim-Ziho/CppAlgorithm | 코드트리/우리는_하나/우리는하나.cpp | #include <iostream>
#include <queue>
using namespace std;
struct Node {
int y;
int x;
};
int N; //격자크기
int K; //도시 수
int U; //높이차 U이상
int D; //높이차 D이하
int arr[8][8];
int maxi;
void input() {
cin >> N >> K >> U >> D;
for (int y = 0; y < 8; y++) {
for (int x = 0; x < 8; x++) {
cin >> arr[y][x];
}... | ALGO | 0.994894 | 4.006206 |
7d4b8dbb-0444-407a-a464-1e9f671e8d4f | nxdxml/code_lc_cf | ling_day/1837D.cpp | #include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef pair<int, int > PII;
typedef long long LL;
// const int N = 1e5 + 5;
void solve(){
int n;
cin >> n;
string s;
cin >> s;
int t = 0;
vector<int> ans(n);
bool fg1 = 1, fg2 = 1;
for(int i = 0; i < n; i ++ ){
if(s... | ALGO | 0.999472 | 3.833896 |
592b2d62-f8aa-496c-bafe-bc0c39c906fb | damianoognissanti/generateCostGradHessPython | amici_models/Bachmann_MSB2011/Bachmann_MSB2011_xdot.cpp | #include "amici/symbolic_functions.h"
#include "amici/defines.h"
#include "sundials/sundials_types.h"
#include <gsl/gsl-lite.hpp>
#include <algorithm>
#include "Bachmann_MSB2011_x.h"
#include "Bachmann_MSB2011_p.h"
#include "Bachmann_MSB2011_k.h"
#include "Bachmann_MSB2011_w.h"
#include "Bachmann_MSB2011_xdot.h"
nam... | ALGO | 0.99908 | 3.634863 |
cf8bbdba-737d-4b64-97c8-992bea3d4184 | Selvakumar1410/FOC-PRACTICALS- | FOC(Experiment 43).cpp | #include <stdio.h>
#define NUM_HOURS 24
#define NUM_DAYS 14
#define MIN_EMPLOYEES 3
#define EMPLOYEES_PER_20_CUSTOMERS 1
int main() {
int customers[NUM_HOURS][NUM_DAYS];
int average_customers[NUM_HOURS];
int average_employees[NUM_HOURS];
for (int i = 0; i < NUM_DAYS; i++) {
printf("Enter the ... | ALGO | 0.998348 | 5.044796 |
c2bbe20f-4775-40c0-9b98-ba4e0078a6f2 | Andrew-liu/Leetcode | SearchForARange.cpp | // 首先使用二分查找找到一个节点, 然后左右扫描找到对应的左右边界
class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
vector<int> ranges;
int len = nums.size();
int index = binarySearch(nums, target);
if(index == -1) { //没有符合条件的target
ranges.push_back(-1);
rang... | ALGO | 0.99999 | 6.350008 |
d3606235-b367-41ff-940a-253f5be453d5 | HPC-AI-Team/lammps-fugaku-threadpool-sc23 | lib/linalg/dlaed9.cpp | #ifdef __cplusplus
extern "C" {
#endif
#include "lmp_f2c.h"
static integer c__1 = 1;
int dlaed9_(integer *k, integer *kstart, integer *kstop, integer *n, doublereal *d__, doublereal *q,
integer *ldq, doublereal *rho, doublereal *dlamda, doublereal *w, doublereal *s,
integer *lds, integer *info)
... | ALGO | 0.998159 | 3.083215 |
2e945426-c270-4a92-80a9-b74688a23654 | turnjp/CompetitionProgramming | AtCoder/agc014/agc014_a.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b,c;
cin >> a >> b >> c;
int pa,pb,pc;
int cnt = 0;
while(a%2!=1 && b%2!=1 && c%2!=1){
cnt++;
pa = a;
pb = b;
pc = c;
a = pb/2 + pc/2;
b = pa/2 + pc/2;
c = pa/2 + pb/2;
... | ALGO | 0.999929 | 4.344623 |
85f38818-3713-4801-895a-76f0366e1b61 | esix/competitive-programming | e-olymp/~contest-8860/D/main.cpp | #include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
using namespace std;
int gcd(int m, int n) {
if (m == 0) return n;
if (n == 0) return m;
if (m == n) return m;
if (m == 1) return 1;
if (n == 1) return 1;
bool m_even = ((m & ... | ALGO | 0.999894 | 5.168745 |
e3e88ee3-cc88-48d6-ad5e-f5db16bd83f2 | vuphan314/phd-thesis | lg/solvers/htd-master/src/htd/SemiNormalizationOperation.cpp | #ifndef HTD_HTD_SEMINORMALIZATIONOPERATION_CPP
#define HTD_HTD_SEMINORMALIZATIONOPERATION_CPP
#include <htd/Globals.hpp>
#include <htd/SemiNormalizationOperation.hpp>
#include <htd/WeakNormalizationOperation.hpp>
#include <htd/IMutableTreeDecomposition.hpp>
#include <htd/LimitChildCountOperation.hpp>
/**
* Private ... | TOOL | 0.985895 | 7.220918 |
cc12d369-78d4-4be7-a661-3a389225601a | yaram/simple-compiler | thirdparty/llvm-project/llvm/lib/CodeGen/MachineCycleAnalysis.cpp | #include "llvm/CodeGen/MachineCycleAnalysis.h"
#include "llvm/ADT/GenericCycleImpl.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/MachineSSAContext.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/InitializePasses.h"
using namespace llvm... | ALGO | 0.90735 | 7.85878 |
f3b54abe-87b4-47d4-b9f9-ec5c4390557c | chiragHORSE12/SUPREME-BATCH | week14(tree)/lecture04/boundary_traversal.cpp | #include<iostream>
#include<queue>
#include<map>
#include<vector>
using namespace std;
class node{
public:
int data;
node*left;
node*right;
node(int data){
this->data=data;
left=NULL;
right=NULL;
}
};
node* buildtree(){
int data;
cout<<"enter the value of node :"... | ALGO | 0.999894 | 3.957287 |
d8d065c5-7083-4024-8bd3-e756806d78bc | KalawelaLo/Kattis | PrimePath/main.cpp | #include <iostream>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
const int size_of_primes = 1061; //the number of primes where 1000<x<9999
bool isPrime(int w){ //
int w_lim = sqrt(w) + 1;
for(int i = 3; i < w_lim; i+=2){
if(w%i==0){
return false;
}
}
... | ALGO | 0.999541 | 4.139072 |
ccdd5d08-fb6c-4b26-9edb-71c5a329973c | ChoiCube84/baekjoon-solutions | 16061/source.cpp | #include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pll = pair<ll, ll>;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll n, d, k;
cin >> n >> d >> k;
vector<pair<ll, string>> emp... | ALGO | 0.999745 | 4.215139 |
53a9a627-a136-4722-aa0a-438d791019d1 | pinegreen83/codetree-TILs | 240719/앞의 두 수를 더한 수열 2/a-sequence-by-adding-the-previous-two-numbers-2.cpp | #include <iostream>
#define MAX_N 90
using namespace std;
long long nums[MAX_N+1];
int main() {
// 여기에 코드를 작성해주세요.
nums[1] = 1;
nums[2] = 1;
int n;
cin >> n;
for(int i=3; i<=n; i++) nums[i] = nums[i-2] + nums[i-1];
cout << nums[n];
return 0;
} | ALGO | 0.999981 | 4.134393 |
ce288a1d-7a3e-43eb-a8e2-385623693b17 | Xtended-Devices/android_device_xiaomi_violet | gps/utils/loc_misc_utils.cpp | #define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_misc_utils"
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <dlfcn.h>
#include <math.h>
#include <log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
#include <fcntl.h>
#include <inttypes.h>
#ifndef MSEC_IN_ONE_SEC
#define MSEC_IN_ONE_SEC 1000UL... | TOOL | 0.960174 | 5.919974 |
83165f56-5128-42d1-94c2-c2869288b661 | shelltdf/osgall | prebuild/bullet3-2.83.7/src/Bullet3OpenCL/BroadphaseCollision/b3GpuParallelLinearBvhBroadphase.cpp | /*
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it f... | ALGO | 0.928253 | 6.113014 |
230b0965-e575-4219-b952-2ddeedb76348 | trilinos/Trilinos | packages/ml/examples/Advanced/ml_user_aggr.cpp | /* ******************************************************************** */
/* person and disclaimer. */
/* ******************************************************************** */
// \author Marzio Sala, SNL 9214
// \data Last modified on 05-Dec-04
#include "ml_include.h"... | ALGO | 0.999881 | 3.971546 |
5d02f3cf-1ebc-4031-be07-7634fb539d0d | UEFI-code/PyTorch_For_PoorGuys | torch/csrc/jit/codegen/cuda/root_domain_map.cpp | #include <torch/csrc/jit/codegen/cuda/ir_iostream.h>
#include <torch/csrc/jit/codegen/cuda/ir_utils.h>
#include <torch/csrc/jit/codegen/cuda/iter_visitor.h>
#include <torch/csrc/jit/codegen/cuda/root_domain_map.h>
#include <sstream>
namespace torch {
namespace jit {
namespace fuser {
namespace cuda {
std::unordered_... | TOOL | 0.945729 | 6.99275 |
bed8a9b1-e4fe-42e7-87d7-007b8649887e | JackyXu866/LeetCodeSoln | 1379_FindaCorrespondingNodeofaBinaryTreeinaCloneofThatTree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* getTargetCopy(TreeNode* original, TreeNode* cloned, TreeNode* target) {
queu... | ALGO | 0.999757 | 5.320703 |
f4c5eeaa-43b9-48ce-9ab7-01bb1125061d | abhishek9125/DSAlgoSet | Stacks/01. Implementation Using Arrays.cpp | class ArrayStack {
private:
int topIndex;
int *stackArr;
int capacity;
public:
ArrayStack(int size = 1000) {
capacity = size;
topIndex = -1;
stackArr = new int[capacity];
}
void push(int x) {
if(topIndex != capacity - 1) {
stackArr[++topIndex] =... | TOOL | 0.889971 | 5.461334 |
d99b41eb-6430-491d-bfce-035afddf7894 | Sandigupta/Problem_Sets_DSA_Fundamentals_C_plus_plus | Function/to_find_area_and_parameter_ofCircle.cpp | // #include<iostream>
// using namespace std;
// void area_parametr(int );
// int main(){
// int r;
// cout<<"Enter the radius: ";
// cin>>r;
// area_parametr(r);
// }
// void area_parametr(int x){
// cout<<"Parameter="<<(2*3.14*x)<<endl;
// cout<<"Area="<<(3.14*x*x)<<endl;
// }
/*<------... | TOOL | 0.989801 | 4.681386 |
d8aafd28-4ffe-40b5-aeeb-5e55b85e21d3 | raincross7/code-similarity | codes/train_code/problem244/problem244_492.cpp | #pragma GCC optimize("O3") //コンパイラ最適化用
#define _GLIBCXX_DEBUG //配列に[]でアクセス時のエラー表示
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはメントされる
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i... | ALGO | 0.999294 | 3.821438 |
24b4b606-fda7-4b4a-9d09-23cefc891611 | bioexcel/bioexcel-code-releases | GROMACS/gromacs-2018.3/src/gromacs/linearalgebra/gmx_lapack/slascl.cpp | #include <cctype>
#include <cmath>
#include "gromacs/utility/real.h"
#include "../gmx_lapack.h"
#include "lapack_limits.h"
void
F77_FUNC(slascl,SLASCL)(const char *type,
int *kl,
int *ku,
float *cfrom,
float *cto,
... | ALGO | 0.984212 | 4.349483 |
512622d4-882d-4009-9c75-144742c43913 | YonghoAhn/DataStructureAssignment | Assignment67/main.cpp | #include <iostream>
#include "String.h"
#include "Calculator.h"
using namespace std;
int main(int argc, char* argv[])
{
char expr[1000];
Calculator c = Calculator();
cout << " ԷϽÿ : ";
cin.getline(expr, 1000);
c.setExpression(expr);
String posfix = c.getPostFix();
cout << "ǥ : " << posfix << " : " << c.g... | ALGO | 0.957245 | 4.419394 |
d82c46e1-b928-463f-9443-c43509b77eb7 | DARSHAN-THE-CODER/Leetcode-solutions | 42-trapping-rain-water/trapping-rain-water.cpp | class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
int left = 0;
int right = n-1;
int leftMax = 0, rightMax = 0, ans = 0;
while(left < right){
if(height[left] < height[right]){
if(height[left] > leftMax) leftMa... | ALGO | 0.999987 | 6.785484 |
de1520fd-5a5a-4fbe-9acd-78af12433dec | sheninthjr/BugBash | Debug/C++/10.cpp | // Implement a function to generate all possible combinations of a given length from a list of unique integers.
#include <iostream>
#include <vector>
using namespace std;
void backtrack(vector<int> &arr, int k, int start, vector<int> &curr, vector<vector<int>> &result);
vector<vector<int>> combinations(vector<int> ... | ALGO | 0.995474 | 5.497513 |
eca5259e-9cc9-4dc7-aa74-d79dfd8602c1 | gauravshinde19/CPP-Programs | Recursion/printNumbers.cpp | // Program to accept number from user and print numbers till that number using recursion
#include <iostream>
using namespace std;
void Display(int iNo)
{
static int i = 1;
if (i <= iNo)
{
cout << i << endl;
i++;
Display(iNo);
}
}
int main()
{
int iValue = 0;
cout << ... | ALGO | 0.999799 | 4.452349 |
7af09caf-9b74-4730-acd8-ad9be9ffc063 | ZeroFive0505/Omok | Omok/omok.cpp | #include "pch.h"
#include "omok.h"
STAT Buffer[SIZE][SIZE];
STAT Screen[SIZE][SIZE];
bool black_turn;
int cur_x;
int cur_y;
bool game_end;
void GotoXY(int x, int y)
{
COORD new_coord = { x * 2, y };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), new_coord);
}
void Initialize()
{
black_turn = true;
gam... | ALGO | 0.951727 | 4.53618 |
55293e60-d935-489f-bb41-2fee1a39fa97 | pavel-ryzhov/global_vars | runs/008154.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using std::vector;
struct graph_node {
size_t outgoing;
size_t edge_weight;
graph_node(): outgoing(0), edge_weight(0){}
graph_node(size_t outgoing, size_t distance): outgoing(outgoing), edge_weight(distance) {}
};
struct tree_node {
unsigned long ... | ALGO | 0.999422 | 4.361609 |
9a15cf48-7846-458a-9a1a-5618ac76a92c | tahmid678/Online-Judge-Solutions | LeetCode/141. Linked List Cycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode* head) {
ListNode* node1 = head;
ListNode* node2 = head;
while (node1 && node2) {
... | ALGO | 0.999709 | 5.4388 |
c84f596e-c697-4681-9800-a72fd968679d | ellyheetov/Problem-Solving | Programmers/C++/43104_타일_장식물.cpp | //
// Created by 박혜원 on 2020/07/06.
//
#include <string>
#include <vector>
#include <iostream>
using namespace std;
long long solution(int N) {
long long answer = 0;
vector<long> dp(N, 0);
dp[0] = 1;
dp[1] = 1;
for (int i = 2; i < N; i++) {
dp[i] = dp[i - 1] + dp[i - 2];
}
answer... | ALGO | 0.999986 | 5.130591 |
f08e7d58-e747-43ab-8601-77d1366c34e1 | MSKim0215/Algorithm | 프로그래머스/lv0/120829. 각도기/각도기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int angle) {
if(angle > 0 && angle < 90)
{
return 1; // 예각
}
else if(angle == 90)
{
return 2; // 직각
}
else if(angle > 90 && angle < 180)
{
return 3; // 둔각
}
else if(a... | ALGO | 0.999538 | 4.60076 |
d9471445-50f5-4bc6-a124-b3397598ac29 | zegiha/algorithm | sliver/1541/1541.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string str; cin >> str;
string newNumber;
int ans = 0;
bool sw = false;
for(int i = 0; i < str.size(); i++) {
if(str[i] == '+' || str[i] == '-') {
int n = stoi(newNumber);
if(sw) {
ans -= n;
} else {
... | ALGO | 0.999957 | 4.43712 |
ea336658-f914-442b-8c96-810efd8003a9 | sahadat-11/Codeforces | 1526/C1.cpp | //In The Name of ALLAH
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
#define int long long
void solve() {
int n; cin >> n;
vector<int> a(n), neg;
int sum = 0, cnt = 0;
priority_queue<int> pq;
for(int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
cnt++;
if(a[i] < 0... | ALGO | 0.999981 | 4.700983 |
1c987e41-441d-4abb-af4a-9f2c1df6c86f | MaZeSA/CPP-OOP | Semestr_0/HomeWork/123/HomeWorkMarch/HomeWork12/HomeWork12.cpp | //Класна задача
//Поєднання двох відсортованих масивів, по зростаючій без використання сортування
#include <Windows.h>
#include <iostream>
using namespace std;
/// <summary>
/// Обєднати масиви
/// </summary>
/// <param name="mas1">масив 1</param>
/// <param name="countItemMas1">кількість елемантів масива 1</param>
//... | ALGO | 0.998892 | 3.677863 |
2e477f99-6d4d-48e8-a3db-91541d0a953a | marsicplusplus/ItalianPlug | src/mesh_repair.cpp | // Original demp implmentation of hole_fixer from GitHub User Erkaman https://github.com/Erkaman/hole_fixer
// Modified to work with our content retrieval program
#include "mesh_repair.hpp"
#include <igl/boundary_loop.h>
#include <igl/cat.h>
#include <igl/colon.h>
#include <igl/slice.h>
#include <igl/upsample.h>
#incl... | ALGO | 0.997457 | 5.950716 |
3052ef86-4dcf-470a-87f5-3c80cd8024ac | ishandutta2007/codeforces | cyand1317/normal/81/C.cpp | #include <cstdio>
#include <algorithm>
#include <utility>
static const int MAXN = 100004;
int n, a, b;
std::pair<int, int> t[MAXN];
int f[MAXN];
inline bool pair_cmp_1(const std::pair<int, int> &lhs, const std::pair<int, int> &rhs) {
return (lhs.first == rhs.first) ? (lhs.second < rhs.second) : (lhs.first < rhs.f... | ALGO | 0.999921 | 3.122343 |
9dfe2e28-5f35-4c07-877e-ae17983e2e03 | ferry-hhh/CXL-DMSim | src/systemc/tests/systemc/misc/synth/combo/switch3/switch3.cpp | /*****************************************************************************
switch3.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | TOOL | 0.944538 | 4.566834 |
4c332a4a-8cb2-4f07-ac1c-7eab9ea32cdf | yash291/DsaPractice_C_plus_plus | Pattern/dabangg_pattern.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
int i = 1;
while(i <= n){
//first triangle
int j = 1;
while(j <= n - i + 1){
cout << j;
j += 1;
}
int star = 2*i - 2;
while(star){
cout << "*";
... | ALGO | 0.999963 | 3.730671 |
f3537419-0c80-47cf-a28b-a3338a15cc61 | QbitQuantum/Basics | Исходники/BigInt.cpp | void Bigint::internalDivide(const Bigint& number, const bool& isDecimal, const int& precision)
{
std::string mstring;
std::vector<int> mparts;
std::string fnvalue = toString();
std::string snvalue = number.toString();
if(fnvalue.length()>snvalue.length())
{
if(!number.isPositive)
mstring = snvalue.substr(1);... | ALGO | 0.997098 | 4.758929 |
e86320cd-f53f-4a6b-a568-40602eb362a9 | homer6/c_reading | llvm/lib/Transforms/Utils/InlineFunction.cpp | #include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Intrinsics.h"
#include "llvm/Attributes.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/DebugInfo.h... | TOOL | 0.992943 | 7.591573 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.