uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
24770ce2-55b3-4a38-987b-974aa6fc85da | PhuocVinhLee/online_system_exam_quiz_programming | online_exam_system_backend/temp/bz8yyoe.cpp | #include <stdio.h>
int main() {
int number1, number2, sum;
printf("Enter two integers: ");
scanf("%d %d", &number1, &number2);
// calculate the sum
sum = number1 + number2;
printf("%d + %d = %d", number1, number2, sum);
return 0;
}
| TOOL | 0.976343 | 4.438632 |
0304352c-ba4a-49a8-8a59-e10fb553ffd4 | hexwhiz/AC-POTD | Day3/task1.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> smallerNumbersThanCurrent(vector<int>& nums) {
int n=nums.size();
vector<int> ans(n);
// create a sorted hash table of <value,index list> pair
map<int,vector<int>> hash;
for(int i=0;i... | ALGO | 0.999992 | 5.585996 |
6dfaf27e-e707-45b6-bf0e-58fe61592869 | joshua-jin/algorithm-campus | chingjun/181-flip-bits.cpp | class Solution {
public:
/**
*@param a, b: Two integer
*return: An integer
*/
int countOnes(int num) {
num = ((num & 0xAAAAAAAA) >> 1) + (num & 0x55555555);
num = ((num & 0xCCCCCCCC) >> 2) + (num & 0x33333333);
num = ((num & 0xF0F0F0F0) >> 4) + (num & 0x0F0F0F0F);
... | ALGO | 0.999938 | 5.810624 |
cef6ecb4-41f4-401e-931a-648ea5dded41 | magyarakoos/contest-prog | codeforces/archive/996A/main.cpp | #include <bits/stdc++.h>
#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()
#define has(s, e) s.count(e)
using namespace std;
using ll = long long;
using point = array<int, 2>;
int main() {
speed;
int N, result = 0, amountS[5] = {1... | ALGO | 0.999519 | 3.806392 |
bd8721ff-6ad4-48ba-b31a-4a1dd142ac08 | Coach-Academy/Winter-2-2023 | Level 2/Class 3/Practice G1/Week 15/i.cpp | #include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typed... | ALGO | 0.999942 | 4.472939 |
03cbb9c3-2a16-4571-b0a7-b0273d6681dd | Instantbitex/source-code | src/rpcmining.cpp | #include "main.h"
#include "db.h"
#include "txdb.h"
#include "init.h"
#include "miner.h"
#include "bitcoinrpc.h"
using namespace json_spirit;
using namespace std;
Value getsubsidy(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"getsubsidy [nTarget]\n"
... | WEB | 0.892038 | 4.743596 |
6318c0b7-7c0a-4f1d-b143-1d92b7d7d404 | zkxshg/Test_of_LeetCode | 817_Linked_List_Components.cpp | // Transform to calculate the number of connected links by hash table
class Solution {
public:
int numComponents(ListNode* head, vector<int>& G) {
if (!head || G.size() == 0) return 0;
if (G.size() == 1) return 1;
unordered_map<int, int> linkDict;
unordered_map<int, int> fre... | ALGO | 0.999959 | 5.766132 |
71bfe128-6233-40f1-ba88-3d17b64e1866 | namnguyen215/CTDLGT | giaiMaXauKiTu.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
string s;
cin>>s;
stack<int> nu;
stack<char> st;
string r="";
for(int i=0;i<s.length();i++){
if(s[i]=='['){
if(s[i-1]>='0'&&s[i-1]<='9') st.push(s[i]);
... | ALGO | 0.998191 | 4.363606 |
c6ff2b09-995f-41a4-8bd4-7db5aa55d74b | aditya1944/Scaler-Questions | deleteDuplicates.cpp | #include<iostream>
struct ListNode{
int val;
ListNode* next;
ListNode(int x) : val(x), next(NULL){}
};
ListNode* solve(ListNode *head){
ListNode *temp = head;
while(temp!=NULL){
if(temp->next && temp->val==temp->next->val){
//then there is duplicates
//1->2->3->3->4
... | ALGO | 0.999841 | 3.810306 |
5b07e3e4-fef1-420e-9415-37aaad57d2f1 | pnayak1501/cpp | 14bitmanipulation/no_of_ones_in_bit_representation.cpp | // Number of ones in the binary representation of a number
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int numberofones(int n){
int count = 0;
while(n){
n = n & (n-1);
count++;
}
return count;
}
int main() {
int n;
cin>>n;
cout<<"Number of ones ar... | ALGO | 0.999771 | 5.553366 |
0d1dd6a6-6fb1-4597-aa07-7e0046a5c647 | ehnryx/acm | acpc-2016/b.cpp | #include <bits/stdc++.h>
using namespace std;
#include "../../lca/misc/fast_input.h"
using ll = long long;
using ld = long double;
using pt = complex<ld>;
constexpr char nl = '\n';
constexpr int MOD = 998244353;
constexpr ld EPS = 1e-9L;
random_device _rd; mt19937 rng(_rd());
const int N = 1e4 + 1;
int h[N], e[N];
... | ALGO | 0.999876 | 5.112162 |
0059c16d-f383-479e-86b3-88432b67748d | Bhavikasingla/Prebytes-Solutions | Strings/Playing Cards.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
char arr[2];
for(int i=0;i<2;i++){
cin>>arr[i];
}
char arr2[10];
for(int i=0;i<10;i++){
cin>>arr2[i];
}
bool check=false;
for(int i=0;i<10;i++){
... | ALGO | 0.999782 | 3.346737 |
0e8283b0-b4ca-4a6a-b5f8-0d1814b2e08a | pranavjawale01/cp.exe | LeetCode/0080-remove-duplicates-from-sorted-array-ii/0080-remove-duplicates-from-sorted-array-ii.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int count = 0;
unordered_map<int, int> mp;
int n = nums.size();
for (int i = 0; i < n; i++) {
mp[nums[i]]++;
if (mp[nums[i]] <= 2) {
nums[count++] = nums[i];
}
... | ALGO | 0.999818 | 6.610114 |
0af583ca-0e03-40d2-8af3-5376045195f2 | Fresh-hongsi/BaekjoonCpp | 6064-카잉달력.cpp | //MATH
//NUMBER THEORY
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tc = 0;
cin >> tc;
while (tc--) //TC마다 연산 후 출력
{
int M = 0;
int N = 0;
int x = 0; //대상이 존재하는 지 확인할 X -> M에 ... | ALGO | 0.999887 | 3.933971 |
8a843f15-5fa5-4f9d-a571-3b08e64070c6 | sarvex/leetcode-machine | solution/1400-1499/1489.Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/Solution.cpp | class UnionFind {
public:
vector<int> p;
int n;
UnionFind(int _n)
: n(_n)
, p(_n) {
iota(p.begin(), p.end(), 0);
}
bool unite(int a, int b) {
if (find(a) == find(b)) return false;
p[find(a)] = find(b);
--n;
return true;
}
int find(in... | ALGO | 0.999987 | 5.350977 |
110473fc-7353-438b-8d43-2fc85b013f3f | parkblo/problem-solving | Baekjoon/Silver/12852_1로_만들기_2.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int num[1000001], N;
int path[1000001];
cin >> N;
num[1] = 0; path[1] = 0;
for (int i=2; i<=N; i++)
{
num[i] = num[i-1] + 1;
path[i] = i-1;
if (i%2==0 && num[i] > num[i/2]+1)
{
num[i] = num[i/2]+1;
path[i] = i/2;
}
if (... | ALGO | 0.999987 | 3.678898 |
56617282-4e90-40cf-8367-6e65b62bb3b7 | salmonmoose/accidentalnoise | src/implicitbasisfunction.cpp | #include "implicitbasisfunction.h"
#include <cmath>
#include "random_gen.h"
using namespace anl;
std::map<std::string, EInterpTypes> CImplicitBasisFunction::InterpMap = {
{"NONE", NONE},
{"LINEAR", LINEAR},
{"CUBIC", CUBIC},
{"QUINTIC", QUINTIC}
};
std::map<std::string, EBasisTypes> CImplicitBasisFun... | ALGO | 0.932362 | 7.404011 |
9c9de8df-fb01-4531-ba97-0972818c0260 | cpuwhiz11/CS-School-Work | 201/prog1111/prog1111.cpp | /*
* File: prog1111.cpp
* Author: Paul
*
* Created on November 23, 2010, 6:13 PM
*/
#include <iostream>
#include "Polynomial.h"
using namespace std;
int main() {
Polynomial poly1, poly2, poly3, poly4 ;
poly1.enterTerms() ;
poly2.enterTerms() ;
poly4 = poly1 ;
cout << "The first polynom... | ALGO | 0.924064 | 4.045532 |
035af76a-c981-456f-8d2b-4ea516da7515 | pari-1920/godot.py | thirdparty/oidn/mkl-dnn/src/cpu/gemm/s8x8s32/simple_gemm_s8s8s32.cpp | #include "common.hpp"
#include "nstl.hpp"
#include "math_utils.hpp"
#include "../gemm.hpp"
#include "jit_avx512_core_gemm_s8u8s32.hpp"
namespace mkldnn {
namespace impl {
namespace cpu {
void compensation_init(const char *offsetC, int32_t *compensation, int len,
const int32_t *oc) {
bool OCisC = (*offset... | ALGO | 0.969531 | 6.022329 |
51ce9fe4-7282-4729-a261-05e6886d75e7 | matthriscu/CSES | maximum_subarray_sum_ii.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
vector<long long> v(n + 1);
v[0] = 0;
for (int i = 1; i <= n; ++i)
cin >> v[i];
partial_sum(v.begin(), v.end(), v.begin());
long long mx = LLONG_MIN;
deque<... | ALGO | 0.999849 | 3.765275 |
72b93c8e-cff7-4961-87cf-4a4acf47b3b5 | Hamza-ALyemeni/recursive-functions-cpp | Homework/01/homework_05_answer.cpp | #include<iostream>
using namespace std;
double arr_average(double arr[], int len) {
if (len == 1)
return arr[0];
double sub_result = arr_average(arr, len - 1);
// Now this was average of len-1. So sum / (len-1)
sub_result = sub_result * (len-1);
return (sub_result + arr[len - 1] ) / len;
}
int main() {
do... | ALGO | 0.990367 | 4.320374 |
15713209-6fb9-4f50-8e4a-3bcc1a714556 | zhiwei-pg/ELEC5660_Proj2_Ubuntu20 | tag_detector/src/tag_detector_node.cpp | #include <iostream>
#include <ros/ros.h>
#include <ros/console.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/image_encodings.h>
#include <cv_bridge/cv_bridge.h>
#include <nav_msgs/Odometry.h>
#include <opencv2/opencv.hpp>
#include <opencv2/aruco.hpp>
#include <board.h>
#include <Eigen/Eigen>
#include <Eigen/... | ALGO | 0.98611 | 5.335192 |
ecc3429f-91b5-45ed-8ca8-f2dd5aec187f | lakpahana/kattis_solutions | billiard.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
const double PI = 3.14159265358979323846;
pair<double, double> calculateLaunchParameters(int a, int b, int s, int m, int n) {
double vx = a * m / (2.0 * s);
double vy = b * n / (2.0 * s);
double velocity = sqrt(vx * vx + vy * vy... | ALGO | 0.987671 | 3.600643 |
9899c9b3-917e-4b4f-ac3f-99a7edcad01d | gokul19032005/8971324934_parvam_CEC_GOKUL | cpp_training/day_1/prg82.cpp | #include <iostream>
using namespace std;
int main() {
char ch;
cout << "Enter a character: ";
cin >> ch;
// Check if the character is a vowel
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' ||
ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') {
cout <... | ALGO | 0.975313 | 6.019587 |
07d0fe38-4f56-4ff6-82cb-82586b767490 | jiahengcen/Android12Framework | frameworks/av/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "Mixer_private.h"
#include "LVM_Macros.h"
/********************************************************************************... | ALGO | 0.995255 | 5.104463 |
7fd47162-e924-473c-b287-8e57fb26da34 | Ajaykurmi/dsalgo | replacingestring.cpp | /* Write a method to replace all spaces in a string with ‘%20’*/
#include<iostream>
using namespace std;
class StringReplace{
public: char* replaceSpace(char *arr){
int i=0;
int j=0;
char *dynamic;
dynamic = (char *) malloc(sizeof(char));
for (int i = 0; arr[i]!='\0'; ++i)
{
if(arr[i]==32){
dynamic... | TOOL | 0.915476 | 3.9306 |
6859554a-e5f6-4685-bcc3-6d2541b69edb | Bijoy227/Codeforces | 38.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int sol=1;
for (int i=2;i<=n;i++)
sol+=4*(i-1);
cout<<sol<<endl;
}
| ALGO | 0.999744 | 3.686558 |
c5440f5b-c2ac-4a54-a43e-0b9d0ea5bf13 | hexu1985/cpp_book_code | cpp.primer.3e/algorithm/generate/generate_demo.cpp | #include <algorithm>
#include <list>
#include <iostream>
using namespace std;
int odd_by_twos() {
static int seed = -1;
return seed += 2;
}
template <class Type>
void print_elements( Type elem ) { cout << elem << " "; }
int main()
{
list< int > ilist( 10 );
void (*pfi)( int ) = print_elements;
generate( ilist... | TOOL | 0.993027 | 4.887536 |
e17e2736-4c9a-4e3d-9d4e-f466c9f82474 | kimoo112/Melodics | 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 |
b818e649-30cd-4eb2-9bb4-3deeae6e650e | BeanChuang/Practice | leetcode/graph/bfs/2608. Shortest Cycle in a Graph.cpp | class Solution {
public:
int findShortestCycle(int n, vector<vector<int>>& edges) {
// 1. bfs each node is not visited
// 2. update answer if we tarverse the same node again
// ans = min(ans, dis[i, j] + dis[i, k] + dis[j, k])
// TC : O(nm), SC : O(n + m), where m is edges length
... | ALGO | 0.999887 | 5.816285 |
327c4876-81f4-4402-993b-1ba095960e9c | sohan18011/Problem-Solving-In-different-online-judge | Uva/11.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll p[10000000];
ll pp[10000000];
int main()
{
ll i,j;
p[0]=0;
pp[0]=0;
p[0]=0;
pp[1]=0;
ll k=2;
for(i=2; i<10000000; i++)
{
if(p[i]==0)
{
for(j=i+i; j<10000000; j+=i)
{
... | ALGO | 0.999382 | 3.935067 |
30e1d3e9-de2a-4918-b988-0b6553681f43 | Rahulgoy/Data-Structures-and-Algo | striver_sde_sheet/day6-linked_list-II/31.intersection_of_linked_lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
//Method 1
// unordered_map<ListNode*,int> mp;
// ... | ALGO | 0.999886 | 5.306047 |
344bb69c-3a29-47a3-b9ba-4a12bf81ebf7 | ManojKumarPatnaik/Sr.SoftwareEngineerInterviewPrep | 04]. Coding Ninjas/1]. Practice/2]. Problem Lists/1]. Lists by Experts/1]. Striver SDE Sheet Problems/C++/139]. Construct BST from Preorder Traversal.cpp | /*************************************************************
Following is the Binary Tree node structure
template <typename T>
class TreeNode{
public:
T data;
TreeNode<T> *left;
TreeNode<T> *right;
TreeNode(T data) {
this->data = data;
left =... | ALGO | 0.999967 | 5.992378 |
da766b41-ae20-4be5-8f05-68382f52721b | Lubiyangka/AlgorithmProject | 数据结构与算法/算法/Kruskal.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Edge {
int src, dest, weight;
};
class Graph {
private:
int V; // 图中顶点的数量
vector<pair<int, pair<int, int>>> edges; // 边的集合
public:
Graph(int V) : V(V) {}
void addEdge(int src, int dest, int weight) {
... | ALGO | 0.999977 | 5.244558 |
44f81efe-dc22-4a37-910a-fa9e419ead3b | heiyedeshengyin/LinkedList | src/SingleLinkedList.cpp | #ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include<iostream>
using namespace std;
template <typename T>
struct Node //节点
{
T val; //节点的值
Node<T> *next; //下一个节点的指针
Node()
{
val = NULL;
next = NULL;
}
};
template <typename T>
class LinkedList //单链表
{
private:
Node<T> *head; //头节点
public:
LinkedList(); //默认构... | ALGO | 0.994747 | 4.635641 |
b105dec3-1686-486d-838e-a7e9ff917ce7 | aanda-stcloudstate-edu/WebSpace | cs201/Gaddis/9e/Labs/SourceCode/Lab5/sentinel.cpp | // This program illustrates the use of a sentinel in a while loop.
// The user is asked for monthly rainfall totals until a sentinel
// value of -1 is entered. Then the total rainfall is displayed.
// PLACE YOUR NAME HERE
#include <iostream>
using namespace std;
int main()
{
// Fill in the code to define and initia... | ALGO | 0.976424 | 3.527851 |
66de101c-0d09-41d7-8df4-4f3b1b318f8e | apaarkamal/LPU-Jun24 | cp/reverse_stack_using_recursion.cpp | #include<bits/stdc++.h>
using namespace std;
void pushAtBottom(stack<int> &St, int x) {
if (St.empty()) {
St.push(x);
return;
}
int val = St.top();
St.pop();
pushAtBottom(St, x);
St.push(val);
}
void reverseStack(stack<int> &St) {
if (St.empty()) return;
int x = St.top();
St.pop();
reverseStack(St);
... | ALGO | 0.999967 | 4.979798 |
0171f3fa-276c-40da-8152-3ebb2f36eecd | LegendreXu/DataStructure | Tree Reconstruction/Tree Reconstruction/main.cpp | #include <iostream>
#include <string>
using namespace std;
int search(int arr[], int x, int n){
for(int i = 0; i < n; i++){
if(arr[i] == x){
return i;
}
}
return -1;
}
void getpost(int in[], int pre[], int n, int fuck){
int root;
root = search(in,pre[0],n);
if... | ALGO | 0.999976 | 3.76271 |
85db0b63-03aa-499d-8cc7-6283bc4e0be0 | Prodigy343/CompetitiveProgramming | UVa/454.cpp | #include <bits/stdc++.h>
using namespace std;
struct word{
string w;
int count[94],wspace;
word(){
wspace = 0;
memset(count,0,sizeof(count));
}
void counting(){
for(int i=0;i<w.size();i++)if(w[i]!=32){count[w[i]-33]++;wspace++;}
}
void print(){
for (int i = 0; i < 94; ++i)
cout<<char(i+33)<<" => ... | ALGO | 0.999778 | 4.047451 |
3970dd6c-fd57-4418-954a-ffad6a5f79dd | Ajaymishra69/LeetCode-Practice-Problem | 0540-single-element-in-a-sorted-array/0540-single-element-in-a-sorted-array.cpp | class Solution {
public:
int singleNonDuplicate(vector<int>& nums) {
int n = nums.size();
int s = 0;
int e = n-1;
if(n==1)
return nums[0];
if(nums[0]!=nums[1])
return nums[0];
if(nums[e]!=nums[e-1])
return nums[e];
while(s<=e){
... | ALGO | 0.999899 | 5.77336 |
231aadae-5975-4e8e-983a-9d763c8e4443 | Ashish473797/Cpp-BootCamp | Assignment 33/1.cpp | /*Create a base class called shape. Use this class to store two double type values that could be used to compute the area of figures.
Derive two specific classes called triangle and rectangle from the base shape. Add to the base class, a member function get_data()
to initialise base class data members and another mem... | TOOL | 0.965702 | 6.654396 |
5fb1dd9d-9b1f-4b22-94cb-29fc60fc3fa7 | Chaitya-007/DSA-GFG-VS_CODE | 002_Flow Control,Function and Loops/decimal_to_binary.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n = 18;
int rem;
vector<int>v;
while (n > 0)
{
rem = n%2;
v.push_back(rem);
n = n/2;
}
cout<<"\n";
// ! Reversing the vector is done like this => v.end() - 1
/*
*fo... | ALGO | 0.999968 | 4.102888 |
80e283b8-8487-4b70-b344-67c8a3d7ded8 | BronsonLau/Practice_-_Study | leetcode/leetcodecpp/practice241224.cpp | // 1705. 吃苹果的最大数目
// 中等
// 有一棵特殊的苹果树,一连 n 天,每天都可以长出若干个苹果。在第 i 天,树上会长出 apples[i] 个苹果,这些苹果将会在 days[i] 天后(也就是说,第 i + days[i] 天时)腐烂,变得无法食用。也可能有那么几天,树上不会长出新的苹果,此时用 apples[i] == 0 且 days[i] == 0 表示。
// 你打算每天 最多 吃一个苹果来保证营养均衡。注意,你可以在这 n 天之后继续吃苹果。
// 给你两个长度为 n 的整数数组 days 和 apples ,返回你可以吃掉的苹果的最大数目。
typedef pair<int,int> pii... | ALGO | 0.999961 | 5.51591 |
2d732c13-1135-4c72-be65-d92e9f5f50b4 | glucosesupremacy/IPMP-adi-s | Week 1/Arrays/arrays8.cpp | bool hasArrayTwoCandidates(int arr[], int n, int x)
{
// code here
sort(arr, arr + n);
int l = 0;
int r = n - 1;
while (l < r)
{
int a = arr[l];
int b = arr[r];
if (a + b < x)
{
l++;
}
else if (a + b > x)
{
r--;
... | ALGO | 0.999966 | 5.014006 |
b49f3be5-a82c-47f1-abb3-7cef953e309c | dimasteva/Codeforces | 1744C.cpp | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
int t; cin >> t;
while(t--)
{
int n;
char c;
cin >> n >> c;
string s1;
cin >> s1;
s1 += s1;
int max = INT_MIN;
for (int i = 0; i < s1.size(); i++)
{
if (s1[i] == c)
{
int br = 0;
while(s1[i] != 'g' && i < s1.siz... | ALGO | 0.994887 | 3.226846 |
1404bd82-77f9-4546-adeb-496c2535e863 | SHRUTI-SINGH16/internship-prep | 04-ARRAYS/05-index-of-largest-element.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;++i){
cin>>arr[i];
}
int maximum = INT_MIN;
int ans = 0;
for(int i=0;i<n;++i){
if(arr[i]>=maximum){
maximum = arr[i];
ans = i;
... | ALGO | 0.999871 | 3.777005 |
0971701d-9f3e-420c-810f-f56b03dad068 | ishandutta2007/codeforces | radal/normal/446/C.cpp | #include <bits/stdc++.h>
#pragma GCC target ("avx,avx2,fma")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define X first
#define Y second
#define debug(x) cerr << #x << ": " << x << endl;
#define endl '\n'
#define pb push_back
#define rep(i,l,r) for (int i=l; i<r; i++)
#define repr(i,r,l) ... | ALGO | 0.999967 | 3.767573 |
e296677f-4b2c-4f12-a3f1-94f531e30f60 | nvtu/CompetitiveProgrammingLog | Practice/EduRound103/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_ITEMS = int(1e2+3);
int n, t;
long long p[MAX_ITEMS], k;
int main() {
// freopen("test.txt", "r", stdin);
cin >> t;
while (t--) {
cin >> n >> k;
for (int i=0; i<n; i++) cin >> p[i];
long long ans = 0, sum = p[0];
f... | ALGO | 0.999844 | 3.704635 |
3e6a96f4-5319-482f-8da1-da3db6651ffe | thelunartear/Coding_Test_Study | 프로그래머스/0/120871. 저주의 숫자 3/저주의 숫자 3.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int n) {
int answer = 0;
for(int i=0; i<n; i++)
{
answer++;
while(answer%3==0 || to_string(answer).find('3')!=string::npos)
{
answer++;
}
}
return answer;
} | ALGO | 0.999653 | 4.564555 |
7bb3ca69-7f7f-4c0e-a295-9267aabedb43 | seggiani-luca/esercizi-fdp | fibonacci/fibonacci.cpp | #include <iostream>
using namespace std;
long int fib(long int i) { //uso una funzione ricorsiva
if(i==0) return 0;
if(i==1) return 1;
return (fib(i-2)+fib(i-1));
}
int main() {
int n;
cout << "Quanti numeri di fibonacci vuoi stampare?" << endl;
cin >> n;
for(int i = 0; i < n; i++) {
if(i == n-1) {
... | ALGO | 0.999727 | 4.316142 |
d7ff7b70-4570-4065-a247-4da2c6755d44 | Aakashmid/DataStructureCpp | RecursiceProblems/ReverseArray.cpp | #include<iostream>
using namespace std;
void reverse(int A[],int l,int h){
if (l<h)
{
int temp=A[l];
A[l]=A[h];
A[h]=temp;
reverse(A,l+1,h-1);
}
}
int main(){
cout<<"Name - Aakash Kumar Jha \n";
int Arr[8]={2,4,6,1,8,4,6,7};
reverse(Arr,0,7);
// Printing rever... | ALGO | 0.999312 | 4.274692 |
7ceffec5-3145-4012-b711-19ef95c2348f | Sp-177/CODEFORCES | A_Jzzhu_and_Children.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
class Solution{
public:
int func(queue<pair<int,int>>&q,int candy){
int ans=0;
while(!q.empty()){
pair<int,int>x=q.front();
q.pop();
if(candy<x.first){
... | ALGO | 0.999921 | 3.576016 |
089ee35b-62ba-401a-91eb-7714c1e6b102 | hjpark83/Baekjoon | Silver/Silver2/Ferguson.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> A;
int GCD(int a, int b){
if(b==0){
return a;
}else{
if(a>b){
return GCD(b,a%b);
}else{
return GCD(a,b%a);
}
}
}
int divisor(int N){
A.clear();
for(int i=1;i<=N;i++){
... | ALGO | 0.999522 | 3.818174 |
360ca6b8-5c72-4623-9c11-756a50baab84 | ishandutta2007/codeforces | origenes/normal/1594/E2.cpp | #include <bits/stdc++.h>
#include <utility>
namespace atcoder {
namespace internal {
// @param m `1 <= m`
// @return x mod m
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
}
// Fast moduler by barrett reduction
// Reference: https://en.wikipedia.org/wiki/B... | ALGO | 0.999713 | 4.586275 |
1c0bcc81-0804-453b-a1d2-a170d9efd9c0 | rishabh27goel/Daily-Coding-Practice | DSA_Sheet/Trees/Check_if_a_binary_tree_is_subtree_of_another_binary_tree.cpp | #include <iostream>
#include <vector>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int data){
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
Node* createTree(Node* root){
int data;
cin >> data... | ALGO | 0.999946 | 5.627214 |
6f531df4-07a9-41f6-94f3-1e7c1a3e2e2a | ajit2688/simpleocr | tess-two/jni/com_googlecode_tesseract_android/src/ccstruct/quadlsq.cpp | #include <stdio.h>
#include <math.h>
#include "quadlsq.h"
#include "tprintf.h"
// Minimum variance in least squares before backing off to a lower degree.
const double kMinVariance = 1.0 / 1024;
/**********************************************************************
* QLSQ::clear
*
* Function to initialize a QLSQ.
... | ALGO | 0.997756 | 6.248074 |
4641e9c1-782e-411a-9b44-36c41a89b945 | inovia/IronHSP | plugins/win32/hspda/Hspda.cpp |
//
// Easy Data Access Plugin for HSP3
// onion software/onitama 1999
// onitama 2005/5
//
#include <windows.h>
#include <stdio.h>
#include <stdarg.h>
#include "../hpi3sample/hsp3plugin.h"
#include "membuf.h"
#include "ccsv.h"
#include "MTRand.h"
static ccsv *csv;
void Alertf( char *format, .... | TOOL | 0.877733 | 3.442827 |
17995f5d-9c90-4f6e-aa83-e5459c80939c | SwindleA/LLMCodeObfuscation | O2/O2_B9.cpp | #include <iostream>
#include <vector>
int main() {
// Welcome to the realm of recursion!
std::vector<int> numbers = {1, 2, 3, 5, 2, 1345, 63, 56, 3, 6626, 2556, 342, 5345, 55, 44, 33, 223, 863, 24, 52, 98, 888};
// An array of numbers that shall be processed recursively
for (int i = 0; i < number... | ALGO | 0.999945 | 6.539486 |
16f4cc2c-2d17-4b21-9141-7d2358855dba | MahinAshraful/CodeWatch_Data | sample-data/p00011/s620427273.cpp | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#define EPS (1e-8)
using namespace std;
int main() {
int w, n;
while(cin >> w >> n, w) {
int a[n][2];
int r[w];
int t;
for (int i = 0; i < n; i++) {
cin >> a[i][0];
cin.ignore();
cin >... | ALGO | 0.999981 | 3.61302 |
debf626c-be0a-436f-b1a3-9ce9e3a76bb2 | aminjonshermatov/competitive_programming | atcoder/abc/321/A.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#endif
using namespace std;
void solve() {
string s;
cin >> s;
bool ok = true;
for (int i = 1; i < s.size(); ++i) {
ok &= s[i - 1] > s[i];
}
cout << (ok ? "Yes" : "No") << '\n';
}
bool is_multi = false;
int main() {
... | ALGO | 0.999963 | 4.969228 |
3cdd2086-6d85-41ee-b95f-e9b89c9df827 | xiyanxiyan10/acm | jd/1385.cpp | /**
* @brief jiu du 1385
* @file 1385.cpp
* @author mianma
* @created 2014/01/20 14:16
* @edited 2014/01/21 14:11
* @type tree
* @note
*/
#include <fstream>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ?... | ALGO | 0.999998 | 3.610901 |
2f4af5d0-8c96-4e52-b68b-009a807145c9 | aryan-0069/CPP_basics | c++/z_random/prefixsum.cpp | #include <iostream>
using namespace std;
int main(){
int array[]={1,2,3,4,5};
for(int i=4;i>=0;i--){
for(int j=0;j<i;j++){
array[i]=array[i]+array[j];
}
}
for(int i=0;i<5;i++){
cout<<array[i]<<" ";
}
return 0;
} | ALGO | 0.99993 | 3.521636 |
1a1140a3-f319-4ec3-ad4b-26ec3cbbd2ac | ranzhaocgu/C-programming-coursera | Week 4/bubbleSorting/bubbleSorting/bubbleSorting.cpp | // bubbleSorting.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
int n, a[1000]; // 一共n个数,n不超过1000。a用来保存这些数
cin >> n;
// 输入n个数
for (int i = 0; i < n; i++) {
cin >> a[i];
... | ALGO | 0.999683 | 4.290585 |
1745afd4-90d7-4dd6-ad88-df3738ee92b9 | HariPasapuleti/Leetcode-Problems | 0160-intersection-of-two-linked-lists/0160-intersection-of-two-linked-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* getIntersectionNode(ListNode* headA, ListNode* headB) {
// unordered_map<ListNode*, int> mp;
// ListNode*... | ALGO | 0.999894 | 5.28064 |
64dbe054-b054-418c-ad6d-aeaba755a52d | cajet/Leetcode | my-leetcode-master/674.cpp | class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
if (nums.size() <= 1) return nums.size();
int count = 1;
for (int i = 1; i < nums.size(); ) {
if (nums[i - 1] < nums[i]) {
int temp = 1;
while (i < nums.size() && nums[i - 1] < nums[i]) {
temp++;
i++;
}
if (temp > cou... | ALGO | 0.999976 | 6.09083 |
96130503-58cc-4bf5-bad3-9d854b63495e | FeverDream-cy/C_plus_plus_PTIT | CPP0627 - TÌM KIẾM GIẢNG VIÊN.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.996624 | 3.843107 |
84f39649-2193-4416-99e4-4dbcfdf9c4a5 | AdnanSakib04/CodeForces | 116A - Tram.cpp | #include<iostream>
using namespace std;
int main(){
int n,a,b,capacity = 0, max_capacity = 0;
cin>>n;
for (int i = 0; i < n; i++)
{
cin>>a>>b;
capacity = capacity + (b-a);
if(capacity>max_capacity){
max_capacity = capacity;
}
}
cout<<max_capacity<<en... | ALGO | 0.999734 | 3.497213 |
4e9058ce-7263-4816-8f94-86f5127f308f | crazysoldier/clonecoin | src/uint256.cpp | #include "uint256.h"
#include "utilstrencodings.h"
#include <stdio.h>
#include <string.h>
template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::string& str)
{
SetHex(str);
}
template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::vector<unsigned char>& vch)
{
if (vch.size() != sizeof... | ALGO | 0.906604 | 6.478078 |
5676ab2f-cc3b-46d0-8675-8c1610ac0584 | angel2230/TLBB | Game/boost/libs/graph/example/cycle-file-dep.cpp | using namespace boost;
namespace std
{
template < typename T >
std::istream & operator >> (std::istream & in, std::pair < T, T > &p)
{
in >> p.first >> p.second;
return in;
}
}
typedef adjacency_list < listS, // Store out-edges of each vertex in a std::list
vecS, // Store v... | ALGO | 0.999295 | 5.969138 |
e96e4ee0-352f-49c6-a3a2-3da4d356d9db | MalekYasser26/medical | 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 |
033a4efd-4e18-4867-b244-75d7152c4524 | rebeccca-debug/Cpp-C-Data-Structures | Graphs/C++/DFSStack.cpp | #include <iostream>
#include <stack>
using namespace std;
// Based on Lecture
void DFS(int u, int A[][8], int n) {
// Initialize visit tracking array and stack
int visited[8] {0};
stack<int> stk;
stk.emplace(u);
// Visit start vertex u
cout << u << ", " << flush;
visited[u] = 1; // Vis... | ALGO | 0.99997 | 5.181859 |
776eb72b-641b-4dac-a003-f9fb85daa690 | tabib-e-alahi/Algorithms | Graph/Depth-First-Search/dfs_on_2D_grid.cpp | #include<bits/stdc++.h>
using namespace std;
char grid[105][105];
bool vis[105][105];
vector<pair<int,int>> dir = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};// up, down, left, right
int row_num, col_num;
bool valid(int i, int j){
if(i < 0 || i >= row_num || j < 0 || j >= col_num)
return false;
return true; ... | ALGO | 0.999872 | 3.425573 |
5fff7805-8473-4951-832f-ae7d63478bc9 | marcosvcloures/maratona | Primeira Fase/2012/c.cpp | #include <bits/stdc++.h>
#define D(x) cout << #x << " = " << x << endl;
using namespace std;
int main() {
int n;
long long cartoes[12000];
long long A[12000];
long long W[12000];
while(cin >> n) {
for(int i=0; i<n; i++) {
scanf("%lld", &cartoes[i]);
A[i] = W[i] = 0;
}
for(int i=1; i<n; i++) {... | ALGO | 0.999756 | 3.49711 |
cd4564a1-300b-42eb-91bb-fd65ba81f41c | mikhaeljonathan/online-judges | TLX/INC/INC 2019/INC_F.cpp | #include <stdio.h>
int main (){
int n, k;
scanf("%d %d", &n, &k);
int res = 0;
for (int i = 0; i < n; i++) {
int num;
scanf("%d", &num);
res += num;
}
printf("%s\n", (res % 2 == 0) ? "Preston" : "John");
return 0;
}
| ALGO | 0.999865 | 3.270307 |
c9c9d42c-a720-41f8-847f-29b039ecb239 | mohammad-majoony/codeForces-submits | F. Equalize the Array/main.cpp | // When i wrote this code, only me and God knew how it works. Now only God knows...
// https://codeforces.com/problemset/problem/1490/F
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MAJOONI ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define O... | ALGO | 0.999751 | 4.957075 |
490d8c4e-e8da-4251-8c52-10888b603793 | leticia-pontes/EstruturaDeDados | revisao/fila.cpp | #include <iostream>
#include <stdlib.h>
using namespace std;
typedef struct {
int* valorInt;
float* valorFloat;
int tamanho, capacidade, primeiro, ultimo;
} Fila;
Fila* criarFila(int capacidade) {
Fila* f = (Fila*)calloc(1, sizeof(Fila));
f->tamanho = 0;
f->capacidade = capacidade;
f->pri... | ALGO | 0.991711 | 3.871482 |
fe3c59d5-7438-4323-aa42-fed0652599ec | mirsfang/skia | src/shaders/gradients/Sk4fLinearGradient.cpp | #include "include/core/SkPaint.h"
#include "src/shaders/gradients/Sk4fLinearGradient.h"
#include <cmath>
#include <utility>
namespace {
template<ApplyPremul premul>
void ramp(const Sk4f& c, const Sk4f& dc, SkPMColor dst[], int n,
const Sk4f& bias0, const Sk4f& bias1) {
SkASSERT(n > 0);
const Sk4f ... | TOOL | 0.874504 | 6.621017 |
125e9e1d-200b-4e25-a247-5dafc5f19b3d | Nogal2222/flutPrac | stateful_prac/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.99844 | 6.76073 |
ffde0cb0-1309-4856-aa6a-d54fea7a00d0 | chipmc/TOF-Sensor-Demo | src/TOF-Sensor-Demo.cpp | // v1.00 - For testing purposes put into "testing mode" to get rapid output via usb serial
// v2.00 - Will stay disconnected to simplfy code - Just trying to implement directionality
// v2.01 - First version for testing
// v2.02 - Changing oritentation to match ST Micro example code
// v2.03 - Added a buffer to find th... | TOOL | 0.887708 | 5.315619 |
e5491215-d986-457b-902e-f5ae16e9553b | nmessa/CPlusPlus---2024 | Lab Exercise 3.18.2024/UPC/UPC/main.cpp | //Lab Exercise 3/18/2024 Problem 2
//Author:
#include <iostream>
#include <string>
using namespace std;
//Function prototype
bool isValidProductCode(string);
int main()
{
string code;
cout << "Enter the UPC: ";
cin >> code;
if (isValidProductCode(code))
cout << "Code is valid" << endl;
else
cout << "Cod... | ALGO | 0.995658 | 5.670236 |
ceeb1c63-a619-499e-996e-b8c25cbc3368 | aminjonshermatov/competitive_programming | atcoder/abc/046/C.cpp | // #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#ifdef LOC... | ALGO | 0.999847 | 4.889785 |
7467df85-0b24-4526-9b3a-b09be36cfa74 | argos-research/speed-dreams | src/modules/simu/simuv2.1/differential.cpp | #include "sim.h"
void
SimDifferentialConfig(void *hdle, const char *section, tDifferential *differential)
{
const char *type;
differential->I = GfParmGetNum(hdle, section, PRM_INERTIA, (char*)NULL, 0.1f);
differential->efficiency = GfParmGetNum(hdle, section, PRM_EFFICIENCY, (char*)NULL, 1.0f);
... | ALGO | 0.997758 | 5.965656 |
be2dc3c0-a0c7-467d-987f-22aec9376752 | C-2024-4-6/240431OuYingchi | p4.3.cpp | #include <iostream>
void sortArray(int* arr, int size) {
for (int i = 0; i < size - 1; i++) {
for (int j = 0; j < size - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
... | ALGO | 0.999301 | 4.190853 |
18681a95-ca2f-4c29-accb-7b3fb4dcbd3d | arthurlocce/Estudos-C | EX6.cpp | #include <stdio.h>
#include <math.h>
int main(){
float dis;
float comb;
float cons;
printf("Distancia percorrida(km):");
scanf("%f",&dis);
printf("Combustivel gasto(l):");
scanf("%f",&comb);
if (comb!=0){
cons= dis/comb;
printf("O veiculo consumiu %.2fkm/l",cons);
}
else{
printf("Erro: Combustie... | ALGO | 0.990687 | 3.428482 |
a23878e3-980a-446a-a49c-12c740e5b320 | xtf0214/CPP | Contest/Codeforces/1843/1843C.cpp | /**
* @file : Codeforces Round 881 (Div. 3) 1843C
* @author : Tanphoon
* @date : 2023/06/20 23:24
* @version : 2023/06/20 23:24
* @link : https://codeforces.com/contest/1843/problem/C
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
ll x;
cin >> x;... | ALGO | 0.999845 | 5.616133 |
5b5c44d2-f6a2-4250-b3ca-8e85d1efb049 | istyukahamed/VS-Code | C++/lab1p2.cpp | // Binary Search
#include<iostream>
using namespace std;
int main()
{
int arr[100],left,right,mid,n,x,cnt=0;
cout<<"How many element do you need: ";
cin>>n;
left=0;
right=n-1;
cout<<"Enter elements"<<endl;
for (int i = 0; i < n; i++)
{
cin>>arr[i];
}
cout<<"which element do you want to search: ";
cin>>x;
while (left<=... | ALGO | 0.99979 | 4.854161 |
41a5755c-ea07-45f8-b422-73fda34fb0bb | sanjitaprabhu/C-Programming | week 4/P5.cpp | #include <stdio.h>
int main()
{
int n;
printf("Enter number of rows: ");
scanf("%d",&n);
for(int i=0;i<n;i++)
{
for(int s=0;s<n-i-1;s++)
{
printf(" ");
}
for(int j=0;j<2*i+1;j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
| ALGO | 0.995539 | 3.757843 |
db3da8a0-fc2c-4a89-a790-c4bd38f32221 | Kurt232/Code | DShomework/2/expression.cpp | #include<iostream>
#include"BinNode.h"
#include"BinTree.h"
#include"Check.h"
#include<string>
#include<cctype>
using namespace std;
//处理输入
void in(string&s){
printf("请输入下一行输入表达式\n");
getline(cin,s);
s.push_back('#');//结尾标记
}
//将表达式转化成二叉树
void execute(BinTree& bt, string s){
bt.insert("");//插入根节点
Bin... | ALGO | 0.999917 | 4.014145 |
0f0f4695-24de-469f-b594-3d312e44caf5 | ishandutta2007/codeforces | spy20051623/normal/1703/E.cpp | #include <bits/stdc++.h>
using i64 = long long;
void solve() {
int n;
std::cin >> n;
std::vector<std::string> a(n);
for (int i = 0; i < n; ++i) {
std::cin >> a[i];
}
int ans = 0;
for (int i = 0; i < n / 2; ++i) {
for (int j = 0; j < (n + 1) / 2; ++j) {
int x = a[i][j] + a[j][n - 1 - i] + a[n - 1 - i][n ... | ALGO | 0.999884 | 5.521012 |
2bfaab52-e55b-4e49-8a0a-2c779819e4c0 | ishandutta2007/codeforces | chemthan/normal/803/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
... | ALGO | 0.999946 | 3.362916 |
5db077cb-3e24-4bff-9774-fda3c7def849 | Mayank9mare/Codeforces | 708div2/e1.cpp | // .-""""-.
// / j \
// :.d; ;
// $P :
// .m._ $$ :
// dSMMSSSss.__$b. __ :
// :MMSMMSSSMMMSS$$b $P ;
// SMMMSMMSMMMSSS$$$$ :b
// dSMMMSMMMMMMSSMM$$b.dP ... | ALGO | 0.999877 | 3.690049 |
59f4f99d-851d-4221-be70-8d476dd7d02d | TaiKonne/Code_Forces | love_song.cpp | #include <bits/stdc++.h>
using namespace std;
#define nl << '\n'
#define vti vector<int>
#define vtll vector<long long>
#define yep cout << "YES" nl
#define nope cout << "NO" nl
#define ll long long
#define lg long
#define db double
#define pb push_back
#define bg begin()
#define ed end()
#define rbg rbegin()
#define ... | ALGO | 0.999747 | 4.203478 |
f18fd51d-7627-41c0-9a35-623f6d3985ce | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-cot-gpt35/Codenet/p00121/129361802/improved.cpp | #include <algorithm>
#include <bitset>
#include <functional>
#include <set>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
char zzzt[8] = {0, 1, 2, 3, 4, 5, 6, 7};
char bj[8];
bitset<80000000> vis;
struct pt {
int ztt;
int lwz;
int step;
};
int bs;
pt dl[1 << 16];
... | ALGO | 0.99928 | 3.521327 |
4930ea10-7db5-40b7-b2d4-db48c4c82c8b | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_130_18.cpp | #include <bits/stdc++.h>
template <class T>
bool chmax(T &val, T nv) {
return val < nv ? (val = nv, true) : false;
}
template <class T>
bool chmin(T &val, T nv) {
return nv < val ? (val = nv, true) : false;
}
using namespace std;
using ll = long long;
const int MAX_N = 200010, MAX_K = MAX_N;
int n, a[MAX_N], cnt[MA... | ALGO | 0.999981 | 4.800289 |
11035a76-b258-42d7-b146-7965d9e8e526 | Chatrz/DSA | Graph Theory/Dijkstra/CPP/dijkstra_using_set.cpp | /**************************************************************************************
Dijkstra on set for sparse graphs - O(MlogM). Slower than heap version.
**************************************************************************************/
#include <iostream>
#include <fstream>
#include <cmath>
#include... | ALGO | 0.999987 | 3.973534 |
ff077a80-6a77-4f06-877e-8b681e410c32 | DanielHalachev/Bachelor-Code-Materials | Semester 3/Data Structures And Algorithms/8/4.cpp | ERROR: type should be string, got "https://www.hackerrank.com/contests/sda-hw-8-2021/challenges/call-center-1\n\n#include <iostream>\n\nint main() {\n int clients;\n int operators;\n int clientNum, length;\n std::cin >> clients >> operators;\n int *timetable = new int[operators];\n int *counter = new int[operators];\n for (int i = 0; i < operators; i++) {\n timetable[i] = 0;\n counter[i] = 0;\n }\n for (int i = 0; i < clients; i++) {\n std::cin >> clientNum >> length;\n int j = i;\n int start = i % operators;\n do {\n if (timetable[j % operators] <= clientNum) {\n timetable[j % operators] = clientNum + length;\n counter[j % operators]++;\n break;\n }\n j++;\n } while (j % operators != start);\n }\n int max = INT32_MIN;\n for (int i = 0; i < operators; i++) {\n if (counter[i] > max) {\n max = counter[i];\n }\n }\n for (int i = 0; i < operators; i++) {\n if (counter[i] == max) {\n std::cout << i << \" \";\n }\n }\n delete[]timetable;\n delete[] counter;\n}\n" | ALGO | 0.999978 | 4.212749 |
a1b1b0c0-62ce-404f-a6fb-3f683113e172 | Ga1ax9y/cpp_labs | Lab5/Task2/Task2.cpp | #include <iostream>
#include <Windows.h>
void Fillarr(double* const arr, const int size) //const!
{
for (int i = 0; i < size; i++)
{
std::cin >> arr[i];
}
}
int check(int x, int min, int max)
{
while (scanf_s("%d", &x) != 1 || x < min || x >max || getchar() != '\n')
{
printf("Ошибка!\n");
rewind(stdin);
}
... | ALGO | 0.999209 | 3.815614 |
6e50ee7b-7409-43c6-b9d4-d7e99a07f9aa | subham-paul/LeetCode | Top View of Binary Tree - GFG/top-view-of-binary-tree.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.999586 | 6.964333 |
3bea20d4-4235-4a10-a2f0-e920e7ed5770 | cosmicray001/academic | problem_solving/UVA/1225/16891743_AC_0ms_0kB.cpp | #include <bits/stdc++.h>
using namespace std;
int n[12];
void fnc(int a){
for(; a > 0; a /= 10) n[a % 10]++;
}
int main(){
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int t, a;
for(scanf("%d", &t); t--; ){
scanf("%d", &a);
memset(n, 0, sizeof(n));
... | ALGO | 0.999406 | 4.028522 |
e7952a76-100c-420c-9399-41749683a2b3 | privateLLM001/Private-LLM-Inference | OpenCheetah/deps/eigen/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = m * n;
cout << "-- Matrix m*n: --" << endl << result << endl << endl;
result = m.array() * ... | ALGO | 0.998221 | 4.306757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.