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
fin = open('Downloads/sub.sql', 'r') | |
cnt = 0 | |
fcnt = 0; | |
fout = open('output/out_' + `fcnt` + '.sql', 'w'); | |
with fin as ins: | |
for line in ins: | |
cnt = cnt + 1 | |
fout.write(line) | |
if line.startswith("commit") and cnt > 50000: | |
fout.close() |
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 java.io.InputStream; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Modifier; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.util.ArrayList; | |
import java.util.List; |
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
package chatdemo.server; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.UnsupportedEncodingException; | |
import java.net.InetSocketAddress; | |
import java.net.MalformedURLException; | |
import java.net.ServerSocket; | |
import java.net.URL; |
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 <vector> | |
#include <stack> | |
#include <sstream> | |
#include <utility> | |
#include <set> | |
using namespace std; | |
vector<int> cnt; |
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 <vector> | |
#include <stack> | |
#include <sstream> | |
#include <utility> | |
using namespace std; | |
void getNextPoint(pair<int, int> &point, int m , int n, int &dir) { | |
int x = point.first; |
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 <vector> | |
#include <stack> | |
#include <sstream> | |
using namespace std; | |
struct NumExt { | |
int val; | |
int index; |
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> | |
#include <cassert> | |
using namespace std; | |
int kSum(vector<int> arr, int k) { | |
assert(k <= arr.size()); | |
vector<int> count(10); | |
for (int i = 0; i < arr.size(); i++) { | |
count[arr[i]]++; |
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> | |
#include <stack> | |
using namespace std; | |
struct TreeNode { | |
int val; | |
TreeNode *left; | |
TreeNode *right; | |
TreeNode(int _val) : val(_val), left(NULL), right(NULL) {}; |
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 <cassert> | |
using namespace std; | |
bool equal(string& s, int i, string& t, int j) { | |
while (i < s.size() && j < t.size() && s[i] == t[j]) { | |
i++; | |
j++; | |
} |
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 <bitset> | |
using namespace std; | |
int countOne(unsigned int n) { | |
int count = 0; | |
while (n) { | |
n = n & (n - 1); | |
count++; | |
} |
NewerOlder