text stringlengths 59 71.4k |
|---|
module msg_tx(
input clk_sys,
output [0:7] uart_data,
output uart_send,
input uart_ready,
input [0:2] trig,
output [0:2] ena,
input [0:7] cmd,
input [0:7] a1,
input [0:15] a2,
input [0:15] a3
);
// --- Transmission ------------------------------------------------------
localparam IDLE = 3'd0;
localpa... |
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(0); cin.tie(NULL), cout.tie(NULL); } int main() { fast(); int n, k; cin >> n >> k; vector<int> v(n), vc(k + 1); for (int i = 0; i < n; i++) { cin >> v[i]; } auto it = unique(v.begin(),... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2013.4
// Copyright (C) 2013 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; const int DIM = 55; char mat[2][DIM][DIM]; vector<pair<int, int>> lst1, lst2; void move(int k, int p, int q, vector<pair<int, int>> &lst) { lst.push_back(make_pair(p, q)); if (mat[k][p][q] == U ) { assert(mat[k][p + 0][q + 0] == U and mat[k][p + 0... |
`include "CU/ControlUnit.v" //`
`include "MU/Register32.v" //`
`include "ALU/ALUInterface.v" //`
`include "MU/ProgramCounter.v"
`include "MU/InstructionRegister.v"
module CPU( output R1in, output R1out,
output R2in, output R2out,
output Add, output Sub, output Mul, output Div,
output SelectY, out... |
// Copyright 1986-1999, 2001-2013 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2013.4 (lin64) Build 353583 Mon Dec 9 17:26:26 MST 2013
// Date : Thu Mar 27 17:00:07 2014
// Host : macbook running 64-bit Arc... |
#include <bits/stdc++.h> const long long mod = (long long)(1e9 + 7); int n; long long s, ans; long long f[1000]; long long ksm(long long x, long long y) { long long ans = 1; while (y) { if (y & 1) ans = ans * x % mod; x = x * x % mod; y = y / 2; } return ans; } long long ... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; int N, M; vector<int> conn[MAXN]; bool adj[10][10]; bool vis[MAXN]; int deg[10]; int ar[MAXN]; int pa[10]; int pb[10]; int numed; void prec() { for (int j = 0; j < numed; ++j) { int a = 2, b = 1; for (int k = ... |
/**
* 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... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast , unroll-loops , omit-frame-pointer , inline ) #pragma GCC optimize(3) using namespace std; const long long INF = 1e17; const long long maxn = 1e5 + 700; const int mod = 998244353; const int up = 1e9; template <typename T> inline void read(T &a) ... |
#include <bits/stdc++.h> using namespace std; int d, n, m; const int M = 2e5; pair<int, int> gas[M + 7]; bool possible = true; int pendingD, running; int currentGas; long long res = 0; struct cmp { bool operator()(int c1, int c2) { if (gas[c1].second != gas[c2].second) return gas[c1]... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; while (scanf( %d%d , &n, &x) != EOF) { int a[100000], b[100000]; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } for (int i = 0; i < n; i++) { scanf( %d , &b[i]); } int a1[200001], b1... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; using pii = pair<long long, long long>; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); long long q; cin >> q; while (q--) { long long n, m; cin >> n >> m; vector<pair<long long, p... |
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; const int NINF = INT_MIN; const long long INF_LL = LLONG_MAX; const long long NINF_LL = LLONG_MIN; const double PI = acos(-1.0); const int MOD = 1e9 + 7; int main() { long long n, m; cin >> n >> m; long long ans = n * n; ... |
//
// 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)
// ... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:57:54 11/09/2015
// Design Name:
// Module Name: vga_scandoubler
// Project Name:
// Target Devices:
// Tool versions:
// Descripti... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RIT
// Engineer: Cody Cziesler and Nick Desaulniers
//
// Create Date: 11:28:25 04/07/2011
// Design Name: instruction_fetch
// Module Name: instruction_fetch
// Project Name: Omic... |
#include <bits/stdc++.h> using namespace std; const int p = 1000000007; long long quick_mod(long long a, long long b) { long long ans = 1; a %= p; while (b) { if (b & 1) { ans = ans * a % p; b--; } b >>= 1; a = a * a % p; } return ans; } long long C(... |
#include <bits/stdc++.h> using namespace std; int main() { int nmin, nmax = 1; int n, m, a, b; scanf( %d%d , &n, &m); nmin = n; for (int i = 0; i < m; i++) { scanf( %d%d , &a, &b); if (b < a) swap(a, b); nmin = min(nmin, b); nmax = max(nmax, a); } if (nmax < nmin)... |
/*
* 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; long long p, ans, num; int n; string s[500000]; int main() { cin >> n >> p; p /= 2; for (int i = 1; i <= n; ++i) { cin >> s[i]; } for (int i = n; i >= 1; --i) { num *= 2; if (s[i] == halfplus ) num++; ans += num; } ... |
#include <bits/stdc++.h> using namespace std; const int MAX_SIZE = 10; int n; unsigned long long adj[200010], k; struct Matrix { unsigned long long a[MAX_SIZE][MAX_SIZE]; Matrix() { for (int i = 0; i < MAX_SIZE; i++) for (int j = 0; j < MAX_SIZE; j++) a[i][j] = 0; } Matrix mul(Ma... |
#include <bits/stdc++.h> using namespace std; int main() { int i, n, moves = 0, flag = 1, gears; cin >> n; cin >> gears; moves = n - gears; for (i = 1; i < n; i++) { cin >> gears; if (i % 2 == 1) gears = (gears + (n - moves)) % n; else gears = (gears + moves) % ... |
// Verify that a zero width constant replication is handled correctly.
module top;
reg pass;
reg [31:0] in_full;
wire [31:0] pa_out_full, ca_out_full;
reg [29:0] in_part;
wire [31:0] pa_out_part, ca_out_part;
initial begin
pass = 1'b1;
in_full = {16{2'b10}};
in_part = {15{2'b01}};
#1;
i... |
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, -2, -2, -1, 1, 2, 2, 1}; const int dy[] = {-2, -1, 1, 2, 2, 1, -1, -2}; set<pair<int, pair<int, int> > > heap; vector<vector<int> > now; int main() { int n, m; cin >> n >> m; if (n >= 10 && m >= 10) { cout << (m * n + 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; int main() { int y1, m1, d1, y2, m2, d2; scanf( %d:%d:%d n%d:%d:%d , &y1, &m1, &d1, &y2, &m2, &d2); if (m1 < 3) y1--, m1 += 12; long long ans1 = 365 * y1 + y1 / 4 - y1 / 100 + y1 / 400 + (153 * m1 - 457) / 5 + d1 - 306; if (m2 < 3) y2--, m2 +... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int M = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int s, x1, x2, t1, t2, p, d; cin >> s >> x1 >> x2; cin >> t1 >> t2; cin >> p >> d; int ans = t2 * abs... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, 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:... |
//////////////////////////////////////////////////////////////////////
//// ////
//// spi_clgen.v ////
//// ////
//// This file is part of the SPI I... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; const int M = 10000005; const int mo = 1000000007; int pri[M / 10], mn[M], id[M]; vector<int> e[N]; int n, T, Q, dfn[N], ed[N]; int fa[N][20], dep[N]; int qx[N], qy[N], qL[N], qv[N]; int t[N * 2], vis[N], A[N], ans[N]; vector<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 law... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 545; int a[MAX_N]; int main() { int n, minus = 0; cin >> n; int sum = 0; for (int i = (0); i < (int)(2 * n - 1); ++i) { cin >> a[i]; if (a[i] < 0) { a[i] = abs(a[i]); minus++; } sum += a[i]; ... |
#include <bits/stdc++.h> using namespace std; struct Str { int l; char *s; } str[50010 << 2]; int tot; char s[3100000]; int k; int n, l[50010], r[50010]; char ans[3100000]; int cut(int pos) { for (int i = 0; i < tot; i++) if (pos == 0) { tot++; for (int k = tot - 1; k... |
// This module uses the synthesizable bsg_fsb_node_trace_replay module
// to communicate over bsg_tag. This module instantitates a trace-replay,
// removes the output data to match what bsg_tag is expecting, and
// finally it serializes the trace data down to a single bit.
//
// Each trace should be in the following fo... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, p, q, temp; cin >> n; int levels[101] = {0}; cin >> p; for (int i = 0; i < p; i++) { cin >> temp; levels[temp]++; } cin >> q; for (int ... |
#include <bits/stdc++.h> int main() { int n, count = 0; scanf( %d , &n); while (n--) { int t = 3, s = 0; while (t--) { int a; scanf( %d , &a); s = s + a; } if (s > 1) { count++; } } printf( %d , count); return 0; } |
// file: timer_exdes.v
//
// (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
// laws.
//
// DISCLAIMER
// This disclaim... |
#include <bits/stdc++.h> using namespace std; const int Nmax = 1e5 + 5; string s, t; int n, m, pos, l, r; int pre[Nmax]; int suf[Nmax]; int main() { cin >> s; cin >> t; n = s.size(); m = t.size(); s = + s; t = + t; pos = 1; for (int i = 1; i <= m; i++) { while... |
#include <bits/stdc++.h> using namespace std; struct DSU { struct Node { int pr; long long max_sum; long long max_pref; long long sum; long long max_suff; }; vector<Node> t; multiset<long long> mx; DSU(int n, vector<int>& c) { t.resize(n); for (int i = 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; int n, m, tot; bool ok(int i, int j) { if (i < 0 or i >= n or j < 0 or j >= m) return 0; return 1; } long long int c[20][20] = {0}; void matcpy(long long int a[20][20], long long int b[20][20]) { for (int i = 0; i < tot; i++) { for (int j = 0; ... |
#include <bits/stdc++.h> using namespace std; long long power(long long x, long long y, long long p) { long long res = 1; x = x % p; while (y > 0) { if (y & 1) { res = (res * x) % p; } y = y >> 1; x = (x * x) % p; } return res; } long long modInverse(long long... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11.03.2017 19:31:22
// Design Name:
// Module Name: main
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision... |
#include <bits/stdc++.h> using namespace std; int n, m, q; vector<int> colors[100013]; unordered_map<int, vector<int> > adj[100013]; unordered_map<int, int> p[100013]; unordered_map<int, int> h[100013]; pair<int, int> visited[100013]; unordered_map<int, int> precalc[100013]; int BIG = 200; int findS... |
#include <bits/stdc++.h> using namespace std; const long long mod = 100000007; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long powmod(long long a, long long b) { long long res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a %... |
`include "setseed.vh"
module top(input clk, stb, di, output do);
localparam integer DIN_N = 10;
localparam integer DOUT_N = 10;
reg [DIN_N-1:0] din;
wire [DOUT_N-1:0] dout;
reg [DIN_N-1:0] din_shr;
reg [DOUT_N-1:0] dout_shr;
always @(posedge clk) begin
din_shr <= {din_shr, di};
dout_shr <= {dout_shr, din... |
#include <bits/stdc++.h> int main(int argc, char *argv[]) { std::string s; std::cin >> s; int yes = 0; int len = s.length(); if (len < 3) { std::cout << No ; return 0; } for (int i = 0; i < len - 2; i++) { std::string ss = s.substr(i, 3); if (ss == ABC || ss == ... |
#include <bits/stdc++.h> using namespace std; const double pi = atan(1) * 4; const double EXP = 1e-8; struct node { int x, y; double a; } light[30]; double cal(double pos, node l) { double len = sqrt((l.x - pos) * (l.x - pos) + l.y * l.y); if (pos > l.x) { if (l.a < atan(l.y * 1.0 / (p... |
#include <bits/stdc++.h> using namespace std; long long a[16], d[40000], vis[40000]; int main() { ios::sync_with_stdio(0); int n, x, i, j, k, l0, m, m0, m1, c; long long l, r, v, ans = 0; cin >> n >> l >> r >> x; for (i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); for (i = 1,... |
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012, Jahanzeb Ahmad
// 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 o... |
#include <bits/stdc++.h> using namespace std; long long n, mod; long long fast(long long base, long long pow) { long long res = 1; while (pow) { if (pow % 2) res = ((res % mod) * (base % mod)) % mod; pow /= 2; base = ((base % mod) * (base % mod)) % mod; if (!base) base = mod; }... |
#include <bits/stdc++.h> using namespace std; int main() { int q, n, i, a[201], start, tmp, yn; cin >> q; while (q--) { cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 1) start = i; } yn = 0; tmp = 1; for (i = 0; i < n - 1; i++) if... |
#include <bits/stdc++.h> using namespace std; int r, c, s, e; vector<int> adj[1000 * 1000 + 10]; int d[1000 * 1000 + 10]; char grid[1000][1000]; char access(int n) { int x = n % c; int y = n / c; return grid[y][x]; } void bfs(int n) { queue<int> frontier; frontier.push(n); d[n] =... |
#include <algorithm> #include <array> #include <bitset> #include <cctype> #include <chrono> #include <cmath> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iso646.h> #include <iterator> #include <list> #include <m... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 200 + 17, inf = 2e18 + 17; long long a[MAXN], b[MAXN], n, m, k, t[MAXN][MAXN], np; void fillA() { for (int i = 1; i <= m; i++) for (int j = 0; i - j > 0 && j < n; j++) a[i] = min(t[j + 1][i - j], a[i]); for (int i = 1; i <= n; i+... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, res; int a[400], c; while (cin >> n >> k) { cin >> c; for (int i = 0; i < c; i++) cin >> a[i]; sort(a, a + c); res = 0; for (int t = 0, ci = 0; t < n; res++) { if (ci < c && a[ci] <= t + k && a[ci]... |
/**
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2019 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//bug1604
module t (/*AUTOARG*/
// Outputs
two,
// Inputs
clk, aresetn, ten
);
input wi... |
#include <bits/stdc++.h> using namespace std; constexpr long long MOD = 1e9 + 7; constexpr long double EPS = 0.0 + 1e-6; void YES() { cout << YES << n ; } void NO() { cout << NO << n ; } bool search(const string& s, long long i, const string& t, long long j, ... |
//
// LogicProbe.v -- on-chip logic probe with trace memory and read-out facility
//
`timescale 1ns/1ns
module LogicProbe(clock, reset, trigger, sample, channels, serial_out);
input clock;
input reset;
input trigger;
input sample;
input [127:0] channels;
output serial_out;
wire full;
reg ... |
`timescale 1ns / 1ps
module top_sch(clk_in,
Drive_mfm_in,
Drive_sector_in,
rst_in,
SPI_clk,
SPI_CS,
SPI_MOSI,
SPI_CurWordIsHeader,
drive_command_n,
drive_command_p,... |
// file: main_pll.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 ... |
#include <bits/stdc++.h> using namespace std; int o[101]; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int e; cin >> e; if (e % 7 == 0) { o[i] = e / 7; } else { o[i] = e / 7 + 1; } } for (int i = 0; i < t; i++) { cout << o[i] <... |
`timescale 1ns / 1ps
/*
-- Module Name: Harness
-- Description: Arnes para pruebas del modulo test_engine_network_core.
En particular, este arnes conecta todos los puertos de
la red con 'inyectores / receptores' de paquetes.
-- Dependencies: -- system.vh
-- Parameters:
-- Original Author: Héctor Cabr... |
//Testbench for the dispatch unit.
module dispatchu_tb(
);
reg clk;
reg [15:0] aDat;
reg [15:0] bDat;
reg [15:0] cDat;
wire [31:0] addr;
wire [15:0] memOut;
wire memWrite;
wire [15:0] cOut;
wire cWrite;
wire [2:0] aSel;
wire [2:0] bSel;
wire [2:0] cSel;
wire [3:0] intOp;
wire [2:0] intA;
wire [2:0] intB;
wire [2:0] ... |
// Copyright (c) 2011, Richard Castle
// 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 must retain the above copyright
// notice, this list of con... |
/**
* 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 2012, Homer Hsing <>
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n; cin >> n; int fl = 0; long long int ans = 0; if (n == 2) { cout << 2 << endl; continue; } ans = pow(2, n); for (int i = 1; i < n; i++... |
`include "assert.vh"
`include "cpu.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 5;
localparam MEM_EXTRA = 4;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg [ MEM_ADDR :0] rom_upper_bo... |
/**
* 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... |
`define bsg_buf_macro(bits) \
if (harden_p && (width_p==bits) && vertical_p) \
begin: macro \
bsg_rp_tsmc_250_BUFX8_b``bits buf_gate (.i0(i),.o); \
end \
... |
#include <bits/stdc++.h> using namespace std; int N, M; long long tblX[1001001]; int minp[1001001]; long long gs[1001001]; long long bsum[1001001]; long long bsums0[1001001]; long long bsums1[1001001]; long long bsums2[1001001]; long long linsum(long long K) { long long P = K, Q = K + 1; 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 n, k, a[105], b[105], i, q, j, f, x, c = 0; double s = 0, s1 = 0, min = -1, max = -1; cin >> n >> k; for (i = 1; i <= n; i++) cin >> a[i]; cin >> q; for (i = 1; i <= q; i++) { f = 0; s = 0; for (j = 1; j <= n / ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, q; cin >> n >> k >> q; vector<int> A(n); set<int> S; for (int i = 0; i < n; ++i) cin >> A[i]; int ty, id; for (int i = 0; i < q; ++i) { cin >> ty >> id; if (ty == 1) { S.insert(A[id - 1]); 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 "constants.v"
`ifndef _clkdiv
`define _clkdiv
module clkdiv(input in, output out);
parameter CLK_DIVIDER_WIDTH = `CLK_DIVIDER_WIDTH;
parameter CLK_DIVIDER_VALUE = `CLK_DIVIDER_VALUE;
reg [CLK_DIVIDER_WIDTH-1:0] _icounter;
reg _internal_clk;
assign out = _internal_clk;
initial beg... |
#include <bits/stdc++.h> using namespace std; long long int Lpow(long long int a, long long int b) { long long int ans = 1; while (b > 0) { if (b % 2) ans = (ans * a); a = (a * a); b = b / 2; } return ans; } long long int Lpow(long long int a, long long int b, long long int M) ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 110; int N, M, U = 110, D = 0, L = 110, R = 0, cnt; char s[maxn][maxn]; inline int gi() { char ch; int ret = 0, f = 1; do ch = getchar(); while (!(ch >= 0 && ch <= 9 ) && ch != - ); if (ch == - ) f = -1, ch = getchar(); ... |
#include <bits/stdc++.h> using namespace std; int MOD = 1e9 + 7; long long INF = 1e18; int n, q, a[200005]; int d[200005] = {}; int solve() { cin >> n >> q; for (int i = 0; i < n; i++) cin >> a[i]; while (q--) { int l, r; cin >> l >> r, l--, r--; d[l]++; d[r + 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; int rd(int &x) { return scanf( %d , &x); } int rd(int &x, int &y) { return scanf( %d %d , &x, &y); } int rd(int &x, int &y, int &z) { return scanf( %d %d %d , &x, &y, &z); } int rd(int &x, int &y, int &z, int &s) { return scanf( %d %d %d %d , &x, &y, &z, &s); ... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, l, m, n, f, t; string s, s1, s3, s4; while (cin >> s) { s1 = s; k = 0; for (i = 0; i < s.size(); i++) { k += s[i] - 0 ; } k = k % 3; if (k == 0) { cout << s << endl; } else ... |
`timescale 1ns/1ps
module testbench_CORDIC_Arch2 (); /* this is automatically generated */
parameter PERIOD = 10;
//ESTAS SON DEFINICIONES QUE SE REALIZAN EN LOS COMANDOS O CONFIGURACIONES
//DEL SIMULADOR O EL SINTETIZADOR
`ifdef SINGLE
parameter W = 32;
parameter EW = 8;
parameter SW = 23;
parameter SWR = 26... |
#include <bits/stdc++.h> using namespace std; template <typename T> T getint() { T x = 0, p = 1; char ch; do { ch = getchar(); } while (ch <= ); if (ch == - ) p = -1, ch = getchar(); while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); return x * p; } tem... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2010 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 13.... |
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T& a) { static char c; static bool b; for (c = getchar(), b = false; !isdigit(c); c = getchar()) if (c == - ) b = true; for (a = 0; isdigit(c); c = getchar()) a = a * 10 + (c - 0 ); if (b) a = -a; } templ... |
//
// 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... |
`timescale 1ns / 1ps
/********************************************************************
* TEST BENCH FOR PROTECTION CELLS *
********************************************************************
* Laboratory : Robotics and Embedded System Technology
* Engineer : Hanjara Cah... |
#include <bits/stdc++.h> using namespace std; bool valid(char str[]) { int now = 0; for (int i = 0; str[i]; i++) { if (str[i] > now + a ) return false; if (str[i] == now + a ) now++; } return true; } int main() { char in[550]; scanf( %s , in); int mx = 0; for (int i... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distributed ... |
//-----------------------------------------------------------------------------
// setbit.v
//-----------------------------------------------------------------------------
//- (C) D. Cuartielles for Arduino, December 2015
//- GPLv3 License
//- based on previous work by Obijuan for BQ
//---------------------------------... |
#include <bits/stdc++.h> const int MAXN = 1e6 + 5; int n, m, k; char str[21]; int x[MAXN], y[MAXN]; int s[MAXN], t[MAXN]; int p[21]; int f[(1 << 20) + 3], g[(1 << 20) + 3]; inline void presum() { for (int i = 0; i <= k - 1; ++i) { for (int S = 0; S <= (1 << k) - 1; ++S) { if ((S >> i) ... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( O2 ) const int P = 998244353; int n, k, ans; int dp[2][510][510]; int cnt[510], pre[510]; template <typename T> inline void read(T &x) { T f = 1; x = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`include "utils/bus_to_ip.v"
`include "seq_gen/seq_gen.v"
`include "seq_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.