text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; int main(void) { int n, q, a, b; scanf( %d%d%d%d , &n, &q, &a, &b); vector<int> x(n); for (int i = 0; i < n; ++i) { scanf( %d , &x[i]); } vector<double> y(n); vector<int> from(n, -1); y[0] = x[0]; for ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e9 + 1; const long double pi = 3.1415926535897; void solve() { int n, ans(0); cin >> n; int a[n], b[5001] = {0}; for (int i = 0; i < n; i++) { cin >> a[i]; if (b[a[i]] == 0) b[a[i]] = 1; } for (int i = 1; i < n + 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... |
module FpuFpD_Mul(
/* verilator lint_off UNUSED */
clk,
enable,
srca,
srcb,
dst
);
input clk;
input enable;
input[63:0] srca;
input[63:0] srcb;
output[63:0] dst;
reg sgna;
reg sgnb;
reg sgnc;
reg[12:0] exa;
reg[12:0] exb;
reg[12:0] exc;
`ifdef PRECISE_FMUL
reg[105:0] tFracA;
reg[105:0] tFracB;
reg[105:0... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_transmitcontrol.v ////
//// ////
//// This file is part of the Ether... |
/**
* 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 inf = INT_MAX; const long long int INF = LLONG_MAX; const long long int mod = 1e9 + 7; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); long long int dp[151][10]; dp[1][0] = 1; dp[2][0] = 2; dp[3][0] = 3; ... |
#include <bits/stdc++.h> using namespace std; struct point { long long x, y; }; long long cross(point a, point b, point c) { return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y); } int main() { point a, b, c; cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y; long long ans = cross(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 la... |
`define SIZE 2
`define FIFO_DEPTH_LOG2 2
`define FIFO_DEPTH (1<<`FIFO_DEPTH_LOG2)
module fifo(clk, reset, full, empty, item_in, item_out, write, read);
parameter routerid=-1;
input clk, reset, write, read;
output full, empty;
reg [`SIZE-1:0] mem [`FIFO_DEPTH-1:0];
reg [`FIFO_DEPTH_LOG2-1:0] read_ptr;
... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { set<pair<pair<long long, long long>, pair<long long, long long> > > rem; long long xi = 0, yi = 0, xf = 0, yf = 0; string s;... |
/**
* 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 long long INF = 2e9 + 7; const int M = 1e6 + 10; const int N = 51; const int POW = 20; const long long MOD = 1000 * 1000 * 1000 + 7; int a[N]; int d[2][N][N][N][N]; void add(int &a, long long add) { a = ((long long)a + add) % MOD; } int main() { ... |
module clk_gen (
input clk,
input resetn,
output [0:0] clk_out
);
parameter CLK_CYCLES = 10;
reg [0:0] clk_out;
reg [$clog2(CLK_CYCLES):0] clk_counter;
always @(posedge clk) begin
if (!resetn) begin
clk_counter <= CLK_CYCLES-1;
clk_o... |
#include <bits/stdc++.h> using namespace std; set<int> st; int main() { int t, i, j, k, n, m; scanf( %d , &n); for (i = 0; i < n; i++) { int x; scanf( %d , &x); st.insert(x); } int a, b; scanf( %d , &a); scanf( %d , &b); set<int>::iterator it, cit; int ans = 0... |
#include <bits/stdc++.h> using namespace std; int a[2 * 100000 + 10]; int n, m, k; bool find(int pos) { int m1 = 0; while (m1 < m && pos <= n) { int k1 = k; while (pos <= n && a[pos] <= k1) { k1 -= a[pos++]; } m1++; } return pos == n + 1 ? 1 : 0; } 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... |
/**
* 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 = 5005; const int mod = 1000000007; int n, a, b, k; int dp[N][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> a >> b >> k; for (long long i = 1; i <= n; ++i) { dp[0][i] = i; } for ... |
#include <bits/stdc++.h> using namespace std; const int mx = 1e6 + 1; int n, m; string s[3]; int dp[mx][8]; bool isok(int i, int j) { int cnt = 0; for (int k = 0; k < 2; k++) cnt += ((i >> k) & 1) + ((j >> k) & 1); if (cnt % 2 == 0) return false; if (n == 2) return true; cnt = 0; for... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2014 by Jie Xu.
//
// change these two parameters to see the speed differences
`define DATA_WIDTH 8
`define REP_COUNT4 `DATA_WIDTH/4
`define REP_COUNT2 `DATA_WIDTH/2
module t (/*AU... |
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define fr first #define sc second #define MOD 1000000007 #define len(x) x.size() #define min3(a, b, c) min(a, min(b, c)) #define max3(a, b, c) max(a, max(b, c)) #define all(v) v.begin(), v.end() #define alla(a,n) a, a + n using... |
//Legal Notice: (C)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
//simulation files), and any associated do... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`timescale 1ns / 1ns
`define INT 3'd0
`define SHP 3'd1
`define CTD 3'd2
`define ADD 3'd3
`define SUB 3'd4
`define RDY 3'd5
module BoothController(input clk,input start,input[1:0] yLow, input[2:0] count,output reg ready,init,ldx,ldy,shift,cin,cntD);
reg [2:0] ps;
reg [2:0] ns;
initial ns = `RDY;
initial ps = `RDY;
... |
#include <bits/stdc++.h> using namespace std; auto start = std::chrono::high_resolution_clock::now(); long double crrtime() { auto stop = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); return ((long double)duration... |
// ddrInput2.v
// Copyright (c) 2009-2010 Atomic Rules LLC, ALL RIGHTS RESERVED
//
// Transforms typ ddr250 (500Mb/lvds_pair/cycle) to 1/4 rate SDR (125 MHz)
//
// 2009-11-11 ssiegel Creation
// 2010-01-06 ssiegel Adapation to use V5 ISERDES_NODELAY, add IDELAY to clock
// 2010-01-07 ssiegel Fix delays on the data inpu... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
-- ============================================================================
-- FILE NAME : chip_top.v
-- DESCRIPTION : gbvW
[
-- ----------------------------------------------------------------------------
-- Revision Date Coding_by Comment
-- 1.0.0 2011/06/27 suito VKì¬
-- ======... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_dtl_impctl_pullup.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... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; inline int in() { int x, y; y = scanf( %d , &x); return x; } const int N = 2 * 100 * 1000 + 5; int a[N], ans[N]; vector<pair<int, int>> v; int seg[4 * N]; void add(int p, int s = 0, int e = N, int x = 1) { seg[x]++; if (e - s == 1) return... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_velocityControlHdl.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ------------------------------------------------... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ac
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: w... |
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; string s[n]; for (int i = 0; i < n; i++) cin >> s[i]; int ans = 0; for (int i = 0; i < m - 1; i++) { if (s[n - 1][i] == D ) ++ans; } for (int i = 0; i < n - 1; i++) { if (s[i][m - 1] ==... |
`timescale 1ns / 1ps
module Freq_Count_Top(
input sys_clk_50m,ch_c,
output reg [63:0] freq_reg,
input sys_rst_n
);
reg Gate_1S; //1ÃëÖÓ¼ÆÊý´°¿Ú
wire Load;
reg EN_FT;
reg CLR;
//-----------------------------------------------------------------------
parameter HIGH_TIME_Gate_1S = 50_000_000;
pa... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 305; string s[MAX_N][MAX_N], t[MAX_N][MAX_N]; int cnt0[MAX_N], cnt1[MAX_N]; int n, m; struct Move { int x_1, y_1, x_2, y_2; Move(int x_1_, int y_1_, int x_2_, int y_2_) : x_1(x_1_), y_1(y_1_), x_2(x_2_), y_2(y_2_) {} Move() ... |
`default_nettype none
`define CLKFREQ 48000000 // frequency of incoming signal 'clk'
`define BAUD 115200
// Simple baud generator for transmitter
// ser_clk pulses at 115200 Hz
module baudgen(
input wire clk,
output wire ser_clk
);
localparam lim = (`CLKFREQ / `BAUD) - 1;
localparam w = $clog2(li... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s[1001], d[1001], i, a, S; cin >> n; for (i = 1; i <= n; i++) { cin >> s[i] >> d[i]; } S = s[1]; for (i = 2; i <= n; i++) { if (s[i] <= S) { int x = ((S - s[i]) / d[i]) + 1; S = s[i] + d[i] * x; ... |
//**************************************************************************
module COUNTER(CLOCK_I, nARST_I, COUNT_O);
parameter CBITS = 3;
input CLOCK_I;
input nARST_I;
output[CBITS-1:0] COUNT_O;
reg[CBITS-1:0] COUNT_O;
always @(posedge CLOCK_I or negedge nARST_I)
if(nARST_I==1'b0)
COUNT_O <= {CBITS{1'b0}}... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const int N = 52; int n, T; int t[N], x[N], c[5]; long long f[2][N][N][N * N + 50]; long long g[2][N][N * N]; long long cnt[N][N][N]; long long dp[N][N][N][4], fac[N]; int main() { fac[0] = 1; for (int i = 1; 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 law... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9, MOD = 1e9 + 7; const int n_ = 1e5 + 1000; long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); } long long power(long long a, long long n) { long long p = 1; while (n > 0) { if (n % 2) { p = p *... |
// bsg_tag_master
//
// 8/30/2016
//
// Usage: send a stream of 0's to reset master node and/or noop.
// Then, send a single <1> followed by a packet:
// < id > < data_not_reset > < payload length > < payload >
// ****************************************************************************
// $... |
/**
* 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 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 ... |
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=10000 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" clk1_divide_by=5000 clk1_duty_cycle=50 clk1_multiply_by=1 clk1_phase_shift="0" compensate_clock="CLK1" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_d... |
/////////////////////////////////////////////////////////////////////
//// ////
//// FIFO 4 entries deep ////
//// ////
//// Authors: Rudolf Usselmann, Richard ... |
#include <bits/stdc++.h> using namespace std; ifstream fin( input.txt ); ofstream fout( output.txt ); int gcd(int a, int b) { while (a && b) a > b ? a %= b : b %= a; return a + b; } int val(char c) { if (c >= 0 && c <= 9 ) return (int)c - 0 ; else return (int)c - A + 10; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15.03.2016 14:21:56
// Design Name:
// Module Name: I_NORM_FLOAT_TO_FIXED
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:... |
// (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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2017 by John Stevenson.
package pkg;
typedef logic [31:0] unique_id_t;
typedef struct packed {
unique_id_t foo;
} inner_thing_t;
typedef struct packed {
inner_... |
module latch_ex_mem(
input clock ,
input reset ,
input [ 5:0] stall ,
input [31:0] ex_instruction ,
output reg [31:0] mem_instruction ,
input [ 7:0] ex_operator ... |
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int MAXN = 100100; inline void add(int &a, int b) { a += b; if (a >= MOD) { a -= MOD; } } inline int mul(int a, int b) { return (a * 1LL * b) % MOD; } inline int fastPow(int a, int b) { int r = 1; w... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 100; char ch[maxn]; namespace Suffix_Array { int cntA[maxn], cntB[maxn], tsa[maxn], A[maxn], B[maxn]; int sa[maxn], rkrk[maxn], height[maxn]; void GetSa(char *ch, int n) { for (int i = 0; i < maxn; i++) cntA[i] = 0; for (int i = ... |
#include <bits/stdc++.h> using namespace std; int r = 2, g = 5, b = 8, n, k; int h, j, p; int main() { cin >> n >> k; h = r * n; j = g * n; p = b * n; h = (h + k - 1) / k; j = (j + k - 1) / k; p = (p + k - 1) / k; cout << p + j + h; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Case Western Reserve University
// Engineer: David Ariando
//
// Create Date: 22:22:00 01/31/2018
// Project Name: EECS301 Digital Design
// Design Name: Lab #2 Project
// Module Name: ... |
#include <bits/stdc++.h> using namespace std; void sdvig(char *c, int n) { int i; char s = c[0]; for (i = 0; i < n - 1; i++) { c[i] = c[i + 1]; } c[n - 1] = s; } int main() { int n; scanf( %d n , &n); char c[1010], cc[1010]; cin >> cc; int i, g, f, l = n - 1; in... |
//This module exists to clean the main CPU module a bit and to allow for there to be
//more hard-wired combinational logic in the CPU. Future revisions will include even further
//hard-wiring so as to hopefully increase clockspeed potential.
module pipeBlockedU(
DAT1,
DAT2,
DAT3,
DAT4,
DAT5,
blocked
);
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 law... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 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 proper... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, n, i, j, money; cin >> a >> b >> c; cin >> n; int m[n]; money = 0; for (i = 0; i < n; i++) { cin >> m[i]; if (m[i] > b && m[i] < c) money = money + 1; } if (a > b && a < c) cout << money; el... |
module optest(clk, mode, u1, s1, u2, s2, y);
input clk;
input [6:0] mode;
input [3:0] u1, u2;
input signed [3:0] s1, s2;
output reg [7:0] y;
always @(posedge clk) begin
y <= 8'h42;
case (mode)
0: y <= u1 << u2;
1: y <= u1 << s2;
2: y <= s1 << u2;
3: y <= s1 << s2;
4: y <= u1 >> u2;
5: y <= u1 >... |
#include <bits/stdc++.h> using namespace std; struct Data { int Value, Number; }; bool operator<(Data A, Data B) { return A.Value < B.Value; } int Get() { char c; while (c = getchar(), c < 0 || c > 9 ) ; int X = 0; while (c >= 0 && c <= 9 ) { X = X * 10 + c - 48; c ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_exu_ecc.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 and... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 1000; int n, m; char B[Maxn][Maxn]; bool takeHor(int r, int c1, int c2) { if (c2 >= m) return false; if (B[r][c1] != W || B[r][c1 + 1] != B || B[r][c2] != W ) return false; bool ctake[4]; fill(ctake, ctake + 4, true); if (... |
#include <bits/stdc++.h> using namespace std; int isP(long int hj) { long int op; for (op = 2; op <= sqrt(hj); op++) { if (hj % op == 0) return 0; } return 1; } void swap(long long int *p, long long int *q) { long long int tmp = *p; *p = *q; *q = tmp; } void tog(int *p) { ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; const long long maxn = 3 * 1e5 + 10; int n, c[maxn]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> c[i]; int ans = 0; for (int i = 2; i <= n; i++) { if (c[i] != c[1]) ans = max(ans, i - 1); } for ... |
// (C) 2001-2016 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... |
/**
* 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 d[] = {25, 18, 15, 12, 10, 8, 6, 4, 2, 1}; int t, n, k; struct edge { string name; int s, win[50]; } a[100]; bool cmp1(edge x, edge y) { if (x.s != y.s) { return x.s > y.s; } for (int i = 0; i < 50; i++) { if (x.win[i] != y.wi... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; string test; cin >> test; for (int i = 0; i < m; i++) { int l, r; char c1, c2; cin >> l >> r >> c1 >> c2; l -= 1; r -= 1; for (; l <= r; l++) { if (test[l] == c1) { ... |
//-------------------------------------------------------------------------
// COPYRIGHT (C) 2016 Univ. of Nebraska - Lincoln
//
// 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 ve... |
//sata_link_layer_read.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 th... |
// Filename: counter16bit.v
// Author: Jason Thweatt, Danny Dutton
// Date: 1 April 2015
// Version: 1
// Description: A 16-bit counter as a starting point for project 3.
// Incorporates separate keypress state machine by T. Martin
module counter16bit(clock, enable, clear, disp, dir, countValue, o... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const int maxn = 4e2 + 5, maxk = 4e2 + 5, inf = 1e9 + 69, delta = 1e9 + 7, max_sum = 10000 + 5; inline vo... |
#include <bits/stdc++.h> using namespace std; set<int> smax, smin; int ox[100000], oy[100000]; map<pair<int, int>, int> pnts; inline int eval(int x, int y) { if (pnts.count({x, y})) { return pnts.count({x, y - 1}) + pnts.count({x - 1, y - 1}) + pnts.count({x + 1, y - 1}); } retu... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[201]; for (int i = 1; i <= n; ++i) cin >> arr[i]; int brr[201] = {0}, count = 0; for (int i = 1; i <= n; ++i) { if (i == 1 && n >= 2) { if (arr[1] == 1 && arr[2] == 2) brr[i] = 1; } else {... |
#include <bits/stdc++.h> using namespace std; const bool debug = 0; int main() { if (!debug) { cin.tie(0); cin.sync_with_stdio(0); cout.tie(0); cout.sync_with_stdio(0); } int n, m; cin >> n >> m; vector<vector<int>> d(m, vector<int>(n)); for (int i = 0; i < m; i++) ... |
#include <bits/stdc++.h> using namespace std; const int64_t maxn = 1e3 + 42; vector<int64_t> g[maxn]; int64_t par[maxn], sz[maxn]; basic_string<int64_t> leaves[maxn]; void dfs(int64_t v) { sz[v] = 1; for (auto u : g[v]) { if (u != par[v]) { par[u] = v; dfs(u); sz[v] += ... |
#include <bits/stdc++.h> using namespace std; const long long maxN = 2e5 + 10; const long long maxB = 500; const long long INF = 4557430888798830399; const int INF_I = 2139062143; const long long maxA = 1e6 + 10; const long long MOD = 1e9 + 7; const long long mINF = -4557430888798830400; const int mIN... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; const int M = 1000005; const long long INF = (long long)(1e15); long long a[N][N]; long long retc[M], retr[M]; priority_queue<pair<long long, int> > sc, sr; int main() { int n, m, k, p; scanf( %d%d%d%d , &n, &m, &k, &p); for (... |
#include <bits/stdc++.h> using namespace std; long long M, n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long ttttt = 1; while (ttttt--) { cin >> M >> n; long long a[n], ans[n]; cin >> a[0]; long long ok = -1; if (a[0] <= M * -1) ok =... |
#include <bits/stdc++.h> using namespace std; bool isprime(int n) { for (int i = (2); i < (sqrt(n) + 1); ++i) if (n % i == 0) return false; return true; } int main() { vector<int> ans; int h[400] = {0}; for (int i = 4; i < 400; i += 2) h[i] = 1; h[2] = 0; h[1] = 1; for (int... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector ) #pragma GCC optimize( unroll-loops ) using namespace std; const int BLK = 320; const int MXN = 1e5 + 5; const int MOD = 998244353; int add(int x, int y) { return (x += y) < MOD ? x : x - MOD; } int sub(int x, int y) { return (x -=... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a, b; cin >> a >> b; if (a == b) { cout << (a * 10) << << (b * 10) + 1; } else if (a + 1 == b) { cout << (min(a, b) * 10) + 9 << << (max(a, b) * 10); } else... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> a(n); int sum = 0, maxi = -1; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; maxi = max(a[i], maxi); } if (maxi > (sum / 2)) cout << T << n ; 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { int a, k = 0, nod; cin >> a; for (int i = 2; i < a; i++) { int b = a; while (b != 0) { k += b % i; b /= i; } } int b = a - 2; for (int i = k; i > 0; i--) if (k % i == 0 && b % i == 0) { ... |
`include "setseed.vh"
module top(input clk, din, stb, output dout);
reg [41:0] din_bits;
wire [78:0] dout_bits;
reg [41:0] din_shr;
reg [78:0] dout_shr;
always @(posedge clk) begin
if (stb) begin
din_bits <= din_shr;
dout_shr <= dout_bits;
end else begin
din_shr <= {din_shr, din};
dout_shr <= {d... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2018 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
localparam string SVEC [0:7] = '{"zero", "one", "two", "three", "four", "five", "six", "seven... |
#include <bits/stdc++.h> using namespace std; int MDA[10000010]; int MDB[10000010]; int main() { long long a, b, m; int i; cin >> a >> b >> m; for (i = 0; i < (min(m, a + 1)); i++) { MDA[i] = (i * 1000000000) % m; } for (i = 0; i < (min(m, b + 1)); i++) { MDB[(i) % m] = 1; ... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 998244353; const long long int MAXN = 3e3 + 5; const long long int inf = 1e17; int main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); ; long long int t; cin >> t; while (t--) { long long ... |
#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... |
/*
* 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_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, i, j, k; cin >> n; vector<string> v; vector<pair<int, string> > v1; for (i = 0; i < n; i++) { string s; cin >> s; v.push_back(s); v1.push_b... |
#include <bits/stdc++.h> using namespace std; long long int MOD = 1e9 + 7; long long int INF = 1e18; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int i, j, k = 0, m = 0, n, p = 0, l, r, ans = 0, cnt = 0, mini = INF, maxi = INF, x... |
`default_nettype wire
module damy_memory_16entry_256bit(
input iCLOCK,
input [31:0] iBYTE_ENA,
//Write
input iWR_ENA,
input [3:0] iWR_ADDR,
input [255:0] iWR_DATA,
//Read
input [3:0] iRD_ADDR,
output [255:0] oRD_DATA
);
reg [255:0] b_mem[0:15];
always@(posedge iCLOCK)begin
if(iWR_ENA)begin
... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; const int mod=1e9+7; const int N=1e6+11; const double eps=0.00000001; bool check(int u,int v){ int a=0,b=0; for(int i=0;i<31;i++){ if(u>>i&1) a++; if(v>>i&1) b++; if(b){ if(!a) return ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d %d , &n, &m), ++n; long long ans = 0; for (int a = m + 1; a <= n / 2; ++a) { int tmp = 0; for (int b = m + 1, c = n - m - 1; b < n - m && c > m; ++b) { while (c > m && a * ((a << 1) + b - (n << 1) - c)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.