text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; inline long long read() { register char ch; while (!isdigit(ch = getchar())) ; register long long x = ch ^ 0 ; while (isdigit(ch = getchar())) x = (((x << 2) + x) << 1) + (ch ^ 0 ); return x; } vector<pair<long long, long long> > e[200005... |
// ***************************************************************************
// ***************************************************************************
// 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; int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } int lcm(int a, int b) { return (a * b) / gcd(a, b); } int fact(int n) { if (n == 0 || n == 1) return 1; else return n * fact(n - 1); } int main() { ios_base::... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(NULL); long long i, j, n, m; cin >> n; long long a[n - 1]; for (int i = 0; i < n - 1; i++) cin >> a[i]; long long dp[n][2][2]; memset(dp, 0, sizeof(dp)); for (int j = 0; j < 2; j++) ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x; long long amt = 0; cin >> n; vector<pair<int, int> > a; vector<int> p(n); vector<long long> count(6, 0); for (int i(0); i < (n); i++) { cin >> p[i]; } for (int i(0); i < (5); i++) { cin >> x; a... |
#include <bits/stdc++.h> long long minus(long long k) { return (1000000009LL - 1 + k) % 1000000009LL; } long long multiply(long long k) { return (k * 2) % 1000000009LL; } long long multiply(long long a, long long b) { return (a * b) % 1000000009LL; } int main() { int n, m; scanf( %d %d , &n, &m); lo... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int max = 0, min = 0; int a[m], b[m]; for (int i = 0; i < m; i++) { cin >> a[i]; b[i] = a[i]; } sort(a, a + m, greater<int>()); for (int i = 0; i < n; i++) { if (a[0] != 0) { ... |
/*
* Author: Oswaldo Cadenas <>
*/
module test;
parameter S = 9;
parameter K = 3;
parameter L = 2**(S-K);
parameter N = 2**(S-1);
reg signed [S-1:0] a_reg;
bit signed [S-1:0] a_bit;
byte signed a_byte;
shortint signed a_short;
int signed a_int;
longint signed a_long;
byte signed amount;
byte unsigned pos;
int temp;... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int h[5005]; int dp[5005][2505][2]; void test_case() { int n; scanf( %d , &n); for (int i = 1; i <= n; ++i) scanf( %d , &h[i]); memset(dp, INF, sizeof(dp)); dp[0][0][0] = 0; dp[1][0][0] = 0; dp[1][1][1] = 0; ... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, pair<int, int> > > horz, vert, tmp; set<int> y_com; map<int, int> y_map; void cleanup(vector<pair<int, pair<int, int> > >& v) { sort(v.begin(), v.end()); for (auto it = v.begin(); it != v.end();) { if (it != v.begin()) { auto... |
/*
* 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; inline int two(int n) { return 1 << n; } inline int test(int n, int b) { return (n >> b) & 1; } inline void set_bit(int& n, int b) { n |= two(b); } inline void unset_bit(int& n, int b) { n &= ~two(b); } inline int last_bit(int n) { return n & (-n); } int dist[... |
//////////////////////////////////////////////////////////////////////
//// ////
//// spi_top.v ////
//// ////
//// This file is part of the SPI I... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pci = pair<char, int>; using vi = vector<int>; using vll = vector<ll>; using vpii = vector<pii>; const ll infll = ... |
#include <bits/stdc++.h> using namespace std; map<string, long long> m; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); vector<pair<long long, long long> > v = { make_pair(1989, 1998), make_pair(1999, 2098), make_pair(2099, 3098), make_pair(3099, 13098... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void checkmin(T &a, T b) { if (b < a) a = b; } template <class T> inline void checkmax(T &a, T b) { if (b > a) a = b; } int cond = (long long)1; void _main() { int n, w, m; scanf( %d%d%d , &n, &w, &m); int gues... |
module ExecuteForwarding(p0, p1, p0Addr, p1Addr, regAddr_EX_MEM, regWe_EX_MEM, aluResult_EX_MEM, jal_EX_MEM, pcNext_EX_MEM, memRe_EX_MEM, regAddr_MEM_WB, regWe_MEM_WB, aluResult_MEM_WB, jal_MEM_WB, pcNext_MEM_WB, memRe_MEM_WB, memData_MEM_WB, writeData_WB, writeAddr_WB, writeEnable_WB, forwardP0, forwardP1, forwardStal... |
`timescale 1ns/10ps
`include "pipeconnect.h"
module bus_ctrl(input wire clk,
input wire rst,
// Master connections
input wire `REQ master1_req,
output wire `RES master1_res,
input wire `REQ master2_req,
... |
/**
* 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 func() { string s; cin >> s; long long n = s.length(); long long i = 1, len = 0, pre[n]; pre[0] = 0; while (i < n) { if (s[i] == s[len]) { len++; pre[i++] = len; } else { if (len == 0) { pre[i++]... |
//*****************************************************************************
// (c) Copyright 2009 - 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
/... |
#include <bits/stdc++.h> const double eps = 1e-9; const int inf = 2000000000; const double pi = acos(-1.0); const long long mod = 1000000007; using namespace std; char s[150]; int t; long long d[26 * 100 + 200][130]; int main() { scanf( %d n , &t); memset(d, 0, sizeof(d)); for (int num = 0... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long int n, i, x; cin >> n; long long int a[2 * n]; for (i = 0; i < 2 * n; i++) { cin >> a[i]; } sort(a, a + 2 * n); x = (a[n - 1] - a[0]) * (a[2 * n - 1] - a[... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
class ClsZ;
function new();
$display("ClsZ::new");
endfunction
endclass
class ClsA;
functi... |
// Booth encoding
// TODO: radix-4
module multiplier(
input clk,
input [WIDTH - 1 : 0] a,
input [WIDTH - 1 : 0] b,
output [WIDTH * 2 - 1 : 0] c
);
parameter WIDTH = 2;
wire [WIDTH : 0] _a;
wire [WIDTH : 0] _b;
wire [2 * WIDTH - 1 : 0] _c;
assign ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<int> res; for (int i = n + 1;; i++) { if (res.size() == n) { break; } res.push_back(i); } for (auto x : res) { cout << x << ; } } int main() { long long t... |
// ghrd_10as066n2_f2sdram2_m.v
// Generated using ACDS version 17.1 240
`timescale 1 ps / 1 ps
module ghrd_10as066n2_f2sdram2_m (
input wire clk_clk, // clk.clk
input wire clk_reset_reset, // clk_reset.reset
output wire [31:0] master_address, // master.a... |
//--------------------------------------------------------------------------------
//
// iomodules.v
// Copyright (C) 2011 Ian Davis
//
// 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;... |
// #####################################################################################
// # Copyright (C) 1991-2008 Altera Corporation
// # Any megafunction design, and related netlist (encrypted or decrypted),
// # support information, device programming or simulation file, and any other
// # associated ... |
#include <bits/stdc++.h> using namespace std; map<string, int> m; string s, c, a; int n, i, p; int main() { for (cin >> n >> s; i < n - 1; i++) { c += s[i]; c += s[i + 1]; m[c]++; if (p < m[c]) p = m[c], a = c; c.clear(); } cout << a; } |
#include <bits/stdc++.h> using namespace std; int pow(int a, int b, int c) { int ret = 1; for (; b; b >>= 1, a = 1LL * a * a % c) if (b & 1) ret = 1LL * ret * a % c; return ret; } const int N = 2e3 + 10, M = 4.05e6 + 10; int h[N], g[N], p[M], n1[M], ee, low[N], dfn[N], dfntot, vis[N], n, m, ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
// WARNING! THIS MODULE IS WORK IN PROGRESS! NOT TEST... |
/**
* ------------------------------------------------------------
* Copyright (c) SILAB , Physics Institute of Bonn University
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`include "firmware/src/fe65p2_mio.v"
module tb (
input wire FCLK_IN,
//full speed
... |
// Copyright 2007, Martin Whitaker.
// This code may be freely copied for any purpose.
module unnamed_generate_block();
localparam up = 1;
wire [2:0] count1;
wire [2:0] count2;
wire [2:0] count3;
generate
if (up)
count_up counter(count1);
else
count_down counter(count1);
endgenerate
generate
if (up... |
#include <bits/stdc++.h> using namespace std; int main() { size_t found; vector<string> str; string a, b, c, in, out; long long i, j, k, m, n, l, t; cin >> t; while (t--) { cin >> in; for (i = 0, j = 0, k = 0; i < in.size(); i++) { if (in[i] == : && i == 0) { ... |
#include <bits/stdc++.h> using namespace std; int N, H, M; int main() { scanf( %d%d:%d , &N, &H, &M); if (N == 24) { if (H / 10 >= 3) H %= 10; if (H / 10 == 2 && H % 10 >= 4) H %= 10; } else { if (H / 10 >= 2) { if (H % 10 == 0) H = H % 10 + 10; else ... |
/**
* 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... |
//Legal Notice: (C)2017 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... |
#include <bits/stdc++.h> using namespace std; const long long A = 100000000000000LL, N = 300228; long long t[N * 4], i, j, n, m, a[N], p[N], o, b, l, r; void modi(long long v, long long l, long long r, long long p, long long g) { if (p < l || p > r) return; if (l == r) { t[v] = g; return; ... |
#include <bits/stdc++.h> using namespace std; const long double pi = 3.1415926535897932384626433832795l; template <typename T> inline auto sqr(T x) -> decltype(x * x) { return x * x; } template <typename T1, typename T2> inline bool umx(T1& a, T2 b) { if (a < b) { a = b; return 1; ... |
/*
* chained_pll_tb.v: Test bench for chained plls.
* author: Till Mahlburg
* year: 2020
* organization: Universität Leipzig
* license: ISC
*
*/
`timescale 1 ns / 1 ps
`ifndef WAIT_INTERVAL
`define WAIT_INTERVAL 1000
`endif
`ifndef CLKIN1_PERIOD
`define CLKIN1_PERIOD 5
`endif
`ifndef CLKFBOUT_MULT
`define... |
`include "senior_defines.vh"
module fwd_ctrl(
input wire[`FWD_CTRL_WIDTH-1:0] ctrl_i,
input wire condition_p4_i,
input wire condition_p5_i,
input wire condition_wb_i,
input wire [`RF_CTRL_WIDTH-1:0] rf_ctrl_i,
output reg [`FWDMUX_CTRL_WIDTH-1:0] fwdmux_ctrl_o
);
wire p5_mux_mac;
//p5 in mac wants to wr... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; map<int, int> mmp; long long qpow(long long a, long long b, long long m) { long long ans = 1, aa = a; while (b) { if (b & 1) ans = ans * aa % m; aa = aa * aa % m; b >>= 1; } return ans; } int a[200010]... |
//------------------------------------------------------------------------------
// YF32 -- A small SOC implementation based on mlite (32-bit RISC CPU)
// @Taiwan
//------------------------------------------------------------------------------
//
// ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T sqr(T x) { return x * x; } const double EPS = 1e-6; const int INF = 0x3fffffff; const long long LINF = INF * 1ll * INF; const double PI = acos(-1.0); using namespace std; char g[505][505]; int cnt[505]; int dp[2][505][... |
/*
* 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; const int DBG = 0, INF = int(1e9); string toString(long long k) { stringstream ss; ss << k; string res; ss >> res; return res; } int toInt(string s) { stringstream ss; ss << s; int res; ss >> res; return res; } int main(... |
/*
* 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() { ios::sync_with_stdio(false); long long int x1, y1; cin >> x1 >> y1; long long int x2, y2; cin >> x2 >> y2; int n; cin >> n; int ans = 0; for (int i = 0; n > i; i++) { long long int a, b, c; cin >> a >> b >> c;... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// 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)
// ... |
/******************************************************************************/
/* */
/* Copyright (c) 1999 Sun Microsystems, Inc. All rights reserved. */
/* ... |
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef long double ld; //typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set; template<class T1, class T2> ostream &op... |
#include <bits/stdc++.h> using namespace std; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << ; cout << endl; } template <class T> void chmin(T &t, const T &f) { if (t > f) t = f; } template <class T> void chmax(T &t, const T &f) { if (t < f) t = f; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:12:22 08/30/2014
// Design Name: lab4dpath
// Module Name: C:/ece4743/projects/lab4_part1_solution/tb_lab4dpath.v
// Project Name: lab4_part1_solution
// Target D... |
#include <bits/stdc++.h> using namespace std; const int N = 1510; const int MOD = 1000000007; const int SZ = 100010; inline int add(int u, int v) { return (u += v) >= MOD ? u - MOD : u; } inline int sub(int u, int v) { return (u -= v) < 0 ? u + MOD : u; } inline int mul(int u, int v) { return (long long)u... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> const int Maxn = 1000 * 1000 + 10; using namespace std; int main() { vector<int> A[10000]; int B[10000]; int n; cin >> n; n *= 2; int e[10000]; for (int i = 0; i < n; i++) { int a; cin >> a; A[a].push_back(i); B[i] = a; } bool k ... |
`default_nettype none
module memory_pipe_arbiter(
input wire iCLOCK,
input wire inRESET,
//Data(Core -> Memory)
input wire iDATA_REQ,
output wire oDATA_LOCK,
input wire [1:0] iDATA_ORDER,
input wire [3:0] iDATA_MASK,
input wire iDATA_RW,
input wire [13:0] iDATA_TID,
input wire [1:0] iDATA_MMUMOD,
... |
/*
* Copyright (c) 2015-2017 The Ultiparc Project. 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... |
/*
* mmcme2_base.v: Simulates the MMCME2_BASE pll of the Xilinx 7 series. This
* is just a wrapper around the actual logic found in pll.v
* author: Till Mahlburg
* year: 2020
* organization: Universität Leipzig
* license: ISC
*
*/
`timescale 1 ns / 1 ps
/* A reference for the interface can be found in Xilinx ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using lli = long long int; using str = string; const ll MOD = 1e9 + 7; void solve() { ll a, b, c; cin >> a >> b >> c; cout << a + b + c - 1 << n ; return; } int main() { ios_base::sync_with_stdio(false); cin.ti... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
`default_nettype none
`timescale 1ns / 1ps
`include "../src/message_formatter.v"
// ============================================================================
module tb;
// ============================================================================
reg CLK;
initial CLK <= 1'b0;
always #0.5 CLK <= !CLK;
reg [3:... |
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 1; cin >> n; vector<vector<int>> graph(n + 1); vector<bool> visit(n + 1); vector<int> color(n + 1); for (int i = 1; i < n; i++) { int a, b; cin >> a >> b; graph[a].push_back(b); graph[b].push_back... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_unchange (clock, reset, enable, start_event, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; int nLund0 = 0; int nRund0 = 0; int n00 = 0; int nL = 0; int nR = 0; auto zaehle = [&](char c1, char c2) -> void { if ((c1 == > && c2 == - ) || (c2 == > ... |
// IS61LV25616 Asynchronous SRAM, 256K x 16 = 4M; speed: 10ns.
// Note; 1) Please include "+define+ OEb" in running script if you want to check
// timing in the case of OE_ being set.
// 2) Please specify access time by defining tAC_10 or tAC_12.
`define OEb
`define tAC_10 //tAC_10 or tAC_12 define... |
#include <bits/stdc++.h> template <typename T> inline void read(T &x) { bool b = 0; char c; while (!isdigit(c = getchar()) && c != - ) ; if (c == - ) c = getchar(), b = 1; x = c - 48; while (isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - 48; if (b) x = -x; } template <... |
#include <bits/stdc++.h> using namespace std; const double fs = 6e-2, Pi = acos(-1.0); struct point { double x, y; } p[4]; double a, b, c, r, S, C, P, C1, A1, B1, R1, Ans; double s(point a, point b) { return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); } double gcd(double a, doub... |
/*
*--------------------------------------------------------------
* This module converts a counter value N into a reset value
* for an 8-bit LFSR. The count is initialized by "reset" high
* or "start" transition high. When the count is valid, it is
* latched into "dp" and the signal "done" is raised to indicat... |
//////////////////////////////////////////////////////////////////
// //
// Wishbone master interface for the Amber core //
// //
// This file is part of the Amber project ... |
`timescale 1ns / 1ps
/*
module OpDecoder(clk, );
// we: Write Enable
input clk, we;
input [15:0]addr;
input [31:0]wdata;
output [31:0]data;
reg [3:0] state;
assign data = rom[addr];
always @ (posedge clk)
begin
if(we == 1) begin
rom[addr] = wdata;
end
end
initial
begin
$readmemh("rom.he... |
#include <bits/stdc++.h> using namespace std; struct node { int x, h, id; } a[100005]; int n, i, j, f[100005], ans[100005]; bool cmp(node x, node y) { if (x.x != y.x) return x.x < y.x; else return x.h < y.h; } int main() { scanf( %d , &n); for (i = 1; i <= n; i++) { s... |
/*******************************************************************************
* 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 ... |
`timescale 1 ns / 1 ps
module phase_unwrapper #
(
parameter integer DIN_WIDTH = 16,
parameter integer DOUT_WIDTH = 32
)
(
input wire clk,
input wire acc_on,
input wire rst,
input wire signed [DIN_WIDTH-1:0] phase_in,
output wire signed [DIN_WIDTH+1-1:0] freq_out,
output reg signed [DOUT_WIDTH-1:0] ... |
/*******************************************************************************
* 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; void init_code() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } set<pair<int, int>> es; map<int, list<int>> m; void add(int a, int b) { m[a].push_back(b); m[b].push_back(a); } int v[1001]; void dfs(int node) { v[node] = 1; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:43:27 04/04/2016
// Design Name: Top
// Module Name: C:/Users/Ranolazine/Desktop/lab5_better_io/test_for_top.v
// Project Name: lab5
// Target Device: ... |
#include <bits/stdc++.h> using namespace std; bool G[100005]; bool use[100005]; int top[100005]; int Top[100005]; char R[100005]; int num[100005]; int main() { int m, n, Len = 0, useLen = 0; char str[10]; memset(G, true, sizeof(G)); memset(use, false, sizeof(use)); scanf( %d%d , &n, ... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int n, sz; vector<int> vec[MAXN]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; cout << n - 1 << n ; for (int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; a--, b--; vec... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; const double PI = acos(-1.0); const long long MOD = 1000000007LL; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmi... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int a, b, c, d, m, n, p, q, r, x, y, z, aa, bb, cc, dd; double pp, qq, rr, xx, yy, zz; char ch1, ch2, ch3, ch4, ch5; long long int i, j, k, l; long long int cnt = 0, cnt1 = 0, cnt2 = 0, cnt3 = 0, sum = 0, sum2 = 0, ... |
#include <bits/stdc++.h> using namespace std; int d[1008][1008]; int main() { int n, x1, x2, y1, y2; int di[] = {0, 0, 1, -1}; int dj[] = {1, -1, 0, 0}; cin >> n >> x1 >> y1 >> x2 >> y2; int i, j, k; d[n - y1][x1] = 1; queue<int> qi, qj, dist; qi.push(n - y1); qj.push(x1); ... |
#include <bits/stdc++.h> using namespace std; template <class T> bool umin(T &x, T y) { return y < x ? x = y, 1 : 0; } template <class T> bool umax(T &x, T y) { return y > x ? x = y, 1 : 0; } const int N = 505; int n, m, g[N][N][2]; bitset<N> dp[100][2][N], ok, tmp; signed main() { cin... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:08:01 02/19/2016
// Design Name: tp_final
// Module Name: /home/poche002/Desktop/ArqComp/Trabajo_final/arquitectura_tpf/tp_final_tb.v
// Project Name: arquitectur... |
#include <bits/stdc++.h> using namespace std; long long int pow(long long int x, long long int y, long long int m) { long long int res = 1; x = x % m; while (y > 0) { if (y & 1) res = ((res % m) * (x % m)) % m; y = y >> 1; x = ((x % m) * (x % m)) % m; } return res % m; } te... |
/**
* 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; const int N = 2e5 + 7; map<long long, int> cnt; bool vis[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; long long a[n]; memset(vis, 0, sizeof(vis)); for (int i = 0; i < n; i++) { long long x; ... |
#include <bits/stdc++.h> using namespace std; const int N = 55, mod = 1LL * 1000 * 1000 * 1000 + 7; int dp[N][N][2], ans[N][N][2], n, cnt50, cnt100, W, c[N][N], seen[N][N]; bool vis[N][N][2], vis2[N][N][2]; int C(int r, int n) { if (r == 0 || r == n) return 1; if (r > n) return 0; if (seen[r][n]) ... |
#include <bits/stdc++.h> using namespace std; const int mx = 1e6 + 50; bool tot[10000050]; vector<int> prime; void seive() { for (int i = 2; i * i <= mx; i++) { if (!tot[i]) { for (int j = (2 * i); j <= mx; j += i) { tot[j] = true; } } } for (int i = 2; i <= m... |
#include <bits/stdc++.h> using namespace std; const int N = 110; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int al, ar, bl, br; cin >> al >> ar >> bl >> br; if ((al * 2 + 3 > br && br >= al - 1) || (ar * 2 + 3 > bl && bl >= ar - 1)) cout << YES << endl; ... |
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template <class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } int main() { int n; cin >> n; static long long dp[100][100][... |
#include <bits/stdc++.h> using namespace std; int n, m; int dir[405][405], dic[405][405]; int main() { memset(dir, 63, sizeof(dir)); memset(dic, 63, sizeof(dic)); scanf( %d %d , &n, &m); for (int i = 1, x, y; i <= m; i++) { scanf( %d %d , &x, &y); dir[x][y] = dir[y][x] = 1; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; long long n, m, b, ans; long long a[1005]; int l, r, mid; long long dp[1005][1005]; struct Node { long long w, id; } f[1005]; bool cmp(Node a, Node b) { if (a.w != b.w) return a.w < b.w; return a.id > b.id; } int main()... |
/**
* 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() { int n; cin >> n; long long row1[n], row2[n]; for (int i = 0; i < n; i++) cin >> row1[i]; for (int i = 0; i < n; i++) cin >> row2[i]; long long first, second, pref = 0, pres = 0; for (int i = 0; i < n; i++) { first = max(pre... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: check_fifo.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.