text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; void OUT_TST(string s, istream_iterator<string> it) { cerr << s; } template <typename T, typename... Args> void OUT_TST(string s, istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << ; OUT_TST(s, ++it, args...); } template <cla... |
// master_0.v
// Generated using ACDS version 12.0 178 at 2012.08.08.17:01:17
`timescale 1 ps / 1 ps
module master_0 (
input wire clk_clk, // clk.clk
input wire clk_reset_reset, // clk_reset.reset
output wire [31:0] master_address, // master.address
in... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: iobdg_efuse_reg.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 a... |
`timescale 1 ns / 100 ps
module top
(
);
`include "sim_params.v"
reg clk;
reg rst;
reg [31:0] wb_adr_o;
reg [3:0] wb_sel_o;
reg [31:0] wb_dat_o;
reg wb_we_o;
reg wb_cyc_o;
reg wb_stb_o;
reg [2:0] wb_cti_o;
reg [1:0] wb_bte_o;
wire [31:0] wb_dat_i;
wire wb_ack_i;
w... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 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 copies.
*
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
parameter SIZE = 8;
integer cnt = 0;
logic [SIZE-1:0] vld_for;
logic vld_... |
/**
* 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... |
// This module generates M pairs of N-1 bits unsigned numbers A, B
// and also serialises them starting from LSB bits between
// activation of active-high reset signal
module stimulus #(parameter N = 4, M = 10) (input clk,
output reg reset,
output reg sa, sb,
output r... |
#include <bits/stdc++.h> using namespace std; const int N = 500005; const int maxx = 1000005; int n, x, y, q, l, r; int a[N]; struct Tree { int ans, m, tag; } tr[maxx * 6]; void pushdown(int rt) { int lson = rt << 1; int rson = rt << 1 | 1; tr[lson].m += tr[rt].tag; tr[rson].m += tr[... |
//`#start header` -- edit after this line, do not edit this line
// Copyright (C) 2013 Michael McMaster <>
//
// This file is part of SCSI2SD.
//
// SCSI2SD 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, e... |
/**
* 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; void readi(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = v * 10 + c - 0 ; while (isdigit(c = getchar())) v = v * 10 + c - 0 ; x = v * f; } void ... |
/**
* 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 = (int)1e2, maxM = (int)1e2, intMax = INT_MAX, maxValue = 44721; const long long llmax = LLONG_MAX, INF = (long long)1e9 + 1, mod = 998244353; long long nod(long long a, long long b) { while (a != 0 && b != 0) { if (a < b) b %= a; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<vector<char> > v; v.resize(n, vector<char>(m)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> v[i][j]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { i... |
#include <bits/stdc++.h> using namespace std; int main() { long long t, i, j, k, l, r; cin >> t; while (t--) { cin >> l >> r; if (l == r) { if (l % 2 == 0) cout << l << endl; else cout << - << l << endl; } else if (l % 2 == 1 && r % 2 == 1) { ... |
module fpga_memory
(
// input
// LSU
mem_wr_en, mem_rd_en,
mem_addr, mem_wr_data, mem_tag_req,
// MB
mb_data_in, mb_data_we, mb_ack, mb_done,
clk, rst,
// output
// LSU
mem_tag_resp, mem_rd_data, mem_ack,
// MB
mb_op, mb_data_out, mb_addr
);
input clk;
input rst;
... |
//-----------------------------------------------------------------------------
//
// Jonathan Westhues, April 2006
//-----------------------------------------------------------------------------
module hi_read_rx_xcorr(
pck0, ck_1356meg, ck_1356megb,
pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4,
adc... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; long long mod = 1e9 + 7; vector<long long> v; long long n, s; bool check(long long x) { long long sum = 0; for (long long i = 0; i < n; i++) { sum += (v[i] - x); } return sum >= s; } int main() { ios_bas... |
/*
* Milkymist 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 distribut... |
/**
* 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... |
//*****************************************************************************
// (c) Copyright 2009 - 2010 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 (c) 2001 Juergen Urban
*
* 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)
* any... |
#include <bits/stdc++.h> using namespace std; int T; string s, ans; bool exist[30]; int main() { scanf( %d , &T); for (int i = 0; i < T; i++) { cin >> s; ans.clear(); for (int j = 0; j < 26; j++) { exist[j] = false; } ans = s[0]; exist[s[0] - a ] = true; ... |
#include <bits/stdc++.h> using namespace std; const int N = 300050; const int L = 19; const long long inf = 1e15; vector<int> E[N]; int par[N][L], dep[N]; void DFS(int u, int p) { dep[u] = dep[p] + 1; par[u][0] = p; for (int i = 1; i < L; i++) par[u][i] = par[par[u][i - 1]][i - 1]; for (in... |
/*******************************************************************************
* 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 ... |
#include <bits/stdc++.h> using namespace std; int k, a[1001], i, j, poz, submisii_interesante, f[1001]; double ecran, fully_tested, n, timp = 1; struct coada { int x, y, z; }; vector<coada> v; int main() { cin >> n >> k; for (i = 1; i <= n; ++i) { cin >> a[i]; if (k) { v.pu... |
#include <bits/stdc++.h> using namespace std; long long n, parent[100002]; long long pl[100002], ans, dp[100002][22][5]; vector<long long> gr[100002]; long long ast[65]; void dfs(long long v) { for (long long i = 0; i <= 20; i++) { long long x = ((pl[v] >> i) & 1); dp[v][i][x]++; } l... |
#include <bits/stdc++.h> int main() { int n, k, i, st = 0, cnt = 0; scanf( %d %d , &n, &k); int a[n]; for (i = 0; i < n; i++) { scanf( %d , &a[i]); } for (i = 0; i < n && k > 0; i++) { if (a[i] <= 8) { k -= a[i], cnt++; if (st > 0 && st <= (8 - a[i])) k -=... |
#include <bits/stdc++.h> using namespace std; int N; bool valid(int P, int d, vector<int> guess) { if (P >= N) { return true; } if (P == 0) { if (valid(P + 1, d, guess)) return true; guess[P] -= d; if (valid(P + 1, d, guess)) return true; guess[P] += d; guess[P] += ... |
#include <bits/stdc++.h> using namespace std; template <class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << = << h << endl; } template <class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != , ) cerr << *sdbg++; cerr << = << h << , ; _dbg(sdb... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10, N = 2000; long long m, n, shroo, I[maxn], tmm, id[maxn], J[maxn], W[maxn], Su[maxn], dp1[maxn], dp2[maxn]; vector<pair<long long, long long> > hel1; vector<int> tmp, in[maxn], out[maxn]; bool amx(int i, int j) { return id[I[i]] >... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5; int n, u, v, tp; int par[2][N], sz[2][N]; long long ans; int find_set(int v) { if (par[tp][v] == v) return v; return par[tp][v] = find_set(par[tp][v]); } void union_sets(int a, int b) { a = find_set(a); b = find_set(b); ... |
module tb_fifo9togmii();
/* 125MHz system clock */
reg sys_clk;
initial sys_clk = 1'b0;
always #8 sys_clk = ~sys_clk;
/* 33MHz PCI clock */
reg pci_clk;
initial pci_clk = 1'b0;
always #30 pci_clk = ~pci_clk;
/* 62.5MHz CPCI clock */
reg cpci_clk;
initial cpci_clk = 1'b0;
always #16 cpci_clk = ~cpci_clk;
/* 125MHz R... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5 * 1e5; long long s[maxn], del[maxn], mark[maxn]; void build(int u, int l, int r) { if (l < r) { int mid = (l + r) / 2; build(u * 2, l, mid), build(u * 2 + 1, mid + 1, r); } else mark[u] = l; } long long query(int u, i... |
#include <bits/stdc++.h> using namespace std; int n, m, a[101000], tmp; struct C { int b, p; } c[101000]; long long ans = 0, tot; bool cmp(C c1, C c2) { return c1.b < c2.b; } priority_queue<int, vector<int>, greater<int> > q; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) s... |
// 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9
// 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0
//----------------------------------------------------------------------------------------
//
// The MIT License (MIT)
// Copyright (c) 20... |
/**
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's register file read operands mux ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { std::cerr << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<vector<int>> v; v.resize(n, vector<int>(7)); for (int i = 0; i < n; i++) { for (int j = 0; j < 7; j++) { scanf( %1d , &v[i][j]); } } int max_rooms = 0, cur = 0; for (int i = 0; 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... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; vector<int> path[1005]; long long d[105], t[105]; int n, m, u, v; queue<int> q; void work(int now) { for (int i = 1; i <= n; i++) { d[i] = 1 << 30; t[i] = 0; } d[now] = 0; t[now] = 1; q.push(now); while (!q.empty()) { u ... |
#include <bits/stdc++.h> using namespace std; void solve(int cases) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; int su = 0; for (int i = 0; i < n; i++) su += a[i]; sort(a, a + n); if (su == 0) { cout << NO n ; return; } cout << YES n ; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/06/06 20:44:21
// Design Name:
// Module Name: Mealy_FSM_ROM_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
// ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n; double res, t = 1e99; cin >> a >> b >> n; int x, y, v; int i; for (i = 0; i < n; i++) { cin >> x >> y >> v; res = hypot(x - a + 0., y - b + 0.) / v; t = min(t, res); } printf( %.10f n , t); ... |
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2011 by Wilson Snyder.
// Reported by Julian Gorfajn <>
module autoinst_multitemplate ();
/*AUTOINPUT*/
// Beginning of automatic inputs (from unused autoinst inputs)
input Boo2; // To suba2 of SubB.v
input Boo3; ... |
#include <bits/stdc++.h> using namespace std; void _fill_int(int* p, int val, int rep) { int i; for (i = 0; i < rep; i++) p[i] = val; } signed long long GETi() { signed long long i; scanf( %lld , &i); return i; } int N, X, Y; int mat[501][501]; int vis[501][501]; int LM[501], RM[50... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m, q, i, s, j, k, u, dis[N][350], lazy[350], W[N]; long long sum[N], arr[N], x, Y[350]; char c; vector<int> G[N], F[N]; bool H[N], is[N][350]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >>... |
/*
* Copyright (C)2014-2015 AQUAXIS TECHNOLOGY.
* Don't remove this header.
* When you use this source, there is a need to inherit this header.
*
* This software is released under the MIT License.
* http://opensource.org/licenses/mit-license.php
*
* For further information please contact.
* URI: http://ww... |
/* verilator lint_off STMTDLY */
/* verilator lint_off WIDTH */
module PLLE2_ADV #(
parameter BANDWIDTH = "OPTIMIZED",
parameter integer CLKFBOUT_MULT = 5,
parameter real CLKFBOUT_PHASE = 0.000,
parameter real CLKIN1_PERIOD = 0.000,
parameter real CLKIN2_PERIOD = 0.000,
parameter integer CLKOUT0_DIVIDE = ... |
#include <bits/stdc++.h> using namespace std; string now, st; vector<int> num[26]; int main(void) { int n, k; cin >> n >> k; cin >> st; for (int i = 0; i < (k); i++) { num[st[i] - a ].push_back(i); } for (int Case = 0; Case < (n); Case++) { cin >> now; long long res = ... |
#include <bits/stdc++.h> using namespace std; int n, m; int tot = 1; int b[200005], e[200005], h[200005], p[200005], u[200005]; vector<int> ans[200005]; void add(int x, int y) { b[++tot] = y; e[tot] = h[x]; h[x] = tot; } void dfs(int k, int fa_edge) { p[k] = 1; for (int go = h[k]; go... |
#include <bits/stdc++.h> using namespace std; /*<DEBUG>*/ #define tem template <typename #define can_shift(_X_, ...) enable_if_t<sizeof test<_X_>(0) __VA_ARGS__ 8, debug&> operator<<(T i) #define _op debug& operator<< tem C > auto test(C *x) -> decltype(cerr << *x, 0LL); tem C > char test(...); tem ... |
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
//
// Revision Control Information
//
// $RCSfile: altera_tse_rgmii_module.v,v $
// $Source: /ipbu/cvs/sio/projects/TriSpeedEthernet/src/RTL/MAC/mac/rgmii/alter... |
/**
* 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
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/06/07 13:06:03
// Design Name:
// Module Name: _3bit_binary_multiplier
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencie... |
#include <bits/stdc++.h> int n, k, s; int main() { scanf( %d%d , &k, &n); while (n > k && n % k == 0) { s++; n /= k; } if (n != k) printf( NO n ); else printf( YES n%d n , s); } |
#include <bits/stdc++.h> using namespace std; int n, i, nr, k[7], m; int main(void) { cin >> n; m = 0; for (i = 1; i <= n; i++) { cin >> nr; k[nr]++; } if ((k[1] + k[2] * 2 + k[3] * 3 + k[4] * 4 == 5) || (k[1] + k[2] * 2 + k[3] * 3 + k[4] * 4 < 3)) { cout << -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> using namespace std; using lli = long long; using Double = long double; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string s[9][3]; for (int i = 0; i < 9; ++i) { for (int j = 0; j < 3; ++j) { cin >> s[i][j]; } } ... |
//Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2016.2 (win64) Build Thu Jun 2 16:32:40 MDT 2016
//Date : Mon May 15 11:07:49 2017
//Host : DLAB running 64-bit Service Pack 1 (build 7601)... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; struct rec { int x1, y1, x2, y2; }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); vector<rec> v; int n; cin >> n; multiset<int> x1, x2, y1, y2; for (int i = 0; i < n; i++) { ... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.1
// Ultra-Embedded.com
// Copyright 2011 - 2014
//
// Email:
//
// ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_clk_cl_dram_jbus.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 ... |
// (C) 1992-2014 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 simulati... |
//////////////////////////////////////////////////////////////////////
//// ////
//// wb_master_model.v ////
//// ////
//// This file is part of the SPI I... |
#include <bits/stdc++.h> using namespace std; int a[10000], i, t, n, j, x; int main() { cin >> t; while (t--) { cin >> n; for (int i = 1; i <= n; i++) { cin >> x; if (x <= 2048) a[x]++; } j = 1; while (j < 2048) { a[j * 2] += a[j] / 2; a[j] = 0... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10, mod = 998244353; int n, p[N], c[N]; void add(int& x, int y) { x += y; if (x >= mod) { x -= mod; } } int mul(int x, int y) { return (long long)x * y % mod; } int qpow(int v, int p) { int result = 1; for (; p; p ... |
// (c) Copyright 1995-2017 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; const long long N = 1e5 + 5; const long long mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; long long a[n], b[n]; for (long long i = 0; i < n; i++) cin >> a[i]; for (long long i = 0; i ... |
// 21 Jul 2021
// A special module for use with HardFloat's mulAddRecFN for
// easy absorption of pipeline stages by the DSPs that get
// synthesised in some FPGAs. This helps in retiming the
// paths in FPGA implementations as only immediate registers
// are absorbed, and global retiming does not seem to do this.
/... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, x, y; cin >> n >> x >> y; long long a = y - n + 1; long long b = x - n + 1; for (long long i = a; i >= 1; i--) { long long c = i * i; if (c >= b)... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:300000000 ) const long double eps = 1e-20; const long double pi = acos(-1.0); const long long inf = 1000 * 1000 * 1000 * 1000 * 1000 * 1000; const long long base = 1000 * 1000 * 1000 + 7; using namespace std; int n, m, z, a[111111], x, y; bool fl;... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2003 Matt Ettus
//
// 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 2 of the License... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (scanf( %d , &n) == 1) { int ara[n + 4], diftab[n + 4]; ara[0] = 0; for (int i = 1; i <= n; i++) { scanf( %d , &ara[i]); diftab[i - 1] = ara[i] - ara[i - 1]; } int ansara[n + 1], index = 0; ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2018 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> int main() { int t; scanf( %d , &t); while (t--) { long long a, b, k; scanf( %lld %lld %lld , &a, &b, &k); printf( %lld n , (k / 2) * (a - b) + a * (k % 2)); } return 0; } |
#include <bits/stdc++.h> using namespace std; vector<long long int> ans; vector<long long int> allD; unordered_map<long long int, int> comp; const int MM = 1e4; const int LIM = 1e5; vector<long long int> gr[MM]; void solve(long long int N, long long int K) { if (K == 0 || N == 0) { ans.push_ba... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; inline int read() { char ch = getchar(); int x = 0, f = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x << 1) + (x << 3) - 0 + ch; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int n; int a[maxn]; long long dp[maxn][3][3]; int main(void) { scanf( %d , &n); for (int i = 0; i < n - 1; i++) scanf( %d , &a[i]); for (int i = 1; i < n; i++) { if (a[i - 1] == 0) continue; int b = a[i - 1]; ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 10, mod = 11092019; int n, m[2], leaf[N][2], dep[N][2], p[16][2][N], pre[N][2], dist[N][N][2], dp[N][2]; vector<int> adj[N][2]; void predfs(int u, int pa, int lst, bool st) { p[0][st][u] = pa; dep[u][st] = dep[pa][st] + 1; pre... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define int ll set<int> s; const int N = 200000 + 7; const int M = 998244353; int n; int a[N], pre[2][N], total[N]; int getsumx(int mod, int l, int r) { if (l > r) return 0; return pre[... |
#include <bits/stdc++.h> using namespace std; template <class A, class B> ostream &operator<<(ostream &os, pair<A, B> p) { return os << ( << p.first << , << p.second << ) ; } template <class A> ostream &operator<<(ostream &os, vector<A> v) { os << { ; for (auto &x : v) cout << x << ; ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Tue Sep 19 00:31:51 2017
// Host : DarkCube running 64-bit major release ... |
// ==============================================================
// 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 ... |
#include <bits/stdc++.h> using namespace std; long long fact[100005]; long long power(long long x, long long y, long long p) { long long res = 1; x = x % p; while (y > 0) { if (y & 1) res = ((res % p) * (x % p)) % p; y = y >> 1; x = ((x % p) * (x % p)) % p; } return res; } ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ctu_clsp_jbusgif.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 ... |
//==============================================================================
// File: $URL: svn+ssh:///public/Projects/GateLib/branches/dev/Firmware/UART/Hardware/UART.v $
// Version: $Revision: 26904 $
// Author: Greg Gibeling (http://www.gdgib.com)
// Copyright: Copyright 2003-2010 UC Berkeley
//===============... |
#include <bits/stdc++.h> using namespace std; const int NN = 50010; const int INF = 0x3f3f3f3f; const int MOD = 100000, STA = 8000010; const long long LNF = 1LL << 60; const double EPS = 1e-8; const double OO = 1e15; const int dx[4] = {-1, 0, 1, 0}; const int dy[4] = {0, 1, 0, -1}; const int day[13]... |
#include <bits/stdc++.h> int main() { int n; char a[20]; scanf( %d , &n); scanf( %s , a); char num[10]; for (int i = 2; i < 10; i++) { int c = 0; for (int j = 0; a[j]; j++) if (a[j] >= i + 0 ) c++; num[i] = c; } if (num[7] > 0) { for (int i = 2; i < 7... |
#include <bits/stdc++.h> template <typename T> inline void read(T &x) { x = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar(); } using namespace std; int n, m; struct Edge { int u, v, w, id; Edge() {} Edge(int jzp, i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, l, c, d, p, nl, np; cin >> n >> k >> l >> c >> d >> p >> nl >> np; int mls = k * l; int slices = c * d; int drinks = min(mls / nl, min(p / np, slices)) / n; cout << drinks << endl; } |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: test_stub_bist.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 an... |
#include <bits/stdc++.h> using namespace std; set<string> ans; string a; int dp[1000010][5]; int main() { cin >> a; int len = a.size(); reverse(a.begin(), a.end()); for (int i = 1; i < len - 5; ++i) { if (i == 1) { string s1 = ; s1 += a[i]; s1 += a[i - 1]; ... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> inline void chkmin(T1& a, T2 b) { if (a > b) a = b; } template <typename T1, typename T2> inline void chkmax(T1& a, T2 b) { if (a < b) a = b; } using ll = long long; using d = double; using ld = long double; ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 100005; vector<int> A, B[MAX], C, D; int visited[MAX]; int n, m; void DFS(int u) { visited[u] = 1; C.push_back(u); for (int i = 0; i < B[u].size(); i++) { int current = B[u][i]; if (visited[current] == 0) DFS(current); ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using pii = pair<int, int>; using vi = vector<int>; struct res { int x, t; bool operator<(const res &z) const { return x < z.x; } bool operator==(const res &z) const { re... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; vector<long long> p; int ho, mi, se; void fix_time() { if (se > 59) mi += se / 60, se = se % 60; if (se < 0) se += 60, mi--; if (mi > 59) ho += mi / 60, mi = mi % 60; if (mi < 0) mi += 60, ho--; if (ho < 0) ho += 24; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.