Skip to content

Instantly share code, notes, and snippets.

Akifumi Imanishi asi1024

Block or report user

Report or block asi1024

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View time.sh
#!/bin/bash
# set -eu
# export CUDA_VISIBLE_DEVICES=-1
DIR=$1
HASH=`git rev-parse --short HEAD`
echo "DIR=${DIR}"
View numpy_class.txt
<class 'int'> numpy.ALLOW_THREADS
<class 'type'> numpy.AxisError
<class 'int'> numpy.BUFSIZE
<class 'int'> numpy.CLIP
<class 'type'> numpy.ComplexWarning
<class 'type'> numpy.DataSource
<class 'int'> numpy.ERR_CALL
<class 'int'> numpy.ERR_DEFAULT
<class 'int'> numpy.ERR_LOG
<class 'int'> numpy.ERR_PRINT
View fallbacks_nanargmin.py
# import numpy
from cupy.fallback_mode import numpy
x = numpy.array([[float('nan'), -1], [float('nan'), 1]]) # cupy.array
result1 = numpy.nanargmin(x, axis=1) # Converts to numpy.array, calls numpy.argmin and returns cupy.array
result2 = numpy.nanargmin(x) # Returns privitive int
print(result1) # Output: [1 1]
print(result2) # Output: 1
View template.cpp
#include "../../lib/template/template.cpp"
{% if mod %} #include "../../lib/types/mod.cpp" {% endif %}
{% if mod %} using Mod = Modulo<{{ mod }}>; {% endif %}
{% if yes_str and no_str %}
struct yes_no : std::numpunct<char> {
string_type do_truename() const { return "{{ yes_str }}"; }
string_type do_falsename() const { return "{{ no_str }}"; }
};
View scc_functional.cpp
#include <bits/stdc++.h>
using namespace std;
template<typename Edge>
vector<int> scc(const vector<vector<Edge>> &g) {
const int n = g.size();
vector<vector<int>> rg(n);
vector<int> cmp(n), vs;
vector<bool> used(n, false);
View segtree2.cpp
template <class T>
class SegmentTree {
const int n;
vector<T> data;
public:
SegmentTree(const int s) : n(1 << s), data(n * 2, T()) {}
void update(int p, T val) {
data[p += n] = val;
while (p /= 2) {
data[p] = merge(data[p * 2], data[p * 2 + 1]);
View segtree1.cpp
template <class T>
class SegmentTree {
const int n;
vector<T> data;
T sub(int l, int r, int node, int lb, int ub) const {
if (ub <= l || r <= lb) return T();
if (l <= lb && ub <= r) return data[node];
T vl = sub(l, r, node * 2 + 0, lb, (lb + ub) / 2);
T vr = sub(l, r, node * 2 + 1, (lb + ub) / 2, ub);
return merge(vl, vr);
View AOJ2751.cpp
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
const int mod = 1000000007;
View AOJ2749.cpp
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;
int N, M;
int s[16], d[128];
int memo[1<<15][128];
View AOJ2748.cpp
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;
using ld = long double;
struct Edge{ int src, dest; };
You can’t perform that action at this time.