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 |
|---|---|---|---|---|---|---|
da785a88-d445-4b76-b819-47ba768470e8 | Del-te/algorithm | team_queue_uva540.cpp | #include <iostream>
#include <map>
#include <queue>
using namespace std;
const int maxt = 1000 + 10;
int main()
{
int t, kase = 0;
while (cin >> t && t != 0)
{
cout << "Scenario #" << ++kase << endl;
// 记录所有人的团队编号;
// team[x]表示编号为x的人所在的团队编号
map<int, int> team;
for (s... | ALGO | 0.99872 | 3.606038 |
6a4c66dd-6ff8-4da0-97a1-9ae680bdd120 | bansalmukul-cse/LeetCode-Codes | 535. Encode and Decode TinyURL.cpp | class Solution {
public:
map<string,string> mp;
int n = 0;
// Encodes a URL to a shortened URL.
string encode(string longUrl) {
string res = "http://tinyurl.com/" + to_string(n);
n++;
mp[res] = longUrl;
return res;
}
// Decodes a shortened URL to its original URL.
str... | ALGO | 0.998803 | 5.935334 |
2c1b9210-9a86-4a53-b938-581075c0bfa8 | AlexanderKiselyov/Homework | 4_1_1/4_1.cpp | // В дополнении к "хорошим" тестам написал такие:
// 1. 8 и -7. Вывел: 000...0001000 и 111...111001. Сумма: 000...0001. В десятичном виде выглядят как: 8 и -7.
// 2. -15 и -10. Вывел: 111...1110001 и 111...1110110. Сумма: 0111...11100111. В десятичном виде выглядят как: -15 и -10.
#include "Decimal.h"
#include <iostre... | ALGO | 0.993975 | 5.064178 |
65f1199b-9208-407e-bff9-03e1a7f692bd | PaintX/Arduino_ECU | _FIRMWARE_/speeduino_for_dev/libs/PID_v1/PID_v1.cpp | #if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "PID_v1.h"
/*Constructor (...)*********************************************************
* The parameters specified here are those for for which we can't set up
* reliable defaults, so we need to have the user set them.
*... | TOOL | 0.88774 | 5.94687 |
626471b3-7047-472f-b202-7295dcef7d76 | SimonDirckx/pqraaa | pqraaa-support/eigen-3.4.0/doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.899834 | 6.417363 |
b25d4441-e2cb-4881-a9b7-f931d37146f2 | reza-saleh40216341054607/40216341054607 | mesal-jozve/pg_22_1.cpp | #include <iostream>
using namespace std;
int main()
{
int i, j;
for (i = 1; i <= 5; i++)
{
for (j = 1; j <= i; j++)
cout << j;
cout << endl;
}
return 0;
} | ALGO | 0.998886 | 3.728296 |
f15b9129-e657-40ef-84f2-28905a9f92e6 | maseca/aoc_2016 | 16/01/main.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
using namespace std;
string checksum(const string& in){
string checksum = in;
string temp = "";
int len = checksum.length();
while(len % 2 == 0){
for(int i = 0; i < len-1; i += 2){
if(checksum.at(i) == checksum.at(i+1))
temp.app... | ALGO | 0.99992 | 3.939712 |
4aaef91f-4d72-4fb8-b578-f065f0da18a6 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1083_17.cpp | #include <bits/stdc++.h>
using namespace std;
int inp() {
int a;
scanf("%d", &a);
return a;
}
struct pr {
int x;
int y;
};
int grid[2000][2000];
int dist[9][9];
int rowCount[2000][9];
int rowCount2[2000][9];
int colCount[2000][9];
int colCount2[2000][9];
list<pr> col[9];
int n, m, k, s;
int abs(int a) { retur... | ALGO | 0.999888 | 3.645529 |
30c42eaf-8c32-492e-8023-a0636f1cb421 | Liliila/Cpp-Final-Summary | Forth/b.cpp | #include<stdio.h>
int main()
{
int s,n;
s = 1;
n = 1;
while (n<100)
{
n = n + 1;
s = s + n;
}
printf("1+2+....+100=%d\n", s);
return 0;//while循环计算1-100的和
}//LHF | ALGO | 0.999871 | 3.281031 |
b1e6285f-a530-4256-9910-b3bd4ffa3f30 | stalin18/C-and-CPlusPlus-Programs | CodeChef/CVOTE.cpp | #include<stdio.h>
#include<iostream>
#include<string>
#include<string.h>
#include<map>
using namespace std;
int main(){
int i=0;
long n, m, vote1=0, vote2=0, max1=0, max2=0;
string max_chef, max_country, temp_max_chef;
scanf("%ld%ld", &n, &m);
string chef;
string country;
string subject;
... | ALGO | 0.999995 | 4.218012 |
990c1fc6-762d-4247-bc01-90893eab4fc9 | Abdulla-Khan/HTTP-API | 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 |
9be52cb2-2f30-42cc-9d1e-81945ffcf6de | leanflutter/shortcut_menu_extender | packages/shortcut_menu_extender/example/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.998261 | 6.76073 |
0d19da88-e54e-4a65-ad61-cb46b39e69bc | ShubhamYadav25/LeetCode-Problem-Solution | 1966-frequency-of-the-most-frequent-element/frequency-of-the-most-frequent-element.cpp | class Solution {
public:
int maxFrequency(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int left = 0, maxFreq = 0;
long long sum = 0;
for(int right = 0; right < nums.size(); right++){
sum += nums[right];
while(1LL*(right - l... | ALGO | 0.999991 | 6.119621 |
3bdcd8b4-699a-456c-bd69-e96499a1bb2b | MhmdRyhn/ProblemSolving | LightOj/1049 - One Way Roads.cpp | #include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define mx 101
#define x first
#define y second
vector<int> graph[mx];
int cost[mx][mx];
bool isvisited[mx];
int bfs(int src,int ad)
{
int cst=0,from,to;
queue<int> q;
isvisited[src]=true;
// printf("src: %d\n",src);
// printf(... | ALGO | 0.999937 | 3.930982 |
a418fda1-3479-4842-9e09-d29ee346a96d | shahidul-brur/OnlineJudge-Solution | Codeforces/1140_C - Playlist.cpp | /*==============================================*\
ID: shahidul_brur
Name: Md. Shahidul Islam
Study: CSE, BRUR
Address: Rangpur, Bangladesh
mail: <EMAIL>
FB : fb.com/shahidul.brur
Blog: shahidul-brur.blogspot.com(in Bengali),
shahidul-brur-en.blogspot.com(in English)
\*==================... | ALGO | 0.999934 | 3.295185 |
ed149c80-4711-454e-ae55-bf9d13de0b6d | ishandutta2007/codeforces | crabby_maskiv/normal/1023/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
const ll mod=998244353;
set<int> s;
int mn[N],mx[N];
int n,m;
int a[N],b[N],c[N];
vector<int> v1[N],v2[N];
int main(){
int i,j;
cin>>n>>m;
memset(mn,0x3f,sizeof(mn));
for(i=1;i<=n;i++) cin>>a[i],c[i]=a[i];
for(i=1;i<=n;i++){
i... | ALGO | 0.999996 | 3.610797 |
e830850e-2217-4a18-923f-aa15acbd71d4 | nik36-54/CP-Codes | Dijkstra.cpp | // Time complexity : O(ElogV)
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pii > vii;
#define INF 0x3f3f3f3f
vii *G; // Graph
vi Dist; // for storing the distance of every other node from source.
/*==========================================*/
vo... | ALGO | 0.999962 | 4.288854 |
bbda0578-f29f-4eb6-a4d5-f4527b7c35a1 | ak85846/sde_sheet | 200-number-of-islands/200-number-of-islands.cpp | class Solution {
public:
int numIslands(vector<vector<char>>& grid) {
int m = grid.size(), n = m ? grid[0].size() : 0, islands = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (grid[i][j] == '1') {
islands++;
eras... | ALGO | 0.999989 | 6.726117 |
735198b9-b082-4741-a280-639e25c8d6cc | sublingbling/coding-everyday | 11_17_2016-same-tree/sousou.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:
bool isSameTree(TreeNode* p, TreeNode* q) {
if (p && !q) return false;
if (!p &... | ALGO | 0.999954 | 6.496082 |
5cf8f4c8-11ef-4425-9cae-6def96456de8 | shermz-lim/kattis-problems | chopin.cpp | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
int main() {
string line;
int i=1;
char arr[]={'A','B','C','D','E','F','G'};
while(getline(cin, line)){
if(line=="") break;
istringstream sin(line);
string a,b;
sin>>a>>b;
cout<... | ALGO | 0.997382 | 4.83429 |
08bedaa3-9333-4d81-9213-94cf2d1cf725 | Chirag2003/ADS_LABEXAM | bfsdfs.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int N = 100;
bool vis[N];
vector<int> adj[N];
void input_nodes()
{
int n, e;
cout << "Enter number of nodes: ";
cin >> n;
cout << "Enter number of edges: ";
cin >> e;
for (int i = 1; i <= n; i++)
{
vis[i] = f... | ALGO | 0.999849 | 5.377015 |
a84d54b9-6b8c-4972-9585-588bc291f5d7 | Rahul-Chhabra-27/Interview_Preparation | Bits_Manipulation/SingleNumber.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define nl "\n"
#define pq_max std::priority_queue<ll>
#define pq_min std::priority_queue<ll,vi,std::greater<ll> >
#define all(n) n.begin(),n.end()
#defi... | ALGO | 0.999998 | 4.96064 |
ba994467-f389-43e4-b4e7-a0a445459a5f | rohit0033/cpp-tut-begineers | tut57.cpp | #include<iostream>
using namespace std;
class CWH{
protected:
string title;
float rating;
public:
CWH( string s , float r){
title = s;
rating = r;
}
virtual void display(){}
};
class CWHVideo : public CWH
{
float videolength;
public:
... | TOOL | 0.904859 | 4.526103 |
ff06924a-7f6b-4c44-8897-cbedbfbf7e0a | dustn9401/algo | 문제풀이/7469 k번째 수 정답2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int arr[100001], lower, upper, n, m;
vector<vector<int>> tree(400000);
vector<int> tree_init(int start, int end, int index)
{
if (start == end)
{
tree[index].push_back(arr[end]);
return tree[index];
}
vector<int> a = tree_init(star... | ALGO | 0.999995 | 4.984993 |
d680c61b-4c10-4caf-aeee-c6242ca89858 | fear404-png/red_eye_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
0cc15e1d-3cc9-4197-bae3-5484058a211a | Vansh-chaudhary-6395/DSA-Questions | Backtracking/BinaryTreePaths.cpp | #include<iostream>
using namespace std;
class Node{
public :
int data;
Node* left;
Node*right;
Node(int x){
this->data =x;
this->left = NULL;
this->right = NULL;
}
};
Node* takeInput(Node* root){
int data;
cout<<"enter the data "<<endl;
cin>>data;
root = new Node(d... | ALGO | 0.999897 | 4.405363 |
ce095722-d874-440d-b5d1-26504f9f70ad | lanshi17/leetcode | editor/cn/remove-sub-folders-from-the-filesystem.cpp | /*
* @lc app=leetcode.cn id=1233 lang=cpp
* @lcpr version=30201
*
* [1233] 删除子文件夹
*/
// @lc code=start
class Solution {
public:
vector<string> removeSubfolders(vector<string>& folder) {
sort(folder.begin(), folder.end());
unordered_set<string> res;
for (const auto& path : folder) {
... | ALGO | 0.999259 | 5.680313 |
6d481183-1b97-4b44-bc51-6d38d565a54a | himanshunita009/DSA | Recursion/Implement ATOI.cpp | int solve(int i ,string str){
if(i < 0 )
return 0;
if(!(str[i] >= '0' && str[i] <= '9'))
return -1;
int ans = solve(i-1,str);
if(ans == -1)
return ans;
return (str[i]-'0')+ans*10;
}
int atoi(string str) {
bool flag = false;
if(str[0] == '-'){
flag = true;
... | ALGO | 0.999908 | 4.457386 |
cacd6fae-6564-4b52-99e3-2c73497e18ec | kun8904/Thuat-Toan-ATTT | cau22.cpp | #include <iostream>
using namespace std;
bool check_snt(int a){
if(a<=1) return false;
if(a<=3) return true;
if(a%2==0 || a%3==0) return false;
for(int i=5; i*i<=a; i++){
if(a%i==0 || a%(i+2)==0) return false;
}
return true;
}
int main(){
int l,r,tong=0,a,b;
cout << "Nhap l, r: " ; cin >> l >> r;
if(l>r){... | ALGO | 0.999923 | 4.823708 |
d0a67bb8-3e97-407a-b353-ae702820a56b | its-coder5128/leetcode | my-folder/problems/minimum_deletions_to_make_character_frequencies_unique/solution.cpp | class Solution {
public:
int minDeletions(string s) {
vector<int> vec(27,0);
for(int i=0;i<s.size();i++)
{
vec[s[i] - 'a']++;
}
int ans = 0;
sort(vec.begin(),vec.end(),greater<int>());
for(int i=0;i<26;i++)
{
if(vec... | ALGO | 0.999946 | 5.212626 |
7da08a46-b13c-4d00-a37e-9f69f6abc951 | lifengmiao/Leetcode | Evaluate Division.cpp | class Solution {
public:
vector<double> calcEquation(vector<pair<string, string>> equations, vector<double>& values, vector<pair<string, string>> queries) {
vector<double> rst;
//build graph
unordered_map<string, unordered_map<string, double>> graph; //direction graph with weight
for... | ALGO | 0.999984 | 6.198329 |
a335ccc6-b321-4653-81ca-b6c2356be0c2 | Chrinkus/stroustrup-ppp | chapter17/ex05_findx.cpp | //
// Stroustrup - Programming Principles & Practice
//
// Chapter 17 Exercise 5
//
// Write a function, char* findx(const char* s, const char* x), that finds the
// first occurrence of the C-style string x in s.
//
#include <iostream>
#include <stdexcept>
using std::cout;
const char* findx(const char* s, const char... | ALGO | 0.99848 | 5.658331 |
10761682-9ca8-4e42-b6c0-6472370fede0 | konradha/swapmc | generate_equilibrium/packed/packed_sim.cpp | #include "packed_maps.h"
#include <cassert>
#include <cmath>
#include <iostream>
#include <random>
#include <cstring>
void build_lattice_diag(const int & num_particles, const int & num_red, const int & num_blue,
std::mt19937 & generator, std::uniform_int_distribution<> & indices)
{
for(int... | ALGO | 0.999785 | 4.13389 |
05aa8668-4d58-42cc-aca9-c1ee84588f54 | AshishKhatkar/Codechef | MAY14/CHEFBM.cpp | /* ashish1610 */
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,p;
cin>>n>>m>>p;
vector<int> v[n+1];
map<int,int> ma;
int x,y;
for(int i=0;i<p;++i)
{
cin>>x>>y;
v[x].push_back(y);
}
bool flag,flag1;
int ans,present_sum,prev_sum,a,b,prev_a,prev_b;
for(int i=1;i<=n;++i)
{
if(v[i].size... | ALGO | 0.999345 | 3.52979 |
13d313a2-283b-4219-a678-ab38718f2c5b | by-student-2017/lammps-14May16 | lib/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp | #include <Kokkos_Core.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <cstdio>
#include <cstdlib>
typedef Kokkos::View<double*> view_type;
// Kokkos::Views have an MemoryTraits template parameter which
// allows users to specify usage scenarios of a View.
// Some of those act simply as hints, which can be used to inser... | ALGO | 0.929721 | 6.084058 |
c3da3725-3ca5-4f7d-8d13-3b135cff1a6f | radioactive1014/working | src/utils/eigen/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(const T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar hypotNorm(const T& v)
{
r... | TOOL | 0.971837 | 6.545245 |
bcc04a47-e2e5-48cd-955a-acd00845f05e | aashwin-tripathi/Leetcode-problems | letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.cpp | class Solution
{
public:
vector<string> letterCombinations(string digits)
{
vector<string> res;
if(size(digits)==0)
{
return res;
}
map<int, vector<string>> m;
m[2]= {"a", "b", "c"};
m[3]= {"d", "e", "f"};
m[4]= {"g", "h", "i"};
... | ALGO | 0.999945 | 6.508859 |
a68793f3-a15a-4568-ad87-81e3a1c1d645 | vfolunin/archives-solutions | UVa Online Judge/259.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
using namespace std;
struct Edge {
int a, b, capacity, flow;
Edge(int a, int b, int capacity) : a(a), b(b), capacity(capacity), flow(0) {}
int other(int v) const {
return v ==... | ALGO | 0.99982 | 3.923667 |
eff521dd-0727-4af6-b712-7b86aaa6584a | ishandutta2007/codeforces | roundgod/normal/1100/E.cpp | #include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
struct edge
{
int from,to,cost,id;
};
int n,m,ord[MAXN];
vector<edge> G[MAXN];
vector<int> order,ans;
vector<edge> E;
bool f;... | ALGO | 0.999993 | 4.028706 |
59edb027-2aed-480f-864a-480a3d44c79e | ishandutta2007/codeforces | thebes/normal/659/G.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<int> vi;
const int MN = 1e6+6, mod = 1e9+7;
ll n, i, x, y, cur, ans, h[MN];
int main(){
for(scanf("%lld",&n),i=1;i<=n;i++)
scanf("%lld",&... | ALGO | 0.999997 | 3.728375 |
216ac9ab-2673-47df-9f09-c0e20c8f573c | illinoisdata/qstore | baselines/src/baseline4_zipnn.cpp | #include <cassert>
#include <fstream>
#include <iostream>
// #include <set>
#include <vector>
#include <cassert>
#include <omp.h>
#include "load_tensors.h"
#include "qstore.h"
extern "C" {
#include "zipnn.h"
}
#include <chrono>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h> // For stat
using namespace... | DATA | 0.885419 | 5.925392 |
94ef9089-a502-4fc9-883e-2fade4713e6c | azecoder/Problem-Solving | E-olimp/4671. Подстрока .cpp | #include <iostream>
#include <cstring>
using namespace std;
int main(int argc, char** argv)
{
string a; cin >> a;
string b; cin >> b;
cout << a.find(b)+1 << endl;
return 0;
} | ALGO | 0.996736 | 3.551724 |
f03c716a-0fae-45ab-945f-36f1a77297e6 | micade145/4148E-Spin-Up-Worlds | src/my_lib/pid.cpp | #include "my_lib_header/pid.h"
// Credit to Theo | 7842F on VEXForum
double PID::calculateOutput(double m_error) {
error = m_error;
// //calculate delta time
// double dT = m_timer.millis().convert(millisecond) - m_lastTime;
// //abort if dt is too small
// if(dT < m_minDt) return m+output;
//calculat... | ALGO | 0.982988 | 5.37194 |
0956c3ac-f5a2-46ca-8e15-fae8226ce074 | Algorithm-Artisan-Sandip/GFG_My_Solved_Questions | Difficulty: Medium/k-th smallest element in BST/kth-smallest-element-in-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str) {
// Corner ... | ALGO | 0.999931 | 6.588978 |
3a8b1780-9fb2-419b-9ea3-ec5abacb9a9a | NayeemHossenJim/DSA | 1. Basics/4. Basic Recursion/Factorial.cpp | #include <iostream>
using namespace std;
int Fac(int n)
{
if (n==1) return 0;
return n*Fac(n-1);
}
int main()
{
int k = Fac(4);
cout << k;
return 0;
} | ALGO | 0.999932 | 4.330982 |
131447bc-642d-4d88-9a2d-7dd75f7ac1b2 | Ayush29Ayush/leetcode-gfg-problems | 0109-convert-sorted-list-to-binary-search-tree/0109-convert-sorted-list-to-binary-search-tree.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
/**
* Definition for a binary tree node.
* struc... | ALGO | 0.999997 | 6.417272 |
f96ec6d5-f89e-4748-b236-437c7989a5ee | NoviceCoderInfinity/DSA_CP | leetcode/22.Generate_Parentheses.cpp | // Brute Force Solution
class Solution {
private:
bool isValid(string test) {
int left_count = 0;
for (char c: test) {
if (c == '(') {++left_count;}
else {
if (left_count == 0) {return false;}
--left_count;
}
}
retur... | ALGO | 0.999638 | 6.577265 |
0549d2db-9e50-409a-9997-b7dabdba9d12 | jaebaek/SGX-Shield | llvm/lib/CodeGen/DeadMachineInstructionElim.cpp | #include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetS... | ALGO | 0.902632 | 7.930265 |
c9ed8d6c-69c0-46c4-a784-2ef6bdd34782 | webturing/NOIP2018FinalCamp | 20181001/EOF.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int x;
string s;
getline(cin,s);
istringstream iss(s);
iss>>x;
while (x--){
string s,s2;
getline(cin,s);
if (s[0]!=' ') s2.push_back(toupper(s[0]));
for (int i=1;i<s.length();i++)
if (s[i-1]==' '&&s[i]!=' ') s2.push_ba... | ALGO | 0.999433 | 4.105819 |
50173826-4827-47ed-bf66-98606dd17e56 | Yu-Maryland/Verilog-to-PyG | abc/src/sat/glucose/AbcGlucose.cpp | /**CFile****************************************************************
FileName [AbcGlucose.cpp]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [SAT solver Glucose 3.0 by Gilles Audemard and Laurent Simon.]
Synopsis [Interface to Glucose.]
Author [Alan Mishchenko]
... | ALGO | 0.99714 | 3.150813 |
3ab6d82a-dcf8-4b81-b05b-7916f4c69d73 | sathvik00123/CPP-Programs-DSA | DSA concepts/Binary Tree/InOrderBT.cpp | #include<iostream>
#include<queue>
using namespace std;
template<typename T>
class btnode{
public:
T data;
btnode *left;
btnode *right;
btnode(T data){
this->data = data;
left = NULL;
right = NULL;
}
~btnode(){
delete left;
delete right;
}
};
/... | ALGO | 0.999955 | 4.572252 |
b15179b1-5b49-4364-9a6a-7e74880baa7e | ishandutta2007/codeforces | pyqe/normal/1215/B.cpp | #include <bits/stdc++.h>
using namespace std;
long long n;
bitset<200069> a;
int main()
{
long long i,z=0,l=0,k;
scanf("%lld",&n);
for(i=1;i<=n;i++)
{
scanf("%lld",&k);
if(k>0)
{
a[i]=1;
}
}
for(i=1;i<=n;i++)
{
if(a[i])
{
k=l+1;
}
else
{
k=i-l-1;
}
z+=k;
l=k;
}
printf("%ll... | ALGO | 0.999806 | 3.142391 |
5f6f9b9d-062a-4520-859c-8e5dd1a96c9f | MattosJ/Cpp | lista5-quest3.cpp | #include <iostream>
//Faça um programa que leia uma lista de 10 números reais e, em seguida, leia também dois valores X e Y quaisquer correspondentes a duas posições (índices) na lista. Ao final, seu programa deverá escrever a soma dos valores encontrados nas respectivas posições X e Y. Informe ao usuário caso os valor... | ALGO | 0.901274 | 3.737976 |
209bda3b-4254-4dcd-adff-ac50c5230ff0 | MartinNoboa/parallelProgramming | act col/05/Exercise01.cpp | // =================================================================
//
// File: exercise01.cpp
// Author(s):
// Martin Adrian Noboa Monar - A01704052
// Samuel Octavio González Azpeitia - A01704696
// Description: This file contains the code to count the number of
// even numbers within an array using the... | ALGO | 0.998466 | 5.260739 |
95c17a14-9fdb-43bb-bce2-ef636cf33498 | ly1997th/leetcode | 174.cpp | class Solution
{
public:
int calculateMinimumHP(vector<vector<int>>& dungeon)
{
int M=dungeon.size(),N=dungeon[0].size();
//health元素代表从当前节点到公主节点的最小生命值
vector<vector<int>> health(M,vector<int>(N,0));
//初始化公主节点
health[M-1][N-1]=1;
if(dungeon[M-1][N-1]<0)
... | ALGO | 0.999872 | 5.341947 |
5266f5f0-5321-46c9-947c-34811c309607 | Preeti8684/Cpp_good | SinglyLinkedList.cpp | #include<iostream>
using namespace std;
// Node class represents each element (node) in the linked list
class Node {
public:
int data; // Data stored in the node
Node* next; // Pointer to the next node
// Constructor to initialize a node
Node(int data) {
this->data = data;
this... | ALGO | 0.999752 | 6.119754 |
ba290757-322b-44b5-999b-9ace496339cd | tamle29092004/LeVanTam_MonC | Chương 4/Program Challenges/6_Mass_and_weight.cpp | #include <iostream>
using namespace std;
int main()
{
double mass, weight;
// Nhập khối lượng của đối tượng (kilograms)
cout << "Nhap khoi luong cua doi tuong (kilograms): ";
cin >> mass;
// Tính trọng lượng (newtons) dựa trên công thức
weight = mass * 9.8;
// Hiển thị trọng lượng và kiể... | TOOL | 0.92331 | 5.529497 |
6680b0bd-8e39-4811-bc32-364590390403 | shiquan-wang/LeetCode | nowcoder_101/List/reverseGroup.cpp | #include<iostream>
#include"ListNode.h"
using namespace std;
/*
步骤分解:
链表分区为已翻转部分+待翻转部分+未翻转部分
每次翻转前,要确定翻转链表的范围,这个必须通过 k 此循环来确定
需记录翻转链表前驱和后继,方便翻转完成后把已翻转部分和未翻转部分连接起来
初始需要两个变量 pre 和 end,pre 代表待翻转链表的前驱,end 代表待翻转链表的末尾
经过k此循环,end 到达末尾,记录待翻转链表的后继 next = end.next
翻转链表,然后将三部分链表连接起来,然后重置 pre 和 end 指针,然后进... | ALGO | 0.999948 | 4.898258 |
1320d6a2-4aed-498b-b652-86c20f61d999 | Siihyun/Algorithm | 14499_주사위굴리기.cpp | #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<utility>
#define MAX 20
#define EAST 1
#define WEST 2
#define NORTH 3
#define SOUTH 4
using namespace std;
int r, c, x, y, n, dir, nx, ny;
int map[MAX][MAX];
int dice[7] = { 0,0,0,0,0,0,0};
void change_dice() {
if (dir == EAST) {
swap(dice[1], dice[4... | ALGO | 0.999931 | 4.415538 |
275eacae-fca7-406d-9e67-5db7bf33e55b | CPP-Algorithm-Study/CPP-Algorithm-Study | Sujung/240107/6_InvertBinaryTree.cpp | /* Invert Binary Tree - 레벨 순회 방식으로 풀이하였습니다. */
class Solution {
public:
TreeNode* invertTree(TreeNode* root) {
if(root == NULL) return NULL;
queue<TreeNode*> q;
q.push(root);
while(!q.empty()){
TreeNode *cur = q.front();
q.pop();
swap(cur->left, ... | ALGO | 0.999995 | 6.376206 |
0f49bd40-98f0-4ab1-b4a4-abd5162be0d2 | Yuki-Wada/competitive_programming | cpp/src/at_coder/selection90_039.cpp | //include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <ss... | ALGO | 0.999479 | 3.918833 |
e7bfb1d1-dcb7-4606-8d02-e42d98e511c2 | sarvex/leetcode-javascript | lcof/面试题40. 最小的k个数/Solution.cpp | class Solution {
public:
vector<int> getLeastNumbers(vector<int>& arr, int k) {
int n = arr.size();
function<vector<int>(int, int)> quickSort = [&](int l, int r) -> vector<int> {
int i = l, j = r;
while (i < j) {
while (i < j && arr[j] >= arr[l]) {
... | ALGO | 0.999996 | 6.399315 |
e3ca0141-d284-4244-b94b-4b0ce5eb0002 | Tafreed/CP | Codeforces/Gifts Fixing.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false); cin.tie(NULL);
int main(){
fastio
int t,n,inp;
cin >> t;
vector<int> a,b;
while(t--){
int flag=0,amin,bmin;
long long count=0;
a.clear();
b.clear();
cin >> n;
fo... | ALGO | 0.999957 | 4.027578 |
9eec82c5-97e6-48c3-a191-50b0bd24cc08 | codeSpicer/LeetCode-solutions | 1372-longest-zigzag-path-in-a-binary-tree/1372-longest-zigzag-path-in-a-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.99984 | 5.744035 |
1455f760-f565-4c4d-9680-05ecd6e966ed | jgret/physisim | src/solver/rk4solver.cpp | #include "rk4solver.h"
#include <iostream>
#include <vector>
namespace psim
{
Rk4Solver::Rk4Solver(dydt_func f) : ODESolver(f)
{
}
void Rk4Solver::step(StateVector y, StateVector& out, float t0, float dt)
{
float dt_2 = dt / 2.0f;
StateVector k1 = func(t0, y);
StateVector... | ALGO | 0.999776 | 5.67569 |
f5a92602-6bb7-4a65-8bd8-6683a0a8579b | hdpiscoding/Luu-do-thuat-toan-C- | Bai091/Bai091.cpp | #include <iostream>
using namespace std;
int main()
{
int n, m = 1, dau = 1;
float x, t = 1, s = -1;
cout << "Nhap x: ";
cin >> x;
cout << "Nhap n: ";
cin >> n;
for (int i = 2; i <= 2 * n; i += 2)
{
t = t * x * x;
m = m * (i - 1) * i;
s = s + dau * (t / m);
dau = -dau;
}
cout << "s(" << x << "," << n... | ALGO | 0.999958 | 3.950631 |
a65398b6-e25f-467b-aa7c-75cff8a91546 | NaJunhyeok/backjoon | backjoon/8958.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
char arr[80];
int T;
int cnt = 0;
int score = 0;
cin >> T;
for(int i = 0; i < T; i++){
cnt = 0;
score = 0;
cin >> arr;
for(int j = 0; j < strlen(arr); j++){
if(... | ALGO | 0.999338 | 4.497433 |
29f7e7e2-f540-4b5c-9648-e24e7ca2d2e3 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7029_3.cpp | #include <bits/stdc++.h>
using namespace std;
string s[1100];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s[i];
}
if (n == 1) {
cout << 6;
return 0;
}
int r = 7;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
if (i != j) {
int x = 0;
... | ALGO | 0.999886 | 3.731465 |
9782c0b3-5606-44d7-a80f-adf7962585ee | ishandutta2007/codeforces | antoine/normal/839/B.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <functional>
int a[100];
bool program() {
int n, k;
std::cin >> n >> k;
int twos, fours;
twos = 2 * n;
fours = n;
for (int i = 0; i < k; ++i)
std::cin >> a[i];
// 4's
for (int i = 0; i < k; ++i)
while (a[i] >= 4 && fo... | ALGO | 0.99997 | 4.103113 |
027a320f-739f-4e82-9b7e-6ce93aa5f00e | PosEx/Posex | src/scrypt.cpp | #include <stdlib.h>
#include <stdint.h>
#include "scrypt.h"
#include "pbkdf2.h"
#include "util.h"
#include "net.h"
#define SCRYPT_BUFFER_SIZE (131072 + 63)
#if defined (OPTIMIZED_SALSA) && ( defined (__x86_64__) || defined (__i386__) || defined(__arm__) )
extern "C" void scrypt_core(unsigned int *X, unsigned int *V... | ALGO | 0.9887 | 5.414102 |
68ba31bb-0a3e-4cfd-bef3-6e54e7a4059f | kkeyan931/LeetSync | 122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.cpp | class Solution {
public:
int rec(vector<int>& prices, vector<vector<int>> &dp, int index, bool canBuy) {
if (index == prices.size()) {
return 0;
}
if(dp[index][canBuy] != -1) {
return dp[index][canBuy];
}
if (canBuy) {
int buy = -prices[i... | ALGO | 0.999943 | 6.22972 |
2a2b4f45-7082-47ad-a073-0bc55230442e | JakZaj/AdventOfCode-2022 | Day11/AdventOfCode11/AdventOfCode11/AdventOfCode11.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include "BigInt.hpp"
using namespace std;
const int numberOfRounds = 20;
const int numberOfRoundsPartTwo = 10000;
const int boredDivided = 3;
struct ITEM {
BigInt value;
ITEM* nextItem = nullptr;
};
struct OPERATION {... | ALGO | 0.979914 | 4.598672 |
65f5bdfd-2cd6-498d-bdd3-c02d09fb74ee | et84121/NCUTV_switcher_tally_light | ATEM_Wireless_Tally_Light-master/libraries/RF12/PortsBMP085.cpp | // computation and algorithm taken from the Bosch Sensortec BMP085 data sheet
// (IIRC, I had to cast to an int32_t for the b3 calculation to work above 25C)
#include <Ports.h>
#include "PortsBMP085.h"
#if ARDUINO>=100
#include <Arduino.h> // Arduino 1.0
#else
#include <WProgram.h> // Arduino 0022
#endif
uint8_t BMP0... | ALGO | 0.94092 | 5.617728 |
0ce7f1c4-9a6a-4e15-9f18-14eb5392d7bd | ishandutta2007/codeforces | galen_colin/normal/1132/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define send {ios_base::sync_with_stdio(false);}
#define help {cin.tie(NULL);}
#define f first
#define s second
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
typedef long long ll;
typedef long double lld;
typedef unsigned l... | ALGO | 0.999949 | 3.710885 |
0699d7b8-60d6-461f-bbd4-266c18146834 | mitasingh10332/Queue | Implementing Queue using Array.cpp |
#include <bits/stdc++.h>
using namespace std;
#define n 20
class Queue
{
int *ar;
int front;
int back;
public:
Queue (){
ar=new int[n];
front =-1;
back=-1;
}
void push(int x)
{
if (back==n-1)
{ cout<< "Queue overloaded"; return ;}
back++;
ar[back]=x;
if (front==-1)
{front++;}
}... | TOOL | 0.947718 | 3.821665 |
1b0c965b-9db7-4f23-b5bc-d8fe6fb5ee78 | uttamsdev/advanced-algorithms | subset-sum-problem-dynamic-programming.cpp | #include<bits/stdc++.h>
using namespace std;
int subset_sum(int set[], int size, int sum)
{
int i, j, dp_table[size+1][sum+1];
for(i = 0; i <= size; i++){
for(j = 0; j <= sum; j++){
if(i == 0 && j == 0)
dp_table[i][j] = 1;
else if(i == 0 && j!= 0)
... | ALGO | 0.999879 | 5.22474 |
d3376853-a747-43c5-ab50-5e3db735c698 | hs094/CP | Codeforces/Codeforces Round #473 (Div. 2)/B_Three-level_Laser.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#incl... | ALGO | 0.999206 | 4.749007 |
10c389fa-7cb8-450a-9a51-435d7fe05401 | shreejitverma/SDE-Interview-Prep | ACM ICPC/Math/Matrix_Power/matrix_power.cpp | #include <iostream>
using namespace std;
const int MaxSize = 2; //It depends on the problem (2 for computing Fibonacci series)
const int mod = 1e9+7; //It depends on the problem as you may don't need it
struct Matrix{
long long mat[MaxSize][MaxSize];
};
Matrix matMul(Matrix a , Matrix b)
{
Matrix ans; int k;... | ALGO | 0.999936 | 3.958537 |
59a425ee-727b-4996-b2e5-119caccc0c57 | Weijun-H/PAT | AdvancedLevel/1033.To Fill or Not to Fill/main.cpp | #include <algorithm>
#include <cstdio>
using namespace std;
const int maxn = 510;
const int INF = 1000000000;
struct station{
double price, dis; //价格、与起点的距离
}st[maxn];
bool cmp(station a, station b){
return a.dis < b.dis; //按照距离从小到大排序
}
int main() {
int n;
double Cmax, D, Davg;
... | ALGO | 0.999835 | 3.607041 |
c69ba3af-bd3e-420e-b4f5-a3c8b82846d7 | yosupo06/library-checker-problems | graph/min_cost_b_flow/checker.cpp | #include <vector>
#include <utility>
#include <exception>
#include "testlib.h"
// Copied from params.h
#define N_MAX (long long)100
#define M_MAX (long long)1000
#define U_MAX (long long)1000000000
#define C_MAX (long long)1000000000
#define P_MAX (long long)1000000000000000
using Flow = long long int;
using Cost = ... | ALGO | 0.989943 | 5.35846 |
f2f78c5a-59fb-469a-b8de-6cf3a0de0d07 | Manojkapure100/DSA | Lowest common ancestor in binary tree.cpp | #include<iostream>
#include "utils.h"
using namespace std;
btNode* lowestCommonAncestor(btNode* root, btNode* p, btNode* q) {
if(root == NULL) return NULL;
if(root->val == p->val || root->val == q->val){
return root;
}
btNode* leftLCA = lowestCommonAncestor(root->left, p, q);
btNode* rig... | ALGO | 0.999975 | 4.646379 |
e4018d53-851b-4fbe-aa3e-ed4c8881c203 | keqhe/leetcode | google_list/leetcode332.cpp |
class Solution {
public:
//topological sort?
//You may assume all tickets form at least one valid itinerary.
//[["JFK","KUL"],["JFK","NRT"],["NRT","JFK"]]
void dfs(unordered_map<string, multiset<string>> &adj, string curr, vector<string> &res) {
/*for (auto x : adj[curr]) {
... | ALGO | 0.999992 | 6.22086 |
33437fe1-ce7d-44c7-a1fb-e1288a29874a | saumya-v/Strings | remova CharStr.cpp | #include<iostream>
using namespace std;
void removeC(char inp[],char x){
int i=0,j=0;
while(inp[i]!='\0'){
if(inp[i]==x){
i++;
}
else{
inp[j]=inp[i];
j++;
i++;
}
}
inp[j]='\0';
}
int main(){
char inp[100];
char x;
... | ALGO | 0.998154 | 4.178894 |
3d65978f-94b1-484f-92dc-090914938ec5 | ishandutta2007/codeforces | fanache99/normal/1109/D.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cassert>
#include <map>
#include <numeric>
#include <cstring>
#include <set>
#include <ctime>
#include <queue>
#include <cmath>
#include <iomanip>
#include <iterator>
#include <bitset>
#include <unordered_map>
#incl... | ALGO | 0.9999 | 4.653261 |
e20e3ec0-6b07-4ae9-b9a2-39756c583fc8 | matthias-prevost/formation-flutter | 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.998809 | 6.763549 |
3ae318b0-78b6-43e3-ae80-4d6cc68d7c1b | emmyanak/log-manager | project3.cpp | #include <string.h>
#include <string>
#include <algorithm> //transform
#include <iostream>
#include <sstream>
#include <fstream>
#include "p3functions.h"
#include <unordered_map>
#include <stdio.h>
#include <ctype.h>
using namespace std;
int main(int argc, char **argv) {
string filename = "file";
if (argc == 2)
... | TOOL | 0.914849 | 3.75753 |
de130d78-0d7f-431d-99e1-9bc9d3d5bad2 | ranajibghosh/C-Progs | list.cpp | #include <iostream>
#include <list>
using namespace std;
int main(){
list<int> list1={5,2,4,6,2};
list<int> list2={7,6,1,9};
for(auto &ele : list1)
cout<<ele<<" ";
cout<<endl;
list2.sort();
for(auto &ele : list2)
cout<<ele<<" ";
cout<<endl;
list1.merge(list2);
for(auto &ele : list1)... | ALGO | 0.997149 | 4.237823 |
c849ee8b-35d5-45e4-9c63-86e6832d413b | abhaysharmak90/Cpp-learning | Practice-Exercise from Ivor Horton book/chapter-12/2/12.2.cpp | #include <iostream>
class INTEGER
{
int number;
public:
void getter() const { std::cout << number << "\n"; }
void setter(int num) { number = num; }
void compare(INTEGER) const;
// void compare(INTEGER &) const;
// void add(INTEGER num) const;
// void sub(INTEGER num) const;
// void mul... | TOOL | 0.891992 | 4.660894 |
91d5a4f7-2ed6-4383-a264-3a84bc4852d5 | securesystemslab/llvm-project | libc/src/math/x86_64/tan.cpp | #include "src/math/tan.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(double, tan, (double x)) {
double result;
double one;
// The fptan instruction pushes the number 1 on to the FP stack after
// computing tan. So, we read out the one before popping the actual result.
__asm... | TOOL | 0.941225 | 7.124644 |
34d3382e-02b5-4831-91a1-643ddd787794 | adityagaur0/DSA-Masterclass | 4.CB -Lectures codes/Lecture 16/2.CharacterArray/03FindLargestOfNStrings.cpp | // strlen <= 100
#include<iostream>
#include<cstring>
using namespace std;
int main() {
int n;
cout << "Enter the no. of strings : ";
cin >> n;
char inp[101];
cin>>inp;
char lsf[101];
strcpy(lsf,inp);
for(int i=2;i<=n;i++){
cin>>inp;
if(strcmp(inp,lsf)>0){
strc... | ALGO | 0.998086 | 3.376204 |
7415aabf-f6b8-4216-a3bb-60b7af3f2ac3 | alibro005/DSA-Problems | Problem_136/index.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> nums = {2,3,2,3,4};
int ans = 0;
for(int i : nums){
ans ^= i ;
}
cout<<"Single Number is : "<<ans;
return 0 ;
} | ALGO | 0.999948 | 5.192621 |
9bb124af-cd5a-4d34-8103-a1697e4107d8 | river-li-tech/AlgoLab | CppLab/17_PrintNDigits.cpp | #include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
/*
n˳ӡ 1 n λʮ 3ӡ 123 һֱ 3 λ 999
*/
//#define PRINTNDIGITS
#ifdef PRINTNDIGITS
using namespace std;
vector<int> printNumbers(int n)
{
if (n <= 0) {
return vector<int>();
}
int maxNum = 0;
if (n >= ... | ALGO | 0.997543 | 4.333127 |
0bb3db77-694d-49ac-a775-705827a098cc | ishandutta2007/codeforces | winniechen/normal/1146/E.cpp | #include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 100005
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
int tag[N<<3],rev[N<<3],t[N<<3],a[N],n,Q;
inline void giv_rev(int rt){rev[rt]^=1,t[... | ALGO | 0.999975 | 3.390172 |
834927cc-019b-48b3-b07f-7c310c08f1bb | viacoin/viacoin | src/crypto/sha1.cpp | #include <crypto/sha1.h>
#include <crypto/common.h>
#include <string.h>
// Internal implementation code.
namespace
{
/// Internal SHA-1 implementation.
namespace sha1
{
/** One round of SHA-1. */
void inline Round(uint32_t a, uint32_t& b, uint32_t c, uint32_t d, uint32_t& e, uint32_t f, uint32_t k, uint32_t w)
{
... | ALGO | 0.998495 | 7.492627 |
b0d96291-4d33-4268-95da-d3399cf3ca6f | AkshayRamchandraDhole/Python | Python Code/Daily_Flash_Code_0/Week 7/28 Feb/40-DailyFlash_Solutions/40-DailyFlash_Solutions/28_Feb_Solution_Three/C++/Program0.cpp | /* Problem Statement
*
* Program0 -- Write a Program that prints whether a number entered by user is Disarium Number or not.
{Note: A number can be termed as Disarium number if the sum of every digits
raised by their position in that number is equal to that number. E.g. 135, 1 is at
position 1, 3 is at position 2 & 5... | ALGO | 0.99956 | 5.655028 |
13d839b7-99fc-47ca-9bdb-a83271776855 | pbysu/BOJ | ~2017/2602.cpp | #include<iostream>
#include<cstring>
using namespace std;
char doru[21];
char dol[2][101];
int dp[21][102];
int dp1[21][102];
int main() {
scanf("%s", doru);
scanf("%s", dol[0]);
scanf("%s", dol[1]);
if (dol[0][0] == doru[0])
dp[0][0] = 1;
if (dol[1][0] == doru[0])
dp1[0][0] = 1;
int cnt = 0;
int cnt1 = 0... | ALGO | 0.999466 | 3.281012 |
e1cc353d-7247-48e0-9141-2bb24e2378f4 | mdnazmulislam0087/Data-Structure | M-04/Sorted.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int test;
cin >> test;
for (int t = 0; t < test; t++)
{
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
vector<int> b(n);
for (int i ... | ALGO | 0.999974 | 3.893385 |
4dd698d4-e7bd-4ce2-9562-e917008eabc1 | tahsinkose/Data-Structures-and-Algorithms | Codeforces/991E.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
vector<vector<int> > memo;
typedef unsigned long long int ull;
ull factorial(int num){
ull result = 1;
for(int i=2;i<=num;i++)
result *= i;
return result;
}
ull recurse(map<char,int> c,map<char,int>&... | ALGO | 0.999924 | 4.368979 |
670c63c9-586c-471e-8bab-2845d4b6d9b5 | MdRafidulIslam/xpsc-week1 | stater158/subsequence.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<long long> a(n), b(n);
for (int i = 0;i < n;i++) {
cin >> a[i];
}
for (int ... | ALGO | 0.999992 | 3.598211 |
7e4ec76c-def2-4a92-a314-8ff645a79de6 | KHvic/uva-online-judge | 12207-That is Your Queue.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <deque>
using namespace... | ALGO | 0.999295 | 3.246816 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.