text stringlengths 59 71.4k |
|---|
/**
* 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 __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... |
`timescale 1ns / 1ps
//this code was generated by cReComp
module sensor_ctl(
input [0:0] clk,
input rst_32,
input [31:0] din_32,
input [0:0] wr_en_32,
input [0:0] rd_en_32,
output [31:0] dout_32,
output [0:0] full_32,
output [0:0] empty_32,
input [0:0] SPI_DI_a,
output [0:0] SPI_SS_a,
output [0:0] SPI_CK_a,
output [0:... |
// Ken Eguro
// Alpha version - 2/11/09
// Version 1.0 - 1/4/10
// Version 1.0.1 - 5/7/10
// Version 1.1 - 8/1/11
`timescale 1ns / 1ps
`default_nettype none
module fifo36Wrapper(
input wire writeClk,
input wire [35:0] writeData,
input wire writeEnable,
output wire full,
input wire readClk,
... |
#include <bits/stdc++.h> using namespace std; int const bound = 2e6 + 2, N = 5e5 + 2; long long OO = 1e18; double eps = 1e-6; int oo = 1e9, mod = oo + 7; pair<int, int> can[101]; bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) { if (a.first.first != b.first.first) return a.first.fir... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Miguel Angel Rodriguez Jodar
//
// Create Date: 15:18:53 03/06/2015
// Design Name: SAM Coupé clone
// Module Name: ps2_keyb
// Project Name: SAM Coupé cl... |
module microfono
(
input reset,
output ledres,
input clk,
output mclk,
output reg micLRSel,
input micData,
output ampPWM,
output ampSD,
input rd,wr,
output empty,
output full,
output reg done
);
wire [7:0] dout;
wire [7:0] dout1;
wire ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: coffee.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
/**
* 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 n; char a[440000], b[440000]; int cnta = 0, cntb = 0; int df[440000] = {0}; int czl[440000], czr[440000]; int zz1 = 0, zz2 = 0; int ab[440000] = {0}, ba[440000] = {0}; int ans = 0; int main() { cin >> n; cin >> a >> b; for (int i = 0; i <... |
`timescale 1ns/1ns
module top;
wire q;
reg a, b;
initial begin
// $dumpfile("test.lx2"); // Need to also use the -lxt2 flags on exe.
// $dumpvars(0, top);
// Initial value should be X is 1.
#1 a = 1'b1; // Should be X is 1.
#1 if (q !== 1'bx) begin
$d... |
#include <bits/stdc++.h> using namespace std; long long power(long long x, unsigned long long y, unsigned long long m) { if (y == 0) return 1; long long p = power(x, y / 2, m) % m; p = (p * p) % m; return (y % 2 == 0) ? p : (x * p) % m; } int32_t main() { ios_base::sync_with_stdio(false); ... |
// -- (c) Copyright 2009 - 2011 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... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2010 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 11.... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int T; cin >> T; while (T--) { int n; cin >> n; cout << n / 2 << n ; } } |
#include <bits/stdc++.h> using namespace std; const int oo = 1e9 + 9; const long long inf = 1e18 + 18; const int max6 = 1e6 + 6; const int modx = 1e9 + 7; const int mody = 997; const int base = 137; int n, m; int cnt[max6], a[max6], tmp[max6]; int f[3][1005][1005]; int b[3][1005][1005]; int Pow(... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n; cin >> n; long long a[n]; for (int i = 0; i < n; ++i) { a[i] = i + 1; } long long ans = 0; long long i = 1, j = 1, k = 2; for (in... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 3e5 + 100; int t, T, n, k; int A[maxn]; int B[maxn]; int main() { ios::sync_with_stdio(false); cin >> T; while (T--) { cin >> n; int sum = 0; for (int i = 1; i <= n; i++) { cin >> ... |
/**
* 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 ; # define all(v) (v).begin() , (v).end() # define allrev(v) (v).rbegin() , (v).rend() # define allcomp(v) (v).begin() , (v).end() , comp # define ll long long # define line cout << n ; # define fast ios_base :: sync_with_stdio ( false ) ; cin.tie ( ... |
/**
* 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::sync_with_stdio(false); int n, m; cin >> n >> m; vector<int> v[n + 1]; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; v[a].push_back(b); } int cnt[n + 1]; for (int o = 1; o <= n; o++) { fo... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_a_e
//
// Generated
// by: wig
// on: Mon Sep 25 09:53:03 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls
//
// !!! Do not edit this file! Autogenerated by MIX !... |
/* testcase */
/**
generate this input file:
$ cat t.in
$
expected output in t.out:
$ cat t.out
# x =
# x =
# x =
0
Icarus Verilog output in t.out:
$ cat t.out
# x =
# x =
# x =
0
0
*/
module testbench;
parameter WIDTH = 33;
reg clk;
reg [WIDTH-1:0] in;
reg [WIDTH-1:0] ... |
#include <bits/stdc++.h> using namespace std; const int N = 400000 + 5; int n, m, tr[N << 2][3], q; set<int> ssp[N][2]; void modify(int x, int who, int v, int l = 1, int r = n, int k = 1) { if (l == r) { if (ssp[l][who].count(v)) ssp[l][who].erase(v); else ssp[l][who].insert(v)... |
module visualizacion (
input clk,
input ECHO,
input orden,
output trigg,
output [3:0] anodo,
output [6:0] seg
);
wire [7:0] d;
wire [7:0] distancia;
wire [1:0] mostrar;
wire [3:0] digito;
wire [3:0] anodo;
wire [6:0] seg;
wire [3:0] centenas;
wire [3:0] decenas;
wire [3:0] ... |
`timescale 1ns / 1ps
module spi #(
parameter clk_divisor=8 // SCLK shall be this many
// times slower than CLK;
// can only be an even number.
)
(
input clk, // Processor clock
input rst, // Processo... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
/... |
/**
* 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... |
/**
* ff_d.v - Microcoded Accumulator CPU
* Copyright (C) 2015 Orlando Arias, David Mascenik
*
* 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
* ... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is dis... |
#include <bits/stdc++.h> using namespace std; int v[3 * 100001]; int main() { int n; long long s = 0; cin >> n; for (int i = 1; i <= n; ++i) { cin >> v[i]; } sort(v + 1, v + n + 1); for (int i = 1; i <= n / 2; ++i) { s += (v[i] + v[n - i + 1]) * (v[i] + v[n - i + 1]); }... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/16/2017 04:17:39 PM
// Design Name:
// Module Name: top_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Rev... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:23:37 11/08/2015
// Design Name:
// Module Name: Integradorv2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
#include <bits/stdc++.h> using namespace std; bool visited[2000]; vector<int> G[2000]; vector<int> parent; int dfs(int u) { if (visited[u]) { return 0; } visited[u] = true; int ans = 0; for (int i = 0; i < G[u].size(); i++) { ans = max(ans, dfs(G[u][i])); } return ans +... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; scanf( %d%d%d , &a, &b, &c); int n = a * c - b * c; if (n % b > 0) printf( %d n , n / b + 1); else printf( %d n , n / b); 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; int n, g[20][20], r, c, k, ans = 0, x, y; bool chk(int a, int b, int c, int d) { int cnt = 0; for (int i = a; i <= a + c; i++) { for (int j = b; j <= b + d; j++) { cnt += g[i][j]; if (cnt >= k) return 1; } } return 0; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 100; int t, cnt[N]; int mx; int check(int row, int col, int n, int m) { if (row < 0 || row >= n || col < 0 || col >= m) return 0; int i = 0, j = 0, ok = 1; for (; i < n; i++) { for (j = 0; j < m; j++) { if (!cnt[abs(ro... |
/**
* 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 = 2e5 + 51; int n, x; int res[MAXN]; inline int read() { register int num = 0, neg = 1; register char ch = getchar(); while (!isdigit(ch) && ch != - ) { ch = getchar(); } if (ch == - ) { neg = -1; ch = getchar... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 9223000000000000000; struct DATA { long long v; long long c; long double p; }; long long n, l; DATA data[31]; bool cmp(DATA x, DATA y) { return x.p < y.p; } void init() { scanf( %lld%lld , &n, &l); for (int i = 1; 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... |
/*
VGA Demo 800x480 at 58Hz
The screen I'm using
http://www.amazon.co.uk/gp/product/B00IR5VRS4?psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s01
http://www.adafruit.com/datasheets/KD50G21-40NT-A1.pdf
if these timings fail, try http://www.adafruit.com/datasheets/AT070TN94.pdf
Pixel Clock (MHz): 30.000
Horizontal (... |
#include <bits/stdc++.h> using namespace std; int fastpow(int a, int b) { int ans = 1; for (; b; b >>= 1, a = a * a) if (b & 1) ans = ans * a; return ans; } int num; int main() { int n; scanf( %d , &n); string a; cin >> a; for (int i = 0; i < a.length(); i++) n += (a[i] -... |
// megafunction wizard: %RAM: 3-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: alt3pram
// ============================================================
// File Name: IMG_TRI_BUFFER.v
// Megafunction Name(s):
// alt3pram
//
// Simulation Library Files(s):
// altera_mf
// =================... |
#include <bits/stdc++.h> using namespace std; const int mxn = 1e5 + 100; int a[mxn], b[mxn], c[mxn]; set<int> mp; void add(int x) { if (c[x] == 0) mp.insert(b[x]); else if (c[x] == 1) mp.erase(b[x]); c[x]++; } void remove(int x) { if (c[x] == 2) mp.insert(b[x]); else ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5, maxk = (1 << 20), inf = 1e9; int dp[maxk][2]; int ind[20]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m, k; cin >> n >> m >> k; string a, b; cin >> a >> b; int c = 0, d =... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin >> n; int sum1 = 0, sum2 = 0, sum3 = 0; int flag1 = 1, flag2 = 0, flag3 = 0; for (int i = 1; i <= n; i++) { int a; cin >> a; if (flag1) { sum1 += a; flag1 = 0;... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr[n]; map<long long, int> mp; vector<long long> summer(n); for (int i = 0; i < n; i++) { int m; cin >> m; int tmp; long long sum = 0; for (int j = 0; j < m; j++) { ... |
module Sec4(
input A,
input B,
input C,
input AnalogLDir,
input AnalogRDir,
output Len,
output Ldir,
output Ren,
output Rdir
);
wire Z_A;
wire Z_B;
wire Z_C;
wire Ldir_int;
wire Len_int;
wire Rdir_int;
wire Ren_int;
wire Analog_select;
supply0 GND;
assign Analog_select =... |
#include <bits/stdc++.h> using namespace std; int main() { int l, r; scanf( %d%d , &l, &r); if (l == r && l % 2) printf( %d , l); else printf( %d , 2); } |
#include <bits/stdc++.h> using namespace std; int S, l[100], r[100], N, w[200]; double a[100], b[100], f[100][100], ans[100]; void init() { scanf( %d , &N); for (int i = 1; i <= N; i++) scanf( %d%d , &l[i], &r[i]), w[++S] = l[i], w[++S] = r[i]; } void calc(int p, int L, int R) { int t = 0,... |
/*
Copyright (c) 2021 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> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; double eps = 1e-10; const int maxn = 30005; char s[105][105]; int num[105][105], ans[105]; int main() { ios::sync_with_stdio; cin.tie(0); double a, b, c, d; cin >> a >> b >> c >> d; doub... |
#include <bits/stdc++.h> using namespace std; pair<pair<bool, long double>, string> a[13]; bool comp(pair<pair<bool, long double>, string> a, pair<pair<bool, long double>, string> b) { auto t1 = a.first, t2 = b.first; if (t1.first != t2.first) return t1.first; if (abs(t1.second - t2.second... |
#include <bits/stdc++.h> using namespace std; const char *par = () ; const int pm[] = {1, -1}; int n; int mn, res, fir; string s; vector<int> v, w; map<int, int> mp; int init(string s) { v = vector<int>(n); for (int i = 0, pre = 0; i < n; ++i) { v[i] = (pre += pm[strchr(par, s[i]) - par... |
// (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; const int maxn = 1e5 + 10, mod = 1e9 + 7; const long long inf = 1e18; long long tn[20], fv[20]; long long Mul(long long a, long long b, long long md) { long long ans = 0; while (b) { if (b & 1) ans = (ans + a) % md; a = (a + a) % md; b >>... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, kol = 0; vector<int> a, b; cin >> n; for (i = 0; i < n; i++) { cin >> j; a.push_back(j); b.push_back(j); } sort(b.begin(), b.end()); for (i = 0; i < n; i++) if (a[i] != b[i]) kol++; if (ko... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* PL allocator
*
*
*/
module LAG... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 21; const long long MOD = 1000000007; int n; long long m; long long C[MAXN][MAXN]; long long g[MAXN], s[MAXN], ten[MAXN], eight[MAXN]; inline void update(long long& x, long long y) { y %= MOD, x += y, x %= MOD; } inline long long P(const l... |
/**
* 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; long long n, k, res = 1; long long a[100005]; long long b[100005]; long long d = 1, ans; int main() { cin >> n >> k; for (int i = 0; i < k; i++) d *= 10; for (int i = 0; i < n / k; i++) cin >> a[i]; for (int i = 0; i < n / k; i++) cin >> b[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... |
module top;
parameter parm = 1;
parameter name0_s = 1; // signal
wire [1:0] out;
/***********
* Check signals
***********/
// Check signal/parameter name issues.
wire name0_s;
// Check signal/genvar name issues.
genvar name0_v;
generate
for (name0_v = 0; name0_v < 2; name0_v = name0_v + ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 55; int n, l; int a[maxn], b[maxn]; bool check(int d, int x, int y) { int i = x + 1, j = y + 1; i %= n; j %= n; while (i != x && j != y) { if ((a[i] - b[j] + l) % l == d) { i++; i %= n; j++; j ... |
// niosii_nios2_gen2_0.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module niosii_nios2_gen2_0 (
input wire clk, // ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1025; long long p[MAX_N]; int main() { long long s, n, sum = 0; scanf( %lld%lld , &n, &s); for (int i = 1; i <= n; ++i) scanf( %lld , &p[i]), sum += p[i]; sort(p + 1, p + 1 + n); if (sum < s) { printf( -1 n ); return... |
#include <bits/stdc++.h> using namespace std; string s; int main() { long long k, d, t; scanf( %lld %lld %lld , &k, &d, &t); if (k % d == 0) { printf( %.10lf n , (double)t); return 0; } t *= 2; long long period = (k / d + 1) * d; long long periodPoints = 2 * k + period - k;... |
#include <bits/stdc++.h> using namespace std; int num[200000]; long long cnt[200000] = {0}; long long dp[200000] = {0}; long long sum[200000] = {0}; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> num[i]; cnt[num[i]]++; } long long ans = 0; for (int i =... |
/*
* Copyright (c) 2013, Quan Nguyen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditi... |
`timescale 1ns / 1ps
module Controlador_Gato(
clk,
reset_all,
reset_game,
cuadro,
vertical,
horizontal,
cruzada,
state,
boton_arriba_reg, boton_abajo_reg, boton_izq_reg, boton_der_reg, boton_elige_reg,
turno_p1_wire, turno_p2_wire,
win_game_wire, //Gana Jugador 2
loss_game_wir... |
`timescale 1ps/1ps
module sim_fsusb_foot
(inout dp,
inout dm);
localparam HALFBIT = 41667;
localparam BIT = 83333;
reg vp_noise_inject;
reg vm_noise_inject;
reg vm_noise, vp_noise;
integer delay_amount;
initial begin
vp_noise = 1'b0;
vp_noise_inject = 1'b0;
#1_200_000_000;
forever begin
vp_noise = ~vp... |
#include <bits/stdc++.h> clock_t t = clock(); namespace my_std { using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline T rnd(T l, T r) { return uniform_int_distribution<T>(l, r)(rng); } template <typename T> inline bool chkmax(T& 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 main() { int n, m, k; cin >> n >> m >> k; int a[m], b[k], c[105] = {0}; for (int i = 0; i < m; i++) { cin >> a[i]; } for (int i = 0; i < k; i++) { cin >> b[i]; } for (int i = 0; i < m; i++) { c[a[i]] = 1; } f... |
module top;
parameter le0 = 1'b0 <-> 1'b0; // 1'b1
parameter le1 = 1'b0 <-> 1'b1; // 1'b0
parameter le2 = 1'b0 <-> 1'bz; // 1'bx
parameter le3 = 1'b0 <-> 1'bx; // 1'bx
parameter le4 = 1'b1 <-> 1'b0; // 1'b0
parameter le5 = 1'b1 <-> 1'b1; // 1'b1
parameter le6 = 1'b1 <-> 1'bz; // 1'bx
parameter le7 = 1'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... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; inline int read() { int s = 0, w = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { s = s * 10 + ch - 0 ; ch = getchar();... |
#include <bits/stdc++.h> using namespace std; pair<double, double> p[100100]; double dt[100100]; double db[100100]; double da[100100]; int main() { double ax, ay, bx, by, tx, ty; int n; cin >> ax >> ay >> bx >> by >> tx >> ty; cin >> n; double ans = 0; scanf( %lf %lf , &p[0].first, &... |
#include <bits/stdc++.h> using namespace std; long double a[100009][2]; long double maxi(long double a, long double b) { if (a > b) return a; else return b; } bool solve(long double mid, int n, long double p) { long double req = 0; for (int i = 0; i < n; i++) { req += maxi(0.... |
#include <bits/stdc++.h> using namespace std; vector<int> tmp; vector<vector<int>> sol[4]; int lov[7][7]; int hero(string s) { if (s == Troll ) return 0; if (s == Dracul ) return 1; if (s == Anka ) return 2; if (s == Snowy ) return 3; if (s == Hexadecimal ) return 4; if (s == Cha... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long f = n * (n - 1) * (n - 2) * (n - 3) * (n - 4); cout << (f / 120) * ((n * n) - (4 * n) + 37) / 42; return 0; } |
#include <bits/stdc++.h> using namespace std; int arr[30001]; int main() { int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> arr[i]; } int dp1 = arr[1]; int dp2 = 0; bool fail = 0; for (int i = 2; i < n; i++) {... |
// This module generate enable and two-bit selector for verifying a 2-to-4 decoder
module stimulus #(parameter M = 8, T = 10) (
output reg [1:0] sel,
output reg en
);
bit [2:0] i;
initial begin
sel = 0;
en = 1'bx;
#T;
sel = 1;
#T;
sel = 2;
#T;
sel = ... |
/**
* 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; char IO; inline long long rd() { long long res = 0, f = 1; while (IO = getchar(), IO < 48 || IO > 57) if (IO == - ) f = 0; do res = (res << 3) + (res << 1) + (IO ^ 48); while (IO = getchar(), IO >= 48 && IO <= 57); if (f) return res; ret... |
//
// 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 main() { int i, j, k, l, ans = 0, sign = 1, count = 0; string s; getline(cin, s); l = s.size(); vector<int> v; for (i = 0; i < l; i++) { if (s[i] == ? ) { v.push_back(sign); sign == 1 ? count++ : count--; } else i... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// vg93 interface
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify it under the terms of
the GNU General Public L... |
#include <bits/stdc++.h> using namespace std; void swap(int &a, int &b) { int temp; temp = a; a = b; b = temp; } void printarr(int a[], int n) { for (int i = 0; i < 2 * n; i++) cout << a[i] << ; cout << endl; } int main() { long long int n, k, v; cin >> n; int a[2 * n]... |
#include <bits/stdc++.h> using namespace std; void fastIO() { ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(10); cout.tie(nullptr); cin.tie(nullptr); } template <class T> T power(T N, T P) { return (P == 0) ? 1 : N * power(N, P - 1); } template <class T> ... |
// Check behaviour with out-of-range and undefined array indices
// on LHS of blocking procedural assignment.
module top;
reg array1[2:1];
reg array2[1:0];
`ifndef VLOG95
real array3[2:1];
real array4[1:0];
`endif
integer index;
reg failed;
initial begin
failed = 0;
array1[1] = 1'b0;
array1[2] = 1'b0;
a... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000006; const long long MOD = 1000000007; struct Query { int a, t, x, id; } query[MAXN]; map<int, int> cnt; int n, ans[MAXN], qcnt; void solve(int l, int r) { ; if (l != r - 1) { int mid = (l + r) >> 1; solve(l, mid)... |
// 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 : Thu Aug 25 17:33:50 2016
// Host : fpgaserv running 64-bit Ubuntu 14.04.4 LTS
... |
#include <bits/stdc++.h> using namespace std; bool isPrime(long long int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (long long int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } ... |
/*
* 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 int N = 1e6, mod = 1e9 + 7, inf = 1e10; long long int a[N], dp[N]; int main() { long long int n, mn = 0, mx = -1, ans_1 = 0, ans_2 = 0, cnt, clk, clr; cin >> n; for (long long int i = 1; i * i * i <= n; i++) { if (n % i == 0) { ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.