text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const long long int N = 1e5 + 5; long long int a[N], b[N], n, d, x; long long int getNextX() { x = (x * 37 + 10007) % 1000000007; return x; } void... |
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-9; const long double pi = acos(-1.0); const int inf = 1e+9; long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); } int xabs(int a) { return a >= 0 ? a : -a; } int sign(int a) { return (a < 0) ? -1 : 1; } i... |
#include <bits/stdc++.h> using namespace std; int n, t[200005], ans = 0; bool chk[200005]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , t + i); chk[0] = true; for (int i = n; i >= 1; i--) if (!chk[i]) { int x = i; ans++; while (!chk[x]) chk... |
#include <bits/stdc++.h> using namespace std; int main() { int m, e[10][10] = {}, a, b; scanf( %d , &m); while (m--) { scanf( %d%d , &a, &b); e[a][b] = e[b][a] = 1; } for (int i = 1; i <= 5; i++) for (int j = i + 1; j <= 5; j++) for (int k = j + 1; k <= 5; k++) ... |
module etx_io (/*AUTOARG*/
// Outputs
txo_lclk_p, txo_lclk_n, txo_frame_p, txo_frame_n, txo_data_p,
txo_data_n, tx_wr_wait, tx_rd_wait,
// Inputs
tx_lclk_io, tx_lclk_div4, tx_lclk90, txi_wr_wait_p, txi_wr_wait_n,
txi_rd_wait_p, txi_rd_wait_n, tx_data_slow, tx_frame_slow
);
parameter PLATFORM... |
#include <bits/stdc++.h> using namespace std; int n, m, k; char s[2010][1010]; int a[1010][1010]; int main() { scanf( %d%d%d n , &n, &m, &k); if (k == 1) { int cnt = 0; int tot = 0; for (int i = 0; i < 2 * n - 1; ++i) { gets(s[0]); for (int j = 0; j < m - ((i + 1) & 1... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (win64) Build 881834 Fri Apr 4 14:15:54 MDT 2014
// Date : Thu Jul 24 13:40:01 2014
// Host : CE-2013-124 running 64-bit Service Pa... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const double eps = 1e-9; const int INF = inf; const double EPS = eps; struct __timestamper {}; class fenv_tree { static int f(int x) { return x & -x; } vector<int> tr; public: fenv_tree(int n) : tr(n + 1, -inf) {} voi... |
//
// 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; int read() { char ch = getchar(); int x = 0, f = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f; } ... |
// This is a component of pluto_step_spi, a stepper driver for linuxcnc over SPI.
// based on the main.v from Jeff Epler <>
// Copyright 2013 by Matsche <>
//
// 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
//... |
#include <bits/stdc++.h> using namespace std; struct node { int hx, hy; int tx, ty; int dep; long dir; int zt[15]; }; queue<node> q; int n, m, len; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; bool v[15][15][262144]; char c[30][30]; bool init(int a, int b) { if (a < 0 || a... |
// Ethernet_v6.v -
// Contains
// i) block-level-wrapper
// ii) EMAC wrapper
// iii) GMII code
//-----------------------------------------------------------------------------
// Title : Block-level Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper
// Project : Virtex-6 Embedded Tri-Mode Ethernet... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; bool flag = true; while (cin >> n >> m) { for (int i = 0; i < n; i++) { for (int j = 1; j <= m; j++) { if (i % 2 && j < m && flag) cout << . ; else if (i % 2 && j == m && flag) ... |
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { long long n, sum = 0; cin >> n; vector<long long> v(n), ans, odd; for (long long i = 0; i < n; i++) { cin >> v[... |
/*
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Module | Partition | Slices* | Slice Reg | LUTs | LUTRAM | BRAM/FIFO | DSP48A1 | BUFG | BU... |
//
// 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; int main() { int a, b; cin >> a >> b; int ans = 0; while ((a >= 1 && b > 1) || (a > 1 && b >= 1)) { if (a < b) { ans++; a--; b -= 2; } else { ans++; a -= 2; b--; } } cout << ans <<... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-6; const int INF = 0x3f3f3f3f; inline int readint() { int sum = 0; char c = getchar(); bool f = 0; while (c < 0 || c > 9 ) { if (c == - ) f = 1; c = getchar(); } while (c >= ... |
#include <bits/stdc++.h> using namespace std; struct node { int x, y; } A[10005], B[10005], CA[10005], CB[10005]; int tim, qim; node operator+(node a, node b) { return node{a.x + b.x, a.y + b.y}; } node operator-(node a, node b) { return node{a.x - b.x, a.y - b.y}; } int operator*(node a, node b) { re... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> p(n); for (int i = 0; i < n; ++i) cin >> p[i]; double ans = 0; int cnt[102] = {0}; double loser[102] = {0}; for (int i = 0; i < n; ++i) loser[i] = 1.0; for (int i = 1; i < n; ++i) { ... |
`timescale 1 ns / 1 ps
//////////////////////////////////////////////////////////////////////////////////
// Company: AGH UST
// Engineer: Wojciech Gredel, Hubert Górowski
//
// Create Date:
// Design Name:
// Module Name: DrawBackground
// Project Name: DOS_Mario
// Target Devices: Basys3
// ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; template <class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; } template <class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } const int N = 1 << 7, M = 1 << 14; i... |
//////////////////////////////////////////////////////////////////////
//// ////
//// adbg_or1k_status_reg.v ////
//// ////
//// ... |
// Blitter address generator
// It can increment or decrement selected pointer register or add or substract any selected modulo register
module agnus_blitter_adrgen
(
input clk, // bus clock
input clk7_en,
input reset, // reset
input first_line_pixel,
input [1:0] ptrsel, // pointer register selection
... |
/*
* 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 min(int a, int b) { if (a < b) return a; return b; } double min(double a, double b) { if (a < b) return a; return b; } int max(int a, int b) { if (a > b) return a; return b; } int ABS(int a) { if (a < 0) return -a; return ... |
/*
* 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 = 200005; const int M = 400005; inline int read() { int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 0 ; ch = getch... |
`default_nettype none
`timescale 1ns/100ps
module vga_controller(
input wire clock_ref, // 50 MHz
input wire reset,
input wire [2:0] iRGB,
output wire h_sync,
output wire v_sync,
output wire [8:0] row,
output wire [9:0] column,
output reg [2:0] oRGB
);
wire reset_h_counter, reset_... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; string s; cin >> s; long long n = s.length(); s = 1 + s; long long x[n + 1], y[n + 1], z[n + 1]; x[0] = 0; y[0] = 0; z[0] = 0; for (long long i = 1; i ... |
#include <bits/stdc++.h> int main() { int n, m, t; scanf( %d %d , &n, &m); t = (n / 2); t -= (t & 1); for (int i = 1; i < n; i++) { if (i == 1) printf( > ); else printf( ^ ); if (i & 1) { for (int j = 2; j <= (n - t < n - 2 ? n - t : n - 2); j++) printf( >... |
///////////////// ** iodelay_incrementor ** //////////////////////////////////////////
//
// This module is clocked at 40MHz. It waits for a trigger pulse synchronous to 40Mhz,
// at which point it counts up to the spec_delay input in units of 40MHz using its
// internal 6 bit counter. During this time, it outputs an... |
#include <bits/stdc++.h> using namespace std; int p[200005], q[200005]; int fa[200005], top[200005], sz[200005], dep[200005]; vector<int> E[200005]; void dfs1(int root); void dfs2(int root, int toproot); int lca(int node1, int node2); int dis(int node1, int node2); pair<int, int> merge(int node1, int ... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; int f = 1; char ch = getchar(); while (ch != 45 && (ch > 9 || ch < 0 )) ch = getchar(); if (ch == 45) { f = -1, ch = getchar(); } while (ch <= 9 && ch >= 0 ) { x = x * 10 + ch - 48; ch... |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
// From: "Ma, Zhenqiang" <>
module test (
// Ports for module A
input i_A_outsidei,
output o_A_outsideo,
// Ports for module B
input i_B_outsidei,
output o_B_outsideo );
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire A_internal; // From u0 ... |
#include <bits/stdc++.h> using namespace std; int a[5]; int main() { scanf( %d%d%d%d , &a[0], &a[1], &a[2], &a[3]); while (a[0] != 1 || a[1] != 1 || a[2] != 1 || a[3] != 1) { bool f = 1; for (int i = 0; i < 4; i++) if (a[i] % 2 == 0 && a[(i + 1) % 4] % 2 == 0) { printf( /%d n... |
#include <bits/stdc++.h> using namespace std; const int MN = 1000111; int n; pair<int, int> a[MN], b[MN]; int main() { ios ::sync_with_stdio(0); cin.tie(0); while (scanf( %d , &n) == 1) { for (int i = (1), _b = (n); i <= _b; ++i) { scanf( %d , &a[i].first); a[i].second = i; ... |
#include <bits/stdc++.h> using namespace std; string str[1005]; int tim[1005][1005]; int n, m, t; int fx[] = {-1, +1, 0, 0}; int fy[] = {0, 0, -1, +1}; vector<pair<int, int> > cur; bool okay(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < m); } void dfs(int x, int y, int curr) { tim[x][y]... |
`define STATE_IDLE 4'h0
`define STATE_START_BIT 4'h1
`define STATE_BIT_0 4'h2
`define STATE_BIT_1 4'h3
`define STATE_BIT_2 4'h4
`define STATE_BIT_3 4'h5
`define STATE_BIT_4 4'h6
`define STATE_BIT_5 4'h7
`define STATE_BIT_6 4'h8
`define STATE_BIT_7 4'h9
`define STATE_STOP_B... |
#include <bits/stdc++.h> using namespace std; int L = 1; int R = 0; int cnt[300005]; int a[300005]; int big[300005][2]; int is1 = 0; int ap[300005]; vector<int> st; void in(int id) { id = a[id]; if (++cnt[id] == 1) is1++; else if (cnt[id] == 2) is1--; } void out(int id) {... |
/**
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_tfifo.v ////
//// ////
//// ... |
// synopsys translate_off
`timescale 1 ps / 1 ps
// synopsys translate_on
module ram_sp
#(
parameter DWIDTH=8,
parameter AWIDTH=12,
parameter CONTENT="./memory.mif"
) (
`ifndef ALTERA_RESERVED_QIS
// synopsys translate_off
`endif
input tri1 clock,
`ifndef ALTERA_RESERVED_QIS
// synopsys translat... |
#include <bits/stdc++.h> using namespace std; int solve() { int N; cin >> N; if (N % 2) { N -= 9; if (N < 0 || N == 2) return -1; return 1 + N / 4; } else { if (N < 4) return -1; return N / 4; } } int main() { int Q; cin >> Q; while (Q--) cout << sol... |
// cog_ram
/*
-------------------------------------------------------------------------------
Copyright 2014 Parallax Inc.
This file is part of the hardware description for the Propeller 1 Design.
The Propeller 1 Design is free software: you can redistribute it and/or modify
it under the terms of the GNU General Pub... |
#include <bits/stdc++.h> using namespace std; struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << ; return *this; } } debug; template <typename T1, typename T2> inline ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << ( <... |
/*
* 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 "senior_defines.vh"
module program_counter
#(parameter nat_w = `SENIOR_NATIVE_WIDTH)
(
input wire clk_i,
input wire reset_i,
input wire [nat_w-1:0] ise_i,
input wire [nat_w-1:0] lc_pc_loopb_i,
input wire [nat_w-1:0] ta_i,
input wire pfc_pcadd_opa_sel_i,
input wire [2:0] pfc_pc_sel_i... |
/*+--------------------------------------------------------------------------
Copyright (c) 2015, Microsoft Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code ... |
`include "project_defines.v"
`timescale 1ps / 1ps
module rgb_vga_generator #(
parameter CLOCK_RATE = 100
)(
input clk, // 100MHz system clock signal
input rst, // reset signal
//Generated Signals to Drive Display
output [9:0] o_... |
//*****************************************************************************
// (c) Copyright 2008-2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// ... |
module top;
reg pass = 1'b1;
integer count;
reg [2:0] icount;
reg clk = 0;
reg [3:0] in = 4'h0;
reg [7:0] result [1:0];
always #10 clk = ~clk;
always #20 in = in + 4'h1;
initial begin
count = 3;
result[0][3:0] <= repeat(count) @(posedge clk) in;
if ($simtime != 0 || result[0] !== 8'bx) ... |
// file: clk_200_400_tb.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is n... |
#include <bits/stdc++.h> using namespace std; int get(char *s) { if (s[0] == 8 && s[1] == < ) return 1; if (s[0] == [ && s[1] == ] ) return 2; if (s[0] == ( && s[1] == ) ) return 3; } int check(int a, int b) { if (a == 1 && b == 2 || a == 2 && b == 3 || a == 3 && b == 1) return 1; i... |
#include <bits/stdc++.h> using namespace std; const long long N = 200001; std::vector<long long> g[N]; long long s[N]; long long h[N]; long long a[N] = {0}; bool visited[N] = {false}; void dfs1(long long n, long long parent, long long depth) { h[n] = depth; for (long long v : g[n]) { if (v... |
// #####################################################################################
// # Copyright (C) 1991-2008 Altera Corporation
// # Any megafunction design, and related netlist (encrypted or decrypted),
// # support information, device programming or simulation file, and any other
// # associated ... |
#include <bits/stdc++.h> using namespace std; bool ok[100010]; int a[100010]; int b[100010]; int c[100010]; vector<int> ans; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) scanf( %d , &b[i]); memset(ok, false, sizeof(o... |
#include <bits/stdc++.h> using namespace std; int main() { int i; int n, d, l; cin >> n >> d >> l; int pos = (n + 1) / 2; int neg = n / 2; int a[n + 1]; if (d > (pos * l - neg) || d < (pos - neg * l)) { cout << -1 ; return 0; } if (d > 0) { for (i = 1; i <= n; ... |
module vid_score #(parameter POSITION = 114 )
(clk,
rst_n,
score,
vid_time,
x,
y,
num
);
//Where to display the number of the score
localparam NUM_LOW = POSITION;
loca... |
/**
* 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) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; const int INF = 522133279; const int MAXN = 100000; const int TOTN = 100 + 100; const long long MOD = 1000000007; bool _su[MAXN]; vector<int> su; vector<int> suc; int n, k; void shai() { memset((_su), true, sizeof(_su)); for (int i = (2); i < (MA... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include <bits/stdc++.h> inline int Get() { char ch; while ((ch = getchar()) < 0 || ch > 9 ) ; int Num = ch - 0 ; while ((ch = getchar()) >= 0 && ch <= 9 ) Num = (Num << 3) + (Num << 1) + ch - 0 ; return Num; } const int N = 1e3 + 5; const int M = 1600; int n, m, gA[N],... |
/*
* 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... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: stage2.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
// (C) 2001-2013 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 doc... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`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... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const long double EPS = 0.000000001; const long long INF64 = 1000000000000000000; const long long INF32 = 2000000000; bool iss_pt_in_triangle(pair<long long, long long> a, pair<long long, long long> b, ... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// --------... |
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)3e18; struct data { long long x, flag, id; int operator<(const data& d) const { return x < d.x; } } d[200010 << 2]; long long dp[200010 << 2][2], c[200010 << 2], s[200010 << 2], v[200010 << 2], nw, ans; long long _s... |
#include <bits/stdc++.h> using namespace std; long long n, i, rs, j; vector<long long> ball; vector<long long>::iterator pos; int main() { scanf( %lld , &n); for (i = 0; i < n; i++) scanf( %lld , &j), ball.push_back(j); sort(ball.begin(), ball.end()); rs = 0; i = 0; if (n % 2 == 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 law... |
#include <bits/stdc++.h> using namespace std; const int maxn = 16, inf = 2e8 + 10; ; int n, m, dis[maxn][maxn], deg[maxn], ans, dp[1024 * 33]; vector<int> veci; void find(int a) { int cnt = 0; for (int i = 0; i < n; i++) if ((a >> i) & 1) cnt++; if (cnt % 2 == 1) return; for (int i = 0... |
#include <bits/stdc++.h> using namespace std; inline void pisz(int n) { printf( %d n , n); } template <typename T, typename TT> ostream &operator<<(ostream &s, pair<T, TT> t) { return s << ( << t.first << , << t.second << ) ; } template <typename T> ostream &operator<<(ostream &s, vector<T> t) { ... |
/*******************************************************************************
* Module: simul_axi_read
* Date:2014-04-06
* Author: Andrey Filippov
* Description: simulation of read data through maxi channel
*
* Copyright (c) 2014 Elphel, Inc.
* simul_axi_read.v is free software; you can redistribute it and/... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: mast_new.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===========================... |
#include <bits/stdc++.h> using namespace std; int dp[2][505][505]; char mp[505][505]; const int mod = 1000000007; int dis(int a, int b, int c, int d) { return abs(a - c) + abs(b - d) <= 1; } int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) scanf( %s , mp[i]); if (mp[... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
// Take CRC data and apply to test... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, nums[2201], ans = 0; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> nums[i]; } sort(nums, nums + n); for (int i = 0; i < k; i++) { ans += nums[i]; } cout << ans; return 0; } |
#include <bits/stdc++.h> using namespace std; long long int mod = 1e9 + 7; const double error = 1e-10; const double PI = acos(-1); inline long long int MOD(long long int x, long long int m = mod) { long long int y = x % m; return (y >= 0) ? y : y + m; } const int inf = INT_MAX; const long long i... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> V; int solve() { V.clear(); cin >> n; for (int i = 0; i < n; ++i) { int a; cin >> a; V.emplace_back(a); } sort(V.begin(), V.end()); V.erase(unique(V.begin(), V.end()), V.end()); return V.size(); } ... |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ==================================================... |
#include <bits/stdc++.h> using namespace std; int n, x, y; vector<vector<int> > adjList(100009, vector<int>()); bool vis[100009]; vector<int> ans; bool check_valid_edges(vector<vector<int> > &a, int n) { for (size_t i = 1; i <= n; i++) if (a[i].size() != 4) return false; return true; } int... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e6 + 10; const long long mod = 1e9 + 7; struct Dsu { long long fa[N << 1], d[N << 1]; struct Tmp { long long x, y, add; }; stack<Tmp> s; long long find(long long x) { while (x != fa[x]) x = fa[x]; return x; ... |
#include <bits/stdc++.h> using namespace std; constexpr int MAXN = 3e5 + 5; constexpr int MAXW = 1e4 + 5; constexpr int MOD = 998244353; constexpr long long INF = 2e10; constexpr int LOG = 11; string s; vector<int> ans; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// This source code is free software; you can redistribute it
// and/or modify it in source code form under the terms of the GNU
// General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option)
// ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, a, b; cin >> n >> m >> a >> b; if (n % m == 0) { cout << 0; } else { long long j = n % m; cout << min(j * b, (m - j) * a); } return 0; } |
`timescale 1ns / 1ps
/*
-- Module Name: test_engine_nic_output_block
-- Description: Bloque de salida de la interfaz de red. Se encarga de la
interaccion entre el elemento de procesamiento y el
router.
Este modulo toma el resultado del elemento de
procesamiento y lo empaquete en flits para su tran... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6; int N; long long A[MAXN + 10], B[MAXN + 10], S; vector<long long> prime; int main() { long long i, j; scanf( %d , &N); for (i = 1; i <= N; i++) scanf( %d , &A[i]), S += A[i]; for (i = 2; i * i <= S; i++) { if (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... |
/**
* 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; using pii = pair<int, int>; using ll = long long; using llu = long long unsigned; using ld = long double; const ld EPS = 1e-9; inline int cmp(ld first, ld second = 0, ld tol = EPS) { return (first <= second + tol) ? (first + tol < second) ? -1 : 0 : 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 la... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ; int n, k; cin >> n >> k; vector<int> a(n); for (int &x : a) cin >> x; bool can = true; for (int i = k; i < n; ++i) { if (... |
module register_file
(
input clk, rst, w_en,
input [3:0] addr_a, addr_b, addr_c, addr_d,
input [15:0] data_c,
output reg [15:0] data_a, data_b, data_d
);
//`define addr_size 4
wire w_en0, w_en1, w_en2, w_en3, w_en4, w_en5, w_en6, w_en7, w_en8, w_en9, w_enA, w_enB, w_enC, w_enD, w_enE, w_enF;
wire [1... |
//---------------------------------------------------------------------//
// Name: am_put_fpga.v
// Author: Chris Wynnyk
// Date: 2/3/2008
// Purpose: Computes the exercise price.
//---------------------------------------------------------------------//
module compute_vex(
clk,
nrst,
start,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.