text stringlengths 59 71.4k |
|---|
/*
Copyright (c) 2017 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, distribute,... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if ((n == 1 && k > 0) || (k == 0 && n > 1) || k < n / 2) cout << -1; else if (k == 0) cout << 1; else { int x = k - (n - 2) / 2; cout << x << << x * 2 << ; for (int i = 1; i <... |
#include <bits/stdc++.h> using namespace std; int z[(int)1e6 + 3]; string z_algo(string s) { int x = 0, y = 0; int T = 0, M = (int)1e6 + 3; for (int i = 1; i < s.size(); i++) { z[i] = max(0, min(z[i - x], y - i + 1)); while (i + z[i] < s.size() && s[z[i]] == s[i + z[i]]) { x = i, y... |
#include <bits/stdc++.h> using namespace std; int t, a, b, c, ans, t1; int main() { scanf( %d , &t); while (t--) { scanf( %d%d%d , &a, &b, &c); ans = 0; t1 = c / 2; t1 = min(t1, b); ans += t1 * 3; b -= t1; t1 = b / 2; t1 = min(t1, a); ans += t1 * 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... |
#include <bits/stdc++.h> using namespace std; int ques[50005]; int ma[26]; int main() { string s; cin >> s; int i, j; memset(ques, 0, sizeof(ques)); int br = 1; for (i = 0; i < (s.size()); i++) { if (i != 0) ques[i] = ques[i] + ques[i - 1]; if (s[i] == ? ) ques[i] += 1; ... |
// phase_selector.v
`timescale 1 ns / 1 ps
module phase_selector
(
input CLK400,
input CLK80,
input reset,
input [3:0]phsel,
input [7:0]serin,
output serout
);
// --- expand fron 8 to 16 phases (serin -> ser) -------------------------
reg [7:0]serdel;
wire [15:0]ser = {serin, serdel};
... |
#include <bits/stdc++.h> using namespace std; long long n, x, f[101][101][101], g[101]; char s[101]; int main() { scanf( %I64d%I64d%s , &n, &x, s + 1); for (long long i = 1; i <= n; i++) f[s[i] - 0 ][i][i] = 1; g[0] = g[1] = 2; for (long long i = 2; i <= x; i++) g[i] = g[i - 1] * g[i - 2] % 100... |
/**
* 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; char inp[5]; void try_catch(long long int l, long long int r) { long long int mid = l + rand() % (r - l + 1); printf( %lld %lld n , mid, mid); fflush(stdout); scanf( %s , inp); if (inp[0] == Y ) exit(0); } int main() { srand(time(NULL)); ... |
`timescale 1ns / 1ps
module mux4to1_beh_1_tb;
// Inputs
reg [3:0] data_in;
reg [1:0] ctrl_sel;
// Outputs
wire data_out;
// Instantiate the Unit Under Test (UUT)
mux4to1_beh_1 uut (
.data_in(data_in),
.ctrl_sel(ctrl_sel),
.data_out(data_out)
);
task expect;
inpu... |
#include <bits/stdc++.h> using namespace std; int sc1() { int x; scanf( %d , &x); return x; } long long sc2() { long long x; scanf( %lld , &x); return x; } int bs; int n, q; int arr[100007]; int cnt[100007]; int ans = 0; int answer[100007]; struct A { int l, r, id; ... |
module Computer_Datapath_RegisterFile(
output reg [WORD_WIDTH-1:0] ADDR_bus_out,
output reg [WORD_WIDTH-1:0] B_data_out,
input [CNTRL_WIDTH-1:0] CNTRL_bus_in,
input [WORD_WIDTH-1:0] D_bus_in,
input CLK,
input RST
);
parameter WORD_WIDTH = 16;
parameter DR_WIDTH = 3;
parameter SB_WIDTH = DR_WIDTH;
parameter SA_W... |
#include <bits/stdc++.h> using namespace std; long long i, j, k, n, v[200010], m, a, b, x, y, h, w, l, p, ans, numitor, aux, mini, sum, poz; string s1, s2, second; char c; map<long long, long long> mip; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> x; for (long... |
/**
* 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; long long n, q, ans[50005], sum[50005], a[50005], p[50005], x[50005], cont, pos, us[50005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> q; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 2; i <= n; i++) cin >> p[i... |
// psi2c_control
`timescale 1 ps / 1 ps
/*
-- registers b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
-- 0 w: tbm go
-- 0 r: ful tbm run
-- 1 w: send raw ... |
#include <bits/stdc++.h> using namespace std; struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << ; return *this; } } dbg; void solve() { int n, m; cin >> n >> m; for (int i = 0; i < 200; i++) cout << 9 ; cout << endl; for (int i... |
// Automatically generated: write_netlist -wrapapp -verilog -module reconflogic-wrapadt7410.v
module MyReconfigLogic (
input Reset_n_i,
input Clk_i,
input AdcConvComplete_i,
output AdcDoConvert_o,
input[9:0] AdcValue_i,
input I2C_Busy_i,
output[7:0] I2C_DataIn_o,
input[7:0] I2C_DataOut_i,
output[15:0... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: arriagx_dmem.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===========================... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 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
... |
/*
* 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... |
//////////////////////////////////////////////////////////////////////////////////
// TimeCounter 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; you c... |
#include <bits/stdc++.h> using namespace std; int read() { int X = 0, w = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) w = -1; c = getchar(); } while (c >= 0 && c <= 9 ) X = X * 10 + c - 0 , c = getchar(); return X * w; } const int N = 125000 + 10; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; ++i) cin >> arr[i]; vector<bool> used(n, false); int count = 0; int marked = 0; while (marked < n) { int min = 101; for (int i = 0; i < n; ++i) { ... |
`include "cpu_data.v"
module Alu(single, value1, value2, operator, bus_out, alu_flags, alu_flags8, old_carry);
input single;
input [15:0] value1, value2;
input [3:0] operator;
input old_carry;
reg carry; wire overflow, zero, negative;
wire carry8, overflow8, zero8, negative8;
output [3:0] ... |
// This is a component of pluto_servo, a PWM servo driver and quadrature
// counter for emc2
// Copyright 2006 Jeff Epler <>
//
// 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 Foundatio... |
//-----------------------------------------------------------------
// RISC-V Top
// V0.6
// Ultra-Embedded.com
// Copyright 2014-2019
//
//
//
// License: BSD
//--------------------------... |
#include <bits/stdc++.h> using namespace std; int a[100010]; int main() { int T; cin >> T; while (T--) { int n, sum = 0; int z = 0; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; sum = sum + a[i]; if (a[i] == 0) { z++; } } ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a, n2 = 0, n1 = 0; for (int i = 0; i < n; i++) cin >> a, a - 1 ? n2++ : n1++; if (n2) cout << 2 << ; if (n1) cout << 1 << ; for (int i = 0; i < n2 - 1; ... |
#include <bits/stdc++.h> using namespace std; long long int mod = 1000000007; long long int store[2002][2002] = {0}; long long int ncrModp(long long int n, long long int r, long long int p) { long long int value[9999] = {0}; value[0] = 1; for (long long int e = 1; e <= n; e++) { store[e][0] = ... |
// DEFINES
`define BITS 8 // Bit width of the operands
`define B2TS 16 // Bit width of the operands
module bm_base_multiply(clock,
reset_n,
a_in,
b_in,
c_in,
d_in,
e_in,
f_in,
out0,
out2,
out3,
out4,
out1);
// SIGNAL DECLARATIONS
input clock;
input reset_n;
input [`BITS... |
// -- (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; template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); } template <class T> T max(T a, T b, T c) { return max(a, max(b, c)); } int r, c, k, n, a[15][15]; int main() { scanf( %d%d%d%d , &r, &c, &n, &k); for (int i = (1); i <= (n... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline T1 max(T1 a, T2 b) { return a < b ? b : a; } template <typename T1, typename T2> inline T1 min(T1 a, T2 b) { return a < b ? a : b; } const char lf = n ; namespace ae86 { const int bufl = 1 << 15; cha... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline T1 max(T1 a, T2 b) { return a < b ? b : a; } template <typename T1, typename T2> inline T1 min(T1 a, T2 b) { return a < b ? a : b; } const char lf = n ; namespace ae86 { const int bufl = 1 << 15; cha... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module fast_spi_rx_core
#(
parameter ABUSWIDTH =... |
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)2 * 1e9; const long long MOD = (long long)1e9 + 7; const long long P = 239; const long long MAX_N = 100000; const long long ABC = 26; const long double pi = 3.1415926535897932384626; const long double eps = 1e-6; int main()... |
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m; cin >> n >> m; vector<vector<int> > file(n); for (int i = (0); i < ((m)); ++i) { int tmp; cin >> tmp; vector<int> f(tmp); for (int j = (0); j < ((tmp)); ++j) cin >> f[j]; file.push_back(f); } ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2011 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
... |
// (c) Copyright 1995-2014 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
#include <bits/stdc++.h> using namespace std; int n, d, m, a[100001], id; long long sum[100001]; int main() { scanf( %d%d%d , &n, &d, &m); for (int i = 1; i <= n; ++i) scanf( %d , a + i); sort(a + 1, a + 1 + n); id = upper_bound(a + 1, a + 1 + n, m) - a; for (int i = 1; i <= n; ++i) sum[i] =... |
// hub_mem
/*
-------------------------------------------------------------------------------
Copyright 2014 Parallax Inc.
This file is part of the hardware description for the Propeller 1 Design.
The Propeller 1 Design is free software: you can redistribute it and/or modify
it under the terms of the GNU Ge... |
#include <bits/stdc++.h> using namespace std; long long cnt(long long a, long long b, long long c) { if (a > b || b > c) return 0LL; if (a == b && b == c) return 1LL; if (a == b && b < c) return 3LL; if (a < b && b == c) return 3LL; if (a < b && b < c) return 6LL; } int main() { long lon... |
#include <bits/stdc++.h> int main() { long long int n, m, i, c = 0; scanf( %lld %lld , &n, &m); long long int a[m]; for (i = 0; i < m; i++) { scanf( %lld , &a[i]); } for (i = 0; i < m - 1; i++) { if (a[i + 1] > a[i]) { c = c + a[i + 1] - a[i]; } else if (a[i] == a[i +... |
//
// Generated by Bluespec Compiler, version 2011.03.beta1 (build 23381, 2011-03-08)
//
// On Tue Apr 26 10:52:10 EDT 2011
//
//
// Ports:
// Name I/O size props
// pcie_tx O 4
// led O 8
// p200clk O 1
// CLK... |
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n >> s; int cont = 0; for (int i = 0; i < n && s[i] == < ; i++, cont++) ; for (int i = n - 1; i >= 0 && s[i] == > ; i--, cont++) ; cout << cont << endl; return 0; } |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; long long a[200010]; int main() { int n; long long sum = 0, MAX = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %I64d , a + i); sum += a[i]; MAX = max(a[i], MAX); } long long ans; if (sum % (n - 1) == 0) ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const ll MAX = 1e18 + 1; const int NN = 1e5 + 5; const int mod = 1e9 + 7; void solve() { string s1; cin >> s1; char vow[] = { a , e , o , u , i }; vector<int> ans; int i = 0; while (i < ... |
#include <bits/stdc++.h> using namespace std; int F[30030]; int n; int mod; int a[30030], id[30030]; int nxt[30030]; bool cmp(int i, int j) { return a[i] < a[j]; } int m; struct pnt { int l, r, i; pnt(int l = 0, int r = 0, int i = 0) : l(l), r(r), i(i){}; } q[30030]; bool operator<(pnt a, ... |
/**
* 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 = 1e5 + 10; struct edge { int u, v, st, nt; } e[MAXN * 2]; vector<int> lis; int hd[MAXN], etot, used[MAXN], in[MAXN], u[MAXN], v[MAXN]; void addedge(int u, int v, int st) { e[etot].u = u; e[etot].v = v; e[etot].st = st; e[eto... |
`default_nettype none
`include "common.h"
module mmu_if(
input wire iCLOCK,
input wire inRESET,
input wire iFREE_TLB_FLUSH,
/*************************
To Core
*************************/
//Core -> This
input wire iCORE_REQ,
output wire oCORE_LOCK,
input wire iCORE_DATA_STORE_ACK,
input wire [1:0... |
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; const int maxn = 300009; long long fac[maxn], invfac[maxn], A[33], B[33], in[maxn], idx[maxn]; vector<int> L[maxn], R[maxn]; int n, m; long long mpw(long long a, long long b) { long long c = 1; while (b) { if (b &... |
//
// Copyright 2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int A[N]; long long sum = 0, ans = 0; bool state; map<int, int> cnt; int main() { cnt[0] = 1; int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> A[i]; } for (int i = 0; i < n; i++) { if (A[... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Jafet Chaves Barrantes
//
// Create Date: 15:45:17 04/03/2016
// Design Name:
// Module Name: contador_AD_MM_T_2dig
// Project Name:
// Target Devices:
// Tool versions:
// Desc... |
#include <bits/stdc++.h> using namespace std; long long int max(long long int a, long long int b) { if (a > b) return a; return b; } long long int min(long long int a, long long int b) { if (a < b) return a; return b; } long long int msb(long long int n) { long long int ans; for (lon... |
#include <bits/stdc++.h> using namespace std; int m, x, p[100005], h[100005], cnt; long long n; int ksm(int a, long long k) { if (!k) return 1; int p = ksm(a, k / 2); if (k & 1) return (long long)p * p % 1000000007 * a % 1000000007; return (long long)p * p % 1000000007; } int Getval(long lon... |
/*******************************************************************************
* 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 ... |
#include <bits/stdc++.h> using namespace std; const int N = 55; int n, num, h[N], siz[N], e[N << 1], pre[N << 1]; double g[N], C[N][N], f[N][N]; inline void add(int x, int y) { e[++num] = y, pre[num] = h[x], h[x] = num; } void dfs(int u, int fa = 0) { memset(f[u], 0, sizeof f[u]), f[u][0] = siz[u] = 1; ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// i2cSlaveTopAltera.v ////
//// ////
//// This file is part of the i2cSla... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 300300; int n, k, uf[2 * MAXN], cnt[2 * MAXN], ans; vector<int> f[MAXN]; char s[MAXN]; int find(int x) { return (uf[x] != -1 ? uf[x] = find(uf[x]) : x); } void join(int x, int y) { if ((x = find(x)) == (y = find(y))) return; cnt[x] += ... |
#include <bits/stdc++.h> using namespace std; const int N = 100 * 1000 + 5; int xs, ys, xt, yt, n, a[N], b[N], r[N]; map<pair<int, int>, int> mark; map<pair<int, int>, int> dist; int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}; int dy[] = {0, 0, 1, -1, 1, -1, 1, -1}; void bfs(int x, int y) { queue<pair<int, ... |
/*
* Copyright (c) 2001 Stephen Williams ()
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* ... |
#include <bits/stdc++.h> using namespace std; int main() { int x, x0, y, y0; cin >> x >> y >> x0 >> y0; char s[100013]; cin >> s; int a[513][513] = {}; int num = 0; for (int i = 0; s[i] != 0 ; i++) { if (a[x0][y0] != 1) { cout << 1 ; num++; } else { ... |
module cov_tl_stage
import bsg_cache_non_blocking_pkg::*;
(
input clk_i
, input reset_i
, input ld_st_miss
, input mhu_miss_match
, input dma_miss_match
, input ld_st_hit
, input data_mem_pkt_ready_i
, input stat_mem_pkt_ready_i
, input v_i
, input bsg_cache_non_blocking_d... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; string s, t; int lenX, lenY; long long dp[5009][5009]; inline long long go(int x, int y) { if (x < 0 || y < 0) return 0LL; long long &ret = dp[x][y]; if (ret != -1) return ret; ret = 0; if (y > 0) ret = go(x, y ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; const int N = 100100; char a[N], b[N]; int n, m, k, p[27]; int Par(int i) { return p[i] = (i == p[i]) ? i : Par(p[i]); } bool same(int i, int j) { return Par(i) == Par(j); } int comp[27]; void mrg(int i, int j) { if (same(i, j)... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double Pi = acos(-1); namespace { template <typename T> inline void read(T &x) { x = 0; T f = 1; char s = getchar(); for (; !isdigit(s); s = getchar()) if (s == - ) f = -1; for (; isdigit(s); s = getch... |
#include <bits/stdc++.h> using namespace std; const int N = 1000023; long long int power(long long int a, long long int b) { long long int ans = 1; while (b) { if (b & 1) ans = (ans * a); b /= 2; a = (a * a); } return ans; } bool sortbysec(const pair<long long int, long long ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Wilson Snyder.
`include "verilated.v"
module t;
// Note $sscanf already tested elsewhere
reg [3:0] n;
reg [63:0] q;
reg [16*8:1] wide;
reg [48*8:1] str;
... |
#include <bits/stdc++.h> using namespace std; int a[200001]; int main() { int n, w; cin >> n >> w; for (int i = 0; i < 2 * n; i++) { cin >> a[i]; } sort(a, a + 2 * n); double x = min((double)a[0], (double)a[n] / 2); double ans = min((double)w, (double)3 * n * x); cout.precisi... |
/*
* 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 register_ctrl_top(
input I_sys_clk ,
input I_sys_rst ,
//=====================System usb_uart_if===========================
output O_usb_uart_tx_req ,
output [7 : 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... |
//==================================================================================================
// Filename : antares_load_store_unit.v
// Created On : Sat Sep 5 10:38:09 2015
// Last Modified : Sat Nov 07 12:09:07 2015
// Revision : 1.0
// Author : Angel Terrones
// Company : Univ... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable 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 law... |
#include <bits/stdc++.h> using namespace std; int n, a[200001]; const double esl = 1e-11; double cal(double x) { double t = 0; double ans = 0; for (int i = 1; i <= n; i++) { if (t + a[i] - x < 0) { ans = max(ans, t); t = 0; } else { t += ((double)a[i] - x); ... |
//------------------------------------------------------------------------------
// File : axi_mux.v
// Author : Xilinx Inc.
// -----------------------------------------------------------------------------
// (c) Copyright 2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and propri... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Wilson Snyder.
`define checkhw(gotv,w,expv) do if (gotv[(w)*32+:$bits(expv)] !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv[(w)*3... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
#include <bits/stdc++.h> using namespace std; int T, n, a[100005], b[100005], f[22], F[22], u[22], m, dp[2222222], cnt[2222222], C; void ope(int x) { dp[x] = 0; for (int i = 1; i <= 20; ++i) { if ((1 << i) & x) { int y = x ^ (1 << i); if (dp[y] == -1) ope(y); if (!(y & ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const int mod = 1e9 + 7; int a[N]; long long fac[30]; long long sum[N]; long long Contor(int* a, int n) { long long res = 0; for (int i = 1; i <= n; i++) { int cnt = 0; for (int j = i + 1; j <= n; j++) if (a[... |
// file: system_clk_wiz_0_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 ... |
`include "mem_beh.v"
`include "regfile_beh.v"
`include "components.v"
`include "control_units.v"
`include "alu_beh.v"
`include "mux2to1_beh.v"
module kustar;
reg clock, clear;
wire Zero;
// Signal //
/*
//Ex
[8:7] ALUOp
[6] ALUSrc
[5] RegDst,
//M
[4] Branch
[3] MemRead
[2] MemWrite
//WB
[1] RegWrite
[0] MemtoReg... |
// A verilog master that has a register array of data it uses to write to a slave.
// Each data is written to different address, and then read to verify it worked.
// Address space is assumed to be contiguous.
module wb_master #(
parameter BASE_ADDRESS = 0, // The first referable address. Is substracted from input ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, k; string s; cin >> k; vector<long long> cnt(10, 0); for (long long i = 0; i < 4; i++) { cin >> s; for (long long j = 0; s[j]; j++) { if (s[j] >= 0 && s[j] <= 9 ) cnt[s[j] - 0 ]++; } } ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; b %= n; int p = ((a - 1 + b) % n + n) % (n) + 1; cout << p << endl; } |
//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 mod = 1e9 + 7; const int N = 410; int cnt[N]; int temp[N]; long long cost[N][N]; long long dp[N][N]; long long n, m, k; const long long INF = (1LL) << 60; vector<int> v[200]; int main() { while (cin >> n >> m >> k) { memset(dp, 0, s... |
#include <bits/stdc++.h> using namespace std; map<int, int> mp; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) { int a; scanf( %d , &a); mp[a]++; } int res = n; while (!mp.empty()) { for (auto itr = mp.begin(); itr != mp.end();) { if (--itr... |
/**
* 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... |
/*
* 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; double EPS = 1e-9; long long INF = 1000000000000000005ll; double PI = acos(-1); inline string IntToString(long long int a) { char x[100]; sprintf(x, %lld , a); string s = x; return s; } inline long long int StringToInt(string a) { char x[1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.