text stringlengths 59 71.4k |
|---|
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's register file read operands mux ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; bool m[1001][1001]; bool ff[1001][1001]; int n, num; int ans; int main() { cin >> n >> num; for (int i = 1; i <= n; i++) for (int j = i + 1; j <= i + num; j++) if (!m[i][(j - 1) % n + 1]) { m[i][(j - 1) % n + 1] = true; ... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.0
// Ultra-Embedded.com
// Copyright 2011 - 2013
//
// Email:
//
// ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)1e9 + 7; const long long N = (long long)1e5 * 4; const long long INF = (long long)1e18; const double eps = (double)1e-6; string s; vector<long long> v; signed main() { ios_base::sync_with_stdio(false); cin.tie(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> int main() { srand(1598743157); int v[4]; for (int i = 0; i < 4; i++) scanf( %d , &v[i]); while (v[0] != 1 || v[1] != 1 || v[2] != 1 || v[3] != 1) { bool ok = true; bool was = false; while (ok) { ok = false; for (int i = 0; i < 4; 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 n, m, a[4], num, sum; string s[4], str; bool check(char ch) { return ch == a || ch == e || ch == i || ch == o || ch == u ; } int work() { sum = 0; for (int i = str.length() - 1; i >= 0; i--) { sum += check(str[i]); if (sum ==... |
/* Line buffer producing a window of inputs.
*
* Copyright (c) 2016, Stephen Longfield, stephenlongfield.com
*
* 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 ... |
/**
* 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; vector<int> v1[3010], v2[3010]; int dista[3010][3010], distb[3010][3010]; pair<int, int> besta[3010][3], bestb[3010][3]; int n, m; void dijkstra(int x) { for (int i = 1; i <= n; i++) dista[x][i] = 1000000009; dista[x][x] = 0; priority_queue<pair<int,... |
// Experiment about implementing of a 100% asynchronous "AND" function between
// request signals
// THis is just a arbitrer with the equivalent of a call function
// where xor gates have been replaced by AND gates
// using arbitrer_r1_2ph
module and_r1_2ph (/*AUTOARG*/
// Outputs
a1, a2, r,
// Inputs
r1... |
//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... |
#include <bits/stdc++.h> using namespace std; using pil = pair<long long, long long>; using pii = pair<long long, long long>; using pid = pair<double, double>; long long mod = 1e9 + 7; long long power(long long a, long long n) { long long res = 1; while (n) { if (n % 2) res = (res * a) % mod; ... |
#include <bits/stdc++.h> using namespace std; static const int maxn = 3e5 + 5; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; multiset<int> ms; for (int i = 0; i < n; i++) { int x; cin >> x; ms.insert(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> using namespace std; int main() { int n, m, kol = 0, sum = 0, a; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> a; if (sum + a > m) { kol++; sum = a; } else sum += a; } cout << kol + 1; } |
#include <bits/stdc++.h> using namespace std; long long n, tmp, ans, curr; string s; deque<pair<long long, long long> > v; void add(long long val, long long pos) { while (v.front().first <= val) { curr -= v.front().first * (v[1].second - v.front().second); v.pop_front(); } v.push_front... |
#include <bits/stdc++.h> using namespace std; const long double EPS = 1e-9; const long double PI = atan(1) * 4; const long long M = 1000000007; struct PT { double x, y; PT() {} PT(double x, double y) : x(x), y(y) {} PT(const PT &p) : x(p.x), y(p.y) {} PT operator+(const PT &p) const { retu... |
#include <bits/stdc++.h> using namespace std; vector<long long> al[100001]; long long vis[100001]; long long no(long long num) { long long min = num % 10, max = num % 10; while (num > 0) { long long a = num % 10; num /= 10; if (min > a) min = a; if (max < a) max = a; } re... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; long long a[200000 + 5]; int main() { long long i, j, k, l; long long n, m; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; a[n] = 2000000009; long long maxn = 0; k = 0; for (i = 1; i <= n; i++) { if (... |
#include <bits/stdc++.h> using namespace std; void showvec(vector<long long> &arr); inline void solve() { long long n; cin >> n; vector<long long> arr(n); for (long long i = 0; i < n; i++) { cin >> arr[i]; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout... |
#include <bits/stdc++.h> using namespace std; int tree[100010 << 2]; bool flag; struct node { int row, col, pos; friend bool operator<(node a, node b) { if (a.row == b.row) return a.col < b.col; return a.row < b.row; } }; node p[100010]; inline void pushUp(int rt) { tree[rt] = min(... |
#include <bits/stdc++.h> using namespace std; int main() { int pushes = 0; int buttons; cin >> buttons; for (int i = 1; i <= buttons; i++) { pushes += 1 + (i * (buttons - i)); } cout << pushes << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int N; vector<int> V; bool solve(int n); int main() { ios_base::sync_with_stdio(false); int i, st, dr, mid; cin >> N; V.resize(N); for (i = 0; i < N; ++i) { cin >> V[i]; } sort(V.begin(), V.end()); st = 1; dr = N; whil... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_bb
//
// Generated
// by: wig
// on: Fri Jul 15 16:37:11 2005
// cmd: h:/work/eclipse/mix/mix_0.pl -strip -nodelta ../../sigport.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// ... |
/***********************************************************************
WISHBONE miscellaneous timer
This file is part FPGA Libre project http://fpgalibre.sf.net/
Description:
Implements the micro and milliseconds timers. Also a CPU blocker,
used for small time delays.
This module also implements the 6 ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T& x) { x = 0; char c; while (!isdigit(c = getchar())) ; do { x = x * 10 + c - 0 ; } while (isdigit(c = getchar())); } template <typename T> inline void write(T x) { if (x > 9) write(x /... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int n = s.length(); int m; cin >> m; int b[m + 2]; for (int i = 1; i <= m; i++) { cin >> b[i]; } char ans[m + 2]; sort(s.begin... |
/*******************************************************************************
* *
* Copyright (C) 2009 Altera Corporation *
* ... |
// file: clk_wiz_0.v
//
// (c) Copyright 2008 - 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 property
// laws.
//
// DISCLAIMER
// This disclaimer is... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: dpram_2kx32.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================... |
#include <bits/stdc++.h> using namespace std; struct node { int x, y; node(int x1 = 0, int y1 = 0) : x(x1), y(y1){}; bool operator=(const node &b) const { return (x == b.x) && (y == b.y); } }; const int dx[5] = {0, 0, 0, 1, -1}; const int dy[5] = {0, 1, -1, 0, 0}; int N, M, Q; char maze[1007][... |
#include <bits/stdc++.h> using namespace std; bool vis[100001]; int pi[100001]; int level[100001]; list<int> adj[100001]; void dfs(int s) { vis[s] = 1; bool flag = 1; for (list<int>::iterator it = adj[s].begin(); it != adj[s].end(); ++it) if (!vis[*it]) { level[*it] = level[s] + 1;... |
#include <bits/stdc++.h> using namespace std; template <typename G> struct triple { G first, second, T; }; struct BIT { vector<int> v; BIT(int n) : v(n + 10) {} void upd(int p) { for (; p < v.size(); p += (p & (-p))) ++v[p]; } int query(int p) { int x = 0; for (; p > ... |
#include <bits/stdc++.h> using namespace std; bool sortmahstyle(const pair<int, int> &a, const pair<int, int> &b) { if (a.first == b.first && a.second < b.second) return true; return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n, m, d; cin >> n >>... |
`timescale 1ns / 1ps
// @input
// clk_src: input event detective
// switch_power: power on/off state switch
// switch_en: start/pause state switch
// sig_change: plus signal for sel_value
// @output
// sel_value
module selector_mode
#(parameter LO = 2, HI = 5, CLK_CH = 25)
(
input [31:0]clk,
input switch_power... |
module dds_gen(clk, key1, key2, da_clk, da_db);
input wire clk;
input wire key1;
input wire key2;
output wire da_clk;
output wire [7:0] da_db;
wire clk100M;
pll100M gen_100MHz(.inclk0(clk),
.c0(clk100M));
reg [31:0] dds_accum; initial dds_accum <= 32'd0;
reg [31:0] dds_adder; initial dds_adder <= 3... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n; cin >> n; if (n == 1) { cout << 0 << n ; continue; } long long int ans = 0; while (n != 1) { ans++; if (n % 2 == 0) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int o = 0; int z = 0; for (int i = 0; i < n; i++) { int y; cin >> y; if (y == 1) o++; else z++; } if (z... |
#include <bits/stdc++.h> using namespace std; const int MAX = 111, K = 26; int n; string name[MAX]; namespace G { struct V : vector<int> { V() : odw(false) {} bool odw; int wyj; }; V g[K]; void krawedz(char a, char b) { g[int(a) - int( a )].push_back(int(b) - int( a )); } int t = 0... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003-2007 by Wilson Snyder.
`define zednkw 200
module BreadAddrDP (zfghtn, cjtmau, vipmpg, knquim, kqxkkr);
input zfghtn;
input [4:0] cjtmau;
input vipmpg;
input [7:0] knquim;
input... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200 * 1000 + 5; pair<long long int, long long int> b[MAXN]; long long int dp[MAXN]; long long int rem[MAXN]; inline pair<long long int, long long int> cst(int x, int y) { long long int tt = ((b[x].first - rem[y] + b[y].second - 1) / b[y].sec... |
#include <bits/stdc++.h> using namespace std; const long long OO = (long long)1e9 + 7; using namespace std; long long inv(long long a, long long b) { return 1 < a ? b - inv(b % a, a) * b / a : 1; } long long Pow(long long B, long long P) { long long R = 1; while (P > 0) { if (P & 1) R = (R... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e4 + 100; int c[maxn], a[maxn]; int main() { int n, m, l = 0, ans = 0; cin >> n >> m; for (int i = 0; i < n; i++) cin >> c[i]; for (int i = 0; i < m; i++) cin >> a[i]; for (int i = 0; i < n; i++) if (a[l] >= c[i]) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int q, n, sum; cin >> q; while (q--) { cin >> n; int m = n; sum = 0; while (n--) { int x; cin >> x; sum += x; } double y = (double)sum / m; int rs = y; if (y == rs) { ... |
/*
* 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) 2016
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 in writing, software
distribute... |
#include <bits/stdc++.h> using namespace std; static const int N = 500005; long long l[N]; long long d[N]; char s[N]; int main() { int a, b, t, n; cin >> n >> a >> b >> t; scanf( %s , &s); l[0] = 1 + b * (s[0] == w ); for (int i = 1; i < n; i++) l[i] = 1 + l[i - 1] + a + b * (s[i] == w... |
#include <bits/stdc++.h> using namespace std; const int N = 510, mod = 1LL * 1000 * 1000 * 1000 + 7; int dp[N][N], n, b[N], num[N][N]; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> b[i]; for (int j = 1; j <= n; j++) for (int... |
#include <bits/stdc++.h> using namespace std; std::vector<std::string> alph; class IAlphabet { public: virtual int encode(char symbol) = 0; virtual char decode(int code) = 0; virtual int size() = 0; }; class alphabet_eng : public IAlphabet { public: virtual int encode(char symbol); v... |
// bsg_strobe
//
// N
// Outputs sequence ( 1 0 )* for 0 <= N=init_val_i <= (1<<width_p)-1
//
// init_val_i = # of cycles to count between asserting 1
// (e.g 0 means assert 1 continuously)
//
// One usage is clock downsampling.
//
// The paper "The Power of Carry-Save Addition" by L... |
`timescale 1ns / 1ps
//Sumador de 32 bits con signo.
/*
* Números de 32 bits donde, si a es número, entonces:
* a[31] : signo de a.
* a[30:10] : parte entera de a.
* a[9:0] : parte decimal de a.
*/
module Sumador(
input wire [31:0] a,
input wire [31:0] b,
output reg [31:0] Z,
output reg ovf
);
... |
#include <bits/stdc++.h> using namespace std; const int N = 1 << 21 | 1; int n, p[N]; long long a[N], b[N], c[N]; char s[N], t[N]; void OR(long long* a) { int i, j, u, v, l, t; for (i = 2; i <= n; i <<= 1) for (j = 0, t = i >> 1; j < n; j += i) for (u = j, v = l = j + t; u < l; ++u, ++... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time bas... |
#include <bits/stdc++.h> using namespace std; int k; long long s[16], sum; map<long long, int> id; vector<long long> v; bool vis[16]; bool dp[1 << 15]; vector<pair<int, int> > way[1 << 15]; int pre[1 << 15]; pair<int, int> ans[16]; int main() { scanf( %d , &k); for (int i = 0; i < k; i++) ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_rxstatem.v ////
//// ////
//// This file is part of the Ether... |
module controlunit(input [5:0] imemout,output brnch,output memorywrite,output memoryread,output alusrc,output regw,output regdst,output aluop,output memtoreg);
reg brnch,memorywrite,memoryread,aluop;
reg memtoreg,alusrc,regw,regdst;
always @ ( imemout )
begin
if(imemout[5:0] == 6'b000000)
begin
brnch = 1'b0;
mem... |
#include <bits/stdc++.h> using namespace std; int n, k, sx, ex; char s[1010]; int main() { scanf( %d%d%s , &n, &k, s); for (int i = 0; i < n; i++) { if (s[i] == G ) sx = i; if (s[i] == T ) ex = i; } if (sx > ex) swap(sx, ex); if ((ex - sx) % k != 0) printf( NO n ); el... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:59:24 11/29/2014
// Design Name:
// Module Name: multiplexor32a1
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies... |
/*
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; long long c; vector<int> a; int N; long long C[65][65]; long long nCk(long long n, long long k) { if (k > n) return 0; return C[n][k]; } long long f(int index, int onesNeeded, int tight) { if (index == N) { if (onesNeeded == 0) retu... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 1; const int MOD = 1e9 + 7; long long a[MAXN], b[MAXN]; bool used[MAXN]; vector<int> g[MAXN]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; long long n, m, cnt = 0, ans = 0; bool y = 0; cin >> ... |
`timescale 10ns/10ns
module test;
wire button;
reg clk;
/* camera signal generator */
reg href;
reg vsync;
reg pclk;
reg [7:0] data;
parameter Tline = 786 * 2;
reg spi_clk,
spi_mosi,
cs;
initial begin
forever begin
spi_clk = 0;
spi_mosi = 0;
cs = 1;
//start
#50 spi_mosi = 1;
#10 cs = 0;
#40 spi... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, i = 1; cin >> n >> k; while (~k & 1) k >>= 1, i++; cout << i; return 0; } |
#include <bits/stdc++.h> using namespace std; namespace IO { const int maxn(1 << 21 | 1); char *iS, *iT, ibuf[maxn], obuf[maxn], *oS = obuf, *oT = obuf + maxn - 1, c, st[20]; int f, tp, len; inline char getc() { return iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Tick Timer ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long N = 2e5 + 5; const double pi = acos(-1.0); long long addM(long long a, long long b) { return (a + b) % MOD; } long long multM(long long a, long long b) { return (a * b) % MOD; } long long binpow(long long a, long ... |
#include <bits/stdc++.h> using namespace std; int l, r, a; int main() { cin >> l >> r >> a; if (l > r) swap(l, r); if (l == r) return cout << (l + a / 2) * 2, 0; if (l < r) { if (l + a >= r) { a -= abs(l - r), l = r; cout << l * 2 + (a / 2) * 2; } else cout << (... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s1, s2; cin >> s1 >> s2; int a, b, c, d; a = s1[0] - 0 ; b = s1[1] - 0 ; c = s2[1] - 0 ; d = s2[0] - 0 ; vector<int> v1({a, b, c, d}); map<vector<int>, int> mp; mp[{a, b, c, d}] = 1... |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int k; int addk(int a,int b) { int base,aw,bw,ret=0; for(base=1;base<=max(a,b);base*=k) { aw=a/base%k; bw=b/base%k; ret+=(aw+bw)%k*base; } return ret; } int subk(int a,int b) { int base,aw,bw,ret=... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
`include "defines.v"
`timescale 1ns/1ps
module tb(
);
wire injrd, injack;
reg clk, rst;
reg `control_w flit0c;
reg `control_w flit1c;
wire `control_w port0_co, port1_co, port2_co, port3_co, port4_co;
brouter r(
.clk(clk),
.rst(rst),
.port0_ci(flit0... |
/*
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... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const int MOD = 1e9 + 7; int n, revfact[N << 1], fact[N << 1]; int mul(int, int); int sum(int, int); int pow(int, int); int choose(int, int); int32_t main() { cin >> n; fact[0] = 1; for (int i = 1; i < 2 * n + 3; i++) fa... |
#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); } long long lcm(long long a, long long b) { return (a / gcd(a, b) * b); } bool sorta(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second);... |
//
// xmtbuf.v -- serial line transmitter buffer
//
module xmtbuf(clk, reset, write, ready, data_in, serial_out);
input clk;
input reset;
input write;
output reg ready;
input [7:0] data_in;
output serial_out;
reg [1:0] state;
reg [7:0] data_hold;
reg load;
wire empty;
xmt xmt1(clk,... |
/**
* 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... |
module lvds2lcds (
// avalon-bus
input clk,
input reset,
input avs_slave_write,
input avs_slave_read,
input [7:0]avs_slave_writedata,
output [7:0]avs_slave_readdata,
// lvds2lcds
output reset_n,
output scl,
output sdi,
output sld
);... |
module encoder_test;
reg write_enable;
reg [31:0] my_data;//data to test: 0xe3a02001
reg [7:0] my_ecc;// ecc for this data: 0xf7
reg [39:0] bitflip_mask;
wire [31:0] input_data;
wire [7:0] input_ecc;
wire [31:0] output_data;
wire [7:0] ecc_syndrome;
wire uncorrected;
initial
begin
// Simulation test values.
my... |
#include <bits/stdc++.h> int main() { char s[51]; scanf( %s , s); int i, tf, na = 0, t1 = strlen(s); if (t1 >= 1 && t1 <= 50) { for (i = 0; i < t1; i++) { if (s[i] == a ) { na = na + 1; } } if (2 * na > t1) { tf = t1; } else { tf = (2 ... |
`timescale 1ns/100ps
module top;
reg in;
wire [3:0] vec;
wire [4:0] bvec;
wire real r_vec, r_arr, r_io;
initial in <= 1'b0;
// You cannot go to multiple real values (have multiple instances).
vec_to_real u1[1:0](r_vec, in);
// A real port cannot be used in an arrayed instance.
arr_real u2a[1:0](bve... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pi = pair<int, int>; using pl = pair<ll, ll>; using pld = pair<ld, ld>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using vld = vector<ld>; using vs = vector<string>; usi... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int i, n, t, p = INT_MAX, j = 0, x, a = 0, b, l = 0, r = 0, k = 0, e, w = 0; long long sum = 0; string s, m; cin >> n; int ara[n]; int ar[n... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; a[i] += i; } sort(a.begin(), a.end()); for (int i = 0; i < n; i++) { a[i] -= i; if (i && a[i] < a[i - 1]) { cout << :(... |
module butterfly_8(
enable,
i_0,
i_1,
i_2,
i_3,
i_4,
i_5,
i_6,
i_7,
o_0,
o_1,
o_2,
o_3,
... |
#include <bits/stdc++.h> using namespace std; int main(void) { int t; cin >> t; for (int z = 0; z < t; ++z) { int n; string s; cin >> n >> s; string ans = ; for (int i = 0; i < n; ++i) { if ((s[i] - 0 ) % 2 == 1) ans += s[i]; if (ans.size() == 2) break; ... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long Query(long long L, long long R) { cout << L << << R << endl; fflush(stdout); string s; cin >> s; if (L == R && s == Yes ) exit(0); return s == Yes ; } int3... |
#include <bits/stdc++.h> using namespace std; bool vis[105][105]; int main() { int n; scanf( %d , &n); int m; scanf( %d , &m); for (int i = 1; i <= m; i++) { int x; scanf( %d , &x); vis[1][x] = true; } for (int i = 2; i <= n; i++) { int m; scanf( %d , &m);... |
`timescale 1 ns / 1 ps
module READ_ROM32 ( input[4:0] ADDR ,output[31:0] DATA_RE,output[31:0] DATA_IM);
reg [31:0] re[0:31];
initial begin
re[0] = 32'h00000000;re[1] = 32'hFFE4CC88;re[2] = 32'h002DA5B3;re[3] = 32'hFFCE9932;
re[4] = 32'h00254173;re[5] = 32'hFFF2E19A;re[6] = 32'hFFF0C26D;re[7] = 32'h0026B1CD;
re[8] = 32... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double eps = 1e-12; const int inf = 2000000000; const long long int infLL = (long long int)1e18; long long int MOD = 1000000007; int MOD1 = 1000000007; int MOD2 = 1000000009; inline bool checkBit(long long int n, long long... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; string s; int x = 0, y = 0; cin >> s; for (int i = 0; i < t; i++) { if (s[i] == L ) { x--; } else { y++; } } cout << y - x + 1 << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (max((3 * a / 10), a - a / 250 * c) == max((3 * b / 10), b - b / 250 * d)) cout << Tie ; else if (max((3 * a / 10), a - a / 250 * c) > max((3 * b / 10), b - b / 250 * d)) ... |
#include <bits/stdc++.h> using namespace std; char ans[2000005]; vector<int> lis[2000005]; string Str[2000005]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int m = 0; for (int i = 0; i < n; i++) { string str; cin >> str; Str[i] = str... |
#include <bits/stdc++.h> using namespace std; char _; int num_rectangles; pair<pair<int, int>, pair<int, int> > rectangles[135000], pre[135000], suff[135000]; pair<pair<int, int>, pair<int, int> > intersection( pair<pair<int, int>, pair<int, int> > first, pair<pair<int, int>, pair<int, int> ... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_odd_parity (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
parameter property_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.