text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; void Anivia_kid() { long long n; cin >> n; long long res = 1 + 3 * n * (n + 1); cout << res << n ; return; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int q = 1; while (q-... |
/**
* 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 csr#(
parameter NUM_CH = 8,
parameter NUM_SPDIF_IN = 3,
parameter NUM_RATE = 5,
parameter VOL_WIDTH = NUM_CH*32,
parameter NKMDDBG_WIDTH = 16*8,
parameter RATE_WIDTH = NUM_SPDIF_IN*NUM_RATE,
parameter UDATA_WIDTH = NUM_SPDIF_IN*192,
parameter CDATA_WIDTH = UDATA_WIDTH
)(
inpu... |
/*
* Copyright 2013, Homer Hsing <>
*
* 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 to ... |
/**
* 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; int main() { int n, fp = 0; cin >> n; vector<int> p(n); bool nice = false; bool entrou = false; for (int i = 0; i < n; i++) { cin >> p[i]; if (i == p[i]) fp = fp + 1; } for (int i = 0; i < n; i++) { if (p[i] != i) { ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; struct habijabi { long int start_time, end_time; } work[500500]; bool cmp(habijabi a, habijabi b) { if (a.end_time == b.end_time) { return a.start_time < b.start_time; } return a.end_time < b.end_time; } int main() { long int t, n, i, j... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long x, y, p, q; cin >> x >> y >> p >> q; if (p == q && x == y) { printf( 0 n ); continue; } if (p == 0 && x == 0) { printf( 0 n ); continue;... |
#include <bits/stdc++.h> using namespace std; const int MOD = int(1e9) + 7; const long long int MOD64 = (long long int)(1e18) + 7; const int INF = 0x7fffffff; const long long int INF64 = 0x7fffffffffffffff; const int N = 2e4 + 200; int a[60][N]; int sum[60][N]; int dp[60][N]; int t[4 * N], lazy[4 * ... |
/*
* These source files contain a hardware description of a network
* automatically generated by CONNECT (CONfigurable NEtwork Creation Tool).
*
* This product includes a hardware design developed by Carnegie Mellon
* University.
*
* Copyright (c) 2012 by Michael K. Papamichael, Carnegie Mellon University
*
* ... |
//Legal Notice: (C)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 associate... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014
// Date : Mon May 26 11:16:42 2014
// Host : macbook running 64-bit Arch Linux
// ... |
#include <bits/stdc++.h> using namespace std; int main() { int t, i; cin >> t; for (i = 0; i < t; i++) { string s; cin >> s; int j = 0, k, l = s.length(), sum = 0; while (j < l) { if (s[j] == 1 ) { k = j; j++; while (s[j] == 0 ) j++; ... |
#include <bits/stdc++.h> using namespace std; template <class T> T modulo(T x, T p) { if (x >= 0) return x % p; return p + x % p; } template <class T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); } template <class T> T lcm(T a, T b) { return a * b / gcd(a, b); } ... |
/*
* 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... |
// This tests SystemVerilog packages
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
package p1;
localparam int p1_prmt = 100+10+1;
typedef bit [10+1-1:0] p1_type;
function int p1_func (int x);
p1_func = x+10+1;
endfunction
endpackage
pac... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 07/27/2014 11:48:22 PM
// Design Name:
// Module Name: BIN_DEC2
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
// This is an up-down counter with initial and max values.
// Moreover, it has an parameter for extra bits to be used
// for counter, in case of using for credit counters. Also
// up and down values could be variable, having max threshold
// of max_step_p.
`include "bsg_defines.v"
module bsg_counter_up_down_variable #... |
#include <bits/stdc++.h> #define ll long long int #define vi vector<int> #define vll vector<long long int> #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ABS(x) ((x) < 0 ? -(x) : (x)) #define setpr(x, y) cout << fixed << setprecision(x) << y #define tr(x) cou... |
#include <bits/stdc++.h> int main() { int J, M; float QJ, QM; int i; scanf( %d , &J); scanf( %d , &M); i = 1; while (1) { J = J - i; if (J < 0) { printf( Vladik n ); break; } i++; M = M - i; if (M < 0) { printf( Valera n ); ... |
/*******************************************************************************
* 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 ... |
// megafunction wizard: %GPIO Lite Intel FPGA IP v18.0%
// GENERATION: XML
// alt_ddr.v
// Generated using ACDS version 18.0 614
`timescale 1 ps / 1 ps
module alt_ddr (
input wire outclock, // outclock.export
input wire [1:0] din, // din.export
output wire [0:0] pad_out // pad_out.export
)... |
#include <bits/stdc++.h> using namespace std; const int MAX_VALUE = 32768; struct Tokenizer { string input; int at; void tokenize(const string& s) { input = s + @ ; at = 0; token = ; } char nextChar() { return input[at]; } char nextNoneSpace() { while (nextChar()... |
`define ADDER_WIDTH 032
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
//
// 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)
// ... |
//#############################################################################
//# Function: 5:1 one hot mux #
//#############################################################################
//# Author: Andreas Olofsson #
... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_sync_flops.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int arr[1009]; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &arr[i]); int x1, y1, x2, y2; for (int i = 0; i < n - 1; i++) { x1 = min(arr[i], arr[i + 1]); y1 = max(arr[i], arr[i + 1]); for (int j =... |
#include <bits/stdc++.h> using namespace std; int A[10010]; int B[10010]; bool check(int st, int ed) { int mx = st; for (int i = st; i <= ed; i++) { if (A[i] > A[mx]) { mx = i; } if (A[i] == A[mx]) { if (st <= i - 1 && A[i - 1] < A[i]) mx = i; if (i + 1 <= ed &&... |
#include <bits/stdc++.h> using namespace std; const int N = 1000 * 100 + 10; int par[N], n, m, c; unordered_map<int, int> adj[N]; unordered_set<int> adj1[N]; int getPar(int root) { return par[root] == par[par[root]] ? par[root] : par[root] = getPar(par[root]); } ... |
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015
// Date : Sun Aug 28 08:25:18 2016
// Host : fpgaserv running 64-bit Ubuntu 14.04.4 LTS
... |
#include <bits/stdc++.h> using namespace std; inline long long read() { char ch = getchar(); long long x = 0; int op = 1; for (; !isdigit(ch); ch = getchar()) if (ch == - ) op = -1; for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 0 ; return x * op; } inline void write(long ... |
#include <bits/stdc++.h> using namespace std; int n; char s[50001]; int last[26][50001]; int best[51][50001]; bool prv[51][50001]; void print(int i, int j, int k) { int len = 2 * i + (k != -1 ? 1 : 0); char ans[101]; ans[len] = 0 ; if (k != -1) ans[i] = s[k]; while (j != 0) { i... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module fast_spi_rx
#(
parameter BASEADDR = 16'h0... |
#include <bits/stdc++.h> const int oo = 1073741819; using namespace std; int f[200][500], n, t[500], w[500]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> t[i] >> w[i]; memset(f, 61, sizeof(f)); f[0][0] = 0; for (int i = 1; i <= n; i++) for (int j = 0; j <= i * 2; j++) { ... |
#include <bits/stdc++.h> using namespace std; long long power(long long x, long long y, long long m); long long modInverse(long long n, long long m); long long nCr(long long n, long long r, long long m); long long ceiling(long long x, long long y); bool sortbyth(const tuple<long long, int, int>& a, ... |
#include <bits/stdc++.h> using namespace std; int main() { long int n, x, y, i, j; long double sum1 = 0, sum2 = 0, mini, maxi, p, z; cin >> n >> x >> y; long int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); mini = min(x, y); maxi = max(x, y); p = mini;... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { if (i >= (m - n % m)) cout << n / m + 1 << ; else cout << n / m << ; } return 0; } |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
/*
Filename: TopModule.v
Author: Duane Niles, Jason Thweatt, Danny Dutton
Date: 1 April 2015
Version: 2
Description: Top-Level module for synthesis.
Updated for use on the DE1-SoC platform.
*/
module TopModule(CLOCK_50, SW, KEY, HEX3, HEX2, HEX1, HEX0);
input CLOCK_50;
input [5:0] SW;
inpu... |
#include <bits/stdc++.h> using namespace std; const int N = 300005, M = 25; const long long p = 998244353ll; inline long long expo(long long a, int b = 998244351) { long long c = 1ll; while (b) { if (b & 1) c = c * a % p; b >>= 1; a = a * a % p; } return c; } long long FAC[... |
/**
* 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() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long int n; cin >> n; pair<long long int, long long int> a[n]; for (long long int i = 0; i < n; i++) cin >> a[i].first >> a[i].second; sort(a, a + n)... |
Require Import Coq.Lists.List.
Require Import Coq.Sets.Ensembles.
Import ListNotations.
From OakIFC Require Import
Lattice
Parameters
GenericMap
Lattice
Events
State.
From RecordUpdate Require Import RecordSet.
Import RecordSetNotations.
(* Ensembles don't have implicit type params and this li... |
module PHYctrl_Slave_MAX10 (
input CLOCK_50_MAX10,
input CLOCK_25_MAX10,
input [3: 0] USER_PB,
output [4: 0] USER_LED,
output [1:0] PMODA_IO,
output ENET_MDC,
inout ENET_MDIO,
// Ethernet A
output ENET0_RESET_N,
output ... |
#include <bits/stdc++.h> using namespace std; int M; const int MAX = 100001; vector<int> _size, marked, _pow, _ipow; vector<pair<int, int> > adjList[MAX + 1]; int getSize(int u, int p = -1) { _size[u] = 1; for (auto [v, w] : adjList[u]) if (v != p && !marked[v]) _size[u] += getSize(v, u); ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (lin64) Build Wed Dec 14 22:35:42 MST 2016
// Date : Sat Jan 21 14:33:05 2017
// Host : natu-OMEN-by-HP-Laptop running 64-bit Ubunt... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(0); long long n, h, k; cin >> n >> h >> k; vector<long long> mas(n); for (int i = 0; i < n; i++) cin >> mas[i]; long long time = 0, currVolume = 0; bool have = false; for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int x = 1; while (n > 0) { if (n == 3) { cout << x << << x << << 3 * x << ; break; } else { for (int i = 0; i < (n + 1) / 2; i++) { cout << x << ; } ... |
#include <bits/stdc++.h> using namespace std; int a[1005], b[1005]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } for (int i = 0; i < n; i++) { scanf( %d , &b[i]); } int ans = 0; for (int i = 0; i < n; i++) { int p = 0; ... |
/*
* Copyright (c) 2000 Steve 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)
* a... |
#include <bits/stdc++.h> using namespace std; int a[4], b[4], n, m; void f1() { a[0] = 0; b[0] = 1; a[1] = 0; b[1] = m; a[2] = 0; b[2] = 0; a[3] = 0; b[3] = m - 1; } void f2() { b[0] = 0; a[0] = 1; b[1] = 0; a[1] = n; b[2] = 0; a[2] = 0; b[3] = 0; ... |
#include <bits/stdc++.h> using namespace std; vector<long long> v; long long a, b; int main() { ios_base::sync_with_stdio(0); cin >> a >> b; while (true) { v.push_back(b); if (b % 10 == 1) { b--; b /= 10; } else if (b % 2 == 0) { b /= 2; } else { ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1000000 + 20; int used[MAX_N]; int a[MAX_N]; int n, k; int main() { ios::sync_with_stdio(false); cin >> n >> k; for (int i(0); i < int(n); i++) { int x; cin >> x; ++used[x]; } int sum = 0; for (int i = ... |
/*
* This demonstrates a basic dynamic array
*/
module main;
byte foo[];
int idx;
initial begin
if (foo.size() != 0) begin
$display("FAILED -- foo.size()=%0d, s.b. 0", foo.size());
$finish;
end
foo = new[10];
if (foo.size() != 10) begin
$display("FAILED -- foo.size()=%0d, s.... |
#include <bits/stdc++.h> using namespace std; char a[200000], b[200000]; int kmp[200000]; int n, m, i, j, first, curr, val[200000], l; int dyn[200000]; int sum[200000]; int MOD = 1000000007; int main(void) { cin >> b >> a; n = strlen(a); m = strlen(b); kmp[0] = 1; if (n == 1) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000; int ans[N], l[N], r[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> l[i]; } for (int i = 0; i < n; ++i) { cin >> r[i]; } fo... |
`timescale 1ns/1ps
module test_spi_master;
reg clk;
reg spi_tx_rd_en_256;
reg spi_rx_rd_en_256;
reg spi_rd_rst_256;
reg mode_rd_select_256;
wire sm_rd_sck_256;
wire sm_rd_mosi_256;
wire sm_rd_miso_256;
wire sm_rd_cs_n_256;
wire spi_receive_rd_status_256;
spi_ctrl_reduced #(.DATA_LENGTH(256)) spi_ctrl_reduced_inst... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_dtl_rpt.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... |
//----------------------------------------------------------------
//-- Inicializador
//-- (c) BQ. August 2015. Written by Juan Gonzalez (obijuan)
//-- GPL license
//----------------------------------------------------------------
//-- Generacion de una señal escalo (0 -> 1) para inicializar
//-- circuitos digitales
//... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, m, a, b, count = 0; ; cin >> n >> m; while (cin >> a >> b) { if (a == 1 || b == 1) { count++; } } cout << count; } signed main() { long long test = 1; while (test--) { solve(); ... |
#include <bits/stdc++.h> using namespace std; double dp[105][105][105]; void solve(int r, int s, int p) { double _r = 0, _s = 0, _p = 0; for (int i = r; i >= 0; i--) { for (int j = s; j >= 0; j--) { for (int k = p; k >= 0; k--) { double tot = i * j + j * k + k * i; if ((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... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 20; int a[105]; int u[105], res[105]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { scanf( %d , &a[i]); } int pos = a[0], ans = 1; while (ans < m) { if (a[ans] > pos) { ... |
#include <bits/stdc++.h> int main() { int n, i, j, c = 0, p, q, f = 0; scanf( %d , &n); scanf( %d , &p); int a[p]; for (i = 0; i < p; i++) scanf( %d , &a[i]); scanf( %d , &q); int b[q]; for (i = 0; i < q; i++) scanf( %d , &b[i]); for (i = 1; i <= n; i++) { f = 0; for (j... |
// Hybrid PWM / Sigma Delta converter
//
// Uses 5-bit PWM, wrapped within a 10-bit Sigma Delta, with the intention of
// increasing the pulse width, since narrower pulses seem to equate to more noise
module hybrid_pwm_sd
(
input clk,
input n_reset,
input [15:0] din,
output dout
);
reg [4:0] pwmcounter;
reg [4: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... |
module iq_comp (
input clk, RESETn,
input freeze_iqcomp, //Should come from Start Signal FSM, freezes W values when on
input [1:0] op_mode,
input [3:0] Ix, Qx,
input signed [12:0] Wr_in, Wj_in, //Externally supplied W, used when op_mode = EXT_W
output reg signed [3:0] Iy, Qy, //Rotated and compensated IQ
//... |
// megafunction wizard: %RAM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ip_ram.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module rec_sync #(
parameter ... |
#include <bits/stdc++.h> using namespace std; const int N = 100009; vector<int> edges[N]; vector<int> a; int n, m; int main() { while (cin >> n >> m) { a.clear(); for (int i = 1; i <= n; ++i) edges[i].clear(), a.push_back(i); for (int i = 0; i < m; ++i) { int ac, b; cin... |
/*
* Next state calculation for fetch FSM
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software
* Foundation;... |
#include <bits/stdc++.h> using namespace std; long long inf; const double eps = 1e-8; const double pi = acos(-1.0); template <class T> long long chkmin(T &a, T b) { return a > b ? a = b, 1 : 0; } template <class T> long long chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; } template <clas... |
// megafunction wizard: %RAM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: disk02.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =================... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 08:56:21 04/12/2015
// Design Name:
// Module Name: Voter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
#include <bits/stdc++.h> using namespace std; int n, m; set<int> nx[1000100]; vector<pair<int, int> > nw; int a[1000100]; vector<pair<int, int> > ans; set<pair<int, int> > order; set<pair<int, int> > lst; int main() { ios_base ::sync_with_stdio(0); cin.tie(); cout.tie(); srand(23095); ... |
/*
Copyright (c) 2015 Alex Forencich
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 the rights
to use, copy, modify, merge, publish, distribute,... |
#include <bits/stdc++.h> using namespace std; const long double PI = acos(-1.0); const long double EPS = 1e-12; const int MAXN = (int)1e5; const int INF = (int)2e9; int main() { int n, a[100]; scanf( %d , &n); for (int i = 0; i < n; ++i) scanf( %d , &a[i]); int ans = INF; for (int i = 0;... |
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * Copyright INRIA, CNRS and contributors *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(* \VV/ *********... |
#include <bits/stdc++.h> using namespace std; void getre() { int x = 0; printf( %d n , 1 / x); } void gettle() { int res = 1; while (1) res <<= 1; printf( %d n , res); } template <typename T, typename S> inline bool upmin(T &a, const S &b) { return a > b ? a = b, 1 : 0; } templ... |
/**
* 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 File() { freopen( output.txt , w , stdout); freopen( input.txt , r , stdin); } void yAsEr_HaFiz() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}; int dy[] = {1, -1, 0, 0, -1, 1,... |
#include <bits/stdc++.h> using namespace std; int n; string s; int dp[510][510]; bool has[510][510][30]; int dfs(int l, int r) { if (l >= r) return 0; int &ans = dp[l][r]; if (ans != 0) return ans; if (!has[l + 1][r][s[l] - a ]) return ans = dfs(l + 1, r); ans = dfs(l + 1, r); 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; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string x, y; cin >> x >> y; int n, m; n = x.size(), m = y.size(); if (n != m) { cout << NO ; return 0; } if (n == 1) { if (x == y) cout... |
interface my_interface ();
logic [2:0] out2;
logic [2:0] out3;
endinterface: my_interface
module foobar (input [2:0] in2, output [2:0] out2);
endmodule
module foo_autowire_fails (my_interface itf);
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire [2:0] out2... |
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 5; long long a[N], dp[N]; long long n, k; long long check(long long m) { for (int i = 0; i < n; i++) { dp[i] = i - 1; for (int j = 0; j < i; j++) { if (abs(a[i] - a[j]) <= 1ll * (i - j) * m) { dp[i] = min(dp[i]... |
#include <bits/stdc++.h> using namespace std; int root, n; vector<int> mp[200605]; int Dfs(int u, int from) { set<int> s; for (int i = 0; i < mp[u].size(); i++) { int v = mp[u][i]; if (v == from) continue; int tmp = Dfs(v, u); if (tmp == -1) return -1; s.insert(tmp + 1); ... |
#include <bits/stdc++.h> using namespace std; long long n, mod = 1e9 + 7ll, cont, maxi = 1000000000000ll, cont2, val[400005], ans, bestval = 1000000000000ll; pair<long long, long long> dp[400005], num, ft[400005]; pair<int, int> v[400005]; map<int, int> ind; vector<int> opz[400005], tmp; vo... |
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> t >> s; set<char> b(t.begin(), t.end()); int n; cin >> n; for (int k = 0; k < n; ++k) { cin >> t; int i = 0; int j = 0; while (i < s.size() || j < t.size()) { if (s[i] == ? ) { ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* 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... |
//==================================================================================================
// Filename : antares_branch_unit.v
// Created On : Fri Sep 4 21:35:54 2015
// Last Modified : Sat Nov 07 11:49:10 2015
// Revision : 1.0
// Author : Angel Terrones
// Company : Universi... |
// (c) Copyright 1995-2015 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (n == 1 && m == 1) cout << 1; else if (m + n < 5) cout << -1; else { int x = n * m / 2 + 1, y = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if ((i +... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) #pragma GCC optimization( unroll-loops ) using namespace std; const long long MAX = 1000004; const long long INF = 1e18L + 5; template <class T, class U> void chmin(T &t, const U &u) { if (t > u) t = u; } t... |
#include <bits/stdc++.h> using namespace std; int n, m, OO = 1e8; int dp[100001]; int solve(int x) { if (x <= 0 || x > 1e5) return OO; if (x == m) return 0; int &ret = dp[x]; if (ret != -1) return ret; ret = OO; if (x > m) ret = min(ret, 1 + solve(x - 1)); else { ret = mi... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e6; int q, lstAns, flag; long long m; struct point { long long x, y; point(long long x, long long y) : x(x), y(y) {} inline bool operator<(const point &a) const { if (flag) return y < a.y; return x < a.x; } inline p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.