text stringlengths 59 71.4k |
|---|
/*
* 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 (c) 2011-2012
*
*
*
* 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 distributed in... |
#include <bits/stdc++.h> int n; int a[1001000]; int b[1001000]; int c[1001000]; int ans; int main() { int i, j; scanf( %d , &n); n++; for (i = 2; i <= n; i++) { scanf( %d , &a[i]); b[i] = 1; c[i] = 0; j = i; if (ans < b[j]) ans = b[j]; while (a[j] != 1) { ... |
// ALU implementation
`include "verilog/mips_alu_defines.v"
module alu
(
input wire[31:0] opr_a_alu_i,
input wire[31:0] opr_b_alu_i,
input wire[5:0] op_alu_i,
output wire[31:0] res_alu_o,
output wire z_alu_o,
output wire n_alu_o
);
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:15:28 07/05/2015
// Design Name:
// Module Name: Level1_Cache
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; const int N = 1010; struct node { double x; double y; double t; double p; bool operator<(const node& W) const { return t < W.t; } } q[N]; double dp[N]; bool check(node a, node b) { double dx = a.x - b.x; double dy = a.y - b.y; ret... |
//////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE SD Card Controller IP Core ////
//// ////
//// sd_wb_sel_ctrl.v ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; string s[105]; set<char> ms; cin >> n >> m; for (int i = 0; i < n; i++) cin >> s[i]; long long ans = 1; for (int i = 0; i < m; i++) { ms.clear(); for (int j = 0; j < n; j++) ms.insert(s[j][i]); ans = a... |
///////////////////////////////////////////////////////////////////////////////
// Title : alt_mem_ddrx_mm_st_converter
//
// File : alt_mem_ddrx_mm_st_converter.v
//
// Abstract : take in Avalon MM interface and convert it to single cmd and
// multiple data Avalon ST
//
/////////... |
#include <bits/stdc++.h> using namespace std; int k[3], t[3]; int n; long long a[100000]; long long was[100000]; int main() { scanf( %d %d %d , &k[0], &k[1], &k[2]); scanf( %d %d %d , &t[0], &t[1], &t[2]); scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %I64d , &a[i]); was[... |
/*
* 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; struct node { int x, y, id; bool operator<(const node &A) const { return x < A.x; } }; vector<node> line[2][100005 << 2]; bool mark[2][100005 << 2]; int n, m, k; long long t[100005]; void add(int x, int y, int i) { node a; a.x = x, a.y = y, a... |
module top (
input wire [7:0] inp,
input wire [1:0] hiz,
output wire [3:0] out,
output wire [3:0] out_p,
output wire [3:0] out_n
);
// OBUF
OBUF #(
.IOSTANDARD("LVCMOS33"),
.DRIVE(8),
.SLEW("FAST")
) obuf_0 (
.I (inp[0]),
.O (out[0])
);
// OBUFT, T=0
OBUFT #(
.IOSTANDA... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; const long long INF = 1e9; const long long MOD = 1000000007; int prevs[20]; int main() { ios ::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i]; int a... |
// (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 ... |
#include <bits/stdc++.h> int main() { long long n, d, m, l, i, le, ri, step; while (~scanf( %I64d%I64d%I64d%I64d , &n, &d, &m, &l)) { for (i = 0; i < n; i++) { le = i * m + l; ri = (i + 1) * m; step = (le + d) / d; if (step * d < ri) break; } printf( %I64d 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 la... |
#include <bits/stdc++.h> int minDig(uint64_t n) { int k = n % 10, min = k; n /= 10; while (n != 0) { k = n % 10; if (k <= min) min = k; n /= 10; } return min; } int maxDig(uint64_t n) { int k = n % 10, max = k; n /= 10; while (n != 0) { k = n % 10; if ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 5; const int mod = 51123987; char s[maxn]; struct Pam { vector<pair<int, int> > next[maxn]; int fail[maxn]; int len[maxn]; int num[maxn]; int S[maxn]; long long a[maxn], b[maxn]; int last, n, p; int newNode(in... |
#include <bits/stdc++.h> using namespace std; struct data { int to, head; } e[750000 * 2]; stack<int> s; vector<int> cir[750000]; int n, m, len, head[750000], dfn[750000], low[750000], cnt, num, p[750000], binv[750000], d[750000]; int ans, tot; long long mm; int mul(int a, int b) { int a... |
#include <bits/stdc++.h> using namespace std; unsigned long long mod = 1e9 + 7; unsigned long long ncr(long long int n, long long int k) { unsigned long long res = 1; if (k > n - k) k = n - k; for (int i = 0; i < k; ++i) { res *= (n - i); res /= (i + 1); res = res % mod; } 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 law... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const int INF = 1 << 30; const long long LINF = 1ll << 60; const int BUFFER_SZ = 1 << 15; const int MOD = 1000 * 1000 * 1000 + 7; char BUFFER[BUFFER_SZ]; int gi() { int x; scanf( %d , &x); return x; } double gd() { ... |
// DESCRIPTION: Verilator: Verilog Test for short-circuiting in generate "if"
// that should not work.
//
// The given generate loops should attempt to access invalid bits of mask and
// trigger errors.
// is defined by SIZE. However since the loop range is larger, this only works
// if short-circuited evaluation of th... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n + 1]; for (int i = 1; i < n + 1; i++) { cin >> a[i]; } int s = 0; int arr[n + 1], max; max = INT_MIN; memset(arr, 0, sizeof(arr)); for (int i = 1; i < n + 1; i++) { if (a[i] == 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... |
`timescale 1ns / 1ps
module tx_sm_tb ();
`include "dut.v"
integer i;
initial
begin
//$dumpfile("test.vcd");
//$dumpvars(0,tx_sm_tb,U_tx_sm);
end
initial
begin
#15 reset = 0;
mode = 0;
// Will initially wait IFG before making any transmissions
// Set fifo_count to 1 and check IFG d... |
#include <bits/stdc++.h> using namespace std; unsigned long long dsum(unsigned long long n) { unsigned long long res = 0; while (n) { res += n % 10; n /= 10; } return res; } int main() { unsigned long long n, s; cin >> n >> s; unsigned long long dif = n - dsum(n); if ... |
#include <bits/stdc++.h> namespace my_std { using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline T rnd(T first, T second) { return uniform_int_distribution<T>(first, second)(rng); } template <typename T> inline bool chkmax(T &x, T y) ... |
#include <bits/stdc++.h> using namespace std; long long num[505]; int n; long long minval = 0x3f3f3f3f3f3f3f3fll; long long check(int x) { long long ans = 0; for (int i = 1; i <= n; i++) { if (num[i] % x == 0) { ans += num[i] / x; } else { if (num[i] % x + num[i] / x >= x -... |
/**
* 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> const int MAX_VAL = 1000000; struct AInt { int sum; int minSum; }; AInt aInt[1 << 21]; void update(int index, int left, int right, int addIndex, int addValue) { if (left == right) { aInt[index].sum += addValue; aInt[index].minSum += addValue; } else { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6; int n, t[1000001]; struct data { int num, loc, vis; } b[1000001]; int a[1000001]; int lowbit(int x) { return x & (-x); } int Query(int x) { int sum = 0; while (x > 0) { sum = max(sum, t[x]); x -= lowbit(x); } ... |
//`#start header` -- edit after this line, do not edit this line
// ========================================
// Copyright 2013 David Turnbull AE9RB
//
// 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 o... |
//
// Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)
//
//
//
//
// Ports:
// Name I/O size props
// mv_read O 64
// mav_write O 64
// mv_sie_read O 64
// mav_sie_write ... |
module stimulus;
parameter data_width = 32;
parameter address_width = 32;
parameter address_depth = 2048;
parameter opcode_width = 7;
parameter reg_addr_width = 5;
parameter immediate_width = 15;
parameter period = 20;
parameter delay = 1;
// Define the input and output file names
/*
parameter p... |
/**
* 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... |
// (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 ... |
//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 associate... |
// EE 471 Lab 1, Beck Pang, Spring 2015
// Main function for calling different counter onto the board
// @require: only call one counter a time
`include "hexOnHex.v"
`include "Implementation/mux2_1.sv"
`include "Implementation/mux4_1.sv"
`include "Implementation/mux8_1.sv"
`include "Implementation/mux32_1.sv"
`incl... |
#include <bits/stdc++.h> using namespace std; int N, K; bool good[1050]; int main() { scanf( %d , &N); for (int i = 2; i <= N; i++) { bool isp = true; for (int j = 2; j < i; j++) if (i % j == 0) { isp = false; int x = i; while (x % j == 0) x /= j; ... |
/**
* 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... |
/**
* 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... |
/*
eTeak synthesiser for the Balsa language
Copyright (C) 2012-2016 The University of Manchester
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 opt... |
// Actel Corporation Proprietary and Confidential
// Copyright 2007 Actel Corporation. All rights reserved.
// ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN
// ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED
// IN ADVANCE IN WRITING.
// Revision Information:
// SVN Revision Info... |
#include <bits/stdc++.h> using namespace std; long long n, m, k, sum, num, ans; long long a[200005]; int main() { cin >> n >> m >> k; for (int i = 1; i <= m; i++) cin >> a[i]; sort(a + 1, a + m + 1); sum = 0, num = 1, ans = 1; for (int i = 2; i <= m; i++) { if ((a[i] - 1 - sum) / k != ... |
#include <bits/stdc++.h> using namespace std; string s; int n, ans = 0; vector<pair<int, int>> b; vector<int> a(26); int main() { cin >> s >> n; for (int i = 0; i < s.length(); ++i) { a[s[i] - a ]++; } for (int i = 0; i < 26; ++i) { b.push_back(make_pair(a[i], i)); } sor... |
#include <bits/stdc++.h> using namespace std; int n; long long dp[210][210]; struct point { long long x, y; void read() { scanf( %I64d%I64d , &x, &y); } } P[210]; long long cross(point a, point b, point c) { return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); } int main() { lon... |
/**
* 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... |
/*
* PS2 Interface
* Copyright (C) 2009 Takeshi Matsuya
* 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.... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; int f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } x ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; const int N = 1000 + 20; int n, m, q, part[N][N]; string s[N]; inline int get(int x) { return (__builtin_popcount(x) & 1 ? -1 : +1); } inline int get(int x, int y) { return get(x) * ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:46:45 10/11/2015
// Design Name:
// Module Name: rx
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies... |
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; const int C = 26; void add(int &x, int y) { x += y; while (x >= MOD) x -= MOD; while (x < 0) x += MOD; } int fix(int x) { while (x >= MOD) x -= MOD; while (x < 0) x += MOD; return x; } int pw(int a, int b) {... |
#include <bits/stdc++.h> using namespace std; int main() { int q; scanf( %d , &q); for (int i = 0; i < q; i++) { int l, r, d; scanf( %d %d %d , &l, &r, &d); if ((double)l / d > 1) printf( %d n , d); else { int f = ((double)r / d) + 1; printf( %d n , f * d)... |
/*
* 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 INF = 1000000000; long long A[100005]; map<long long, long long> mp; int main() { long long n, a, i; cin >> n; for (i = 1; i <= n; i++) { cin >> a; mp[a] += a; } A[1] = mp[1]; A[0] = 0; for (i = 2; i <= 100000; 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... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_clk_gclk_inv_r90_224x.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistri... |
#include <bits/stdc++.h> using namespace std; int a[105]; bool judge(int x) { for(int i=1;i<=100;i++) { if(i*i==x) return true; } return false; } int main() { int t; cin>>t; while(t--) { int n; cin>>n; 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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2007 Corgan Enterprises 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 2 of... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int mod = 998244353; int T; int a[N], b[N], p[N]; bool vis[N]; int main() { scanf( %d , &T); while (T--) { int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); p[a[i... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); long long n, m, k, s; cin >> n >> m >> k >> s; vector<vector<long long>> a(2, vector<long long>(n)); for (long long i = 0; i < 2; ++i) { for (long long j = 0; j <... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`timescale 1ns/1ns
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
always @ (posedge cl... |
/**
* 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 test_amba;
// Inputs
reg clk;
reg miso;
//reg[7:0] data_in;
//reg ready_send;
reg rst;
reg hwrite;
reg[31:0] hwdata;
reg[31:0] haddr;
reg hsel;
// Outputs
wire mosi;
wire sclk;
wire ss;
//wire busy;
//wire[7:0] data_out;
wi... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:20000000 ) using namespace std; int ri() { int x; scanf( %d , &x); return x; } long long rll() { long long x; scanf( %lld , &x); return x; } void solve() { long long x; cin >> x; set<pair<long long, long long> > r... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; template <typename T> void read(T &x) { x = 0; char op = getchar(); int F = 1; while (!isdigit(op)) { if (op == - ) F *= -1; op = getchar(); } while (isdigit(op)) { x = (x << 1) + (x << 3) + op - 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... |
/*
* 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... |
// (c) NedoPC 2013
//
// SD data sender to test SD and MP3 dmas
`timescale 1ns/100ps
module sd
(
input wire clk,
input wire sdi,
output wire sdo
);
reg [7:0] byteout;
reg [7:0] bytein;
int bitcntout;
int bitcntin;
int state;
int count;
reg [7:0] tmp;
localparam _FF = 'd0;
localparam _FE = 'd1;
... |
#include <bits/stdc++.h> using namespace std; int p_arr[200005]; int main() { int n, in, cnt, x, arr[200005]; std::cin >> n; queue<int> q; for (int i = 1; i <= n; i++) { std::cin >> in; q.push(in); } for (int i = 1; i <= n; i++) { std::cin >> arr[i]; } cnt = 0; ... |
#include <bits/stdc++.h> using namespace std; int n; long long s, x; int main() { srand(time(NULL)); cin >> n; n--; s = 1; x = 12; while (n) { s += x; x += 12; n--; } cout << s << endl; return 0; } |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: mult_unit.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// ===============================... |
`include "defines.v"
module alu (input [31:0] a, b, output [15:0] o1, o2, input size, input [4:0] func, output [15:0] flag_o, input en);
reg [15:0] flag;
wire [15:0] alu8_flag, alu16_flag;
wire alu8_en, alu16_en;
always @(alu8_flag) begin
flag <= alu8_flag;
end
always @(alu16_flag) begin
flag <= alu16_flag... |
#include <bits/stdc++.h> using namespace std; long long n, d, ans = 0; vector<long long> a; int main() { ios::sync_with_stdio(false); cin >> n >> d; while (n--) { long long temp; cin >> temp; a.push_back(temp); } for (long long i = 0; i < a.size(); i++) { long long id... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; set<int> s; for (int i = 0; i < n; i++) { int a; cin >> a; s.insert(a);... |
/**************************************
* Module: router
* Date:2016-01-29
* Author: saber
*
* Description:
***************************************/
`include "constants.v"
`include "util.v"
module router(flit_out, credit, flit_in, data, next_router_credit, load, write,
init, clock, reset);
para... |
#include <bits/stdc++.h> using namespace std; struct osoba { string ime, prezime; }; int main() { int n; cin >> n; vector<osoba> osobe(n); vector<int> redoslijed(n); vector<string> minori(n); bool trigger = true; for (int i = 0; i < n; i++) cin >> osobe[i].ime >> osobe[i].prezime... |
#include <bits/stdc++.h> using namespace std; int main() { int N, i; cin >> N; char ch; int o = 0, n = 0, e = 0, z = 0, r = 0; for (i = 0; i < N; i++) { cin >> ch; if (ch == o ) o++; else if (ch == n ) n++; else if (ch == e ) e++; else if ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Ramdon_gen.v ////
//// ////
//// This file is part of the Ether... |
//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... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: TU Darmstadt
// Engineer: Mahdi Enan
//
// Create Date: 10:44:35 01/18/2017
// Design Name: Pi
// Module Name: spongent/tb_Pi.v
// Project Name: spongent
// Target Device:
// Tool versions:
// D... |
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &a) { register int b = 1, c = getchar(); a = 0; for (; !isdigit(c); c = getchar()) if (c == 45) b *= -1; for (; isdigit(c); c = getchar()) a = (a << 3) + (a << 1) + c - 48; a *= b; } const int maxn = 105;... |
/**
* 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... |
// (C) 1992-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 simulati... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2020 by Peter Monsson.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
wire [31:0] in = cyc;
Test test (/*AUTOINST*/
... |
/*
* Copyright (c) 2001 Stephen Williams ()
*
* 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)
* ... |
//
// 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... |
/*
* 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() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int q; cin >> q; while (q--) { int n; cin >> n; int a = 100000, b = 100000, c = -100000, d = -100000; vector<bool> ok(4, false); for (int ... |
#include <bits/stdc++.h> using namespace std; int n, m, a[100005], b[100005]; vector<int> g[100005]; int next_id, from[100005], to[100005]; bitset<1000> tree[4 * 100005], primes; int lazy[4 * 100005]; void dfs(int u) { from[u] = next_id++; b[from[u]] = a[u] % m; for (int i = 0; i < g[u].size()... |
// DEFINES
`define BITS 2 // Bit width of the operands
module bm_dag3_lpm_log_mod(clock,
reset_n,
first,
sceond,
third,
fourth,
out0,
out1);
// SIGNAL DECLARATIONS
input clock;
input reset_n;
input [`BITS-1:0] first;
input [`BITS-1:0] sceond;
input third;
input fourth;
output [`BITS-1: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> const int N = 1123; const double eps = 1e-6; const int inf = (int)1e9 + 123; using namespace std; int n, m; char a[N][N]; int mini = inf; int d[N][N]; int sum(int x, int y, int x2, int y2) { return d[x2][y2] - d[x - 1][y2] - d[x2][y - 1] + d[x - 1][y - 1]; } bool check... |
#include <bits/stdc++.h> using namespace std; long long mod1(long long x) { if (x >= 0) { return x; } return -x; } vector<long long> countDigit(long long n) { vector<long long> ret; while (n != 0) { ret.push_back(n % 10); n = n / 10; } return ret; } long long gc... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; const int inf = 0x7fffffff / 2; int n, m; int fa[maxn]; int vis[maxn]; struct edge { int u; int v; int w; } e[maxn]; struct ex { int mi; int mx; int sum; } ex[maxn]; int father(int x) { if (x != fa[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.