text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; void rr(vector<vector<long long>> &m, long long r, long long nr, long long nc) { long long t = m[r - 1][nc - 1]; for (long long i = nc - 2; i >= 0; i--) m[r - 1][i + 1] = m[r - 1][i]; m[r - 1][0] = t; return; } void rc(vector<vector<long long>> &m, l... |
module crc_parallel
#(
parameter CRC_SIZE = 8, // Define the size of CRC Code
parameter FRAME_SIZE = 8 // Number of bits in the data block
)(
//OUTPUTS
output [CRC_SIZE - 1 : 0] crc_out,
//INPUTS
input [FRAME_SIZE - 1 : 0] data_in,
input [CRC_SIZE - 1 : 0] crc_init,
input [CRC_SI... |
#include <bits/stdc++.h> using i8 = std::int8_t; using i16 = std::int16_t; using i32 = std::int32_t; using i64 = std::int64_t; using u8 = std::uint8_t; using u16 = std::uint16_t; using u32 = std::uint32_t; using u64 = std::uint64_t; auto SolveTest() -> void { int n; std::cin >> n; std::vec... |
#include <bits/stdc++.h> using namespace std; int n, m; int dmap[45][45]; int ans[45]; int dans[45]; int nans, zans; void dfs(int dn) { if (dn == n + 1) { if (nans > zans) { zans = nans; } return; } int mark = 0; for (int i = 1; i < dn; i++) if (ans[i] == 1 ... |
#include <bits/stdc++.h> using namespace std; int Mod; const int Nmax = 1005, Kmax = 105; int Dp[Nmax][Kmax]; int main() { ios::sync_with_stdio(false); int N, K; cin >> N >> K >> Mod; for (int i = 1; i < 10; ++i) Dp[1][i % K]++; if (N > 1) Dp[1][K] = 1; for (int i = 2, pw = 10 % K; i <... |
#include <bits/stdc++.h> using namespace std; inline int nxt() { int x; scanf( %d , &x); return x; } int main() { mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long n; cin >> n; vector<long long> ps; for (long long i = 2; i * i <= n; ++i) { if (n... |
#include <bits/stdc++.h> using namespace std; int N, K, D[1010], S[1010], ans, tt, crtMax; int main() { int i; scanf( %i %i , &N, &K); for (i = 1; i <= N; i++) scanf( %i , &D[i]); for (i = 1; i <= N; i++) scanf( %i , &S[i]); for (i = 1; i <= N; i++) { crtMax = max(crtMax, S[i]); an... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; const long long inf = 10000005; int nsize, root, n, tot, nedge, hed[maxn], father[maxn], maxson[maxn], sz[maxn], vis[maxn]; long long M, pw[maxn]; map<int, int> up[maxn], cst[maxn]; vector<int> dist[maxn], down[maxn]; struct Ed... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 100000 + 10; const double PI = M_PI; const double eps = 1e-8; int dcmp(double a) { if (fabs(a) < eps) return 0; if (a > 0) return 1; return -1; } struct Point { double x, y; Point operator+(const Point &A) { return (Point){... |
/**
* 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
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19.06.2017 18:58:49
// Design Name:
// Module Name: VGA_driver
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Re... |
/**
* 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 ar[5000005]; int main() { string s; cin >> s; long long sz = s.size(); long long cnt = 0; for (int i = 0; i < sz; i++) { long long l = 0, w = 0; for (int j = i; j < sz; j++) { if (s[j] == ( ) l++; el... |
#include <bits/stdc++.h> const double eps = 1e-06; int main() { double t, s, q; scanf( %lf%lf%lf , &t, &s, &q); double v = (q - 1.0) / q; int cnt = 1; while (true) { s = s / (1 - v); if (s > t - eps) break; cnt++; } printf( %d n , cnt); return 0; } |
`timescale 1 ns / 100 ps
module top_tb #(parameter CLOCK_FREQ = 12000000, parameter BAUD_RATE = 1200) ();
reg [3:0] lpc_ad;
reg lpc_clock;
reg lpc_frame;
reg lpc_reset;
reg ext_clock;
wire uart_tx_pin;
wire lpc_clock_led;
wire lpc_frame_led;
wire lpc_reset_led;
wire uart_tx_led;
wire overflow_led;
always... |
`timescale 1ns / 1ps
module VGA(
input CLK_25MH,
input CLK_50MH,
output reg [5:0] RGB,
output reg hsync,
output reg vsync,
output [9:0] hor_count,
output [9:0] ver_count,
input [2:0] rgb_in,
input [9:0] paddle_pos,
input [9:0] ball_x,
input [9:0] ball_y,
input reset,
input active_write_enable,
inp... |
/*
* 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; int n, k; const int N = 5050; int a[N]; int dp[N][N]; int cnt[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cerr.setstate(ios_base::failbit); cin >> n >> k; for (int i = 1; i < (n + 1); i++) cin >> a[i]; sort(a + 1, a +... |
//Copyright (C) 1991-2004 Altera Corporation
//Any megafunction design, and related netlist (encrypted or decrypted),
//support information, device programming or simulation file, and any other
//associated documentation or information provided by Altera or a partner
//under Altera's Megafunction Partne... |
#include <bits/stdc++.h> using namespace std; int main() { string s, t, sum; cin >> s >> t; string n = to_string(stoi(s) + stoi(t)); s.erase(remove(s.begin(), s.end(), 0 ), s.end()); t.erase(remove(t.begin(), t.end(), 0 ), t.end()); n.erase(remove(n.begin(), n.end(), 0 ), n.end()); if... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; int n; int x[300010]; int y[300010]; pair<int, int> izq, der, down, up; int ereccion(int i, int j, int k) { vector<int> pito, ura; pito.push_back(x[i]); pito.push_back(x[j]); pito.push_back(x[k]); ura.push_back(y... |
/**
* 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 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 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; using ll = long long; using ld = long double; template <class S, class T> ostream &operator<<(ostream &os, const pair<S, T> v) { os << ( << v.first << , << v.second << ) ; return os; } template <class T> ostream &operator<<(ostream &os, const ... |
#include <bits/stdc++.h> using namespace std; int a[60000], x, mn = 0x3f3f3f3f; int main() { int n, m; cin >> m >> n; for (int i = 1; i <= n; i++) { cin >> x; a[x]++; } sort(a + 1, a + m + 1); cout << a[1]; return 0; } |
/*
* schoolMIPS - small MIPS CPU for "Young Russian Chip Architects"
* summer school ( )
*
* originally based on Sarah L. Harris MIPS CPU
*
* Copyright(c) 2017 Stanislav Zhelnio
* Alexander Romanov
*/
`include "sm_cpu.vh"
module sm_cpu
(
input clk, //... |
#include <bits/stdc++.h> using namespace std; const int N = 5e3 + 5; int n, a[N][N]; char s[N]; bool vis[N]; void dfs(int x, int fa) { vis[x] = 1; for (int i = 1; i <= n; i++) { if (!a[x][i] || i == fa || i == x) continue; if (a[i][fa]) printf( %d %d %d n , x, i, fa), exit(0); 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... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int tc = 1; tc <= t; tc++) { int n; cin >> n; pair<pair<int, int>, int> arr[2 * n - 1]; for (int i = 0; i < 2 * n - 1; i++) { cin >> arr[i].first.first >> arr[i].first.second; arr[i].... |
// megafunction wizard: %ALTSYNCRAM%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: altera_spram_256x32.v
// Megafunction Name(s):
// altsyncram
// ============================================================
/... |
#include <bits/stdc++.h> using namespace std; long long int power(int b, int pw) { long long int res = 1; for (int i = 1; i <= pw; i++) { res = res * b; } return res; } long long int typ[1000000]; int main() { ios_base::sync_with_stdio(false); long long int n; cin >> n; f... |
#include <bits/stdc++.h> using namespace std; int incoming[110]; int outgoing[110]; int main(int argc, const char* argv[]) { int n, m; cin >> n >> m; int a, b, c; for (int i = 0; i < m; i++) { cin >> a >> b >> c; incoming[b] += c; outgoing[a] += c; } int ans = 0; fo... |
#include <bits/stdc++.h> using namespace std; int n, m; int pos, neg, tmp, x, y, len; int main() { scanf( %d%d , &n, &m); pos = 0; neg = 0; for (int i = 0; i < n; ++i) { scanf( %d , &tmp); if (tmp > 0) ++pos; else ++neg; } while (m--) { scanf( %d%d... |
//-------------------------------------------------------------------
//-- scicad1_tb
//-- Banco de pruebas para el ejemplo de transmision continua de
//-- cadenas
//-------------------------------------------------------------------
//-- BQ September 2015. Written by Juan Gonzalez (Obijuan)
//-------------------------... |
`timescale 1ns / 1ps
module VIDEO_FETCHER(
input RST_I,
input CLK_I_25MHZ,
input VSYNC_I,
input VFEN_I,
output [12:0] RAM_ADR_O,
output RAM_CYC_O,
output RAM_STB_O,
input RAM_ACK_I,
input [15:0] RAM_DAT_I,
output [ 5:0] LB_ADR_O,
output [15:0] LB_DAT_O,
output LB_WE_O
);
reg ... |
/**
\file "channel-ledr-source-sink.v"
Chain a source and sink in prsim to verilog.
$Id: channel-source-sink.v,v 1.4 2010/04/06 00:08:26 fang Exp $
*/
`timescale 1ns/1ps
`include "standard.v"
`define inv_delay 0.020
module timeunit;
initial $timeformat(-9,1," ns",9);
endmodule
module TOP;
reg l0, l1;
wire ... |
#include <bits/stdc++.h> using namespace std; template <class T> void debug(T a, T b) { ; } template <class T> void chmin(T& a, const T& b) { if (a > b) a = b; } template <class T> void chmax(T& a, const T& b) { if (a < b) a = b; } namespace std { template <class S, class T> ostrea... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
module t;
integer p_i;
reg [7*8:1] p_str;
string sv_str;
reg [7*8:1] p_in;
string sv_in;
initial begin
if ($test$plusargs("P... |
#include <bits/stdc++.h> using namespace std; int fx[] = {1, 0, 0, -1}; int fy[] = {0, -1, 1, 0}; int n, m; int data[1002][1002], dist[1002][1002]; void bfs(int sx, int sy) { for (int i = 0; i < 1002; i++) { for (int j = 0; j < 1002; j++) dist[i][j] = INT_MAX; } queue<int> q; q.push(sx... |
/*
* 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; int main() { long long int T, n, i, j, l, m, x, y, z, a, b, c, d, flag, count; cin >> a >> b >> c >> d; long long int sum1, sum2; sum1 = std::max((3 * a / 10), (a - ((a / 250) * c))); sum2 = std::max((3 * b / 10), (b - ((b / 250) * d))); if (sum1... |
#include <bits/stdc++.h> std::vector<long long> G[100001]; std::vector<long long> psn[100001]; std::vector<long long> arr[100001][20]; long long par[100001], lvl[100001]; long long P[100001][20]; void dfs_visit(long long s, long long p) { if (p != -1) { par[s] = p; lvl[s] = 1 + lvl[p]; }... |
#include <bits/stdc++.h> using namespace std; struct xy { int x, y; }; int a[1212121], par[1212121], depth[1212121]; vector<int> C[1212121]; void dfs(int w, int dep) { depth[w] = dep; for (int nxt : C[w]) dfs(nxt, dep + 1); } int Hn = 0, myH[1212121], sz[1212121], root[1212121], ppar[1212121... |
#include <bits/stdc++.h> using namespace std; #define ll long long #define deb(x) cout << #x << = << x << endl #define deb2(x, y) cout << #x << = << x << , << #y << = << y << endl #define nl n void solve() { int n; cin >> n; int arr[n][n]; int x = 1; for(int i=0;i<... |
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5 + 5; const long long int M = 1e3; const long long int mod = 1e7 + 7; const long long int m1 = 1e9 + 7; const long long int m2 = 1e9 + 9; const long long int p1 = 402653189; const long long int p2 = 1610612741; const int LN = 32;... |
`timescale 1ns/10ps
module RegBankP8Sim;
reg clock;
reg reset;
reg [11:0] inst;
reg inst_en;
wire [7:0] out_0;
wire [7:0] out_1;
wire [7:0] out_2;
wire [7:0] out_3;
wire [7:0] out_4;
wire [7:0] out_5;
wire [7:0] out_6;
wire [7:0] out_7;
initial begin
... |
#include <bits/stdc++.h> using namespace std; const int N = 100; double pr[10][N][N], p[N][N], dp[10][N][N]; int n; int main() { double ans = 0; cin >> n; for (int i = 0; i < (1 << n); i++) for (int j = 0; j < (1 << n); j++) cin >> p[i][j], p[i][j] /= 100; for (int i = 0; i < (1 << n); i... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200010; map<int, int> mp; int n; struct pnt { int x, w; bool operator<(const pnt &p) const { return x < p.x; } } p[maxn]; int ask(int x) { int res = 0; for (int i = x; i > 0; i -= (i & -i)) if (mp.count(i)) res = max(res,... |
#include <bits/stdc++.h> using namespace std; int N, M, C; vector<pair<int, pair<int, int> > > V; int A[505][505], R[505]; int main() { int x, y, t; scanf( %d %d , &N, &M); memset(A, 40, sizeof A); for (int i = 1; i <= M; i++) { scanf( %d %d %d , &x, &y, &t); A[x][y] = A[y][x] = t;... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 40; const int inf = 0x3fffffff; 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) + ... |
#include <bits/stdc++.h> using namespace std; int a[501102]; int ans, cnt, sum, d; void solve() { ans = 0; cnt = 0; sum = 0; d = 0; int n; cin >> n; for (int i = 1; n >= i; i++) { cin >> a[i]; if (a[i] % 2 == 1) { ans++; if (a[i] * n % 2 == 1) d = 1; ... |
//
// Designed by Qiang Wu
//
`timescale 1ns/1ps
`include "NF_2.1_defines.v"
`include "registers.v"
`include "reg_defines_reference_router.v"
module packet_buffer(
input clk,
input reset,
output [239:0] TRIG0,
input [63:0] in_data,
input [15:0] in_pkt_route,
input in_wr,
output reg in... |
/* this file automatically generated by make_wp.py script
* for file rtl/ictlb.v
* for module ictlb
* with the instance name ictlb_dut
*/
`include "scmem.vh"
`define L1IT_PASSTHROUGH
module ictlb_wp(
/* verilator lint_off UNUSED */
input logic clk
,input logic reset
//... |
module test;
reg fail = 1'b0;
reg [3:0] bus = 4'b0;
initial begin
// Check the initial value.
if (bus !== 4'b0) begin
$display("FAILED: initial value, got %b, expected 0000.", bus);
fail = 1'b1;
end
// Check a bit assign and verify a normal bit assign does nothing.
#1 assign bus[... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1... |
#include <bits/stdc++.h> using namespace std; map<long long, long long> frequency(vector<long long> v) { map<long long, long long> m; for (long long i = 0; i < v.size(); i++) { if (m.find(v[i]) != m.end()) m[v[i]]++; else { m.insert({v[i], 1}); } } return m; } v... |
#include <bits/stdc++.h> using namespace std; const long long M = 1e9 + 7; const long long inf = 4e18; const long long N = 1e6; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin >> t; while (t--) { long long n, m, k; cin >> n >> m >> k; ch... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; const long long mod = 1e9 + 7; inline long long bigmod(long long B, long long P) { long long R = 1; while (P > 0) { if (P & 1) { R = (R * B) % mod; } P >>= 1; B = (B * B) % mod; } return R; ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; vector<long long> vec(n); for (long long i = 0; i < n; i++) { cin >> vec[i]; } vec.push_back(vec.back()); long long ans = 1; long long cnt = 1; ... |
/*
* 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 blocking_cond (in, out);
input in;
output reg out;
reg tmp;
always @* begin
tmp = 1;
out = 1'b0;
case (1'b1)
tmp: out = in;
endcase
tmp = 0;
end
endmodule
// -------------------------------------------------------------
module uut(clk, arst, a, b, c, d, e, f, out1);
input clk, arst, a, b, c, d, e,... |
/**
* 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 M = 1000000007; const int MM = 998244353; const long double PI = acos(-1); const long long INF = 2e18; template <typename T, typename T1> void amax(T &a, T1 b) { if (b > a) a = b; } template <typename T, typename T1> void amin(T &a, T1 b) {... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; string s; cin >> s; long long o = 0; long long z = 0; for (long long i = 0; i < n; i++) if (s[i] == n ) o++; else if (s[i] == z ) z++; while (o--) cout << 1 << ; w... |
#include <bits/stdc++.h> using namespace std; bool Check(char x) { if (x <= 3 && x >= 1 ) return true; else return false; } int main() { char s[1000]; cin >> s; char x; for (int i = 0; i < strlen(s); ++i) { for (int j = i + 1; j < strlen(s); ++j) { if (s[j] <... |
#include <bits/stdc++.h> using namespace std; void pb_200() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int32_t main() { long long int x; cin >> x; while (x--) { long long int n; cin >> n; long long int *arr = new long long int[n]; ; for (long... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; int n; int a[N], sum[N], b[65][N], cnt[65]; long long ans; int t[2]; long long find(int l, int r, int lim) { int i, j; long long ret = 0; if (l > r) return 0; j = l - 1; t[0] = t[1] = 0; for (i = l; i <= r; ++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 la... |
#include <bits/stdc++.h> using namespace std; const double error = 1e-15; const double pi = 2 * acos(0); const int maxn = (int)1e5 + 10; const int mod = (int)1e9; int dx[] = {0, -1, 0, +1, -1, -1, +1, +1}; int dy[] = {-1, 0, +1, 0, -1, +1, +1, -1}; long A[205][200], B[200]; vector<int> v; int main()... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int cnt2[maxn]; int cnt[maxn]; struct trie { int nxt[maxn][26], fail[maxn], g[maxn]; int ed[maxn]; int rt, L; int newnode() { memset(nxt[L], -1, sizeof nxt[L]); ed[L++] = 0; return L - 1; } void ... |
#include <bits/stdc++.h> using namespace std; int n = 0, m = 0; char** values; bool** values1; void PrintArray() { cout << Values n ; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cout << values[i][j] << ; } cout << endl; } cout << Values1 n ; f... |
// test_usb_ft232.v
`timescale 1 ns / 1 ps
module test_usb16;
reg clk = 0;
reg reset = 1;
// FT232 interface
reg usb_clk = 0;
wire wr_n;
wire rd_n;
wire oe_n;
wire [7:0]data;
reg txe_n = 1;
reg rxf_n = 1;
wire siwu_n;
// avs_ctrl
reg avs_ctrl_address = 1'bx;
reg avs_ctrl_write = 0;
reg [7:0]avs_... |
#include <bits/stdc++.h> using namespace std; vector<int> parent; vector<int> Rank; int root(int v) { if (parent[v] == v) return v; return parent[v] = root(parent[v]); } void DSU(int a, int b) { a = root(a); b = root(b); if (a != b) { if (Rank[b] > Rank[a]) swap(a, b); Rank[a... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; vector<int> T; int l, size; void Stworz(int n) { int p = 1; while (p < n) p *= 2; l = p; size = 2 * p - 1; for (int i = 0; i <= size; ++i) T.push_back(INF); } void Ustaw(int a, int x) { a += l; T[a] = x; ... |
#include <bits/stdc++.h> using namespace std; const int N = 25; int main(int argc, char *argv[]) { long long n; cin >> n; long long ret1 = (1LL << 60); long long ret2 = 0; for (long long x = 1; x * x <= n; ++x) { if (n % x) continue; long long m = n / x; for (long long y = 1;... |
/*
* 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... |
/*
* 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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale ... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// break function: when CPU M1 address equals to predefined, NMI is generated
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2014 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=0;
reg [63:0] crc;
reg [63:0] sum;
reg out1;
reg... |
// AJ, Beck, and Ray
// ALUnit testbench
// 5/4/15
`include "Implementation/mux2_1.sv"
`include "adder_subtractor.v"
`include "flag.v"
`include "adder16b.v"
`include "adder4b.v"
`include "fullAdder1b.v"
`include "lookAhead4b.v"
`include "ALUnit.sv"
`include "addition.v"
`include "subtract.v"
`include "andGate.v"
`inclu... |
/*
* Copyright (c) 2013, The DDK Project
* Dmitry Nedospasov <dmitry at nedos dot net>
* Thorsten Schroeder <ths at modzero dot ch>
*
* All rights reserved.
*
* This file is part of Die Datenkrake (DDK).
*
* "THE BEER-WARE LICENSE" (Revision 42):
* <dmitry at nedos dot net> and <ths at modzero dot ch> ... |
#include <bits/stdc++.h> using namespace std; struct targ { long long x, r; int id, s; } tar[10004]; bool _x(targ a, targ b) { return a.x < b.x; } bool _id(targ a, targ b) { return a.id < b.id; } int fd(int l, int r, long long x) { if (l == r) return l; int m = l + r >> 1; if (tar[m].x <... |
#include <bits/stdc++.h> using namespace std; const int nmax = 5e5 + 42; struct info { int u, v, cost; }; info inp[nmax]; pair<int, int> my[nmax]; int n, k, m; int parent[nmax]; int root(int node) { if (parent[node] == node) return node; parent[node] = root(parent[node]); return parent... |
/**
* 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 = 100005; const int INF = 1000000009; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int a, b; cin >> a >> b; if ((a || b) && max(a, b) - min(a, b) < 2) { cout << YES ; } else { cout << ... |
///////////////////////////////////////////////////////////////////////////////
//
// File name: axi_protocol_converter_v2_1_b2s_wr_cmd_fsm.v
//
///////////////////////////////////////////////////////////////////////////////
`timescale 1ps/1ps
`default_nettype none
(* DowngradeIPIdentifiedWarnings="yes" *)
module axi... |
#include <bits/stdc++.h> const double Pi = 3.14159265; const int N = 1e6 + 50; const int M = 1e5 + 15; const unsigned long long base = 163; const int INF = 0x3f3f3f3f; using namespace std; int a[N]; int main() { int n; scanf( %d , &n); int l = 0, r = 0; for (int i = 1; i <= n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int sst(string g) { int f; stringstream ss; ss << g; ss >> f; return f; } int main() { string s, s1, s2, s3; cin >> s; int max = -1, h = 0; int t = s.size(), x, y, z; if (t < 3) { cout << -1 << endl; return 0; ... |
/*
Copyright (c) 2014-2018 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, distri... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Jorge Sequeira
//
// Create Date: 08/31/2016 03:34:58 PM
// Design Name:
// Module Name: KOA_c
// Project Name:
// Target Devices:
// Tool Versions:
// Description: Recursive Karasuba P... |
//name : file_reader_a
//tag : c components
//output : output_z:16
//source_file : file_reader_a.c
///=============
///
///*Created by C2CHIP*
`timescale 1ns/1ps
module file_reader_a(output_z_ack,clk,rst,output_z,output_z_stb);
integer file_count;
integer input_file_0;
input clk;
input rst;
output... |
//Legal Notice: (C)2016 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; template <typename elemType> inline void Read(elemType &T) { elemType X = 0, w = 0; char ch = 0; while (!isdigit(ch)) { w |= ch == - ; ch = getchar(); } while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar(); T = (... |
#include <bits/stdc++.h> int main() { char s[5200] = {0}, next[5200] = {0}, p[5200] = {0}, t[5200] = {0}; while (scanf( %s , s + 1) != EOF) { s[0] = a ; double sum = 0; int f = 0; while (sscanf(s, %*[^0-9]%[0-9.]%[^ 0] , p, next) > 0) { double num1 = 0, num2 = 0; int ... |
/**
* 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 S = 1003; bool a[S]; bool b[S]; string s; int k; int i, j; int main() { cin >> s; j = s.size() - 1; while (i < j) { if (s[i] == ( && s[j] == ) ) { b[i] = 1; b[j] = 1; k++; i++; j--; ... |
#include <bits/stdc++.h> using namespace std; const long long N = 1000000007; void solve() { string s; cin >> s; long long ans = INT_MAX; for (long long i = 0; i <= 9; i++) { long long count = 0; for (long long j = 0; j < (long long)s.size(); j++) { if (s[j] == (char)( 0 + i))... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; inline long long getint() { long long _x = 0, _tmp = 1; char _tc = getchar(); while ((_tc < 0 || _tc > 9 ) && _tc != - ) _tc = getchar(); if (_tc == - ) _tc = getchar(), _tmp = -1; while (_tc >= 0 && _tc <= 9 ) _x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.