text stringlengths 59 71.4k |
|---|
//Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2015.1 (lin64) Build Mon Apr 27 19:07:21 MDT 2015
//Date : Sat Aug 8 15:14:35 2015
//Host : edinburgh running 64-bit Ubuntu 15.04
//Command ... |
#include <bits/stdc++.h> using namespace std; int n, len; char str[55][25]; long long f[(1 << 20) + 10], bin[55]; double ans[(1 << 20) + 10]; double res; int main() { int i, j, k, c; bin[0] = 1; for (i = 1; i < 55; i++) bin[i] = (bin[i - 1] << 1); scanf( %d , &n); for (i = 0; i < n; i+... |
#include <bits/stdc++.h> #define all(v) (v).begin(), (v).end() #define sortv(v) sort(all(v)) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define pb push_back #define FI first #define SE second #define lb lower_bound #define ub upper_bound #define mp make_pair #define test 1 #define TE... |
#include <bits/stdc++.h> using namespace std; struct node { int a, ord; } p[10005]; int b[10005]; bool cmp(node a, node b) { return a.a < b.a; } int main() { int n; while (~scanf( %d , &n)) { memset(b, 0, sizeof(b)); for (int i = 0; i < n; i++) { scanf( %d , &p[i].a); ... |
#include <bits/stdc++.h> using namespace std; void enter(vector<long long int> &ar) { long long int n = ar.size(); for (long long int i = 0; i < n; i++) { cin >> ar[i]; } } void show(vector<long long int> &a) { long long int n = a.size(); for (long long int i = 0; i < n; i++) { c... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (auto &x : v) cin >> x; int mine = *min_element(v.begin(), v.end()); vector<int> temp; for (int i = 0; i < n; i++) { if (v[i] == mine) temp.push_back(i); } for (int i = 0; i < ... |
#include <bits/stdc++.h> using namespace std; int binarySearch(int a[], int l, int r, int x); int main() { int n, m, i, temp; vector<int> v1; vector<int> v2; scanf( %d %d , &n, &m); for (i = 0; i < n; i++) { scanf( %d , &temp); v1.push_back(temp); } for (i = 0; i < m; i++) ... |
#include <bits/stdc++.h> using namespace std; int main() { { long long i, j, n, a, b, c, d, mx, mn; cin >> n >> a >> b >> c >> d; mx = max(a + b, a + c); mx = max(mx, b + d); mx = max(mx, c + d); mn = min(a + b, a + c); mn = min(mn, b + d); mn = min(mn, c + d); ... |
#include <bits/stdc++.h> using namespace std; int main() { long long d, k, tc, tf, tr, res = 100 * 100 * 100 * 100LL; scanf( %lld , &d); ; scanf( %lld , &k); ; scanf( %lld , &tc); ; scanf( %lld , &tf); ; scanf( %lld , &tr); ; if (k >= d) return 0 * printf( %lld , d * ... |
#include <bits/stdc++.h> using namespace std; struct NODE { char w[4]; }; NODE tmp; vector<NODE> st, stt; bool use[10]; int bull, cow; char ss[6]; void back(int index) { if (index == 4) { int i, j, b, c; for (i = 0, b = 0, c = 0; i < 4; ++i) for (j = 0; j < 4; ++j) ... |
/*
* 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... |
`timescale 1 ns / 1 ps
`ifdef DEBUG
`ifndef DEBUGM
`define DEBUGM
`include "debug_module.v"
`endif
`endif
module BUF(A, Y);
input A;
output Y;
assign Y = A;
`ifdef DEBUGM
parameter power_rev_time=`PRTIME;
wire [31:0] contador;
reg enb;
potencia p(contador,enb,A);
integer cur_time;
initial
begin
enb=1;
#(`PRTIME... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Sun Jun 04 15:55:33 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int main() { string s, a; a = hello ; cin >> s; int i, j, k = 0; for (i = 0, j = 0; j < a.size(); i++) { if (i >= s.size()) break; if (s[i] == a[j]) { j++; } } if (j == a.size()) cout << YES << endl; els... |
#include <bits/stdc++.h> using namespace std; int N, edge; pair<int, int> E[2][200002]; vector<int> V[2][200002]; int in[2][200002], out[2][200002]; bool S[2][200002], isdel[2][200002]; vector<pair<pair<int, int>, int> > ARBf[2][4 * 200002], ARBs[2][4 * 200002]; int Ap1, Ap2, Apv, Ax1, Ax2; vector<int... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: ITCR
// Engineer: Yermy Benavides
//
// Create Date: 21:40:24 02/29/2016
// Design Name: MDF
// Module Name: D:/ISE/Proyecto1/TB_MDF.v
// Project Name: Proyecto1
// Target Device:
// Tool versions... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; long long n, a[100007], x, ans, t, res, tmp; vector<long long> v, cur; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (long int i = 0; i < n; i++) { cin >> x; if (x) v.... |
#include <bits/stdc++.h> using namespace std; void init() {} const int N = 1e6 + 34; const int INF = 1e9 + 34; vector<int> ans[2]; vector<int> es[N]; int n, m, v1, v2; int c[N]; void dfs(int v, int q) { if (c[v] && c[v] != q + 1) { cout << -1 ; exit(0); } if (c[v]) return; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; const int inf = 1e9 + 5e5 + 19; int n, k; int a[maxn]; bool in_b[maxn]; struct fenwick { int n; vector<int> val; void init(int _n) { n = _n; val.assign(n + 5, -1); } void update(int x, int k) { fo... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, 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> int ff[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; long long dp[16][9 + 1]; void solve(int *bb, int l) { int k, d, i, e, j; memset(dp, 0, sizeof dp); k = ((l) < (bb[0]) ? (l) : (bb[0])); for (i = 0; i <= k; i++) dp[0][i] = 1; for (d = 0; d < 16 - 1; d++) ... |
// 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 : Tue Oct 31 12:11:23 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, B, c; cin >> n >> k >> B >> c; long long a[n]; for (int i = 0; i < n; i++) cin >> a[i]; long long x = *min_element(a, a + n); for (int i = 0; i < n; i++) a[i] = a[i] - x; B = min(B, 5 * c); long long ans = 1e1... |
#include <bits/stdc++.h> using namespace std; char s[2005]; const int mod = 1e9 + 7; int n, k, t[2005]; int a[2005][2005], b[2005][2005]; int mp(const int &a, const int &b) { return (int)(1ll * a * b % mod); } int add(const int &a, const int &b) { return (a + b) % mod; } int main() { scanf( %d %d %s... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; void solve() { long long int a, s; cin >> a >> s; vector<long long int> b; while (s) { long long int x = a % 10; long long int y = s % 10; if (y >= x) { b.push_back(y - x); } else { ... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_mutex (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 2;
parameter invert_mode ... |
//-*- mode: Verilog; verilog-indent-level: 3; indent-tabs-mode: nil; tab-width: 1 -*-
module apl2c_connect(autoinoutmodport_type_intf ctl_i,
/*AUTOINOUTMODPORT("autoinoutmodport_type_intf", "ctl_cb")*/
// Beginning of automatic in/out/inouts (from modport)
... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100005, MAX_K = 105; int N, M, K, S; int good_type[MAX_N]; int distances[MAX_N][MAX_K]; vector<int> adj[MAX_N]; int dist[MAX_N]; void RunBFS(int type) { queue<int> q; for (int i = 0; i < N; ++i) { if (good_type[i] == type) { ... |
#include <bits/stdc++.h> using ll = long long; using namespace std; const int INF = 1e8; const int N = 2e5 + 2; int n, m, k; vector<int> G[N]; int a[N]; bool sp[N]; int distN[N], dist1[N]; int suf[N]; bool cmp(int& v, int& u) { return dist1[v] < dist1[u]; } void bfsN() { for (int i = 0; i < ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_ncio_prqq_buf.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 it... |
#include <bits/stdc++.h> using namespace std; bitset<6> a, b; int main() { int n; cin >> n; a = bitset<6>(n); b.set(5, a[5]); b.set(4, a[0]); b.set(3, a[2]); b.set(2, a[3]); b.set(1, a[1]); b.set(0, a[4]); cout << b.to_ulong(); } |
#include <bits/stdc++.h> using namespace std; const bool testcase = 0; const long long int mod1 = 1000000007; const long long int mod2 = 998244353; const long long int N = 1e5 + 5; std::vector<long long int> adj[N]; std::vector<long long int> vis(N, false); bool hasLoop(long long int i, long long int p)... |
`timescale 1 ns / 1 ps
`default_nettype none
`define WIDTH 16
module j4a(input wire clk,
input wire resetq,
output wire uart0_wr,
output wire uart0_rd,
output wire [7:0] uart_w,
input wire uart0_valid,
input wire [7:0] uart0_data
);
wire io_rd, io_wr... |
//-----------------------------------------------------
// Design Name : ram_dp_ar_aw
// File Name : ram_dp_ar_aw.v
// Function : Asynchronous read write RAM
// Coder : Deepak Kumar Tala
//-----------------------------------------------------
module ram_dp_ar_aw (
address_0 , // address_0 Input
data_0 , /... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; const long long mod = 1e9 + 7; void rd(int &x) { int f = 1; x = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = x * 10 +... |
`define bsg_buf_macro(bits) \
if (harden_p && (width_p==bits) && vertical_p) \
begin: macro \
bsg_rp_tsmc_40_BUFFD8BWP_b``bits buf_gate (.i0(i),.o); \
end ... |
#include <bits/stdc++.h> using namespace std; int n, F[500007], wartosc[500007], Fat[500007]; bool valid_number[500007], valid_edges[300007], query_node[500007]; int Find(int a) { return (a == Fat[a] ? a : Fat[a] = Find(Fat[a])); } inline void Union(int a, int b) { a = Find(a); b = Find(b); F[a] =... |
#include <bits/stdc++.h> using namespace std; int n, m, a[111], maxx; int main() { cin >> n >> m; for (int i = 0; i < n; ++i) cin >> a[i]; maxx = a[0]; for (int i = 1; i < n; ++i) maxx = max(maxx, a[i]); int tot = 0; for (int i = 0; i < n; ++i) tot += maxx - a[i]; int res2 = maxx + m; ... |
//Legal Notice: (C)2013 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... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2009 Xilinx, Inc.
// This design is confidential and proprietary of Xilinx, All Rights Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ /... |
#include <bits/stdc++.h> using namespace std; int r1, c1, r2, c2, a[505][505], N, M, dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; bool viz[505][505]; char c; queue<pair<int, int> > Q; bool bfs(int x, int y, int xx, int yy) { Q.push(make_pair(x, y)); while (Q... |
/**
* 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; int main() { long long a, b, f, k; scanf( %lld %lld %lld %lld , &a, &b, &f, &k); long long ans = 0; long long cfuel = b; for (int i = 0; i < k - 1; i++) { if (i % 2 == 0) { if (cfuel >= 2 * a - f) { cfuel -= a; } else ... |
// cog_ram
/*
-------------------------------------------------------------------------------
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 double gimmearea(long double x1, long double y1, long double r1, long double x2, long double y2, long double r2, long double c) { long double t1, t2, p1, p2; t1 = acos((r1 * r1 + c - r2 * r2) / (2 * r1 * sqrt(... |
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b, long long m) { a %= m; long long res = 1; while (b > 0) { if (b & 1) res = res * a % m; a = a * a % m; b >>= 1; } return res; } int binomial(int n, int k) { if (k == 0 || k == n) ret... |
/**
* 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... |
//-----------------------------------------------------------------------------
// File : wb_sum_buffer.v
// Creation date : 20.04.2017
// Creation time : 10:25:17
// Description : Maintains calculated sum of input values. The output value is the latest result. When new input value is set, the oldest is disc... |
/*
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2014 by Jie Xu.
//
// change these two parameters to see the speed differences
`define DATA_WIDTH 8
`define REP_COUNT4 `DATA_WIDTH/4
`define REP_COUNT2 `DATA_WIDTH/2
module t (/*AUT... |
#include <bits/stdc++.h> using namespace std; int ABS(int a) { if (a < 0) return (-a); return a; } void input() {} int a[100005]; int seg[100005]; int nxt[100005]; int hop[100005]; void readInt(int &n) { n = 0; char ch = getchar(); while (!isdigit(ch)) ch = getchar(); while (is... |
#include <bits/stdc++.h> using namespace std; int a[300010]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); } long long ans = 0; vector<int> v; for (int i = 1; i <= n; ++i) { ans += a[i] / 2; if (a[i] % 2 != 0) { v.push_back(i... |
// megafunction wizard: %In-System Sources and Probes%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsource_probe
// ============================================================
// File Name: hps_reset.v
// Megafunction Name(s):
// altsource_probe
//
// Simulation Library Files(s):
//
// ========... |
#include <bits/stdc++.h> using namespace std; const int N = 1 << 20; long long sum; int k, p, n, a[N + 1], i, b[N + 1], left_tree[N + 1], right_tree[N + 1]; vector<long long> leftv, rightv; void update(int index, int value, int tree[]) { while (index < N + 1) { tree[index] += value; index +=... |
/*
* 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; struct ma { int x, vt; } a[105]; bool cmp(ma p, ma y) { return p.x < y.x; } int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].x; a[i].vt = i; } sort(a + 1, a + n + 1, cmp); for (int i = 1; i <= n / 2; i+... |
// --------------------------------------------------------------------------------
//| Avalon ST Idle Inserter
// --------------------------------------------------------------------------------
`timescale 1ns / 100ps
module altera_avalon_st_idle_inserter (
// Interface: clk
input 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 = 200000 + 10; ... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const long long INF = (long long)5e18; const int MOD = 998244353; int add(int x, int y) { x += y; return x >= MOD ? x - MOD : x; } int sub(int x, int y) { x -= y; return x < 0 ? x + MOD : x; } int qpow(int x, int y... |
#include <bits/stdc++.h> using namespace std; int ans = -1; map<pair<int, int>, bool> visited, mp; void bfs(int x1, int y1, int x2, int y2) { queue<pair<pair<int, int>, int>> q; q.push({{x1, y1}, 0}); while (!q.empty()) { auto z = q.front(); q.pop(); visited[z.first] = 1; if ... |
#include <bits/stdc++.h> using namespace std; int a[410], s[410], dp[60][410][2]; void su(int &a, int b) { if (b > a) a = b; } void lemon() { int n, m; scanf( %d%d , &n, &m); for (int i = (1); i <= (n); i++) scanf( %d , &a[i]); for (int i = (1); i <= (n); i++) s[i] = s[i - 1] + a[i]; f... |
#include <bits/stdc++.h> using namespace std; long long h, n; int main() { cin >> h >> n; long long ans = 0; long long l = 1, r = (1LL << h); int dir = 0; for (int i = h - 1; i >= 0; i--) { ans++; long long mid = (l + r) / 2; if (dir == 0) { if (mid < n) { a... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 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 distributed ... |
module io1_sub(
/*AUTOARG*/
// Outputs
sec_out, lower_out,
// Inouts
sec_io, lower_io,
// Inputs
sec_ina, lower_ina
);
/*AUTOINPUT*/
// Beginning of automatic inputs (from unused autoinst inputs)
input lower_ina; // To instio of instio.v
inp... |
`include "../network_params.h"
module feature_map_buffer_ctrl(
input clock,
input reset,
input data_rdy,
input [`X_COORD_BITWIDTH:0] xcoord,
input [`Y_COORD_BITWIDTH:0] ycoord,
output reg [`FM_ADDR_BITWIDTH:0] addr,
output reg buffer_full
);
//assign addr = xcoord + (ycoord * `FM_ADDR_WIDTH'd`FM_WI... |
/*
* PicoSoC - A simple example SoC using PicoRV32
*
* Copyright (C) 2017 Claire Xenia Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all co... |
#include <bits/stdc++.h> using namespace std; const int B = 12; const int D = 64; const int MASK = 1030; int q, b; long long f[B][D][MASK]; long long sum[B][D]; long long call(int base, int rem, int mask) { if (rem <= 0) return mask == 0; long long &ret = f[base][rem][mask]; if (ret != -1) r... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, x, res = 0; cin >> n; int t[n + 1]; fill(t, t + (n + 1), 0); for (int i = 1; i <= n; i++) { cin >> x; t[x] = t[x - 1] + 1; res = max(res, t[x]); } cou... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:51:06 09/06/2013
// Design Name:
// Module Name: time_parameters
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies... |
/**
* 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 Max(int a, int b) { return a > b ? a : b; } int Min(int a, int b) { return a < b ? a : b; } char s[10][10]; int n, k; int a[10], mi, ma, ans; int flag[10]; void dfs(int t) { int i, j; if (t == k) { mi = ma = a[0]; for (i = 1; i < n; +... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &x) { x = 0; char c = getchar(); bool f = 0; for (; !isdigit(c); c = getchar()) f ^= c == - ; for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); x = f ? -x : x; } inline void readChar(char &c) { ... |
#include <bits/stdc++.h> using namespace std; int n; int A[200005]; vector<int> L[105]; int dp[400005]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &A[i]); L[A[i]].push_back(i); } int opt = 0; int D = 0; int N = min(n, 100); for (int i = 1... |
// Generated by FIR Compiler 9.0 [Altera, IP Toolbench 1.3.0 Build 132]
// ************************************************************
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
// ************************************************************
// Copyright (C) 1991-2014 Altera Corporation
// Any meg... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; while (cin >> n) { vector<long long> vec; for (long long i = 2; i * i <= n; i++) { while (n % i == 0) { vec.push_back(i); n /= i; } } if (n > 1) { vec.push_back(n); ... |
/**
* Reads the input and passes it to the game engine.
*
*/
module player(
CLOCK,
RESET,
A,
B,
POSITION
);
input CLOCK, RESET, A, B;
output [7:0] POSITION;
wire [3:0] speed;
wire direction;
wire count_enable;
// Read the rotary encoder.
quadrature_decode... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:40:46 12/20/2010
// Design Name:
// Module Name: clk_test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
#include <bits/stdc++.h> using namespace std; long n, ar[500000], ps[500000], q, tp, a, b, bd[500000], sb[500000]; long res, fb; long gs(long v) { fb = v / 200; res = 0; for (int i = 0; i < fb; i++) res += sb[i]; for (int i = fb * 200; i <= v; i++) res += bd[i]; return res; } int main() ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s; cin >> n; n += 1; int h[n]; for (int i = 1; i < n; i++) cin >> h[i]; h[0] = 0; int energy = 0; int max_energy = 0; for (int i = 0; i < (n); ++i) { if (i == 0) continue; energy += h[i - 1] - h[i]; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int *arr = new int[2 * n + 1]; cin >> arr[0]; for (int i = 1; i < 2 * n + 1; i += 2) { cin >> arr[i] >> arr[i + 1]; if (k > 0 && arr[i] > arr[i - 1] + 1 && arr[i] > arr[i + 1] + 1) { k -= 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 "./Definition.v"
//float Lmin = 0, L1x = 5, L2x = 10, L3x = 50;
//float Lmax = 100, L1y = 10, L2y = 17.5, L3y = 55;
//float a1 = ( L1y - Lmin ) / ( L1x - Lmin ), a2 = ( L2y - L1y ) / ( L2x - L1x ), a3 = ( L3y - L2y ) / ( L3x - L2x ), a4 = ( Lmax - L3y ) / ( Lmax - L3x);
//float b1 = ( L1y - ( L1x * a1)), b2 =... |
/********************************************/
/* generic_output.v */
/* A generic implementation of outputs */
/* (LEDs, ...) */
/* */
/* 2012, */
/********************************************/
module ge... |
#include <bits/stdc++.h> #define MP make_pair using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++ i) #define rep1(i, n) for (int i = 1; i <= (int)(n); ++ i) #define foreach(itr, c) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); ++ itr) typedef long long LL; typed... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:128777216 ) using namespace std; const long long LINF = 1000000000000000000LL; const int INF = 1000000000; const long double eps = 1e-9; const long double PI = 3.1415926535897932384626433832795l; void prepare(string s) { if (s.length() != 0) { ... |
#include <bits/stdc++.h> using namespace std; const int inf = 2e9; const int sz = 3; const double eps = 1e-9; const int maxn = 1e3 + 500, base = 1e9 + 7, maxm = 10; string second[maxn]; int main() { ios_base::sync_with_stdio(0); ; cin.tie(0); int n; cin >> n; if (n == 1) { co... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cin.get(); string s; deque<pair<string, bool>> storage; while (n--) { getline(cin, s); storage.push_back(pair<string, bool>(s, true)); } deque<pair<string, bool>>::iterator it1, it2; bool flag... |
/*
* Titor - Barrel Processor - Task-dedicated register bank
* Copyright (C) 2012,2013 Sean Ryan Moore
*
* 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 ... |
//////////////////////////////////////////////////////////////////////////////////
// d_KES_PE_DC_NMLodr.v for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Jinwoo Jeong <>
// Ilyong Jung <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
... |
#include <bits/stdc++.h> const int MAX_MEM = 1e8; int mpos = 0; char mem[MAX_MEM]; inline void *operator new(size_t n) { assert((mpos += n) <= MAX_MEM); return (void *)(mem + mpos - n); } inline void operator delete(void *) noexcept {} using namespace std; struct Ex { int s, d, c, i; }; ... |
#include <bits/stdc++.h> using namespace std; int dp[500005][28]; int ar[500005]; int p[500005][28]; int ans[500005]; string st; int main() { int a, b, c, d, e, x, y, z, k, n; cin >> n >> k; cin >> st; for (a = 0; a < n; a++) ar[a + 1] = st[a] - A ; for (a = 1; a <= n; a++) { fo... |
/*******************************************************************************
* 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 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2.1 (win64) Build Wed Aug 9 16:32:24 MDT 2017
// Date : Fri Sep 22 14:40:47 2017
// Host : EffulgentTome running 64-bit major re... |
// ledtest_hps_0_hps_io.v
// This file was auto-generated from altera_hps_io_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 17.0 595
`timescale 1 ps / 1 ps
module ledtest_hps_0_hps_io (
output wire [14:0] mem_a, // memory.mem_a
output wire [2:... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int main() { int n, m, t; cin >> n >> m >> t; int total = (n - 2) * (n - 1) / 2 + 1; if (total >= m && m >= n - 1) { m = m - n + 1; int cant = 0; if (t != 1) cant = 1; else cant = n; ... |
#include <bits/stdc++.h> using namespace std; struct Grass { int sizee; char dir; } a[100005]; int n; bool flag[100005]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].dir; } for (int i = 1; i <= n; i++) { cin >> a[i].sizee; } int nowx = 1; ... |
module reg_64page_1024x32b_3r_1w_fpga
(/*AUTOARG*/
// Outputs
rd0_data, rd1_data, rd2_data,
// Inputs
rd0_addr, rd1_addr, rd2_addr, wr0_addr, wr0_en, wr0_en_xoutof4,
wr0_data, clk, clk_double
);
output [8191:0] rd0_data;
output [2047:0] rd1_data;
output [2047:0] rd2_data;
input [9: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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.