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 la... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t, n; string s; cin >> t; while (t--) { cin >> n >> s; vector<int> szs; char prev = s.front(); int sz = 0; for (char c : s) { if (c != prev) { s... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; int nowarn; int n, m; namespace Tree { int head[MAXN], nxt[MAXN], to[MAXN], eidx; void init() { eidx = 0; memset(head, -1, sizeof(head)); } void adde(int u, int v) { to[eidx] = v, nxt[eidx] = head[u], head[u] = eidx++; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000007; int n, m; int fa[200010]; struct Line { int u, v, c; } l[200010]; int p[200010]; bool cmp(int x, int y) { return l[x].c < l[y].c; } bool intree[200010]; struct Edge { int v, id, nxt; } e[400010]; int tot; int fir... |
// vim:set shiftwidth=3 softtabstop=3 expandtab:
//
// Module: reg_grp.v
// Project: NetFPGA
// Description: Generic register group
//
// Muxes the registers for a group
//
// Note: The downstream modules should respect the rules for the number of
// cycles to hold ack high.
//
//////////////... |
#include <bits/stdc++.h> using namespace std; struct Problem { long long as, at, bs, bt; double pr; } a[2000]; const long long P = (long long)1e6; int n, m; long long fail[1001]; long long f[1001][1600]; double g[1001][1600]; bool cmp(Problem u, Problem v) { return u.bt * u.pr * (1 - v.pr)... |
/**
* 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
`include "Defintions.v"
module MiniAlu
(
input wire Clock,
input wire Reset,
output wire [7:0] oLed
);
wire [15:0] wIP,wIP_temp;
reg rWriteEnable,rBranchTaken;
wire [27:0] wInstruction;
wire [3:0] wOperation;
reg [15:0] rResult;
wire [7:0] wSourceAddr0,wSou... |
#include <bits/stdc++.h> using namespace std; int main() { int a[3][3], b[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cin >> a[i][j]; a[i][j] %= 2; b[i][j] = 0; } } pair<int, int> f[] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {0, 0}}; for (in... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/27 21:57:27
// Design Name:
// Module Name: Datapath_with_mux_adder_register_memory
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 1; void solve() { long long int n, x, ans = 1, p = -1, q = -1, c; cin >> n; set<long long int> s; long long int a[n]; for (long long int i = 0; i < n; i++) cin >> a[i], s.insert(a[i]); for (long long int i = 0; i < n; i++) {... |
`timescale 1ns/10ps
/**
* `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 base for each unit, ranging from seconds
* to femtoseconds, and must be:... |
#include <bits/stdc++.h> using namespace std; long long add(long long x, long long y) { x += y; while (x >= 998244353) x -= 998244353; while (x < 0) x += 998244353; return x; } long long mul(long long x, long long y) { return (x * 1ll * y) % 998244353; } long long binpow(long long x, long long... |
#include <bits/stdc++.h> using namespace std; template <typename S, typename T> inline bool smin(S &l, T r) { return r < l ? l = r, 1 : 0; } template <typename S, typename T> inline bool smax(S &l, T r) { return l < r ? l = r, 1 : 0; } constexpr int MOD = 1e9 + 7; template <typename S> inlin... |
/*
* 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; vector<int> e[200005], E[200005], v; int vis[200005]; inline void dfs(int u) { if (vis[u]) return; vis[u] = 1; v.push_back(u); int x = E[u][0], y = E[u][1]; if (e[x][0] == e[u][0] || e[x][0] == e[u][1] || e[x][1] == e[u][1] || e[x][1] == ... |
`timescale 1ns/10ps
/**
* `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 base for each unit, ranging from seconds
* to femtoseconds, and must be:... |
/**
* 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... |
/*!
btcminer -- BTCMiner for ZTEX USB-FPGA Modules: HDL code for ZTEX USB-FPGA Module 1.15b (one double hash pipe)
Copyright (C) 2011-2012 ZTEX GmbH
http://www.ztex.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
... |
#include <bits/stdc++.h> using namespace std; int n, t[100005]; int l1, l2; int dp[100005]; int main() { scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , &t[i]); l1 = 1; l2 = 1; for (int i = 1; i <= n; ++i) { while (t[i] - t[l1] > 89) ++l1; while (t[i] - t[l2] > 1439) ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector ) #pragma GCC target( sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( fast-math ) using namespace std; const int INF = 1e9 + 9; const long long MAXN = 5e... |
#include <bits/stdc++.h> using namespace std; int dist[2005][2005]; char f[2005][2005]; int n, m, r, c, x, y; int main() { scanf( %d%d%d%d%d%d , &n, &m, &r, &c, &x, &y); x = min(x, 10000000); y = min(y, 10000000); r--; c--; for (int i = 0; i < n; i++) scanf( %s , &f[i]); for (int 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; const int N = 2005, M = 200005; struct node { int x, y; } d[N]; int h, w, n, mod = 1e9 + 7; long long c[M] = {1, 1}, inv[M] = {1, 1}, ni[M] = {1, 1}, f[N]; long long quick_mod(long long a, long long b) { long long ans = 1; while (b) { if (b &... |
`timescale 10ns/100ps
module testbench;
// Net declarations
wire [15:0] dat_o;
wire [15:0] mem_dat_i, io_dat_i, dat_i;
wire [19:1] adr;
wire we;
wire tga;
wire [ 1:0] sel;
wire stb;
wire cyc;
wire ack, mem_ack, io_ack;
wire inta;
reg clk;
re... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int n; int fn[200005] = {}; int a, b, c; vector<string> st(t); for (int j = 0; j < t; j++) { cin >> n; int rn[n]; for (int i = 0; i < n; i++) { cin >> rn[i]; fn[rn[i]] = i + 1; ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e9 + 7; const long long INF = 1e18 + 5; const long long maxn = 5e5 + 5; long long n = 100000000000, a[1555555], d[555555], mx = -1000000001; long long u[1511111], b[1100005], sum, cnt, t[555555]; long long bi(long long x, long long y) { ... |
// File: JohnsonCount3_TBV.v
// Generated by MyHDL 0.10
// Date: Wed Sep 5 07:53:06 2018
`timescale 1ns/10ps
module JohnsonCount3_TBV (
);
// myHDL -> Verilog Testbench for `UpDown_Counter` module
reg clk = 0;
reg rst = 0;
wire [3:0] q;
reg [1:0] Dir = 2'b10;
reg [3:0] JohnsonCount30_0_q_i = 0;
always @(rst, ... |
#include <bits/stdc++.h> using namespace std; bool chmin(int64_t& a, const int64_t& b) { return b < a ? a = b, 1 : 0; } bool chmax(int64_t& a, const int64_t& b) { return a < b ? a = b, 1 : 0; } constexpr int pct(int x) { return __builtin_popcount(x); } constexpr int bits(int x) { return 31 - __builtin_clz(x);... |
#include <bits/stdc++.h> using namespace std; int main() { int number_of_players; cin >> number_of_players; int old_bid, counter; for (counter = 0; counter < number_of_players; counter++) { int bid; cin >> bid; while (bid % 2 == 0) bid /= 2; while (bid % 3 == 0) bid /= 3; ... |
/**
* 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: altera_tse_xcvr_resync
//
// Description:
// A general purpose resynchronization module.
//
// Parameters:
// SYNC_CHAIN_LENGTH
// - Specifies the length of the synchronizer chain for metastability
// retiming.
// WIDTH
// - Specifies the number of bits you want to synchr... |
#include <bits/stdc++.h> #pragma optimization_level 3 #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math,O3 ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx ) using namespace std; const long double PI = 3.14159265358979323846; const long long mod = 1e+9 + 7; const int I... |
// (c) Copyright 1995-2016 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 ... |
/*
* 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; char str[10000]; int n, m, Q; map<string, int> mem; map<string, int>::iterator iter; struct Func { string name; int num; int v[10]; bool operator==(const Func& A) const { if (name != A.name) return false; if (num != A.num) return fals... |
module debounce_pulse(input wire clk,
input wire sw_in,
output wire sw_out);
//------------------------------
//-- CONTROLLER
//------------------------------
//-- fsm states
localparam IDLE = 0; //-- Idle state. Button not pressed
localparam WAIT_1 = 1; //-- Waiting for the st... |
#include <bits/stdc++.h> const int oo = 0x3f3f3f3f; template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; } template <typename T> inline bool chkmin(T &a, T b) { return a > b ? a = b, true : false; } template <typename T> T read(T &first) { int f = 1; ... |
`timescale 1 ns / 1 ps
module multiply_accumulate_behavioural #
(
// signal width definitions
parameter integer DATA_WIDTH = 16,
parameter integer COEFFICIENT_WIDTH = 16,
parameter integer CARRY_WIDTH = 48,
parameter integer OUTPUT_OFFSET = 0,
// operation definitions
parameter integer DAT... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
// Design of the pipe
module pipeline_buffer (in,out,clock,reset);
// Output signal for the design module
output out; // Output data signal
// Input signals for the design module
input in; // Input data signal
input clock; // Input clo... |
/**
* 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; char s[200005], s1[200005]; void sol() { int i, l, xp; l = strlen(s); memset(s1, 0, sizeof(s1)); xp = -1; for (i = 0; i < l; i++) { if (xp == -1) { xp++; s1[xp] = s[i]; continue; } if (s1[xp] == s[i]) ... |
#include <bits/stdc++.h> using namespace std; int num[300005][2]; int jichu = 100000; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m, x; cin >> n >> m; if (n == 1) { cout << 0 << endl; return 0; } long long cont = 0, sum = n; for (int ... |
/*
Basic fifo
Copyright 2005, Timothy Miller
Updated 2012 by Per Lenander & Anton Fosselius (ORSoC)
- basic fifo is no longer of a fixed depth
This file is part of orgfx.
orgfx is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as publi... |
#include <bits/stdc++.h> using namespace std; long long n; int main() { cin >> n; if (n == 1) cout << -1; else cout << n << << n + 1 << << n * (n + 1); return 0; } |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; long long a[n]; for (long long i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); long long moves = 0; for (long long i = 0; i < n; i++) { if (a[i] < 1) { moves = moves + (i + 1) ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 41; const int MASK = 1 << 21; long long sz[MAX_N], par[MAX_N], po2[MAX_N], vis[MAX_N]; long long dp[MASK]; vector<int> adj[MAX_N]; int rt(int v) { return v ^ par[v] ? par[v] = rt(par[v]) : v; } void join(int u, int v) { if ((u = rt(u)) ... |
#include <bits/stdc++.h> using namespace std; int x, q; vector<int> adj[205]; bool visited[205]; void dfs(int n) { visited[n] = 1; for (int i = 0; i < adj[n].size(); i++) { if (!visited[adj[n][i]]) { visited[adj[n][i]] = 1; dfs(adj[n][i]); } } } int main() { int... |
#include <bits/stdc++.h> using namespace std; long long inf = 2e18; long long mod = 1e6; const long long M = 1e5; string s; long long a[M]; long long bmm(long long a, long long b) { if (b == 0) return a; return bmm(b, a % b); } int main() { long long n; cin >> n; string s = ; ... |
/*
* pll_led.v: Example program working in simulation as well as on real hardware. Tested on Digilent Basys 3.
* author: Till Mahlburg
* year: 2019
* organization: Universität Leipzig
* license: ISC
*
*/
`timescale 1 ns / 1 ps
module pll_led #(
parameter FF_NUM = 25) (
input clk,
input RST,
output [6:0] l... |
//////////////////////////////////////////////////////////////////////////////////
// DCFIFO_64x16_DR for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free software; y... |
#include <bits/stdc++.h> using namespace std; char z[500005]; int Qs1[500005], b, Qs2[500005]; int f(char a) { if (a == w ) return b + 1; return 1; } int main() { int i, j, n, a, t, Max = 0; int *qs2 = Qs2 + 1, *qs1 = Qs1 + 1; scanf( %d %d %d %d , &n, &a, &b, &t); gets(z); qs1[... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200100; struct seat { int w, id; bool operator<(const seat& st) const { return w < st.w; } bool operator>(const seat& st) const { return w > st.w; } }; seat st[maxn]; int n; char tp[maxn * 2]; int main() { while (scanf( %d , ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; long long ans = 0; for (int i = (0); i < (n); ++i) { long long t, T, x, cost; cin >> t >> T >> x >> cost; if (t >= T) { ans += cost + m * x; continue; } long long aux1 = ... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, i, a1, b1, y, y1, ans, ans1, ans2, x; cin >> n >> a >> b; for (i = 1; i <= n; i++) { cin >> x; y = x * a; ans = y % b; if (a != 0) cout << ans / a << ; else cout << x << ; ... |
///////////////////////////////////////////////////////////////////////////////
//
// Project: Aurora Module Generator version 2.8
//
// Date: $Date: 2007/09/28 12:50:35 $
// Tag: $Name: i+HEAD+134158 $
// File: $RCSfile: global_logic.ejava,v $
// Rev: $Revision: 1.2 $
//
// ... |
// Check behaviour with out-of-range and undefined array indices
// on LHS of continuous assignment.
`ifdef __ICARUS__
`define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
`define SUPPORT_REAL_NETS_IN_IVTEST
`endif
module top;
wire [1:0] array1[2:1];
wire [1:0] array2[1:0];
`ifdef SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
a... |
#include <bits/stdc++.h> const int MAXN = 2000 + 10; int n; char s[MAXN]; struct Bitset { static const int SIZE = 2048 / 64; unsigned long long a[SIZE]; int cnt; int high; Bitset() { memset(a, 0, sizeof a); cnt = 0; high = 0; } inline bool at(int x) { return (a[x >>... |
#include <bits/stdc++.h> using namespace std; long long fa[400005], iv[400005]; pair<long long, long long> p[2005]; long long dp[2005]; long long pw(long long bs, long long x) { long long ans = 1; while (x) { if (x & 1) ans = ans * bs % 1000000007; bs = bs * bs % 1000000007; x /= 2; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int n, m; int low[maxn], dfn[maxn], v[maxn << 1], A[maxn]; int nxt[maxn << 1], head[maxn], belong[maxn], a[maxn], vis[maxn << 1]; stack<int> s; int indexs = 0, cnt = 0; int ans = 0; void add_edge(int x, int y) { static int N = ... |
#include <bits/stdc++.h> using namespace std; int n, dad[200000 + 1], u[200000 + 1], v[200000 + 1]; long long w[200000], pop[200000], initsum, S; std::vector<int> adjl[200000 + 1]; int cnode(int node, int ed) { return node ^ u[ed] ^ v[ed]; } void dfs(int u) { int isleaf = 1; if (u != 1) pop[dad[u]] ... |
/*
* 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, t1, p; int b[200000], h[200000]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> b[i]; if (!b[i]) { --i; --n; } } for (int i = 0; i < n; i++) { cin >> h[i]; if (h[i] == b[0]) p = i; ... |
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
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, mo... |
#include <bits/stdc++.h> using namespace std; int a[201][201] = {0}; int n, m; int main(int argc, char *argv[]) { int x = 100; int y = 100; int ok = 0; cin >> n >> m; a[x][y] = n; do { ok = 0; int max = y; int min = x; for (int i = x; i <= y; i++) for (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 main() { std::ios_base::sync_with_stdio(false); float dist, h, w, t; cin >> dist; cin >> h; cin >> w; t = dist / (h + w); printf( %.12lf n , t * h); return 0; } |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 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 distri... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000500; typedef struct treap *ptreap; struct treap { int v, c, y; ptreap l, r; treap() {} treap(int v) : v(v), c(1), y(rand()), l(0), r(0) {} }; int cnt(ptreap t) { return t ? t->c : 0; } void recalc(ptreap t) { if (t) t->... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; const int inf = 1e9 + 7; long long minv[1 << 16]; long long numx[15], numy[15]; long long n, a[maxn], x, y, A, B, facy[15000], ans; inline long long read() { char ch = getchar(); long long u = 0, f = 1; while (!isdigit(ch)... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int k; cin >> k; int days[14]; int ones = 0; for (int i = 0; i < 7; i++) { cin >> days[i]; if (days[i]) ones++; days[i + 7] = days[i]; } int ans = 0... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, t, dp[20][4][4][11][11]; int main() { scanf( %d%d , &n, &t); memset(dp, 0, sizeof(dp)); for (int i = 0; i != 4; ++i) for (int j = 0; j != 4; ++j) dp[1][i][j][0][0] = i != j; for (int i = 2; i != n; ++i) for (int j = 0; j != 4; ++j) ... |
/*
* Module for performing other ALU operations
* Copyright (C) 2008-2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software
* ... |
#include <bits/stdc++.h> using namespace std; long long n; long long s(long long x) { long long ans = 0; while (x) ans += x % 10, x /= 10; return ans; } long long solve(long long x) { return x * x + s(x) * x - n; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
genvar g;
integer i;
reg [31:0] v;
reg [31:0] gen_pre_PLUSPLUS... |
module peripheral_spi_master(clk , rst , d_in , cs , addr , rd , wr, d_out,mosi ,miso, sck, ss);
//entradas y salidas j1
input clk;
input rst;
input [15:0]d_in;
input cs;
input [3:0]addr; // 4 LSB from j1_io_addr
input rd;
input wr;
output reg [15:0]d_out;
input miso;
output mosi, ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; const int M = N * 30; int tree[M][2]; vector<int> val[M]; int main() { int n; scanf( %d , &n); vector<int> a(n + 1); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); int idx = 0; auto insert = [&](int n, int id) { ... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.length(), cur = 1, best = 1; s += s; for (size_t i = 1; i < s.size(); i++) if (s[i] != s[i - 1]) cur++; else { best = max(best, cur); cur = 1; } best = max(best,... |
#include <bits/stdc++.h> using namespace std; const int N = 105, INF = 1 << 30, MOD = 1e9 + 7; int n, k; vector<int> adj[N]; long long cnt[N][N]; long long ans = 0, F[N]; long long sumOfProducts(vector<int>& arr, int n, int k) { long long dp[n + 1][n + 1]; memset(dp, 0, sizeof(dp)); long long ... |
#include <bits/stdc++.h> using namespace std; void prime(long long int n, set<long long int> &s) { if (n % 2 == 0) { s.insert(2); n /= 2; } while (n % 2 == 0) { n /= 2; } for (int i = 3; i <= sqrt(n); i += 2) { if (n % i == 0) { s.insert(i); n /= i; ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; const int RLEN = 1 << 18 | 1; inline char nc() { static char ibuf[RLEN], *ib, *ob; (ib == ob) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin)); return (ib == ob) ? -1 : *ib++; } inline int rd() { char ch = nc(); int i = 0, f = 1; while (... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
class Cls;
static task static_task(int x);
$write("Called static task: %d\n", x);
if (x !=... |
#include <bits/stdc++.h> using namespace std; bool flag = false; long long n; long long mat[1000][1000]; bool vis[1000][1000]; long long ans[1000][1000]; bool isSol() { long long s = 0; for (int i = 0; i < n; i++) { s += ans[i][i]; } long long s2 = 0; for (int i = 0; i < n; i++) ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx ) using namespace std; const long long mod = 998244353; long long binpow(long long a, long long n) { if (n == 0) return 1; if (n % 2 == 1) { return (binpow(a, n - 1) * a) % mod; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:33:17 05/25/2015
// Design Name: OneShot
// Module Name: C:/Users/dagosttv.ROSE-HULMAN/Documents/School/ECE/ECE398/CAN-Bus-Controller-/One-ShotTest.v
// Project Na... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-7; const int inf = 1e8; int main() { int n, sum = 0; cin >> n; vector<int> in(n); for (int i = 0; i < n; i++) cin >> in[i]; for (int i = 0; i < n; i++) sum += in[i]; vector<int> used(n); ... |
/* Author: QAQAutoMaton Lang: C++ Code: F.cpp Mail: lk@qaq-am.com Blog: https://www.qaq-am.com/ */ #include<bits/stdc++.h> #define int long long #define debug(qaq...) fprintf(stderr,qaq) #define DEBUG printf( Passing [%s] in LINE %d n ,__FUNCTION__,__LINE__) #define Debug debug( Passing [%s] in LI... |
#include <bits/stdc++.h> using namespace std; long long calc2(long long a, long long b, long long c, long long ab, long long ac, long long bc, long long abc) { long long parts[] = {a - ab - ac + abc, b - ab - bc + abc, c - ac - bc + abc, ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module FX3_IF (
inout wire [31:0] fx3_bus,
inp... |
#include <bits/stdc++.h> using namespace std; long double F(int A, int B) { long double S = 1; for (int i = 0; i < B; i++) S = S * (A - i) / (i + 1); return S; } int main() { int N; scanf( %d , &N); static int C[100000], Max[100000]; static long double P[100000][101]; memset(P, 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... |
/**
* 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
// width = 32
// depth = 256
// depth_log2 = 8
// is_async_fifo = 0
// is_sync_read = 1
// is_read_without_pop = 0
// is_multi_pop = 0
// is_write_commit = 0
// is_flush = 1
module fifo (
din
, write_busy
, fifo_full
, dout
, read_busy
, fifo_empty
, fifo_clk
, rst_n
, fifo_flush
);
//INPUT ports... |
#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 * f; } c... |
#include <bits/stdc++.h> using namespace std; void dbg_out() { cerr << b b] n ; } template <typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << H << , ; dbg_out(T...); } void solve() { long double n; cin >> n; cout << fixed << setprecision(10); if (n == 2) ... |
`timescale 1 ns / 1 ps
module axis_fifo #
(
parameter integer S_AXIS_TDATA_WIDTH = 32,
parameter integer M_AXIS_TDATA_WIDTH = 32
)
(
// System signals
input wire aclk,
// Slave side
output wire s_axis_tready,
input wire [S_AXIS_TDATA_WIDTH-1:0] s_axis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.