Source
stringclasses
1 value
Date
int64
2.01k
2.02k
Text
stringlengths
22
783k
Token_count
int64
20
394k
Project_CodeNet
2,018
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, std.bitmanip; const long MOD = 998244353; const long INF = 1L << 59; void main() { auto s = readln.split.map!(to!int); auto N = s[0...
500
Project_CodeNet
2,018
# -*- coding: utf-8 -*- def inpl(): return list(map(int, input().split())) N, _ = inpl() A = inpl() if N == 1: print(*A) exit() L = [0]*(N+1) R = [0]*(N+1) for i in range(N-1): R[A[i]] = A[i+1] L[A[i+1]] = A[i] lm = A[0] rm = A[-1] for q in inpl(): if q == rm: l = L[q] ...
316
Project_CodeNet
2,018
using System; using System.Collections.Generic; using System.Linq; using System.IO; //using System.Text; //using System.Text.RegularExpressions; //using System.Globalization; //using System.Diagnostics; using static System.Console; //using System.Numerics; //using static System.Math; //using pair = Pair<int, int>; cla...
941
Project_CodeNet
2,014
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<(int)n;++i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define ALL(c) (c).begin(), (c).end() #define chmax(a,b) (a<(b)?(a=b,1):0) #define chmin(a,b) (a>(b)?(a=b,1):0) #define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w...
1,351
Project_CodeNet
2,014
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;i++) #define rep(i,n) REP(i,0,n) #define IINF (INT_MAX) #define EPS (1e-7) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; //作成中 VerifyしたものにはVerifyと書いてある //Verify AOJ 0115 class Point3d{ public: double x,y,z; Point3d(double x=0,double ...
4,437
Project_CodeNet
2,015
#include<cstdio> #include<cmath> const double eps=1e-9; bool zero(double e) {return fabs(e)<eps;} int sgn(double e) {return e<-eps?-1:e>eps;} struct v3{ double x,y,z; v3(){} v3(double x,double y,double z):x(x),y(y),z(z){} void s() { scanf("%lf%lf%lf",&x,&y,&z); } void p() { ...
1,206
Project_CodeNet
2,015
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8; const double INF = 1e+8; struct P3{ double x, y, z; P3(double x=0, double y=0, double z=0):x(x),y(y),z(z){} P3 operator + (const P3 &a) const{ return P3(x+a.x, y+a.y, z+a.z); } P3 operator - (const P3 &a) const{ return P3(x-a.x, y-a.y, z-a...
1,781
Project_CodeNet
2,018
#include <cmath> #include <iostream> using namespace std; const int spl = 1048576; const double pi = acos(-1.0); class point3d { public: double x, y, z; point3d() : x(0), y(0), z(0) {}; point3d(double x_, double y_, double z_) : x(x_), y(y_), z(z_) {}; point3d& operator+=(const point3d& p) { x += p.x; y += p.y; z +...
601
Project_CodeNet
2,015
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using...
871
Project_CodeNet
2,018
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pa...
2,197
Project_CodeNet
2,020
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 99999999999999999 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; struct Point{ Point(double arg_x,double arg_y,double arg_z){ x = arg_x; y = arg_y; z = arg_z; ...
1,076
Project_CodeNet
2,015
#include<stdio.h> #include<algorithm> #include<math.h> using namespace std; double PI=acos(-1.0); double EPS=1e-9; double ABS(double a){return max(a,-a);} int main(){ double acx,acy,acz,bcx,bcy,bcz; double avx1,avx2,avy1,avy2,avz1,avz2; double bvx1,bvx2,bvy1,bvy2,bvz1,bvz2; scanf("%lf%lf%lf%lf%lf%lf%lf%lf%lf",&acx,...
873
Project_CodeNet
2,016
#include<bits/stdc++.h> using namespace std; double eps = 1e-8, PI = acos(-1); double Sqrt(double x){ return (x<0?0:sqrt(x)); } bool eq(double a, double b){ return (-eps<a-b&&a-b<eps); } struct Point{ double x,y,z; Point (double a=0,double b=0,double c=0): x(a),y(b),z(c) {} Point operator + (const Point &...
1,194
Project_CodeNet
2,016
#include<bits/stdc++.h> using namespace std; const double EPS = 1e-9; struct P3{ double x,y,z; P3(double x,double y, double z):x(x),y(y),z(z) {} P3 operator + (const P3 &a) const{ return (P3){x+a.x, y+a.y, z+a.z}; } P3 operator - (const P3 &a) const{ return (P3){x-a.x, y-a.y, z-a.z}; } P3 operator / (doubl...
2,019
Project_CodeNet
2,018
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <cmath> using namespace std; const double EPS = 1e-8; const double INF = 1e12; #define EQ(n,m) (abs((n)-(m)) < EPS) struct Point{ double x,y,z; Point(double x, double y, double z):x(x), y(y), z(z){} Point(){} Point &...
910
Project_CodeNet
2,014
#include <iostream> #include <cstdio> #include <valarray> #include <cmath> using namespace std; #define EPS 1e-8 typedef valarray<double> P; void assign(P &p, double x, double y, double z){ p.resize(3); p[0] = x; p[1] = y; p[2] = z; } double dot(const P &a, const P &b){ return (a * b).sum(); } P cross(const P...
489
Project_CodeNet
2,015
require 'matrix' include Math vs = [] 2.times { vs << Vector[*gets.split.map(&:to_f)] vs += gets.split.map(&:to_f).each_slice(3).map{|a| Vector[*a]} } d = vs[0].dup vs[0] -= d vs[3] -= d if vs[1][2] != 1 cos = vs[1][0] / sqrt(vs[1][0]**2 + vs[1][1]**2) sign = (vs[1][1] > 0 ? -1 : 1) mat = Matrix[[cos, -sign * ...
740
Project_CodeNet
2,018
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; #define fi first #define se second #define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++) #define rep(i,n) repl(i,0,n) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<x<<endl #defi...
1,064
Project_CodeNet
2,016
#define _USE_MATH_DEFINES #include <iostream> #include <queue> #include <vector> #include <cmath> #include <algorithm> #include <iomanip> #include <string> #include <stack> #include <cctype> #include <cstdlib> #include <map> using namespace std; #define INF (1 << 20) #define EPS (1e-10) #define EQ(a,b) (fabs((a)-(b)) ...
1,227
Project_CodeNet
2,018
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 99999999999999999 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; #define LEN 505 #define NUM 30 #define SIZE 10 int N,M; int height[LEN],boss[LEN]; ll calc_min[NUM],c...
1,382
Project_CodeNet
2,018
#include<bits/stdc++.h> using namespace std; using Int = long long; struct UnionFind{ Int n; vector<Int> r,p; UnionFind(){} UnionFind(Int sz):n(sz),r(sz,1),p(sz,0){iota(p.begin(),p.end(),0);} Int find(Int x){ return (x==p[x]?x:p[x]=find(p[x])); } bool same(Int x,Int y){ return find(x)==find(y); ...
1,181
Project_CodeNet
2,018
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <utility> #define llint long long #define mod 1000000007 using namespace std; typedef pair<llint, llint> P; struct UnionFind{ int size; vector<int> parent; UnionFind(){} UnionFind(int size){ this->size = size;...
1,116
Project_CodeNet
2,015
#include <iostream> #include <cstdio> #include <vector> #include <set> #include <map> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <cstring> #include <functional> #include <cmath> #include <complex> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define rep1(i,n) for(in...
849
Project_CodeNet
2,018
#include <bits/stdc++.h> #define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME #define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) #define Pr(a) (#a)<<"="<<(a)<<" " #define pr1(a) cerr<<Pr(a)<<endl #define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl #define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl #define ...
1,680
Project_CodeNet
2,018
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll MOD = 1000000007; class DisjointSets { public: DisjointSets(const int v) : parent(v), rank(v, 0) { iota(parent.begin(), parent.end(), 0); } bool same(const int a, const int b) { return find(a) == find(b); } int find(const int a...
885
Project_CodeNet
2,018
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pa...
1,089
Project_CodeNet
2,019
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; string S; int N, M, V[509], U[22], power[19], num[22], cl[22], cr[22], col[22], cnts; long long mod = 1000000007; vector<int>vec, X[22], G[22]; void dfs(int pos) { if (col[pos] >= 1) return; col[pos] = cnts; G[cnts].pu...
1,128
Project_CodeNet
2,020
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> l_l; typedef pair<int, int> i_i; template<class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T &a, T b) { if(a > b) { ...
1,167
Project_CodeNet
2,019
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; constexpr int mod = 1e9 + 7; class union_find { public: union_find(int n) : par(n, -1) {} int root(int x) { return par[x] < 0 ? x : par[x] = root(par[x]); } void unite(int x, int y) { x =...
991
Project_CodeNet
2,015
#include<stdio.h> #include<algorithm> using namespace std; char str[1100]; char in[2]; int u[110]; int mod=1000000007; int UF[110]; int FIND(int a){ if(UF[a]<0)return a; return UF[a]=FIND(UF[a]); } void UNION(int a,int b){ a=FIND(a);b=FIND(b);if(a==b)return; UF[a]+=UF[b];UF[b]=a; } char tmp[1100]; int L[110]; int R...
1,605
Project_CodeNet
2,015
#include<iostream> #include<string> #include<cctype> #include<vector> #include<numeric> #include<map> #include<set> using namespace std; int par[128]; int M=1000000007; int find(int x){ return (x==par[x])?x:par[x]=find(par[x]); } void unite(int a,int b){ par[find(a)]=find(b); } int main(){ int N,m; cin>>N>...
719
Project_CodeNet
2,020
#include<iostream> #include<vector> #include<map> using namespace std; #include<vector> struct UF{ int n; vector<int>parent,rank; UF(int n_=0):n(n_),parent(n_),rank(n_,1) { for(int i=0;i<n_;i++)parent[i]=i; } int find(int a){return parent[a]!=a?parent[a]=find(parent[a]):a;} bool same(int a,int b){return find(a...
837
Project_CodeNet
2,018
#include <bits/stdc++.h> #define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME #define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) #define Pr(a) (#a)<<"="<<(a)<<" " #define pr1(a) cerr<<Pr(a)<<endl #define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl #define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl #define ...
1,680
Project_CodeNet
2,019
#include<bits/stdc++.h> using namespace std; using Int = long long; struct UnionFind{ Int n; vector<Int> r,p; UnionFind(){} UnionFind(Int sz):n(sz),r(sz,1),p(sz,0){iota(p.begin(),p.end(),0);} Int find(Int x){ return (x==p[x]?x:p[x]=find(p[x])); } bool same(Int x,Int y){ return find(x)==find(y); ...
1,171
Project_CodeNet
2,018
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int,int> P; int n,m; int u[11]; string str; ll ans=0; int col[10]; int num[2001]; vector<int> G[51]; vector<int> seq[51]; P rng[51]; int cnt; bool used[51]; bool flag[51]; int id[20]; int dp[61][1<<10]; P dfs2(in...
1,280
Project_CodeNet
2,020
from itertools import product import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): MOD = 10**9 + 7 N, M = map(int, readline().split()) S = readline().strip() U = [0]*M L = [0]*M mp = {} for i in range(10): mp[str(i)] = i for i in range(M): v, u =...
1,129
Project_CodeNet
2,015
#@profile def dfs(p,s,c,cmin,cmax): if len(p) == 0: return solve(s,c,cmin,cmax) lower, u = p[0] c += lower if u <= 9: cmin[lower] = 0 cmax[lower] = u return dfs(p[1:],s,c,cmin,cmax) cmin[lower] = 0 cmax[lower] = 9 ret = dfs(p[1:],s,c,cmin,cmax) upp...
727
Project_CodeNet
2,020
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class Main{ public static void main(String args[]){ new Main().mainrun(); } Scanner scan; private int N,count; private boolean loop,inf; private List<Order> OrderList; private ...
919
Project_CodeNet
2,020
#include <iostream> #include <algorithm> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template<class T> constexpr...
928
Project_CodeNet
2,018
#include <iostream> #include <map> #include <utility> using namespace std; struct line{ int type; int con; char c[3]; }; const int N=100; int main(){ int n,t,cnt=0,temp; map<int,int> m; map<char,int>var; line a[N]; string s; cin>>n; for(int i=0;i<n;i++){ cin>>t; m...
1,066
Project_CodeNet
2,017
#include <bits/stdc++.h> using namespace std; struct cmd{ int line; string p; vector<string>v; }; vector<cmd> A; map<int,int> idx; map<string,int> var; bool isNum(const string &a){return isdigit(a[0]);} int StoI(const string &a){ int res=0; for(int i=0;i<a.size();i++)res=res*10+a[i]-'0'; return res; } in...
692
Project_CodeNet
2,017
#include <stdio.h> #include <cmath> #include <algorithm> #include <cfloat> #include <stack> #include <queue> #include <vector> #include <string> #include <iostream> #include <set> #include <map> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0...
1,903
Project_CodeNet
2,017
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) #define INF (1e9) #define N 1005 using namespace std; string s[N],s1[N],s2[N],s3[N]; set<char> S; int n,num; int d[N],p; int var[N]; int get_num(string str){ if('a'<=str[0]&&str[0]<='z')return var[(int)str[0]]; int res=0; rep(i,str.size())re...
628
Project_CodeNet
2,016
#include<bits/stdc++.h> using namespace std; int N; int s[100]; char t[100][10]; int u[100],v[100],w[100]; int num[1000]; int s2i(string str){ stringstream ss; ss<<str; int res; ss>>res; return res; } int change(int x){ if(0<=x){ return x; }else{ return num[-x]; } } void setvalue(int x,int y...
1,098
Project_CodeNet
2,019
#include <iostream> #include <chrono> #include <string> #include <map> using namespace std; using ll = long long; struct Line { string op; string v1, v2, v3; Line () {}; Line (string &op, string &v1, string &v2, string &v3): op(op), v1(v1), v2(v2), v3(v3) {}; }; int n; map<string, int> var; Line program[1005];...
1,094
Project_CodeNet
2,019
#include <bits/stdc++.h> using namespace std; int n; struct Operator{ string id, ope, a, b, c; }; Operator mei[100]; map<string, int> opeLine; int used[300]; int hen_id[300]; char rhen_id[300]; int main(){ cin >> n; for(int i = 0;i < n;i++){ string id, ope; cin >> id >> ope; opeLine[id] = i; if(ope ==...
967
Project_CodeNet
2,018
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> V; typedef pair<ll,ll> P; typedef map<ll,ll> M; #define REP(i,n) for(ll (i) = 0; (i) < (n); ++(i)) signed main(){ int n; cin >> n; V line(n); M line_map; vector<string> type(n); vector<vector<string>> args(...
896
Project_CodeNet
2,017
#include<bits/stdc++.h> using namespace std; int num_id[500]; char num_rev[6]; int num_cnt = 0; int num[6]={}; string info[52],var[52][3]; int line[52],dest[52],con[52]; int id_cnt[1002]={}; int id_rev[52]={}; int n; priority_queue<pair<char,int> >pq; // N,num1,num2,num3,num4,num5 int dp[52][16][16][16][16][16] = ...
1,406
Project_CodeNet
2,019
#include <cstdio> #include <cctype> #include <map> #include <vector> #include <string> #include <set> struct directive { char type; std::string dst, src1, src2; size_t dline; directive() = default; directive(std::string const&, std::string const& dst, std::string const& src): type('='), dst(dst), src1(sr...
1,061
Project_CodeNet
2,017
#include <cstdio> #include <iostream> #include <algorithm> #include <string> #include <cstring> #include <vector> #include <queue> #include <set> #include <map> #include <cmath> #include <iomanip> #include <cassert> #include <bitset> using namespace std; typedef pair<int, int> P; #define rep(i, n) for (int i=0; i<(n);...
820
Project_CodeNet
2,017
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define fi first #define se second template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; } template<typename A, typen...
1,311
Project_CodeNet
2,017
#include<bits/stdc++.h> using namespace std; int main() { string s; int N; cin >> N; getline(cin, s); unordered_map<string, int> index; map<string, int> var; vector<vector<string>> stmt(N, vector<string>(5)); for(auto i = 0; i < N; ++i) { getline(cin, s); stringstream ss(s); ss >> stmt[i][...
629
Project_CodeNet
2,017
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; using ld = long double; const ld eps = 1e-9; struct sentence { int type; int a; int b; int c; }; map<int, int>line_mp; map<string, int>name_mp; bool memo[51][(1 << 20)]; int getid(vector<int...
1,270
Project_CodeNet
2,017
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define pb push_back #define rep(i, a, n) for(int i = (a); i < (n); i++) #define dep(i, a, n) for(int i = (a); i >= (n); i--) #define mod 1e9+7 __attribute__((constructor)) void initial() { cin.tie(0); ios::sync_with_s...
975
Project_CodeNet
2,016
#include <bits/stdc++.h> using namespace std; typedef long long int64; unordered_map< string, int > ff; void stop() { int ret = 0; vector< pair< char, int > > vv; for(auto &c : ff) if(isalpha(c.first[0])) vv.emplace_back(c.first[0], c.second); sort(begin(vv), end(vv)); for(auto& c : vv) printf("%c=%d\...
540
Project_CodeNet
2,017
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include...
1,038
Project_CodeNet
2,019
#define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <bitset> #define MAX_VALUE (1000 * 16 * 16 * 16 * 16 * 16) enum cmd_t { CMD_ADD, CMD_SUB, CMD_SET, CMD_IF, CMD_HALT }; struct command { cmd_t type; int var1; int var2; int var3; int opt; }; ...
1,600
Project_CodeNet
2,016
#include<bits/stdc++.h> #define REP(i,s,n) for(int i=s;i<n;++i) #define rep(i,n) REP(i,0,n) using namespace std; struct Op { string op; string v[3]; }; int getValue(vector<int> &state,int id) { if( state[id] == -1 ) return state[id] = 0; return state[id]; } int main() { int n; cin >> n; map<string,in...
1,351
Project_CodeNet
2,016
#include <iostream> #include <map> #include <sstream> #include <cstring> #include <cctype> using namespace std; constexpr int MAX = 1010; constexpr int LIMIT = 50000000; int N, line[MAX], order[MAX]; char c1[MAX], c2[MAX], c3[MAX]; int v[MAX]; int getNum(string& s) { if (s == "SET") return 0; if (s == "ADD"...
745
Project_CodeNet
2,019
#include <string> #include <vector> #include <iostream> #include <algorithm> #include <functional> using namespace std; int main() { int Q; cin >> Q; vector<int> ln(Q), c1(Q), c2(Q), c3(Q); vector<string> tp(Q), v1(Q), v2(Q), v3(Q); vector<string> varlist; function<bool(string)> is_number = [&](string str) { for...
1,171
Project_CodeNet
2,018
#include<bits/stdc++.h> using namespace std; typedef struct{ int raw; string com; string var1, var2, var3; } P; int array[50][5] = {}; map<string, bool> used; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); for(int i = 0;i < 50;++i){ for(int j = 0;j < 5;++j){ array[i][j] = -1; } } int...
1,435
Project_CodeNet
2,019
import scala.collection.mutable object Main extends App { import scala.io.StdIn._ val n = readInt val program = new Program(Array.tabulate(n){_ ⇒ readLine.trim}) executeWhileEnd(program) def executeWhileEnd(program: Program): Unit = { val single: State = new State val double: State = new State ...
1,688
Project_CodeNet
2,017
// AOJ 0330: Halting Problem // 2017.10.27 bal4u@uu #include <stdio.h> #include <stdlib.h> #include <string.h> #define ADDV 1 #define ADDC 2 #define SUBV 3 #define SUBC 4 #define SETV 5 #define SETC 6 #define IFV 7 #define HALT 8 typedef struct { int lin, cmd, v1, v2, v3, con, to; } T; T pgm[52]; int n; int tr['z'...
1,035
Project_CodeNet
2,017
n = int(input()) stmts = [input().split() for i in range(n)] mapper = {} for i, stmt in enumerate(stmts): mapper[stmt[0]] = i vn = {} for stmt in stmts: for ope in stmt[2:]: if ope.isalpha() and ope not in vn: vn[ope] = len(vn) vs = [0]*len(vn) def stmt_add(v1, v2, v3): v1 = vn[v1] ...
747
Project_CodeNet
2,018
from itertools import product def check(): n = int(input()) prog = [input().split() for _ in range(n)] v = set() for ss in prog: for s in ss: if "a" <= s <= "z": v.add(s) v = sorted(list(v)) var_state = [0] * len(v) var_to_ind = dict(zip(v, range(len(v)))) line_to_ind = {} for...
1,036
Project_CodeNet
2,019
def solve(): from sys import stdin f_i = stdin N = int(f_i.readline()) from string import ascii_lowercase next_line = {} S = {} # statements V = {} # values line = 0 for i in range(N): stmt = f_i.readline().split() next_line[line] = stmt[0] line = st...
636
Project_CodeNet
2,020
using System.Linq; using System.Collections.Generic; using System; public class hello { public static bool[,,,,,] visited; public static void Main() { visited = new bool[50, 16, 16, 16, 16, 16]; var n = int.Parse(Console.ReadLine().Trim()); var pr = new int[n, 4]; var p = 0;...
1,423
Project_CodeNet
2,018
(let ((n (read)) (k (read)) (count 1) (temp 0) (ans 0)) (loop for i from (1+ k) upto n do (setf ans (+ ans (* (floor (/ n i)) count))) ;; (format t "~A:~A " i (* (floor (/ n i)) count)) (setf temp (- (+ (mod n i) count (if (= k 0) 0 1)) i)) (if (and (>...
179
Project_CodeNet
2,019
import java.io.*; import java.util.*; import java.util.Map.Entry; import java.util.stream.Collectors; @SuppressWarnings("unused") public class Main { String fileName = "input.txt"; final boolean isDebug = false; //final boolean isDebug = true; FastScanner in = new FastScanner(System.in); PrintWriter out = new Pri...
933
Project_CodeNet
2,018
import java.util.*; class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); long count = 0; long val; for(long t = K+1; t<=N;t++){ val = N/t; count += val * (t-K); long v2 = N - (val*t + K -1); if(v2>0) count ...
129
Project_CodeNet
2,018
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } public void run() { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long K = sc.nextLong(); long ans = 0; for (long b = K + 1; b <...
276
Project_CodeNet
2,018
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); long count = 0L; if (k == 0) { count = (long)n*n; System.out.println(count); ...
151
Project_CodeNet
2,018
/* * 高橋君は、N 以下の正の整数の 2 つ組 (a,b) を持っていましたが、忘れてしまいました。 高橋君は、a を b で割ったあまりが K 以上であったことを覚えています。 * 高橋君が持っていた組としてあるうるものの個数を求めてください。 */ import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); //入力 long n = Integer.parseInt(s...
341
Project_CodeNet
2,019
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long K = sc.nextLong(); long ans = 0; if(K==0) { System.out.println(N*N); return; } for(int i = (int)...
151
Project_CodeNet
2,018
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); if(k==0) { System.out.println((long)n*n); return; } int res=0; long ans=0; for(int b=k+1;b<=n;b++) { res=n/b; ans+=...
129
Project_CodeNet
2,018
import java.io.*; import java.util.StringTokenizer; public class Main { /********************************************************************************************** * DEBUG * ******************************************...
618
Project_CodeNet
2,018
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long K = sc.nextLong(); long ans = 0; if(K==0) System.out.println(N*N); else{ for(long i=K+1;i<=N;++i){ long max = N/i; ans += (i-K)*max; if(N-max*...
130
Project_CodeNet
2,020
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; public class Main { private static final String NO = "NO"; private static fina...
1,400
Project_CodeNet
2,019
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); long ans = 0; for(long j = k + 1; j <= n; j++) { long t = n / j; long r = n - t * j; long a = (j - k) * t + Math....
139
Project_CodeNet
2,018
import java.io.*; import java.util.StringTokenizer; public class Main { private static class SegmentTree { int N; int[] tree; public SegmentTree(int n) { N = n; tree = new int[N << 2]; } private static int left(int p) { return p << 1; ...
846
Project_CodeNet
2,020
import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); // ans: n以下の(a, b)で、a % b >= kになるパターン数 long ans = 0; ...
258
Project_CodeNet
2,018
// package arc.arc091; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = n...
681
Project_CodeNet
2,018
import java.util.Scanner; public class Main { public void main(Scanner sc) { long n = sc.nextLong(); long k = sc.nextLong(); long sum = 0; for (int b = 1;b <= n;b++) { if (b <= k) { continue; } sum += (b - k) * (n / b) + Mat...
150
Project_CodeNet
2,019
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
412
Project_CodeNet
2,018
import java.io.*; import java.util.*; /** * * @author prabhat */ class Main { //static int[] a; static int[] S; static long[] sum; public static int mod=1000000007; static int[][] dp; static boolean[][] isPalin; static int max1=5000+10; static int[][] g; static int ver; static ...
4,269
Project_CodeNet
2,018
import java.util.Scanner; public class Main { public static void main(String[] args) { Main m = new Main(); m.run(); } Scanner sc = new Scanner(System.in); void run() { int n = sc.nextInt(); int k = sc.nextInt(); System.out.println(solve(n,k)); } long solve(long n, long k){ if(k == 0){ ...
183
Project_CodeNet
2,020
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; //import java.util.HashMap; import java.util.NoSuchElementException; public class Main{ static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); //static String S; static long n; //static in...
931
Project_CodeNet
2,018
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.StringTokenizer; import java.io.Writer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; ...
486
Project_CodeNet
2,018
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.PrimitiveIterator; import java.util.Spliterator; import java.util.Spliterators; import java.util.function.Supplier; import java.util.stream.IntStream; import java.util.stream.Stream; ...
1,245
Project_CodeNet
2,018
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
657
Project_CodeNet
2,019
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import j...
255
Project_CodeNet
2,018
import java.util.Scanner; /** * https://arc091.contest.atcoder.jp/tasks/arc091_b */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long K = sc.nextLong(); sc.close(); long ans = 0; if(K==0){ ans = N*N; }else{ fo...
148
Project_CodeNet
2,018
import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { Main m = new Main(); //* m.input(); m.solve(); m.output(); /*/ m.debug(); //*/ ...
1,383
Project_CodeNet
2,018
import java.io.*; import java.util.*; import java.math.*; // import java.awt.Point; public class Main { InputStream is; PrintWriter out; String INPUT = ""; int mod = 1_000_000_007; int inf = Integer.MAX_VALUE; void solve(){ long n = nl(); long k = nl(); long ans = 0;...
1,008
Project_CodeNet
2,018
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); if(k == 0) { System.out.print((long) n * n); return; } long sum = 0; ...
129
Project_CodeNet
2,018
import java.io.*; import java.util.*; public class Main { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); int k = sc.nextInt(); long ans = 0; for (int b = k + 1; b <= n; b++) { long tmp = cnt(n, b, k); ans += tmp; // pr.printf("%d %d\n", b...
1,190
Project_CodeNet
2,020
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author silviase */ public class Main { public static void main(String[] args) { InputStream ...
250
Project_CodeNet
2,018
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; static void solve() { // a % b...
1,087
Project_CodeNet
2,020
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { long mod = (long)Math.pow(10,9)+7; FastScanner sc = new FastScanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); long ans = 0; if(k == ...
516
Project_CodeNet
2,020
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str[] = br.readLine().split(" "); long n = Long.parseLo...
179