Skip to content

Instantly share code, notes, and snippets.

@evansb
Created July 1, 2014 14:24
Show Gist options
  • Save evansb/582da4f3cdc570efa79c to your computer and use it in GitHub Desktop.
Save evansb/582da4f3cdc570efa79c to your computer and use it in GitHub Desktop.
CP stuff
#!/bin/bash
filename=$1
touch $1.input
touch $1.output
touch $1.model
cp ~/Code/bash/Makefile .
cp ~/Code/cpp/CF.cpp $1.cpp
sed -i -e "s/TARGET_NAME/$1/g" Makefile
TARGET=TARGET_NAME
CC=clang++
CFLAG=-Wall -O3 -g -DNDEBUG
SRC=$(shell find . -name *.cpp)
OBJ=${SRC:.cpp=.o}
all: $(OBJ)
./$(TARGET) $(TARGET).input $(TARGET).output
diff $(TARGET).output $(TARGET).model
.cpp.o :
$(CC) $(CFLAG) $(SRC) -o $(TARGET)
clean:
rm *.o
.PHONY: all
// author: [email protected]
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <limits>
#include <cmath>
#include <functional>
#include <bitset>
#include <ctime>
#include <deque>
#include <stack>
#include <sstream>
using namespace std;
#define REP(n) for(int i = 1; i <= n; i++)
#define REPN(n) for(int i = 0; i < n; i++)
#define X(V) (V).first
#define Y(V) (V).second
#define PB(V,W) (W).push_back(V)
#define INS(V,W) (W).insert(V)
#define vi vector<int>
#define vc vector<char>
#define mis map<int,string>
#define eps 1e-9
typedef long long I64;
typedef long double F64;
typedef wchar_t UC;
// end of template
int main(int argc, char* argv[]) {
ios_base::sync_with_stdio(false);
#ifdef NDEBUG
#define dlog(X) cerr<< __LINE__<<":\n\t"<<#X<<":"<<X<<endl;
ifstream din(argv[1]);
ofstream dout(argv[2]);
#else
#define dlog(X) ;
#define din cin
#define dout cout
#endif
return 0;
}
// vim: ts=4 sw=4 et
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment