text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; char arr[300]; int main() { ios::sync_with_stdio(false); string s, t; cin >> s >> t; int n = s.size(); memset(arr, A , sizeof(arr)); if (n != t.size()) { cout << -1; return 0; } for (int i = 0; i < n; i++) { if (arr[t... |
/* Title: eight_bit_counter.v
* Author: Sergiy Kolodyazhnyy <>
* Date: May 2nd, 2017
* Purpose: Behavioral module for simple 8-bit binary counter
* Developed on: Ubuntu 16.04 LTS , Quartus Prime Lite 16.1
* Tested on: DE1-SoC , Cyclone V , 5CSEMA5F31
*/
module eight_bit_counter(count_out,enable,clock,clear);
... |
#include <bits/stdc++.h> using namespace std; int x[200005]; int main() { memset(x, 0, sizeof(x)); int n = 0; scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %d , &x[i]); } sort(x, x + n); double eps = 1e-10, l = 0.0, r = (double)(x[n - 1] - x[0]) / 6.0; int p1 = 0, p2 ... |
#include <bits/stdc++.h> using namespace std; string b[51]; bool check(pair<int, int> f, pair<int, int> s) { bool r1 = true, r2 = true, c1 = true, c2 = true; for (int i = f.first; i <= s.first; i++) { if (b[i][f.second] == W ) c1 = false; if (b[i][s.second] == W ) c2 = false; } 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 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; struct Node { int ancestor; vector<int> children; }; class TarjanOLCA { enum Color { WHITE = 0, BLACK = 1, }; public: TarjanOLCA(const vector<Node>& tree, int root, const vector<pair<int, int> >& query) : ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Tue Oct 17 02:50:46 2017
// Host : Juice-Laptop running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; const long long C = 1000000007; long long pow1(long long x, long long y, long long z) { if (y == 0) { return 1; } if (y % 2 == 0) { return pow1(x * x % z, y / 2, z); } return pow1(x, y - 1, z) * x % z; } signed main() { ios::syn... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. *
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 233, mxzt = (1 << 20) + 23; int f[21][mxzt], tmp[2][mxzt][20]; int stv[maxn]; int i, j, k, n, m; char s[maxn]; int ra, fh; char rx; inline int read() { rx = getchar(), ra = 0, fh = 1; while (rx < 48) rx == - && (fh = -1), r... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; char s[1000]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %s , &s); } for (int i = 0; i < 10; i++) cout << ?? << i << >> << i << ?? n ; cout << ??>>? n ; for (int i = 0; i < 9; i++) { cout << ... |
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, d = 0, count = 0, maxCount = 0; cin >> n >> d; string s = ; for (int i = 0; i < d; i++) { cin >> s; int res = 1; for (int j = 0; j < s.size(); j++) { res &= (s[j] - 0 ); } if (res == 1) { ... |
#include <bits/stdc++.h> int n, a[1000][1000]; int main() { for (int i = 1; i <= 100; i++) for (int j = 1; j <= 100; j++) a[i][j] = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { int t, v; scanf( %d , &t); for (int j = 1; j <= t; j++) { scanf( %d , &v); a[i][v... |
#include <bits/stdc++.h> using namespace std; int hcf(long long a, long long b) { if (b == 0) return a; return hcf(b, a % b); } void solve() { long long n; cin >> n; long long x = hcf(n + 1, 4 * n); long long lcm = ((4 * n) * (n + 1)) / x; cout << lcm / (n + 1) + 1; } int main() ... |
/*
Author: Joe Krachey
Date: 01/03/2017
*/
module ece453(
// signals to connect to an Avalon clock source interface
clk,
reset,
// signals to connect to an Avalon-MM slave interface
slave_address,
slave_read,
slave_write,
slave_readdata,
slave_writedata,
slave_byteenable,
gpio_inputs,
gpio_output... |
/**
* 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... |
module mem_window (
clk,
reset,
// Memory slave port
s1_address,
s1_read,
s1_readdata,
s1_readdatavalid,
s1_write,
s1_writedata,
s1_burstcount,
s1_byteenable,
s1_waitrequest,
// Configuration register slave port
cra_write,
cra_writedata,
cra_byteenable,
// Bridged m... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; const long long inf = 1000000000000000000LL; int a[N]; long long prefix_cost[N], cost[N], suffix_cost[N]; set<int> factors; set<int>::iterator it; void pf(int x) { for (int j = x - 1; j <= x + 1; j++) { int d = j; for (... |
#include <bits/stdc++.h> using namespace std; const long long N = 5e5 + 5, inf = 1e16; long long a[N], p[N], b[N], seg[N << 2], m; void shift(long long id) { if (seg[id] == 0) return; seg[id << 1] += seg[id], seg[id << 1 | 1] += seg[id]; seg[id] = 0; } void add(long long l, long long r, long lon... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; long long a[n]; for (int i = 0, ggdem = n; i < ggdem; ++i) cin >> a[i]; long long yo = -1; for (int i = 0, ggdem = n; i < ggdem; ++i) { if (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... |
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin... |
// megafunction wizard: %Shift register (RAM-based)%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: ALTSHIFT_TAPS
// ============================================================
// File Name: SHIFTREGRAM.v
// Megafunction Name(s):
// ALTSHIFT_TAPS
//
// Simulation Library Files(s):
// altera_mf
// =======... |
#include <bits/stdc++.h> using namespace std; void err() { cout << n ; } template <class T, class... Ts> void err(const T& arg, const Ts&... args) { cout << arg << ; err(args...); } inline int read() { int s = 0, w = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (c... |
(*
* Copyright © 2013 http://io7m.com
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCL... |
#include <bits/stdc++.h> using namespace std; int n, k; int c[5005], h[11], f[505]; int cnt[100005]; int fcnt[100005]; int cache[5005][505]; int solve(int idx1, int idx2) { if (idx1 == 0 || idx2 == 0) return 0; int &ret = cache[idx1][idx2]; if (ret != -1) return ret; ret = 0; for (int ... |
#include <bits/stdc++.h> using namespace std; namespace Flandre_Scarlet { long long mod; class Matrix { private: long long a[5][5]; public: long long n; Matrix() { memset(a, 0, sizeof(a)); n = 0; } Matrix(long long _n) { memset(a, 0, sizeof(a)); n = _n; }... |
//==================================================================================================
// Filename : Mux_3x1_b.v
// Created On : 2016-10-03 16:53:16
// Last Modified : 2016-10-04 10:27:42
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologico de C... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, y = 0; cin >> a >> b; while (a <= b) { a *= 3; b *= 2; y++; } cout << y; return 0; } |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long fact[100001]; vector<long long> vec[100001]; long long vis[100001], win[100001], flag[100001]; long long power(long long x, long long y) { long long res = 1; while (y) { if (y & 1) res = (res * x) % mod; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; t = 1; while (t--) { long long n, a[8] = {0}, k; cin >> n; for (int i = 0; i <= n - 1; i++) { cin >> k; a[k]++; } if (a[5] > 0 || a[7] > 0 || a[1] ... |
#include <bits/stdc++.h> int main() { char s[512]; scanf( %s , s); int length = strlen(s); int i; int alpha_cnt = 0; for (i = 0; i < length; i++) { if (s[i] - a > alpha_cnt) { puts( NO ); return 0; } if (s[i] - a == alpha_cnt) { alpha_cnt++; ... |
#include <bits/stdc++.h> using namespace std; int N; int A[3][30]; int p3[30]; map<pair<int, int>, pair<int, signed long long> > M[2]; void solve() { int i, j, k, l, r, x, y; string s; cin >> N; p3[0] = 1; for (i = 0; i < N; i++) p3[i + 1] = p3[i] * 3; for (i = 0; i < N; i++) cin >> ... |
///2016/8/6
///ShaoMin Zhai
///module function: used to debug core
`include "define.v"
module top_level(
clk,
rst
);
input clk;
input rst;
wire [31:0] pc;
wire [31:0] mem_data;
wire [31:0] mem_addr;
wire [3:0] mem_head;
wire v_mem;
wire v_p... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LNF = 0x3f3f3f3f3f3f3f3f; const int MOD = 1000000007; const double EPS = 1e-8; const long double EUL = 2.71828182845904523536; const long double PII = 3.14159265358979323846; int main() { ios_base::sync_with_st... |
// (C) 1992-2012 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 simul... |
#include <bits/stdc++.h> bool isvowel(char s) { if (s == a || s == A || s == e || s == E || s == i || s == I || s == o || s == O || s == u || s == U ) return true; else return false; } long long fact(long long n) { long long mul = 1; for (long long i = 1; i <... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 2e18; const double PI = acos(-1.0); const double E = exp(1); const double EPS = 1e-8; const long long mod = 1e4 + 7; const int maxn = 3e5 + 5; void pre() { freopen( in.txt , r , stdin); freopen( o... |
#include <bits/stdc++.h> using namespace std; long long f[100]; int s[100]; long long dp[100][2]; int main() { f[0] = f[1] = 1; for (int i = 2; i < 100; i++) { f[i] = f[i - 1] + f[i - 2]; } int cas; cin >> cas; while (cas--) { long long n; cin >> n; int cnt = 0;... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// -------... |
#include <bits/stdc++.h> using namespace std; const int maxn = 31; const int mod = 1000000007; struct ma { long long a[maxn][maxn]; int n; ma(int m = 0) { n = m; memset(a, 0, sizeof(a)); for (int i = 0; i < n; i++) a[i][i] = 1; } ma(const ma& nn) { n = nn.n; mem... |
module BufferIn(
input wire Clk,
input wire InputBuffer,
output reg [17:0] oBufferIn,
output reg EndOfFile
);
reg [17:0] tmpChar;
integer i;
initial
begin
i = $fopen("original.txt");
EndOfFile = 1'b0;
end
always @ (posedge Clk)
begin
if(InputBuffer)
begin
tmpChar = $fgetc... |
module RegBank
#(
parameter WORD_SIZE = 32,
parameter MAX_NUMBER = 32'hffffffff,
parameter PC_REGISTER = 15,
parameter SP_REGISTER = 14,
parameter SPECREG_LENGTH = 4,
parameter KERNEL_STACK = 7167,
parameter USER_STACK = 8191,
parameter OS_START = 3072,
parameter SP_KEEPER_REGISTER ... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5; const long long MOD = 1e9 + 7; long long n, a[55]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for (long long i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); if (a... |
//-----------------------------------------------------
// Design Name : rrab_t
// File Name : rrab_t.v
// Function : Testing rrab.v design.
// Coder : hydai
//-----------------------------------------------------
module rrab_t;
reg reset_n, clk;
reg [1:0] request;
wire [1:0] grant;
rrab rrab_instance(
grant,... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000009; int n, m, k; class Mat { public: long long e[2][2]; Mat mul(Mat u) { Mat s; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { s.e[i][j] = 0; for (int k = 0; k < 2; k++) { ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; long long a[N]; struct t { int lval, rval, mval; } tr[N * 4]; int sign(long long x) { if (x > 0) return 1; if (x < 0) return -1; return 0; } inline void cal(int cur, int l, int r) { int m = (l + r) / 2; int dcur... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2012-2012 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> using namespace std; using ii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vii = vector<ii>; using vb = vector<bool>; using ll = long long; template <typename A, typename B> istream &operator>>(istream &in, pair<A, B> &p) { in >> p.first >> p.sec... |
`timescale 1ns / 1ps
module keyed_permutation_tb();
localparam UNIT_WIDTH = 1;//MAX is 16
localparam NUNITS = 16;
localparam INDEX_WIDTH = 4;
localparam KEY_WIDTH = 49;
reg i_clk;
reg [NUNITS*UNIT_WIDTH-1:0] i_dat;
reg [NUNITS*UNIT_WIDTH-1:0] i_dat_d1;
reg [NUNITS*UNIT_WIDTH-1:0] i_dat_d2;
reg [KEY_WIDTH-1:0] i_key;
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 501; int n, vis[maxn][maxn], a[maxn][maxn], x, y, s, cnt; char p[3000010]; int d[4][2] = {0, 1, 1, 0, -1, 0, 0, -1}; bool J(int x, int y, int i) { while (true) { x += d[i][0]; y += d[i][1]; if (!x || !y || x > n || y > n) r... |
#include <bits/stdc++.h> using namespace std; inline int two(int n) { return 1 << n; } 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); } template <class T> T gcd(T a, T b) { return (b != 0 ? gcd<T>... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read() { T x = 0, f = 0; char c = getchar(); while (!isdigit(c)) f = c == - , c = getchar(); while (isdigit(c)) x = x * 10 + c - 48, c = getchar(); return f ? -x : x; } namespace run { const long long N = 2e5 +... |
#include <bits/stdc++.h> namespace mem { namespace stdval { using i32 = int; using i64 = long long int; using u32 = unsigned int; using u64 = unsigned long long int; using f32 = float; using f64 = double; using f96 = long double; using i128 = __int128_t; using u128 = __uint128_t; } // namespace... |
#include <bits/stdc++.h> using namespace std; int main() { int k, n1, n2, n3, t1, t2, t3; cin >> k >> n1 >> n2 >> n3 >> t1 >> t2 >> t3; multiset<int> A, B, C; for (int i = 0; i < n1; ++i) A.insert(0); for (int i = 0; i < n2; ++i) B.insert(0); for (int i = 0; i < n3; ++i) C.insert(0); for... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: async_fifo_256x72_to_36.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(s):
// alt... |
/* verilator lint_off WIDTH */
/* verilator lint_off UNUSED */
/* verilator lint_off COMBDLY */
module arithbox (arithop,calc_sz,ci,co,af,ai,sa,sb,opa,opb,resa,cmp);
input [3:0] arithop;
input [3:0] calc_sz;
input [31:0] opa,opb;
output reg [31:0] resa;
input ci,ai;
output reg co,af,sa,sb,... |
module WordOpcodeBufferTest;
`include "Framework.v"
reg reset;
reg clk;
always #10 clk = ~clk;
reg [31:0] addrA;
wire [31:0] addrB;
reg writeEnable = 0;
reg [31:0] dataIn;
reg requestA;
wire requestB;
wire [31:0] outA;
wire [31:0] outB;
wire busyA;
wire busyB;
wire [15:0] displayIn = 0;
wire [... |
/*
* 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 / 10 ps
module dpram (clock,
address_a, byteena_a, wrdata_a, wren_a, rddata_a,
address_b, byteena_b, wrdata_b, wren_b, rddata_b);
parameter DATA_WIDTH = 32;
parameter ADDR_WIDTH = 7;
parameter INIT_FILE = "dummy"; // This is ignored right now
input ... |
`include "../../network_params.h"
module np_matrix_mult_ctrl(
input clock,
input reset,
input start,
output reg [`FM_ADDR_BITWIDTH:0] addr,
output reg [`RAM_SELECT_BITWIDTH:0] ram_select,
output reg mult_en,
output reg product_rdy
);
always @(posedge clock or negedge reset) begin
if (reset == 1'b0)... |
#include <bits/stdc++.h> using namespace std; const int maxN = 1e5 + 5; int lover[maxN], unlover[maxN]; int speak[maxN]; int N, M; bool iscrime[maxN]; int totnocommit, totcommit; int main() { scanf( %d%d , &N, &M); for (int i = (1), _ = (N); i <= _; ++i) { scanf( %d , &speak[i]); if ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, sum = 0; cin >> n; n++; for (int i = 1; i < n - 2; i++) { for (int j = i; j < n - 1; j++) { int k = (int)(i ^ j); if (k < n && k > j) { if (!(i ^ j ^ k)) { double p = (i + j + k) / 2; ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Oct 27 10:20:39 2017
// Host : Juice-Laptop running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; multiset<long long int> s; map<string, int> mp; while (t--) { char ch; long long int x; cin >> ch >> x; string str(18, 0 ); string t... |
// -*- Mode: Verilog -*-
// Filename : wb_daq_data_aggregation.v
// Description : WB Data Acquisition Aggregation
// Author : Philip Tracton
// Created On : Wed Dec 16 13:02:29 2015
// Last Modified By: Philip Tracton
// Last Modified On: Wed Dec 16 13:02:29 2015
//... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const double PI = acos(-1.0); const double epsilon = PI / 180.0; long long powmod(long long a, long long b) { long long res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % mod; ... |
//Legal Notice: (C)2011 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... |
/*
* NAME
* ----
*
* mem_ctl - memory control
*
*
* DESCRIPTION
* -----------
*
* Module for interfacing an Alliance AS6C1008 128x8 RAM chip
* on to an 8-bit data bus and a 7-bit address bus.
*
* AUTHOR
* ------
*
* Jeremiah Mahler <>
*
*/
module mem_ctl(
input read_n,
... |
#include <bits/stdc++.h> using namespace std; long long n, k, cnt; int A[10]; long long FE(long long n, long long m) { if (!m) return 1; long long t = FE(n, m >> 1); t = (t * t) % (1000000007); if (m & 1) t = (t * n) % (1000000007); return t % (1000000007); } bool ctrl() { bool H[10]... |
#include <bits/stdc++.h> using namespace std; long long a[100020], b[100020]; int main() { int m, n; scanf( %d%d , &m, &n); long long sum1 = 0, sum2 = 0, s1 = 0, s2 = 0, Max1 = 0, Max2 = 0; for (int i = 1; i <= m; i++) { scanf( %I64d , &a[i]); sum1 += a[i]; if (a[i] > Max1) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } int last = 0; int ans = 0; string s = ; int l = 0, r = n - 1; while (1) { int k = INT_MAX; if (arr[l] > last) { ... |
#include <bits/stdc++.h> using namespace std; bool checkThree(char cc, char lc, char nc) { return (cc != lc && cc != nc); } int main() { int t; cin >> t; while (t--) { string s, t; cin >> s >> t; for (int i = 0; i < s.length(); i++) { int x = t.find(s[i]); if (x < t.l... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 1; vector<int> s[N], e[N]; int n, m, l[N], r[N], x[N], res[N]; bool vis[N]; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < m; ++i) { scanf( %d%d%d , &l[i], &r[i], &x[i]); s[l[i]].push_back(i); e[r[i]].push_b... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6; long long int n, k, mx, sum, a[N]; int main() { cin >> n >> k; sum++; for (int i = 0; i < n; i++) { cin >> a[i]; if (i) { if (a[i] != a[i - 1]) { sum++; mx = max(mx, sum); } else { ... |
#include <bits/stdc++.h> using namespace std; int main() { long long w, m; cin >> w >> m; vector<int> a; long long z = m; while (z) { a.push_back(z % w); z /= w; } a.push_back(0); int flag = 1; for (int i = 0; i < a.size(); i++) { if (a[i] == w || a[i] == w - 1)... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 11; const int MAXN = 1e5 + 5; const int LG = 20; const int INF = 1e9; using ll = long long int; using ull = unsigned long long int; const ll MOD2 = 998244353; const ll MOD1 = 1e9 + 7LL; vector<int> g[MAXN], cg[MAXN]; vector<int> ... |
/**
* 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; if (n == 1) { cout << -1; } else cout << n << << n + 1 << << n * (n + 1); } |
#include <bits/stdc++.h> using namespace std; int n; vector<int> ways[400], a[400], num[400]; vector<int> ans; struct edge { int a, b; }; vector<edge> gr; bool dfs(int v, int f, int pr) { if (v == f) return true; for (int i = 0; i < a[v].size(); i++) { if (a[v][i] != pr) if (df... |
#include <bits/stdc++.h> using namespace std; #define int unsigned long long const int N = 100010; int n, a[N]; signed main(void) { ios::sync_with_stdio(false); map <int, int> mp; int T; cin >> T; while(T--) { mp.clear(); int res = 0; i... |
#include <bits/stdc++.h> using namespace std; long long n, m, l, r, p, span, t, lwr, upr; long pr[200000]; vector<long> vec[200000]; long calc[200000]; long long res, nmoves[200000]; long long check[200000]; long long temp; long long answ; long long gcd(long long a, long long b) { while (a && b)... |
#include <bits/stdc++.h> using namespace std; int a[50][50], n, m; bool can(int k) { int total = 0; for (int i = 0; i < m; i++) if (a[k][i] != i + 1) total++; if (total <= 2) return 1; return 0; } bool ok() { for (int i = 1; i <= n; i++) if (!can(i)) return 0; return 1; }... |
`timescale 1 ns / 1 ps
module PWM_Analyzer_v1_0 #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Parameters of Axi Slave Bus Interface S00_AXI
parameter integer C_S00_AXI_DATA_WIDTH = 32,
parameter integer C_S00_A... |
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ===========================================================
//`timescale 1 ns... |
/* opa: Open Processor Architecture
* Copyright (C) 2014-2016 Wesley W. Terpstra
*
* 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 opt... |
#include <bits/stdc++.h> using namespace std; int V[200010]; char vowel[] = aeiouAEIOU ; int v(int a, int k) { if (k == 0) return 0; int x = V[a + k - 1]; if (a > 0) x -= V[a - 1]; return x; } int f(int a, int k) { return 2 * k - 3 * v(a, k); } int g(int k) { return f(0, k); } bool Good... |
#include <bits/stdc++.h> using namespace std; long long n, m, a[1000500]; map<pair<int, long long>, bool> dp; bool found = false; void solve(int idx, long long sum, bool take) { if (found) return; if (take && sum % m == 0) { found = true; return; } if (idx >= n) return; bool &r... |
#include <bits/stdc++.h> using namespace std; int power(int a, int n, int m) { if (n <= 0) return 1; if (n % 2 == 1) { return ((int)(((long long)power(a, n - 1, m) * a) % m)); } else { int k = power(a, n / 2, m); return ((int)(((long long)k * k) % m)); } } int main() { long... |
// 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 : Thu May 25 15:17:21 2017
// Host : GILAMONSTER running 64-bit major release (... |
`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:... |
#include <bits/stdc++.h> inline int read() { int data = 0, w = 1; char ch = getchar(); while (ch != - && !std::isdigit(ch)) ch = getchar(); if (ch == - ) w = -1, ch = getchar(); while (std::isdigit(ch)) data = data * 10 + (ch ^ 48), ch = getchar(); return data * w; } const int N(1e5 + 1... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n; int mx = 0; for (int i = 0; i < n; i++) { cin >> x >> y; mx = max(mx, (x + y)); } cout << mx << endl; } |
module erx_remap (/*AUTOARG*/
// Outputs
emesh_access_out, emesh_packet_out,
// Inputs
clk, emesh_access_in, emesh_packet_in, remap_mode, remap_sel,
remap_pattern, remap_base
);
parameter AW = 32;
parameter DW = 32;
parameter PW = 104;
parameter ID = 12'h808;
//Clock/reset
input... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k, r[1000], c[1000], min[1000], sum = 0; cin >> n >> m >> k; for (int i = 0; i < n; i++) { cin >> r[i] >> c[i]; min[i] = 9999999999; } for (int i = 0; i < n; i++) if (min[r[i] - 1] > c[i]) min[r[i] - 1] = c[i]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.