text stringlengths 59 71.4k |
|---|
// file: SysMon.v
// (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
// laws.
//
// DISCLAIMER
// This disclaimer is not a license... |
#include <bits/stdc++.h> using namespace std; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const int INF = 1000000000; const long long LINF = 1000000000000000000; const long long MOD = 1000000007; const double PI = acos(-1.0); const double EPS = 1e-10; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:26:11 07/23/2010
// Design Name:
// Module Name: dac_test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; int main() { int x, y, z, q, w, e; cin >> x >> y >> z >> q >> w >> e; int leg = 0; int el = 0; leg = abs(x - y) * q; el = 3 * e + abs(x - z) * w + abs(y - x) * w; if (el <= leg) { cout << YES ; } else { cout << NO ; } ... |
//////////////////////////////////////////////////////////////////////
// File: CRC32.v
// Date: Thu Nov 27 13:56:49 2003
//
// Copyright (C) 1999-2003 Easics NV. ... |
`timescale 1ns/100ps
module fft_8 (
clk,
rst,
butt8_real0,
butt8_imag0,
butt8_real1,
butt8_imag1,
butt8_real2,
butt8_imag2,
butt8_real3,
butt8_imag3,
butt8_real4,
... |
#include <bits/stdc++.h> using namespace std; int m; char s[15]; int ans[1005]; bool num[15]; bool dfs(int suml, int sumr, int cot, int pre) { if (cot == m + 1) return true; if (cot & 1) { for (int i = 1; i <= 10; i++) if (num[i] && i != pre && suml + i > sumr) { ans[cot] = i... |
// (C) 2001-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 doc... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*
*
*/
`timescale 1ns/10ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) { return a; } return gcd(b, a % b); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; long long g = 0; for (int i = 0; i < 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... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const long long N = 1e5 + 10; const long long mod = 1e9 + 7; const long long inf = -1e18; const long long INF = 1e18; long long bin_pow(long long n, long long k) { if (k == 0) return 1; if (k == 1) return n; if (n == 0) r... |
module cameraReader
#(
parameter x_size = 640,
parameter y_size = 480
)
(
input clk,
input reset_n,
output refclk,
input pclk,
input [7:0] data,
input vsync,
input hsync,
output reg [15:0] data_out = 0,
output wire wrreq,
output wire wrclk
);
reg [19:0] pixel_counter = 0;
assign refclk = reset_n == 1... |
#include <bits/stdc++.h> using namespace std; long long aa[33]; long long a[33], b[33], k[33], p[33]; long long n, u, r; long long ans = -1e10; void dfs(long long d, long long pre) { if ((u - d) % 2 == 0) { long long t = 0; for (int i = 1; i <= n; i++) t = t + a[i] * k[i]; ans = max(an... |
#include <bits/stdc++.h> using namespace std; int mod = 998244353; int main() { ios_base ::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; long long int fac[n + 1]; fac[0] = 1; for (int i = 1; i <= n; i++) { fac[i] = fac[i - 1] * i; fac[i] %= mod; } ... |
#include <bits/stdc++.h> using namespace std; int main() { string s, t; while (cin >> s >> t) { int n = s.size(); string res; for (int i = n - 1; i >= 0; --i) { char& c = s[i]; ++c; int x = 0; if (c > z ) { c = a ; x = 1; } ... |
#include <bits/stdc++.h> using namespace std; inline bool check(int x) { for (; x; x /= 10) if (x % 10 != 4 && x % 10 != 7) return 0; return 1; } const int maxn = 100100; int head[maxn], nxt[maxn << 1], ver[maxn << 1], val[maxn << 1], tot; inline void addedge(int a, int b, int c) { nxt[++t... |
module IF_STAGE(
input clk,
input rst,
input instr_fetch_enable,
input [5:0] imm_branch_offset,
input branch_enable,
input jump,
output [7:0] pc,
output [15:0] instr
);
wire[7:0] PCI;
wire[7:0] PCO;
wire[7:0] PCAdd1O;
wire[7:0] PC1AddBr8;
wir... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, i, k = 0; cin >> n; int a[n]; map<int, int> m; set<int> s; for (i = 0; i < n; i++) { cin >> a[i]; m[a[i]]++; k = max(k, m[a[i]]); } for... |
/*
* 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; struct ilter { int job; long long ti; bool operator<(const ilter &a) const { return a.ti > ti; } } T[100001]; int s, c; long long TIME; int main() { map<int, int> M2; int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { cin >>... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv) { string i, o; cin >> i >> o; sort(i.begin(), i.end()); if (i == 0 && i == o) { cout << OK << endl; return 0; } unsigned int z; for (z = 0; z < i.length() && i[z] == 0 ; ++z) ; while ... |
// This module generate M single 2*HW-1 bit vector each T time steps
module stimulus #(parameter HW = 4, T = 10, M = 200) (
output reg [2*HW-1:0] a
);
int i;
int MAX;
initial begin
MAX = 1 << 2*HW;
for (i = 0; i < M; i=i+1) begin
a = $random % MAX ;
#T;
end
end
end... |
#include <bits/stdc++.h> int check_matrix(int** arr, int n, int m) { int itN = 0, itJ = n - 1; if (n % 2) return n; while (itN < itJ) { for (int i = 0; i < m; ++i) if (arr[itN][i] != arr[itJ][i]) return n; itN++; itJ--; } return check_matrix(arr, n / 2, m); } int main... |
module alt_vipitc131_common_sync
#(parameter
CLOCKS_ARE_SAME = 0,
WIDTH = 1)
(
input wire rst,
input wire sync_clock,
input wire [WIDTH-1:0] data_in,
output wire [WIDTH-1:0] data_out);
(* altera_attribute = "-name SYNCHRONIZER_IDENTIFICATION FORCED_IF_ASYNCHRONOUS; -name SD... |
/**
* 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... |
/**
* Embedded Systems (EECE6017C) - Lab 3
* Simple Processor
* Author(s): Alex Stephens <> (AWS)
* Josh Boroff <> (JBB)
* Adam Wilford <> (AFW)
* Target FPGA: Altera Cyclone II 2C20 (EP2C20F484C7)
* Tool: Quartus II 64-bit
* Version: 13.0.1 sp1
*
* Development Log:
* Date Devel... |
//faux_hd_command_layer.v
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation t... |
#include <bits/stdc++.h> using namespace std; int vis[15]; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int a[3]; memset(vis, 0, sizeof(vis)); for (int i = 0; i < 3; i++) cin >> a[i]; int ans = 0; for (int i = 0; i < 3; i++) { ... |
// Copyright (c) 2016 CERN
// Maciej Suminski <>
//
// 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 late... |
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ===========================================================
`timescale 1 ns /... |
// generated by gen_VerilogEHR.py using VerilogEHR.mako
// Copyright (c) 2019 Massachusetts Institute of Technology
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction... |
module spi_tb ();
// UUT Parameters
parameter LOG2_DEPTH = 4;
// UUT Signals
wire nCs;
wire mosi;
wire miso;
wire sck;
wire [7:0] doutMaster;
wire [7:0] doutSlave;
wire txDataPresentM;
wire txHalfFullM;
wire txFullM;
wire rxDataPresentM;
wire rxHalfFullM;
wire rxFullM;
wire txDataPresentS;
wire tx... |
#include <bits/stdc++.h> int main() { int n, result, count = 0, i; scanf( %d , &n); char arr[n]; for (i = 0; i < n; i++) { scanf( n%c , &arr[i]); } i = 0; for (i = 0; i < n; i++) { if (arr[i] != arr[i - 1]) { count++; } } if (count + 2 < n) { result... |
#include <bits/stdc++.h> using namespace std; int n, m, t1, t2; vector<int> q1, q2; vector<vector<int> > Visted; int des(int point1, int point2, int point3, int point4) { return abs(point1 - point3) + abs(point2 - point4); } int main() { cin >> n >> m >> t1; Visted.resize(n + 10, vector<int>(m... |
//
// my_fpga_test_count_dn_1k.v
//
`timescale 1ns/1ps
`define ms(t) (t * 1e6)
`define ns(t) (t)
module my_fpga_test_count_dn_1k;
reg clk = 0, n_rst = 0;
reg up = 0, dn = 0;
wire [31:0] cnt;
wire [3:0] cnt_1k;
reg in1 = 0, in2 = 0;
wire out1, out2;
time t, u;
my_fpga uut(clk, n_rs... |
#include <bits/stdc++.h> using namespace std; int ncr(int n, int r) { int ret = 1; for (int i = 1; i <= n - r; i++) { ret = (ret * (n - r + i)) / i; } return ret; } int main() { int n; cin >> n; int x; long long pos = 0; long long neg = 0; long long prod = 1; fo... |
#include <bits/stdc++.h> int main() { int i, n, x = 2; scanf( %d , &n); for (i = 0; i < n - 1; i++) { printf( %d , x); x += (2 + i); if (x > n) x -= n; } return 0; } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; vector<int> v[200005]; int t1[200005], t2[200005]; bool vis[200005]; int n, x, a, b; void dfs1(int step, int t) { t1[step] = t; vis[step] = true; for (int i = 0; i < v[step].size(); i++) { if (!vis[v[step][i]]) dfs1(v[step][i], t + 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; signed main() { string s; cin >> s; int n = s.size(); if (n == 1) { cout << 0; return 0; } int ans = 0; int co = 1; vector<pair<char, int> > c; for (int i = 1; i < n; i++) { if (s[i] != s[i - 1]) { c.emplace_... |
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c = 0; cin >> a; b = 1; while (c < a) { c = (b * (b + 1)) / 2; b++; } b--; if (c == a) cout << b << endl; else { cout << b - c + a << endl; } } |
#include <bits/stdc++.h> using namespace std; const double eps = 1E-8; const int dx4[4] = {1, 0, 0, -1}; const int dy4[4] = {0, -1, 1, 0}; const int inf = 0x3f3f3f3f; const int N = 2E5 + 7; int tree[2][N]; int a[N], p[N]; int n; long long k; int lowbit(int x) { return x & (-x); } void update(int... |
module divisorprueba (
input reset,
input [7:0] count,
input calculate,
input clk,
output [3:0] an,
output [6:0] seg
);
//wire [7:0] count;
wire [7:0] d;
wire [3:0] centenas;
wire [3:0] decenas;
wire [3:0] unidades;
divisor divisor0 (
.reset ( reset ),
.count... |
#include <bits/stdc++.h> using namespace std; using namespace std; vector<vector<int> > g; vector<int> depth; void dfs(int v, int d = 0) { depth[v] = d; for (int to : g[v]) { if (depth[to] == -1) { dfs(to, d + 1); } } } int main() { int n, m; cin >> n >> m; g.re... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { while (a % b != 0) { long long aux = a % b; a = b; b = aux; } return b; } int main() { ios::sync_with_stdio(0); cin.tie(); int n; cin >> n; for (int i = 1; i <= n; i++) { ... |
// (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; int n, m, a[200200], w[200200], dp[3030][3030], ep[3030][3030], X, Y, Z, ans[200200], Inv[2 * 3030 + 5]; const int mod = 998244353; int expmod(int x, int n) { int rlt = 1; while (n) { if (n & 1) rlt = 1ll * rlt * x % mod; x = 1ll * x * x % ... |
#include <bits/stdc++.h> using namespace std; const int N = 500005; const int mod = 1e9 + 7; int n, m, l[N], r[N], f[N], sum[N]; vector<int> g[N]; vector<int> cmp; int main() { scanf( %d %d , &n, &m); for (int i = 0; i < m; ++i) { scanf( %d %d , l + i, r + i); cmp.push_back(r[i]); ... |
#include <bits/stdc++.h> using namespace std; const int M = 1e5 + 5; const int inf = 1e9 + 5; const int mod = 1e9 + 7; vector<int> v[M]; int hx2[2 * M]; int hx[M]; int nxt[M]; int n, m; int KMP() { memset(nxt, 0, sizeof(nxt)); int la, lb; la = n; lb = m; int j, k; j = 0; ... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
//
// Module: in_arb_regs.v
// Project: NF2.1
// Description: Demultiplexes, stores and serves register requests
//
///////////////////////////////////////////////////////////////////////////... |
/**
* 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: 21:51:35 06/09/2014
// Design Name:
// Module Name: GrayCounter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<queue> #define ll long long using namespace std; const int N=310,M=100005,mod=1e9+7; int n,tot; ll inv,ans; int head[N],ver[M],Nxt[M],dep[N],fa[N][20]; ll f[N][N]; void add(int x,int y){ ver[+... |
`include "raycast_defines.v"
module raycast_core_master
(
clk, rst,
// WB Master
m_wb_adr_o, m_wb_dat_i,
m_wb_cyc_o, m_wb_stb_o,
m_wb_ack_i,
init_i, pop_i,
root_adr_i,
idx_flip_i,
node_data_req_i,
node_data_ready_o,
node_data_o
);
// = Parameters =
parameter stack_size = 2;
parameter s... |
/*
Copyright (C) {2014} {Shawn Jain} <>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the ho... |
#include <bits/stdc++.h> using namespace std; long long bigmod(long long b, long long p) { if (p == 0) return 1; long long my = bigmod(b, p / 2); my *= my; my %= 1000000009; if (p & 1) my *= b, my %= 1000000009; return my; } int setb(int n, int pos) { return n = n | (1 << pos); } int r... |
// See Line 54
module hangcase (/*AUTOARG*/);
//
assign w_rdat_ena = ({16{foo[ 0]}} & bar ) |
({16{foo[ 1]}} & bar ) |
({16{foo[ 2]}} & bar ) |
({16{foo[ 3]}} & bar ) |
({16{foo[ 4]}} & bar ) |
... |
/*
* 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 (c) 2000 Intrinsity, Inc.
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { long long n, k; cin >> n >> k; multiset<pair<long long, long long>> s; vector<tuple<long long, long long, long long>> v; long long i; for (i = 0; i < n; i++) { long long a, b, p; cin >> a >> b >> p; s.insert({(a... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/* verilator lint_off UNDRIVEN */
/* verilator lint_off UNUSED */
module axi_rom (
clk,rstn,
axi_ARVALID,
axi_ARREADY,
axi_AR,
axi_ARBURST,
axi_ARLEN,
axi_R,
axi_RVALID,
axi_RREADY,
axi_RLAST
);
input clk,rstn;
input axi_ARVALID,axi_RREADY;
output reg axi_ARREADY,axi_RVALID;
output reg axi... |
/*
* 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... |
/* wb_mux. Part of wb_intercon
*
* ISC License
*
* Copyright (C) 2013-2019 Olof Kindgren <>
*
* 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.
... |
#include <bits/stdc++.h> using namespace std; int n, m, num, cnt; int dat[1009][1009], ans[1000009]; bool vis[1009][1009]; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, 1, 0, -1}; int wall[4] = {8, 4, 2, 1}; void dfs(int x, int y) { if (vis[x][y] || x < 0 || x > n || y < 0 || y > m) return; vis[x][... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; long long a[N][N], dp[N][N][4]; int n, m; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> a[i][j]; for (int i = 1; i <= n; i++) ... |
#include <bits/stdc++.h> int W[21][11]; void F() { W[1][1] = 0; W[1][2] = 0; W[1][3] = 0; W[1][4] = 0; W[1][5] = 0; W[1][6] = 0; W[1][7] = 0; W[1][8] = 0; W[1][9] = 0; W[1][10] = 0; W[2][1] = 0; W[2][2] = 0; W[2][3] = 0; W[2][4] = 0; W[2][5] = 0; W[2][... |
/**
* 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 = 100000 + 5; int b[maxn]; int g[maxn]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , &b[i]); for (int i = 1; i <= m; i++) scanf( %d , &g[i]); long long sum = 0; sort(b + 1, b + n + 1)... |
#include <bits/stdc++.h> using namespace std; int ans, ansIndex, n, s, x, val, res = 2000000006; int main() { scanf( %d%d%d , &n, &s, &x); int nxt = s, m = min(800, n); for (int i = 0; i < m; i++) { printf( ? %d n , (rand() * 107 + rand()) % n + 1); fflush(stdout); scanf( %d %d , &va... |
/**
* 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 tests the synthesis of a very sparse case statement. The
* combinational case statement below specifies only two of 256
* possible selections, with all the remaining left to the default.
* What's more, all the inputs to the MUX are constant, giving
* even further opportunity for optimization.
*/
module ... |
/*
* 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 ar[1002][1002]; char buf[20]; int main() { int n, m, k, w; int res = 0; vector<pair<int, int> > r; scanf( %d %d %d %d n , &n, &m, &k, &w); vector<vector<string> > f(k); for (int i = 0; i < k; i++) { for (int j = 0; j < n; j++) { ... |
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2013, 2014 Rok Krajnc //
// ... |
`timescale 1ns / 1ps
//File: MusicSheetReader.v
//Author: Jianjian Song
//Date: May 11, 2012
//Purpose: Read a music sheet from memory MusicScore
//module MusicScore(ReadOrWrite, Address, KeyInput, KeyOutput, TimeInput, TimeOutput,Clock, Reset);
//Start reading when Start=1. Read from StartAddress until the end when Ke... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000 * 1000 + 17, sq = 1000; int n, a[MAXN]; vector<pair<int, int> > p; bool cmp(int i, int j) { i--, j--; if (p[i].first / sq != p[j].first / sq) return p[i].first < p[j].first; return ((p[i].first / sq) % 2 ? p[i].second > p[j].secon... |
// Copyright 1986-1999, 2001-2013 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2013.4 (lin64) Build 353583 Mon Dec 9 17:26:26 MST 2013
// Date : Mon Mar 24 21:51:05 2014
// Host : macbook running 64-bit unk... |
#include <bits/stdc++.h> using namespace std; void fileioe() { freopen( input.txt , r , stdin); freopen( xyz.txt , w , stdout); freopen( error.txt , w , stderr); } const long long mod = 1000000007; const long long INF = 1e18; const long long MAX = 100001; void solve() { long long n; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, m, i; cin >> n; if (n < 4) { cout << NO << endl; return 0; } cout << YES << endl; if (n % 2) cout << 5 * 4 = 20 << endl << 20 + 3 = 23 << endl <<... |
#include <bits/stdc++.h> using namespace std; using Long = int64_t; constexpr Long Z = 0; bool fire(Long N, Long M, int K, const vector<Long>& X, const vector<Long>& Y, Long t) { map<Long, int> xs; map<Long, int> ys; xs[0] = 0; xs[N] = 0; ys[0] = 0; ys[M] = 0; for (int i ... |
#include <bits/stdc++.h> struct City { long long g; long long w; long long gf; long long bg; long long minbg; }; class Data { public: City cities[100000]; int n; int k; long long gifts; long long gas; long long nextGas; int maxL; City* end; City* head; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long maxi = LLONG_MIN; for (long long i = 1LL; i <= n; i++) { long long x, y; cin >> x >> y; maxi = max(maxi, x + y); } cout << maxi << endl; } |
#include <bits/stdc++.h> using namespace std; vector<vector<long long int> > v, dp; long long int ans, k; void dfs(long long int u, long long int par) { long long int i; dp[u][0] = 1; for (auto it : v[u]) { if (it == par) continue; dfs(it, u); for (i = 1; i <= k; i++) ans += dp[it]... |
#include <bits/stdc++.h> using namespace std; long double f[1011][1011]; int m, n; void init() { memset(f, 0, sizeof f); f[1][1] = 1; for (int i = (1), _b = (n - 1); i <= _b; i++) { for (int x = (0), _b = (min(i, m)); x <= _b; x++) if (f[i][x] > 1e-50) { f[i + 1][x] += f[i][x... |
/**
* 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 read() { int x = 0, f = 1; char a = getchar(); for (; !isdigit(a); a = getchar()) if (a == - ) f = -1; for (; isdigit(a); a = getchar()) x = x * 10 + a - 0 ; return x * f; } const unsigned long long INF = 1ULL << 63; const int N = 2... |
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n; cin >> n; vector<long long> tpa[6], tpb[4]; long long amt[6]; fill(amt, amt + 6, 0); for (long long i = 0; i < n; ++i) { long long a, b, c; cin >> a >> b >... |
// ***************************************************************************
// ***************************************************************************
// 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> #pragma GCC optimize( O3 ) using namespace std; inline void solve() { int n; cin >> n; vector<int> a(n); for (int& e : a) { cin >> e; } long long b = a[0]; for (int i = 0; i < n - 1; ++i) { int d = a[i + 1] - a[i]; if (d < 0) { b += d;... |
#include <bits/stdc++.h> using namespace std; int n, d; long long h[100001]; struct A { long long h; int i; bool operator<(const A &B) const { return h < B.h || h == B.h && i < B.i; } } H[100001]; map<long long, int> MP; map<long long, int> MPSORT; int N, Kn; int st[100001 << 2]; int sti... |
#include <bits/stdc++.h> using namespace std; vector<vector<int>> edge; int n, m; int parent[100000]; int size[100000]; int visited[100000]; int finished[100000]; int has_loop[100000]; int find_root(int v) { if (parent[v] == -1) { return v; } return parent[v] = find_root(parent[v]); ... |
#include <bits/stdc++.h> using namespace std; signed main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<int> cnt(200002, 0); for (int i = 0; i < n; i++) { cnt[a[i]]++; } int mx = 0; int res = 0; for (int i = 0; i < ... |
#include <bits/stdc++.h> using namespace std; int head[100005], nxt[200005], v[200005], w[200005], tot = 0; int fa[100005], rk[100005]; int p[100005], k[100005], n, m; long long d[100005]; struct node { int a, b, c; long long len; } e[100005]; queue<int> q; inline int read() { int x = 0; ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: credit_ff_async.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// =======================================... |
#include <bits/stdc++.h> using namespace std; int cd(int a, int b) { return a - a / b; } int main() { int cnt1, cnt2, x, y; cin >> cnt1 >> cnt2 >> x >> y; long long int l = 1, r = 1000000000009; while (l < r) { int mid = l + (r - l) / 2; if (cnt1 <= cd(mid, x) && cnt2 <= cd(mid, y) && ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.