Skip to content

Instantly share code, notes, and snippets.

View osjayaprakash's full-sized avatar
💭
I may be slow to respond.

Jayaprakash S osjayaprakash

💭
I may be slow to respond.
View GitHub Profile
@osjayaprakash
osjayaprakash / SPOJ-MST.cpp
Created December 27, 2012 20:42
SPOJ, MST, GRAPH
#include <iostream>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
#define MOD 10000
#define MAX 10000
int N,M;
@osjayaprakash
osjayaprakash / SPOJ-ABA12D.cpp
Created December 29, 2012 07:46
Sum of divisors!, SPOJ, Solution,
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <vector>
using namespace std;
#define MOD 1000000007
#define MAX 100000
@osjayaprakash
osjayaprakash / SPOJ-BYTESE2.cpp
Created December 29, 2012 17:36
BYTESE2, SPOJ
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
#define PB push_back
typedef pair <int, bool> pii;
typedef unsigned long long ull;
@osjayaprakash
osjayaprakash / SPOJ-template.cpp
Last active December 10, 2015 09:08
SPOJ, TEMPLATE, CPP
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <vector>
namespace IO{
const int SIZE = 1 << 19;
char buff[SIZE], *p = buff + SIZE;
char read_char(){
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
int v[205][205],N,M;
int dp[2][205][205];
int init(){
@osjayaprakash
osjayaprakash / SPOJ-GOV01.cpp
Created December 31, 2012 18:08
SPOJ, Matrix Exponentiation, Fibonacci, Recurrence Equation
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
ull mod = 1000000007;
class _matrix{
public:
ull x[2][2];
@osjayaprakash
osjayaprakash / SPOJ-DCEPC501.cpp
Last active December 10, 2015 10:38
DCEPC501
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std;
#define MAX 100012
namespace IO{
const int SIZE = 1 << 19;
char buff[SIZE], *p = buff + SIZE;
@osjayaprakash
osjayaprakash / SPOJ-WEIGHT.cpp
Created December 31, 2012 20:38
SPOJ,WEIGHT
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
namespace IO{
const int SIZE = 1 << 19;
char buff[SIZE], *p = buff + SIZE;
char read_char(){
if( p == buff + SIZE ){
fread( buff, 1, SIZE, stdin );
@osjayaprakash
osjayaprakash / SPOJ-TRECOUNT.cpp
Created January 16, 2013 06:30
SPOJ, TRECOUNT, DP
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef unsigned long long ull;
const ull MOD = 1000000000ULL;
const int MH=15;
ull dp[MH+2][4096];
@osjayaprakash
osjayaprakash / SPOJ-IKEYB.cpp
Created January 16, 2013 17:29
SPOJ, IKEYB, I KEYBOARD
#include <iostream>
#include <cstdio>
typedef unsigned long long ull;
typedef unsigned u;
using namespace std;
const u INF=1<<31;
u f[105];
char letter[105];