text stringlengths 59 71.4k |
|---|
//------------------------------------------------------------------------------
// Title : Synchronous Reset generation flip-flop pair
// Project : Tri-Mode ethernet MAC
//------------------------------------------------------------------------------
// File : reset_sync.v
// Author : Xilinx, Inc.
//... |
/*
* 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 block_memory(
input clock, reset, enable,
input [4:0] row1, row2, // 0~29
input [4:0] col1, col2, // 0~9
input [1:0] func,
input [1:0] stage,
output [2:0] block1, block2,
output ready
);
`include "def.v"
localparam MAXROW = 30;
localparam READY = 2'b00;
reg write;
reg [4:0] cnt, addr1;
wire [4:0] addr2;... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) { in >> a.first >> a.second; return in; } template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> a) { out << a.first << << a.second;... |
/*
* 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 ... |
#include <bits/stdc++.h> using namespace std; bool sortin(const pair<long long int, long long int> &e, const pair<long long int, long long int> &f) { return (e.first < f.first); } long long int i, j, k, l, m, n, c, p, q, ts, mn = 10e17; long long int a[200002], b[200002], x[200002]; int ma... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, i, m, s = 0, d = 0; cin >> n >> m; long long a[n], b[n], c[n]; for (i = 0; i < n; i++) { cin >> a[i] >> b[i]; s += a[i]; c[i] = a[i] - b[i]; } sort(c, c + n); for (i = 0; i < n; i++) if (s >... |
`default_nettype none
`timescale 1ns / 1ps
// The receiver core provides a ITU V.4-compatible bit-serial interface.
// The receiver is broadly broken up into three parts: the Wishbone B4
// slave interface, the transmitter, and the receiver.
//
// This module defines the V.4-compatible receiver.
//
// Note that if bo... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 3) + (x << 1) + c - 0 ; c = getchar(); } return x ... |
/*
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... |
/**
* 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; inline long long add(long long a, long long b) { a = (a + b); if (a >= 1000000007) a -= 1000000007; return a; } inline long long sub(long long a, long long b) { a = a - b; if (a < 0) a += 1000000007; return a; } inline long long mul(long ... |
// File: read_pointerTBV.v
// Generated by MyHDL 0.10
// Date: Mon Aug 27 20:10:12 2018
`timescale 1ns/10ps
module read_pointerTBV (
);
// myHDL -> Verilog Testbench for `read_pointer` module
reg clk = 0;
reg rst_n = 0;
reg rd = 0;
reg fifo_empty = 0;
wire [4:0] rptr;
wire fifo_rd;
wire read_pointer0_0_fifo_rd_i;... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFF = 0x3f3f3f3f3f3f3f3fll; const long long M = 1e9 + 7; const long long maxn = 2e5 + 7; const double eps = 0.00000001; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } template <typename ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2E5 + 10; const int P = 1E9 + 7; int n, q; struct node { int l, r, id; } qu[MAXN]; int a[MAXN], pri[1100], cnt; int num[1000001]; long long ans[MAXN]; long long bin[MAXN]; vector<int> dir[1000001]; vector<int> rec[MAXN]; int po... |
#include <bits/stdc++.h> using namespace std; priority_queue<long long, vector<long long>, greater<long long>> q; int a[100005]; int main() { int n, x; long long b = 0, s; scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , &a[i]); for (int i = 1; i <= n; ++i) { scanf( %d , &x); ... |
//Legal Notice: (C)2015 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... |
// DESCRIPTION: Verilator: Verilog Test module
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2008 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
integer v;
reg i;... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
#include <bits/stdc++.h> #define int long long #define ld long double #define vc vector #define s second #define f first //#include prettyprint.hpp using namespace std; typedef pair <int, int> pii; int n, m; int t(int a){ return a+n; } int mod=998244353; vc< vc <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; int flag[13], change[13]; bool is_leap(int y) { if (y % 100 == 0) return y % 400 == 0; else return y % 4 == 0; } int main() { memset(flag, 0, sizeof(flag)); memset(change, 0, sizeof(change)); int y; cin >> y; while (1) { ... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(0); long long n; cin >> n; long long num = 1e5 + 3; long long pos[num]; for (int i = 0; i < n; ++i) { long long a; cin >> a; pos[a] = i + 1; } long long m; cin >> m; ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, ans = 0, pot; long long a, b, c, e; cin >> n; if (n <= 2) { ... |
#include <bits/stdc++.h> int const MAX = 1e5 + 5; using namespace std; char ans[50][50]; void place(long long s, long long e, long long c, long long cnt) { int f = 0; for (long long i = s; i < e; i += 2) { for (long long j = 0; j < 50; j += 2) { if (cnt == 0) { f = 1; b... |
/**
* 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 N = 300005; int n, k, pos[N]; long long c[N], ans; vector<int> v; priority_queue<pair<long long, int> > q; int main() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %lld , &c[i]); for (int i = 1; i <= n + k; i++) { if ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; const long long mod = 1e9 + 7; const long long N = 222; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long n, k; vector<long long> adj[N]; long long dp[N][N], dp2[N][N], a[N]; void input() { cin >... |
#include <bits/stdc++.h> using namespace std; int n, m, a[105], rev[105], b[105]; long double ans = 0, cnt = 0, f[2][35][35], g[31][31]; void dfs(int u) { if (!u) { for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) if (a[i] > a[j]) ans++; cnt++; return; } ... |
#include <bits/stdc++.h> #pragma warning(disable : 4786) #pragma warning(disable : 4996) using namespace std; int c[200005], d[200005]; int main() { int n; scanf( %d , &n); int val = 0; int lb, ub; lb = -1000000000; ub = 1000000000; for (int i = 1; i <= n; i++) { scanf( %d %d... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; vector<string> v(100005); long long int n, m; long long int check(string s, string str) { long long int count = 0; for (long long int i = 0; i < s.size(); i++) { if (str[i] != s[i]) count++; } return count; ... |
/*
* 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; void read(int &x) { register int c = getchar(); x = 0; for (; c < 48 || c > 57; c = getchar()) ; for (; c > 47 && c < 58; c = getchar()) x = (x << 1) + (x << 3) + c - 48; } queue<int> y[300005], v; int main() { int n, q, w = 0, x, z = 0, ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int c = 0, f = 0; for (int i = 0; i < n; i++) { if (s[i] == x ) c++; else if (s[i] != x && c < 3) c = 0; if (c > 2) { while (1) { f++; ... |
#include <bits/stdc++.h> namespace myland { using namespace std; namespace _abbr {} using namespace _abbr; namespace _constant { const double EPS(1e-8); const double PI(acos(-1.0)); const int INF(0x3f3f3f3f); const long long INFL(0x3f3f3f3f3f3f3f3fll); const int MOD(1e9 + 7); const int dx[] = {-1,... |
#include <bits/stdc++.h> using namespace std; const int N = 1e9 + 7; int main() { int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int difference; int ans = 0; for (int i = 0; i < n - 1; i++) { if (a[i] + a[i + 1] < k) { difference = k - (a[i] +... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
#include <bits/stdc++.h> using namespace std; using i64 = long long; int n, p[666][666], quad[666]; bool alive[666]; i64 x[666], y[666], px[666], py[666]; int gopos[666][666], goneg[666][666], f[666], id[666]; i64 dp[666][666][4], ans; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) {... |
//----------------------------------------------------------------------------
// Wishbone SRAM controller
//----------------------------------------------------------------------------
module wb_sram32 #(
parameter adr_width = 19,
parameter latency = 2 // 0 .. ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:28:30 03/06/2016
// Design Name: summed
// Module Name: C:/XilinxP/Practica1/summed_test.v
// Project Name: Practica1
// Target Device:
// Tool versi... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, c = 0; cin >> n >> m; int a[n], i; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (i = 0; i < m; i++) if (a[i] <= 0) c = c + a[i]; cout << abs(c); } |
// Copyright (c) 2014 Takashi Toyoshima <>.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
module MC6502ProcessorStatusRegister(
clk,
rst_x,
i_c,
i_set_c,
i_i,
i_set_i,
i_v,
i_set_v,
i_d,
i_set_d,
... |
#include <bits/stdc++.h> using namespace std; const int N = 105; const int oo = 1000000000; long long n, k; long long a[N], b[N], c[N]; long long module = 1000000007; void print(vector<vector<long long> > mat) { for (int j = 0; j < mat.size(); j++) { for (int k = 0; k < mat[j].size(); k++) cout ... |
#include <bits/stdc++.h> using namespace std; template <typename T> vector<T>& operator--(vector<T>& v) { for (auto& i : v) --i; return v; } template <typename T> vector<T>& operator++(vector<T>& v) { for (auto& i : v) ++i; return v; } template <typename T> istream& operator>>(istream&... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; vector<long long> a(n); vector<long long> b(n); for (long long i = 0; i < n; i++) cin >> a[i]; for (long long i = 0; i < n; i++) cin >> b[i]; sort(b.begin(), b.end()); long long ans = m - 1; ... |
// -- (c) Copyright 2013 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 proper... |
#include <bits/stdc++.h> using namespace std; struct Seller { long long first, second, diff; } a[200005]; bool cmp(Seller p, Seller q) { return (p.diff > q.diff); } int main() { long long n, m, i, j, ans = 0; cin >> n >> m; for (i = 0; i < n; i++) cin >> a[i].first; for (i = 0; i < n; i++)... |
`default_nettype none
`include "processor.h"
module dispatch_general_register(
//System
input wire iCLOCK,
input wire inRESET,
input wire iRESET_SYNC,
//Write Port
input wire iWR_VALID,
input wire [4:0] iWR_ADDR,
input wire [31:0] iWR_DATA,
//Read Port0
input wire [4:0] iRD0_ADDR,
output wire [3... |
//#############################################################################
//# Function: Gray to binary encoder #
//#############################################################################
//# Author: Andreas Olofsson #
... |
/**
* 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 C-L-G.FPGA1988.lichangbeiju. All rights reserved-----------------
//
// -- It to be define --
// -- ... |
`include "mrfm.vh"
module biquad_2stage (input clock, input reset, input strobe_in,
input serial_strobe, input [6:0] serial_addr, input [31:0] serial_data,
input wire [15:0] sample_in, output reg [15:0] sample_out, output wire [63:0] debugbus);
wire [3:0] coeff_addr, coeff_wr_addr;
wire ... |
module router(clock,
ID,
// input links
in_data_n, in_data_s, in_data_e, in_data_w,
in_srcdst_n, in_srcdst_s, in_srcdst_e, in_srcdst_w,
in_active_n, in_active_s, in_active_e, in_active_w,
in_hops_n, in_hops_s, in_hops_e, in_hops_w,
... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
/**
* 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 "v2k_typedef_yee_inc.v"
module v2k_typedef_yee
(/*AUTOARG*/
// Outputs
sub2_out_pixel, ready, sub1_to_sub2_and_top,
// Inputs
sub1_in_pixel, reset, pixel_ff, cp
);
//-----------------------
// Output definitions
//
output logic_t sub1_to_sub2_and_top; // Explicit output ... |
/*
* 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> std::mt19937 rng( (int)std::chrono::steady_clock::now().time_since_epoch().count()); const int MOD = 1e9 + 7; const int ms = 220; int c = 1; int to[ms][20]; int fail[ms]; int cost[ms]; int addString(const std::vector<int> &str) { int on = 0; for (auto ch : str) { ... |
#include <bits/stdc++.h> using namespace std; template <class T1> void deb(T1 e) { cout << e << endl; } template <class T1, class T2> void deb(T1 e1, T2 e2) { cout << e1 << << e2 << endl; } template <class T1, class T2, class T3> void deb(T1 e1, T2 e2, T3 e3) { cout << e1 << << e2 ... |
/**
* 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 p[5005], c[5005]; int day[5005]; bool out[5005], vi[5005]; int last = 0; int match[5005]; vector<int> DSK[5005]; bool DFS(int u) { if (vi[u] == true) return false; vi[u] = true; for (int i = 0; i < DSK[u].size(); i++) { int w = DSK[u][i... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2005 Xilinx, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,abm,mmx,tune=native ) using namespace std; const int64_t INF = (int64_t)(2e18); const int maxn = 500 * 1000 + 100; chrono::time_point<chrono::steady_clock> cl; double curre... |
#include <bits/stdc++.h> using namespace std; map<string, string> m; int main() { int n; string j, x; cin >> n; while (n--) { cin >> j >> x; if (m.count(j) == 0) m[x] = j; else { m[x] = m[j]; m.erase(j); } } cout << m.size() << endl; map<... |
//-----------------------------------------------------------------------------
// Pretend to be an ISO 14443 tag. We will do this by alternately short-
// circuiting and open-circuiting the antenna coil, with the tri-state
// pins.
//
// We communicate over the SSP, as a bitstream (i.e., might as well be
// unframed,... |
module konamiacceptor (
clk,
reset_,
up_,
down_,
left_,
right_,
segment_,
digit_enable_
);
input clk;
input reset_;
input up_;
input down_;
input left_;
input right_;
output [6:0] segment_;
output [3:0] digit_enable_;
// Konami code acceptor states
parameter START = 4'd0; ... |
#include <bits/stdc++.h> using namespace std; map<string, string> mp; map<string, int> stn; void Print(string cur) { string res = / ; while (cur != / ) { string tmp = cur; while (int(tmp.size()) && ( 0 <= tmp[tmp.size() - 1] && tmp[tmp.size() - 1] <= 9 )) tmp.erase(t... |
//move some stuff to minitests/ncy0
module top(input clk, stb, di, output do);
localparam integer DIN_N = 256;
localparam integer DOUT_N = 256;
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 <... |
/**
* 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; struct AA { int p, s; } c[110]; int st[110]; bool cmp1(AA a, AA b) { if (a.p == b.p) return a.s < b.s; return a.p < b.p; } bool vis[110]; int work1() { int ret = 0; sort(c, c + n, cmp1); sort(st, st + m); for (int i = ... |
#include <bits/stdc++.h> using namespace std; int n, m, i, j; int main() { ios::sync_with_stdio(false); cin >> n; cout << 3 * n / 2 << n ; for (i = 2; i <= n; i += 2) cout << i << ; for (i = 1; i <= n; i += 2) cout << i << ; for (i = 2; i <= n; i += 2) cout << i << ; return ... |
#include <bits/stdc++.h> using namespace std; const long double pi = acos(-1); const int N = 2e5; long long gi() { long long w = 0; bool q = 1; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = getchar(); if (c == - ) q = 0, c = getchar(); while (c >= 0 && c <= 9 ) w =... |
#include <bits/stdc++.h> using namespace std; int t, n; string s; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> t; while (t--) { cin >> s; n = s.length(); int m = n, M = -1; for (int i = 0; i < n; i++) { if (s[i] == 1 ) { m = min(m, i); ... |
#include <bits/stdc++.h> using namespace std; int A[100][10000]; int d[100][10000]; int main() { int n, m; cin >> n >> m; string str; getline(cin, str); for (int i = 0; i < n; i++) { getline(cin, str); for (int j = 0; j < str.size(); j++) if (str[j] == 1 ) A[i]... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include<bits/stdc++.h> #define fo(i,a,b) for(int i=a;i<=b;i++) #define fd(i,a,b) for(int i=a;i>=b;i--) using namespace std; typedef long long LL; typedef pair<int,int> pr; const int maxn=505; int n,m; char mp[maxn][maxn]; int T; int main() { scanf( %d ,&T); while (T--) { ... |
#include <bits/stdc++.h> using namespace std; const long long MX = 1e5 + 10; long long A[MX]; long long cnt[MX]; vector<long long> pos[MX]; long long ans[MX]; void init(long long n) { for (long long i = 0; i <= n + 2; i++) cnt[i] = 0; for (long long i = 0; i <= n + 2; i++) pos[i].clear(); for ... |
#include <bits/stdc++.h> using namespace std; int main() { int c = 0, m = 0, y = 0, w = 0, g = 0, b = 0, d, e; cin >> d >> e; char arr[d][e]; for (int i = 0; i < d; i++) { for (int j = 0; j < e; j++) { cin >> arr[i][j]; if (arr[i][j] == M ) { m++; } else if (... |
#include <bits/stdc++.h> using namespace std; const int N = 300100; const int K = 1001000; vector<int> v[K]; int a[N], s[N]; int l[N], r[N]; int q[N], id[N]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } s[0] = a[0] % k; v... |
/*
* 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: SIPO_TBV.v
// Generated by MyHDL 0.10
// Date: Wed Sep 5 07:52:49 2018
`timescale 1ns/10ps
module SIPO_TBV (
);
// myHDL -> Verilog Testbench for `SIPO` module
reg clk = 0;
wire rst;
reg SerialIn = 0;
wire [3:0] BusOut;
wire [11:0] SerialVals;
reg [3:0] SIPO0_0_Buffer = 0;
assign rst = 1'd0;
assign Ser... |
module j1soc#(
//parameter bootram_file = "../../firmware/hello_world/j1.mem" // For synthesis
parameter bootram_file = "../firmware/Hello_World/j1.mem" // For simulation
)(
uart_tx, ledout,
sys_clk_i, sys_rst_i, mosi ,miso, sck, ss, SDA, SCL... |
#include <bits/stdc++.h> using namespace std; long long int dp[5005][5005]; int main() { long long int n, m, k; cin >> n >> m >> k; long long int arr[n + 1]; long long int sum[n + 1]; for (int i = 1; i <= n; i++) cin >> arr[i]; sum[1] = 0; for (int i = 1; i <= m; i++) sum[1] += arr[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 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> long long R = 7 + 1e9, NUMTESTCASE; const int NN = 10 + 2e6; const double pi = acos(-1.0); int di[4] = {1, 0, -1, 0}, dj[4] = {0, 1, 0, -1}, DI[8] = {1, 1, 0, -1, -1, -1, 0, 1}, DJ[8] = {0, 1, 1, 1, 0, -1, -1, -1}; using namespace std; int n, ti = 1, timein[NN], timeout[NN], l... |
module reversed_gate (clk, ctrl, din, sel, dout);
input clk;
input [4:0] ctrl;
input [15:0] din;
input [3:0] sel;
output reg [31:0] dout;
always @(posedge clk)
case ((({(32)-((ctrl)*(sel))})+(1))-(2))
0:
dout[1:0] <= din;
1:
dout[2:1] <= din;
2:
do... |
/**
* 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 = 110; int N; struct notlaptop { int speed, ram, hdd, cost; notlaptop(int a, int b, int c, int d) { speed = a; ram = b; hdd = c; cost = d; } notlaptop()<% %> }; notlaptop ar[MAXN]; int main() { scanf( ... |
// ----------------------------------------------------------------------
// 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; int main() { long long int n, a, b, c, d, e, f, g, h; cin >> n; vector<long long int> values(n), kalues(n), malues; for (int i = 0; i < n; i++) { cin >> values[i]; cin >> kalues[i]; kalues[i]--; malues.push_back(values[i]); ... |
#include <bits/stdc++.h> using namespace std; long long n, a = 0; int main() { cin >> n; n = abs(n); while ((a * (a + 1)) / 2 < n || ((a * (a + 1)) / 2) % 2 != n % 2) a++; cout << a; return 0; } |
/*
* Milkymist VJ SoC fjmem flasher
* Copyright (C) 2010 Michael Walle <>
*
* 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 in t... |
/*
* 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, a[303], flipped[303]; int query(int l, int r) { cout << ? << l << << r << endl; cin >> l; fflush(stdin); return l; } void flip(int l, int r) { for (int i = l; i < r + 1; i++) { flipped[i] ^= 1; } } void sol(int l,... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000000; const long long INFLL = INF * INF; long long pot2[100]; vector<long long> czek_all(long long l, long long r, long long k) { vector<long long> wynik; long long x = r - l + 1; long long res = INFLL; for (int i = (1);... |
#include <bits/stdc++.h> using namespace std; template <class T> bool setmax(T &_a, T _b) { if (_b > _a) { _a = _b; return true; } return false; } template <class T> bool setmin(T &_a, T _b) { if (_b < _a) { _a = _b; return true; } return false; } template... |
// The four D flip-flops (DFFs) in a Cyclone V/10GX Adaptive Logic Module (ALM)
// act as one-bit memory cells that can be placed very flexibly (wherever there's
// an ALM); each flop is represented by a MISTRAL_FF cell.
//
// The flops in these chips are rather flexible in some ways, but in practice
// quite crippled ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cout.tie(0), cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin >> n >> m; vector<string> ar(n); long long cnt = 0; vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0)); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.