text stringlengths 59 71.4k |
|---|
// board has 8 LED segment for display numbers
// print out the current tick which increments
// every number of second based on the clock
// use 4 button switch for reset and toggle of the
// step value. 18 LEDR is used for displaying the
// current step
`define NSEG 8
`define NLEDR 18
module ledhex
(
input wire [3... |
/*
This file is part of Fusion-Core-ISA.
Fusion-Core-ISA 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.
Fusion-Core-... |
// USED ONLY TO SELECT VC BLOCKED STATUS
// OPTIMISE FOR XY ROUTING
/* autovdoc@
*
* component@ unary_select_pair
* what@ A sort of mux!
* authors@ Robert Mullins
* date@ 5.3.04
* revised@ 5.3.04
* description@
*
* Takes two unary (one-hot) encoded select signals and selects one bit of the input.
*
* Imp... |
/*
Legal Notice: (C)2007 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... |
//
// Copyright 2015 Ettus Research LLC
//
module noc_block_addsub #(
parameter NOC_ID = 64'hADD0_0000_0000_0000,
parameter STR_SINK_FIFOSIZE = 11) // Use VHDL version of AddSub module
(
input bus_clk, input bus_rst,
input ce_clk, input ce_rst,
input [63:0] i_tdata, input i_tlast, input i_tvalid, output i... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Todd Strader.
function integer get_baz(input integer bar);
get_baz = bar;
$fatal(2, "boom");
endfunction
module foo #(parameter BAR = 0);
localparam integer BAZ = ge... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5; int ans[N], all, u, v, n, m, num, color[N], cnt[2]; vector<int> adj[N], radj[N]; bool used[N]; void output() { printf( YES n ); for (int i = 0; i < n; ++i) printf( %d%c , ans[i] + 1, n [i == n - 1]); exit(0); } void dfs... |
#include <bits/stdc++.h> const int N = (int)1e3 + 5; int n; int a[N]; int b[N]; int u[N]; int gcd(int a, int b) { return !b ? a : gcd(b, a % b); } int main() { int ts; scanf( %d , &ts); while (ts--) { for (int i = 0; i < N; ++i) { u[i] = 0; } scanf( %d , &n); fo... |
/**
* Generates the current game screen contents.
*/
module game_engine (
RESET,
SYSTEM_CLOCK,
VGA_CLOCK,
PADDLE_A_POSITION,
PADDLE_B_POSITION,
PIXEL_H,
PIXEL_V,
BALL_H,
BALL_V,
PIXEL
);
input RESET;
input SYSTEM_CLOCK;
input VGA_CLOCK;
input [7:0] PADDLE_A_... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int main() { ios::sync_with_stdio(false); int n; while (cin >> n) { int a, b, c, d, sum = 0, i = 0, mx = -1, my = -1, mix = N, miy = N; for (i = 0; i < n; i++) { cin >> a >> b >> c >> d; sum += abs(a - c)... |
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * Copyright INRIA, CNRS and contributors *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(* \VV/ *********... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); set<string> s; s.insert( don t even ); s.insert( worse ); s.insert( terrible ); s.insert( no way ); s.insert( go die in a hole ); s.insert( are you serious ); ... |
#include <bits/stdc++.h> using namespace std; int n, m; char cmd[(100000 + 10)]; int vis[510][510], path[(100000 + 10)]; const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0}; int convert(char ch) { if (ch == R ) return 0; else if (ch == L ) return 1; else if (ch == D ) retur... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; int a[105][105], u[105], v[105]; int main() { int n, m, k; scanf( %d%d%d , &n, &m, &k); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf( %d , &a[i][j]); for (int j = 0; j < m; j++) { int cnt[105] = {}; for (int i = 0; i ... |
module basic_checker
import bsg_cache_non_blocking_pkg::*;
#(parameter `BSG_INV_PARAM(data_width_p)
, parameter `BSG_INV_PARAM(id_width_p)
, parameter `BSG_INV_PARAM(addr_width_p)
, parameter `BSG_INV_PARAM(cache_pkt_width_lp)
, parameter data_mask_width_lp=(data_width_p>>3)
, parameter `BSG_IN... |
module main;
parameter NIBBLE = 4;
reg [NIBBLE*4-1:0] array [1:0];
reg [3:0] word;
integer idx;
initial begin
for (idx = 0 ; idx < 4 ; idx = idx+1) begin
array[0][idx*NIBBLE +: 4] = +idx;
array[1][idx*NIBBLE +: 4] = -idx;
end
if (array[0] !== 16'h3210) begin
$display("FAIL... |
#include <bits/stdc++.h> using namespace std; int m = 0, b = 0; int main() { int n; cin >> n; int Arrpi[n]; for (int j = 0; j < n; ++j) { cin >> Arrpi[j]; } int A[n]; for (int l = 0; l < n; ++l) { m = Arrpi[l] - 1; b = l + 1; A[m] = b; } for (int y = 0; ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_jp_sstl_bscan.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute ... |
#include <bits/stdc++.h> using namespace std; int n; string T[20]; bool comp[40][1 << 20]; int res[40][1 << 20]; int pts(char c, int d) { if (c == a ) return 1 * (1 - 2 * (d % 2)); if (c == b ) return -1 * (1 - 2 * (d % 2)); return 0; } int go(int d, int bitmask) { if (bitmask == 0) { ... |
#include <bits/stdc++.h> using namespace std; vector<int> lk; void make(int num, int len) { if (len == 10) return; if (num != 0) lk.push_back(num); make(num * 10 + 4, len + 1); make(num * 10 + 7, len + 1); } double gao(int l1, int l2, int r1, int r2) { double l = max(l1, r1), r = min(l2, r... |
#include <bits/stdc++.h> using namespace std; vector<int> d; int countDivisors(int n) { if (d[n] != 0) return d[n]; int res = 0; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { if (n / i == i) res++; else res += 2; } } d[n] = res; return... |
//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... |
/**
* 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() { map<string, string> hh; map<string, string>::iterator it; int n; string a, b, c; cin >> n; while (n--) { cin >> a >> b; it = hh.find(a); if (it == hh.end()) hh[b] = a; else { c = it->second; ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = (1ll << 32); const int LOGN = 14; const long long INF = (1ll << 62); long long __gcd(long long a, long long b) { if (b == 0) return a; return __gcd(b, a % b); } bool comp(pair<int, unordered_set<int> >& a, pair<int, un... |
module user_design(clk, rst, exception, input_timer, input_rs232_rx, input_ps2, input_i2c, input_switches, input_eth_rx, input_buttons, input_timer_stb, input_rs232_rx_stb, input_ps2_stb, input_i2c_stb, input_switches_stb, input_eth_rx_stb, input_buttons_stb, input_timer_ack, input_rs232_rx_ack, input_ps2_ack, input_i2... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; long long binpow(long long a, long long b) { if (b == 0) return 1; long long res = binpow(a, b / 2); if (b % 2) return res * res * a; else return res * res; } vector<int> adj[200006]; bool vis[200006]; bool ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; void cmin(long long& x, long long y) { if (x > y) { x = y; } } int n, a[N]; long long f[N][2]; bool best[N][2]; vector<int> adj[N], answer; void dfs1(int u, int p) { long long min_diff = 0; bool go = false; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int a, b, cnt = 0, sum = 0, i, j, hand, flag = 0, c, n, m, k, t, res, maxy = 0, miny = 12345678910; cin >> n; string str; getline(cin, str); int len = str.size(); if (st... |
#include <bits/stdc++.h> using namespace std; const long long BIG = 1000000000000000000LL; void solve(); signed main() { ios::sync_with_stdio(false); cin.tie(0); solve(); return 0; } long long nbBoxes; long long reqSom = 0; bool cycor[1 << 15]; pair<long long, pair<long long, long long... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}; int dy[] = {1, -1, 0, 0, -1, 1, 1, -1}; long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; } void PLAY() { cout << fixed << ... |
//
// Copyright (c) 2001 Ed Schwartz ()
//
// 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)
// a... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:45:21 02/22/2015
// Design Name:
// Module Name: AddState
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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... |
/**
* 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 uvm;
class simple_item extends uvm_sequence_item;
rand int unsigned addr;
rand int unsigned data;
rand int unsigned delay;
constraint c1 { addr < 16'h2000; }
constraint c2 { data < 16'h1000; }
// UVM automation macros for general objects
`uvm_object_utils_begin(simple_item)
a = b;
... |
#include <bits/stdc++.h> using namespace std; int INF = 1234567890; int t, T; int fa[100000], opp[100000]; int l[100000], r[100000]; int col[100000]; set<pair<int, int> > rp; set<pair<int, int> > lp; int find(int a) { if (a == -1) return -1; if (fa[a] == -1) return a; return fa[a] = find(f... |
/**
* 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 optimize(2) using namespace std; inline int read() { char c = getchar(); int x = 0; bool f = 0; for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45); for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); if (f) x = -x; return x; } b... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// Copyright (c) 2016 Min Chen
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions... |
#include <bits/stdc++.h> using namespace std; int a[105], b[105], n, k; bool f[105]; void dfs(int i) { f[i] = true; for (int k = 1; k <= n; k++) { if (f[k]) continue; if (a[i] > a[k] && a[i] < b[k]) dfs(k); else if (b[i] > a[k] && b[i] < b[k]) dfs(k); } } void s... |
#include <bits/stdc++.h> using namespace std; int main() { long long int r, c, ans = 0; cin >> r >> c; vector<vector<long long int> > A(r + 2, vector<long long int>(c + 2)); for (long long int i = 1; i <= r; i++) for (long long int j = 1; j <= c; j++) cin >> A[i][j]; vector<vector<long lon... |
#include <bits/stdc++.h> using namespace std; long long lmin(long long a, long long b) { if (a < b) return a; return b; } long long lmax(long long a, long long b) { if (a > b) return a; return b; } int main() { long long t1, t2, x1, x2, t0; scanf( %lld %lld %lld %lld %lld , &t1, &t2... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const long long MODSQ = 1LL * MOD * MOD; int W[8]; int dp[1 << 7][1 << 7][8][2]; struct matrix { int sz; int data[1 << 7][1 << 7]; }; matrix multiply(matrix& a, matrix& b) { matrix c; c.sz = a.sz; for (int i = ... |
#include <bits/stdc++.h> using namespace std; void _print(long long t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(long double t) { cerr << t; } void _print(double t) { cerr << t; } void _print(unsigned long long t) { cerr << t; } template <class T,... |
`include "assert.vh"
`include "cpu.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 6;
localparam MEM_EXTRA = 4;
localparam STACK_DEPTH = 7;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg ... |
#include <bits/stdc++.h> using namespace std; const long long N = 105; const long long MOD = 1e9 + 7; long long n, m, k; long long cache[N][N * N], cache2[N][N]; long long fact[N], invfact[N]; long long pow(long long a, long long b, long long m) { long long ans = 1; while (b) { if (b & 1) an... |
#include <bits/stdc++.h> using namespace std; const int N = 16, K = 225; struct HASH { size_t operator()(const pair<long long, long long> &x) const { return hash<long long>()((x.first) ^ ((x.second) << 32)); } }; int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0}; int n, m; int len = 0; long... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); char a[n][n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) a[i][j] = * ; int begin, end; begin = end = n / 2; for (int i = 0; i <= n / 2; i++) { for (int j = begin; j <= end; j++) a... |
#include <bits/stdc++.h> using namespace std; int main() { short n; int n1, n2; bool state = false; char handle[11]; cin >> n; for (short i = 0; i < n; i++) { cin >> handle; cin >> n1; cin >> n2; if (n1 >= 2400 && n2 > n1) state = true; } if (state) cout... |
#include <bits/stdc++.h> using namespace std; const long long UNDEF = -1; const long long INF = 1e18; template <typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; } template <typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2000000009; const int Max = 1000007; const double PI = acos(-1.0); long long nc2(long long n) { return (n * (n - 1)) / 2; } map<long long, long long> mp1, mp2; map<pair<long long, long long>, long long> mp3; int main() { long long i, j, k... |
`include "andGate.v"
module andGateTest ();
// localize variables
wire [31:0] busADD;
wire [31:0] busA, busB;
// declare an instance of the module
andGate andGate (busADD, busA, busB);
// Running the GUI part of simulation
andGatetester tester (busADD, busA, busB);
// file for gtkwave
initial
begin
$dum... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000009; const int MOD = 1000000007; double probMayor(pair<int, int> x, int bid) { if (bid < x.first) { return 1.0; } if (bid > x.second) { return 0.0; } return double(x.second - bid) / (x.second - x.first + 1); }... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); long long int n, m, i, j, x; cin >> n >> m; long long int a[n]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); for (i = 0; i < m; i++) { cin >... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200010, P = 998244353; int n, k, num, ans, h[maxn], fact[maxn], inv[maxn]; int qp(int x, int y) { int z = 1; for (; y; y >>= 1, x = 1LL * x * x % P) { if (y & 1) z = 1LL * z * x % P; } return z; } int C(int x, int y) { retu... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module spi_core
#(
parameter ABUSWIDTH = 16,
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i; vector<char> v; string s; cin >> s; n = s.size(); char c[n], ch; i = n; ch = s[n - 1]; while (i--) { if (s[i] == ch) v.push_back(s[i]); else if (s[i] > ch) { v.push_back(s[i]); ... |
#include <bits/stdc++.h> using namespace std; int n, m; int p[100010]; const int md = 1000000009; int an = 1; int sz[100010]; void make_set(int v) { p[v] = v; sz[v] = 1; } int find_set(int v) { if (p[v] == v) return v; return p[v] = find_set(p[v]); } void union_sets(int a, int b) {... |
#include <bits/stdc++.h> int main() { char abc[105]; scanf( %s , abc); int n = strlen(abc); int i = 0; int max = 1, count = 0; while (i < n) { if (abc[i] == A || abc[i] == E || abc[i] == I || abc[i] == O || abc[i] == U || abc[i] == Y ) { if (max < count + 1) ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Fri Sep 22 10:05:01 2017
// Host : vldmr-PC running 64-bit Service Pack 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... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:102400000,102400000 ) using namespace std; const double PI = acos(-1.0); int f_max(int a, int b) { return a > b ? a : b; } int f_min(int a, int b) { return a < b ? a : b; } int f_abs(int a) { return a > 0 ? a : -a; } int gcd(int a, int b) { return b... |
#include <bits/stdc++.h> using namespace std; int n, k; int a[100005]; int maxans, maxnum; int main() { scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) scanf( %d , &a[i]); sort(a, a + n); int l = 0, r = 0; int curk = k, curans = 0, curnum = 0; while (r < n) { while (r < n && c... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: small_fifo_test.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// =======================... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x1, y1, x2, y2; cin >> n >> m >> x1 >> y1 >> x2 >> y2; int dx = abs(x1 - x2) - 1; int dy = abs(y1 - y2) - 1; if (dx > 3 || dy > 3) { cout << Second << endl; } else if (dx <= 2 && dy <= 2) { cout << First << ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int du[maxn]; set<int> g[maxn]; int b1[maxn], b2[maxn], ans[maxn], vis[maxn]; int main() { int n, m, k; scanf( %d%d%d , &n, &m, &k); set<pair<int, int> > s; for (int i = 0; i < m; i++) { int x, y; scanf( %d%... |
module xyz (/*AUTOARG*/
// Outputs
signal_f, signal_c,
// Inputs
signal_e3, signal_b
);
/*AUTOINPUT*/
// Beginning of automatic inputs (from unused autoinst inputs)
input [2:0] signal_b; // To u_abc of abc.v
input signal_e3; // To u_def of def.v
// End of automatics
/*AUTOOUTPUT*/... |
/**
* 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... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; bool check(vector<int>& v, int k, int val, int start) { vector<int> dp(v.size()); if (v[0] <= val && start == 0) { dp[0] = dp[1] = 1; } if (v[1] <= val) { dp[1] = 1; } for (int i = 2; i < v.size(); ++i) { dp[i] = dp[i - 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 la... |
#include <bits/stdc++.h> using namespace std; const int N = 1e7 + 10; const long long MOD = (long long)(1e9) + (long long)(7); const long double INF = 1e17; long long dp[505][505][12]; long long edge[505][505][4]; int main() { ios::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; ... |
#include <bits/stdc++.h> using namespace std; const long long md = 1e9 + 7; long long fe(long long e) { if (e == 0) return 1; long long ans = fe(e / 2); ans = (ans * ans) % md; if (e % 2) ans *= 2; return (ans % md); } int main() { long long x, y; cin >> x >> y; if (y % x) { ... |
#include <bits/stdc++.h> using namespace std; int gcd(long long int a, long long int b) { if (b == 0) return a; return gcd(b, a % b); } long long int binomialCoeff(long long int n, long long int k) { long long int C[n + 1][k + 1]; long long int i, j; for (i = 0; i <= n; i++) { for (j =... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const long long mod = 1e9 + 7; const long long N = 2e5 + 10; inline long long add(long long x, long long y) { x += y; if (x >= mod) x -= mod; return x; } inline long long mul(long long x, long long y) { x = (1LL * x ... |
#include <bits/stdc++.h> using namespace std; struct p { int s, n; }; int comp(struct p a, struct p b) { return (a.s <= b.s); } int main() { vector<long long> a, sb, s, r; long long i, j, k, n, ss, sss, rrr; cin >> n; s.resize(n + 2, 0); r.resize(n + 2, 0); sb.push_back(0); for... |
/*******************************************************************************
* *
* Copyright (C) 2009 Altera Corporation *
* ... |
#include <bits/stdc++.h> using namespace std; int n, m; int main() { cin >> n >> m; if (m / n == 2) cout << n - m % n; else if (m / n == 1) cout << m % n; else cout << 0; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, ans = 0, xs, ys, xe, ye; char q[105][105]; cin >> n >> m; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cin >> q[i][j]; if (q[i][j] == S ) { xs = i; ys = j; } ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:58:39 10/16/2015
// Design Name: DFF
// Module Name: /home/steins;gate/IIIT-Delhi/ELD/Assignments/Verilog/Assignment_1/Assign1/test_DFF.v
// Project Name: Assign1... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Engineer: Ryan
//
// Create Date: 06/07/2017
// Module Name: Main Module
// Project Name: Joystick and oLED controller
// Target Devices: ICEStick
// Tool versions: iCEcube2
// Description: This ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int intersection = n * m; int turn = 0; while (n > 1 && m > 1) { intersection -= (n + m - 1); n--; m--; turn++; } if (n == 1 && m == 1 && turn % 2 == 0) { cout << Akshat <<... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void umax(T &a, T b) { if (a < b) a = b; } template <class T> inline void umin(T &a, T b) { if (a > b) a = b; } template <class T> inline T abs(T a) { return a > 0 ? a : -a; } template <class T> inline T gcd(T a,... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n; cin >> n; if (n == 47 || n == 74 || n == 477 || n == 477) cout << YES ; else if (n % 4 == 0 || n % 7 == 0 || n % 47 == 0) cout << YES ; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(), cout.tie(); bool w = false; int cnt = 0; string s; cin >> s; for (int i = 0; i < s.size(); i++) { int zero = 0, one = 0; if (w && s[i] == 0 ) { cout << 1 << << 1 << endl; ... |
/*
########################################################################
EPIPHANY eMesh Arbiter
########################################################################
This block takes three FIFO inputs (write, read request, read response)
and the DMA channel, arbitrates between the active channels, and forw... |
#include <bits/stdc++.h> const int N = 100005; long long a[N], s[N]; long long max; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %I64d , &a[i]); } std::sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) { s[i] = s[i - 1] + a[i]; max += s[... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void smn(T &a, const T &b) { if (b < a) a = b; } template <class T> inline void smx(T &a, const T &b) { if (b > a) a = b; } template <class T> inline T gcd(T x, T y) { return y ? gcd(y, x % y) : x; } namespace std ... |
`timescale 1ns / 1ps
`include "./MPU6050_defines.v"
module MPU6050
(
input clk,
input rst,
inout scl,
inout sda,
output reg [15:0] accel_z,
output reg valid,
output reg error
);
integer i;
localparam [4:0] INIT_REG_STATE = 0;
localparam [4:0] READ_ACCEL_Z_STATE... |
/**
* 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; double dp[100002]; int main() { double res = 0, prob = 0; int n; cin >> n; dp[0] = 0; for (int i = 0; i < n; i++) { double p; cin >> p; dp[i] = dp[i - 1] * p; res = res + p + dp[i] * 2.0; dp[i] += p; } printf( ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; template <typename T> inline void read(T &AKNOI) { T x = 0, flag = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) flag = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 0 ; ... |
//-----------------------------------------------------------------------------
// The way that we connect things when transmitting a command to an ISO
// 15693 tag, using 100% modulation only for now.
//
// Jonathan Westhues, April 2006
//-----------------------------------------------------------------------------
m... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.