text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> long long p[16]; void F() { p[1] = 10; for (int i = 2; i <= 14; i++) p[i] = p[i - 1] * 10; } using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); F(); long long n, ans = 0; cin >> n; if (n < 10) { cout << 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> #pragma GCC target( sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx ) using namespace std; const int mod = 1e9 + 7; const int N = 2e5 + 4; int a[N], v[N], s[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, k; cin >> n >> m >> k; for (i... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; int n, howMany[N]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> n; vector<pair<int, int> > beacons; for (int i = 0; i < n; i++) { int x, p; cin >> x >> p; beacons.push_back({x, p}); }... |
/* Verilog for cell 'FTC{sch}' from library 'wordlib8' */
/* Created on Fri Oct 25, 2013 21:56:14 */
/* Last revised on Fri Oct 25, 2013 22:27:32 */
/* Written on Tue Oct 29, 2013 15:50:09 by Electric VLSI Design System, version 8.06 */
module muddlib07__a2o1_1x(a, b, c, y);
input a;
input b;
input c;
output y... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; bool visited[100005]; vector<long long> arr[100005]; int main() { std::ios::sync_with_stdio(false); long long n, x; cin >> n; vector<pair<long long, long long> > ans; for (long long i = 0; i < n; i++) { cin >> x; arr[x].push_back(i); ... |
// bsg_rp_clk_gen_coarse_delay_element
//
// (o is inverting on even start_tap_p
// worst_o is non-inverting)
//
// o contains controllably delayed signal
// worst_o contains worst-case delayed signal (for delay matching)
//
//
// we use sed to substitute parameters because the netlist reader
// does not... |
/*
* Copyright (c) 2000 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 1986-2014 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2014.2 (win64) Build 928826 Thu Jun 5 18:21:07 MDT 2014
//Date : Tue Jan 27 10:02:38 2015
//Host : Dtysky running 64-bit major release (buil... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/versclibs/data/simprims/LUT6.v,v 1.11 2007/06/05 00:00:54 yanx Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
/////////////////////////////////////////////////////... |
/*
Copyright 2015, Google 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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, r; cin >> n >> r; vector<double> a(1 << n); double sum = 0, div = (double)(1 << n); for (int i = 0; i < (1 << n); i++) { int x; cin >> x; a[i] = (double)x; s... |
`define ADDER_WIDTH 096
`define DUMMY_WIDTH 128
`define 3_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 9; int arr[maxn], ar[maxn]; int main() { int a, b, c, d, e, f, g, h; while (cin >> a) { cin >> e >> f; for (int i = 1; i <= a; i++) { cin >> arr[i]; } for (int i = 1; i <= a; i++) { cin >> ar[i];... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { string ch, t; int n, s, i; bool ok1 = 0, ok2 = 0; scanf( %d %d , &n, &s); if (9 * n >= s) { if (n == 1 && s == 0) { cout << 0 << << 0 << endl; } else if (s == 0) { cout << -1 << << -1 << endl; } ... |
`timescale 1ns / 1ps
module select_efect(
input [6:0]efect,
output reg efect0,
output reg efect1,
output reg efect2,
output reg efect3,
output reg efect4,
output reg efect5 /*output efect6,*/
);
always @(efect) begin
case(efect)
7'd48: begin
efect0 =1'b1;
ef... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e3 + 10, oo = maxn; int n, m; char s[maxn], t[maxn]; int a[maxn]; int dp[maxn][maxn]; void myMax(int &a, int b) { if (a < b) { a = b; } } int main() { int i, j, k, x, y; scanf( %s , s + 1); n = strlen(s + 1); ... |
#include <bits/stdc++.h> using namespace std; string s; bool check(long long l, long long r) { for (long long i = l; i < (r + l) / 2; i++) { if (s[i] != s[r - i - 1]) { return false; } } return true; } long long sulganlox(long long l, long long r) { if (r - l == 1) { ... |
module buf_manage(
input clk,
input reset,
//cut pkt
input pkt_metadata_cut_out_valid,
input [359:0] pkt_metadata_cut_out,
input [138:0] pkt_cut_data,
input pkt_cut_data_valid,
output [7:0] pkt_cut_data_usedw,
input [10:0] ram_rd_addr,
input ram_rd,
output [138... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_ASSERT_ON
wire xzcheck_enable;
`ifdef OVL_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
assign xzcheck_... |
#include <bits/stdc++.h> using namespace std; int main() { int b, l, k = 0, p, m; cin >> b >> l; int n[l]; for (int i = 0; i < l; i++) { n[i] = 0; } for (int i = 0; i < b; i++) { cin >> p; for (int j = 0; j < p; j++) { cin >> m; n[m - 1]++; } } ... |
#include <bits/stdc++.h> using namespace std; long long int trash = 0; long long int a[50], c[50]; long long int value2power[50]; long long int n, m; priority_queue<long long int> mainPQ; vector<long long int> queueArray; bool test(priority_queue<long long int> &PQ, long long int *b, long lo... |
`timescale 1ps / 1ps
/**
* ------------------------------------------------------------
* Copyright (c) SILAB , Physics Institute of Bonn University
* ------------------------------------------------------------
*/
`include "firmware/src/mmc3_eth_core.v"
`include "gpio/gpio.v"
`include "bram_fifo/bram_fifo.v"
`inc... |
#include <bits/stdc++.h> using namespace std; int n; int d[262144][4]; map<int, int> comp; int r[262144], R, pr[262144]; vector<int> vec; bool cmp(int a, int b) { return d[a][1] > d[b][1]; } struct BIT { int m[262144 * 2]; vector<int> v[262144]; void init() { int i; for (i = 0; i... |
#include <bits/stdc++.h> using namespace std; string s; int mynum(int x, int y) { int temp; stringstream ss; ss << (s.substr(x, y - x)); ss >> temp; if (temp > 1000000 || (y - x != 1 && s[x] == 0 ) || x == y) return -1; return temp; } int main() { int mx = -1, x, y, z; cin >> ... |
//altiobuf_out CBX_AUTO_BLACKBOX="ALL" CBX_SINGLE_OUTPUT_FILE="ON" DEVICE_FAMILY="Cyclone V" ENABLE_BUS_HOLD="FALSE" NUMBER_OF_CHANNELS=1 OPEN_DRAIN_OUTPUT="FALSE" PSEUDO_DIFFERENTIAL_MODE="TRUE" USE_DIFFERENTIAL_MODE="TRUE" USE_OE="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN1="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN2="FALSE" USE_TE... |
#include <bits/stdc++.h> using namespace std; const int MAX = 200005; map<int, int> Map; struct Node { int au, sub; } node[MAX]; int n, temp, m; int main() { cin >> n; for (int i = 1; i <= n; i++) { scanf( %d , &temp); Map[temp]++; } int m; scanf( %d , &m); for (int... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0; char ch = getchar(); bool f = 0; for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = 1; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return f ? -x : x; } void write(long long ... |
#include <bits/stdc++.h> using namespace std; int const N = int(2e5) + 7; int const mod = int(1e9) + 7; int a[N]; int ra[N], le[N]; int raB[N][31], leB[N][31]; int main() { ios_base::sync_with_stdio(false); ifstream in( input.txt ); int n; cin >> n; vector<int> st; for (int i = 1; ... |
#include <bits/stdc++.h> using namespace std; const int OO = INT_MAX; const int N = 2e5 + 2; const int MOD = 1e9 + 7; double ebs = 1e-6; const int INF = 0x3f3f3f3f; int in[N]; map<int, int> mp; int main() { ios::sync_with_stdio(0); int t; cin >> t; while (t--) { mp.clear(); ... |
#include <bits/stdc++.h> using namespace std; int dp[2][316 + 1][316 + 2]; int addmod(int x, int y) { int sum = x + y; if (sum >= 1000000007) sum -= 1000000007; return sum; } int mulmod(int x, int y, int p) { long long prod = x; prod = (prod * y) % p; return (int)prod; } void add_t... |
#include <bits/stdc++.h> using namespace std; using lli = long long int; int main() { int n; cin >> n; if (n == 2) { cout << 1 << endl << 1 << << 1 << endl; return 0; } else if (n == 3) { cout << 0 n2 1 2 n ; } else if (n == 4) { cout << 0 n2 1 4 n ; } else { ... |
/* sigma-delta modulator bench */
`timescale 1ns/10ps
`define CLK_HPER 17.8571
module sdm_tb();
// variables
reg clk;
real lsum=0, rsum=0;
real lmean=0, rmean=0;
reg [14:0] ldata_in;
reg [14:0] rdata_in;
wire ldata_out;
wire rdata_out;
// constants
real ifactor = 128;
integer steps = 4096;
// integrator function... |
#include <bits/stdc++.h> using namespace std; template <class T> void Read(T &x) { char c; bool f(0); while (c = getchar(), c != EOF) { if (c == - ) f = 1; else if (c >= 0 && c <= 9 ) { x = c - 0 ; while (c = getchar(), c >= 0 && c <= 9 ) x = x * 10 + c - 0... |
#include <bits/stdc++.h> using namespace std; int main() { int x, y; cin >> x >> y; int m = 0; while (x * 100 + y * 10 >= 220) { int kx, ky; if (m % 2 == 0) { kx = min(2, x); x -= kx; ky = (220 - 100 * kx) / 10; y -= ky; if (y < 0) break; } e... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long a, long b) { return ((a * b) / gcd(a, b)); } long long a[100000]; int main() { long long i, j, k, l, m, n, maxx = 0, g = 0; cin >> n; for (i = 0; i < n; i... |
#include <bits/stdc++.h> using namespace std; const int N = 1111; int n; string a[N], b[N]; int t[N]; int d; std::set<pair<string, string> > res; int main() { cin >> n >> d; for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> t[i]; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; ... |
#include <bits/stdc++.h> using namespace std; struct group { int sz; vector<int> worst, best; group(vector<int>& a) : sz(1), worst(a.begin(), a.end()), best(a.begin(), a.end()) {} bool operator<(const group& a) const { for (int i = 0; i < best.size(); i++) if (best[i] >= a.wors... |
// Copyright (C) 2013 Simon Que
//
// This file is part of DuinoCube.
//
// DuinoCube is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later ... |
#include <bits/stdc++.h> using namespace std; using namespace std; int main() { string s; cin >> s; vector<string> v(10); for (int i = 0; i < 10; i++) { cin >> v[i]; } string res = ; for (int i = 0; i <= 70; i += 10) { string find = s.substr(i, 10); for (int j = 0; ... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, m, K, w[N]; inline char nc() { static char buf[100000], *p1 = buf, *p2 = buf; if (p1 == p2) { p2 = (p1 = buf) + fread(buf, 1, 100000, stdin); if (p1 == p2) return EOF; } return *p1++; } inline void read(in... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const long long INF = 1e18; const int MAXN = 1e5 + 5; long long i, j, m, n, k, t, d; long long ans; long long x[MAXN]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> d; for (i ... |
#include <bits/stdc++.h> using namespace std; int V[102][102], M2[2][102]; int main() { int n, a; scanf( %d , &n); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { scanf( %d , &a); M2[0][i] += a; M2[1][j] += a; } int cnt = 0; for (int i = 0; i < n; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2005 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
// verilator lint_off BLKANDNBLK
// 3 3 4
reg [71:0] memw [2:0][1:3... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2005 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
wire [7:0] array [2:0][1:3];
integer cyc; initial cyc=0;
integer i0,i1,i2;
genva... |
#include<bits/stdc++.h> #define N 200100 #define ll long long using namespace std; const ll inf=9223372036854775807; ll n,m; ll T; ll a[N]; ll maxx=-inf; ll ans; ll anss; int main(){ cin>>T; while(T--){ ans=0; maxx=-inf; cin>>n; scanf( %lld ,&a[1]); for(int i=2;i<=n;i++)... |
#include <bits/stdc++.h> using namespace std; double xx[10], yy[10]; int main() { double px, py, vx, vy, a, b, c, d; cin >> px >> py >> vx >> vy >> a >> b >> c >> d; double x = vx / sqrt(vx * vx + vy * vy); double y = vy / sqrt(vx * vx + vy * vy); xx[1] = b * x + px; yy[1] = b * y + py; ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 1000000001; const long long LINF = 1000000000000000001LL; struct ConvexHullTrick { struct line { int a; long long b; long long eval(int x) { return (long long)a * x + b; } }; bool incrSlope,... |
//
// Copyright 2012 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; struct node { int u, v, w; } arr[300010]; bool cmp(node a, node b) { return (a.w < b.w); } int n, m; int f[300010], f2[300010]; int main() { scanf( %d , &n); ; scanf( %d , &m); ; for (int i = 0; i < m; i++) { scanf( %d , &arr[i].u... |
module PS_flops_EX_WB_alu (
in_wfid,
in_instr_pc,
in_vgpr_dest_addr,
in_sgpr_dest_addr,
in_instr_done,
in_vgpr_wr_en,
in_sgpr_wr_en,
in_vcc_wr_en,
out_wfid,
out_instr_pc,
out_vgpr_dest_addr,
out_sgpr_dest_addr,
out_instr_done,
out_vgpr_dest_wr_en,
out_sgpr_dest_wr_en,
out_vcc_wr_en,
clk,
rst
);
input... |
module ISP1362_IF( // HOST Side
iDATA,
oDATA,
iADDR,
iRD_N,
iWR_N,
iCS_N,
iRST_N,
iCLK,
oINT0_N,
oINT1_N,
// ISP1362 Side
OTG_DATA,
OTG_ADDR,
OTG_RD_N,
OTG_WR_N,
OTG_CS_N,
OTG_RST_N,
OTG_INT0,
OTG_INT1 );
... |
#include <bits/stdc++.h> int main() { int n, m, k; while (scanf( %d%d , &n, &m) != EOF) { int ans = n / m; k = n % m; for (int i = 1; i <= m; i++) { if (i <= m - k) { printf( %d , ans); } else { printf( %d , ans + 1); } if (i != m) { ... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; int n, k; double h; struct lms { int i, m, v; } a[100005]; int pos[100005]; inline int put(double t) { int ptr = 1; for (int i = 0; i < n; ++i) { if ((double)ptr <= t * a[i].v) { pos[ptr] = a[i].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... |
// sram.v
// This file was auto-generated as part of a generation operation.
// If you edit it your changes will probably be lost.
`timescale 1 ps / 1 ps
module sram (
input wire iCLK, // clk.clk
inout wire [15:0] SRAM_DQ, // avalon_slave_0_export.export
output wire [17:0] SRAM... |
module PushButton_Debouncer(
input clk,
input PB, // "PB" is the glitchy, asynchronous to clk, active low push-button signal
// from which we make three outputs, all synchronous to the clock
output reg PB_state, // 1 as long as the push-button is active (down)
output PB_down, // 1 for one clock ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int z = 0; z < t; z++) { int n; cin >> n; string s; cin >> s; bool found = false; for (int i = 0; i <= n - 11; i++) { if (s[i] == 8 ) { cout << YES << endl; ... |
#include <bits/stdc++.h> using namespace std; int x; void dfsUtil(int node, int count, bool visited[], int& maxCount, vector<vector<int> >& adj) { visited[node] = true; count++; for (auto& i : adj[node]) { if (!visited[i]) { if (count >= maxCount) { maxCount = co... |
#include<bits/stdc++.h> #define ls i<<1 #define rs i<<1|1 #define fi first #define se second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef vector<int> vct; typedef pair<int,int> pii; const int N=2E5+1; const int inf=1<<30; ll read() { ll a... |
`timescale 10ns/10ns
module alu_tb();
// Declare inputs as regs and outputs as wires
reg [15:0] x;
reg [15:0] y;
reg zx, nx, zy, ny, f, no;
wire [15:0] out;
wire zr, ng;
alu alu_DUT(
.x(x),
.y(y),
.zx(zx),
.nx(nx),
.zy(zy),
.ny(ny),
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, temp, i, x = 0, arr[100] = {0}; map<long long, long long> inx; cin >> n; for (i = 0; i < n; i++) { cin >> temp; inx[temp] = i; } for (map<long long int, long long int>::iterator it = inx.begin(); it != inx... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int a[maxn], b[maxn]; bool v[maxn]; int main() { int n; cin >> n; a[0] = -1; for (int i = 1; i <= n; ++i) { cin >> a[i]; v[a[i]] = 1; if (a[i] > a[i - 1]) b[i] = a[i - 1]; else b[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... |
//
// usb 3.0 data scrambling lfsr
//
// Copyright (C) 2009 OutputLogic.com
// This source file may be used and distributed without restriction
// provided that this copyright statement is not removed from the file
// and that any derivative work contains the original copyright notice
// and the associated disclaimer.... |
/*
* 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; class Graph { long long int v; list<pair<long long int, long long int>> *adj; public: Graph(long long int v) : v(v) { adj = new list<pair<long long int, long long int>>[v]; } void addEdge(long long int u, long long int v, long long int w,... |
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 5; char g1[N][N]; int dp1[N][N]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); int n = 0, m = 0, ans1 = 0; cin >> n >> m; for (int i = 1; i <= n; ++i) cin >> g1[i]; for (int i = 1; i <= n... |
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(NULL); ios::sync_with_stdio(false); long long int n, m, i, j, k, ans = 0; cin >> n >> m; long long int A[n], B[m]; string str(500, 0 ); for (i = 0; i < n; i++) cin >> A[i]; for (i = 0; i < m; i++) { cin >> k; ... |
`timescale 1ns/1ns
module Score_tb();
reg RESET;
reg [11:0] SCORE;
wire [6:0] DISP_SU;
wire [6:0] DISP_SD;
wire [6:0] DISP_SC;
wire [6:0] DISP_SM;
Score sc_tb(
.RESET(RESET),
.SCORE(SCORE),
.DISP_SU(DISP_SU),
.DISP_SD(DISP_SD),
.DISP_SC(DISP_SC),
.DISP_SM(DISP_SM)
);
initial begin
RESET=0;
SCORE=0;
$displ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> start(m); vector<int> ending(m); vector<int> time(m); vector<int> prize(m); int money = 0; for (int i = 0; i < m; i++) { cin >> start[i] >> ending[i] >> time[i] >> prize[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 (c) 2015-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 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Tue Sep 19 09:39:16 2017
// Host : DarkCube running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 50; char str[maxn]; int pre[30], now[30]; int l, r, len, cnt; void sov() { scanf( %s , str); len = strlen(str); cnt = 1; l = 0, r = 0; memset(now, 0, sizeof(now)); int i = 1; while (i < len) { if (str[i] =... |
`timescale 1ns / 1ps
//Test comparador de 32 bits con signo
module TestComparador;
reg [31:0] a;
reg [31:0] b;
wire lt;
wire gt;
wire eq;
Comparador uut(
.a(a),
.b(b),
.lt(lt),
.gt(gt),
.eq(eq)
);
initial begin
a = 32'b0;
... |
/**
* 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 "../src/fifo/fifo_fwft.v"
module fifo_fwft_tb # (
parameter depth_width = 4
);
localparam dw = 16;
reg clk = 1'b1;
reg rst = 1'b1;
always #10 clk <= ~clk;
initial #100 rst <= 0;
reg [dw-1:0] wr_data;
wire wr_en;
wire [dw-1:0] rd_data;
wire rd_en;
wire full;
wire ... |
`default_nettype none
`include "processor.h"
module interrupt_control(
//System
input wire iCLOCK,
input wire inRESET,
//Interrupt Configlation Table
input wire iICT_VALID,
input wire [5:0] iICT_ENTRY,
input wire iICT_CONF_MASK,
input wire iICT_CONF_VALID,
input wire [1:0] iICT_CONF_LEVEL,
//Core I... |
#include <bits/stdc++.h> using namespace std; string q; string d; int b; void f(string s, int p) { char a = 0; int c = 0; if (s.size() <= p) return; for (int i = p; i < s.size(); i++) { if (s[i] > a) { a = s[i]; b = i; c = 1; } else if (s[i] == a) { ... |
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { return x > 0 ? x : -x; } const string dom[2][7] = {{ ......... , ....O.... , O.......O , O...O...O , O.O...O.O , O.O.O.O.O , OOO...OOO }, { ......... , ....O.... , ... |
// Copyright (C) 2017-2020 The Project X-Ray Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier: ISC
`default_nettype none
`timescale 1ns / 1ps
`include "../src/error_counter.v"
... |
//
// calculate_countid module
//
// bv2.0_programmable
//
// Created by LiJunnan on 16/9/23.
// Copyright (c) 2016year LiJunnan. All rights reserved.
//
`timescale 1ns/1ps
module calculate_countid(
clk,
reset,
bv_in_valid,
bv_in,
countid_valid,
countid
);
parameter width_bv_and = 64;
parameter width_count = 6;
... |
// http://www.eg.bucknell.edu/~cs320/1995-fall/verilog-manual.html#RTFToC33
// Digital model of a traffic light
// By Dan Hyde August 10, 1995
module traffic;
parameter on = 1, off = 0, red_tics = 35,
amber_tics = 3, green_tics = 20;
reg clock, red, amber, green;
// will stop the simulation after 1000 time... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const double Pi = 3.1415926535897932; const int dir[4][2] = {-1, 0, 0, -1, 1, 0, 0, 1}; const int maxn = 1e4 + 5; struct EDGE { int a, b; int A, B; } edge[maxn]; int n, m; int last[maxn]; vector<int> G[maxn], tree[maxn];... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > score; map<pair<int, int>, int> freq; bool compare(const pair<int, int> a, const pair<int, int> b) { if (a.first == b.first) return a.second < b.second; return a.first > b.first; } void solve() { int n, k; cin >> n >> 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 law... |
module io1_sub (/*AUTOARG*/);
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire [w-1:0] pin; // To/From MD31_pad of autoinst_lopaz_srpad.v
wire [2*w-1:0] pin_in; // From MD31_pad of autoinst_lopaz_srpad.v, ...
wire templated; // To/From MD31_pad of a... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int T; cin >> T; while (T--) { long long int x, y, z; cin >> x >> y >> z; long long int ans = 0; if (x == y || x == z || y == z) { ... |
#include <bits/stdc++.h> using namespace std; int n, m, g[505][505], f[505][505], tot[505], ans[505][505]; int main() { scanf( %d%d , &n, &m); memset(g, 0x3f, sizeof(g)); memset(f, 0x3f, sizeof(f)); for (int i = 1; i <= n; i++) f[i][i] = 0; for (int i = 1; i <= m; i++) { int u, v, w; ... |
#include <bits/stdc++.h> using namespace std; template <typename T> T inverse(T a, T m) { T u = 0, v = 1; while (a != 0) { T t = m / a; m -= t * a; swap(a, m); u -= t * v; swap(u, v); } assert(m == 1); return u; } template <typename T> class Modular { pub... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 500; const long long INF = 1e9; const long long BITS = 64; const long double EPS = 1e-9; void bye() { cout << n ; exit(0); } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, len; char s[105]; cin >> s; len = strlen(s); for (i = 0; i < len; i++) { for (j = 0; j < len - i - 2; j += 2) { if (s[j] > s[j + 2]) { swap(s[j], s[j + 2]); } } } printf( %s , s); ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Muhammad Ijaz
//
// Create Date: 05/06/2017 08:43:21 AM
// Design Name:
// Module Name: MULTIPLEXER_2_TO_1
// Project Name: RISC-V
// Target Devices:
// Tool Versions:
... |
#include <bits/stdc++.h> using namespace std; int read(); int n; int a[200005], b[200005], c[200005], bk[200005]; int hd[200005], nx[400005], to[400005], cnt; void add(int f, int t) { nx[++cnt] = hd[f], hd[f] = cnt, to[cnt] = t; } int fa[200005], dep[200005]; void dfs1(int u) { for (int i = hd[u], v... |
/*
File: emesh_split.v
This file is part of the Parallella Project.
Copyright (C) 2014 Adapteva, Inc.
Contributed by Fred Huettig <>
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, e... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int x, long long int y) { if (y == 0) return x; return gcd(y, x % y); } long long exp(long long a, long long b) { if (b == 0) return 1; long long res = exp(a, b / 2); if (b % 2) return res * res * a; else ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.