This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python3 | |
with open('resp.txt') as fil: lines=fil.readlines() | |
qids={int(line.split()[-1]) for line in lines if | |
line.startswith('Question ID')} | |
i,offset=0,min(qids) | |
print('Calculated offset') | |
data=[None]*65 | |
while i<len(lines): | |
if (lines[i].startswith('Question Type')): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <queue> | |
using namespace std; | |
struct TreeNode { int val;TreeNode *left;TreeNode*right; TreeNode(int val, TreeNode *left, TreeNode *right):val(val), left(left), right(right) {}; }; | |
// 13 12 21 14 24 10 22 15 23 | |
int main() { | |
TreeNode *root=new TreeNode(12, new TreeNode(13, nullptr, nullptr), new TreeNode(10, new TreeNode(14, new TreeNode(21, nullptr, nullptr), new TreeNode(24, nullptr, nullptr)), new TreeNode(15, new TreeNode(22, nullptr, nullptr), new TreeNode(23, nullptr, nullptr)))); | |
queue<TreeNode *> Q; Q.push(root); int N1, N2; cin >> N1 >> N2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<utility> | |
#include<vector> | |
using namespace std; | |
int main() { | |
size_t n; cin >> n; | |
vector<tuple<int,int, char, bool, size_t>> heros(n); | |
for (size_t i=0; i<n; ++i) { cin >> get<0>(heros[i]); } | |
for (size_t i=0; i<n; ++i) { cin >> get<1>(heros[i]); } | |
string str; cin >> str; for (size_t i=0; i<n; ++i) { get<2>(heros[i])=str[i]; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
bool possible(unsigned long long n_b, unsigned long long n_s, unsigned long long n_c, | |
unsigned long long p_b, unsigned long long p_s, unsigned long long p_c, | |
unsigned long long r_b, unsigned long long r_s, unsigned long long r_c, | |
unsigned long long r, unsigned long long m) { return (m*r_b-n_b)*p_b+(m*r_s-n_s)*p_s+(m*r_c-n_c)*p_c<=r; } | |
int main() { | |
string reciepe; cin >> reciepe; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int* max_element(int *begin, int *end) { | |
int *answer=begin; | |
for (int *iter=begin;iter!=end; ++iter) { if (*iter>*answer) { answer=iter; } } | |
return answer; } | |
int main() { | |
size_t N; cin >> N; int nums[N]; for (size_t i=0; i < N; ++i) { cin>>nums[i]; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
size_t cunt; | |
void TowerOfHanoi3(size_t n, size_t src, size_t aux, size_t dest, vector<string> &towers) { | |
if (n==0) { return; } | |
TowerOfHanoi3(n-1, src, dest, aux,towers); | |
++::cunt; cout << towers[src] << " -> " << towers[dest] << endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$connection=array( | |
'hostName'=>'localhost', | |
'userName'=>'root', | |
'password'=>'', | |
'database'=>'library'); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* tug_of_war.cpp | |
* This is soln of Tug of War problem of Coding Ninjas. This is O(pow(2, N)) time, O(1) space soln. | |
* https://www.codingninjas.com/codestudio/problem-details/tug-of-war_985253 | |
* Date Created: 24 Feb, 2022 | |
* Author: Akhilesh Kumar Verma | |
*/ | |
int tugOfWar(vector<int> &arr, int n) { | |
int sum1 = arr.back(), sum2 = 0; | |
for (int ele: arr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* hello_world.cpp | |
* This is Hello World of C++ | |
* Date Created: 23 Feb, 2022 | |
* Author: Akhilesh Kumar Verma | |
*/ | |
#include <iostream> | |
using namespace std; | |
int main(int argc, char **argv) { |