This file contains 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
''' | |
The MIT License (MIT) | |
Copyright (c) 2013 Krishna Bharadwaj <krishna@krishnabharadwaj.info> | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains 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
/* Update - Thanks to some folks who pointed out a flaw in my code. | |
* I have updated it. Hope it is correct now :-) | |
* Old version can be found here - | |
https://gist.github.com/krisys/4089748/262cbc10d9b9f1cb5df771e14a1e143a86d2ecc6/ | |
*/ | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; |
This file contains 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 <vector> | |
#include <map> | |
#include <set> | |
#include <algorithm> | |
#include <iostream> | |
#define FOR(i,a,b) for(int i=a;i<b;i++) | |
#define REP(i,a) FOR(i, 0, a) | |
#define all(a) a.begin(), a.end() | |
#define SORT(a) sort(all(a)) |
This file contains 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<string> | |
#include<sstream> | |
#define SIZE 700 | |
using namespace std; | |
class large{ | |
int no[SIZE]; | |
/* | |
array is used to store the large number. |
This file contains 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<fstream> | |
#include<string> | |
using namespace std; | |
int found=0; | |
class node{ | |
public: | |
char info; |
This file contains 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 <algorithm> | |
#include <iostream> | |
#include <vector> | |
#define FOR(i,a,b) for(int i=a;i<b;i++) | |
#define REP(i,a) FOR(i, 0, a) | |
#define VI vector<int> | |
#define all(a) (a).begin(), (a).end() | |
using namespace std; |
This file contains 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 <vector> | |
#include <map> | |
#include <set> | |
#include <algorithm> | |
#include <iostream> | |
#include <cstdio> | |
#define FOR(i,a,b) for(int i=a;i<b;i++) | |
#define REP(i,a) FOR(i, 0, a) | |
#define all(a) a.begin(), a.end() |
This file contains 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 <algorithm> | |
using namespace std; | |
int a[] = {4, 3, 1 ,2, 8, 3, 4}; | |
// int a[] = {1, 6, 2 ,3, 4, 5, 7}; | |
// int a[] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}; | |
// int a[] = {5,4,6,3,7}; | |
int N = sizeof(a)/sizeof(a[0]); |
This file contains 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> | |
#define SIZE 50 | |
#define debug(x) {cout << #x << " : " << x << endl ;} | |
using namespace std; | |
int main(){ | |
int a[SIZE] = {396, 549, 22, 819, 611, 972, 730, 638, 978, 342, 566, 514, 752, | |
871, 911, 172, 488, 542, 482, 974, 210, 474, 66, 387, 1, 872, 799, |
This file contains 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
import MySQLdb | |
host = '' | |
user = '' | |
passwd = '' | |
db = '' | |
# setup the connection | |
conn = MySQLdb.connect (host = host, user = user, passwd = passwd, db=db) | |
cursor = conn.cursor() |
NewerOlder