text
stringlengths
59
71.4k
`timescale 1ns / 1ps `define intN 32 `define addrN 10 `include "primitives.v" `include "tests_axil_map_w.v" `include "array.v" module tests_axil_map_w_tb; localparam N = 1024; `wire(Array, (`addrN, `intN), arr); wire `intT res; integer write_seed = 21; integer read_seed = 42; `reg(stream, `i...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int l = s.size(); int a[2]; int b[2]; a[0] = a[1] = 0; b[0] = b[1] = 0; long long ans_odd = 0LL; long long ans_even = 0LL; for (int i = 0; i < l; i++) { ans_odd++; if (s[i] == a ) { ...
#include <bits/stdc++.h> using namespace std; namespace scanfuck { const int L = (1 << 21) + 1; struct io { char ibuf[L], *iS, *iT, obuf[L], *oS, *oT, c, st[55]; int f, tp; void flush() { fwrite(obuf, 1, oS - obuf, stdout); oS = obuf; } void putc(char x) { *oS++ = x; ...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n, i, j; cin >> n; long long int arr[n][n]; for (i = 0; i < n; i++) { string s; cin >> s; for (j = 0; j < n; j++) { long long int te...
#include <bits/stdc++.h> using namespace std; const unsigned long long hash1 = 201326611; const double eps = 1e-8; const long long INF = 0x3f3f3f3f3f3f3f3f; const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; const int N = 255; const int M = 12; const int dif = 26; const double PI = acos(-1.0...
// Name: WcaReadWordReg.v // // Copyright(c) 2013 Loctronix Corporation // http://www.loctronix.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the Lice...
#include <bits/stdc++.h> using namespace std; const int maxN = 200009; vector<int> a; vector<int> b; vector<int> bb; int main() { long long s, x; cin >> s >> x; int s1 = s, x1 = x; int ans = 0; for (int i = 0; i < 45; i++) { if ((s & ((long long)1 << i)) && (x & ((long long)1 << i)...
////////////////////////////////////////////////////////////////////// //// //// //// dbg_comm.v //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1000 + 3; void read(int &x) { char ch; bool flag = 0; for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == - )) || 1); ch = getchar()) ; for (x = 0; isdigit(ch); x = (x << 1) + (x << 3) + ch - 48, ch = getchar()) ...
#include <bits/stdc++.h> int dr[] = {2, 2, -2, -2, 1, -1, 1, -1}; int dc[] = {1, -1, 1, -1, 2, 2, -2, -2}; int dr1[] = {0, 0, 1, 1, 1, -1, -1, -1}; int dc1[] = {1, -1, 1, 0, -1, 0, 1, -1}; int dr2[] = {0, 0, 1, -1}; int dc2[] = {1, -1, 0, 0}; using namespace std; vector<int> adj[1000005]; int a[100000...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n, q; cin >> n >> q; string s; cin >> s; int pref[n + 1]; memset(pref, 0, sizeof(pref)); set<int> arr[2 * n + 5...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i; cin >> n; long long int a[n], b[n], c[n + 1], x = n - 1; for (i = 0; i < n; i++) { b[i] = 0; c[i + 1] = 1; } c[0] = 1; for (i = 0; i < n; i++) { cin >> a[i]; a[i]--; b[a[i]]++; ...
#include <bits/stdc++.h> using namespace std; char A[100 + 3], B[100 + 3], C[100 + 3], Ans[100 + 3]; int f[100 + 3][100 + 3][100 + 3], prei[100 + 3][100 + 3][100 + 3], prej[100 + 3][100 + 3][100 + 3], prek[100 + 3][100 + 3][100 + 3]; int Go[100 + 3][26], fail[100 + 3], la, lb, lc, len, ansi, ansj, ansk; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:23:16 04/12/2016 // Design Name: // Module Name: memoria_registros // Project Name: // Target Devices: // Tool versions: // Description: // // Dependenci...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int BITS = 60; struct tree_node { int child[2] = {-1, -1}; bool full = false; }; struct tree { vector<tree_node> nodes = {tree_node()}; int get_or_create_node(int &node) { int answer = node; if (node <...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; clock_t clk = clock(); int i, j; void solve(void); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; int t = 1; while (t--) solve(); return 0; } int n, m, a, b; bool cnt; bool vis[1501][...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2016 Xilinx, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // /...
/* Copyright (c) 2021 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/*********************************************************/ // MODULE: j-k flip flop // // FILE NAME: jk_rtl.v // VERSION: 1.0 // DATE: January 1, 1999 // AUTHOR: Bob Zeidman, Zeidman Consulting // // CODE TYPE: Register Transfer Level // // DESCRIPTION: This module defines a J-K flip flop with an // asynchronous,...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; long long digit(long long n) { long long ans = 0; long long i = 0; while (n > 0) { long long tmp = n % 10; if (tmp != 0) { ans = ans + (tmp * pow(10, i)); i++; } n = n / 10; } return ans; } int main() { ...
`define bsg_mem_2r1w_sync_macro(words,bits) \ if (els_p == words && width_p == bits) \ begin: macro \ hard_mem_1r1w_d``words``_w``bits``_wrapper \ mem0 \ (.clk_i ( clk_i ) \ ,.r...
// File generate.vhd translated with vhd2vl v2.4 VHDL to Verilog RTL translator // vhd2vl settings: // * Verilog Module Declaration Style: 1995 // vhd2vl is Free (libre) Software: // Copyright (C) 2001 Vincenzo Liguori - Ocean Logic Pty Ltd // http://www.ocean-logic.com // Modifications Copyright (C) 2006 Mar...
#include <bits/stdc++.h> using namespace std; int main() { int64_t t, a, b; cin >> t; while (t--) { cin >> a >> b; cout << max(a, max(b, min(a, b) * 2)) * max(a, max(b, min(a, b) * 2)) << endl; } }
#include <bits/stdc++.h> using namespace std; using seg = pair<int, int>; using ll = long long; seg intersect(seg a, seg b) { seg ret = {max(a.first, b.first), min(a.second, b.second)}; if (ret.first > ret.second) return {-1, -1}; return ret; } inline int len(const seg& a) { return a.second - a....
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; char s[5010]; int main() { scanf( %s , s); int n = (int)strlen(s); int res = 0; for (int i = 0; i < n; i++) { int cnt1 = 0, cnt2 = 0; for (int j = i; j < n; j++) { if (s[j] == ( ) cnt1++; if (s[j] == ) ) cnt1--; if...
#include <bits/stdc++.h> using namespace std; int main() { int n, shet = 0; long long int ans = 0; cin >> n; ans = n; int* mas = new int[n]; for (int i = 0; i < n; i++) { cin >> mas[i]; } for (int i = 1; i < n; i++) { if (mas[i] == mas[i - 1]) { shet++; an...
#include <bits/stdc++.h> using namespace std; const long double PI = acos(-1.0l); const long long MOD = 1e9 + 7; bool debug = 1; const int N = 3e3 + 10; int seg[2 * N]; int n, m; void build() { for (int i = n - 1; i > 0; i--) seg[i] = seg[i << 1] + seg[i << 1 | 1]; } int qry(int l, int r) { ...
#include <bits/stdc++.h> const int mod = 1e9 + 7; const int N = 1010; const int inf = 0x3f3f3f3f; using namespace std; long long sum[N]; int n, a[N], b[N], v, e; int p[N]; int find(int x) { if (p[x] != x) p[x] = find(p[x]); return p[x]; } vector<int> vt[N]; bool vis[N]; struct Data { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, t, i, j, k; cin >> n >> t; string a; cin >> a; for (i = 1; i <= t; ++i) { for (j = 0; j < n - 1; ++j) { if (a[j] == B && a[j + 1] == G ) { a[j + 1] = B ; a[j] = G ; ++j; } ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, pos, lpos; int q; cin >> n >> q; for (int i = 0; i < q; i++) { cin >> pos; while (pos % 2 == 0) { lpos = pos / 2 + 1; pos += n - lpos + 1; } ...
#include <bits/stdc++.h> using namespace std; const int maxn = 201; int a[maxn], N, L, K; double f[maxn][maxn][maxn * 2], p[maxn]; int main() { scanf( %d%d%d , &N, &L, &K); for (int i = 0; i < N; ++i) { scanf( %lf , &p[i]); p[i] /= 100; } for (int i = 0; i < N; ++i) scanf( %d , &a[...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 200005; vector<int> g[maxn]; int dis[maxn]; int pa[maxn]; set<pair<int, int>> st; void dfs(int now, int pre = 0) { if (dis[now] > 2) { st.insert({dis[now], now}); } for (auto &i : g[now]) { if...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
module reg32(Rout, clr, clk, write_enable, write_value); input clr,clk, write_enable; input [31:0] write_value; output [31:0]Rout; reg[31:0] Rout; always @ (posedge clk)begin if(clr) begin Rout = 32'h00000000; end if(write_enable) begin Rout = write_value; end end endmodule module reg32_R0(Rout,...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associated do...
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2, s; cin >> s1 >> s2 >> s; string s3 = s1 + s2; sort(s3.begin(), s3.end()); sort(s.begin(), s.end()); if (s == s3) cout << YES n ; else cout << NO n ; return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = (1 << 18) + 100; const int maxnode = maxn << 2; int n, ai[maxn + 5]; int ls[maxnode + 5], rs[maxnode + 5]; int re[maxnode + 5], sp[maxnode + 5]; long long sum[maxnode + 5]; void Build(int x, int l, int r) { re[x] = sp[x] = 0; ls[x] =...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, a, b, ans; cin >> n >> a >> b; if (b > 0) { ans = (a + b) % n; if (ans == 0) ans = n; } else if (b < 0) { if (a > abs(b)) { ans = a - abs(b); ...
#include <bits/stdc++.h> using namespace std; int indeg[510], vis[510], indeg1[510], vis1[510]; int n, m; vector<vector<int> > adj(510); int check(int x) { int i, c, p; queue<int> q; for (i = 0; i < n; i++) { vis1[i] = vis[i]; indeg1[i] = indeg[i]; } indeg1[x]--; q.push(x);...
#include <bits/stdc++.h> using namespace std; string op, s1, s2; map<string, int> mp; int solve(string s) { int ast, amp; ast = count(s.begin(), s.end(), * ); amp = count(s.begin(), s.end(), & ); return ast - amp; } string remove(string s) { s.erase(remove(s.begin(), s.end(), * ), s.e...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2009 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. `ifdef VCS `define NO_SHORTREAL `en...
//-------------------------------------------------------------------------------- // controller.vhd // // Copyright (C) 2006 Michael Poppitz // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Fo...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// Copyright (c) 2000-2012 Bluespec, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, pub...
// // Copyright 2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is dis...
#include <bits/stdc++.h> using namespace std; const int N = 305; int c[N], a[N], d[N]; bool cmp(int first, int second) { if (a[first] != a[second]) return a[first] < a[second]; return first > second; } inline int lowbit(int first) { return first & -first; } int query(int first) { int res = 0; ...
`timescale 1ns / 1ps module test(); localparam period = 20; reg clk; reg rst; reg [4:0] waddr; reg [31:0] wdata; reg wvalid; reg wready; always begin clk = 1'b0; #(period/2); clk = 1'b1; #(period/2); end always @(posedge clk) begin if (rst) wready <= 1'b0; else if (!wready && wvalid) wr...
#include <bits/stdc++.h> using namespace std; int n, a, b, ans = 6; int len[15], last[15]; void dfs(int x, int va) { if (x == 7) { ans = min(ans, va); return; } for (int i = 1; i <= va; i++) { if (last[i] >= len[x]) { last[i] -= len[x]; dfs(x + 1, va); last[...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int inf = 0x3f3f3f3f; const double eps = 1e-15; const long long INF = (1LL << 60); const int N = 200000 + 100; int xis[N << 1]; bool vis[N << 1]; struct QUE { bool flag; int x, y; } que[N]; struct SegTree { ...
#include <bits/stdc++.h> using namespace std; int main() { int t; t = 1; while (t--) { long long int n; cin >> n; long long int arr[n + 1]; long long int ans[n + 1]; unordered_map<long long int, long long int> mp; arr[0] = 0; for (__typeof(n + 1) i = (1) - ((1) ...
#include <bits/stdc++.h> using namespace std; struct Edge { int u, v, cap, cost, next; } edge[555 * 1111]; int head[555]; int NV, NE, vs, vt; void addEdge(int u, int v, int cap, int cost) { edge[NE].u = u; edge[NE].v = v; edge[NE].cap = cap; edge[NE].cost = cost; edge[NE].next = head...
`timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base for each unit, ranging from seconds * to femtoseconds, and must be...
#include <bits/stdc++.h> using namespace std; int compareAscending(const void *a, const void *b) { return (*(int *)a - *(int *)b); } int compareDecending(const void *a, const void *b) { return (*(int *)b - *(int *)a); } int compareFirst(const void *a, const void *b) { if (((pair<int, int> *)a)->...
/************************************************************************ statusLED.v Status LED control module Domesday Duplicator - LaserDisc RF sampler Copyright (C) 2018 Simon Inns This file is part of Domesday Duplicator. Domesday Duplicator is free software: you can redistribute it and/or modify it...
#include <bits/stdc++.h> using namespace std; int ans[10000]; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n, k; string s; cin >> n >> k; cin >> s; int cnt = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == s[i - 1]) { cnt++; } else { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, r; char str[] = { R , O , Y , B , G , I , V }; cin >> n; r = n % 7; n -= r; for (i = 0; i < n; i++) cout << str[i % 7]; for (i = 0; i < r; i++) cout << str[3 + i % 4]; }
//---------------------------------------------------------------------------- // Copyright (C) 2001 Authors // // This source file may be used and distributed without restriction provided // that this copyright statement is not removed from the file and that any // derivative work contains the original copyright notic...
#include <bits/stdc++.h> using namespace std; int n, m, k, p, x, y, f, kek, all, a[100005]; int main() { cin >> n >> k >> p >> x >> y; for (int i = 1; i <= k; i++) cin >> a[i]; int kol = (n + 1) / 2; for (int i = 1; i <= k; i++) if (a[i] >= y) kol--; if (n - k < kol) { cout << -1; ...
#include <bits/stdc++.h> using namespace std; struct flow_graph { int V, E, s, t; int *flow, *low, *cap, *to, *next, *last, *delta; int *dist, *q, *now, head, tail; flow_graph() {} flow_graph(int V, int E) { (*this).V = V; (*this).E = 0; int TE = 2 * (E + V + 1); flow = n...
#include <bits/stdc++.h> using namespace std; const int N = 5e3 + 1; int dp[N][N]; bool palid[N][N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int n = s.size(); for (int d = 0; d < n; d++) for (int i = 0; i < n; i++) { int j = i + d; ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, m, val, sum = 0; cin >> n; vector<long long> v, q; for (long long i = 0; i < n; i++) { cin >> val; v.push_back(val); sum += val; } ...
// shirley smokes weed #include <bits/stdc++.h> #define sz(v) ((int)(v).size()) #define all(v) (v).begin(), (v).end() using namespace std; using lint = long long; using pi = pair<int, int>; const int MAXN = 400; int n, m, s[MAXN], e[MAXN], x[MAXN]; int dp[1 << 18], indep[1 << 18], w[1 << 18], tk[1 ...
// generated by gen_VerilogEHR.py using VerilogEHR.mako // Copyright (c) 2019 Massachusetts Institute of Technology // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, p; cin >> a >> b >> p; string s; cin >> s; int len = s.size(); int pos = 0; char ss = C ; for (int i = len - 2; i >= 0; i--) { if (ss != s[i]) { ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:60000000 ) using namespace std; const long double eps = 1e-9; const int inf = (1 << 30) - 1; const long long inf64 = ((long long)1 << 62) - 1; const long double pi = 3.1415926535897932384626433832795; template <class T> T sqr(T x) { return x *...
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int N = 100005; const double PI = 4 * atan(1); const double eps = 1e-7; const long long oo = 1e18; const int AlPHA = 26, B = 30; long long n, m, L, sr, t; long long adj[1005][1005]; long long yes[1005][1005]; long long ...
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: LKB // Engineer: Leonhard Neuhaus // // Create Date: 18.02.2016 11:42:49 // Design Name: // Module Name: red_pitaya_lpf_block // Project Name: // Target Devices: // Tool Versions: // Description: /...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
module fpu_array ( pcx_fpio_data_rdy_px2, pcx_fpio_data_px2, arst_l, grst_l, gclk, cluster_cken, fp_cpx_req_cq, fp_cpx_data_ca, ctu_tst_pre_grst_l, global_shift_enable, ctu_tst_scan_disable, ctu_tst_scanmode, ctu_tst_macrotest, ctu_tst_short_chain, si, so ); parameter SIZE = 8; input pcx_fp...
#include <bits/stdc++.h> using namespace std; double prb[(1 << 21)], p[25], ans[25]; int vis[(1 << 21)]; bool eq(double a, double b) { return (abs(a - b) < 1e-12); } int main() { int i, n, k, tmp; scanf( %d , &n); scanf( %d , &k); tmp = n; for (i = 0; i < n; i++) { scanf( %lf , &p[i]...
#include <bits/stdc++.h> using namespace std; set<string> s; string v; map<string, bool> m; void rot(string x) { if (m[x] == 1) return; m[x] = 1; s.erase(x); string y = x; y[0] = x[1]; y[1] = x[2]; y[2] = x[3]; y[3] = x[0]; rot(y); y = x; y[1] = x[4]; y[4] = x[3...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (j == 1 || i == 1) cout << B ; else { cou...
#include <bits/stdc++.h> using namespace std; int upd[400000][10]; long long val[400000][10]; bool dirty[400000]; void clean(int n, int l, int r) { long long buf[10]; memset(buf, 0, sizeof buf); for (int i = 0; i < 10; i++) { buf[upd[n][i]] += val[n][i]; } dirty[n] = false; for (...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; const int pN = 1e6; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; void add(long long &x, long long y) { x += y; x %= MOD; } bool vis[MAXN]; int a[MAXN]; int main() { int n, k; cin >> n >> k; for (int ...
//+FHDR------------------------------------------------------------------------ //Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved //GLADIC Open Source RTL //----------------------------------------------------------------------------- //FILE NAME : //DEPARTMENT : IC Design / Veri...
#include <bits/stdc++.h> using namespace std; const int N = 2e5, M = 350; long long dp[5][N], B, a[N], b[N], t[N], n, m, d, minans = 1e9 + 10, dpL[N], dpR[N]; int last, ldel; deque<int> stac; int main() { ios::sync_with_stdio(false); cin.tie(0); ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; char a[100005], ans[100005]; int main() { int n, m; cin >> n; while (n--) { cin >> a; m = strlen(a); for (int i = 0; i < m; i++) { if (a[i] != ? ) { if (ans[i] == 0) ans[i] = a[i]; else if (a[i] !=...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:45:48 02/22/2015 // Design Name: // Module Name: MultiplyMult // Project Name: // Target Devices: // Tool versions: // Description: // // De...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int N = 25; long long n, ans[N]; pair<int, int> arr[N]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> arr[i].first, arr[i].second = i; sort(arr, arr + n); for (int i = 0; i < n...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 9; int n, u, v, w, t, p, sub[N], par[N], mark[N]; vector<pair<int, int> > g[N]; vector<pair<int, pair<int, int> > > edge[N]; pair<pair<int, int>, pair<int, int> > ed[N]; long long mx, ans[N]; set<int> s; int Get_par(int u) { if (par...
module alu( input clk, input [7:0] A, input [7:0] B, input [3:0] operation, output reg [7:0] result, output reg CF, output reg ZF, output reg SF ); localparam ALU_OP_ADD /* verilator public_flat */ = 4'b0000; localparam ALU_OP_SUB /* verilator public_flat */ = 4'b0001; localparam ALU_OP_ADC /* verilator pub...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int maxn = 2000001; int N, M, cur, F, a[maxn], del[maxn]; int c[maxn]; inline int lowbit(int x) { return x & -x; } inline void add(int x, int d) { for (; x < maxn; x += lowbit(x)) { c[x] += d; } } inline int seek(int k) { int ans = 0,...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, M; int64_t K; cin >> N >> M >> K; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; int64_t ret = 0; for (int m = 0; m < M; m++) { vector<int64_t> B(N); ...
`include "riscv_functions.vh" module riscv_ex_pipe ( input clk, input rstn, input id_ex_rdy, input [`EX_FUNCT_W-1:0] id_ex_funct, input [31:0] id_ex_op1, input [31:0] id_ex_op2, input [`MEM_FUNCT_W...
#include <bits/stdc++.h> using namespace std; int main() { int task; scanf( %d , &task); while (task--) { int n, p; scanf( %d%d , &n, &p); int rest(2 * n + p); for (int i = 1; (i <= n) && rest; i++) for (int j = i + 1; (j <= n) && rest; j++) printf( %d %d n , i,...
#include <bits/stdc++.h> using namespace std; vector<string> split(const string& s, char c) { if (s.length() == 0) return vector<string>(); vector<string> v; stringstream ss(s); string x; while (getline(ss, x, c)) { v.emplace_back(x); } return std::move(v); } vector<int> splitI...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
`timescale 1ns / 1ps module bottleneck( input [63:0] m_adr_i, input m_cyc_i, input [63:0] m_dat_i, input m_signed_i, input [1:0] m_siz_i, input m_stb_i, input m_we_i, output m_ack_o, output [63:0] m_dat_o, output m_err_align_o, output [63:0] s_adr_o, output s_cyc_o, output s_signed_o, output s_...
//% @file sdm_adc_data_aurora_recv.v //% @brief Receive external ADC and TMS_SDM data sent through aurora. //% @author Yuan Mei //% //% The rate of ADC and TMS_SDM data words must be of fixed ratio relation. //% @param[in] NCH_ADC total number of external ADC channels //% @param[in] ADC_CYC # of CLK cycles per ADC data...
#include <bits/stdc++.h> using namespace std; int p[2005], c[2005]; int n, root = -1; vector<int> v[2005]; int d[2005], vis[2005]; int ans[2005]; struct cmp { bool operator()(int x, int y) { return d[x] > d[y]; } }; priority_queue<int, vector<int>, cmp> q; void dfs(int x) { if (c[x] == 0) q....